public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/grss:master commit in: grs/
Date: Mon, 14 Sep 2015 00:29:16 +0000 (UTC)	[thread overview]
Message-ID: <1442190834.f94049b00db8ee54bb4d616570e372589efa5234.blueness@gentoo> (raw)

commit:     f94049b00db8ee54bb4d616570e372589efa5234
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 14 00:33:54 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Mon Sep 14 00:33:54 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=f94049b0

grs/ISOIt.py: fix various path issues.

 grs/ISOIt.py     | 39 ++++++++++++++++++++++++---------------
 grs/Interpret.py |  2 +-
 2 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/grs/ISOIt.py b/grs/ISOIt.py
index 2a0be81..7db86d3 100644
--- a/grs/ISOIt.py
+++ b/grs/ISOIt.py
@@ -17,6 +17,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import os
+import shutil
 from datetime import datetime
 from grs.Constants import CONST
 from grs.Execute import Execute
@@ -25,10 +26,10 @@ from grs.HashIt import HashIt
 class ISOIt(HashIt):
     """ Create a bootable ISO of the system. """
 
-    def __init__(self, name, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, \
+    def __init__(self, name, libdir = CONST.LIBDIR, tmpdir = CONST.TMPDIR, \
             portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
         self.libdir = libdir
-        self.workdir = workdir
+        self.tmpdir = tmpdir
         self.portage_configroot = portage_configroot
         self.logfile = logfile
         # Prepare a year, month and day for a ISO name timestamp.
@@ -42,9 +43,10 @@ class ISOIt(HashIt):
     def initramfs(self, isoboot_dir):
         """ TODO """
         # Paths to where we'll build busybox and the initramfs.
-        busybox_root     = os.path.join(self.workdir, 'busybox')
+        busybox_root     = os.path.join(self.tmpdir, 'busybox')
         busybox_path     = os.path.join(busybox_root, 'bin/busybox')
-        savedconfig_path = os.path.join(busybox_root, 'etc/portage/savedconfig/sys-apps/busybox')
+        savedconfig_dir  = os.path.join(busybox_root, 'etc/portage/savedconfig/sys-apps')
+        savedconfig_path = os.path.join(savedconfig_dir, 'busybox')
         busybox_config   = os.path.join(self.libdir, 'scripts/busybox-config')
 
         # Remove any old busybox build directory and prepare new one.
@@ -53,26 +55,30 @@ class ISOIt(HashIt):
         shutil.copyfile(busybox_config, savedconfig_path)
 
         # Emerge busybox.
-        cmd = 'emerge --nodeps -1 busybox'
+        cmd = 'emerge --nodeps -1q busybox'
         emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : busybox_root }
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
 
         # Remove any old initramfs root and prepare a new one.
-        initramfs_root = os.path.join(self.workdir, 'initramfs')
+        initramfs_root = os.path.join(self.tmpdir, 'initramfs')
         shutil.rmtree(initramfs_root, ignore_errors=True)
         root_paths = ['bin', 'dev', 'etc', 'mnt/cdrom', 'mnt/squashfs', 'mnt/tmpfs',
             'proc', 'sbin', 'sys', 'tmp', 'usr/bin', 'usr/sbin', 'var', 'var/run']
         for p in root_paths:
             d = os.path.join(initramfs_root, p)
-            os.makdirs(d, mode=0o755, exist_ok=True)
+            os.makedirs(d, mode=0o755, exist_ok=True)
 
         # Copy the static busybox to the initramfs root.
         # TODO: we are assuming a static busybox, so we should check.
-        shutil.copyfile(busybox_path, os.join.path(initramfs_root, 'bin/busybox'))
+        busybox_initramfs_path = os.path.join(initramfs_root, 'bin/busybox')
+        shutil.copyfile(busybox_path, busybox_initramfs_path)
+        os.chmod(busybox_initramfs_path, 0o0755)
         cmd = 'chroot %s /bin/busybox --install -s' % initramfs_root
         Execute(cmd, timeout=60, logfile=self.logfile)
         initscript_path = os.path.join(self.libdir, 'scripts/initramfs-init')
-        shutil.copy(initscript_path, initramfs_root)
+        init_initramfs_path = os.path.join(initramfs_root, 'init')
+        shutil.copy(initscript_path, init_initramfs_path)
+        os.chmod(init_initramfs_path, 0o0755)
 
         # TODO: we are assuming a static kernel and so not copying in
         # any modules.  This is where we should copy in modules.
@@ -81,8 +87,9 @@ class ISOIt(HashIt):
         initramfs_path = os.path.join(isoboot_dir, 'initramfs')
         cwd = os.getcwd()
         os.chdir(initramfs_root)
-        cmd = 'find . | cpio -H newc -o | gzip -9 > %s' % initramfs_path
-        Execute(cmd, timeout=600, logfile=self.logfile)
+        cmd = 'find . -print | cpio -H newc -o | gzip -9 > %s' % initramfs_path
+        # Can't pipe commands, so we'll have to find another way
+        #Execute(cmd, timeout=600, logfile=self.logfile)
         os.chdir(cwd)
 
 
@@ -91,9 +98,10 @@ class ISOIt(HashIt):
         if alt_name:
             self.medium_name = '%s-%s%s%s.iso' % (alt_name, self.year, self.month, self.day)
             self.digest_name = '%s.DIGESTS' % self.medium_name
-        iso_dir     = os.path.join(self.workdir, 'iso')
+        iso_dir     = os.path.join(self.tmpdir, 'iso')
         isoboot_dir = os.path.join(iso_dir, 'boot')
         isogrub_dir = os.path.join(isoboot_dir, 'grub')
+        shutil.rmtree(iso_dir, ignore_errors=True)
         os.makedirs(isogrub_dir, mode=0o755, exist_ok=False)
 
         # 1. build initramfs image and copy it in
@@ -112,10 +120,10 @@ class ISOIt(HashIt):
         Execute(cmd, timeout=600, logfile=self.logfile)
 
         # 4. Emerge grub:0 to grab stage2_eltorito
-        grub_root     = os.path.join(self.workdir, 'grub')
+        grub_root     = os.path.join(self.tmpdir, 'grub')
         eltorito_path = os.path.join(grub_root, 'boot/grub/stage2_eltorito')
         menulst_path  = os.path.join(self.libdir, 'scripts/menu.lst')
-        cmd = 'emerge --nodeps -1 grub:0'
+        cmd = 'emerge --nodeps -1q grub:0'
         emerge_env = { 'USE' : '-* savedconfig', 'ROOT' : grub_root }
         Execute(cmd, timeout=600, extra_env=emerge_env, logfile=self.logfile)
         shutil.copyfile(eltorito_path, isogrub_dir)
@@ -127,5 +135,6 @@ class ISOIt(HashIt):
         args += '-no-emul-boot '                # No disk emulation for El Torito
         args += '-boot-load-size 4 '            # 4x512-bit sectors for no-emulation mode
         args += '-boot-info-table '             # Create El Torito boot info table
-        cmd = 'mkisofs %s -o %s %s' % (args, self.medium_pathname, iso_dir)
+        medium_path = os.path.join(self.tmpdir, self.medium_name)
+        cmd = 'mkisofs %s -o %s %s' % (args, medium_path, iso_dir)
         Execute(cmd, timeout=600, logfile=self.logfile)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 4fdb31b..05fdc64 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -131,7 +131,7 @@ class Interpret(Daemon):
         pc = PivotChroot(tmpdir, portage_configroot, logfile)
         ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)
         bi = TarIt(name, portage_configroot, logfile)
