Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 7 commits
  • 9 files changed
  • 0 commit comments
  • 2 contributors
Commits on Jul 20, 2012
@schaefi schaefi - add initial new-root directories according to the
  used package manager (bnc #743844)
c9a9c96
Commits on Jul 23, 2012
@rjschwei - add <description> and <drivers> data to the new imageConfig structure
- renamed following functions as legacy code:
  * getProfiles => getProfiles_legacy
  * __populateTypeInfo => __populateTypeInfo_legacy
  * __populateProfiles => __populateProfiles_legacy
f84f597
@rjschwei - add an oops method to the test log
  * this implements the oops interface of the KIWILog object to
    allow unit tests to handle this condition
c75df4e
@rjschwei - add new object KIWIXMLDescriptionData which provides
  get/set methods for the <description> element
32949b2
@schaefi schaefi - store the mbrid file in /boot and not in /boot/grub. The location
  is misleading if another than the grub bootmanager is used
2bdc5f3
Commits on Jul 25, 2012
@schaefi schaefi - fixed creation of install sticks without system image afaf9f0
Commits on Jul 26, 2012
@schaefi schaefi - perform a qualified import of KIWIQX in kiwi.pl 48bcf20
View
15 .git-hooks/pre-commit
@@ -15,8 +15,9 @@ my @kiwiModules = qw (KIWIArchList.pm KIWIArch.pm KIWIBoot.pm KIWICache.pm
KIWIProductData.pm KIWIQX.pm KIWIRepoMetaHandler.pm
KIWIRoot.pm KIWIRuntimeChecker.pm
KIWISatSolver.pm KIWISharedMem.pm KIWISocket.pm
- KIWIURL.pm KIWIUtil.pm KIWIXMLInfo.pm KIWIXML.pm
- KIWIXMLValidator.pm KIWICommandLine.t KIWIImageCreator.t
+ KIWIURL.pm KIWIUtil.pm KIWIXML.pm KIWIXMLInfo.pm
+ KIWIXMLDescriptionData.pm KIWIXMLValidator.pm
+ KIWICommandLine.t KIWIImageCreator.t
KIWILocator.t KIWIRuntimeChecker.t KIWIXML.t KIWIXMLInfo.t
KIWIXMLValidator.t ktLog.pm ktTestCase.pm
kiwiCommandLine.pm kiwiLocator.pm kiwiImageCreator.pm
@@ -32,8 +33,9 @@ my @notClean1 = qw (KIWIArchList.pm KIWIArch.pm KIWIBoot.pm KIWICache.pm
KIWIProductData.pm KIWIQX.pm KIWIRepoMetaHandler.pm
KIWIRoot.pm KIWIRuntimeChecker.pm
KIWISatSolver.pm KIWISharedMem.pm KIWISocket.pm
- KIWIURL.pm KIWIUtil.pm KIWIXMLInfo.pm KIWIXML.pm
- KIWIXMLValidator.pm KIWICommandLine.t KIWIImageCreator.t
+ KIWIURL.pm KIWIUtil.pm KIWIXML.pm KIWIXMLInfo.pm
+ KIWIXMLDescriptionData.pm KIWIXMLValidator.pm
+ KIWICommandLine.t KIWIImageCreator.t
KIWILocator.t KIWIRuntimeChecker.t KIWIXML.t KIWIXMLInfo.t
KIWIXMLValidator.t ktLog.pm ktTestCase.pm
kiwiCommandLine.pm kiwiLocator.pm kiwiImageCreator.pm
@@ -49,8 +51,9 @@ my @notClean2 = qw (KIWIArchList.pm KIWIArch.pm KIWIBoot.pm KIWICache.pm
KIWIProductData.pm KIWIQX.pm KIWIRepoMetaHandler.pm
KIWIRoot.pm KIWIRuntimeChecker.pm
KIWISatSolver.pm KIWISharedMem.pm KIWISocket.pm
- KIWIURL.pm KIWIUtil.pm KIWIXMLInfo.pm KIWIXML.pm
- KIWIXMLValidator.pm KIWICommandLine.t KIWIImageCreator.t
+ KIWIURL.pm KIWIUtil.pm KIWIXML.pm KIWIXMLInfo.pm
+ KIWIXMLDescriptionData.pm KIWIXMLValidator.pm
+ KIWICommandLine.t KIWIImageCreator.t
KIWILocator.t KIWIRuntimeChecker.t KIWIXML.t KIWIXMLInfo.t
KIWIXMLValidator.t ktTestCase.pm
kiwiCommandLine.pm kiwiLocator.pm kiwiImageCreator.pm
View
2  kiwi.pl
@@ -42,7 +42,7 @@
use KIWIImageCreator;
use KIWIBoot;
use KIWIMigrate;
-use KIWIQX;
+use KIWIQX qw (qxx);
use KIWIRuntimeChecker;
use KIWIImageFormat;
use KIWIXMLInfo;
View
97 modules/KIWIBoot.pm
@@ -2499,8 +2499,8 @@ sub setupInstallFlags {
# Include MBR ID to initrd
#------------------------------------------
my $FD;
- qxx ("mkdir -p $irddir/boot/grub");
- if (! open ($FD, '>', "$irddir/boot/grub/mbrid")) {
+ qxx ("mkdir -p $irddir/boot");
+ if (! open ($FD, '>', "$irddir/boot/mbrid")) {
$kiwi -> error ("Couldn't create mbrid file: $!");
$kiwi -> failed ();
qxx ("rm -rf $irddir");
@@ -2838,9 +2838,7 @@ sub setupBootLoaderStages {
#==========================================
# Boot directories
#------------------------------------------
- my @bootdir = (
- "$tmpdir/boot/grub"
- );
+ my @bootdir = ();
if ($efi) {
push @bootdir,"$tmpdir/boot/grub2-efi/$efipc";
push @bootdir,"$tmpdir/boot/grub2/$grubpc";
@@ -3268,7 +3266,6 @@ sub setupBootLoaderConfiguration {
$cmdline .= " showopts\n";
# ensure exactly one space at start
$cmdline =~ s/^\s*/ /;
-
#==========================================
# Check boot partition number
#------------------------------------------
@@ -3276,6 +3273,20 @@ sub setupBootLoaderConfiguration {
$bootpart = 0;
}
#==========================================
+ # Create MBR id file for boot device check
+ #------------------------------------------
+ $kiwi -> info ("Saving disk label boot/mbrid: $this->{mbrid}...");
+ qxx ("mkdir -p $tmpdir/boot");
+ if (! open (FD,">$tmpdir/boot/mbrid")) {
+ $kiwi -> failed ();
+ $kiwi -> error ("Couldn't create mbrid file: $!");
+ $kiwi -> failed ();
+ return;
+ }
+ print FD "$this->{mbrid}";
+ close FD;
+ $kiwi -> done();
+ #==========================================
# Grub2
#------------------------------------------
if ($loader eq "grub2") {
@@ -3335,23 +3346,11 @@ sub setupBootLoaderConfiguration {
$vesa{'0x31a'} = ["1280x1024x24", "1280x1024"];
$vesa{'0x31b'} = ["1280x1024x32", "1280x1024"];
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create grub.cfg file
#------------------------------------------
$kiwi -> info ("Creating grub2 configuration file...");
foreach my $config (@config) {
+ qxx ("mkdir -p $tmpdir/boot/$config");
if (! open (FD,">$tmpdir/boot/$config/grub.cfg")) {
$kiwi -> failed ();
$kiwi -> error ("Couldn't create $config/grub.cfg: $!");
@@ -3533,22 +3532,10 @@ sub setupBootLoaderConfiguration {
#------------------------------------------
if ($loader eq "grub") {
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create menu.lst file
#------------------------------------------
$kiwi -> info ("Creating grub menu list file...");
+ qxx ("mkdir -p $tmpdir/boot/grub");
if (! open (FD,">$tmpdir/boot/grub/menu.lst")) {
$kiwi -> failed ();
$kiwi -> error ("Couldn't create menu.lst: $!");
@@ -3727,20 +3714,6 @@ sub setupBootLoaderConfiguration {
#------------------------------------------
if ($loader =~ /(sys|ext)linux/) {
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- qxx ("mkdir -p $tmpdir/boot/grub");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create syslinux config file
#------------------------------------------
my $syslconfig = "syslinux.cfg";
@@ -3936,23 +3909,9 @@ sub setupBootLoaderConfiguration {
#------------------------------------------
if ($loader eq "zipl") {
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- qxx ("mkdir -p $tmpdir/boot/grub");
- qxx ("mkdir -p $tmpdir/boot/zipl");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create zipl.conf
#------------------------------------------
+ qxx ("mkdir -p $tmpdir/boot/zipl");
$cmdline =~ s/\n//g;
my $ziplconfig = "zipl.conf";
$kiwi -> info ("Creating $ziplconfig config file...");
@@ -4131,20 +4090,6 @@ sub setupBootLoaderConfiguration {
#------------------------------------------
if ($loader eq "uboot") {
#==========================================
- # Create MBR id file for boot device check
- #------------------------------------------
- $kiwi -> info ("Saving disk label on disk: $this->{mbrid}...");
- qxx ("mkdir -p $tmpdir/boot/grub");
- if (! open (FD,">$tmpdir/boot/grub/mbrid")) {
- $kiwi -> failed ();
- $kiwi -> error ("Couldn't create mbrid file: $!");
- $kiwi -> failed ();
- return;
- }
- print FD "$this->{mbrid}";
- close FD;
- $kiwi -> done();
- #==========================================
# Create uboot image file from initrd
#------------------------------------------
$kiwi -> info ("Creating uBoot initrd image...");
@@ -4338,7 +4283,7 @@ sub installBootLoader {
#------------------------------------------
if ($cmdL) {
my $editBoot = $cmdL -> getEditBootConfig();
- if (! $editBoot) {
+ if ((! $editBoot) && ($xml)) {
$editBoot = $xml -> getEditBootConfig();
}
if (($editBoot) && (-e $editBoot)) {
View
2  modules/KIWIImage.pm
@@ -1937,7 +1937,7 @@ sub createImageLiveCD {
$kiwi -> info ("Saving hybrid disk label in initrd: $this->{mbrid}...");
qxx ("mkdir -p $tmpdir/boot/grub");
my $FD;
- if (! open ($FD, '>', "$tmpdir/boot/grub/mbrid")) {
+ if (! open ($FD, '>', "$tmpdir/boot/mbrid")) {
$kiwi -> failed ();
$kiwi -> error ("Couldn't create mbrid file: $!");
$kiwi -> failed ();
View
12 modules/KIWILinuxRC.sh
@@ -730,7 +730,7 @@ function installBootLoader {
esac
masterBootID=$(printf 0x%04x%04x $RANDOM $RANDOM)
Echo "writing new MBR ID to master boot record: $masterBootID"
- echo $masterBootID > /boot/grub/mbrid
+ echo $masterBootID > /boot/mbrid
masterBootIDHex=$(echo $masterBootID |\
sed 's/^0x\(..\)\(..\)\(..\)\(..\)$/\\x\4\\x\3\\x\2\\x\1/')
echo -e -n $masterBootIDHex | dd of=$imageDiskDevice \
@@ -3201,12 +3201,12 @@ function searchImageISODevice {
local isofrom_device
local isofrom_system
mkdir -p /cdrom
- if [ ! -f /boot/grub/mbrid ];then
+ if [ ! -f /boot/mbrid ];then
systemException \
"Can't find MBR id file in initrd" \
"reboot"
fi
- mbrIID=$(cat /boot/grub/mbrid)
+ mbrIID=$(cat /boot/mbrid)
Echo -n "Searching for boot device in Application ID..."
udevPending
#======================================
@@ -3482,8 +3482,8 @@ function storeIDFiles {
if ! mount -o ro $dev /mnt;then
continue
fi
- if [ -f /mnt/boot/grub/mbrid ];then
- cp -a /mnt/boot/grub/mbrid $cmpd/mbrid$ifix
+ if [ -f /mnt/boot/mbrid ];then
+ cp -a /mnt/boot/mbrid $cmpd/mbrid$ifix
ifix=$((ifix + 1))
umount /mnt
break
@@ -6000,7 +6000,7 @@ function bootImage {
# copy boot log file into system image
#--------------------------------------
mkdir -p /mnt/var/log
- rm -f /mnt/boot/grub/mbrid
+ rm -f /mnt/boot/mbrid
if [ -e /mnt/dev/shm/initrd.msg ];then
cp -f /mnt/dev/shm/initrd.msg /mnt/var/log/boot.msg
fi
View
16 modules/KIWIRoot.pm
@@ -334,6 +334,7 @@ sub init {
#==================================
# Create /etc/ImageVersion file
#----------------------------------
+ my $packager = $xml -> getPackageManager();
my $imageVersionFile = "$root/etc/ImageVersion";
my $imageVersion = $xml -> getImageVersion();
my $imageName = $xml -> getImageName();
@@ -410,12 +411,17 @@ sub init {
qxx ("mknod -m 640 $root/dev/loop2 b 7 2");
qxx ("mknod -m 640 $root/dev/loop3 b 7 3");
qxx ("mkdir -p $root/etc/sysconfig");
- qxx ("mkdir -p $root/var/log/YaST2");
+ # for zypper we need a yast log dir
+ if ($packager eq "zypper") {
+ qxx ("mkdir -p $root/var/log/YaST2");
+ }
# for smart we need the dpkg default file
- qxx ("mkdir -p $root/var/lib/dpkg");
- qxx ("touch $root/var/lib/dpkg/status");
- qxx ("mkdir -p $root/var/lib/dpkg/updates");
- qxx ("touch $root/var/lib/dpkg/available");
+ if ($packager eq "smart") {
+ qxx ("mkdir -p $root/var/lib/dpkg");
+ qxx ("touch $root/var/lib/dpkg/status");
+ qxx ("mkdir -p $root/var/lib/dpkg/updates");
+ qxx ("touch $root/var/lib/dpkg/available");
+ }
# for building in suse autobuild we need the following file
if (-f '/.buildenv') {
qxx ("touch $root/.buildenv");
View
226 modules/KIWIXML.pm
@@ -2,7 +2,7 @@
# FILE : KIWIXML.pm
#----------------
# PROJECT : OpenSUSE Build-Service
-# COPYRIGHT : (c) 2006 SUSE LINUX Products GmbH, Germany
+# COPYRIGHT : (c) 20012 SUSE LINUX Products GmbH, Germany
# :
# AUTHOR : Marcus Schaefer <ms@suse.de>
# :
@@ -63,21 +63,38 @@ sub new {
# imageConfig data structure
#
# imageConfig = {
+ # description = {
+ # author = '',
+ # contact = '',
+ # specification = '',
+ # type = ''
+ # }
# profName[+] = {
- # profInfo = {
- # description = '',
- # import = ''
- # }
# bootPkgs = (),
# bootDelPkgs = (),
# delPkgs = (),
+ # drivers = (),
# pkgs = (),
# arch[+] = {
# bootPkgs = (),
# bootDelPkgs = (),
# delPkgs = (),
+ # drivers = (),
# pkgs = ()
# }
+ # profInfo = {
+ # description = '',
+ # import = ''
+ # }
+ # repoData = {
+ # ID[+] {
+ # alias = '',
+ # location = (),
+ # status = '',
+ # priority = '',
+ # ...
+ # }
+ # }
# type[+] = {
# bootPkgs = (),
# bootDelPkgs = (),
@@ -90,15 +107,6 @@ sub new {
# bootkernel = '',
# ...
# }
- # repoData = {
- # ID[+] {
- # alias = '',
- # location = (),
- # status = '',
- # priority = '',
- # ...
- # }
- # }
# ...
# }
# }
@@ -220,22 +228,30 @@ sub new {
#------------------------------------------
$this->{imageConfig} = {};
my %kDefProfile = (
- 'description' => 'KIWI default profile, store non quilified data',
+ 'description' => 'KIWI default profile, store non qualified data',
'import' => 'true'
);
$this->{imageConfig}{kiwi_default}{profInfo} = \%kDefProfile;
#==========================================
+ # Populate imageConfig with description data from config tree
+ #------------------------------------------
+ $this -> __populateDescriptionInfo();
+ #==========================================
# Populate imageConfig with profile data from config tree
#------------------------------------------
$this -> __populateProfileInfo();
#==========================================
+ # Populate imageConfig with diver data from config tree
+ #------------------------------------------
+ $this -> __populateDriverInfo();
+ #==========================================
# Read and create profile hash
#------------------------------------------
- $this->{profileHash} = $this -> __populateProfiles();
+ $this->{profileHash} = $this -> __populateProfiles_legacy();
#==========================================
# Read and create type hash
#------------------------------------------
- $this->{typeList} = $this -> __populateTypeInfo();
+ $this->{typeList} = $this -> __populateTypeInfo_legacy();
#==========================================
# Update XML data from changeset if exists
#------------------------------------------
@@ -297,7 +313,7 @@ sub updateTypeList {
# internal typeInfo hash too
# ---
my $this = shift;
- $this->{typeList} = $this -> __populateTypeInfo();
+ $this->{typeList} = $this -> __populateTypeInfo_legacy();
$this -> __populateProfiledTypeInfo();
}
@@ -1692,31 +1708,38 @@ sub getProfiles {
$profile{include} = $imgConf{$prof}->{profInfo}->{import};
push @result, { %profile };
}
- # TODO: replaced by new data structure, will be deleted soon
- if ( $ENV{KIWI_OLD_XML_PROC} ) {
- @result = ();
- if (! defined $this->{profilesNodeList}) {
- return @result;
- }
- my $base = $this->{profilesNodeList} -> get_node(1);
- if (! defined $base) {
- return @result;
- }
- my @node = $base -> getElementsByTagName ("profile");
- foreach my $element (@node) {
- my $name = $element -> getAttribute ("name");
- my $desc = $element -> getAttribute ("description");
- my $incl = $element -> getAttribute ("import");
- my %profile = ();
- $profile{name} = $name;
- $profile{description} = $desc;
- $profile{include} = $incl;
- push @result, { %profile };
- }
- }
return @result;
}
+#==========================================
+# getProfiles_legacy
+#------------------------------------------
+sub getProfiles_legacy {
+ # ...
+ # Return a list of profiles available for this image
+ # ---
+ my $this = shift;
+ my @result = ();
+ if (! defined $this->{profilesNodeList}) {
+ return @result;
+ }
+ my $base = $this->{profilesNodeList} -> get_node(1);
+ if (! defined $base) {
+ return @result;
+ }
+ my @node = $base -> getElementsByTagName ("profile");
+ foreach my $element (@node) {
+ my $name = $element -> getAttribute ("name");
+ my $desc = $element -> getAttribute ("description");
+ my $incl = $element -> getAttribute ("import");
+ my %profile = ();
+ $profile{name} = $name;
+ $profile{description} = $desc;
+ $profile{include} = $incl;
+ push @result, { %profile };
+ }
+ return @result;
+}
#==========================================
# getInstSourceRepository
@@ -4631,6 +4654,23 @@ sub __checkProfiles {
}
#==========================================
+# __getChildNodeTextValue
+#------------------------------------------
+sub __getChildNodeTextValue {
+ # ...
+ # Return the value of the node identified by the
+ # given name as text.
+ # ---
+ my $this = shift;
+ my $node = shift;
+ my $childName = shift;
+ return $node
+ -> getChildrenByTagName ($childName)
+ -> get_node(1)
+ -> textContent();
+}
+
+#==========================================
# __getPreferencesNodeByTagName
#------------------------------------------
sub __getPreferencesNodeByTagName {
@@ -5302,15 +5342,15 @@ sub __requestedProfile {
}
#==========================================
-# __populateProfiles
+# __populateProfiles_legacy
#------------------------------------------
-sub __populateProfiles {
+sub __populateProfiles_legacy {
# ...
# import profiles section if specified
# ---
my $this = shift;
my %result = ();
- my @profiles = $this -> getProfiles ();
+ my @profiles = $this -> getProfiles_legacy();
foreach my $profile (@profiles) {
if ($profile->{include}) {
$result{$profile->{name}} = "$profile->{include}";
@@ -5392,6 +5432,102 @@ sub __populateDefaultProfiles {
}
#==========================================
+# __populateDescriptionInfo
+#------------------------------------------
+sub __populateDescriptionInfo {
+ # ...
+ # Populate the imageConfig member with the
+ # description data from the XML file.
+ # ---
+ my $this = shift;
+ my $descrNode = $this->{systemTree}
+ -> getElementsByTagName ('description')
+ -> get_node(1);
+ my $author = $this
+ -> __getChildNodeTextValue ($descrNode, 'author');
+ my $contact = $this
+ -> __getChildNodeTextValue ($descrNode, 'contact');
+ my $spec = $this
+ -> __getChildNodeTextValue($descrNode,'specification');
+ my $type = $descrNode
+ -> getAttribute ('type');
+ my %descript = (
+ author => $author,
+ contact => $contact,
+ specification => $spec,
+ type => $type
+ );
+ $this->{imageConfig}{description} = \%descript;
+ return $this;
+}
+
+#==========================================
+# __populateDriverInfo
+#------------------------------------------
+sub __populateDriverInfo {
+ # ...
+ # Populate the imageConfig member with the
+ # drivers data from the XML file.
+ # ---
+ my $this = shift;
+ my @drvNodes = $this->{systemTree}
+ -> getElementsByTagName ('drivers');
+ for my $drvNode (@drvNodes) {
+ my @drivers = $drvNode -> getElementsByTagName ('file');
+ my %archDrvs;
+ my @drvNames;
+ for my $drv (@drivers) {
+ my $name = $drv -> getAttribute('name');
+ my $arch = $drv -> getAttribute('arch');
+ if (! $arch) {
+ push @drvNames, $name
+ } else {
+ if (defined $archDrvs{$arch}) {
+ my @dLst = @{$archDrvs{$arch}};
+ push @dLst, $name;
+ $archDrvs{$arch} = \@dLst;
+ } else {
+ my @dLst = ($name, );
+ $archDrvs{$arch} = \@dLst;
+ }
+ }
+ }
+ my @pNameLst = ('kiwi-default');
+ my $profNames = $drvNode -> getAttribute('profiles');
+ if ($profNames) {
+ @pNameLst = split /,/, $profNames;
+ }
+ for my $profName (@pNameLst) {
+ my $drivers = $this->{imageConfig}
+ ->{$profName}->{drivers};
+ if (defined $drivers) {
+ my @dLst = @{$this->{imageConfig}->{$profName}->{drivers}};
+ push @dLst, @drvNames;
+ $this->{imageConfig}->{$profName}->{drivers} = \@dLst;
+ } else {
+ $this->{imageConfig}->{$profName}->{drivers} = \@drvNames;
+ }
+ for my $arch (keys %archDrvs) {
+ my $drivers = $this->{imageConfig}
+ ->{$profName}->{$arch}->{drivers};
+ if (defined $drivers) {
+ my @dLst = @{$this->{imageConfig}
+ ->{$profName}->{$arch}->{drivers}};
+ my @archLst = @{$archDrvs{$arch}};
+ push @dLst, @archLst;
+ $this->{imageConfig}->{$profName}
+ ->{$arch}->{drivers} = \@dLst;
+ } else {
+ $this->{imageConfig}->{$profName}
+ ->{$arch}->{drivers} = $archDrvs{$arch};
+ }
+ }
+ }
+ }
+ return $this;
+}
+
+#==========================================
# __populateProfileInfo
#------------------------------------------
sub __populateProfileInfo {
@@ -5431,9 +5567,9 @@ sub __populateProfileInfo {
}
#==========================================
-# __populateTypeInfo
+# __populateTypeInfo_legacy
#------------------------------------------
-sub __populateTypeInfo {
+sub __populateTypeInfo_legacy {
# ...
# Extract the information contained in the <type> elements
# and store the type descriptions in a list of hash references
View
221 modules/KIWIXMLDescriptionData.pm
@@ -0,0 +1,221 @@
+#================
+# FILE : KIWIXMLDescriptionData.pm
+#----------------
+# PROJECT : OpenSUSE Build-Service
+# COPYRIGHT : (c) 20012 SUSE LINUX Products GmbH, Germany
+# :
+# AUTHOR : Robert Schweikert <rjschwei@suse.com>
+# :
+# BELONGS TO : Operating System images
+# :
+# DESCRIPTION : This module represents the data contained in the KIWI
+# : configuration file marked with the <description> element
+# : as well as the element's children.
+# :
+# STATUS : Development
+#----------------
+package KIWIXMLDescriptionData;
+#==========================================
+# Modules
+#------------------------------------------
+use strict;
+use warnings;
+require Exporter;
+
+#==========================================
+# Exports
+#------------------------------------------
+our @EXPORT_OK = qw ();
+
+#==========================================
+# Constructor
+#------------------------------------------
+sub new {
+ # ...
+ # Create the KIWIXMLDescriptionData object
+ # ---
+ #==========================================
+ # Object setup
+ #------------------------------------------
+ my $this = {};
+ my $class = shift;
+ bless $this,$class;
+ #==========================================
+ # Arg processing
+ #------------------------------------------
+ my $kiwi = shift;
+ if (! defined $kiwi) {
+ $kiwi = KIWILog -> new("tiny");
+ }
+ $this->{kiwi} = $kiwi;
+ my $author = shift;
+ if (defined $author) {
+ if (ref $author eq 'HASH') {
+ $this->{author} = $author->{author};
+ $this->{contact} = $author->{contact};
+ $this->{specification} = $author->{specification};
+ # Use setType to get value checking
+ $this -> setType($author->{type});
+ } else {
+ $this->{author} = $author;
+ $this->{contact} = shift;
+ $this->{specification} = shift;
+ my $type = shift;
+ # Use setType to get value checking
+ $this -> setType($type);
+ }
+ }
+ return $this;
+}
+
+#==========================================
+# getAuthor
+#------------------------------------------
+sub getAuthor {
+ # ...
+ # Return the value of the author member
+ # ---
+ my $this = shift;
+ if (! $this -> __isObjectValid()) {
+ return;
+ }
+ return $this->{author};
+}
+
+#==========================================
+# getContactInfo
+#------------------------------------------
+sub getContactInfo {
+ # ...
+ # Return the value of the contact member
+ # ---
+ my $this = shift;
+ if (! $this -> __isObjectValid()) {
+ return;
+ }
+ return $this->{contact};
+}
+
+#==========================================
+# getSpecificationDescript
+#------------------------------------------
+sub getSpecificationDescript {
+ # ...
+ # Return the value of the specification member
+ # ---
+ my $this = shift;
+ if (! $this -> __isObjectValid()) {
+ return;
+ }
+ return $this->{specification};
+}
+
+#==========================================
+# getType
+#------------------------------------------
+sub getType {
+ # ...
+ # Return the value of the type member
+ # ---
+ my $this = shift;
+ if (! $this -> __isObjectValid()) {
+ return;
+ }
+ return $this->{type};
+}
+
+#==========================================
+# setAuthor
+#------------------------------------------
+sub setAuthor {
+ # ...
+ # Set the value of the author member
+ # ---
+ my $this = shift;
+ my $author = shift;
+ if (! defined $author) {
+ return;
+ }
+ $this->{author} = $author;
+ return $this;
+}
+
+#==========================================
+# setContactInfo
+#------------------------------------------
+sub setContactInfo {
+ # ...
+ # Set the value of the contact member
+ # ---
+ my $this = shift;
+ my $contact = shift;
+ if (! defined $contact) {
+ return;
+ }
+ $this->{contact} = $contact;
+ return $this;
+}
+
+#==========================================
+# setSpecificationDescript
+#------------------------------------------
+sub setSpecificationDescript {
+ # ...
+ # Set the value of the specification member
+ # ---
+ my $this = shift;
+ my $spec = shift;
+ if (! defined $spec) {
+ return;
+ }
+ $this->{specification} = $spec;
+ return $this;
+}
+
+#==========================================
+# setType
+#------------------------------------------
+sub setType {
+ # ...
+ # Set the value of the type member
+ # ---
+ my $this = shift;
+ my $type = shift;
+ if (! defined $type) {
+ return;
+ }
+ if ($type ne 'system' && $type ne 'boot') {
+ my $kiwi = $this->{kiwi};
+ $kiwi->warning("Attempting to set invalid description type '$type'");
+ $kiwi->oops();
+ return;
+ }
+ $this->{type} = $type;
+ return $this;
+}
+
+#==========================================
+# Private helper methods
+#------------------------------------------
+#==========================================
+# __isObjectValid
+#------------------------------------------
+sub __isObjectValid {
+ # ...
+ # All data members of the object must defined, or the object is
+ # considered invalid and will not return any of its data.
+ # ---
+ my $this = shift;
+ my @members = qw /author contact specification type/;
+ for my $member (@members) {
+ if (! defined $this->{$member}) {
+ my $kiwi = $this->{kiwi};
+ $kiwi->warning('XMLDescriptionData object in invalid state');
+ $kiwi->oops();
+ return;
+ }
+ }
+ return 1;
+}
+
+1;
View
18 tests/unit/lib/Common/ktLog.pm
@@ -71,6 +71,7 @@ sub new {
$this -> {completed} = 0;
$this -> {failed} = 0;
$this -> {msgType} = 'none';
+ $this -> {oops} = 0;
$this -> {skipped} = 0;
#==========================================
# A "fake" log file
@@ -281,6 +282,10 @@ sub getState {
$state = 'failed';
$stateCnt += 1;
}
+ if ( $this -> {oops} ) {
+ $state = 'oops';
+ $stateCnt += 1;
+ }
if ( $this -> {skipped} ) {
$state = 'skipped';
$stateCnt += 1;
@@ -398,6 +403,18 @@ sub setRootLog {
}
#==========================================
+# oops
+#------------------------------------------
+sub oops {
+ # ...
+ # Set the opps state
+ # ---
+ my $this = shift;
+ $this -> {oops} = 1;
+ return $this;
+}
+
+#==========================================
# skipped
#------------------------------------------
sub skipped {
@@ -541,6 +558,7 @@ sub __resetState {
$this -> {completed} = 0;
$this -> {failed} = 0;
$this -> {msgType} = 'none';
+ $this -> {oops} = 0;
$this -> {skipped} = 0;
return $this;
}

No commit comments for this range

Something went wrong with that request. Please try again.