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 689849 Details for
Bug 905362
Problems using mock as sandbox with tmpfs
[?]
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]
Proposed patch
0001-Proposed-patch-for-bug-905362.patch (text/plain), 9.25 KB, created by
Justin Lewis Salmon
on 2013-01-29 14:25:07 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Justin Lewis Salmon
Created:
2013-01-29 14:25:07 UTC
Size:
9.25 KB
patch
obsolete
>From 0978c0fd7767dc32476247053397e7223c40eece Mon Sep 17 00:00:00 2001 >From: Justin Salmon <jsalmon@cern.ch> >Date: Tue, 29 Jan 2013 14:50:28 +0100 >Subject: [PATCH] Proposed patch for bug #905362 > >--- > py/mock.py | 4 ++ > py/mockbuild/backend.py | 3 +- > py/mockbuild/plugins/root_cache.py | 104 ++++++++++++++++++++++++------------ > 3 files changed, 76 insertions(+), 35 deletions(-) > >diff --git a/py/mock.py b/py/mock.py >index 4efd086..36570c0 100755 >--- a/py/mock.py >+++ b/py/mock.py >@@ -816,6 +816,7 @@ def main(ret): > chroot.tryLockBuildRoot() > try: > chroot._mountall() >+ chroot.modifiedExternally = True > chroot.installSrpmDeps(*args) > finally: > chroot._umountall() >@@ -826,12 +827,14 @@ def main(ret): > log.critical("You must specify a package list to install.") > sys.exit(50) > >+ chroot.modifiedExternally = True > chroot._resetLogging() > chroot.tryLockBuildRoot() > chroot.yumInstall(*args) > chroot.unlockBuildRoot() > > elif options.mode == 'update': >+ chroot.modifiedExternally = True > chroot._resetLogging() > chroot.tryLockBuildRoot() > chroot.yumUpdate() >@@ -842,6 +845,7 @@ def main(ret): > log.critical("You must specify a package list to remove.") > sys.exit(50) > >+ chroot.modifiedExternally = True > chroot._resetLogging() > chroot.tryLockBuildRoot() > chroot.yumRemove(*args) >diff --git a/py/mockbuild/backend.py b/py/mockbuild/backend.py >index 46069a4..060ae1b 100644 >--- a/py/mockbuild/backend.py >+++ b/py/mockbuild/backend.py >@@ -38,6 +38,7 @@ class Root(object): > self._hooks = {} > self.chrootWasCached = False > self.chrootWasCleaned = False >+ self.modifiedExternally = False > self.preExistingDeps = [] > self.logging_initialized = False > self.buildrootLock = None >@@ -901,7 +902,7 @@ class Root(object): > if cmd[0] == "builddep": > yumcmd[0] = self.yum_builddep_path > cmdix = 1 >- if self.yum_builddep_opts: >+ if self.yum_builddep_opts: > for eachopt in self.yum_builddep_opts.split(): > yumcmd.insert(1, '%s' % eachopt) > yumcmd.extend(('--installroot', self.makeChrootPath())) >diff --git a/py/mockbuild/plugins/root_cache.py b/py/mockbuild/plugins/root_cache.py >index 03d1fb5..15bcd07 100644 >--- a/py/mockbuild/plugins/root_cache.py >+++ b/py/mockbuild/plugins/root_cache.py >@@ -24,8 +24,6 @@ def init(rootObj, conf): > class RootCache(object): > """caches root environment in a tarball""" > decorate(traceLog()) >- >- > def __init__(self, rootObj, conf): > self.rootObj = rootObj > self.root_cache_opts = conf >@@ -43,7 +41,13 @@ class RootCache(object): > self.compressArgs = [] > rootObj.rootCacheObj = self > rootObj.addHook("preinit", self._rootCachePreInitHook) >+ rootObj.addHook("preshell", self._rootCachePreShellHook) >+ rootObj.addHook("prechroot", self._rootCachePreShellHook) >+ rootObj.addHook("preyum", self._rootCachePreYumHook) > rootObj.addHook("postinit", self._rootCachePostInitHook) >+ rootObj.addHook("postshell", self._rootCachePostShellHook) >+ rootObj.addHook("postchroot", self._rootCachePostShellHook) >+ rootObj.addHook("postyum", self._rootCachePostShellHook) > self.exclude_dirs = self.root_cache_opts['exclude_dirs'] > self.exclude_tar_cmds = [ "--exclude=" + dir for dir in self.exclude_dirs] > >@@ -68,11 +72,10 @@ class RootCache(object): > decorate(traceLog()) > def _rootCachePreInitHook(self): > getLog().info("enabled root cache") >- mockbuild.util.mkdirIfAbsent(self.rootSharedCachePath) >- # lock so others dont accidentally use root cache while we operate on it. >- if self.rootCacheLock is None: >- self.rootCacheLock = open(os.path.join(self.rootSharedCachePath, "rootcache.lock"), "a+") >+ self._unpack_root_cache() > >+ decorate(traceLog()) >+ def _unpack_root_cache(self): > # check cache status > try: > if self.root_cache_opts['age_check']: >@@ -94,25 +97,41 @@ class RootCache(object): > except OSError: > pass > >- # optimization: don't unpack root cache if chroot was not cleaned >- if os.path.exists(self.rootCacheFile) and self.rootObj.chrootWasCleaned: >- self.rootObj.start("unpacking root cache") >- self._rootCacheLock() >- # >- # deal with NFS homedir and root_squash >- # >- if mockbuild.util.get_fs_type(os.getcwd()).startswith('nfs'): >- os.chdir(mockbuild.util.find_non_nfs_dir()) >- mockbuild.util.do( >- ["tar"] + self.compressArgs + ["-xf", self.rootCacheFile, "-C", self.rootObj.makeChrootPath()], >- shell=False >- ) >- for dir in self.exclude_dirs: >- mockbuild.util.mkdirIfAbsent(self.rootObj.makeChrootPath(dir)) >- self._rootCacheUnlock() >- self.rootObj.chrootWasCleaned = False >- self.rootObj.chrootWasCached = True >- self.rootObj.finish("unpacking root cache") >+ mockbuild.util.mkdirIfAbsent(self.rootSharedCachePath) >+ # lock so others dont accidentally use root cache while we operate on it. >+ if self.rootCacheLock is None: >+ self.rootCacheLock = open(os.path.join(self.rootSharedCachePath, "rootcache.lock"), "a+") >+ >+ # optimization: don't unpack root cache if chroot was not cleaned (unless we are using tmpfs) >+ if os.path.exists(self.rootCacheFile): >+ if self.rootObj.chrootWasCleaned or self.rootObj.pluginConf['tmpfs_enable']: >+ self.rootObj.start("unpacking root cache") >+ self._rootCacheLock() >+ # >+ # deal with NFS homedir and root_squash >+ # >+ if mockbuild.util.get_fs_type(os.getcwd()).startswith('nfs'): >+ os.chdir(mockbuild.util.find_non_nfs_dir()) >+ mockbuild.util.do( >+ ["tar"] + self.compressArgs + ["-xf", self.rootCacheFile, "-C", self.rootObj.makeChrootPath()], >+ shell=False >+ ) >+ for dir in self.exclude_dirs: >+ mockbuild.util.mkdirIfAbsent(self.rootObj.makeChrootPath(dir)) >+ self._rootCacheUnlock() >+ self.rootObj.chrootWasCleaned = False >+ self.rootObj.chrootWasCached = True >+ self.rootObj.finish("unpacking root cache") >+ >+ decorate(traceLog()) >+ def _rootCachePreShellHook(self): >+ if self.rootObj.pluginConf['tmpfs_enable']: >+ self._unpack_root_cache() >+ >+ decorate(traceLog()) >+ def _rootCachePreYumHook(self): >+ if self.rootObj.pluginConf['tmpfs_enable'] and not os.listdir(self.rootObj.makeChrootPath()): >+ self._unpack_root_cache() > > decorate(traceLog()) > def _root_cache_handle_mounts(self): >@@ -124,6 +143,10 @@ class RootCache(object): > > decorate(traceLog()) > def _rootCachePostInitHook(self): >+ self._rebuild_root_cache() >+ >+ decorate(traceLog()) >+ def _rebuild_root_cache(self): > try: > self._rootCacheLock(shared=0) > # nuke any rpmdb tmp files >@@ -132,12 +155,15 @@ class RootCache(object): > > # truncate the sparse files in /var/log > for logfile in ('/var/log/lastlog', '/var/log/faillog'): >- f = open(self.rootObj.makeChrootPath(logfile), "w") >- f.truncate(0) >- f.close() >- >- # never rebuild cache unless it was a clean build. >- if self.rootObj.chrootWasCleaned: >+ try: >+ f = open(self.rootObj.makeChrootPath(logfile), "w") >+ f.truncate(0) >+ f.close() >+ except: >+ pass >+ >+ # never rebuild cache unless it was a clean build, or called externally >+ if self.rootObj.chrootWasCleaned or self.rootObj.modifiedExternally: > mockbuild.util.do(["sync"], shell=False) > self._root_cache_handle_mounts() > self.rootObj.start("creating cache") >@@ -153,9 +179,19 @@ class RootCache(object): > os.remove(self.rootCacheFile) > raise > # now create the cache log file >- l = open(os.path.join(self.rootSharedCachePath, "cache.log"), "w") >- l.write(self.rootObj.yum_init_install_output) >- l.close() >+ try: >+ l = open(os.path.join(self.rootSharedCachePath, "cache.log"), "w") >+ l.write(self.rootObj.yum_init_install_output) >+ l.close() >+ except: >+ pass > self.rootObj.finish("creating cache") > finally: > self._rootCacheUnlock() >+ >+ decorate(traceLog()) >+ def _rootCachePostShellHook(self): >+ if self.rootObj.pluginConf['tmpfs_enable'] and self.rootObj.modifiedExternally: >+ self._rebuild_root_cache() >+ self.rootObj.modifiedExternally = False >+ >-- >1.7.1 >
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 905362
:
689849
|
691597