remove the definition of get_package_names() from genimage of fedora12 and suse
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6689 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
950f31d806
commit
56e025c82d
@ -245,7 +245,7 @@ unless ($onlyinitrd) {
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my %pkg_hash=get_package_names($pkglist);
|
||||
my %pkg_hash=imgutils::get_package_names($pkglist);
|
||||
my $index=1;
|
||||
my $pass;
|
||||
foreach $pass (sort (keys(%pkg_hash))) {
|
||||
@ -271,7 +271,7 @@ unless ($onlyinitrd) {
|
||||
}
|
||||
my %extra_hash=();
|
||||
if ($otherpkglist) {
|
||||
%extra_hash=get_package_names($otherpkglist);
|
||||
%extra_hash=imgutils::get_package_names($otherpkglist);
|
||||
}
|
||||
my %extrapkgnames;
|
||||
|
||||
@ -1108,95 +1108,3 @@ sub generic_post { #This function is meant to leave the image in a state approxi
|
||||
|
||||
copy(<$rootimg_dir/boot/vmlinuz*>,"$destdir/kernel"); }
|
||||
|
||||
sub get_package_names {
|
||||
my $plist_file_name=shift;
|
||||
my %pkgnames=();
|
||||
my @tmp_array=();
|
||||
|
||||
|
||||
if ($plist_file_name) {
|
||||
my $pkgfile;
|
||||
open($pkgfile,"<","$plist_file_name");
|
||||
while (<$pkgfile>) {
|
||||
chomp;
|
||||
s/\s+$//; #remove trailing white spaces
|
||||
next if /^\s*$/; #-- skip empty lines
|
||||
push(@tmp_array,$_);
|
||||
}
|
||||
close($pkgfile);
|
||||
|
||||
if ( @tmp_array > 0) {
|
||||
my $pkgtext=join(',',@tmp_array);
|
||||
|
||||
#handle the #INLCUDE# tag recursively
|
||||
my $idir = dirname($plist_file_name);
|
||||
my $doneincludes=0;
|
||||
while (not $doneincludes) {
|
||||
$doneincludes=1;
|
||||
if ($pkgtext =~ /#INCLUDE:[^#^\n]+#/) {
|
||||
$doneincludes=0;
|
||||
$pkgtext =~ s/#INCLUDE:([^#^\n]+)#/include_file($1,$idir)/eg;
|
||||
}
|
||||
}
|
||||
|
||||
#print "pkgtext=$pkgtext\n";
|
||||
my @tmp=split(',', $pkgtext);
|
||||
my $pass=1;
|
||||
foreach (@tmp) {
|
||||
my $idir;
|
||||
if (/^--/) {
|
||||
$idir="POST_REMOVE"; #line starts with -- means the package should be removed after otherpkgs are installed
|
||||
s/^--//;
|
||||
} elsif (/^-/) {
|
||||
$idir="PRE_REMOVE"; #line starts with single - means the package should be removed before otherpkgs are installed
|
||||
s/^-//;
|
||||
} elsif (/^#NEW_INSTALL_LIST#/) {
|
||||
$pass++;
|
||||
next;
|
||||
} elsif (/^#/) {
|
||||
# ignore all other comment lines
|
||||
next;
|
||||
} else {
|
||||
$idir=dirname($_);
|
||||
}
|
||||
my $fn=basename($_);
|
||||
if (exists($pkgnames{$pass}{$idir})) {
|
||||
my $pa=$pkgnames{$pass}{$idir};
|
||||
push(@$pa, $fn);
|
||||
} else {
|
||||
$pkgnames{$pass}{$idir}=[$fn];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return %pkgnames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub include_file
|
||||
{
|
||||
my $file = shift;
|
||||
my $idir = shift;
|
||||
my @text = ();
|
||||
unless ($file =~ /^\//) {
|
||||
$file = $idir."/".$file;
|
||||
}
|
||||
|
||||
open(INCLUDE,$file) || \
|
||||
return "#INCLUDEBAD:cannot open $file#";
|
||||
|
||||
while(<INCLUDE>) {
|
||||
chomp($_);
|
||||
s/\s+$//; #remove trailing spaces
|
||||
next if /^\s*$/; #-- skip empty lines
|
||||
push(@text, $_);
|
||||
}
|
||||
|
||||
close(INCLUDE);
|
||||
|
||||
return join(',', @text);
|
||||
}
|
||||
|
||||
|
||||
|
@ -832,97 +832,6 @@ sub generic_post { #This function is meant to leave the image in a state approxi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#get th extra package name
|
||||
sub get_extra_package_names {
|
||||
if (!$imagename) {
|
||||
$otherpkglist=get_extra_pkglist_file_name($customdir);
|
||||
if (!$otherpkglist) { $otherpkglist=get_extra_pkglist_file_name($pathtofiles); }
|
||||
}
|
||||
|
||||
#print "customdir=$customdir,pathtofiles=$pathtofiles,otherpkglist=$otherpkglist\n";
|
||||
my %pkgnames=();
|
||||
my @tmp_array=();
|
||||
|
||||
|
||||
if ($otherpkglist) {
|
||||
my $pkgfile;
|
||||
open($pkgfile,"<","$otherpkglist");
|
||||
while (<$pkgfile>) {
|
||||
chomp;
|
||||
s/\s+$//; #remove trailing white spaces
|
||||
next if /^\s*$/; #-- skip empty lines
|
||||
push(@tmp_array,$_);
|
||||
}
|
||||
close($pkgfile);
|
||||
|
||||
if ( @tmp_array > 0) {
|
||||
my $pkgtext=join(',',@tmp_array);
|
||||
|
||||
#handle the #INLCUDE# tag recursively
|
||||
my $idir = dirname($otherpkglist);
|
||||
my $doneincludes=0;
|
||||
while (not $doneincludes) {
|
||||
$doneincludes=1;
|
||||
if ($pkgtext =~ /#INCLUDE:[^#]+#/) {
|
||||
$doneincludes=0;
|
||||
$pkgtext =~ s/#INCLUDE:([^#]+)#/include_file($1,$idir)/eg;
|
||||
}
|
||||
}
|
||||
|
||||
print "pkgtext=$pkgtext\n";
|
||||
my @tmp=split(',', $pkgtext);
|
||||
foreach (@tmp) {
|
||||
my $idir;
|
||||
if (/^--/) {
|
||||
$idir="POST_REMOVE"; #line starts with -- means the package should be removed after otherpkgs are installed
|
||||
s/^--//;
|
||||
} elsif (/^-/) {
|
||||
$idir="PRE_REMOVE"; #line starts with single - means the package should be removed before otherpkgs are installed
|
||||
s/^-//;
|
||||
} else {
|
||||
$idir=dirname($_);
|
||||
}
|
||||
my $fn=basename($_);
|
||||
if (exists($pkgnames{$idir})) {
|
||||
my $pa=$pkgnames{$idir};
|
||||
push(@$pa, $fn);
|
||||
} else {
|
||||
$pkgnames{$idir}=[$fn];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return %pkgnames;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub include_file
|
||||
{
|
||||
my $file = shift;
|
||||
my $idir = shift;
|
||||
my @text = ();
|
||||
unless ($file =~ /^\//) {
|
||||
$file = $idir."/".$file;
|
||||
}
|
||||
|
||||
open(INCLUDE,$file) || \
|
||||
return "#INCLUDEBAD:cannot open $file#";
|
||||
|
||||
while(<INCLUDE>) {
|
||||
chomp($_);
|
||||
s/\s+$//; #remove trailing spaces
|
||||
next if /^\s*$/; #-- skip empty lines
|
||||
push(@text, $_);
|
||||
}
|
||||
|
||||
close(INCLUDE);
|
||||
|
||||
return join(',', @text);
|
||||
}
|
||||
|
||||
sub get_extra_pkglist_file_name {
|
||||
my $base=shift;
|
||||
if (-r "$base/$profile.$osver.$arch.otherpkgs.pkglist") {
|
||||
|
Loading…
Reference in New Issue
Block a user