Hello community, here is the log from the commit of package kiwi checked in at Fri Apr 27 16:47:52 CEST 2007. -------- --- arch/i386/kiwi/kiwi.changes 2007-04-25 17:18:50.000000000 +0200 +++ /mounts/work_src_done/STABLE/kiwi/kiwi.changes 2007-04-27 15:46:25.019147000 +0200 @@ -1,0 +2,11 @@ +Thu Apr 26 12:51:18 CEST 2007 - ms@suse.de + +- v1.30 +- added XML version validation, current XSD version 1.2 +- added experimental <instsource> section in config.xml. + This should be used to setup an installation source specified + by meta packages +- fixed terminal logging, don't use screen if you want logging + to the terminal + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kiwi.spec ++++++ --- /var/tmp/diff_new_pack.Z15849/_old 2007-04-27 16:47:28.000000000 +0200 +++ /var/tmp/diff_new_pack.Z15849/_new 2007-04-27 16:47:28.000000000 +0200 @@ -1,5 +1,5 @@ # -# spec file for package kiwi (Version 1.29) +# spec file for package kiwi (Version 1.30) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -15,7 +15,7 @@ BuildRequires: module-init-tools perl perl-XML-LibXML perl-libwww-perl screen smart syslinux Requires: perl perl-XML-LibXML perl-libwww-perl screen Summary: OpenSuSE - KIWI Image System -Version: 1.29 +Version: 1.30 Release: 1 Group: System/Management License: GNU General Public License (GPL) @@ -288,6 +288,14 @@ %{_datadir}/kiwi/image/xenboot %changelog +* Thu Apr 26 2007 - ms@suse.de +- v1.30 +- added XML version validation, current XSD version 1.2 +- added experimental <instsource> section in config.xml. + This should be used to setup an installation source specified + by meta packages +- fixed terminal logging, don't use screen if you want logging + to the terminal * Mon Apr 23 2007 - ms@suse.de - v1.29 - added nfs root support to kiwi's netboot image ++++++ kiwi.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kiwi/kiwi.pl new/kiwi/kiwi.pl --- old/kiwi/kiwi.pl 2007-04-25 10:50:25.000000000 +0200 +++ new/kiwi/kiwi.pl 2007-04-27 15:22:28.000000000 +0200 @@ -27,7 +27,14 @@ use KIWIImage; use KIWIBoot; -our $Version = "1.29"; +#============================================ +# Globals (Version) +#-------------------------------------------- +our $Version = "1.30"; +our $SchemeVersion = "1.2"; +#============================================ +# Globals +#-------------------------------------------- our $System = "/usr/share/kiwi/image"; our $Scheme = "/usr/share/kiwi/modules/KIWIScheme.xsd"; our $KConfig = "/usr/share/kiwi/modules/KIWIConfig.sh"; @@ -36,6 +43,7 @@ #-------------------------------------------- our $Prepare; # control XML file for building chroot extend our $Create; # image description for building image extend +our $CreateInstSource;# create installation source from meta packages our $Upgrade; # upgrade physical extend our $Destination; # destination directory for logical extends our $LogFile; # optional file name for logging @@ -87,9 +95,6 @@ # Setup logging location #------------------------------------------ if (defined $LogFile) { - if ($LogFile eq "terminal") { - $LogFile = qx ( tty ); chomp $LogFile; - } $kiwi -> info ("Setting log file to: $LogFile\n"); if (! $kiwi -> setLogFile ( $LogFile )) { my $code = kiwiExit (1); return $code; @@ -97,6 +102,40 @@ } #======================================== + # Create instsource from meta packages + #---------------------------------------- + if (defined $CreateInstSource) { + $kiwi -> info ("Reading image description..."); + my $xml = new KIWIXML ( $kiwi,$CreateInstSource ); + if (! defined $xml) { + my $code = kiwiExit (1); return $code; + } + $kiwi -> done(); + #========================================== + # Initialize installation source tree + #------------------------------------------ + $root = new KIWIRoot ( + $kiwi,$xml,$CreateInstSource,$RootTree, + "/meta-system" + ); + if (! defined $root) { + $kiwi -> error ("Couldn't create root object"); + $kiwi -> failed (); + my $code = kiwiExit (1); return $code; + } + if (! defined $root -> init ()) { + $kiwi -> error ("Base initialization failed"); + $kiwi -> failed (); + my $code = kiwiExit (1); return $code; + } + # TODO + # 1) unpack downloaded packages + # 2) call config/ package scripts + # ... + kiwiExit (0); + } + + #======================================== # Prepare image and build chroot system #---------------------------------------- if (defined $Prepare) { @@ -389,26 +428,27 @@ $SIG{"INT"} = \&quit; my $result = GetOptions( - "version" => \&version, - "logfile=s" => \$LogFile, - "prepare|p=s" => \$Prepare, - "list|l" => \&listImage, - "create|c=s" => \$Create, - "upgrade|u=s" => \$Upgrade, - "destdir|d=s" => \$Destination, - "root|r=s" => \$RootTree, - "bootstick=s" => \$BootStick, - "bootvm=s" => \$BootVMDisk, - "bootstick-system=s" => \$BootStickSystem, - "bootvm-system=s" => \$BootVMSystem, - "bootvm-disksize=s" => \$BootVMSize, - "bootcd=s" => \$BootCD, - "installcd=s" => \$InstallCD, - "installcd-system=s" => \$InstallCDSystem, - "strip|s" => \$StripImage, - "createpassword" => \$CreatePassword, - "help|h" => \&usage, - "<>" => \&usage + "version" => \&version, + "logfile=s" => \$LogFile, + "prepare|p=s" => \$Prepare, + "list|l" => \&listImage, + "create|c=s" => \$Create, + "create-instsource|C=s" => \$CreateInstSource, + "upgrade|u=s" => \$Upgrade, + "destdir|d=s" => \$Destination, + "root|r=s" => \$RootTree, + "bootstick=s" => \$BootStick, + "bootvm=s" => \$BootVMDisk, + "bootstick-system=s" => \$BootStickSystem, + "bootvm-system=s" => \$BootVMSystem, + "bootvm-disksize=s" => \$BootVMSize, + "bootcd=s" => \$BootCD, + "installcd=s" => \$InstallCD, + "installcd-system=s" => \$InstallCDSystem, + "strip|s" => \$StripImage, + "createpassword" => \$CreatePassword, + "help|h" => \&usage, + "<>" => \&usage ); my $user = qx (whoami); if ($user !~ /root/i) { @@ -423,7 +463,8 @@ (! defined $Prepare) && (! defined $Create) && (! defined $BootStick) && (! defined $BootCD) && (! defined $InstallCD) && (! defined $Upgrade) && - (! defined $BootVMDisk) && (! defined $CreatePassword) + (! defined $BootVMDisk) && (! defined $CreatePassword) && + (! defined $CreateInstSource) ) { $kiwi -> info ("No operation specified"); $kiwi -> failed (); @@ -454,6 +495,7 @@ print "Usage:\n"; print " kiwi -l | --list\n"; + print "Image Preparation/Creation:\n"; print " kiwi -p | --prepare <image-path>\n"; print " kiwi -c | --create <image-root>\n"; print " kiwi -u | --upgrade <image-root>\n"; @@ -462,7 +504,10 @@ print " [ --bootvm-disksize <size> ]\n"; print " kiwi --bootcd <initrd>\n"; print " kiwi --installcd <initrd> --installcd-system <systemImage>\n"; + print "Helper Tools:\n"; print " kiwi --createpassword\n"; + print " kiwi -C | --create-instsource <image-path>\n"; + print "Options:\n"; print "--\n"; print " [ -d | --destdir <destination-path> ]\n"; print " Specify an alternative destination directory for\n"; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kiwi/modules/KIWIConfigure.pm new/kiwi/modules/KIWIConfigure.pm --- old/kiwi/modules/KIWIConfigure.pm 2007-04-25 10:50:25.000000000 +0200 +++ new/kiwi/modules/KIWIConfigure.pm 2007-04-26 12:21:22.000000000 +0200 @@ -179,7 +179,7 @@ my $screenLogs = $kiwi -> getRootLog(); my $data; my $code; - my $logs; + my $logs = 1; #========================================== # Initiate screen call file #------------------------------------------ @@ -221,16 +221,18 @@ print FD "echo \$? > $file.exit\n"; close FD; #========================================== - # run repository creation in screen + # Check log location #------------------------------------------ - $data = qx ( chmod 755 $screenCall ); - $data = qx ( screen -L -D -m -c $screenCtrl chroot $root $file ); - $code = $? >> 8; - $logs = 1; - if ($main::LogFile =~ /\/dev\//) { + if ($main::LogFile eq "terminal") { $logs = 0; } - if ($logs) { + #========================================== + # run repository creation in screen + #------------------------------------------ + $data = qx ( chmod 755 $screenCall ); + if ( $logs ) { + $data = qx ( screen -L -D -m -c $screenCtrl chroot $root $file ); + $code = $? >> 8; if (open (FD,$screenLogs)) { local $/; $data = <FD>; close FD; } @@ -242,6 +244,9 @@ close FD; } } + } else { + $code = system ( "chroot $root $file" ); + $code = $code >> 8; } qx ( rm -f $screenCall* ); qx ( rm -f $screenCtrl ); @@ -250,7 +255,7 @@ #------------------------------------------ if ($code != 0) { $kiwi -> failed (); - if ($logs) { + if ( $logs ) { $kiwi -> error ($data); } return undef; diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kiwi/modules/KIWILog.pm new/kiwi/modules/KIWILog.pm --- old/kiwi/modules/KIWILog.pm 2007-04-25 11:11:01.000000000 +0200 +++ new/kiwi/modules/KIWILog.pm 2007-04-26 12:37:53.000000000 +0200 @@ -29,7 +29,6 @@ my $errorOk = 0; my $fileLog; my $rootLog; -my $logfile; #========================================== # Constructor @@ -102,8 +101,13 @@ print "\033[1;32mdone\n"; resetOutputChannel(); doNorm(); + if ($errorOk) { + print EFD " done\n"; + } } else { + setOutputChannel(); print " done\n"; + resetOutputChannel(); } } @@ -120,8 +124,13 @@ print "\033[1;31mfailed\n"; resetOutputChannel(); doNorm(); + if ($errorOk) { + print EFD " failed\n"; + } } else { + setOutputChannel(); print " failed\n"; + resetOutputChannel(); } } @@ -138,8 +147,13 @@ print "\033[1;33mskipped\n"; resetOutputChannel(); doNorm(); + if ($errorOk) { + print EFD " skipped\n"; + } } else { + setOutputChannel(); print " skipped\n"; + resetOutputChannel(); } } @@ -200,13 +214,16 @@ foreach my $level (@showLevel) { if ($level == $lglevel) { setOutputChannel(); - if ($errorOk) { - print EFD "$date $logdata\n"; - } if (($lglevel == 1) || ($lglevel == 2) || ($lglevel == 3)) { print $date,$logdata; + if ($errorOk) { + print EFD $date,$logdata; + } } elsif ($lglevel == 5) { print $logdata; + if ($errorOk) { + print EFD $logdata; + } } else { cluck $date,$logdata; } @@ -276,15 +293,16 @@ # --- my $this = shift; my $file = $_[0]; - if (! (open FD,">$file")) { - warning ( $this,"Couldn't open log channel: $!\n" ); - return undef; + if ($file ne "terminal") { + if (! (open FD,">$file")) { + warning ( $this,"Couldn't open log channel: $!\n" ); + return undef; + } + binmode(FD,':unix'); + $channel = \*FD; } - binmode(FD,':unix'); - $fileLog = 1; $rootLog = $file; - $logfile = \*FD; - $channel = \*FD; + $fileLog = 1; return $this; } 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 2007-04-25 10:50:25.000000000 +0200 +++ new/kiwi/modules/KIWIManager.pm 2007-04-27 15:22:28.000000000 +0200 @@ -19,6 +19,7 @@ #------------------------------------------ require Exporter; use strict; +use FileHandle; use KIWILog; #========================================== @@ -37,6 +38,9 @@ my @channelList; # list of channel names my $root; # root path my $chroot = 0; # is chroot or not +my $screenCall; # screen call script +my $screenCtrl; # control commands for screen +my $screenLogs; # screen log file #========================================== # Private @@ -110,6 +114,93 @@ } #========================================== +# setupScreen +#------------------------------------------ +sub setupScreen { + my $this = shift; + #========================================== + # screen files + #------------------------------------------ + $screenCall = $root."/screenrc.smart"; + $screenCtrl = $root."/screenrc.ctrls"; + $screenLogs = $kiwi -> getRootLog(); + + #========================================== + # Initiate screen call file + #------------------------------------------ + my $fd = new FileHandle; + my $cd = new FileHandle; + if ((! $fd -> open (">$screenCall")) || (! $cd -> open (">$screenCtrl"))) { + $kiwi -> failed (); + $kiwi -> error ("Couldn't create call file: $!"); + $kiwi -> failed (); + resetInstallationSource(); + return undef; + } + print $cd "logfile $screenLogs\n"; + print $cd "logfile flush 0\n"; + $cd -> close(); + + #========================================== + # return screen call file handle + #------------------------------------------ + return $fd; +} + +#========================================== +# setupScreenCall +#------------------------------------------ +sub setupScreenCall { + my $this = shift; + my $logs = 1; + my $code; + #========================================== + # Check log location + #------------------------------------------ + if ($main::LogFile eq "terminal") { + $logs = 0; + } + #========================================== + # run upgrade process in screen + #------------------------------------------ + my $data = qx ( chmod 755 $screenCall ); + my $fd = new FileHandle; + if ($logs) { + $data = qx ( screen -L -D -m -c $screenCtrl $screenCall ); + $code = $? >> 8; + if ($fd -> open ($screenLogs)) { + local $/; $data = <$fd>; $fd -> close(); + } + if ($code == 0) { + if (! $fd -> open ("$screenCall.exit")) { + $code = 1; + } else { + $code = <$fd>; chomp $code; + $fd -> close(); + } + } + } else { + $code = system ( $screenCall ); + $code = $code >> 8; + } + qx ( rm -f $screenCall* ); + qx ( rm -f $screenCtrl ); + #========================================== + # check exit code from screen session + #------------------------------------------ + if ($code != 0) { + $kiwi -> failed (); + if ( $logs ) { + $kiwi -> error ($data); + } + resetInstallationSource(); + return undef; + } + $kiwi -> done (); + return $this; +} + +#========================================== # setupSignatureCheck #------------------------------------------ sub setupSignatureCheck { @@ -358,39 +449,70 @@ } #========================================== -# setupUpgrade +# setupDownload #------------------------------------------ -sub setupUpgrade { +sub setupDownload { # ... - # upgrade the previosly installed root system - # using the package manager upgrade functionality + # download package files for later handling + # using the package manager download functionality # --- my $this = shift; - my $screenCall; - my $screenCtrl; - my $screenLogs; - my $data; - my $code; - my $logs; + my @pacs = @_; #========================================== - # screen files + # setup screen call #------------------------------------------ - my $screenCall = $root."/screenrc.smart"; - my $screenCtrl = $root."/screenrc.ctrls"; - my $screenLogs = $kiwi -> getRootLog(); - + my $fd = $this -> setupScreen(); + if (! defined $fd) { + return undef; + } #========================================== - # Initiate screen call file + # smart #------------------------------------------ - if ((! open (FD,">$screenCall")) || (! open (CD,">$screenCtrl"))) { + if ($manager eq "smart") { + $kiwi -> info ("Downloading packages..."); + my $forceChannels = join (",",@channelList); + my @loadOpts = ( + "-o force-channels=$forceChannels", + "--target=$root" + ); + #========================================== + # Create screen call file + #------------------------------------------ + print $fd "smart update @channelList\n"; + print $fd "test \$? = 0 && smart download @pacs @loadOpts\n"; + print $fd "echo \$? > $screenCall.exit\n"; + print $fd "rm -f $root/etc/smart/channels/*\n"; + $fd -> close(); + } + #========================================== + # zypper + #------------------------------------------ + if ($manager eq "zypper") { + # TODO $kiwi -> failed (); - $kiwi -> error ("Couldn't create call file: $!"); + $kiwi -> error ("*** not implemeted ***"); $kiwi -> failed (); return undef; } - print CD "logfile $screenLogs\n"; - print CD "logfile flush 0\n"; - close CD; + return $this -> setupScreenCall(); +} + +#========================================== +# setupUpgrade +#------------------------------------------ +sub setupUpgrade { + # ... + # upgrade the previosly installed root system + # using the package manager upgrade functionality + # --- + my $this = shift; + #========================================== + # setup screen call + #------------------------------------------ + my $fd = $this -> setupScreen(); + if (! defined $fd) { + return undef; + } #========================================== # smart #------------------------------------------ @@ -399,10 +521,10 @@ # Create screen call file #------------------------------------------ $kiwi -> info ("Upgrading image..."); - print FD "chroot $root smart update\n"; - print FD "chroot $root smart upgrade -y\n"; - print FD "echo \$? > $screenCall.exit\n"; - close FD; + print $fd "chroot $root smart update\n"; + print $fd "chroot $root smart upgrade -y\n"; + print $fd "echo \$? > $screenCall.exit\n"; + $fd -> close(); } #========================================== # zypper @@ -412,47 +534,11 @@ # Create screen call file #------------------------------------------ $kiwi -> info ("Upgrading image..."); - print FD "chroot $root yes | zypper upgrade -y\n"; - print FD "echo \$? > $screenCall.exit\n"; - close FD; - } - #========================================== - # run upgrade process in screen - #------------------------------------------ - $data = qx ( chmod 755 $screenCall ); - $data = qx ( screen -L -D -m -c $screenCtrl $screenCall ); - $code = $? >> 8; - $logs = 1; - if ($main::LogFile =~ /\/dev\//) { - $logs = 0; - } - if ($logs) { - if (open (FD,$screenLogs)) { - local $/; $data = <FD>; close FD; - } - if ($code == 0) { - if (! open (FD,"$screenCall.exit")) { - $code = 1; - } else { - $code = <FD>; chomp $code; - close FD; - } - } - } - qx ( rm -f $screenCall* ); - qx ( rm -f $screenCtrl ); - #========================================== - # check exit code from screen session - #------------------------------------------ - if ($code != 0) { - $kiwi -> failed (); - if ($logs) { - $kiwi -> error ($data); - } - return undef; + print $fd "chroot $root yes | zypper upgrade -y\n"; + print $fd "echo \$? > $screenCall.exit\n"; + $fd -> close(); } - $kiwi -> done (); - return $this; + return $this -> setupScreenCall(); } #========================================== @@ -465,32 +551,13 @@ # --- my $this = shift; my @packs = @_; - my $screenCall; - my $screenCtrl; - my $screenLogs; - my $data; - my $code; - my $logs; - #========================================== - # screen files - #------------------------------------------ - my $screenCall = $root."/screenrc.smart"; - my $screenCtrl = $root."/screenrc.ctrls"; - my $screenLogs = $kiwi -> getRootLog(); - #========================================== - # Initiate screen call file + # setup screen call #------------------------------------------ - if ((! open (FD,">$screenCall")) || (! open (CD,">$screenCtrl"))) { - $kiwi -> failed (); - $kiwi -> error ("Couldn't create call file: $!"); - $kiwi -> failed (); - resetInstallationSource(); + my $fd = $this -> setupScreen(); + if (! defined $fd) { return undef; } - print CD "logfile $screenLogs\n"; - print CD "logfile flush 0\n"; - close CD; #========================================== # smart #------------------------------------------ @@ -513,10 +580,10 @@ #========================================== # Create screen call file #------------------------------------------ - print FD "smart update @channelList\n"; - print FD "test \$? = 0 && smart install @packs @installOpts\n"; - print FD "echo \$? > $screenCall.exit\n"; - print FD "rm -f $root/etc/smart/channels/*\n"; + print $fd "smart update @channelList\n"; + print $fd "test \$? = 0 && smart install @packs @installOpts\n"; + print $fd "echo \$? > $screenCall.exit\n"; + print $fd "rm -f $root/etc/smart/channels/*\n"; } else { $kiwi -> info ("Installing image packages..."); my $querypack = "smart query '*' --installed --hide-version"; @@ -546,12 +613,12 @@ #========================================== # Create screen call file #------------------------------------------ - print FD "chroot $root smart update\n"; - print FD "test \$? = 0 && chroot $root smart install @install "; - print FD "@installOpts\n"; - print FD "echo \$? > $screenCall.exit\n"; + print $fd "chroot $root smart update\n"; + print $fd "test \$? = 0 && chroot $root smart install @install "; + print $fd "@installOpts\n"; + print $fd "echo \$? > $screenCall.exit\n"; } - close FD; + $fd -> close(); } #========================================== # zypper @@ -571,53 +638,16 @@ #========================================== # Create screen call file #------------------------------------------ - print FD "yes | zypper --root $root install @installOpts @packs\n"; - print FD "echo \$? > $screenCall.exit\n"; + print $fd "yes | zypper --root $root install @installOpts @packs\n"; + print $fd "echo \$? > $screenCall.exit\n"; } else { $kiwi -> info ("Installing image packages..."); - print FD "chroot $root yes | zypper install -y @packs\n"; - print FD "echo \$? > $screenCall.exit\n"; + print $fd "chroot $root yes | zypper install -y @packs\n"; + print $fd "echo \$? > $screenCall.exit\n"; } - close FD; - } - #========================================== - # run update and install in screen - #------------------------------------------ - $data = qx ( chmod 755 $screenCall ); - $data = qx ( screen -L -D -m -c $screenCtrl $screenCall ); - $code = $? >> 8; - $logs = 1; - if ($main::LogFile =~ /\/dev\//) { - $logs = 0; + $fd -> close(); } - if ($logs) { - if (open (FD,$screenLogs)) { - local $/; $data = <FD>; close FD; - } - if ($code == 0) { - if (! open (FD,"$screenCall.exit")) { - $code = 1; - } else { - $code = <FD>; chomp $code; - close FD; - } - } - } - qx ( rm -f $screenCall* ); - qx ( rm -f $screenCtrl ); - #========================================== - # check exit code from screen session - #------------------------------------------ - if ($code != 0) { - $kiwi -> failed (); - if ($logs) { - $kiwi -> error ($data); - } - resetInstallationSource(); - return undef; - } - $kiwi -> done (); - return $this; + return $this -> setupScreenCall(); } #========================================== @@ -634,7 +664,7 @@ #------------------------------------------ if ($manager eq "smart") { foreach my $channel (keys %{$source{public}}) { - #$kiwi -> info ("Removing smart channel: $channel\n"); + $kiwi -> info ("Removing smart channel: $channel\n"); qx ( smart channel --remove $channel -y 2>&1 ); } } @@ -643,7 +673,7 @@ #------------------------------------------ if ($manager eq "zypper") { foreach my $channel (keys %{$source{public}}) { - #$kiwi -> info ("Removing zypper service: $channel\n"); + $kiwi -> info ("Removing zypper service: $channel\n"); qx ( bash -c "yes | zypper service-delete $channel 2>&1" ); } } diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kiwi/modules/KIWIRoot.pm new/kiwi/modules/KIWIRoot.pm --- old/kiwi/modules/KIWIRoot.pm 2007-04-25 10:50:25.000000000 +0200 +++ new/kiwi/modules/KIWIRoot.pm 2007-04-27 11:35:55.000000000 +0200 @@ -82,9 +82,18 @@ $kiwi -> failed (); return undef; } - my %repository = $xml -> getRepository(); + my %repository; + if ($baseSystem eq "/meta-system") { + %repository = $xml -> getMetaRepository(); + } else { + %repository = $xml -> getRepository(); + } if (! %repository) { - $kiwi -> error ("No repository specified in XML tree"); + if ($baseSystem eq "/meta-system") { + $kiwi -> error ("No instsource repository specified in XML tree"); + } else { + $kiwi -> error ("No repository specified in XML tree"); + } $kiwi -> failed (); return undef; } @@ -117,14 +126,16 @@ } my $channel = "kiwi".$count."-".$$; my $srckey = "baseurl"; + my $srcopt; if ($type eq "rpm-dir") { $srckey = "path"; + $srcopt = "recursive=True"; } my @private_options = ("type=$type","name=$channel", - "$srckey=$private_url","-y" + "$srckey=$private_url",$srcopt,"-y" ); my @public_options = ("type=$type","name=$channel", - "$srckey=$publics_url","-y" + "$srckey=$publics_url",$srcopt,"-y" ); $sourceChannel{private}{$channel} = \@private_options; $sourceChannel{public}{$channel} = \@public_options; @@ -201,7 +212,12 @@ #========================================== # Get base Package list #------------------------------------------ - my @initPacs = $xml -> getBaseList(); + my @initPacs; + if ($baseSystem eq "/meta-system") { + @initPacs = $xml -> getBaseMetaList(); + } else { + @initPacs = $xml -> getBaseList(); + } if (! @initPacs) { $kiwi -> error ("Couldn't create base package list"); $kiwi -> failed (); @@ -215,18 +231,26 @@ return undef; } #========================================== - # Add source, install and remove source + # Add src, install/download and clean src #------------------------------------------ if (! $manager -> setupInstallationSource()) { return undef; } - if (! $manager -> setupRootSystem(@initPacs)) { - return undef; + if ($baseSystem eq "/meta-system") { + if (! $manager -> setupDownload (@initPacs)) { + $manager -> resetInstallationSource(); + return undef; + } + } else { + if (! $manager -> setupRootSystem(@initPacs)) { + $manager -> resetInstallationSource(); + return undef; + } } #========================================== # reset installation source #------------------------------------------ - if (!$manager -> resetInstallationSource()) { + if (! $manager -> resetInstallationSource()) { return undef; } #========================================== @@ -235,6 +259,12 @@ if (! $manager -> resetSignatureCheck()) { return undef; } + #========================================== + # Return in case of instsource creation + #------------------------------------------ + if ($baseSystem eq "/meta-system") { + return $this; + } #================================== # Copy/touch some defaults files #---------------------------------- diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kiwi/modules/KIWIScheme.tst new/kiwi/modules/KIWIScheme.tst --- old/kiwi/modules/KIWIScheme.tst 2007-04-19 14:10:16.000000000 +0200 +++ new/kiwi/modules/KIWIScheme.tst 2007-04-25 18:22:34.000000000 +0200 @@ -16,6 +16,14 @@ <packagemanager>smart</packagemanager> </preferences> + <instsource> + <metadata type="rpm-dir"> + <source path="/mounts/work3/CDs/full-i386/suse/%arch"/> + </metadata> + <package name="bob"/> + <package name="foo"/> + </instsource> + <users group="users"> <user name="linux" pwd="$2a$10$90AjhfXU2YIwTRrIftBauecvWXVuaNZ6JLM2IpWi0svu2kO16le9e" home="/home/linux"/> </users> diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/kiwi/modules/KIWIScheme.xsd new/kiwi/modules/KIWIScheme.xsd --- old/kiwi/modules/KIWIScheme.xsd 2007-04-19 14:10:16.000000000 +0200 +++ new/kiwi/modules/KIWIScheme.xsd 2007-04-27 15:22:28.000000000 +0200 @@ -1,7 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" - elementFormDefault="qualified"> - +<xs:schema + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified" + attributeFormDefault="unqualified" + version="1.2"> <xs:annotation> <xs:documentation> This schema specifies the format of the config.xml image @@ -14,6 +16,7 @@ <xs:sequence> <xs:element ref="description" minOccurs="1" maxOccurs="1"/> <xs:element ref="preferences" minOccurs="1" maxOccurs="1"/> + <xs:element ref="instsource" minOccurs="0" maxOccurs="1"/> <xs:element ref="users" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="drivers" minOccurs="0" maxOccurs="3"/> <xs:element ref="repository" minOccurs="1" maxOccurs="unbounded"/> @@ -24,6 +27,23 @@ </xs:complexType> </xs:element> + <xs:element name="instsource"> + <xs:complexType> + <xs:sequence> + <xs:element ref="metadata" minOccurs="1" maxOccurs="unbounded"/> + <xs:element ref="package" minOccurs="1" maxOccurs="unbounded"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="metadata"> + <xs:complexType> + <xs:sequence> + <xs:element ref="source" minOccurs="1"/> + </xs:sequence> + <xs:attribute name="type" type="xs:string"/> + </xs:complexType> + </xs:element> + <xs:element name="users"> <xs:complexType> <xs:sequence> 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 2007-04-19 14:10:16.000000000 +0200 +++ new/kiwi/modules/KIWIXML.pm 2007-04-27 15:22:28.000000000 +0200 @@ -35,8 +35,11 @@ my $packageNodeList; my $imgnameNodeList; my $deploysNodeList; +my $instsrcNodeList; my $partitionsNodeList; my $configfileNodeList; +my $schemeNodeList; +my $schemeVers; my @urllist; my $arch; @@ -70,7 +73,9 @@ } $arch = qx ( arch ); chomp $arch; my $systemTree; + my $schemeTree; my $controlFile = $imageDesc."/config.xml"; + my $schemeXML = new XML::LibXML; my $systemXML = new XML::LibXML; my $systemXSD = new XML::LibXML::Schema ( location => $main::Scheme ); if (! -f $controlFile) { @@ -80,6 +85,18 @@ return undef; } eval { + $schemeTree = $schemeXML + -> parse_file ( $main::Scheme ); + $schemeNodeList = $schemeTree -> getElementsByTagName ("xs:schema"); + }; + if ($@) { + $kiwi -> failed (); + $kiwi -> error ("Problem reading scheme description"); + $kiwi -> failed (); + $kiwi -> error ("$@\n"); + return undef; + } + eval { $systemTree = $systemXML -> parse_file ( $controlFile ); $optionsNodeList = $systemTree -> getElementsByTagName ("preferences"); @@ -89,6 +106,7 @@ $packageNodeList = $systemTree -> getElementsByTagName ("packages"); $imgnameNodeList = $systemTree -> getElementsByTagName ("image"); $deploysNodeList = $systemTree -> getElementsByTagName ("deploy"); + $instsrcNodeList = $systemTree -> getElementsByTagName ("instsource"); $partitionsNodeList = $systemTree -> getElementsByTagName ("partitions"); $configfileNodeList = $systemTree @@ -101,6 +119,9 @@ $kiwi -> error ("$@\n"); return undef; } + #========================================== + # Validate xml input with current scheme + #------------------------------------------ eval { $systemXSD ->validate ( $systemTree ); }; @@ -111,6 +132,21 @@ $kiwi -> error ("$@\n"); return undef; } + #========================================== + # Check version information of the scheme + #------------------------------------------ + my $schemeVers = $schemeNodeList -> get_node (1) + -> getAttribute ("version"); + if ($main::SchemeVersion ne $schemeVers) { + $kiwi -> failed (); + $kiwi -> error ("*** XML Scheme version mismatch ***\n"); + $kiwi -> error ("Need v$main::SchemeVersion got v$schemeVers"); + $kiwi -> failed (); + return undef; + } + #========================================== + # setup foreign repository sections + #------------------------------------------ if ( defined $foreignRepo{xmlnode} ) { $kiwi -> done (); $kiwi -> info ("Including foreign repository node(s)"); @@ -125,6 +161,9 @@ $repositNodeList = $foreignRepo{xmlnode}; $repositNodeList -> prepend ($need); } + #========================================== + # Create URL list from all locations + #------------------------------------------ @urllist = (); my %repository = getRepository ($this); foreach my $source (keys %repository) { @@ -434,6 +473,31 @@ } #========================================== +# getMetaRepository +#------------------------------------------ +sub getMetaRepository { + # ... + # Get the repository type used for building + # up an installation source tree. For information on the + # available types refer to the package manager documentation + # --- + my $this = shift; + my %result; + my $base = $instsrcNodeList -> get_node(1); + if (! defined $base) { + return %result; + } + my @node = $base -> getElementsByTagName ("metadata"); + foreach my $element (@node) { + my $type = $element -> getAttribute("type"); + my $stag = $element -> getElementsByTagName ("source") -> get_node(1); + my $source = resolveLink ( $stag -> getAttribute ("path") ); + $result{$source} = $type; + } + return %result; +} + +#========================================== # getRepository #------------------------------------------ sub getRepository { @@ -555,16 +619,30 @@ # --- my $this = shift; my $what = shift; - my %pattr= getPackageAttributes ($this,$what); + my %pattr; + my $nodes; + if ($what ne "meta") { + %pattr= getPackageAttributes ($this,$what); + } + if ($what ne "meta") { + $nodes = $packageNodeList; + } else { + $nodes = $instsrcNodeList; + } my @result; - for (my $i=1;$i<= $packageNodeList->size();$i++) { + for (my $i=1;$i<= $nodes->size();$i++) { #========================================== # Get type and packages #------------------------------------------ - my $node = $packageNodeList -> get_node($i); - my $type = $node -> getAttribute ("type"); - if ($type ne $what) { - next; + my $node = $nodes -> get_node($i); + my $type; + if ($what ne "meta") { + $type = $node -> getAttribute ("type"); + if ($type ne $what) { + next; + } + } else { + $type = $what; } my @plist = $node -> getElementsByTagName ("package"); foreach my $element (@plist) { @@ -594,24 +672,26 @@ #========================================== # Check for pattern descriptions #------------------------------------------ - my @slist = $node -> getElementsByTagName ("opensusePattern"); - my @pattlist = (); - foreach my $element (@slist) { - my $pattern = $element -> getAttribute ("name"); - if (! defined $pattern) { - next; + if ($type ne "meta") { + my @slist = $node -> getElementsByTagName ("opensusePattern"); + my @pattlist = (); + foreach my $element (@slist) { + my $pattern = $element -> getAttribute ("name"); + if (! defined $pattern) { + next; + } + push @pattlist,$pattern; } - push @pattlist,$pattern; - } - if (@pattlist) { - my $psolve = new KIWIPattern ( - $kiwi,\@pattlist,\@urllist,$pattr{patternType} - ); - if (! defined $psolve) { - return (); + if (@pattlist) { + my $psolve = new KIWIPattern ( + $kiwi,\@pattlist,\@urllist,$pattr{patternType} + ); + if (! defined $psolve) { + return (); + } + my @packageList = $psolve -> getPackages(); + push @result,@packageList; } - my @packageList = $psolve -> getPackages(); - push @result,@packageList; } #========================================== # Check for ignore list @@ -653,6 +733,18 @@ } #========================================== +# getBaseMetaList +#------------------------------------------ +sub getBaseMetaList { + # ... + # Create base package list needed to create the + # installation source tree + # --- + my $this = shift; + return getList ($this,"meta"); +} + +#========================================== # getBaseList #------------------------------------------ sub getBaseList { ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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