[opensuse-buildservice] [PATCH] improve kiwi system image building in Build Service
Please find attached two patches, that improve the kiwi system image building in the Build Service. The first patch adds code to build to create a tar.bz2 from the kiwi results, the second patch adds support to bs_publish to also publish the results. I have also added those patches to https://bugzilla.novell.com/show_bug.cgi?id=472018 Feedback welcome! Best, Christoph -- Christoph Thiel, Tech. Project Management, Research & Development SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
This has just been commited to trunk and the 1.5 branch. On Tue, Feb 03, 2009 at 06:59:02PM +0100, Christoph Thiel wrote:
Please find attached two patches, that improve the kiwi system image building in the Build Service. The first patch adds code to build to create a tar.bz2 from the kiwi results, the second patch adds support to bs_publish to also publish the results.
I have also added those patches to https://bugzilla.novell.com/show_bug.cgi?id=472018
Feedback welcome!
Best, Christoph -- Christoph Thiel, Tech. Project Management, Research & Development SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Index: Build/Kiwi.pm =================================================================== --- Build/Kiwi.pm (revision 6333) +++ Build/Kiwi.pm (working copy) @@ -101,6 +101,9 @@ my $kiwi = parsexml($xml); die("not a kiwi config\n") unless $kiwi && $kiwi->{'image'}; $kiwi = $kiwi->{'image'}->[0]; + if ($kiwi->{'name'}) { + $ret->{'filename'} = $kiwi->{'name'}; + } my $description = (($kiwi->{'description'} || [])->[0]) || {}; if ($description->{'specification'}) { $ret->{'name'} = $description->{'specification'}->[0]->{'_content'}; Index: build =================================================================== --- build (revision 6333) +++ build (working copy) @@ -1377,6 +1377,8 @@ rm -f $BUILD_ROOT/$TOPDIR/SOURCES/config.xml ln -s $SPECFILE $BUILD_ROOT/$TOPDIR/SOURCES/config.xml 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) chroot $BUILD_ROOT su -c "kiwi --version" - if test "$imagetype" = product ; then echo "running kiwi --create-instsource..." @@ -1390,16 +1392,58 @@ done else BUILD_SUCCEEDED=true - for imagetype in $imagetype ; do - echo "running kiwi --prepare for $imagetype..." - if chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imagetype" - $BUILD_USER < /dev/null ; then - echo "running kiwi --create for $imagetype..." - chroot $BUILD_ROOT su -c "kiwi --create $TOPDIR/KIWIROOT-$imagetype --logfile terminal --type $imagetype -d $TOPDIR/KIWI" - $BUILD_USER < /dev/null || BUILD_SUCCEEDED= + for imgtype in $imagetype ; do + echo "running kiwi --prepare for $imgtype..." + if chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype" - $BUILD_USER < /dev/null ; then + echo "running kiwi --create for $imgtype..." + mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype + chroot $BUILD_ROOT su -c "kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype" - $BUILD_USER < /dev/null || BUILD_SUCCEEDED= else BUILD_SUCCEEDED= fi - test -z "$BUILD_SUCCEEDED" && break + done + + # create tar.bz2 of images, in case it makes sense + if [ "$BUILD_SUCCEEDED" = "true" ] ; then + + echo "compressing images... " + imagearch=`uname -m` + for imgtype in $imagetype ; do + case "$imgtype" in + oem) + pushd $BUILD_ROOT/$TOPDIR/KIWI-oem > /dev/null + tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion-raw.tar.bz2 \ + $imagename.$imagearch-$imageversion.raw + popd > /dev/null + ;; + vmx) + pushd $BUILD_ROOT/$TOPDIR/KIWI-vmx > /dev/null + tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion-vmx.tar.bz2 \ + $imagename.$imagearch-$imageversion.vmx \ + $imagename.$imagearch-$imageversion.vmdk + + # don't compress ovf output + if [ -e $imagename.$imagearch-$imageversion.ovf ] ; then + mv $imagename.$imagearch-$imageversion.ovf $BUILD_ROOT/$TOPDIR/KIWI/ + mv $imagename.$imagearch-$imageversion-disk*.vmdk $BUILD_ROOT/$TOPDIR/KIWI/ + fi + popd > /dev/null + ;; + xen) + pushd $BUILD_ROOT/$TOPDIR/KIWI-xen > /dev/null + tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion-xen.tar.bz2 \ + `grep ^kernel $imagename.$imagearch-$imageversion.xenconfig | cut -d'"' -f2` \ + `grep ^ramdisk $imagename.$imagearch-$imageversion.xenconfig | cut -d'"' -f2` \ + $imagename.$imagearch-$imageversion.xenconfig \ + $imagename.$imagearch-$imageversion + popd > /dev/null + ;; + esac + done + fi + + test -z "$BUILD_SUCCEEDED" && break fi fi
Index: bs_publish =================================================================== --- bs_publish (revision 6347) +++ bs_publish (working copy) @@ -728,6 +728,12 @@ $p = "iso/$bin"; } elsif ($bin =~ /\.raw(:?\.install)?$/) { $p = "$bin"; + } elsif ($bin =~ /\.tar.bz2$/) { + $p = "$bin"; + } elsif ($bin =~ /\.ovf$/) { + $p = "$bin"; + } elsif ($bin =~ /\.vmdk$/) { + $p = "$bin"; } elsif (-d "$r/$bin") { $p = "repo/$bin"; } else {
-- Christoph Thiel, Tech. Project Management, Research & Development SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (1)
-
Christoph Thiel