-        io = ISOIt(name, libdir, workdir, portage_configroot, logfile)
+        io = ISOIt(name, libdir, tmpdir, portage_configroot, logfile)
 
         # Just in case /var/tmp/grs doesn't already exist.
         os.makedirs(tmpdir, mode=0o755, exist_ok=True)


             reply	other threads:[~2015-09-14  0:29 UTC|newest]

Thread overview: 139+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14  0:29 Anthony G. Basile [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-07-20  2:22 [gentoo-commits] proj/grss:master commit in: grs/ Anthony G. Basile
2022-07-20  1:49 Anthony G. Basile
2022-07-19 20:22 Anthony G. Basile
2022-07-19 20:18 Anthony G. Basile
2022-07-18 21:13 Anthony G. Basile
2019-04-19 12:29 Anthony G. Basile
2018-11-18 19:09 Anthony G. Basile
2018-11-12  3:08 Anthony G. Basile
2018-11-11 23:57 Anthony G. Basile
2018-11-11 23:35 Anthony G. Basile
2018-11-11 23:16 Anthony G. Basile
2018-06-25 20:32 Anthony G. Basile
2018-04-14 14:53 Anthony G. Basile
2018-04-10  3:14 Anthony G. Basile
2018-02-20  2:27 Anthony G. Basile
2018-02-20  2:04 Anthony G. Basile
2018-02-18 22:38 Anthony G. Basile
2018-02-18 16:37 Anthony G. Basile
2018-02-06 11:57 Anthony G. Basile
2018-02-06 11:42 Anthony G. Basile
2018-02-06 11:33 Anthony G. Basile
2018-02-06 10:55 Anthony G. Basile
2018-01-28 12:31 Anthony G. Basile
2018-01-28 12:09 Anthony G. Basile
2018-01-15  1:31 Anthony G. Basile
2018-01-15  1:23 Anthony G. Basile
2018-01-14 18:22 Anthony G. Basile
2018-01-14 17:05 Anthony G. Basile
2018-01-14 15:02 Anthony G. Basile
2018-01-14 14:37 Anthony G. Basile
2018-01-14 14:07 Anthony G. Basile
2018-01-13 17:40 Anthony G. Basile
2018-01-10 21:02 Anthony G. Basile
2018-01-10 20:40 Anthony G. Basile
2017-12-28 17:54 Anthony G. Basile
2017-12-28 17:22 Anthony G. Basile
2017-12-27  9:25 Anthony G. Basile
2017-12-26 14:19 Anthony G. Basile
2017-12-26  0:04 Anthony G. Basile
2017-12-26  0:04 Anthony G. Basile
2017-12-26  0:04 Anthony G. Basile
2017-12-25 23:38 Anthony G. Basile
2017-12-25 23:24 Anthony G. Basile
2017-12-23 16:04 Anthony G. Basile
2017-12-23 14:15 Anthony G. Basile
2016-03-23 15:08 Anthony G. Basile
2016-03-23 15:05 Anthony G. Basile
2015-11-26 19:48 Anthony G. Basile
2015-10-10 20:20 Anthony G. Basile
2015-10-10 19:36 Anthony G. Basile
2015-10-10 19:07 Anthony G. Basile
2015-10-10 12:22 Anthony G. Basile
2015-10-10 11:44 Anthony G. Basile
2015-10-10 11:22 Anthony G. Basile
2015-10-10 11:20 Anthony G. Basile
2015-10-10 11:10 Anthony G. Basile
2015-10-10  1:46 Anthony G. Basile
2015-10-10  1:40 Anthony G. Basile
2015-10-10  1:34 Anthony G. Basile
2015-10-10  1:26 Anthony G. Basile
2015-10-10  1:23 Anthony G. Basile
2015-10-10  1:18 Anthony G. Basile
2015-10-10  0:34 Anthony G. Basile
2015-10-10  0:29 Anthony G. Basile
2015-10-09 23:33 Anthony G. Basile
2015-10-09 23:33 Anthony G. Basile
2015-10-09 23:30 Anthony G. Basile
2015-10-09 23:11 Anthony G. Basile
2015-10-09 23:06 Anthony G. Basile
2015-10-08 23:52 Anthony G. Basile
2015-10-08 18:03 Anthony G. Basile
2015-10-08 17:20 Anthony G. Basile
2015-10-07 11:28 Anthony G. Basile
2015-10-07 11:15 Anthony G. Basile
2015-10-07 11:07 Anthony G. Basile
2015-10-07 11:03 Anthony G. Basile
2015-10-07 10:57 Anthony G. Basile
2015-10-07  8:31 Anthony G. Basile
2015-10-07  8:01 Anthony G. Basile
2015-10-06 10:07 Anthony G. Basile
2015-09-16 22:08 Anthony G. Basile
2015-09-16  5:16 Anthony G. Basile
2015-09-16  0:37 Anthony G. Basile
2015-09-16  0:32 Anthony G. Basile
2015-09-14  7:17 Anthony G. Basile
2015-09-14  5:32 Anthony G. Basile
2015-09-14  5:25 Anthony G. Basile
2015-09-13 17:31 Anthony G. Basile
2015-09-12 20:56 Anthony G. Basile
2015-09-12 20:56 Anthony G. Basile
2015-08-09 20:26 Anthony G. Basile
2015-08-08 20:06 Anthony G. Basile
2015-08-08 18:01 Anthony G. Basile
2015-08-08 17:51 Anthony G. Basile
2015-07-29  0:20 Anthony G. Basile
2015-07-28 22:44 Anthony G. Basile
2015-07-27 20:49 Anthony G. Basile
2015-07-25 22:36 Anthony G. Basile
2015-07-14 23:37 Anthony G. Basile
2015-07-14 23:29 Anthony G. Basile
2015-07-14 23:19 Anthony G. Basile
2015-07-14 23:16 Anthony G. Basile
2015-07-14 23:02 Anthony G. Basile
2015-07-14 22:39 Anthony G. Basile
2015-07-14 22:35 Anthony G. Basile
2015-07-14 21:45 Anthony G. Basile
2015-07-14 21:21 Anthony G. Basile
2015-07-14 21:02 Anthony G. Basile
2015-07-14 20:55 Anthony G. Basile
2015-07-10 12:54 Anthony G. Basile
2015-07-10  2:37 Anthony G. Basile
2015-07-10  2:37 Anthony G. Basile
2015-07-10  2:01 Anthony G. Basile
2015-07-09 15:26 Anthony G. Basile
2015-07-09  1:44 Anthony G. Basile
2015-07-08 15:44 Anthony G. Basile
2015-07-08 10:28 Anthony G. Basile
2015-07-07 20:52 Anthony G. Basile
2015-07-07 20:34 Anthony G. Basile
2015-07-07 14:30 Anthony G. Basile
2015-07-07 12:54 Anthony G. Basile
2015-07-07 12:46 Anthony G. Basile
2015-07-07 12:44 Anthony G. Basile
2015-07-07 12:33 Anthony G. Basile
2015-07-07 11:26 Anthony G. Basile
2015-07-07  2:17 Anthony G. Basile
2015-07-06 20:13 Anthony G. Basile
2015-07-06 18:13 Anthony G. Basile
2015-07-05 16:49 Anthony G. Basile
2015-07-05 12:04 Anthony G. Basile
2015-07-02 22:30 Anthony G. Basile
2015-07-01 17:27 Anthony G. Basile
2015-07-01 17:03 Anthony G. Basile
2015-07-01 16:53 Anthony G. Basile
2015-07-01 16:52 Anthony G. Basile
2015-07-01 16:07 Anthony G. Basile
2015-07-01 12:30 Anthony G. Basile
2015-07-01 12:23 Anthony G. Basile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442190834.f94049b00db8ee54bb4d616570e372589efa5234.blueness@gentoo \
    --to=blueness@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox