From 0b8898924898f1d4161cb887e7ed869a15d90573 Mon Sep 17 00:00:00 2001 From: codehelp Date: Wed, 15 Jun 2011 20:44:54 +0000 Subject: [PATCH] * Clean up the retainsources behaviour (Closes: #627179) * Implement some code for omitpreinst support. git-svn-id: http://emdebian.org/svn/current@8024 563faec7-e20c-0410-992a-a66f704d0ccd --- debian/changelog | 4 +++- multistrap | 42 ++++++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/debian/changelog b/debian/changelog index e06af4c..0ae45ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,10 @@ multistrap (2.1.14) unstable; urgency=low allowed. dpkg does not currently support changes in /var/lib/dpkg/info * Read the dpkg status file to look for source packages even when no packages needed to be downloaded or unpacked. (Closes: #623563) + * Clean up the retainsources behaviour (Closes: #627179) + * Implement some code for omitpreinst support. - -- Neil Williams Wed, 11 May 2011 20:30:03 +0100 + -- Neil Williams Wed, 15 Jun 2011 21:44:44 +0100 multistrap (2.1.13) unstable; urgency=low diff --git a/multistrap b/multistrap index d91043a..a945274 100755 --- a/multistrap +++ b/multistrap @@ -764,10 +764,11 @@ sub handle_source_packages { next if (-d $file); next unless ($file =~ /\.deb$/); if (defined $sourcedir) { - my $srcname = `LC_ALL dpkg -f ${dir}${cachedir}archives/$file Source`; + my $srcname = `LC_ALL=C dpkg -f ${dir}${cachedir}archives/$file Source`; chomp ($srcname); + $srcname =~ s/ \(.*\)//; if ($srcname eq "") { - my $srcname = `LC_ALL dpkg -f ${dir}${cachedir}archives/$file Package`; + my $srcname = `LC_ALL=C dpkg -f ${dir}${cachedir}archives/$file Package`; chomp ($srcname); } push @dsclist, $srcname; @@ -779,12 +780,23 @@ sub handle_source_packages { open (STATUS, "${dir}${dpkgdir}status"); my @lines=; close (STATUS); + my $pkg; + my $src; foreach my $line (@lines) { + if ($line =~ /^Package: (.*)$/) { + $pkg = $1; + } if ($line =~ /^Source: (.*)$/) { my $c = $1; $c =~ s/\(.*\)$//; $c =~ s/ //g; push @dsclist, $c; + $src = $c; + } + if ($line =~ /^$/) { + push @dsclist, $pkg if (not defined $src and defined $pkg); + undef $pkg; + undef $src; } } } @@ -801,7 +813,6 @@ sub handle_source_packages { } } chdir ($olddir); - $sourcedir=undef; } sub tidy_apt { @@ -820,6 +831,7 @@ sub tidy_apt { unlink ("${dir}${cachedir}archives/$file"); } } + $sourcedir=undef; } unlink ("${dir}etc/apt/sources.list") if (-f "${dir}etc/apt/sources.list"); @@ -871,17 +883,19 @@ sub native { } } &run_native_hooks_start(sort @{$hooks{'N'}}) if (defined ($hooks{'N'})); - opendir (PRI, "${dir}/var/lib/dpkg/info") or return; - my @preinsts=grep(/\.preinst$/, readdir PRI); - closedir (PRI); - printf (_g("I: Running preinst scripts with 'install' argument.\n")); - my $f = join (" ", @reinstall); - foreach my $script (sort @preinsts) { - my $t = $script; - $t =~ s/\.preinst//; - next if ($t =~ /$f/); - next if ($script =~ /bash/); - system ("$str $env chroot $dir /var/lib/dpkg/info/$script install"); + if (not defined $omitpreinst) { + opendir (PRI, "${dir}/var/lib/dpkg/info") or return; + my @preinsts=grep(/\.preinst$/, readdir PRI); + closedir (PRI); + printf (_g("I: Running preinst scripts with 'install' argument.\n")); + my $f = join (" ", @reinstall); + foreach my $script (sort @preinsts) { + my $t = $script; + $t =~ s/\.preinst//; + next if ($t =~ /$f/); + next if ($script =~ /bash/); + system ("$str $env chroot $dir /var/lib/dpkg/info/$script install"); + } } my $retval = 0; $retval = system ("$str $env chroot $dir dpkg --configure -a");