Add support for configurable single cross-toolchains in the chroot - using the dpkg-cross default_arch, if any.

git-svn-id: http://emdebian.org/svn/current@7167 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2010-05-03 12:56:16 +00:00
parent 175fa80842
commit e0c8365b2b
10 changed files with 82 additions and 18 deletions

View file

@ -2,7 +2,7 @@
include=/usr/share/multistrap/crosschroot.conf include=/usr/share/multistrap/crosschroot.conf
omitrequired=false omitrequired=false
configscript= configscript=
setupscript= setupscript=/usr/share/multistrap/setcrossarch.sh
debootstrap=Debian Base Toolchains debootstrap=Debian Base Toolchains
aptsources=Debian Toolchains aptsources=Debian Toolchains
tarballname=pdebuild-cross.tgz tarballname=pdebuild-cross.tgz

View file

@ -2,7 +2,7 @@
include=/usr/share/multistrap/crosschroot.conf include=/usr/share/multistrap/crosschroot.conf
omitrequired=false omitrequired=false
configscript= configscript=
setupscript= setupscript=/usr/share/multistrap/setcrossarch.sh
debootstrap=Debian Base Toolchains debootstrap=Debian Base Toolchains
aptsources=Debian Toolchains aptsources=Debian Toolchains
tarballname=pdebuild-cross.tgz tarballname=pdebuild-cross.tgz

View file

@ -2,7 +2,7 @@
include=/usr/share/multistrap/crosschroot.conf include=/usr/share/multistrap/crosschroot.conf
omitrequired=false omitrequired=false
configscript= configscript=
setupscript= setupscript=/usr/share/multistrap/setcrossarch.sh
debootstrap=Debian Base Toolchains debootstrap=Debian Base Toolchains
aptsources=Debian Toolchains aptsources=Debian Toolchains
tarballname=pdebuild-cross.tgz tarballname=pdebuild-cross.tgz

View file

@ -2,7 +2,7 @@
include=/usr/share/multistrap/crosschroot.conf include=/usr/share/multistrap/crosschroot.conf
omitrequired=false omitrequired=false
configscript= configscript=
setupscript= setupscript=/usr/share/multistrap/setcrossarch.sh
debootstrap=Debian Base Toolchains debootstrap=Debian Base Toolchains
aptsources=Debian Toolchains aptsources=Debian Toolchains
tarballname=pdebuild-cross.tgz tarballname=pdebuild-cross.tgz

56
cross/setcrossarch.sh Executable file
View file

@ -0,0 +1,56 @@
#!/bin/sh
set -e
# Copyright (C) 2009, 2010 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# meant to be called from multistrap with directory arch variables.
dir=$1
hostarch=$2
if [ -z "$dir" ]; then
echo "No directory specified."
exit 1
fi
cfg="/etc/pdebuild-cross/pdebuild-cross.rc"
if [ -f $cfg ]; then
. $cfg
fi
if [ -z "$CROSSARCH" ]; then
# get crossarch from dpkg-cross - check if it is not None
if [ -f /etc/dpkg-cross/cross-compile ]; then
DEFARCH=`grep "^default_arch" /etc/dpkg-cross/cross-compile|sed -e 's/default_arch *= *\(.*\)/\1/'`
if [ -n "$DEFARCH" -a "$DEFARCH" != "None" ]; then
CROSSARCH="$DEFARCH"
fi
else
echo "No CROSSARCH set in '$cfg' and no dpkg-cross default: using armel."
CROSSARCH="armel"
fi
fi
# set the value inside the chroot
echo "#!/bin/sh" > $dir/tmp/set.sh
echo >> $dir/tmp/set.sh
echo "export DEBIAN_FRONTEND=noninteractive ".
"DEBCONF_NONINTERACTIVE_SEEN=true ".
"LC_ALL=C LANGUAGE=C LANG=C" >> $dir/tmp/set.sh
echo "echo debconf dpkg-cross/default-arch select $CROSSARCH|debconf-set-selections" >> $dir/tmp/set.sh
echo "dpkg-reconfigure dpkg-cross" >> $dir/tmp/set.sh
sudo chroot $dir sh /tmp/set.sh
sudo rm $dir/tmp/set.sh

3
debian/changelog vendored
View file

@ -1,6 +1,7 @@
multistrap (2.1.4) experimental; urgency=low multistrap (2.1.4) experimental; urgency=low
* Add support for multiple cross-toolchains in the chroot * Add support for configurable single cross-toolchains in
the chroot - using the dpkg-cross default_arch, if any.
-- Neil Williams <codehelp@debian.org> Fri, 30 Apr 2010 18:11:16 +0100 -- Neil Williams <codehelp@debian.org> Fri, 30 Apr 2010 18:11:16 +0100

8
debian/control vendored
View file

@ -3,12 +3,12 @@ Section: utils
Priority: optional Priority: optional
Maintainer: Neil Williams <codehelp@debian.org> Maintainer: Neil Williams <codehelp@debian.org>
Uploaders: Wookey <wookey@debian.org> Uploaders: Wookey <wookey@debian.org>
Build-Depends: cdbs, debhelper (>= 5), po4a (>= 0.37.1), po-debconf Build-Depends: cdbs, debhelper (>= 5), po4a (>= 0.37.1)
Build-Depends-Indep: devscripts, gnupg, intltool Build-Depends-Indep: intltool
Standards-Version: 3.8.4 Standards-Version: 3.8.4
Homepage: http://www.emdebian.org/multistrap Homepage: http://www.emdebian.org/multistrap
Vcs-Browser: http://buildd.emdebian.org/svn/browser/current/host/trunk/emdebian-rootfs/trunk/ Vcs-Browser: http://buildd.emdebian.org/svn/browser/current/
Vcs-Svn: http://buildd.emdebian.org/repos/current/host/trunk/emdebian-rootfs/trunk/ Vcs-Svn: http://buildd.emdebian.org/repos/current/
Package: multistrap Package: multistrap
Section: admin Section: admin

