Handle fakeroot with native architectures.

git-svn-id: http://emdebian.org/svn/current@7238 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2010-05-28 21:08:00 +00:00
parent 7e104e631a
commit 548cb09e0a
4 changed files with 57 additions and 50 deletions

3
debian/changelog vendored
View file

@ -11,8 +11,9 @@ multistrap (2.1.5) unstable; urgency=low
default, usable by selecting explicitsuite to true. default, usable by selecting explicitsuite to true.
* When moving downloaded packages to a sourcedir, also download the * When moving downloaded packages to a sourcedir, also download the
source packages for GPL compliance. source packages for GPL compliance.
* Handle fakeroot with native architectures.
-- Neil Williams <codehelp@debian.org> Thu, 27 May 2010 16:59:13 +0100 -- Neil Williams <codehelp@debian.org> Fri, 28 May 2010 22:07:18 +0100
multistrap (2.1.4) unstable; urgency=low multistrap (2.1.4) unstable; urgency=low

2
debian/control vendored
View file

@ -15,7 +15,7 @@ Section: admin
Architecture: all Architecture: all
Depends: ${perl:Depends}, ${misc:Depends}, apt, realpath, Depends: ${perl:Depends}, ${misc:Depends}, apt, realpath,
libconfig-auto-perl, libparse-debian-packages-perl libconfig-auto-perl, libparse-debian-packages-perl
Recommends: emdebian-archive-keyring Recommends: emdebian-archive-keyring, fakeroot | sudo
Replaces: emdebian-rootfs (<= 2.0.9) Replaces: emdebian-rootfs (<= 2.0.9)
Conflicts: emdebian-rootfs (<= 2.0.9) Conflicts: emdebian-rootfs (<= 2.0.9)
Provides: emdebian-rootfs Provides: emdebian-rootfs

View file

