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.
* When moving downloaded packages to a sourcedir, also download the
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

2
debian/control vendored
View file

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

View file

@ -284,10 +284,14 @@ foreach my $pkg (values %keyrings)
if (defined $k)
{
my $e=`LC_ALL=C printenv`;
my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo ";
$str = (-f "/usr/bin/sudo") ? "$str" : "";
printf (_g("I: Installing %s\n"), $k);
system ("$str apt-get install $k");
if ($e !~ /\nFAKEROOTKEY=[0-9]+\n/) {
my $str = "";
if (($e =~ /\nUSER=root\n/)) {
$str = "sudo" if (-f "/usr/bin/sudo");
}
printf (_g("I: Installing %s\n"), $k);
system ("$str apt-get install $k");
}
}
$config_str = '';
@ -695,14 +699,20 @@ sub tidy_apt
# if native arch, do a few tasks just because we can and probably should.
sub native
{
print _g("I: Native mode - configuring unpacked packages . . .\n");
my $e=`LC_ALL=C printenv`;
my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo";
$str = (-f "/usr/bin/sudo") ? "$str" : "";
my $env = "DEBIAN_FRONTEND=noninteractive ".
"DEBCONF_NONINTERACTIVE_SEEN=true ".
"LC_ALL=C LANGUAGE=C LANG=C";
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_bin_sh("$dir");
system ("$str $env chroot $dir dpkg --configure -a");
@ -873,42 +883,30 @@ sub cascade
if ($section eq "general")
{
$arch = $keys{$section}{'arch'}
if (defined $keys{$section}{'arch'}
and (not defined $arch));
if (defined $keys{$section}{'arch'} and (not defined $arch));
$dir = $keys{$section}{'directory'}
if (defined $keys{$section}{'directory'}
and (not defined $dir));
if (defined $keys{$section}{'directory'} and (not defined $dir));
# support the original value but replace by new value.
$unpack = lc($keys{$section}{'unpack'})
if (defined $keys{$section}{'forceunpack'}
and (not defined $unpack));
if (defined $keys{$section}{'forceunpack'} and (not defined $unpack));
$unpack = lc($keys{$section}{'unpack'})
if (defined $keys{$section}{'unpack'}
and (not defined $unpack));
if (defined $keys{$section}{'unpack'} and (not defined $unpack));
$configsh = lc($keys{$section}{'configscript'})
if (defined $keys{$section}{'configscript'}
and (not defined $configsh));
if (defined $keys{$section}{'configscript'} and (not defined $configsh));
$tgzname = lc($keys{$section}{'tarballname'})
if (defined $keys{$section}{'tarballname'}
and (not defined $tgzname));
if (defined $keys{$section}{'tarballname'} and (not defined $tgzname));
undef $configsh if ((defined $configsh) and (not -x $configsh));
$setupsh = lc($keys{$section}{'setupscript'})
if (defined $keys{$section}{'setupscript'}
and (not defined $setupsh));
if (defined $keys{$section}{'setupscript'} and (not defined $setupsh));
undef $setupsh if ((defined $setupsh) and (not -x $setupsh));
$omitrequired = lc($keys{$section}{'omitrequired'})
if (defined $keys{$section}{'omitrequired'}
and (not defined $omitrequired));
if (defined $keys{$section}{'omitrequired'} and (not defined $omitrequired));
$omitpreinst = lc($keys{$section}{'omitpreinst'})
if (defined $keys{$section}{'omitpreinst'}
and (not defined $omitpreinst));
$tidy++ if ((defined $keys{$section}{'cleanup'}) and
($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'}));
if (defined $keys{$section}{'omitpreinst'} and (not defined $omitpreinst));
$tidy++ if ((defined $keys{$section}{'cleanup'}) and ($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'}));
$explicit_suite++ if ((defined $keys{$section}{'explicitsuite'}) and
($keys{$section}{'explicitsuite'} eq "true"));
$allow_recommends++ if ((defined $keys{$section}{'allowrecommends'}) and
@ -924,23 +922,14 @@ sub cascade
}
else
{
$sources{$section}=$keys{$section}{'source'}
if (not exists $source{$section});
$packages{$section}=$keys{$section}{'packages'}
if (not exists $packages{$section});
$suites{$section}=$keys{$section}{'suite'}
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});
$sources{$section}=$keys{$section}{'source'} if (not exists $source{$section});
$packages{$section}=$keys{$section}{'packages'} if (not exists $packages{$section});
$suites{$section}=$keys{$section}{'suite'} 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'}));
if (not defined $components{$section})
{
$components{$section}='main';
}
$keyrings{$section}=$keys{$section}{'keyring'}
if (not exists $keyrings{$section});
$components{$section}='main' if (not defined $components{$section});
$keyrings{$section}=$keys{$section}{'keyring'} if (not exists $keyrings{$section});
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
=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