From 51817bf6f866f4ba9cd84f22ece9b5a1478d5c52 Mon Sep 17 00:00:00 2001 From: codehelp Date: Thu, 11 Mar 2010 16:48:13 +0000 Subject: [PATCH] Handle relative directories from the command line. git-svn-id: http://emdebian.org/svn/current@6799 563faec7-e20c-0410-992a-a66f704d0ccd --- debian/changelog | 3 +- em_multistrap | 28 ++++++++++++++-- po/fr.po | 85 +++++++++++++++++++++++++++++------------------- po/pt.po | 85 +++++++++++++++++++++++++++++------------------- 4 files changed, 129 insertions(+), 72 deletions(-) diff --git a/debian/changelog b/debian/changelog index 27b30b6..e6dbe81 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ emdebian-rootfs (2.0.7) unstable; urgency=low * [INTL:pt] Updated Portuguese program output translation (Closes: #572929) + * Handle relative directories from the command line. - -- Neil Williams Sun, 07 Mar 2010 18:56:37 +0000 + -- Neil Williams Thu, 11 Mar 2010 16:39:36 +0000 emdebian-rootfs (2.0.6) unstable; urgency=low diff --git a/em_multistrap b/em_multistrap index 22c631b..bc17969 100755 --- a/em_multistrap +++ b/em_multistrap @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Copyright (C) 2009 Neil Williams +# Copyright (C) 2009, 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 @@ -34,7 +34,7 @@ use vars qw/ $progname $ourversion $dstrap $extra @aptsources setlocale(LC_MESSAGES, ""); textdomain("multistrap"); $progname = basename($0); -$ourversion = "0.0.8"; +$ourversion = &our_version(); $unpack = "true"; while( @ARGV ) { @@ -160,7 +160,12 @@ $libdir = "var/lib/apt/"; # lists $etcdir = "etc/apt/"; # sources $dpkgdir = "var/lib/dpkg/"; # state -mkdir ("$dir") if (not -d "$dir"); +my $ret = mkdir ("$dir") if (not -d "$dir"); +die ("Unable to create directory '$dir'\n") + if ($ret == 0); +$dir = `realpath $dir`; +chomp ($dir); +$dir .= ($dir =~ m:/$:) ? '' : "/"; system ("mkdir -p ${dir}${cachedir}") if (not -d "${dir}${cachedir}"); system ("mkdir -p ${dir}${libdir}") if (not -d "${dir}${libdir}"); system ("mkdir -p ${dir}${dpkgdir}") if (not -d "${dir}${dpkgdir}"); @@ -168,6 +173,10 @@ system ("mkdir -p ${dir}etc/apt/sources.list.d/") if (not -d "${dir}etc/apt/sources.list.d/"); system ("mkdir -p ${dir}etc/apt/preferences.d/") if (not -d "${dir}etc/apt/preferences.d/"); +my $msg = sprintf(_g("Unable to create directory '%s'\n"), "${dir}etc/apt/preferences.d/"); +die ($msg) + if (not -d "${dir}etc/apt/preferences.d/"); + @dirs = qw/ alternatives info parts updates/; @touch = qw/ diversions statoverride status lock/; foreach my $dpkgd (@dirs) { @@ -337,6 +346,11 @@ exit 0; # touch /usr/share/doc/gcc-4.2-base/.changelog.Debian.gz # touch /usr/share/doc/gcc-4.2-base/.changelog.Debian.gz +sub our_version { + my $query = `dpkg-query -W -f='\${Version}' multistrap`; + (defined $query) ? return $query : return "0.0.9"; +} + sub add_extra_packages { $str = join (' ', @extrapkgs); @@ -414,6 +428,7 @@ sub force_unpack my $old = `pwd`; chomp ($old); chdir ("${dir}"); + printf (_g("Using directory %s for unpacking operations\n"), ${dir}); foreach $deb (sort @archives) { printf (_g("I: Extracting %s...\n"), $deb); @@ -425,6 +440,13 @@ sub force_unpack my $tmpdir = `mktemp -p ./tmp -d -t multistrap.XXXXXX`; chomp ($tmpdir); my $datatar = `LC_ALL=C dpkg -X ./${cachedir}archives/$deb ${dir}`; + my $exit = `echo $?`; + chomp ($exit); + if ($exit ne "0") + { + printf(_g("dpkg -X failed with error code %s\nSkipping...\n"), $exit); + next; + } my @lines = split("\n", $datatar); open (LIST, ">>./${dpkgdir}info/${pkg}.list"); foreach my $l (@lines) diff --git a/po/fr.po b/po/fr.po index f186a51..d07b6c8 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: multistrap\n" "Report-Msgid-Bugs-To: multistrap@packages.debian.org\n" -"POT-Creation-Date: 2010-02-27 20:02+0000\n" +"POT-Creation-Date: 2010-03-11 16:43+0000\n" "PO-Revision-Date: 2009-11-30 00:40+0100\n" "Last-Translator: Bruno Travouillon \n" "Language-Team: French \n" @@ -61,51 +61,56 @@ msgstr "" msgid "%s building %s multistrap on '%s'\n" msgstr "%s construit un multistrap pour l'architecture '%s' sur '%s'\n" -#: ../em_multistrap:203 +#: ../em_multistrap:176 +#, perl-format +msgid "Unable to create directory '%s'\n" +msgstr "" + +#: ../em_multistrap:212 msgid "INF: ./lib64 -> /lib symbolic link reset to ./lib.\n" msgstr "" "INF : Le lien symbolique ./lib64 -> /lib pointe maintenant vers ./lib.\n" -#: ../em_multistrap:213 +#: ../em_multistrap:222 msgid "INF: Setting ./lib64 -> ./lib symbolic link.\n" msgstr "INF : Définit le lien symbolique ./lib64 -> ./lib.\n" -#: ../em_multistrap:246 ../em_multistrap:253 +#: ../em_multistrap:255 ../em_multistrap:262 msgid "Cannot open sources list" msgstr "Impossible d'ouvrir la liste des sources" -#: ../em_multistrap:277 +#: ../em_multistrap:286 #, perl-format msgid "I: Installing %s\n" msgstr "I : Installe %s\n" -#: ../em_multistrap:294 +#: ../em_multistrap:303 #, perl-format msgid "Getting package lists: apt-get %s update\n" msgstr "Téléchargement de la liste des paquets : apt-get %s update\n" -#: ../em_multistrap:296 +#: ../em_multistrap:305 #, perl-format msgid "apt update failed. Exit value: %d\n" msgstr "Échec de la mise à jour apt. Code de sortie : %d\n" -#: ../em_multistrap:314 +#: ../em_multistrap:323 #, perl-format msgid "apt download failed. Exit value: %d\n" msgstr "Échec du téléchargement apt. Code de sortie : %d\n" -#: ../em_multistrap:326 +#: ../em_multistrap:335 msgid "ERR: ./lib64 -> /lib symbolic link reset to ./lib after unpacking.\n" msgstr "" "ERR : Le lien symbolique ./lib64 -> /lib pointera vers ./lib après le " "dépaquetage.\n" -#: ../em_multistrap:327 +#: ../em_multistrap:336 #, perl-format msgid "ERR: Some files may have been unpacked outside %s!\n" msgstr "ERR : Certains fichiers ont été dépaquetés hors de %s !\n" -#: ../em_multistrap:331 +#: ../em_multistrap:340 #, perl-format msgid "" "\n" @@ -116,77 +121,89 @@ msgstr "" "Le système multistrap est installé avec succès dans %s.\n" "\n" -#: ../em_multistrap:359 ../em_multistrap:410 +#: ../em_multistrap:373 ../em_multistrap:424 msgid "Cannot read apt archives directory.\n" msgstr "Impossible d'accéder au répertoire des archives apt.\n" -#: ../em_multistrap:376 +#: ../em_multistrap:390 msgid "I: Calculating obsolete packages\n" msgstr "I : Identifie les paquets obsolètes\n" -#: ../em_multistrap:393 ../em_multistrap:399 +#: ../em_multistrap:407 ../em_multistrap:413 #, perl-format msgid "I: Removing %s\n" msgstr "I : Supprime %s\n" -#: ../em_multistrap:419 +#: ../em_multistrap:431 +#, perl-format +msgid "Using directory %s for unpacking operations\n" +msgstr "" + +#: ../em_multistrap:434 #, perl-format msgid "I: Extracting %s...\n" msgstr "I : Extrait %s...\n" -#: ../em_multistrap:465 +#: ../em_multistrap:447 +#, perl-format +msgid "" +"dpkg -X failed with error code %s\n" +"Skipping...\n" +msgstr "" + +#: ../em_multistrap:487 #, perl-format msgid " -> Processing conffiles for %s\n" msgstr " -> Traitement des fichiers de configuration pour %s\n" -#: ../em_multistrap:486 +#: ../em_multistrap:508 #, perl-format msgid "ERR: lib64 -> ./lib symbolic link clobbered by %s\n" msgstr "ERR : Le lien symbolique lib64 -> ./lib est remplacé par %s\n" -#: ../em_multistrap:489 +#: ../em_multistrap:511 msgid "INF: lib64 -> /lib symbolic link reset to ./lib.\n" msgstr "INF : Le lien symbolique lib64 -> /lib pointe maintenant vers ./lib.\n" -#: ../em_multistrap:496 +#: ../em_multistrap:518 msgid "I: Unpacking complete.\n" msgstr "I : Dépaquetage complet.\n" -#: ../em_multistrap:511 +#: ../em_multistrap:533 #, fuzzy msgid "ERR: ./bin/sh symbolic link does not exist.\n" msgstr "ERR : Le lien symbolique lib64 -> ./lib est remplacé par %s\n" -#: ../em_multistrap:514 +#: ../em_multistrap:536 #, fuzzy msgid "INF: Setting ./bin/sh -> ./bin/dash\n" msgstr "INF : Définit le lien symbolique ./lib64 -> ./lib.\n" -#: ../em_multistrap:521 +#: ../em_multistrap:543 msgid "INF: ./bin/dash not found. Setting ./bin/sh -> ./bin/bash\n" msgstr "" -#: ../em_multistrap:540 +#: ../em_multistrap:562 msgid "I: Tidying up apt cache and list data.\n" msgstr "I : Nettoie le cache apt et les listes de données.\n" -#: ../em_multistrap:544 +#: ../em_multistrap:566 msgid "Cannot read apt lists directory.\n" msgstr "Impossible d'accéder au répertoire des listes apt.\n" -#: ../em_multistrap:553 +#: ../em_multistrap:575 msgid "Cannot read apt cache directory/.\n" msgstr "Impossible d'accéder au répertoire du cache apt/.\n" -#: ../em_multistrap:565 +#: ../em_multistrap:587 msgid "Cannot read apt archives directory/.\n" msgstr "Impossible d'accéder au répertoire des archives apt/.\n" -#: ../em_multistrap:583 +#: ../em_multistrap:605 msgid "I: Native mode - configuring unpacked packages . . .\n" msgstr "I : Mode natif, configure les paquets décompressés...\n" -#: ../em_multistrap:590 +#: ../em_multistrap:612 #, perl-format msgid "" "I: dpkg configuration settings:\n" @@ -195,27 +212,27 @@ msgstr "" "I : Paramètres de configuration de dpkg :\n" "\t%s\n" -#: ../em_multistrap:605 +#: ../em_multistrap:627 #, perl-format msgid "Cannot open %s directory. %s\n" msgstr "Impossible d'accéder au répertoire %s. %s\n" -#: ../em_multistrap:638 +#: ../em_multistrap:660 #, perl-format msgid "cannot open apt sources list. %s" msgstr "Impossible d'accéder à la liste des sources apt. %s" -#: ../em_multistrap:644 +#: ../em_multistrap:666 #, perl-format msgid "cannot open apt sources.list directory %s\n" msgstr "Impossible d'accéder au répertoire des sources apt %s\n" -#: ../em_multistrap:649 +#: ../em_multistrap:671 #, perl-format msgid "cannot open /etc/apt/sources.list.d/%s %s" msgstr "Impossible d'accéder à /etc/apt/sources.list.d/%s %s" -#: ../em_multistrap:661 +#: ../em_multistrap:683 #, fuzzy, perl-format msgid "" "\n" @@ -350,6 +367,6 @@ msgstr "" "sera créé. Il n'est pas empaqueté dans un .tgz une fois complété.\n" "\n" -#: ../em_multistrap:725 +#: ../em_multistrap:747 msgid "failed to write usage:" msgstr "Impossible d'afficher l'aide :" diff --git a/po/pt.po b/po/pt.po index 6df4d7e..bcaf332 100644 --- a/po/pt.po +++ b/po/pt.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: emdebian-rootfs_2.0.5\n" "Report-Msgid-Bugs-To: multistrap@packages.debian.org\n" -"POT-Creation-Date: 2010-02-27 20:02+0000\n" +"POT-Creation-Date: 2010-03-11 16:43+0000\n" "PO-Revision-Date: 2010-03-06 23:50+0000\n" "Last-Translator: Pedro Ribeiro \n" "Language-Team: Portuguese \n" @@ -57,50 +57,55 @@ msgstr "" msgid "%s building %s multistrap on '%s'\n" msgstr "%s a criar multistrap para %s em '%s'\n" -#: ../em_multistrap:203 +#: ../em_multistrap:176 +#, perl-format +msgid "Unable to create directory '%s'\n" +msgstr "" + +#: ../em_multistrap:212 msgid "INF: ./lib64 -> /lib symbolic link reset to ./lib.\n" msgstr "INF: link simbólico ./lib64 -> /lib reposto para ./lib.\n" -#: ../em_multistrap:213 +#: ../em_multistrap:222 msgid "INF: Setting ./lib64 -> ./lib symbolic link.\n" msgstr "INF: A definir link simbólico ./lib64 -> ./lib.\n" -#: ../em_multistrap:246 ../em_multistrap:253 +#: ../em_multistrap:255 ../em_multistrap:262 msgid "Cannot open sources list" msgstr "Impossível abrir lista de fontes" -#: ../em_multistrap:277 +#: ../em_multistrap:286 #, perl-format msgid "I: Installing %s\n" msgstr "I: A instalar %s\n" -#: ../em_multistrap:294 +#: ../em_multistrap:303 #, perl-format msgid "Getting package lists: apt-get %s update\n" msgstr "A obter listas de pacotes: apt-get %s update\n" -#: ../em_multistrap:296 +#: ../em_multistrap:305 #, perl-format msgid "apt update failed. Exit value: %d\n" msgstr "apt update falhou. Valor de saída: %d\n" -#: ../em_multistrap:314 +#: ../em_multistrap:323 #, perl-format msgid "apt download failed. Exit value: %d\n" msgstr "apt download falhou. Valor de saída: %d\n" -#: ../em_multistrap:326 +#: ../em_multistrap:335 msgid "ERR: ./lib64 -> /lib symbolic link reset to ./lib after unpacking.\n" msgstr "" "ERRO: link simbólico ./lib64 -> /lib reposto para ./lib após " "desempacotamento.\n" -#: ../em_multistrap:327 +#: ../em_multistrap:336 #, perl-format msgid "ERR: Some files may have been unpacked outside %s!\n" msgstr "ERRO: Alguns ficheiros podem ter sido desempacotados fora de %s!\n" -#: ../em_multistrap:331 +#: ../em_multistrap:340 #, perl-format msgid "" "\n" @@ -111,75 +116,87 @@ msgstr "" "Sistema multistrap instalado com sucesso em %s.\n" "\n" -#: ../em_multistrap:359 ../em_multistrap:410 +#: ../em_multistrap:373 ../em_multistrap:424 msgid "Cannot read apt archives directory.\n" msgstr "Impossível ler o directório de arquivos apt.\n" -#: ../em_multistrap:376 +#: ../em_multistrap:390 msgid "I: Calculating obsolete packages\n" msgstr "I: A calcular pacotes obsoletos\n" -#: ../em_multistrap:393 ../em_multistrap:399 +#: ../em_multistrap:407 ../em_multistrap:413 #, perl-format msgid "I: Removing %s\n" msgstr "I: A remover %s\n" -#: ../em_multistrap:419 +#: ../em_multistrap:431 +#, perl-format +msgid "Using directory %s for unpacking operations\n" +msgstr "" + +#: ../em_multistrap:434 #, perl-format msgid "I: Extracting %s...\n" msgstr "I: A extrair %s...\n" -#: ../em_multistrap:465 +#: ../em_multistrap:447 +#, perl-format +msgid "" +"dpkg -X failed with error code %s\n" +"Skipping...\n" +msgstr "" + +#: ../em_multistrap:487 #, perl-format msgid " -> Processing conffiles for %s\n" msgstr " -> A processar ficheiros de configuração para %s\n" -#: ../em_multistrap:486 +#: ../em_multistrap:508 #, perl-format msgid "ERR: lib64 -> ./lib symbolic link clobbered by %s\n" msgstr "ERRO: link simbólico lib64 -> ./lib ocultado por %s\n" -#: ../em_multistrap:489 +#: ../em_multistrap:511 msgid "INF: lib64 -> /lib symbolic link reset to ./lib.\n" msgstr "INF: link simbólico lib64 -> /lib reposto para ./lib.\n" -#: ../em_multistrap:496 +#: ../em_multistrap:518 msgid "I: Unpacking complete.\n" msgstr "I: Desempacotamento completo.\n" -#: ../em_multistrap:511 +#: ../em_multistrap:533 msgid "ERR: ./bin/sh symbolic link does not exist.\n" msgstr "ERRO: link simbólico ./bin/sh não existe.\n" -#: ../em_multistrap:514 +#: ../em_multistrap:536 msgid "INF: Setting ./bin/sh -> ./bin/dash\n" msgstr "INF: A definir link simbólico ./bin/sh -> ./bin/dash\n" -#: ../em_multistrap:521 +#: ../em_multistrap:543 msgid "INF: ./bin/dash not found. Setting ./bin/sh -> ./bin/bash\n" msgstr "INF: ./bin/dash não foi encontrado. A definir ./bin/sh -> ./bin/bash\n" -#: ../em_multistrap:540 +#: ../em_multistrap:562 msgid "I: Tidying up apt cache and list data.\n" msgstr "I: A arrumar dados de lista e de apt cache.\n" -#: ../em_multistrap:544 +#: ../em_multistrap:566 msgid "Cannot read apt lists directory.\n" msgstr "Impossível ler directório de listas apt.\n" -#: ../em_multistrap:553 +#: ../em_multistrap:575 msgid "Cannot read apt cache directory/.\n" msgstr "Impossível ler directório/ de apt cache.\n" -#: ../em_multistrap:565 +#: ../em_multistrap:587 msgid "Cannot read apt archives directory/.\n" msgstr "Impossível ler directório/ de arquivos apt.\n" -#: ../em_multistrap:583 +#: ../em_multistrap:605 msgid "I: Native mode - configuring unpacked packages . . .\n" msgstr "I: Modo nativo - a configurar pacotes desempacotados . . .\n" -#: ../em_multistrap:590 +#: ../em_multistrap:612 #, perl-format msgid "" "I: dpkg configuration settings:\n" @@ -188,27 +205,27 @@ msgstr "" "I: opções de configuração do dpkg:\n" "\t%s\n" -#: ../em_multistrap:605 +#: ../em_multistrap:627 #, perl-format msgid "Cannot open %s directory. %s\n" msgstr "Impossível abrir o directório %s. %s\n" -#: ../em_multistrap:638 +#: ../em_multistrap:660 #, perl-format msgid "cannot open apt sources list. %s" msgstr "impossível abrir lista de fontes. %s" -#: ../em_multistrap:644 +#: ../em_multistrap:666 #, perl-format msgid "cannot open apt sources.list directory %s\n" msgstr "impossível abrir directório de apt sources.list %s\n" -#: ../em_multistrap:649 +#: ../em_multistrap:671 #, perl-format msgid "cannot open /etc/apt/sources.list.d/%s %s" msgstr "impossível abrir /etc/apt/sources.list.d/%s %s" -#: ../em_multistrap:661 +#: ../em_multistrap:683 #, perl-format msgid "" "\n" @@ -346,7 +363,7 @@ msgstr "" "será criado - não será empacotado num .tgz após ficar completo.\n" "\n" -#: ../em_multistrap:725 +#: ../em_multistrap:747 msgid "failed to write usage:" msgstr "falhou a escrita do modo de utilização:"