[Fedora-livecd-list] Branch 'f17-branch' - 6 commits - imgcreate/creator.py imgcreate/fs.py imgcreate/kickstart.py imgcreate/live.py imgcreate/yuminst.py Makefile tools/livecd-creator

Brian C. Lane bcl at fedoraproject.org
Tue Jul 31 20:50:38 UTC 2012


 Makefile               |    2 +-
 imgcreate/creator.py   |   12 ++++++++----
 imgcreate/fs.py        |    3 ++-
 imgcreate/kickstart.py |    2 +-
 imgcreate/live.py      |    5 ++---
 imgcreate/yuminst.py   |    9 ++++++---
 tools/livecd-creator   |   10 ++++++++--
 7 files changed, 28 insertions(+), 15 deletions(-)

New commits:
commit 24a16d370bbe8133b736e26b4232d60d5aa6257c
Author: Brian C. Lane <bcl at redhat.com>
Date:   Tue Jul 31 13:50:34 2012 -0700

    Version 17.12

diff --git a/Makefile b/Makefile
index 49fba36..85ea462 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 
-VERSION = 17.11
+VERSION = 17.12
 
 INSTALL = /usr/bin/install -c
 INSTALL_PROGRAM = ${INSTALL}


commit fecdb917a4465ba5b74e97e2825e77af07c62108
Author: Brian C. Lane <bcl at 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 9bc6abca1b80a44778bc49f3b59eab1306b5c03b
Author: Martin Langhoff <martin at 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 cc1290b70ebeca3470ea8272d2654b412f03fa82
Author: Martin Langhoff <martin at 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


commit e2f3a0f70ae4cd4f5d421ee230c2a446b9d4395e
Author: Joey Boggs <jboggs at redhat.com>
Date:   Mon Jul 9 14:38:50 2012 -0400

    if mounting squashfs add ro mount option
    
    This just adds the ro mount option when using squashfs images otherwise we get output
    saying read/write mount failed switching to readonly.
    
    Signed-off-by: Joey Boggs <jboggs at redhat.com>

diff --git a/imgcreate/fs.py b/imgcreate/fs.py
index da444e4..d4558d3 100644
--- a/imgcreate/fs.py
+++ b/imgcreate/fs.py
@@ -433,7 +433,8 @@ class DiskMount(Mount):
         args = [ "/bin/mount", self.disk.device, self.mountdir ]
         if self.fstype:
             args.extend(["-t", self.fstype])
-
+        if self.fstype == "squashfs":
+            args.extend(["-o", "ro"])
         rc = call(args)
         if rc != 0:
             raise MountError("Failed to mount '%s' to '%s'" %


commit a49aeb25176a832a083f871ff025a73fecc2df0c
Author: Brian C. Lane <bcl at redhat.com>
Date:   Tue Jun 12 12:18:02 2012 -0700

    imgcreate: Use copy2 for TimezoneConfig (#829032)

diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index ad69a87..aca4043 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -154,7 +154,7 @@ class TimezoneConfig(KickstartConfig):
         f.write("UTC=" + utc + "\n")
         f.close()
         try:
-            shutil.copyfile(self.path("/usr/share/zoneinfo/%s" %(tz,)),
+            shutil.copy2(self.path("/usr/share/zoneinfo/%s" %(tz,)),
                             self.path("/etc/localtime"))
         except OSError, e:
             log.error("Error copying timezone: %s" %(e.strerror,))




More information about the livecd mailing list