From cecaffcddc5a56757da7025859e7f7881313cdd8 Mon Sep 17 00:00:00 2001 From: codehelp Date: Sun, 29 Mar 2009 15:37:34 +0000 Subject: [PATCH] pbuilder/em_multistrap : Allow retention of source packages outside the rootfs for source distribution and allow separate configuration of the apt sources inside the rootfs. git-svn-id: http://emdebian.org/svn/current@5753 563faec7-e20c-0410-992a-a66f704d0ccd --- debian/changelog | 3 +++ em_multistrap | 26 +++++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 89141d1..9a18bcf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,8 @@ emdebian-rootfs (1.8.0) unstable; urgency=low * Initial split from emdebian-tools source package. + * pbuilder/em_multistrap : Allow retention of source packages outside + the rootfs for source distribution and allow separate configuration + of the apt sources inside the rootfs. -- Neil Williams Thu, 26 Mar 2009 21:59:13 +0000 diff --git a/em_multistrap b/em_multistrap index c240b44..c36f6ae 100755 --- a/em_multistrap +++ b/em_multistrap @@ -21,14 +21,14 @@ use File::Basename; use Parse::Debian::Packages; use strict; use warnings; -use vars qw/ $progname $ourversion $dstrap $extra +use vars qw/ $progname $ourversion $dstrap $extra @aptsources @archives $deb $cachedir $config_str %packages $retval $str $retries - $dir $include $arch $foreign $suite $url $unpack + $dir $include $arch $foreign $suite $url $unpack $sourcedir @e $sourcesname $libdir $dpkgdir @debootstrap %suites $mirror $etcdir $repo @dirs @touch %sources $section %keys $host $key $value $type $file $config $tidy $noauth $keyring %keyrings /; $progname = basename($0); -$ourversion = "0.0.5"; +$ourversion = "0.0.6"; $unpack = "true"; while( @ARGV ) { @@ -55,6 +55,11 @@ while( @ARGV ) { elsif (/^(--tidy-up)$/) { $tidy++; } + elsif (/^(--source-dir)$/) { + $sourcedir = shift (@ARGV); + $sourcedir .= ($sourcedir =~ m:/$:) ? '' : "/"; + $sourcedir = (-d $sourcedir) ? $sourcedir : undef; + } elsif (/^(--no-auth)$/) { $noauth++; } @@ -76,6 +81,7 @@ foreach $key (%$config) %packages=(); %suites=(); %keyrings=(); +@aptsources=(); foreach $section (sort keys %keys) { if ($section eq "general") @@ -91,7 +97,11 @@ foreach $section (sort keys %keys) ($keys{$section}{'cleanup'} eq "true")); $noauth++ if ((defined $keys{$section}{'noauth'}) and ($keys{$section}{'noauth'} eq "true")); + $sourcedir = $keys{$section}{'retainsources'} if + ((defined $keys{$section}{'retainsources'}) and + (-d $keys{$section}{'retainsources'})); @debootstrap = split(' ', lc($keys{$section}{'debootstrap'})); + @aptsources = split (' ', lc($keys{$section}{'aptsources'})); } else { @@ -160,12 +170,15 @@ foreach $repo (sort keys %suites) if (not -e "$dir/${cachedir}archives/partial") { mkdir "$dir/${cachedir}archives/partial"; } +} +foreach my $aptsrc (@aptsources) +{ if (-d "${dir}etc/apt/") { open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") or die "Cannot open sources list $!"; - $mirror = $sources{$repo}; - $suite = $suites{$repo}; + $mirror = $sources{$aptsrc}; + $suite = $suites{$aptsrc}; print SOURCES<