aboutsummaryrefslogtreecommitdiff
path: root/grs
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-08-09 16:29:20 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-08-09 16:29:20 -0400
commita41100e5a1c3514bf316e5e5982c3f749e203892 (patch)
tree3dec989ddc1a350bf5f3267ac2874d2eba024178 /grs
parentbin/grsup: fix typo. (diff)
downloadgrss-a41100e5a1c3514bf316e5e5982c3f749e203892.tar.gz
grss-a41100e5a1c3514bf316e5e5982c3f749e203892.tar.bz2
grss-a41100e5a1c3514bf316e5e5982c3f749e203892.zip
grs/Kernel.py: don't rebuild/reinstall a kernel if its linux-image tarball exists.
Diffstat (limited to 'grs')
-rw-r--r--grs/Kernel.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/grs/Kernel.py b/grs/Kernel.py
index bb76b80..7f96d91 100644
--- a/grs/Kernel.py
+++ b/grs/Kernel.py
@@ -80,9 +80,16 @@ class Kernel():
image_dir = os.path.join(self.kernelroot, gentoo_version)
boot_dir = os.path.join(image_dir, 'boot')
modprobe_dir = os.path.join(image_dir, 'etc/modprobe.d')
- # TODO: modules_dir really needs $(get_libdir), eg /lib64.
- # For example, this breaks on amd64 multilib.
modules_dir = os.path.join(image_dir, 'lib/modules')
+ # Prepare tarball filename and path. If the tarball already exists,
+ # don't rebuild/reinstall it. Note: It should have been installed to
+ # the system's portage configroot when it was first built, so no need
+ # to reinstall it.
+ linux_images = os.path.join(self.package, 'linux-images')
+ tarball_name = 'linux-image-%s.tar.xz' % gentoo_version
+ tarball_path = os.path.join(linux_images, tarball_name)
+ if os.path.isfile(tarball_path):
+ return
# Remove any old kernel image directory and create a boot directory.
# Note genkernel assumes a boot directory is present.
@@ -126,15 +133,9 @@ class Kernel():
Execute(cmd, timeout=60, logfile=self.logfile)
# Tar up the kernel image and modules and place them in package/linux-images
- linux_images = os.path.join(self.package, 'linux-images')
os.makedirs(linux_images, mode=0o755, exist_ok=True)
- tarball_name = 'linux-image-%s.tar.xz' % gentoo_version
- tarball_path = os.path.join(linux_images, tarball_name)
-
cwd = os.getcwd()
os.chdir(image_dir)
- if os.path.isfile(tarball_path):
- os.unlink(tarball_path)
cmd = 'tar -Jcf %s .' % tarball_path
Execute(cmd, timeout=600, logfile=self.logfile)
os.chdir(cwd)