A patch to enable setting the build directory.

This adds more flexibility for those who don't have as much space in
/var/tmp.

Kind regards,

Jeroen van Meeuwen
-kanarip
--- pilgrim.py.prepatch-builddir	2007-08-05 18:14:41.000000000 +0200
+++ pilgrim.py	2007-08-05 18:35:49.000000000 +0200
@@ -306,6 +306,7 @@
         self.fs_label = fs_label
         self.skip_compression = skip_compression
         self.skip_prelink = skip_prelink
+        self.build_dir = None
         self.tmpdir = tmpdir

         self.build_dir = None
@@ -394,14 +395,18 @@
         fstab.write("sysfs                   /sys                    sysfs   defaults        0 0\n")
         fstab.close()

-    def setup(self, image_size, base_on = None):
+    def setup(self, image_size, base_on = None, build_dir = None):
         """setup target ext3 file system in preparation for an install"""

         # setup temporary build dirs
-        try:
-            self.build_dir = tempfile.mkdtemp(dir=self.tmpdir, prefix="livecd-creator-")
-        except OSError, (err, msg):
-            raise InstallationError("Failed create build directory in %s: %s" % (self.tmpdir, msg))
+        if not build_dir:
+            try:
+                self.build_dir = tempfile.mkdtemp(dir="/var/tmp", prefix="livecd-creator-")
+            except OSError, (err, msg):
+                raise InstallationError("Failed create build directory in /var/tmp: %s" % msg)
+        else:
+            self.build_dir = build_dir
+            os.makedirs(self.build_dir)

         os.makedirs(self.build_dir + "/out/isolinux")
         os.makedirs(self.build_dir + "/out/sysroot")
@@ -1035,6 +1040,7 @@
                       [--uncompressed-size=<size-in-MB>]
                       [--ignore-deleted]
                       [--shell]
+                      [--builddir]
                       [--tmpdir=<tmpdir>]

  --help              : Print usage and exit
@@ -1048,6 +1054,7 @@
  --prelink           : Prelink the image
  --uncompressed-size : Size of uncompressed fs in MB (default: 4096)
  --ignore-deleted    : Don't run resize2fs to clean up wasted blocks
+ --builddir          : Use this build directory
  --shell             : Start a shell in the chroot for post-configuration
  --tmpdir            : Temporary directory to use (default: /var/tmp)

@@ -1080,15 +1087,17 @@
         self.uncompressed_size = 4096
         self.ignore_deleted = False
         self.give_shell = False
+        self.build_dir = None
         self.tmpdir = "/var/tmp"

 def parse_options(args):
     try:
-        opts, args = getopt.getopt(args, "hr:b:p:e:f:c:su:lt:",
+        opts, args = getopt.getopt(args, "hr:b:p:e:f:c:su:lt:bd:",
                                    ["help", "repo=", "base-on=", "package=",
                                     "exclude-package=", "fslabel=", "config=",
                                     "skip-compression", "uncompressed-size=",
                                     "ignore-deleted", "shell", "no-prelink",
+                                    "build_dir=",
                                     "prelink", "tmpdir="])

     except getopt.GetoptError, msg:
@@ -1151,6 +1160,9 @@
         if o in ("-t", "--tmpdir"):
             options.tmpdir = a
             continue
+        if o in ("-bd", "--builddir"):
+            options.build_dir = a
+            continue
         raise Usage("Unknown option %s" % o)

     if not options.kscfg and not (options.packages or options.groups):
@@ -1192,7 +1204,7 @@
     try:
         target.parse(options.kscfg)

-        target.setup(options.uncompressed_size, options.base_on)
+        target.setup(options.uncompressed_size, options.base_on, build_dir=options.build_dir)

         target.install()

--
Fedora-livecd-list mailing list
Fedora-livecd-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-livecd-list

Reply via email to