Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 710780 Details for
Bug 799639
RFE: mock should backup result directory when clean
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
prototype for adding a backup mechanism
backup.patch (text/plain), 3.25 KB, created by
Clark Williams
on 2013-03-15 17:40:07 UTC
(
hide
)
Description:
prototype for adding a backup mechanism
Filename:
MIME Type:
Creator:
Clark Williams
Created:
2013-03-15 17:40:07 UTC
Size:
3.25 KB
patch
obsolete
>diff --git a/etc/mock/site-defaults.cfg b/etc/mock/site-defaults.cfg >index 9c44947..ec4feae 100644 >--- a/etc/mock/site-defaults.cfg >+++ b/etc/mock/site-defaults.cfg >@@ -49,6 +49,11 @@ > # config_opts['createrepo_on_rpms'] = False > # config_opts['createrepo_command'] = '/usr/bin/createrepo -d -q -x *.src.rpm' > >+# if you want mock to backup the contents of a result dir before clean >+# config_opts['backup_on_clean'] = False >+# config_opts('backup_base_dir'] = config_opts['basedir'] + "backup" >+ >+ > ############################################################################# > # > # plugin related. Below are the defaults. Change to suit your site >diff --git a/py/mock.py b/py/mock.py >index d01f85f..e9fb425 100755 >--- a/py/mock.py >+++ b/py/mock.py >@@ -273,6 +273,10 @@ def setup_default_config_opts(config_opts, unprivUid): > > config_opts['createrepo_on_rpms'] = False > config_opts['createrepo_command'] = '/usr/bin/createrepo -d -q -x *.src.rpm' # default command >+ >+ config_opts['backup_on_clean'] = False >+ config_opts['backup_base_dir'] = os.path.join(config_opts['basedir'], "backup") >+ > # (global) plugins and plugin configs. > # ordering constraings: tmpfs must be first. > # root_cache next. >diff --git a/py/mockbuild/backend.py b/py/mockbuild/backend.py >index 46069a4..a7ec220 100644 >--- a/py/mockbuild/backend.py >+++ b/py/mockbuild/backend.py >@@ -100,6 +100,9 @@ class Root(object): > self.online = config['online'] > self.internal_dev_setup = config['internal_dev_setup'] > >+ self.backup = config['backup_on_clean'] >+ self.backup_base_dir = config['backup_base_dir'] >+ > self.plugins = config['plugins'] > self.pluginConf = config['plugin_conf'] > self.pluginDir = config['plugin_dir'] >@@ -168,10 +171,25 @@ class Root(object): > raise mockbuild.exception.StateError, "alldone called with pending states: %s" % ",".join(self._state) > > decorate(traceLog()) >+ def backup_results(self): >+ srcdir = os.path.join(self.basedir, "result") >+ if not os.path.exists(srcdir): >+ return >+ dstdir = os.path.join(self.backup_base_dir, self.config_name) >+ mockbuild.util.mkdirIfAbsent(dstdir) >+ rpms = glob.glob(os.path.join(srcdir, "*rpm")) >+ if len(rpms) == 0: >+ return >+ self._state_log.info("backup_results: saving with cp %s %s" % (" ".join(rpms), dstdir)) >+ mockbuild.util.run(cmd="cp %s %s" % (" ".join(rpms), dstdir)) >+ >+ decorate(traceLog()) > def clean(self): > """clean out chroot with extreme prejudice :)""" > from signal import SIGKILL > self.tryLockBuildRoot() >+ if self.backup: >+ self.backup_results() > self.start("clean chroot") > self._callHooks('clean') > mockbuild.util.orphansKill(self.makeChrootPath()) >diff --git a/py/mockbuild/util.py b/py/mockbuild/util.py >index b32e1c5..107fa18 100644 >--- a/py/mockbuild/util.py >+++ b/py/mockbuild/util.py >@@ -410,6 +410,11 @@ def doshell(chrootPath=None, environ=None, uid=None, gid=None, cmd=None): > > > >+def run(cmd, isShell=True): >+ log = getLog() >+ log.debug("run: cmd = %s\n" % cmd) >+ return subprocess.call(cmd, shell=isShell) >+ > def clean_env(): > env = {'TERM' : 'vt100', > 'SHELL' : '/bin/bash',
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 799639
:
710780
|
712138
|
1038453