From 4a121cd0a06c336de6f16bfcf982ae8757a98bf7 Mon Sep 17 00:00:00 2001 From: codehelp Date: Wed, 28 Apr 2010 20:45:22 +0000 Subject: [PATCH] fix problems with incomplete lists of required packages. git-svn-id: http://emdebian.org/svn/current@7149 563faec7-e20c-0410-992a-a66f704d0ccd --- multistrap | 32 ++++++++++++++++---------------- pod/multistrap | 13 +++++++------ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/multistrap b/multistrap index 8dc196f..189ef3f 100755 --- a/multistrap +++ b/multistrap @@ -31,7 +31,7 @@ use vars qw/ $progname $ourversion $dstrap $extra @aptsources $mirror $component $repo @dirs @touch %sources $section %keys $host $key $value $type $file $config $tidy $noauth $keyring %keyrings $deflist $cfgdir @extrapkgs @includes %source $setupsh $configsh $omitrequired $dryrun - $omitpreinst @reinstall $tgzname %uniq /; + $omitpreinst @reinstall $tgzname %uniq %required /; setlocale(LC_MESSAGES, ""); textdomain("multistrap"); @@ -82,6 +82,11 @@ $msg = sprintf (_g("Need a configuration file - use %s -f\n"), $progname); die ($msg) if (not defined $file); +$cachedir = "var/cache/apt/"; # archives +$libdir = "var/lib/apt/"; # lists +$etcdir = "etc/apt/"; # sources +$dpkgdir = "var/lib/dpkg/"; # state + $cfgdir=dirname($file); cascade($file); @@ -134,10 +139,6 @@ unless (keys %sources and @aptsources) # Translators: fields are: programname, architecture, host architecture. printf (_g("%s building %s multistrap on '%s'\n"), $progname, $arch, $host); -$cachedir = "var/cache/apt/"; # archives -$libdir = "var/lib/apt/"; # lists -$etcdir = "etc/apt/"; # sources -$dpkgdir = "var/lib/dpkg/"; # state if (not -d "$dir") { @@ -307,11 +308,11 @@ die (sprintf (_g("apt update failed. Exit value: %d\n"), ($retval/256))) if ($retval != 0); my @s = (); $str = ""; -if ((defined $omitrequired) and ($omitrequired eq "false")) +if ((not defined $omitrequired) or ($omitrequired eq "false")) { print "Calculating required packages.\n"; - my $required = &get_required_debs; - $str .= join (' ', @$required); + &get_required_debs; + $str .= join (' ', keys %required); chomp($str); } $str .= " "; @@ -347,7 +348,7 @@ print "apt-get $forceyes -y $config_str install $str\n"; $retval = system ("apt-get -y $config_str install $str"); die (sprintf (_g("apt download failed. Exit value: %d\n"),($retval/256))) if ($retval != 0); -system ("$setupsh") if (defined $setupsh); +system ("$setupsh $dir $arch") if (defined $setupsh); &force_unpack if ($unpack eq "true"); system ("cp $configsh $dir/") if ((defined $configsh) and (-f "$configsh")); system ("touch ${dir}${libdir}lists/lock"); @@ -726,8 +727,8 @@ sub get_required_debs # from debootstrap/functions # needs to be run after the first apt-get install so that # Packages files exist - my @required=(); - my @debs=(); + %required=(); + my %listfiles=(); opendir (PKGS, "${dir}${libdir}lists/") or die sprintf(_g("Cannot open %s directory. %s\n"), "${dir}${libdir}lists/", $!); @@ -738,20 +739,19 @@ sub get_required_debs my $s = lc($strap); foreach my $l (@lists) { - push (@required, $l); + $listfiles{$l}++; } } - foreach my $file (@required) + foreach my $file (keys %listfiles) { my $fh = IO::File->new("${dir}${libdir}lists/$file"); my $parser = Parse::Debian::Packages->new( $fh ); while (my %package = $parser->next) { next unless $package{'Priority'} eq "required"; - push @debs, $package{'Package'}; + $required{$package{'Package'}}++; } } - return \@debs; } # inherited from apt-cross @@ -947,7 +947,7 @@ sub _g { } sub dump_config { - print "Debootstrap: ".join (", ", sort @debootstrap)."\n"; + print "Bootstrap: ".join (", ", sort @debootstrap)."\n"; print "Apt sources: ".join (", ", sort @aptsources)."\n"; print "Includes: ".join (", ", sort @includes)."\n"; print "Sources: ".join (", ", sort values %sources)."\n"; diff --git a/pod/multistrap b/pod/multistrap index f2866eb..d6df2aa 100644 --- a/pod/multistrap +++ b/pod/multistrap @@ -37,19 +37,20 @@ Example configuration: # same as --tidy-up option if set to true cleanup=true # same as --no-auth option if set to true - # keyring packages listed in each debootstrap will + # keyring packages listed in each bootstrap will # still be installed. noauth=false # extract all downloaded archives (default is true) unpack=true - # aptsources is a list of sections to be used for downloading packages - # and lists and placed in the /etc/apt/sources.list.d/multistrap.sources.list + # aptsources is a list of sections to be used + # the /etc/apt/sources.list.d/multistrap.sources.list # of the target. Order is not important aptsources=Grip Updates # the order of sections is not important. - # the debootstrap option determines which repository - # is used to calculate the list of Priority: required packages. - debootstrap=Debian + # the bootstrap option determines which repository + # is used to calculate the list of Priority: required packages + # and which packages go into the rootfs. + bootstrap=Debian [Debian] packages=