summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Vidal <skvidal@fedoraproject.org>2010-02-10 15:51:08 -0600
committerClark Williams <williams@redhat.com>2010-02-10 15:51:08 -0600
commit716d41a0090047c3e943d102537b87d86fdcbe88 (patch)
tree0c25dd450ded9f96c438bcdbd7cb5bad1ae4a471
parent4f049ba3ba1964477e078f8799d28e92c9fb2e6c (diff)
downloadmock-716d41a0090047c3e943d102537b87d86fdcbe88.tar.gz
mock-716d41a0090047c3e943d102537b87d86fdcbe88.tar.xz
mock-716d41a0090047c3e943d102537b87d86fdcbe88.zip
add configuration option to run createrepo on result rpms
Added patch from Seth Vidal <skvidal@fedoraproject.org> to automatically run createrepo on the generated rpms Signed-off-by: Seth Vidal <skvidal@fedoraproject.org> Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r--etc/mock/site-defaults.cfg4
-rw-r--r--mock.spec.in1
-rwxr-xr-xpy/mock.py7
3 files changed, 12 insertions, 0 deletions
diff --git a/etc/mock/site-defaults.cfg b/etc/mock/site-defaults.cfg
index 0ee2082..6da9290 100644
--- a/etc/mock/site-defaults.cfg
+++ b/etc/mock/site-defaults.cfg
@@ -45,6 +45,10 @@
# config_opts['cleanup_on_success'] = 1
# config_opts['cleanup_on_failure'] = 1
+# if you want mock to automatically run createrepo on the rpms in your
+# resultdir.
+# config_opts['createrepo_on_rpms'] = True
+
#############################################################################
#
# plugin related. Below are the defaults. Change to suit your site
diff --git a/mock.spec.in b/mock.spec.in
index 8b91b40..fe739fe 100644
--- a/mock.spec.in
+++ b/mock.spec.in
@@ -19,6 +19,7 @@ URL: http://fedoraproject.org/wiki/Projects/Mock
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: python >= 2.4, yum >= 2.4, tar, gzip, python-ctypes, python-decoratortools, usermode
+Requires: createrepo
Requires(pre): shadow-utils
BuildRequires: python-devel
diff --git a/py/mock.py b/py/mock.py
index f4794ac..eea493c 100755
--- a/py/mock.py
+++ b/py/mock.py
@@ -227,6 +227,7 @@ def setup_default_config_opts(config_opts, unprivUid):
config_opts['cleanup_on_success'] = 1
config_opts['cleanup_on_failure'] = 1
+ config_opts['createrepo_on_rpms'] = True
# (global) plugins and plugin configs.
# ordering constraings: tmpfs must be first.
# root_cache next.
@@ -378,6 +379,12 @@ def do_rebuild(config_opts, chroot, srpms):
if config_opts["cleanup_on_success"]:
log.info("Cleaning up build root ('clean_on_success=True')")
chroot.clean()
+
+ if config_opts["createrepo_on_rpms"]:
+ log.info("Running createrepo on binary rpms in resultdir")
+ cmd = ['/usr/bin/createrepo', '-d', '-q', '-x', '*.src.rpm', chroot.resultdir]
+ mock.util.do(cmd)
+
except (Exception, KeyboardInterrupt):
elapsed = time.time() - start
log.error("Exception(%s) Config(%s) %d minutes %d seconds"