@ -284,10 +284,14 @@ foreach my $pkg (values %keyrings)
if (defined $k) if (defined $k)
{ {
my $e=`LC_ALL=C printenv`; my $e=`LC_ALL=C printenv`;
my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo "; if ($e !~ /\nFAKEROOTKEY=[0-9]+\n/) {
$str = (-f "/usr/bin/sudo") ? "$str" : ""; my $str = "";
printf (_g("I: Installing %s\n"), $k); if (($e =~ /\nUSER=root\n/)) {
system ("$str apt-get install $k"); $str = "sudo" if (-f "/usr/bin/sudo");
}
printf (_g("I: Installing %s\n"), $k);
system ("$str apt-get install $k");
}
} }
$config_str = ''; $config_str = '';
@ -695,14 +699,20 @@ sub tidy_apt
# if native arch, do a few tasks just because we can and probably should. # if native arch, do a few tasks just because we can and probably should.
sub native sub native
{ {
print _g("I: Native mode - configuring unpacked packages . . .\n");
my $e=`LC_ALL=C printenv`; my $e=`LC_ALL=C printenv`;
my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo";
$str = (-f "/usr/bin/sudo") ? "$str" : "";
my $env = "DEBIAN_FRONTEND=noninteractive ". my $env = "DEBIAN_FRONTEND=noninteractive ".
"DEBCONF_NONINTERACTIVE_SEEN=true ". "DEBCONF_NONINTERACTIVE_SEEN=true ".
"LC_ALL=C LANGUAGE=C LANG=C"; "LC_ALL=C LANGUAGE=C LANG=C";
printf (_g("I: dpkg configuration settings:\n\t%s\n"), $env); printf (_g("I: dpkg configuration settings:\n\t%s\n"), $env);
if ($e =~ /\nFAKEROOTKEY=[0-9]+\n/) {
warn ("W: Cannot use 'chroot' when fakeroot is in use. Skipping package configuration.\n");
return;
}
print _g("I: Native mode - configuring unpacked packages . . .\n");
my $str = "";
if ($e =~ /\nUSER=root\n/) {
$str = "sudo" if (-f "/usr/bin/sudo");
}
# check that we have a workable shell inside the chroot # check that we have a workable shell inside the chroot
&check_bin_sh("$dir"); &check_bin_sh("$dir");
system ("$str $env chroot $dir dpkg --configure -a"); system ("$str $env chroot $dir dpkg --configure -a");
@ -873,42 +883,30 @@ sub cascade
if ($section eq "general") if ($section eq "general")
{ {
$arch = $keys{$section}{'arch'} $arch = $keys{$section}{'arch'}
if (defined $keys{$section}{'arch'} if (defined $keys{$section}{'arch'} and (not defined $arch));
and (not defined $arch));
$dir = $keys{$section}{'directory'} $dir = $keys{$section}{'directory'}
if (defined $keys{$section}{'directory'} if (defined $keys{$section}{'directory'} and (not defined $dir));
and (not defined $dir));
# support the original value but replace by new value. # support the original value but replace by new value.
$unpack = lc($keys{$section}{'unpack'}) $unpack = lc($keys{$section}{'unpack'})
if (defined $keys{$section}{'forceunpack'} if (defined $keys{$section}{'forceunpack'} and (not defined $unpack));
and (not defined $unpack));
$unpack = lc($keys{$section}{'unpack'}) $unpack = lc($keys{$section}{'unpack'})
if (defined $keys{$section}{'unpack'} if (defined $keys{$section}{'unpack'} and (not defined $unpack));
and (not defined $unpack));
$configsh = lc($keys{$section}{'configscript'}) $configsh = lc($keys{$section}{'configscript'})
if (defined $keys{$section}{'configscript'} if (defined $keys{$section}{'configscript'} and (not defined $configsh));
and (not defined $configsh));
$tgzname = lc($keys{$section}{'tarballname'}) $tgzname = lc($keys{$section}{'tarballname'})
if (defined $keys{$section}{'tarballname'} if (defined $keys{$section}{'tarballname'} and (not defined $tgzname));
and (not defined $tgzname));
undef $configsh if ((defined $configsh) and (not -x $configsh)); undef $configsh if ((defined $configsh) and (not -x $configsh));
$setupsh = lc($keys{$section}{'setupscript'}) $setupsh = lc($keys{$section}{'setupscript'})
if (defined $keys{$section}{'setupscript'} if (defined $keys{$section}{'setupscript'} and (not defined $setupsh));
and (not defined $setupsh));
undef $setupsh if ((defined $setupsh) and (not -x $setupsh)); undef $setupsh if ((defined $setupsh) and (not -x $setupsh));
$omitrequired = lc($keys{$section}{'omitrequired'}) $omitrequired = lc($keys{$section}{'omitrequired'})
if (defined $keys{$section}{'omitrequired'} if (defined $keys{$section}{'omitrequired'} and (not defined $omitrequired));
and (not defined $omitrequired));
$omitpreinst = lc($keys{$section}{'omitpreinst'}) $omitpreinst = lc($keys{$section}{'omitpreinst'})
if (defined $keys{$section}{'omitpreinst'} if (defined $keys{$section}{'omitpreinst'} and (not defined $omitpreinst));
and (not defined $omitpreinst)); $tidy++ if ((defined $keys{$section}{'cleanup'}) and ($keys{$section}{'cleanup'} eq "true"));
$tidy++ if ((defined $keys{$section}{'cleanup'}) and $noauth++ if ((defined $keys{$section}{'noauth'}) and ($keys{$section}{'noauth'} eq "true"));
($keys{$section}{'cleanup'} eq "true")); $sourcedir = $keys{$section}{'retainsources'}
$noauth++ if ((defined $keys{$section}{'noauth'}) and if ((defined $keys{$section}{'retainsources'}) and (-d $keys{$section}{'retainsources'}));
($keys{$section}{'noauth'} eq "true"));
$sourcedir = $keys{$section}{'retainsources'} if
((defined $keys{$section}{'retainsources'}) and
(-d $keys{$section}{'retainsources'}));
$explicit_suite++ if ((defined $keys{$section}{'explicitsuite'}) and $explicit_suite++ if ((defined $keys{$section}{'explicitsuite'}) and
($keys{$section}{'explicitsuite'} eq "true")); ($keys{$section}{'explicitsuite'} eq "true"));
$allow_recommends++ if ((defined $keys{$section}{'allowrecommends'}) and $allow_recommends++ if ((defined $keys{$section}{'allowrecommends'}) and
@ -924,23 +922,14 @@ sub cascade
} }
else else
{ {
$sources{$section}=$keys{$section}{'source'} $sources{$section}=$keys{$section}{'source'} if (not exists $source{$section});
if (not exists $source{$section}); $packages{$section}=$keys{$section}{'packages'} if (not exists $packages{$section});
$packages{$section}=$keys{$section}{'packages'} $suites{$section}=$keys{$section}{'suite'} if (not exists $suites{$section});
if (not exists $packages{$section}); $components{$section}=$keys{$section}{'components'} if (not exists $components{$section});
$suites{$section}=$keys{$section}{'suite'} $omitdebsrc{$section}=$keys{$section}{'omitdebsrc'} if (not exists $omitdebsrc{$section});
if (not exists $suites{$section});
$components{$section}=$keys{$section}{'components'}
if (not exists $components{$section});
$omitdebsrc{$section}=$keys{$section}{'omitdebsrc'}
if (not exists $omitdebsrc{$section});
push @reinstall, split (/ /, lc($keys{$section}{'reinstall'})); push @reinstall, split (/ /, lc($keys{$section}{'reinstall'}));
if (not defined $components{$section}) $components{$section}='main' if (not defined $components{$section});
{ $keyrings{$section}=$keys{$section}{'keyring'} if (not exists $keyrings{$section});
$components{$section}='main';
}
$keyrings{$section}=$keys{$section}{'keyring'}
if (not exists $keyrings{$section});
push @extrapkgs, split (' ', lc($keys{$section}{'additional'})); push @extrapkgs, split (' ', lc($keys{$section}{'additional'}));
} }
} }

View file

@ -437,3 +437,20 @@ apt-cache size), use the omitdebsrc field in each Section.
omitdebsrc=true omitdebsrc=true
=cut =cut
=head1 fakeroot
Foreign architecture bootstraps can operate under C<fakeroot> (C<multistrap>
is designed to do as much as it can within a single call to make this
easier) but the configuration stage which normally happens with a native
architecture bootstrap requires C<chroot> and C<chroot> itself will
not operate under C<fakeroot>.
Therefore, if C<multistrap> detects that C<fakeroot> is in use, native
mode configuration is skipped with a reminder warning.
The same problem applies to C<apt-get install> and therefore the
installation of the keyring package on the host system is also skipped
if fakeroot is detected.
=cut