commit kiwi for openSUSE:Factory
Hello community, here is the log from the commit of package kiwi for openSUSE:Factory checked in at Fri Feb 25 15:21:33 CET 2011. -------- --- kiwi/kiwi.changes 2011-02-22 18:05:20.000000000 +0100 +++ /mounts/work_src_done/STABLE/kiwi/kiwi.changes 2011-02-25 13:35:30.000000000 +0100 @@ -1,0 +2,60 @@ +Fri Feb 25 13:29:39 CET 2011 - ms@suse.de + +- v4.79 released + +------------------------------------------------------------------- +Fri Feb 25 11:22:19 CET 2011 - ms@suse.de + +- The default tftp block size chosen by kiwi is too small and + not aligned to page size (4096), so it causes unnecessary + overhead. This patch improves loading performance a lot + +------------------------------------------------------------------- +Thu Feb 24 14:31:23 CET 2011 - adrian@suse.de + +- just compare the major version of squashfs kernel module and squashfs tools (bnc #674653) + +------------------------------------------------------------------- +Thu Feb 24 12:15:56 CET 2011 - adrian@suse.de + +- parse all available product file not just the first one + +------------------------------------------------------------------- +Thu Feb 24 10:18:04 CET 2011 - ms@suse.de + +- fixed -z test for RELOAD_CONFIG variable in netboot + +------------------------------------------------------------------- +Thu Feb 24 09:52:45 CET 2011 - ms@suse.de + +- added unit testing for the KIWILocator object + +------------------------------------------------------------------- +Thu Feb 24 09:46:06 CET 2011 - ms@suse.de + +- added ensconce parameter -i imagename which contains + the contents of the name attribute. ensconce requires this + to distinguish between system image and initrd image + +------------------------------------------------------------------- +Wed Feb 23 14:22:00 CET 2011 - ms@suse.de + +- Using here documents with tabs in front of the limit + string works but is not recommended. Tabs are ignored + when searching for the limit string but spaces are not, + in which case the here document ends at the next occurence + of the limit string or at the end of the file with some + shells not even issuing a warning + +------------------------------------------------------------------- +Wed Feb 23 09:52:15 CET 2011 - ms@suse.de + +- fixed use of uninitialized value if an improper + configuration directory is specified + +------------------------------------------------------------------- +Tue Feb 22 18:36:05 CET 2011 - ms@suse.de + +- move warning messages about shm and semaphores into logfile + +------------------------------------------------------------------- calling whatdependson for head-i586 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kiwi.spec ++++++ --- /var/tmp/diff_new_pack.ceVne2/_old 2011-02-25 15:17:11.000000000 +0100 +++ /var/tmp/diff_new_pack.ceVne2/_new 2011-02-25 15:17:11.000000000 +0100 @@ -65,7 +65,7 @@ %endif %endif Summary: OpenSuSE - KIWI Image System -Version: 4.78 +Version: 4.79 Release: 1 Group: System/Management License: GPLv2 ++++++ kiwi-docu.tar.bz2 ++++++ kiwi/kiwi-docu.tar.bz2 /mounts/work_src_done/STABLE/kiwi/kiwi-docu.tar.bz2 differ: char 11, line 1 ++++++ kiwi.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/.revision new/kiwi/.revision --- old/kiwi/.revision 2011-02-22 18:02:35.000000000 +0100 +++ new/kiwi/.revision 2011-02-25 13:31:24.000000000 +0100 @@ -1 +1 @@ -d32fb17debadd5fa678e69503183bf70ad1eeb51 +ea7a834247aebbb4f41a028503fa9a62f03c2293 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/kiwi.pl new/kiwi/kiwi.pl --- old/kiwi/kiwi.pl 2011-02-22 18:02:35.000000000 +0100 +++ new/kiwi/kiwi.pl 2011-02-25 13:31:24.000000000 +0100 @@ -47,7 +47,7 @@ #============================================ # Globals (Version) #-------------------------------------------- -our $Version = "4.78"; +our $Version = "4.79"; our $Publisher = "SUSE LINUX Products GmbH"; our $Preparer = "KIWI - http://kiwi.berlios.de"; our $openSUSE = "http://download.opensuse.org"; @@ -2382,16 +2382,16 @@ my $mktool_vs = qxx ("mksquashfs -version 2>&1 | head -n 1"); my $module_vs = qxx ("modinfo -d $km 2>&1"); my $error = 0; - if ($mktool_vs =~ /^mksquashfs version (\d\.\d) \(/) { + if ($mktool_vs =~ /^mksquashfs version (\d)\.\d \(/) { $mktool_vs = $1; $error++; } - if ($module_vs =~ /^squashfs (\d\.\d),/) { + if ($module_vs =~ /^squashfs (\d)\.\d,/) { $module_vs = $1; $error++; } - $kiwi -> loginfo ("squashfs mktool version: $mktool_vs\n"); - $kiwi -> loginfo ("squashfs module version: $module_vs\n"); + $kiwi -> loginfo ("squashfs mktool major version: $mktool_vs\n"); + $kiwi -> loginfo ("squashfs module major version: $module_vs\n"); if (($error == 2) && ($mktool_vs ne $module_vs)) { $kiwi -> error ( "--> squashfs tool/driver mismatch: $mktool_vs vs $module_vs" 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 2011-02-21 16:58:21.000000000 +0100 +++ new/kiwi/modules/KIWICollect.pm 2011-02-25 13:03:46.000000000 +0100 @@ -1598,7 +1598,10 @@ # get all .prod files local *D; - opendir(D, $tmp."/etc/products.d/") || return (); + if (!opendir(D, $tmp."/etc/products.d/")) { + $this->logMsg("I", "No products found, skipping"); + next RELEASEPACK; + } my @r = grep {$_ =~ '\.prod$'} readdir(D); closedir D; 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 2011-02-21 15:15:26.000000000 +0100 +++ new/kiwi/modules/KIWILinuxRC.sh 2011-02-25 13:03:46.000000000 +0100 @@ -83,7 +83,7 @@ --exit-label "$TEXT_EXIT" \ $@ echo \$? > /tmp/fbcode - EOF +EOF fbiterm -m $UFONT -- bash /tmp/fbcode code=$(cat /tmp/fbcode) else @@ -3767,6 +3767,8 @@ # to the size of the image. The block size itself is also # limited to 65464 bytes # ---- + local blkTest + local nBlk if [ -z "$zblocks" ] && [ -z "$blocks" ];then # md5 file not yet read in... skip return @@ -3776,15 +3778,16 @@ else isize=`expr $blocks \* $blocksize` fi - isize=`expr $isize / 65535` - if [ $isize -gt $imageBlkSize ];then - imageBlkSize=`expr $isize + 1024` - fi - if [ $imageBlkSize -gt 65464 ];then - systemException \ - "Maximum blocksize for atftp protocol exceeded" \ - "reboot" - fi + for blkTest in 32768 61440 65464 ; do + nBlk=`expr $isize / $blkTest` + if [ $nBlk -lt 65535 ] ; then + imageBlkSize=$blkTest + return + fi + done + systemException \ + "Maximum blocksize for atftp protocol exceeded" \ + "reboot" } #====================================== # loadOK diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWILocator.pm new/kiwi/modules/KIWILocator.pm --- old/kiwi/modules/KIWILocator.pm 2011-01-20 09:19:55.000000000 +0100 +++ new/kiwi/modules/KIWILocator.pm 2011-02-25 13:03:46.000000000 +0100 @@ -20,6 +20,7 @@ use strict; use warnings; require Exporter; +use KIWILog; use KIWIQX; #========================================== @@ -70,7 +71,6 @@ my $this = shift; my $dir = shift; my $kiwi = $this->{kiwi}; - my $config = "$dir/" . $this->{configName}; if (! -d $dir) { my $msg = "Expected a directory at $dir.\nSpecify a directory"; $msg .= ' as the configuration base.'; @@ -78,6 +78,7 @@ $kiwi -> failed(); return undef; } + my $config = "$dir/" . $this->{configName}; if (-f $config) { return $config; } @@ -92,7 +93,7 @@ for my $item (@globsearch) { $msg .= "\t$item\n"; } - $kiwi -> errot ($msg); + $kiwi -> error ($msg); $kiwi -> failed(); return undef; } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWIManager.pm new/kiwi/modules/KIWIManager.pm --- old/kiwi/modules/KIWIManager.pm 2011-02-11 14:21:47.000000000 +0100 +++ new/kiwi/modules/KIWIManager.pm 2011-02-25 13:03:46.000000000 +0100 @@ -1076,7 +1076,6 @@ my @smart = @{$this->{smart}}; my @zypper = @{$this->{zypper}}; my @yum = @{$this->{yum}}; - my @ensconce = @{$this->{ensconce}}; my $screenCall = $this->{screenCall}; #========================================== # check addon packages @@ -1152,20 +1151,12 @@ # ensconce #------------------------------------------ if ($manager eq "ensconce") { - $kiwi -> info ("Installing addon packages..."); - print $fd "function clean { kill \$SPID; "; - print $fd "while kill -0 \$SPID &>/dev/null; do sleep 1;"; - print $fd "if [ \"\$c\" = 5 ];then kill \$SPID;break;fi;"; - print $fd "c=\$((\$c+1));done;\n"; - print $fd "while kill -0 \$SPID &>/dev/null; do sleep 1;done\n"; - print $fd "echo 1 > $screenCall.exit; exit 1; }\n"; - print $fd "trap clean INT TERM\n"; - print $fd "@ensconce &\n"; - print $fd "SPID=\$!;wait \$SPID\n"; - print $fd "ECODE=\$?\n"; - print $fd "echo \$ECODE > $screenCall.exit\n"; - print $fd "exit \$ECODE\n"; + # FIXME + $kiwi -> failed (); + $kiwi -> error ("*** not implemeted ***"); + $kiwi -> failed (); $fd -> close(); + return undef; } #========================================== # yum @@ -1216,7 +1207,6 @@ my @smart = @{$this->{smart}}; my @zypper = @{$this->{zypper}}; my @yum = @{$this->{yum}}; - my @ensconce = @{$this->{ensconce}}; my $screenCall = $this->{screenCall}; #========================================== # check to be removed packages @@ -1295,20 +1285,12 @@ # ensconce #------------------------------------------ if ($manager eq "ensconce") { - $kiwi -> info ("Installing addon packages..."); - print $fd "function clean { kill \$SPID; "; - print $fd "while kill -0 \$SPID &>/dev/null; do sleep 1;"; - print $fd "if [ \"\$c\" = 5 ];then kill \$SPID;break;fi;"; - print $fd "c=\$((\$c+1));done;\n"; - print $fd "while kill -0 \$SPID &>/dev/null; do sleep 1;done\n"; - print $fd "echo 1 > $screenCall.exit; exit 1; }\n"; - print $fd "trap clean INT TERM\n"; - print $fd "@ensconce &\n"; - print $fd "SPID=\$!;wait \$SPID\n"; - print $fd "ECODE=\$?\n"; - print $fd "echo \$ECODE > $screenCall.exit\n"; - print $fd "exit \$ECODE\n"; + # FIXME + $kiwi -> failed (); + $kiwi -> error ("*** not implemeted ***"); + $kiwi -> failed (); $fd -> close(); + return undef; } #========================================== # yum @@ -1354,7 +1336,6 @@ my @smart = @{$this->{smart}}; my @zypper = @{$this->{zypper}}; my @yum = @{$this->{yum}}; - my @ensconce = @{$this->{ensconce}}; my $screenCall = $this->{screenCall}; #========================================== # setup screen call @@ -1991,7 +1972,8 @@ # ensconce #------------------------------------------ if ($manager eq "ensconce") { - my $ensconce_args = ""; + my $imagename = $xml -> getImageName(); + my $ensconce_args = "-i $imagename"; if (! $chroot) { #========================================== # Setup baselibs @@ -2005,7 +1987,7 @@ #========================================== # Ensconce options #------------------------------------------ - $ensconce_args = "-b"; + $ensconce_args .= " -b"; } if (! $chroot) { $kiwi -> info ("Initializing image system on: $root..."); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWISharedMem.pm new/kiwi/modules/KIWISharedMem.pm --- old/kiwi/modules/KIWISharedMem.pm 2011-02-22 17:48:14.000000000 +0100 +++ new/kiwi/modules/KIWISharedMem.pm 2011-02-25 13:03:46.000000000 +0100 @@ -175,12 +175,10 @@ } return unless $this->{OWNER} == $$; # avoid dup dealloc if (! shmctl($this->{SHMKEY}, IPC_RMID, 0)) { - $kiwi -> warning ("shmctl RMID: $!"); - $kiwi -> skipped (); + $kiwi -> loginfo ("shmctl RMID: $!\n"); } if (! $this->{SEMA}->remove()) { - $kiwi -> warning ("sema->remove: $!"); - $kiwi -> skipped (); + $kiwi -> loginfo ("sema->remove: $!\n"); } return $this; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/modules/KIWIXML.pm new/kiwi/modules/KIWIXML.pm --- old/kiwi/modules/KIWIXML.pm 2011-02-18 12:20:07.000000000 +0100 +++ new/kiwi/modules/KIWIXML.pm 2011-02-25 13:03:46.000000000 +0100 @@ -113,6 +113,9 @@ #------------------------------------------ my $locator = new KIWILocator($kiwi); my $controlFile = $locator -> getControlFile ( $imageDesc ); + if (! $controlFile) { + return undef; + } #========================================== # Store object data #------------------------------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/system/boot/ix86/netboot/suse-linuxrc new/kiwi/system/boot/ix86/netboot/suse-linuxrc --- old/kiwi/system/boot/ix86/netboot/suse-linuxrc 2011-02-21 15:15:26.000000000 +0100 +++ new/kiwi/system/boot/ix86/netboot/suse-linuxrc 2011-02-25 13:03:46.000000000 +0100 @@ -765,7 +765,7 @@ #-------------------------------------- runHook preconfig if [ $LOCAL_BOOT = "no" ] || [ ! -z "$RELOAD_CONFIG" ];then - if test ! -z $RELOAD_CONFIG;then + if [ ! -z "$RELOAD_CONFIG" ];then Echo "Configuration files reload forced via RELOAD_CONFIG..." fi #======================================= @@ -806,7 +806,7 @@ # ---- cfg_copy=1 cfgmsg_why='(forced)' - if test -z $RELOAD_CONFIG;then + if [ -z "$RELOAD_CONFIG" ];then cfgmsg_why='(missing)' IFS=","; for j in $ALL_CBK_CONF;do BKconfigDest=`echo "$j" | cut -d ';' -f 2` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/tests/unit/KIWILocator.t new/kiwi/tests/unit/KIWILocator.t --- old/kiwi/tests/unit/KIWILocator.t 1970-01-01 01:00:00.000000000 +0100 +++ new/kiwi/tests/unit/KIWILocator.t 2011-02-25 13:03:46.000000000 +0100 @@ -0,0 +1,27 @@ +#================ +# FILE : KIWILocator.t +#---------------- +# PROJECT : OpenSUSE Build-Service +# COPYRIGHT : (c) 2011 Novell Inc. +# : +# AUTHOR : Robert Schweikert <rschweikert@novell.com> +# : +# BELONGS TO : Operating System images +# : +# DESCRIPTION : Unit test driver for the KIWILocator module. +# : +# STATUS : Development +#---------------- +use strict; +use warnings; +use FindBin; +use Test::Unit::HarnessUnit; + +# Location of test cases according to program path +use lib "$FindBin::Bin/lib"; + +# Location of Kiwi modules relative to test +use lib "$FindBin::Bin/../../modules"; + +my $runner = Test::Unit::HarnessUnit->new(); +$runner->start( 'Test::kiwiLocator' ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/tests/unit/data/kiwiLocator/config.xml new/kiwi/tests/unit/data/kiwiLocator/config.xml --- old/kiwi/tests/unit/data/kiwiLocator/config.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/kiwi/tests/unit/data/kiwiLocator/config.xml 2011-02-25 13:03:46.000000000 +0100 @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> + +<image schemaversion="5.2" name="suse-11.3-vm-guest"> + <description type="system"> + <author>Robert Schweikert</author> + <contact>rschweikert@novell.com</contact> + <specification>Generic valid configuration file</specification> + </description> + <preferences> + <type image="vmx" filesystem="ext4" boot="vmxboot/suse-11.3" format="vmdk"> + <machine memory="512"> + <vmdisk controller="ide" id="0"/> + <vmnic interface="0" driver="e1000" mode="bridged"/> + <vmnic interface="1" driver="e1000" mode="bridged"/> + </machine> + </type> + <version>1.0.0</version> + <packagemanager>zypper</packagemanager> + <rpm-check-signatures>false</rpm-check-signatures> + <rpm-force>true</rpm-force> + <locale>en_US</locale> + <keytable>us.map.gz</keytable> + </preferences> + <users group="root"> + <user pwd="linux" pwdformat="plain" home="/root" name="root"/> + </users> + <repository type="yast2"> + <source path="opensuse://11.3/repo/oss/"/> + </repository> + <packages type="image"> + <package name="bootsplash-branding-openSUSE" bootinclude="true" bootdelete="true"/> + <package name="gfxboot-branding-openSUSE" bootinclude="true" bootdelete="true"/> + <package name="kernel-default"/> + <package name="ifplugd"/> + <package name="vim"/> + <opensusePattern name="base"/> + </packages> + <packages type="bootstrap"> + <package name="filesystem"/> + <package name="glibc-locale"/> + </packages> +</image> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/tests/unit/data/kiwiLocator/multiConf/config_one.kiwi new/kiwi/tests/unit/data/kiwiLocator/multiConf/config_one.kiwi --- old/kiwi/tests/unit/data/kiwiLocator/multiConf/config_one.kiwi 1970-01-01 01:00:00.000000000 +0100 +++ new/kiwi/tests/unit/data/kiwiLocator/multiConf/config_one.kiwi 2011-02-25 13:03:46.000000000 +0100 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<image schemaversion="4.7" name="suse-11.3-vm-guest"> + <description type="system"> + <author>Robert Schweikert</author> + <contact>rschweikert@novell.com</contact> + <specification>Generic valid configuration file</specification> + </description> + <preferences> + <type image="vmx" filesystem="ext4" boot="vmxboot/suse-11.3" format="vmdk"> + <machine memory="512"> + <vmdisk controller="ide" id="0"/> + <vmnic interface="0" driver="e1000" mode="bridged"/> + <vmnic interface="1" driver="e1000" mode="bridged"/> + </machine> + </type> + <version>1.0.0</version> + <packagemanager>zypper</packagemanager> + <rpm-check-signatures>false</rpm-check-signatures> + <rpm-force>true</rpm-force> + <locale>en_US</locale> + <keytable>us.map.gz</keytable> + </preferences> + <users group="root"> + <user pwd="linux" pwdformat="plain" home="/root" name="root"/> + </users> + <repository type="yast2"> + <source path="opensuse://11.3/repo/oss/"/> + </repository> + <packages type="image"> + <package name="bootsplash-branding-openSUSE" bootinclude="true" bootdelete="true"/> + <package name="gfxboot-branding-openSUSE" bootinclude="true" bootdelete="true"/> + <package name="kernel-default"/> + <package name="ifplugd"/> + <package name="vim"/> + <opensusePattern name="base"/> + </packages> + <packages type="bootstrap"> + <package name="filesystem"/> + <package name="glibc-locale"/> + </packages> +</image> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/tests/unit/data/kiwiLocator/multiConf/config_two.kiwi new/kiwi/tests/unit/data/kiwiLocator/multiConf/config_two.kiwi --- old/kiwi/tests/unit/data/kiwiLocator/multiConf/config_two.kiwi 1970-01-01 01:00:00.000000000 +0100 +++ new/kiwi/tests/unit/data/kiwiLocator/multiConf/config_two.kiwi 2011-02-25 13:03:46.000000000 +0100 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<image schemaversion="4.7" name="suse-11.3-vm-guest"> + <description type="system"> + <author>Robert Schweikert</author> + <contact>rschweikert@novell.com</contact> + <specification>Generic valid configuration file</specification> + </description> + <preferences> + <type image="vmx" filesystem="ext4" boot="vmxboot/suse-11.3" format="vmdk"> + <machine memory="512"> + <vmdisk controller="ide" id="0"/> + <vmnic interface="0" driver="e1000" mode="bridged"/> + <vmnic interface="1" driver="e1000" mode="bridged"/> + </machine> + </type> + <version>1.0.0</version> + <packagemanager>zypper</packagemanager> + <rpm-check-signatures>false</rpm-check-signatures> + <rpm-force>true</rpm-force> + <locale>en_US</locale> + <keytable>us.map.gz</keytable> + </preferences> + <users group="root"> + <user pwd="linux" pwdformat="plain" home="/root" name="root"/> + </users> + <repository type="yast2"> + <source path="opensuse://11.3/repo/oss/"/> + </repository> + <packages type="image"> + <package name="bootsplash-branding-openSUSE" bootinclude="true" bootdelete="true"/> + <package name="gfxboot-branding-openSUSE" bootinclude="true" bootdelete="true"/> + <package name="kernel-default"/> + <package name="ifplugd"/> + <package name="vim"/> + <opensusePattern name="base"/> + </packages> + <packages type="bootstrap"> + <package name="filesystem"/> + <package name="glibc-locale"/> + </packages> +</image> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/tests/unit/data/kiwiLocator/noConf/readme.txt new/kiwi/tests/unit/data/kiwiLocator/noConf/readme.txt --- old/kiwi/tests/unit/data/kiwiLocator/noConf/readme.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/kiwi/tests/unit/data/kiwiLocator/noConf/readme.txt 2011-02-25 13:03:46.000000000 +0100 @@ -0,0 +1,4 @@ +Place holder file to keep this directory in version control + +This directory is used to check the "no config file" condition of the +locator object diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/tests/unit/data/kiwiLocator/sglConf/config_one.kiwi new/kiwi/tests/unit/data/kiwiLocator/sglConf/config_one.kiwi --- old/kiwi/tests/unit/data/kiwiLocator/sglConf/config_one.kiwi 1970-01-01 01:00:00.000000000 +0100 +++ new/kiwi/tests/unit/data/kiwiLocator/sglConf/config_one.kiwi 2011-02-25 13:03:46.000000000 +0100 @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<image schemaversion="4.7" name="suse-11.3-vm-guest"> + <description type="system"> + <author>Robert Schweikert</author> + <contact>rschweikert@novell.com</contact> + <specification>Generic valid configuration file</specification> + </description> + <preferences> + <type image="vmx" filesystem="ext4" boot="vmxboot/suse-11.3" format="vmdk"> + <machine memory="512"> + <vmdisk controller="ide" id="0"/> + <vmnic interface="0" driver="e1000" mode="bridged"/> + <vmnic interface="1" driver="e1000" mode="bridged"/> + </machine> + </type> + <version>1.0.0</version> + <packagemanager>zypper</packagemanager> + <rpm-check-signatures>false</rpm-check-signatures> + <rpm-force>true</rpm-force> + <locale>en_US</locale> + <keytable>us.map.gz</keytable> + </preferences> + <users group="root"> + <user pwd="linux" pwdformat="plain" home="/root" name="root"/> + </users> + <repository type="yast2"> + <source path="opensuse://11.3/repo/oss/"/> + </repository> + <packages type="image"> + <package name="bootsplash-branding-openSUSE" bootinclude="true" bootdelete="true"/> + <package name="gfxboot-branding-openSUSE" bootinclude="true" bootdelete="true"/> + <package name="kernel-default"/> + <package name="ifplugd"/> + <package name="vim"/> + <opensusePattern name="base"/> + </packages> + <packages type="bootstrap"> + <package name="filesystem"/> + <package name="glibc-locale"/> + </packages> +</image> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/tests/unit/lib/Common/ktLog.pm new/kiwi/tests/unit/lib/Common/ktLog.pm --- old/kiwi/tests/unit/lib/Common/ktLog.pm 2011-02-15 11:04:08.000000000 +0100 +++ new/kiwi/tests/unit/lib/Common/ktLog.pm 2011-02-25 13:03:46.000000000 +0100 @@ -50,9 +50,10 @@ #========================================== # Stored Messages #------------------------------------------ - $this -> {errMsg} = ''; - $this -> {infoMsg} = ''; - $this -> {warnMsg} = ''; + $this -> {errMsg} = ''; + $this -> {infoMsg} = ''; + $this -> {logInfoMsg} = ''; + $this -> {warnMsg} = ''; #========================================== # Stored State #------------------------------------------ @@ -118,6 +119,10 @@ $msg = $this -> {infoMsg}; $msgCnt += 1; } + if ( $this -> {logInfoMsg} ) { + $msg = $this -> {logInfoMsg}; + $msgCnt += 1; + } if ( $this -> {warnMsg} ) { $msg = $this -> {warnMsg}; $msgCnt += 1; @@ -188,6 +193,18 @@ return $this; } +#========================================== +# loginfo +#------------------------------------------ +sub loginfo { + # ... + # Set the information message + # --- + my $this = shift; + $this -> {logInfoMsg} = shift; + $this -> {msgType} = 'info'; + return $this; +} #========================================== # skipped @@ -238,9 +255,10 @@ # Reset object data # --- my $this = shift; - $this->{errMsg} = ''; - $this->{infoMsg} = ''; - $this->{warnMsg} = ''; + $this->{errMsg} = ''; + $this->{infoMsg} = ''; + $this->{logInfoMsg} = ''; + $this->{warnMsg} = ''; return $this; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiwi/tests/unit/lib/Test/kiwiLocator.pm new/kiwi/tests/unit/lib/Test/kiwiLocator.pm --- old/kiwi/tests/unit/lib/Test/kiwiLocator.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/kiwi/tests/unit/lib/Test/kiwiLocator.pm 2011-02-25 13:03:46.000000000 +0100 @@ -0,0 +1,244 @@ +#================ +# FILE : kiwiLocator.pm +#---------------- +# PROJECT : OpenSUSE Build-Service +# COPYRIGHT : (c) 2011 Novell Inc. +# : +# AUTHOR : Robert Schweikert <rschweikert@novell.com> +# : +# BELONGS TO : Operating System images +# : +# DESCRIPTION : Unit test implementation for the KIWILocato module. +# : +# STATUS : Development +#---------------- +package Test::kiwiLocator; + +use strict; +use warnings; + +use Common::ktLog; +use Common::ktTestCase; +use base qw /Common::ktTestCase/; + +use KIWILocator; + +#========================================== +# Constructor +#------------------------------------------ +sub new { + # ... + # Construct new test case + # --- + my $this = shift -> SUPER::new(@_); + $this -> {dataDir} = $this -> getDataDir() . '/kiwiLocator/'; + $this -> {kiwi} = new Common::ktLog(); + + return $this; +} + +#========================================== +# test_ctor +#------------------------------------------ +sub test_ctor { + # ... + # Test the locator contructor, it has no error conditions, thus check + # the object construction. + # --- + my $this = shift; + my $kiwi = $this -> {kiwi}; + my $locator = new KIWILocator ( $kiwi ); + my $msg = $kiwi -> getMessage(); + $this -> assert_str_equals('No messages set', $msg); + my $msgT = $kiwi -> getMessageType(); + $this -> assert_str_equals('none', $msgT); + my $state = $kiwi -> getState(); + $this -> assert_str_equals('No state set', $state); + # Test this condition last to get potential error messages + $this -> assert_not_null($locator); +} + +#========================================== +# test_getControlFileMultiConfig +#------------------------------------------ +sub test_getControlFileMultiConfig { + # ... + # Test the getControlFile method using a directory with multiple + # configuration files. + # --- + my $this = shift; + my $kiwi = $this -> {kiwi}; + my $locator = $this -> __getLocator(); + my $multiConfDir = $this -> {dataDir} . 'multiConf'; + my $res = $locator -> getControlFile( $multiConfDir ); + my $msg = $kiwi -> getMessage(); + my $expected = 'Found multiple control files in ' + . "$multiConfDir\n" + . "\t$multiConfDir/config_one.kiwi\n" + . "\t$multiConfDir/config_two.kiwi\n"; + $this -> assert_str_equals($expected, $msg); + my $msgT = $kiwi -> getMessageType(); + $this -> assert_str_equals('error', $msgT); + my $state = $kiwi -> getState(); + $this -> assert_str_equals('failed', $state); + # Test this condition last to get potential error messages + $this -> assert_null($res); +} + +#========================================== +# test_getControlFileNoConfigFile +#------------------------------------------ +sub test_getControlFileNoConfigFile { + # ... + # Test the getControlFile method using a directory without a config file + # --- + my $this = shift; + my $kiwi = $this -> {kiwi}; + my $locator = $this -> __getLocator(); + my $noConfDir = $this -> {dataDir} . 'noConf'; + my $res = $locator -> getControlFile( $noConfDir ); + my $msg = $kiwi -> getMessage(); + my $expected = 'Could not locate a configuration file in ' + . "$noConfDir"; + $this -> assert_str_equals($expected, $msg); + my $msgT = $kiwi -> getMessageType(); + $this -> assert_str_equals('error', $msgT); + my $state = $kiwi -> getState(); + $this -> assert_str_equals('failed', $state); + # Test this condition last to get potential error messages + $this -> assert_null($res); +} + +#========================================== +# test_getControlFileNoDir +#------------------------------------------ +sub test_getControlFileNoDir { + # ... + # Test the getControlFile method using a file path as argument + # --- + my $this = shift; + my $kiwi = $this -> {kiwi}; + my $locator = $this -> __getLocator(); + my $aFilePath = $this -> {dataDir} . 'config.xml'; + my $res = $locator -> getControlFile( $aFilePath ); + my $msg = $kiwi -> getMessage(); + my $expected = 'Expected a directory at ' + . "$aFilePath.\nSpecify a directory as the configuration base."; + $this -> assert_str_equals($expected, $msg); + my $msgT = $kiwi -> getMessageType(); + $this -> assert_str_equals('error', $msgT); + my $state = $kiwi -> getState(); + $this -> assert_str_equals('failed', $state); + # Test this condition last to get potential error messages + $this -> assert_null($res); +} + +#========================================== +# test_getControlFileNoErrorConfigXML +#------------------------------------------ +sub test_getControlFileNoErrorConfigXML { + # ... + # Test the getControlFile method using a directory with one config.xml + # file. + # --- + my $this = shift; + my $kiwi = $this -> {kiwi}; + my $locator = $this -> __getLocator(); + my $res = $locator -> getControlFile( $this -> {dataDir} ); + my $msg = $kiwi -> getMessage(); + $this -> assert_str_equals('No messages set', $msg); + my $msgT = $kiwi -> getMessageType(); + $this -> assert_str_equals('none', $msgT); + my $state = $kiwi -> getState(); + $this -> assert_str_equals('No state set', $state); + $this -> assert_not_null($res); + my $configFilePath = $this -> {dataDir} . '/config.xml'; + $this -> assert_str_equals($configFilePath, $res); +} + +#========================================== +# test_getControlFileNoErrorKiwiExt +#------------------------------------------ +sub test_getControlFileNoErrorKiwiExt { + # ... + # Test the getControlFile method using a directory with one *.kiwi + # file. + # --- + my $this = shift; + my $kiwi = $this -> {kiwi}; + my $locator = $this -> __getLocator(); + my $confDir = $this -> {dataDir} . 'sglConf'; + my $res = $locator -> getControlFile( $confDir ); + my $msg = $kiwi -> getMessage(); + $this -> assert_str_equals('No messages set', $msg); + my $msgT = $kiwi -> getMessageType(); + $this -> assert_str_equals('none', $msgT); + my $state = $kiwi -> getState(); + $this -> assert_str_equals('No state set', $state); + # Test this condition last to get potential error messages + $this -> assert_not_null($res); + my $configFilePath = $this -> {dataDir} . 'sglConf/config_one.kiwi'; + $this -> assert_str_equals($configFilePath, $res); +} + +#========================================== +# test_getExecPathNoExec +#------------------------------------------ +sub test_getExecPathNoExec { + # ... + # Test behavior when an executable cannot be found + # --- + my $this = shift; + my $kiwi = $this -> {kiwi}; + my $locator = $this -> __getLocator(); + my $res = $locator -> getExecPath( 'execDoesNotExist' ); + my $msg = $kiwi -> getMessage(); + $this -> assert_str_equals("warning: execDoesNotExist not found\n", $msg); + my $msgT = $kiwi -> getMessageType(); + $this -> assert_str_equals('info', $msgT); + my $state = $kiwi -> getState(); + $this -> assert_str_equals('No state set', $state); + # Test this condition last to get potential error messages + $this -> assert_null($res); +} + +#========================================== +# test_getExecPerl +#------------------------------------------ +sub test_getExecPerl { + # ... + # Test behavior when an executable can be found + # Using the perl interpreter as an example + # Perl's location is specified by LSB, thus we only make the + # assumption that we are on an LSB compliant system, this should be + # reasonable. + # --- + my $this = shift; + my $kiwi = $this -> {kiwi}; + my $locator = $this -> __getLocator(); + my $res = $locator -> getExecPath( 'perl' ); + my $msg = $kiwi -> getMessage(); + $this -> assert_str_equals('No messages set', $msg); + my $msgT = $kiwi -> getMessageType(); + $this -> assert_str_equals('none', $msgT); + my $state = $kiwi -> getState(); + $this -> assert_str_equals('No state set', $state); + # Test this condition last to get potential error messages + $this -> assert_not_null($res); + my $perlPath = '/usr/bin/perl'; + $this -> assert_str_equals($perlPath, $res); +} + +#========================================== +# Private helper methods +#------------------------------------------ +sub __getLocator { + # ... + # Helper function to create a KIWILocator object + # --- + my $this = shift; + my $locator = new KIWILocator ( $this -> {kiwi} ); + return $locator; +} + +1; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de