Hello community, here is the log from the commit of package kiwi for openSUSE:Factory checked in at 2014-06-08 13:36:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kiwi (Old) and /work/SRC/openSUSE:Factory/.kiwi.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kiwi" Changes: -------- --- /work/SRC/openSUSE:Factory/kiwi/kiwi.changes 2014-06-01 18:56:11.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kiwi.new/kiwi.changes 2014-06-08 13:37:08.000000000 +0200 @@ -1,0 +2,112 @@ +Fri Jun 6 12:07:46 CEST 2014 - [email protected] + +- v5.06.107 released + +------------------------------------------------------------------- +Fri Jun 6 12:04:54 CEST 2014 - [email protected] + +- Fixed grub2 recovery setup + * Recovery menu entry was not populated to all config files + +------------------------------------------------------------------- +Thu Jun 5 10:39:34 CEST 2014 - [email protected] + +- v5.06.106 released + +------------------------------------------------------------------- +Thu Jun 5 10:00:40 CEST 2014 - [email protected] + +- Use menu.c32 for isolinux to display a text menu if no + graphics theme is available + +------------------------------------------------------------------- +Wed Jun 4 16:40:49 CEST 2014 - [email protected] + +- Fixed bundle-build result for vagrant image results + +------------------------------------------------------------------- +Wed Jun 4 16:14:01 CEST 2014 - [email protected] + +- Follow up change for --bundle-build command + Make sure the build metadata files .packages/.verified/.channel + are part of the bundle + +------------------------------------------------------------------- +Wed Jun 4 14:54:16 CEST 2014 - [email protected] + +- Fixed typo, surplus status flag + +------------------------------------------------------------------- +Tue Jun 3 19:52:38 CEST 2014 - [email protected] + +- Follow up patch for KIWICollect::indexOfArray + * follow coding style and conventions + +------------------------------------------------------------------- +Tue Jun 3 19:44:44 CEST 2014 - [email protected] + +- Added new class KIWIResult and command: + + kiwi --bundle-build <build-number> --dest-dir <dir> + + Along with the new KIWIResult class the above command was added. + With bundle-build and the given build number and build target + directory kiwi takes the information from the build target + directory and bundles the user relevant image files as single + files and/or tarball suitable for publishing. + +------------------------------------------------------------------- +Tue Jun 3 16:33:52 CEST 2014 - [email protected] + +- KIWICollect: fix order of architectures if one repository contains multiple architecture + versions of same rpm. + +------------------------------------------------------------------- +Tue Jun 3 10:42:39 CEST 2014 - [email protected] + +- Write a kiwi.buildinfo file for each build + The buildinfo file contains information about the build which + will be used to collect user relevant image files according + to the requested image type and parameters. The result of a + kiwi build could contain intermediate build results which + will be embedded in the final result and stay in the result + directory in order to allow faster rebuilds. There will be + a new kiwi post processing command which collects only the + important result image files and provide them together with + a build number. + +------------------------------------------------------------------- +Mon Jun 2 16:05:38 CEST 2014 - [email protected] + +- In preparation to support enable/disable of boot partition + + remove obsolete boot_id/root_id code from grub2 codebase + for grub2 we don't search via id, we search either by uuid + or by flag file + + for other bootloaders make sure boot_id is set to the root + partition id if no explicit boot partition exists + +------------------------------------------------------------------- +Mon Jun 2 10:40:31 CEST 2014 - [email protected] + +- v5.06.105 released + +------------------------------------------------------------------- +Mon Jun 2 10:17:48 CEST 2014 - [email protected] + +- Make sure the selected build type is used in upgrade mode. + With the wrong build type this could lead to unneeded + runtime checks called and failing (bnc #880744) + +------------------------------------------------------------------- +Mon Jun 2 10:01:51 CEST 2014 - [email protected] + +- Fixed spec file, kiwi-templates contains arch specific + templates thus it's wrong to make this a noarch package + +------------------------------------------------------------------- +Mon Jun 2 09:40:58 CEST 2014 - [email protected] + +- Fixed grub.conf setup for RHEL systems using legacy grub + on RHEL grub.conf is a link to the menu.lst file + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kiwi.spec ++++++ --- /var/tmp/diff_new_pack.K5mrob/_old 2014-06-08 13:37:09.000000000 +0200 +++ /var/tmp/diff_new_pack.K5mrob/_new 2014-06-08 13:37:09.000000000 +0200 @@ -26,7 +26,7 @@ Group: System/Management Url: http://github.com/openSUSE/kiwi Name: kiwi -Version: 5.06.104 +Version: 5.06.107 Release: 0 Provides: kiwi-schema = 6.1 # requirements to build packages @@ -432,9 +432,6 @@ Group: System/Management PreReq: coreutils Requires: kiwi-desc-vmxboot = %{version} -%if 0%{?suse_version} > 1120 -BuildArch: noarch -%endif %description -n kiwi-templates This package contains system image templates to easily build @@ -592,7 +589,7 @@ %post -n kiwi-templates #============================================================ # Clean up old old template directories if the exists -oldDists=( 10.1 10.2 10.3 11.0 11.1 11.2 ) +oldDists=( 10.1 10.2 10.3 11.0 11.1 11.2 11.3 12.1 SLE10 SLED10 ) for dist in ${oldDists[@]};do rm -rf /usr/share/kiwi/image/suse-$dist-JeOS done ++++++ kiwi-docu.tar.bz2 ++++++ /work/SRC/openSUSE:Factory/kiwi/kiwi-docu.tar.bz2 /work/SRC/openSUSE:Factory/.kiwi.new/kiwi-docu.tar.bz2 differ: char 11, line 1 ++++++ kiwi-repo.tar.bz2 ++++++ ++++++ kiwi.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/.git-hooks/pre-commit new/kiwi/.git-hooks/pre-commit --- old/kiwi/.git-hooks/pre-commit 2014-05-23 14:09:39.000000000 +0200 +++ new/kiwi/.git-hooks/pre-commit 2014-06-05 10:40:15.000000000 +0200 @@ -14,6 +14,7 @@ # The known Perl modules my @kiwiModules = qw ( + KIWIResult.pm KIWIArchList.pm KIWIArch.pm KIWIBasePlugin.pm @@ -203,6 +204,7 @@ # List of modules not clean to level 1 (brutal) of perlcritic my @notClean1 = qw ( + KIWIResult.pm KIWIArchList.pm KIWIArch.pm KIWIBasePlugin.pm @@ -392,6 +394,7 @@ # List of modules not clean to level 2 (cruel) of perlcritic my @notClean2 = qw ( + KIWIResult.pm KIWIArchList.pm KIWIArch.pm KIWIBasePlugin.pm @@ -463,6 +466,7 @@ # List of modules not clean to level 3 (harsh) of perlcritic my @notClean3 = qw ( + KIWIResult.pm KIWIArchList.pm KIWIBoot.pm KIWICache.pm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/.revision new/kiwi/.revision --- old/kiwi/.revision 2014-05-27 14:49:56.000000000 +0200 +++ new/kiwi/.revision 2014-06-05 10:40:15.000000000 +0200 @@ -1 +1 @@ -8f5fffd0d15c249cfdd0118f69764a60534c5155 +4c3310b1dd3af316dd6d4a87ad3a336c2d8a801f diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/kiwi.pl new/kiwi/kiwi.pl --- old/kiwi/kiwi.pl 2014-05-27 14:49:56.000000000 +0200 +++ new/kiwi/kiwi.pl 2014-06-05 10:40:15.000000000 +0200 @@ -56,6 +56,7 @@ use KIWILog; use KIWIQX; use KIWIRoot; +use KIWIResult; use KIWIRuntimeChecker; use KIWIXML; use KIWIXMLInfo; @@ -138,6 +139,27 @@ KIWIQX::qxx ( "rm -f /etc/smart/channels/*" ); } #======================================== + # Bundle user relevant build results + #---------------------------------------- + if ($cmdL->getOperationMode("bundle")) { + my $bundle = KIWIResult -> new ( + $cmdL -> getOperationMode("bundle"), + $cmdL -> getImageTargetDir(), + $cmdL -> getBuildNumber() + ); + if (! $bundle) { + kiwiExit (1); + } + if (! $bundle -> buildRelease()) { + kiwiExit (1); + } + if (! $bundle -> populateRelease()) { + kiwiExit (1); + } + kiwiExit (0); + } + + #======================================== # Prepare and Create in one step #---------------------------------------- if ($cmdL->getOperationMode("build")) { @@ -735,6 +757,8 @@ my $RootTree; # optional root tree destination my $BootVMSystem; # system image to be copied on a VM disk my $BootVMSize; # size of virtual disk + my $BundleBuild; # bundle user relevant build results + my $BundleID; # bundle/build id used in bundle-build my $StripImage; # strip shared objects and binaries my $PrebuiltBootImage; # dir. where a prepared boot image may be found my $ISOCheck; # create checkmedia boot entry @@ -768,6 +792,8 @@ "add-repoalias=s" => \@AddRepositoryAlias, "add-repopriority=i" => \@AddRepositoryPriority, "add-repotype=s" => \@AddRepositoryType, + "bundle-build=s" => \$BundleBuild, + "bundle-id=s" => \$BundleID, "bootcd=s" => \$BootCD, "bootusb=s" => \$BootUSB, "bootvm=s" => \$BootVMDisk, @@ -899,6 +925,12 @@ kiwiExit (1); } #======================================== + # check if bundle-build option is set + #---------------------------------------- + if (defined $BundleID) { + $cmdL -> setBuildNumber ($BundleID); + } + #======================================== # check if archive-image option is set #---------------------------------------- if (defined $ArchiveImage) { @@ -1284,6 +1316,9 @@ #======================================== # store operation modes #---------------------------------------- + if (defined $BundleBuild) { + $cmdL -> setOperationMode ("bundle",$BundleBuild); + } if (defined $Build) { $cmdL -> setOperationMode ("build",$Build); } @@ -1415,6 +1450,7 @@ #------------------------------------------ if ( (! defined $Build) && + (! defined $BundleBuild) && (! defined $Prepare) && (! defined $Create) && (! defined $InitCache) && @@ -1495,6 +1531,16 @@ $kiwi -> failed (); kiwiExit (1); } + if ((defined $BundleBuild) && (! defined $Destination)) { + $kiwi -> error ("No destination directory specified"); + $kiwi -> failed (); + kiwiExit (1); + } + if ((defined $BundleBuild) && (! defined $BundleID)) { + $kiwi -> error ("No bundle ID specified for bundle build"); + $kiwi -> failed (); + kiwiExit (1); + } return; } @@ -1549,6 +1595,10 @@ print " kiwi --test-image <image> --test-case <path>\n"; print " --type <image-type>\n"; print "\n"; + print "Image bundle (user relevant files)\n"; + print " kiwi --bundle-build <image-dest> --bundle-id <build-number>\n"; + print " --dest-dir <dest-dir>\n"; + print "\n"; print "Image Post Creation modes:\n"; print " kiwi --bootvm <initrd> --bootvm-system <systemImage>\n"; print " [ --bootvm-disksize <size> ]\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWIBoot.pm new/kiwi/modules/KIWIBoot.pm --- old/kiwi/modules/KIWIBoot.pm 2014-05-27 09:33:35.000000000 +0200 +++ new/kiwi/modules/KIWIBoot.pm 2014-06-05 10:40:15.000000000 +0200 @@ -3657,13 +3657,6 @@ $lib = 'lib64'; } #========================================== - # boot id in grub2 context - #------------------------------------------ - my $boot_id = 1; - if ($this->{partids}) { - $boot_id = $this->{partids}{boot}; - } - #========================================== # Stage files #------------------------------------------ $stages{bios}{initrd} = "'usr/lib/$grub_bios/$grubpc/*'"; @@ -4313,15 +4306,6 @@ #------------------------------------------ if ($loader eq "grub2") { #========================================== - # root/boot id's in grub2 context - #------------------------------------------ - my $boot_id = 1; - my $root_id = 1; - if ($this->{partids}) { - $boot_id = $this->{partids}{boot}; - $root_id = $this->{partids}{root}; - } - #========================================== # Theme and Fonts table #------------------------------------------ my $theme = $xml -> getPreferences() -> getBootLoaderTheme(); @@ -4659,8 +4643,12 @@ # boot id in grub context #------------------------------------------ my $boot_id = 0; - if (($this->{partids}) && ($this->{partids}{boot})) { - $boot_id = $this->{partids}{boot} - 1; + if ($this->{partids}) { + if ($this->{partids}{boot}) { + $boot_id = $this->{partids}{boot} - 1; + } elsif ($this->{partids}{root}) { + $boot_id = $this->{partids}{root} - 1; + } } #========================================== # Create menu.lst file @@ -4882,6 +4870,8 @@ } else { print $FD "gfxboot bootlogo"."\n"; } + } else { + print $FD "ui menu.c32"."\n"; } #========================================== # Setup default title @@ -5486,6 +5476,8 @@ $boot_id = $this->{partids}{installboot}; } elsif ($this->{partids}{boot}) { $boot_id = $this->{partids}{boot}; + } elsif ($this->{partids}{root}) { + $boot_id = $this->{partids}{root}; } } if ((! $this->{bindloop}) && (-b $diskname)) { @@ -5633,8 +5625,12 @@ # re-init bootid, legacy grub starts at 0 #------------------------------------------ $boot_id = 0; - if (($this->{partids}) && ($this->{partids}{boot})) { - $boot_id = $this->{partids}{boot} - 1; + if ($this->{partids}) { + if ($this->{partids}{boot}) { + $boot_id = $this->{partids}{boot} - 1; + } elsif ($this->{partids}{root}) { + $boot_id = $this->{partids}{root} - 1; + } } #========================================== # Clean loop maps diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWICollect.pm new/kiwi/modules/KIWICollect.pm --- old/kiwi/modules/KIWICollect.pm 2014-05-23 14:09:40.000000000 +0200 +++ new/kiwi/modules/KIWICollect.pm 2014-06-05 10:40:15.000000000 +0200 @@ -987,6 +987,20 @@ } #========================================== +# indexOfArray +#------------------------------------------ +sub indexOfArray { + my $element = shift; + my $array = shift; + my $count = 0; + foreach my $val(@$array) { + $count = $count + 1; + return $count if "$val" eq "$element"; + } + return $count; +} + +#========================================== # setupPackageFiles #------------------------------------------ sub setupPackageFiles { @@ -1075,10 +1089,18 @@ if ($this->{m_debug} >= 5) { $this->logMsg('I', " check architecture $arch "); } + # sort keys 1st by repository order and secondary + # by architecture priority PACKKEY: for my $packKey( sort { $poolPackages->{$a}->{priority} <=> $poolPackages->{$b}->{priority} + || indexOfArray( + $poolPackages->{$a}->{arch}, \@fallbacklist + ) + <=> indexOfArray( + $poolPackages->{$b}->{arch}, \@fallbacklist + ) } keys(%{$poolPackages}) ) { if ($this->{m_debug} >= 5) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWICommandLine.pm new/kiwi/modules/KIWICommandLine.pm --- old/kiwi/modules/KIWICommandLine.pm 2014-05-23 14:09:40.000000000 +0200 +++ new/kiwi/modules/KIWICommandLine.pm 2014-06-05 10:40:15.000000000 +0200 @@ -817,6 +817,19 @@ } #========================================== +# setBuildNumber +#------------------------------------------ +sub setBuildNumber { + # ... + # Store the build number used to bundle this build + # --- + my $this = shift; + my $build = shift; + $this->{buildNumber} = $build; + return 1; +} + +#========================================== # getSplashFile #------------------------------------------ sub getInitrdFile { @@ -825,6 +838,14 @@ } #========================================== +# getBuildNumber +#------------------------------------------ +sub getBuildNumber { + my $this = shift; + return $this->{buildNumber}; +} + +#========================================== # setSystemLocation #------------------------------------------ sub setSystemLocation { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWIConfig.sh new/kiwi/modules/KIWIConfig.sh --- old/kiwi/modules/KIWIConfig.sh 2014-05-23 14:09:40.000000000 +0200 +++ new/kiwi/modules/KIWIConfig.sh 2014-06-05 10:40:15.000000000 +0200 @@ -1268,6 +1268,10 @@ elif [ -f /usr/share/syslinux/gfxboot.c32 ];then mv /usr/share/syslinux/gfxboot.c32 /image/loader fi + # add menu capabilities for non graphics boot + if [ -f /usr/share/syslinux/menu.c32 ];then + mv /usr/share/syslinux/menu.c32 /image/loader + fi if [ -f /usr/share/syslinux/chain.c32 ];then mv /usr/share/syslinux/chain.c32 /image/loader fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWIGlobals.pm new/kiwi/modules/KIWIGlobals.pm --- old/kiwi/modules/KIWIGlobals.pm 2014-05-30 14:10:16.000000000 +0200 +++ new/kiwi/modules/KIWIGlobals.pm 2014-06-06 12:08:51.000000000 +0200 @@ -20,6 +20,7 @@ use strict; use warnings; use File::Basename; +use Config::IniFiles; use LWP; #========================================== # KIWI Modules @@ -504,6 +505,85 @@ } #========================================== +# generateBuildInformation +#------------------------------------------ +sub generateBuildInformation { + # ... + # write an ini file containing information about + # the build. This data is used in the KIWIResult to + # create an image release + # --- + my $this = shift; + my $xml = shift; + my $cmdL = shift; + my $kiwi = $this->{kiwi}; + #========================================== + # requires pointer to xml and command line + #------------------------------------------ + if ((! $xml) || (! $cmdL)) { + $kiwi -> warning ( + "Need pointer to XML config and command line" + ); + $kiwi -> skipped(); + return; + } + my $idest = $cmdL -> getImageIntermediateTargetDir(); + my $name = $this -> generateBuildImageName($xml); + my $file = $idest.'/kiwi.buildinfo'; + KIWIQX::qxx ("echo '[main]' > $file"); + my $buildinfo = Config::IniFiles -> new ( + -file => $file, -allowedcommentchars => '#' + ); + if (! $buildinfo) { + $kiwi -> warning ( + "Can't create build info file: $file" + ); + $kiwi -> skipped (); + return; + } + #========================================== + # store image base name + #------------------------------------------ + $buildinfo->newval('main', 'image.basename', $name); + #========================================== + # store build format + #------------------------------------------ + my $bldType = $xml -> getImageType(); + if ($bldType) { + my $format = $bldType -> getFormat(); + if ($format) { + $buildinfo->newval('main', 'image.format', $format); + } + } + #========================================== + # store build type + #------------------------------------------ + if ($bldType) { + my $imgtype = $bldType -> getTypeName(); + $buildinfo->newval('main', 'image.type', $imgtype); + } + #========================================== + # store install media type + #------------------------------------------ + if ($bldType) { + my $instIso = $bldType -> getInstallIso(); + my $instStick = $bldType -> getInstallStick(); + my $instPXE = $bldType -> getInstallPXE(); + if (($instIso) && ($instIso eq 'true')) { + $buildinfo->newval('main', 'install.iso', 'true'); + } + if (($instStick) && ($instStick eq 'true')) { + $buildinfo->newval('main', 'install.stick', 'true'); + } + if (($instPXE) && ($instPXE eq 'true')) { + $buildinfo->newval('main', 'install.pxe', 'true'); + } + } + $buildinfo->RewriteConfig(); + return $this; +} + +#========================================== # generateBuildImageName #------------------------------------------ sub generateBuildImageName { @@ -1398,7 +1478,7 @@ # Globals (generic) #------------------------------------------ my %data; - $data{Version} = "5.06.104"; + $data{Version} = "5.06.107"; $data{Publisher} = "SUSE LINUX GmbH"; $data{Preparer} = "KIWI - http://opensuse.github.com/kiwi"; $data{ConfigName} = "config.xml"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWIImageCreator.pm new/kiwi/modules/KIWIImageCreator.pm --- old/kiwi/modules/KIWIImageCreator.pm 2014-05-23 14:09:43.000000000 +0200 +++ new/kiwi/modules/KIWIImageCreator.pm 2014-06-05 10:40:15.000000000 +0200 @@ -454,7 +454,7 @@ $kiwi -> info ("Reading image description [Upgrade]...\n"); my $buildProfs = $this -> {buildProfiles}; my $xml = KIWIXML -> new( - $configDir, undef, $buildProfs,$cmdL + $configDir, $this->{buildType}, $buildProfs,$cmdL ); if (! defined $xml) { return; @@ -951,6 +951,11 @@ } } #========================================== + # Create build result information + #------------------------------------------ + KIWIGlobals -> instance() + -> generateBuildInformation($xml, $cmdL); + #========================================== # Add system strip from bootincludes #------------------------------------------ $this -> __addBootincludedToolsToKeep ($xml, $tree); @@ -2234,7 +2239,6 @@ $kiwi -> warning ( "--> package $pack_name not installed\n" ); - $kiwi -> skipped(); } } my $FILE = FileHandle -> new(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWILinuxRC.sh new/kiwi/modules/KIWILinuxRC.sh --- old/kiwi/modules/KIWILinuxRC.sh 2014-05-26 15:35:05.000000000 +0200 +++ new/kiwi/modules/KIWILinuxRC.sh 2014-06-06 12:08:51.000000000 +0200 @@ -966,6 +966,11 @@ Echo "Failed to install boot loader" return 1 fi + if [[ $kiwi_iname =~ boot-rhel ]];then + # on rhel systems grub.conf is a link to menu.lst. + rm -f /etc/grub.conf + ln -s /boot/grub/menu.lst /etc/grub.conf + fi else Echo "Image doesn't have grub installed" Echo "Can't install boot loader" @@ -1198,16 +1203,14 @@ # last primary partition of the disk # ---- local confTool=grub2-mkconfig - local instTool=grub2-install - local confPath=/boot/grub2/grub.cfg + local confFile_grub_bios=/boot/grub2/grub.cfg + local confFile_grub_efi=/boot/grub2-efi/grub.cfg + local confFile_uefi=/boot/efi/EFI/BOOT/grub.cfg + local confFile_grub=$confFile_grub_bios + local bios_grub=/reco-save/boot/grub2/i386-pc #====================================== # check tool status #-------------------------------------- - if [ "$partedTableType" = "gpt" ];then - lookup grub2-efi-mkconfig &>/dev/null && confTool=grub2-efi-mkconfig - lookup grub2-efi-install &>/dev/null && instTool=grub2-efi-install - confPath=/boot/grub2-efi/grub.cfg - fi if ! lookup $confTool &>/dev/null;then Echo "Image doesn't have grub2 installed" Echo "Can't install boot loader" @@ -1216,29 +1219,49 @@ #====================================== # install grub2 into partition #-------------------------------------- - $instTool --force \ - --boot-directory=/reco-save/boot $imageRecoveryDevice 1>&2 + # this allows a bios to directly jump there, e.g with a function key + grub2-bios-setup -f -d $bios_grub $imageRecoveryDevice 1>&2 if [ ! $? = 0 ];then Echo "Failed to install boot loader" fi #====================================== # create custom recovery entry #-------------------------------------- - local method="chainloader +1" - if [ "$partedTableType" = "gpt" ];then - method="configfile /boot/grub2/grub.cfg" - fi - cat > /etc/grub.d/40_custom <<- EOF - echo "menuentry 'Recovery' --class os {" - echo " set root='hd0,$recoid'" - echo " $method" - echo "}" - EOF - $confTool > $confPath + cat > /etc/grub.d/40_custom <<- DONE + #!/bin/sh + cat <<EOF + menuentry 'Recovery' --class os { + set root='hd0,$recoid' + configfile /boot/grub2/grub.cfg + } + EOF + DONE + #====================================== + # create grub2 config file + #-------------------------------------- + $confTool > $confFile_grub if [ ! $? = 0 ];then Echo "Failed to create grub2 boot configuration" return 1 fi + #====================================== + # update efi grub2 config file(s) + #-------------------------------------- + if [ -e $confFile_grub_efi ];then + cp $confFile_grub $confFile_grub_efi + fi + if [ ! -z "$kiwi_JumpPart" ];then + local jdev=$(ddn $imageDiskDevice $kiwi_JumpPart) + local label=$(blkid $jdev -s LABEL -o value) + if [ "$label" = "EFI" ];then + if mount $jdev /boot/efi;then + if [ -e $confFile_uefi ];then + cp $confFile_grub $confFile_uefi + umount /boot/efi + fi + fi + fi + fi return 0 } #====================================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWIResult.pm new/kiwi/modules/KIWIResult.pm --- old/kiwi/modules/KIWIResult.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/kiwi/modules/KIWIResult.pm 2014-06-05 10:40:15.000000000 +0200 @@ -0,0 +1,434 @@ +#================ +# FILE : KIWIResult.pm +#---------------- +# PROJECT : openSUSE Build-Service +# COPYRIGHT : (c) 2014 SUSE LINUX Products GmbH, Germany +# : +# AUTHOR : Marcus Schaefer <[email protected]> +# : +# BELONGS TO : Operating System images +# : +# DESCRIPTION : This module is used to bundle build results +# : +# : +# STATUS : Production +#---------------- +package KIWIResult; +#========================================== +# Modules +#------------------------------------------ +use strict; +use warnings; +use Config::IniFiles; + +#========================================== +# KIWI Modules +#------------------------------------------ +use KIWIGlobals; +use KIWILog; +use KIWIQX; + +#========================================== +# Constructor +#------------------------------------------ +sub new { + # ... + # Create a new KIWIResult object + # --- + #========================================== + # Object setup + #------------------------------------------ + my $this = {}; + my $class = shift; + bless $this,$class; + #========================================== + # Module Parameters + #------------------------------------------ + my $sourcedir = shift; + my $destdir = shift; + my $buildnr = shift; + #========================================== + # Parameter check + #------------------------------------------ + my $kiwi = KIWILog->instance(); + if (-d $destdir) { + $kiwi -> error ("Destination dir $destdir already exists"); + $kiwi -> failed(); + return; + } + if (! $sourcedir) { + $kiwi -> error ("No image source directory specified"); + $kiwi -> failed(); + return; + } + if (! $buildnr) { + $kiwi -> error ("No build-id specified"); + $kiwi -> failed(); + return; + } + #========================================== + # read in build information file + #------------------------------------------ + my $file = $sourcedir.'/kiwi.buildinfo'; + if (! -e $file) { + $kiwi -> error ("Can't find $file"); + $kiwi -> failed (); + return; + } + my $buildinfo = Config::IniFiles -> new ( + -file => $file, -allowedcommentchars => '#' + ); + my $imagebase = $buildinfo->val('main','image.basename'); + if (! $imagebase) { + $kiwi -> error ("Can't find image.basename"); + $kiwi -> failed (); + return; + } + #========================================== + # create temp. dir + #------------------------------------------ + my $tmpdir = KIWIQX::qxx ( + "mktemp -qdt kiwiresult.XXXXXX" + ); + my $result = $? >> 8; + if ($result != 0) { + $kiwi -> error ("Couldn't create tmp dir: $tmpdir: $!"); + $kiwi -> failed (); + return; + } + chomp $tmpdir; + #========================================== + # Store object data + #------------------------------------------ + $this->{imagebase} = $imagebase; + $this->{tmpdir} = $tmpdir; + $this->{buildinfo} = $buildinfo; + $this->{kiwi} = $kiwi; + $this->{sourcedir} = $sourcedir; + $this->{destdir} = $destdir; + $this->{buildnr} = $buildnr; + return $this; +} + +#========================================== +# buildRelease +#------------------------------------------ +sub buildRelease { + # ... + # bundle result image files into a tmpdir and skip + # intermediate build results as well as the build + # metadata. The result files will contain the + # given build number + # --- + my $this = shift; + my $buildnr = $this->{buildnr}; + my $kiwi = $this->{kiwi}; + my $buildinfo = $this->{buildinfo}; + my $result; + $kiwi -> info ("Bundle build results for release: $buildnr\n"); + #========================================== + # Evaluate bundler method + #------------------------------------------ + my $type = $buildinfo->val('main','image.type'); + if (! $type) { + $kiwi -> info ("--> Calling default bundler\n"); + $result = $this -> __bundleDefault(); + $this->DESTROY if ! $result; + return $result; + } + if ($type eq 'product') { + $kiwi -> info ("--> Calling product bundler\n"); + $result = $this -> __bundleProduct(); + } elsif ($type eq 'docker') { + $kiwi -> info ("--> Calling docker bundler\n"); + $result = $this -> __bundleDocker(); + } elsif ($type eq 'lxc') { + $kiwi -> info ("--> Calling LXC bundler\n"); + $result = $this -> __bundleLXC(); + } elsif ($type eq 'iso') { + $kiwi -> info ("--> Calling ISO bundler\n"); + $result = $this -> __bundleISO(); + } elsif ($type eq 'tbz') { + $kiwi -> info ("--> Calling TBZ bundler\n"); + $result = $this -> __bundleTBZ(); + } elsif ($type eq 'vmx') { + $kiwi -> info ("--> Calling Disk VMX bundler\n"); + $result = $this -> __bundleDisk(); + } elsif ($type eq 'oem') { + $kiwi -> info ("--> Calling Disk OEM bundler\n"); + $result = $this -> __bundleDisk(); + } else { + $kiwi -> info ("--> Calling default bundler\n"); + $result = $this -> __bundleDefault(); + } + $this->DESTROY if ! $result; + return $result; +} + +#========================================== +# populateRelease +#------------------------------------------ +sub populateRelease { + # ... + # Move files from tmpdir back to destdir and + # delete level 1 files from the destdir before + # --- + my $this = shift; + my $kiwi = $this->{kiwi}; + my $dest = $this->{destdir}; + my $tmpdir = $this->{tmpdir}; + $kiwi -> info ( + "Populating build results to: $dest\n" + ); + #========================================== + # copy build meta data + #------------------------------------------ + if (! $this -> __bundleMeta()) { + $this->DESTROY; + return; + } + #========================================== + # populate results + #------------------------------------------ + my $status = KIWIQX::qxx ( + "mkdir -p $dest && mv $tmpdir/* $dest/ 2>&1" + ); + my $result = $? >> 8; + if ($result != 0) { + $kiwi -> error ("Failed to populate results: $status"); + $kiwi -> failed (); + $this->DESTROY; + return; + } + #========================================== + # cleanup + #------------------------------------------ + $this->DESTROY; + return $this; +} + +#========================================== +# __bundleMeta +#------------------------------------------ +sub __bundleMeta { + my $this = shift; + my $kiwi = $this->{kiwi}; + my $source = $this->{sourcedir}; + my $tmpdir = $this->{tmpdir}; + my $bnr = $this->{buildnr}; + my $base = $this->{imagebase}; + my @meta = ( + 'packages','verified','channel' + ); + my $data; + my $code; + foreach my $suffix (@meta) { + my $meta = "$source/$base.$suffix"; + if (-e $meta) { + $data = KIWIQX::qxx ( + "cp $meta $tmpdir/$base-$bnr.$suffix 2>&1" + ); + $code = $? >> 8; + if ($code != 0) { + $kiwi -> error ("Failed to copy $meta: $data"); + $kiwi -> failed (); + return; + } + } + } + return $this; +} + +#========================================== +# __bundleDefault +#------------------------------------------ +sub __bundleDefault { + my $this = shift; + my $kiwi = $this->{kiwi}; + my $source = $this->{sourcedir}; + my $tmpdir = $this->{tmpdir}; + my $bnr = $this->{buildnr}; + my $base = $this->{imagebase}; + my @excl = ( + '--exclude *.buildinfo', + '--exclude *.verified', + '--exclude *.packages' + ); + my $opts = '--no-recursion'; + my $data = KIWIQX::qxx ( + "cd $source && find . -maxdepth 1 -type f 2>&1" + ); + my $code = $? >> 8; + if ($code == 0) { + my @flist = split(/\n/,$data); + $data = KIWIQX::qxx ( + "cd $source && tar $opts -czf $tmpdir/$base-$bnr.tgz @excl @flist" + ); + $code = $? >> 8; + } + if ($code != 0) { + $kiwi -> error ("Failed to archive results: $data"); + $kiwi -> failed (); + return; + } + return $this; +} + +#========================================== +# __bundleExtension +#------------------------------------------ +sub __bundleExtension { + my $this = shift; + my $suffix = shift; + my $base = shift; + my $kiwi = $this->{kiwi}; + my $source = $this->{sourcedir}; + my $tmpdir = $this->{tmpdir}; + my $bnr = $this->{buildnr}; + if (! $base) { + $base = $this->{imagebase}; + } + my $data = KIWIQX::qxx ( + "cp $source/$base.$suffix $tmpdir/$base-$bnr.$suffix 2>&1" + ); + my $code = $? >> 8; + if ($code != 0) { + $kiwi -> error ("Failed to copy $suffix image: $data"); + $kiwi -> failed (); + return; + } + if ($suffix =~ /json|vmx|xenconfig/) { + my $file = "$tmpdir/$base-$bnr.$suffix"; + $data = KIWIQX::qxx ( + "sed -i -e 's/$base/$base-$bnr/' $file 2>&1" + ); + my $code = $? >> 8; + if ($code != 0) { + $kiwi -> error ( + "Failed to update metadata contents of $file: $data" + ); + $kiwi -> failed (); + return; + } + } + return $this; +} + +#========================================== +# __bundleProduct +#------------------------------------------ +sub __bundleProduct { + my $this = shift; + return $this -> __bundleExtension ('iso'); +} + +#========================================== +# __bundleDocker +#------------------------------------------ +sub __bundleDocker { + my $this = shift; + return $this -> __bundleExtension ('docker'); +} + +#========================================== +# __bundleLXC +#------------------------------------------ +sub __bundleLXC { + my $this = shift; + return $this -> __bundleExtension ('lxc'); +} + +#========================================== +# __bundleISO +#------------------------------------------ +sub __bundleISO { + my $this = shift; + return $this -> __bundleExtension ('iso'); +} + +#========================================== +# __bundleTBZ +#------------------------------------------ +sub __bundleTBZ { + my $this = shift; + return $this -> __bundleExtension ('tbz'); +} + +#========================================== +# __bundleDisk +#------------------------------------------ +sub __bundleDisk { + my $this = shift; + my $kiwi = $this->{kiwi}; + my $base = $this->{imagebase}; + my $source = $this->{sourcedir}; + my $tmpd = $this->{tmpdir}; + my $bnr = $this->{buildnr}; + my $buildinfo = $this->{buildinfo}; + my $data; + my $code; + #========================================== + # handle install media + #------------------------------------------ + if ($buildinfo->exists('main','install.iso')) { + return $this -> __bundleExtension ('install.iso'); + } elsif ($buildinfo->exists('main','install.stick')) { + return $this -> __bundleExtension ('install.raw'); + } elsif ($buildinfo->exists('main','install.pxe')) { + return $this -> __bundleExtension ('install.tgz'); + } + #========================================== + # handle formats + #------------------------------------------ + my $format = $buildinfo->val('main','image.format'); + if (! $format) { + return $this -> __bundleExtension ('raw'); + } + if ($format eq 'vagrant') { + my @boxes = glob ("$source/$base.*.box"); + if (! @boxes) { + $kiwi -> error ("No box files found"); + $kiwi -> failed (); + return; + } + foreach my $box (@boxes) { + if ($box =~ /$base\.(.*)\.box/) { + my $provider = $1; + if (! $this -> __bundleExtension('box',"$base.$provider")) { + return; + } + if (! $this -> __bundleExtension('json',"$base.$provider")) { + return; + } + } + } + return $this; + } + if (! $this -> __bundleExtension ($format)) { + return; + } + #========================================== + # handle machine configuration + #------------------------------------------ + if (-e "$source/$base.vmx") { + return $this -> __bundleExtension ('vmx'); + } + if (-e "$source/$base.xenconfig") { + return $this -> __bundleExtension ('xenconfig'); + } + return $this; +} + +#========================================== +# Destructor +#------------------------------------------ +sub DESTROY { + my $this = shift; + my $tmpdir = $this->{tmpdir}; + if (($tmpdir) && (-d $tmpdir)) { + KIWIQX::qxx ("rm -rf $tmpdir"); + } + return $this; +} + +1; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
