imgcreate/creator.py | 12 ++++++++---- imgcreate/kickstart.py | 2 +- imgcreate/live.py | 5 ++--- imgcreate/yuminst.py | 9 ++++++--- tools/livecd-creator | 10 ++++++++-- 5 files changed, 25 insertions(+), 13 deletions(-)
New commits: commit f62f3eab2963d756fa7f8f73abf0e73ffc2296e4 Author: Brian C. Lane bcl@redhat.com Date: Tue Jul 31 11:58:48 2012 -0700
switch to using rd.live.image instead of liveimg
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py index aca4043..3bcbe1e 100644 --- a/imgcreate/kickstart.py +++ b/imgcreate/kickstart.py @@ -476,7 +476,7 @@ def get_timeout(ks, default = None): return default return int(ks.handler.bootloader.timeout)
-def get_kernel_args(ks, default = "ro liveimg quiet"): +def get_kernel_args(ks, default = "ro rd.live.image quiet"): if not hasattr(ks.handler.bootloader, "appendLine"): return default if ks.handler.bootloader.appendLine is None:
commit 091812a30e7d7f004962b10337e9ccdfb8fcfc08 Author: Brian C. Lane bcl@redhat.com Date: Tue Jul 31 11:12:24 2012 -0700
dracut doesn't need explicit filesystems
diff --git a/imgcreate/live.py b/imgcreate/live.py index 8872f24..88c7034 100755 --- a/imgcreate/live.py +++ b/imgcreate/live.py @@ -295,7 +295,6 @@ class LiveImageCreatorBase(LoopImageCreator): if not os.path.exists(os.path.dirname(path)): makedirs(os.path.dirname(path)) f = open(path, "a") - f.write('filesystems+="' + self.__extra_filesystems() + ' "\n') f.write('drivers+="' + self.__extra_drivers() + ' "\n') f.write('add_dracutmodules+=" dmsquash-live "') f.close()
commit 93588da9058253fcafc8246b8354ad239c6746aa Author: Martin Langhoff martin@laptop.org Date: Tue Jul 24 09:39:00 2012 -0400
livecd-creator: Add --cacheonly for offline use
First, complete a run with --cache=/some/cache/dir, then you can re-run it with --cache=/some/cache/dir --cacheonly
Lightly tested.
diff --git a/tools/livecd-creator b/tools/livecd-creator index 8bb81aa..e9be1e5 100755 --- a/tools/livecd-creator +++ b/tools/livecd-creator @@ -75,6 +75,10 @@ def parse_options(args): sysopt.add_option("", "--cache", type="string", dest="cachedir", default=None, help="Cache directory to use (default: private cache") + sysopt.add_option("", "--cacheonly", action="store_true", + dest="cacheonly", default=False, + help="Work offline from cache, use together with --cache (default: False)") + parser.add_option_group(sysopt)
imgcreate.setup_logging(parser) @@ -175,13 +179,15 @@ def main(): releasever=options.releasever, tmpdir=os.path.abspath(options.tmpdir), useplugins=options.plugins, - title=title, product=product) + title=title, product=product, + cacheonly=options.cacheonly) elif options.image_type == 'image': creator = imgcreate.LoopImageCreator(ks, name, fslabel=fslabel, releasever=options.releasever, useplugins=options.plugins, - tmpdir=os.path.abspath(options.tmpdir)) + tmpdir=os.path.abspath(options.tmpdir), + cacheonly=options.cacheonly) else: # Cannot happen, we validate this when parsing options. logging.error(u"'%s' is not a valid image type" % options.image_type)
commit 2d7c4518410d328f5d91664d2a2c64ab55939d25 Author: Martin Langhoff martin@laptop.org Date: Mon Jul 23 17:30:27 2012 -0400
Implement cacheonly (offline) support in ImageCreator and LoopCreator
this takes advangage of yum backend smarts in supporting offline usage.
This allows OLPC OS Builder, a user of imgcreate, to support offline use.
diff --git a/imgcreate/creator.py b/imgcreate/creator.py index d8249cb..77b6e56 100644 --- a/imgcreate/creator.py +++ b/imgcreate/creator.py @@ -51,7 +51,7 @@ class ImageCreator(object):
"""
- def __init__(self, ks, name, releasever=None, tmpdir="/tmp", useplugins=False): + def __init__(self, ks, name, releasever=None, tmpdir="/tmp", useplugins=False, cacheonly=False): """Initialize an ImageCreator instance.
ks -- a pykickstart.KickstartParser instance; this instance will be @@ -64,6 +64,8 @@ class ImageCreator(object): releasever -- Value to substitute for $releasever in repo urls
tmpdir -- Top level directory to use for temporary files and dirs + + cacheonly -- Only read from cache, work offline """ self.ks = ks """A pykickstart.KickstartParser instance.""" @@ -79,6 +81,8 @@ class ImageCreator(object): if not os.path.exists(self.tmpdir): makedirs(self.tmpdir)
+ self.cacheonly = cacheonly + self.__builddir = None self.__bindmounts = []
@@ -619,7 +623,7 @@ class ImageCreator(object): yum_conf = self._mktemp(prefix = "yum.conf-")
ayum = LiveCDYum(releasever=self.releasever, useplugins=self.useplugins) - ayum.setup(yum_conf, self._instroot) + ayum.setup(yum_conf, self._instroot, cacheonly=self.cacheonly)
for repo in kickstart.get_repos(self.ks, repo_urls): (name, baseurl, mirrorlist, proxy, inc, exc, cost) = repo @@ -780,7 +784,7 @@ class LoopImageCreator(ImageCreator):
"""
- def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp", useplugins=False): + def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp", useplugins=False, cacheonly=False): """Initialize a LoopImageCreator instance.
This method takes the same arguments as ImageCreator.__init__() with @@ -789,7 +793,7 @@ class LoopImageCreator(ImageCreator): fslabel -- A string used as a label for any filesystems created.
""" - ImageCreator.__init__(self, ks, name, releasever=releasever, tmpdir=tmpdir, useplugins=useplugins) + ImageCreator.__init__(self, ks, name, releasever=releasever, tmpdir=tmpdir, useplugins=useplugins, cacheonly=cacheonly)
self.__fslabel = None self.fslabel = fslabel diff --git a/imgcreate/live.py b/imgcreate/live.py index cd022a5..8872f24 100755 --- a/imgcreate/live.py +++ b/imgcreate/live.py @@ -40,7 +40,7 @@ class LiveImageCreatorBase(LoopImageCreator): """
def __init__(self, ks, name, fslabel=None, releasever=None, tmpdir="/tmp", - title="Linux", product="Linux", useplugins=False): + title="Linux", product="Linux", useplugins=False, cacheonly=False): """Initialise a LiveImageCreator instance.
This method takes the same arguments as LoopImageCreator.__init__(). @@ -50,7 +50,7 @@ class LiveImageCreatorBase(LoopImageCreator): fslabel=fslabel, releasever=releasever, tmpdir=tmpdir, - useplugins=useplugins) + useplugins=useplugins, cacheonly=cacheonly)
self.compress_type = "xz" """mksquashfs compressor to use.""" diff --git a/imgcreate/yuminst.py b/imgcreate/yuminst.py index 5605eea..97e5ecf 100644 --- a/imgcreate/yuminst.py +++ b/imgcreate/yuminst.py @@ -92,11 +92,14 @@ class LiveCDYum(yum.YumBase): for f in glob.glob(installroot + "/var/lib/rpm/__db*"): os.unlink(f)
- def setup(self, confpath, installroot): + def setup(self, confpath, installroot, cacheonly=False): self._writeConf(confpath, installroot) self._cleanupRpmdbLocks(installroot) self.doConfigSetup(fn = confpath, root = installroot) - self.conf.cache = 0 + if cacheonly: + self.conf.cache = 1 + else: + self.conf.cache = 0 self.doTsSetup() self.doRpmDBSetup() self.doRepoSetup() @@ -176,7 +179,7 @@ class LiveCDYum(yum.YumBase): # disable gpg check??? repo.gpgcheck = 0 repo.enable() - repo.setup(0) + repo.setup(self.conf.cache) repo.setCallback(TextProgress()) self.repos.add(repo) return repo
On Tue, Jul 31, 2012 at 06:59:49PM +0000, Brian C. Lane wrote:
New commits: commit f62f3eab2963d756fa7f8f73abf0e73ffc2296e4 Author: Brian C. Lane bcl@redhat.com Date: Tue Jul 31 11:58:48 2012 -0700
switch to using rd.live.image instead of liveimg
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py index aca4043..3bcbe1e 100644 --- a/imgcreate/kickstart.py +++ b/imgcreate/kickstart.py @@ -476,7 +476,7 @@ def get_timeout(ks, default = None): return default return int(ks.handler.bootloader.timeout)
-def get_kernel_args(ks, default = "ro liveimg quiet"): +def get_kernel_args(ks, default = "ro rd.live.image quiet"): if not hasattr(ks.handler.bootloader, "appendLine"): return default if ks.handler.bootloader.appendLine is None:
This means that spin kickstarts that look at /proc/cmdline need to use rd.live.image instead of liveimg
livecd@lists.fedoraproject.org