[Fai-commit] r5987 - in branches/stable/3.4: bin debian man

Michael Prokop mika at alioth.debian.org
Tue Aug 17 12:54:22 UTC 2010


Author: mika
Date: 2010-08-17 12:54:21 +0000 (Tue, 17 Aug 2010)
New Revision: 5987

Modified:
   branches/stable/3.4/bin/install_packages
   branches/stable/3.4/debian/changelog
   branches/stable/3.4/man/install_packages.8
Log:
install_packages: support retrieving sources for Debian based systems using the -s option


Signed-off-by: Michael Prokop <mika at grml.org>

Modified: branches/stable/3.4/bin/install_packages
===================================================================
--- branches/stable/3.4/bin/install_packages	2010-08-17 12:54:15 UTC (rev 5986)
+++ branches/stable/3.4/bin/install_packages	2010-08-17 12:54:21 UTC (rev 5987)
@@ -28,7 +28,7 @@
 # MA 02111-1307, USA.
 #*********************************************************************
 
-my $version = "Version 4.3.1, 30-march-2010";
+my $version = "Version 4.4.0, 04-july-2010";
 $0=~ s#.+/##; # remove path from program name
 
 # import variables: $verbose, $MAXPACKAGES, $classes, $FAI, $FAI_ROOT
@@ -37,7 +37,7 @@
 use Getopt::Std;
 
 # global variables
-our ($opt_d,$opt_l,$opt_L,$opt_v,$opt_h,$opt_H,$opt_m,$opt_n,$opt_N,$opt_p);
+our ($opt_d,$opt_l,$opt_L,$opt_v,$opt_h,$opt_H,$opt_m,$opt_n,$opt_N,$opt_p,$opt_s);
 my $listonly; # flag, that indicates that only a list of packages will be printed
 our %command;
 our $atype;    # type of action (for apt-get, aptitude,..) that will be performed
@@ -101,7 +101,7 @@
   "smartc-internal" => "smart clean",
 );
 
-getopts('dhHvlLm:p:nN');
+getopts('dhHvlLm:p:nNs');
 
 $opt_N || check_aptpkg(); # do not use AptPkg when -N is given
 
@@ -191,6 +191,7 @@
   if ($atype eq "install" || $atype eq "smarti" || $atype eq "aptitude" || $atype eq "aptitude-r" || $atype eq "unpack" || $opt_l || $opt_L) {
 
     mkpackagelist(@{$list{$atype}}); # create lists of known and unknown packages
+    getsources(); # retrieve sources
     if ($opt_l) {
       # only print the package list
       print join ' ', at known,"\n";
@@ -467,12 +468,25 @@
   print LIST "# List of all packages that will be installed via install_packages\n";
   for (@known) { print LIST "$_\n"; }
   close(LIST);
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# download debian source packages
+sub getsources {
 
-  return unless ($ENV{'FAI_DEBSOURCESDIR'});
+  return unless $opt_s;
 
-  # download debian source packages if $ENV{'FAI_DEBSOURCESDIR'} is defined
-  execute("$rootcmd sh -c \"mkdir $debsourcesdir;cd $debsourcesdir ; apt-get --download-only source @known\"");
-  execute("mkdir -p $ENV{'FAI_DEBSOURCESDIR'}; mv $FAI_ROOT/$debsourcesdir/* $ENV{'FAI_DEBSOURCESDIR'}");
+  print "Trying to retrieve sources as specified via -s option for install_packages\n" if $verbose;
+
+  if (!$ENV{'FAI_DEBSOURCESDIR'}) {
+    die "Error: FAI_DEBSOURCESDIR is not set, can not retrieve sources.";
+  }
+
+  execute("$rootcmd sh -c \"mkdir -p $debsourcesdir;\"");
+  execute("mkdir -p $ENV{'FAI_DEBSOURCESDIR'};");
+  for (@known) {
+    execute("$rootcmd sh -c \"cd $debsourcesdir ; apt-get --download-only source $_\"");
+    execute("mv $FAI_ROOT/$debsourcesdir/* $ENV{'FAI_DEBSOURCESDIR'}");
+  }
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub usage {

Modified: branches/stable/3.4/debian/changelog
===================================================================
--- branches/stable/3.4/debian/changelog	2010-08-17 12:54:15 UTC (rev 5986)
+++ branches/stable/3.4/debian/changelog	2010-08-17 12:54:21 UTC (rev 5987)
@@ -31,6 +31,8 @@
   * subroutines, fai: make sure fai exits with the according return
     code of task action (and all the hooks behind it)
   * subroutines: add support for task_error to task configure
+  * install_packages: support retrieving sources for Debian based
+    systems using the -s option
 
  -- Thomas Lange <lange at debian.org>  Fri, 25 Jun 2010 14:29:10 +0200
 

Modified: branches/stable/3.4/man/install_packages.8
===================================================================
--- branches/stable/3.4/man/install_packages.8	2010-08-17 12:54:15 UTC (rev 5986)
+++ branches/stable/3.4/man/install_packages.8	2010-08-17 12:54:21 UTC (rev 5987)
@@ -1,7 +1,7 @@
 .\"                                      Hey, EMACS: -*- nroff -*-
 .if \n(zZ=1 .ig zZ
 .if \n(zY=1 .ig zY
-.TH install_packages 8 "16 september 2008" "FAI 3.2"
+.TH install_packages 8 "04 july 2010" "FAI 3.4"
 .\" Please adjust this date whenever revising the manpage.
 .\"
 .\" Some roff macros, for reference:
@@ -81,6 +81,10 @@
 .BI "\-p " DIRECTORY
 Read the configuration files from DIRECTORY instead of $FAI/packages_config.
 .TP
+.B -s
+Download source of binary packages that are installed. Currently supported
+only for apt-get/aptitude based installations.
+.TP
 .B \-v
 Be verbose.
 




More information about the Fai-commit mailing list