View file

@ -13,3 +13,5 @@ update-rc.d ./usr/share/multistrap/
bash/multistrap ./etc/bash_completion.d/ bash/multistrap ./etc/bash_completion.d/
cross/*.conf ./usr/share/multistrap/ cross/*.conf ./usr/share/multistrap/
cross/test.c ./usr/share/multistrap/ cross/test.c ./usr/share/multistrap/
cross/setcrossarch.sh ./usr/share/multistrap/
cross/functions ./usr/share/multistrap/

View file

@ -160,10 +160,6 @@ system ("mkdir -p ${dir}etc/apt/preferences.d/")
system ("mkdir -p ${dir}usr/share/info/") system ("mkdir -p ${dir}usr/share/info/")
if (not -d "${dir}usr/share/info/"); if (not -d "${dir}usr/share/info/");
system ("touch ${dir}usr/share/info/dir"); system ("touch ${dir}usr/share/info/dir");
#system ("mkdir -p ${dir}/usr/share/doc/gcc-4.2-base/")
# if (not -d "${dir}/usr/share/doc/gcc-4.2-base/");
#system ("touch ${dir}/usr/share/doc/gcc-4.2-base/.copyright");
#system ("touch ${dir}/usr/share/doc/gcc-4.2-base/#changelog.Debian.gz");
my $msg = sprintf(_g("Unable to create directory '%s'\n"), "${dir}etc/apt/preferences.d/"); my $msg = sprintf(_g("Unable to create directory '%s'\n"), "${dir}etc/apt/preferences.d/");
die ($msg) die ($msg)
if (not -d "${dir}etc/apt/preferences.d/"); if (not -d "${dir}etc/apt/preferences.d/");
@ -348,9 +344,9 @@ print "apt-get $forceyes -y $config_str install $str\n";
$retval = system ("apt-get -y $config_str install $str"); $retval = system ("apt-get -y $config_str install $str");
die (sprintf (_g("apt download failed. Exit value: %d\n"),($retval/256))) die (sprintf (_g("apt download failed. Exit value: %d\n"),($retval/256)))
if ($retval != 0); if ($retval != 0);
system ("$setupsh $dir $arch") if (defined $setupsh); system ("$setupsh $dir $arch") if ((defined $setupsh) and (-f $setupsh));
&force_unpack if ($unpack eq "true"); &force_unpack if ($unpack eq "true");
system ("cp $configsh $dir/") if ((defined $configsh) and (-f "$configsh")); system ("cp $configsh $dir/") if ((defined $configsh) and (-f $configsh));
system ("touch ${dir}${libdir}lists/lock"); system ("touch ${dir}${libdir}lists/lock");
&native if (not defined ($foreign)); &native if (not defined ($foreign));
&add_extra_packages; &add_extra_packages;
@ -863,7 +859,6 @@ sub cascade
$value = $key if (ref $key eq "HASH"); $value = $key if (ref $key eq "HASH");
$keys{$type} = $value; $keys{$type} = $value;
} }
foreach $section (sort keys %keys) foreach $section (sort keys %keys)
{ {
if ($section eq "general") if ($section eq "general")

View file

@ -11,7 +11,12 @@ multistrap - extends debootstrap for multiple repository support
=head1 Options =head1 Options
(These options can also be set in the configuration file.) --dry-run - collate all the configuration settings and output a
bare summary.
--simulate - same as --dry-run
(The following options can also be set in the configuration file.)
--tidy-up - remove apt cache data, downloaded Packages files and --tidy-up - remove apt cache data, downloaded Packages files and
the apt package cache. Same as cleanup=true. the apt package cache. Same as cleanup=true.
@ -19,6 +24,11 @@ the apt package cache. Same as cleanup=true.
--no-auth - allow the use of unauthenticated repositories. Same --no-auth - allow the use of unauthenticated repositories. Same
as noauth=true as noauth=true
--sourcedir DIR - move the contents of var/cache/apt/archives/ from
inside the chroot to the specified external directory. Same as
retainsources=DIR
=head1 Description =head1 Description
multistrap provides a debootstrap-like method based on apt and multistrap provides a debootstrap-like method based on apt and
@ -46,10 +56,10 @@ Example configuration:
# the /etc/apt/sources.list.d/multistrap.sources.list # the /etc/apt/sources.list.d/multistrap.sources.list
# of the target. Order is not important # of the target. Order is not important
aptsources=Grip Updates aptsources=Grip Updates
# the order of sections is not important.
# the bootstrap option determines which repository # the bootstrap option determines which repository
# is used to calculate the list of Priority: required packages # is used to calculate the list of Priority: required packages
# and which packages go into the rootfs. # and which packages go into the rootfs.
# The order of sections is not important.
bootstrap=Debian bootstrap=Debian
[Debian] [Debian]