summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mock.patch52
-rw-r--r--mock.spec10
2 files changed, 62 insertions, 0 deletions
diff --git a/mock.patch b/mock.patch
new file mode 100644
index 0000000..e6fe85d
--- /dev/null
+++ b/mock.patch
@@ -0,0 +1,52 @@
+diff -up mock-1.1.9/py/mock.py.orig mock-1.1.9/py/mock.py
+--- mock-1.1.9/py/mock.py.orig 2011-02-18 22:18:59.000000000 +0100
++++ mock-1.1.9/py/mock.py 2011-04-21 10:22:04.599771253 +0200
+@@ -253,8 +253,8 @@ def setup_default_config_opts(config_opt
+
+ # cleanup_on_* only take effect for separate --resultdir
+ # config_opts provides fine-grained control. cmdline only has big hammer
+- config_opts['cleanup_on_success'] = 1
+- config_opts['cleanup_on_failure'] = 1
++ config_opts['cleanup_on_success'] = True
++ config_opts['cleanup_on_failure'] = True
+
+ config_opts['createrepo_on_rpms'] = False
+ config_opts['createrepo_command'] = '/usr/bin/createrepo -d -q -x *.src.rpm' # default command
+@@ -389,10 +389,6 @@ def set_config_opts_per_cmdline(config_o
+ % (i, config_opts['plugins']))
+ config_opts['plugin_conf']['%s_enable' % i] = True
+
+- if options.cleanup_after and not options.resultdir:
+- raise mock.exception.BadCmdline(
+- "Must specify --resultdir when using --cleanup-after")
+-
+ if options.mode in ("rebuild",) and len(args) > 1 and not options.resultdir:
+ raise mock.exception.BadCmdline(
+ "Must specify --resultdir when building multiple RPMS.")
+@@ -405,8 +401,9 @@ def set_config_opts_per_cmdline(config_o
+ config_opts['cleanup_on_success'] = True
+ config_opts['cleanup_on_failure'] = True
+
+- # cant cleanup unless separate resultdir
+- if not options.resultdir:
++ # cant cleanup unless resultdir is separate from the root dir
++ rootdir = os.path.join(config_opts['basedir'], config_opts['root'])
++ if mock.util.is_in_dir(config_opts['resultdir'] % config_opts, rootdir):
+ config_opts['cleanup_on_success'] = False
+ config_opts['cleanup_on_failure'] = False
+
+diff -up mock-1.1.9/py/mock/util.py.orig mock-1.1.9/py/mock/util.py
+--- mock-1.1.9/py/mock/util.py.orig 2011-02-18 22:18:20.000000000 +0100
++++ mock-1.1.9/py/mock/util.py 2011-04-21 10:21:59.005114748 +0200
+@@ -340,3 +340,11 @@ class ChildPreExec(object):
+ condChroot(self.chrootPath)
+ condDropPrivs(self.uid, self.gid)
+ condChdir(self.cwd)
++
++def is_in_dir(path, directory):
++ """Tests whether `path` is inside `directory`."""
++ # use realpath to expand symlinks
++ path = os.path.realpath(path)
++ directory = os.path.realpath(directory)
++
++ return os.path.commonprefix([path, directory]) == directory
diff --git a/mock.spec b/mock.spec
index 60d25fb..6212831 100644
--- a/mock.spec
+++ b/mock.spec
@@ -15,6 +15,10 @@ Release: 1%{?dist}
License: GPLv2+
Group: Development/Tools
Source: https://fedorahosted.org/mock/attachment/wiki/MockTarballs/%{name}-%{version}.tar.gz
+
+# https://bugzilla.redhat.com/668222
+Patch0: mock.patch
+
URL: http://fedoraproject.org/wiki/Projects/Mock
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -33,6 +37,9 @@ Mock takes an SRPM and builds it in a chroot
%prep
%setup -q
+%patch0 -p1 -b .orig
+
+
%build
%configure
make
@@ -115,6 +122,9 @@ fi
%attr(02775, root, mock) %dir /var/cache/mock
%changelog
+* Thu Apr 21 2011 Remi Collet <rpms@famillecollet.com> 1.1.9-1
+- Fix #688222 cleanup_on_success from config not honored
+
* Fri Feb 18 2011 Clark Williams <williams@redhat.com> - 1.1.9-1
- fix createrepo generated root-owned repository data (BZ# 668278)
- fix createrepo generated root-owned repository data (BZ# 668278)