From 0b6329aaf91d7bcce1d44afd1b658990659c53f0 Mon Sep 17 00:00:00 2001 From: codehelp Date: Fri, 12 Mar 2010 15:03:06 +0000 Subject: [PATCH] Add subroutines to replace functionality from Emdebian::Tools in shell scripts. Drop Emdebian::Tools dependency. (LP: #531143) git-svn-id: http://emdebian.org/svn/current@6803 563faec7-e20c-0410-992a-a66f704d0ccd --- debian/changelog | 4 +++- debian/control | 5 +++-- em_multistrap | 10 +++++----- embootstrap | 8 ++++---- empbuilderlib | 24 +++++++++++++++++++++++- emrootfslib | 41 +++++++++++++++++++++++++++-------------- 6 files changed, 65 insertions(+), 27 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3d7e181..ce72dc7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,10 @@ emdebian-rootfs (2.0.7) unstable; urgency=low * [INTL:pt] Updated Portuguese program output translation (Closes: #572929) * Handle relative directories from the command line. + * Add subroutines to replace functionality from Emdebian::Tools + in shell scripts. Drop Emdebian::Tools dependency. (LP: #531143) - -- Neil Williams Thu, 11 Mar 2010 16:39:36 +0000 + -- Neil Williams Fri, 12 Mar 2010 14:58:01 +0000 emdebian-rootfs (2.0.6) unstable; urgency=low diff --git a/debian/control b/debian/control index f2a5c4c..d350d27 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,8 @@ Priority: extra Maintainer: Neil Williams Uploaders: Wookey Build-Depends: cdbs, debhelper (>= 5), po4a (>= 0.37.1), po-debconf -Build-Depends-Indep: devscripts, docbook-xml, docbook-xsl, gnupg, libxml2-utils, xml-core, xsltproc, intltool +Build-Depends-Indep: devscripts, docbook-xml, docbook-xsl, gnupg, + libxml2-utils, xml-core, xsltproc, intltool Standards-Version: 3.8.4 Homepage: http://www.emdebian.org/ Vcs-Browser: http://buildd.emdebian.org/svn/browser/current/ @@ -15,7 +16,7 @@ Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, apt, apt-cross (>= 0.5.0), binutils-multiarch, debootstrap (>= 1.0.4), dpkg-cross (>= 2.1.0), devscripts, emdebian-archive-keyring, multistrap, pbuilder, sudo, ucf, - libparse-debian-packages-perl, libemdebian-tools-perl + libparse-debian-packages-perl Replaces: emdebian-tools (<= 1.4.3) Recommends: gcc Suggests: deb-gview, debian-xcontrol, screen | minicom diff --git a/em_multistrap b/em_multistrap index bc17969..b99028d 100755 --- a/em_multistrap +++ b/em_multistrap @@ -24,12 +24,12 @@ use Parse::Debian::Packages; use POSIX qw(locale_h); use Locale::gettext; -use vars qw/ $progname $ourversion $dstrap $extra @aptsources +use vars qw/ $progname $ourversion $dstrap $extra @aptsources $mirror @archives $deb $cachedir $config_str %packages $retval $str $retries - $dir $include $arch $foreign $suite $url $unpack $sourcedir $msg - @e $sourcesname $libdir $dpkgdir @debootstrap %suites %components $component $mirror $etcdir - $repo @dirs @touch %sources $section %keys $host $key $value $type - $file $config $tidy $noauth $keyring %keyrings $deflist @extrapkgs /; + $dir $include $arch $foreign $suite $url $unpack $sourcedir $msg $etcdir + @e $sourcesname $libdir $dpkgdir @debootstrap %suites %components + $component $repo @dirs @touch %sources $section %keys $host $key $value + $type $file $config $tidy $noauth $keyring %keyrings $deflist @extrapkgs /; setlocale(LC_MESSAGES, ""); textdomain("multistrap"); diff --git a/embootstrap b/embootstrap index eb4c6d2..57315af 100755 --- a/embootstrap +++ b/embootstrap @@ -6,7 +6,7 @@ set -e # Note that this script controls tarballs for empdebuild and emsandbox # pass --cross to set an emsandbox tarball. # -# Copyright (C) 2007-2008 Neil Williams +# Copyright (C) 2007-2010 Neil Williams # # 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 @@ -264,9 +264,9 @@ else # else if not $CROSS # TODO this should be configurable - emdebian-tools will add a primary later. # copy or use the ~/.apt-cross/sources.foo. files. if [ ! $MIRROR ]; then - URL=`perl -e "use Emdebian::Tools; use Config::Auto; print &get_primary;"` - if [ ! -z "$URL" ]; then - MIRROR="http://${URL}/debian" + get_primary + if [ ! -z "$PRIMARY" ]; then + MIRROR="http://${PRIMARY}/debian" fi fi if [ ! $MIRROR ]; then diff --git a/empbuilderlib b/empbuilderlib index 3f7441c..4783637 100644 --- a/empbuilderlib +++ b/empbuilderlib @@ -1,6 +1,6 @@ # empbuilderlib : shell library to support building chroots for Emdebian. # -# Copyright (C) 2006-2008 Neil Williams +# Copyright (C) 2006-2010 Neil Williams # Copyright (C) 2001-2007 Junichi Uekawa # # This package is free software; you can redistribute it and/or modify @@ -196,3 +196,25 @@ function save_aptcrosscache() { done fi } + +function get_aptcross_dir () +{ + if [ -z "$HOME" -o ! -d $HOME ]; then + $HOME = "/tmp"; + fi + echo $HOME + path="$HOME/.apt-cross"; + if [ ! -d $path ]; then + mkdir $path; + fi +} + +function get_primary () +{ + get_aptcross_dir + if [ -f "$path/emsource.conf" ]; then + PRIMARY=`grep primary $path/emsource.conf|cut -d: -f2|tr -d ' '` + else + PRIMARY=`grep primary /etc/emsource.conf|cut -d: -f2|tr -d ' '` + fi +} diff --git a/emrootfslib b/emrootfslib index 43a3846..d3fe34f 100644 --- a/emrootfslib +++ b/emrootfslib @@ -3,7 +3,7 @@ # This file is POSIX shell, compatible with debootstrap. # Do not include or reference pbuilder functions or bash code here. # -# Copyright (C) 2006-2008 Neil Williams +# Copyright (C) 2006-2010 Neil Williams # # 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 @@ -24,25 +24,38 @@ # Intended solely for use on the build machine. Do not use these functions # in second_stage_install ! -OURVERSION=`perl -e 'use Emdebian::Tools; print &tools_version();'` +OURVERSION=`dpkg-query -W -f='${Version}' emdebian-rootfs` + +get_aptcross_dir () +{ + if [ -z "$HOME" -o ! -d $HOME ]; then + $HOME = "/tmp"; + fi + echo $HOME + path="$HOME/.apt-cross"; + if [ ! -d $path ]; then + mkdir $path; + fi +} get_default_arch () { - ARCH=`perl -e 'use Debian::DpkgCross; \ -&read_config(); \ -my $arch = &get_architecture(); \ -print (qq/None.\n/) if (!$arch); \ -print $arch;';` +if [ -f "/etc/dpkg-cross/cross-compile" ]; then + ARCH=`grep default_arch /etc/dpkg-cross/cross-compile|grep -v '^#'|cut -d'=' -f2` +fi +if [ -z "$ARCH" ]; then + ARCH="None" +fi } - get_work_dir () +get_work_dir () { - WORKDIR=`perl -e 'use Cwd; use Emdebian::Tools; use Config::Auto; use Debian::DpkgCross; \ -&read_config; \ -my $w = &get_workdir; \ -$w = cwd if (! -d $w); \ -$w =~ s/\/$//; \ -print $w;';` + get_aptcross_dir + if [ -f "$path/emsource.conf" ]; then + WORKDIR=`grep workingdir $path/emsource.conf|cut -d: -f2|tr -d ' '` + else + WORKDIR=`grep workingdir /etc/emsource.conf|cut -d: -f2|tr -d ' '` + fi } get_work_dir