Mailinglist Archive: opensuse-buildservice (120 mails)

< Previous Next >
[opensuse-buildservice] [PATCH] use pigz with kiwi if it is available in buildroot
Attached patch defines kiwi option --gzip-cmd to pigz if package
available in buildroot. Otherwise gzip will be used (by default).

pigz, which stands for parallel implementation of gzip, is a fully
functional replacement for gzip that exploits multiple processors and
multiple cores to the hilt when compressing data.

My experience with pigz is ~6Min (gzip) vs ~2Min with pigz.

Comments are welcome.
From 97956a2cdb654452ce67b7750bc3d3c5abdf1c30 Mon Sep 17 00:00:00 2001
From: Dinar Valeev <dvaleev@xxxxxxx>
Date: Tue, 26 Jul 2011 17:18:38 +0200
Subject: [PATCH] use pigz with kiwi if it is available in buildroot

---
build_kiwi.sh | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/build_kiwi.sh b/build_kiwi.sh
index 09d7188..e96f2c0 100644
--- a/build_kiwi.sh
+++ b/build_kiwi.sh
@@ -4,6 +4,11 @@ run_kiwi()
imagetype=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show
$BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE imagetype)
imagename=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show
$BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE filename)
imageversion=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show
$BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE version)
+ GZIPCMD=""
+ # define gzip-cmd as pigz if it available in BUILDROOT
+ if [ -x "$BUILD_ROOT/usr/bin/pigz" ];then
+ GZIPCMD="--gzip-cmd pigz"
+ fi
# prepare rpms as source and createrepo on the repositories
ln -sf $TOPDIR/SOURCES/repos $BUILD_ROOT/repos
cd $BUILD_ROOT/$TOPDIR/SOURCES/repos
@@ -114,10 +119,10 @@ run_kiwi()
for imgtype in $imagetype ; do
echo "running kiwi --prepare for $imgtype..."
# Do not use $BUILD_USER here, since we always need root permissions
- if chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare
$TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype" - root <
/dev/null ; then
+ if chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare
$TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype $GZIPCMD" -
root < /dev/null ; then
echo "running kiwi --create for $imgtype..."
mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
- chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --create
$TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d
$TOPDIR/KIWI-$imgtype" - root < /dev/null || cleanup_and_exit 1
+ chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --create
$TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d
$TOPDIR/KIWI-$imgtype $GZIPCMD" - root < /dev/null || cleanup_and_exit 1
else
cleanup_and_exit 1
fi
--
1.6.0.2

< Previous Next >
This Thread
  • No further messages