[pkg-bioc] svn commit r368 r368 - in /trunk/tools-ng: r_pkg_update.pl r_pkg_upload.pl

smoe-guest at users.alioth.debian.org smoe-guest at users.alioth.debian.org
Fri Dec 7 11:05:54 UTC 2007


Author: smoe-guest
Date: Fri Dec  7 11:05:53 2007
New Revision: 368

URL: http://svn.debian.org/wsvn/pkg-bioc/?sc=1&rev=368
Log:
* r_pkg_upload: serious fix to read the right Packages file
* r_pkg_update: updates the local Packages.gz files, which somehow got removed
                after the r_pkg_prepare and I cannot tell why.


Modified:
    trunk/tools-ng/r_pkg_update.pl
    trunk/tools-ng/r_pkg_upload.pl

Modified: trunk/tools-ng/r_pkg_update.pl
URL: http://svn.debian.org/wsvn/pkg-bioc/trunk/tools-ng/r_pkg_update.pl?rev=368&op=diff
==============================================================================
--- trunk/tools-ng/r_pkg_update.pl (original)
+++ trunk/tools-ng/r_pkg_update.pl Fri Dec  7 11:05:53 2007
@@ -91,6 +91,13 @@ This script will be executed under Debia
    create|update the $installmethods_builder image.
    Need to have $installmethods_pbuilder in the sudo authorisation!
 
+=item --donotpackagesgzupdate
+
+   If the local file repository/builds/Packages.gz file is not existing or
+   older than the directory's last update, then it should be recreated.
+   This is performed automatically with a --doupdate. If this is not intended
+   then just set this flag.
+
 =item --debootstrap (debootstrap|cdebootstrap)
 
    Parameter passed to pbuilder when creating the base.tgz.
@@ -112,7 +119,7 @@ use Cwd;
 use vars qw($help $man $debug $verbose $dryrun $VERSION);
 
 #the specific variables
-use vars qw($doupdate $dotagupdate $dobuilderupdate $debootstrap);
+use vars qw($doupdate $dotagupdate $dobuilderupdate $debootstrap $donotpackagesgzupdate);
 
 my $origpath = cwd;
 
@@ -172,6 +179,7 @@ my %options = (
     "doupdate"        => \$doupdate,
     "dotagupdate"     => \$dotagupdate,
     "dobuilderupdate" => \$dobuilderupdate,
+    "donotpackagesgzupdate" => \$donotpackagesgzupdate,
     "debootstrap:s" => \$debootstrap
 );
 
@@ -281,6 +289,20 @@ check_requirement( $installMethods, $vs,
 &debtag_update()
   if ($dotagupdate);
 
+sub dopackagesgzupdate() {
+   my $rep=shift;
+   my $c="";
+   if (defined($rep)) {
+   	$c = "cd $rep && ";
+   }
+   $c .= "apt-ftparchive packages builds | gzip > builds/Packages.gz";
+   print STDERR "Executing $c" if $verbose;
+   my $s = system($c);
+   if ($s) {
+   	die "\n\nProblem with execution of apt-ftparchive for repository $rep.\n";
+   }
+}
+
 sub remove_directory($) {
     my ($dir) = @_;
 
@@ -705,21 +727,39 @@ sub main {
         my @ary = ();
 
         # in the source directory
-        chdir "../$m";
+        unless (chdir "../$m") {
+		print STDERR "Could not change to directory '$m' - repository is omitted.";
+		next;
+	}
+
+	# check deb files that are already prepared
+	&dopackagesgzupdate() unless $donotpackagesgzupdate;
+
+	
+	# perform update of upstream tar.gz
 
         &updaterepository($m) if $doupdate;
 
-        chdir "$sources";
+        unless (chdir "$sources") {
+		print STDERR "Could not change to directory 'sources' in '$m' - repository is omitted.";
+		next;
+	}
+
         @ary = glob("*");
         print "Found "
           . ( $#ary + 1 )
           . " patterns in the repository $m/$sources.\n";
 
         &updateclean( \@ary );
-        chdir $origpath;
+	
+	die "Could not change back directory to '$origpath'.\n" unless(chdir $origpath);
 
         # in the builds directory
-        chdir "../$m/$builds";
+        unless(chdir "../$m/$builds") {
+		print STDERR "Could not change to 'builds' directory in '$m' - "
+		            ."repository is omitted, the download was performed.";
+		next;
+	}
         @ary = glob("*");
         print "Found "
           . ( $#ary + 1 )

Modified: trunk/tools-ng/r_pkg_upload.pl
URL: http://svn.debian.org/wsvn/pkg-bioc/trunk/tools-ng/r_pkg_upload.pl?rev=368&op=diff
==============================================================================
--- trunk/tools-ng/r_pkg_upload.pl (original)
+++ trunk/tools-ng/r_pkg_upload.pl Fri Dec  7 11:05:53 2007
@@ -125,9 +125,12 @@ my $tmpSep = $/;
 $/ = "Package: ";
 
 #$/="Package: "
-open( PACKAGES,
-    "lynx --source http://pkg-bioc.alioth.debian.org/debian/Packages |" )
-  or die "Could not access target repository\n";
+my $packagesurl="http://pkg-bioc.alioth.debian.org/debian/$reposbn/Packages";
+print STDERR "\nOpening $packagesurl\n";
+
+unlink("Packages") if -r "Packages";
+system("wget $packagesurl")
+  and die "Could not access target repository at '$packagesurl'\n";
 
 use AptPkg::Config '$_config';
 use AptPkg::System '$_system';
@@ -138,6 +141,10 @@ $_config->init;
 $_system = $_config->system;
 my $vs = $_system->versioning;
 
+
+open(PACKAGES,"<Packages")
+	or die "Could not open Packages file that I have supposedly just downloaded.\n";
+
 # Iterate over all packages that should possibly
 # be listed as already available.
 while (<PACKAGES>) {
@@ -338,6 +345,10 @@ if ( defined($username) and !$status ) {
           if defined($pattern)
           and "" ne $pattern
           and !( $k =~ m/$pattern/i );
+
+	# tripple checked
+	next if exists($failedPackages{$k});
+	
         $added++;
         die "Programming error: Accepted package '$k' "
           . "has no files assigned.\n"




More information about the pkg-bioc-devel mailing list