From: Frank Lichtenheld Date: Sun, 12 Nov 2006 20:24:48 +0000 (+0000) Subject: Create $DBDIR if it doesn't exist X-Git-Tag: switch-to-templates~4 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=e178006b4cca636a5aa78b526e35753895b885b3;p=deb%2Fpackages.git Create $DBDIR if it doesn't exist Handle missing Packages/Sources files a little bit more gracefully which makes the log much easier to read --- diff --git a/bin/parse-packages b/bin/parse-packages index c411d34..189ea02 100755 --- a/bin/parse-packages +++ b/bin/parse-packages @@ -31,6 +31,7 @@ my $MAX_PACKAGE_POSTFIXES = 100; use DB_File; use Storable; +use File::Path; use Deb::Versions; use Packages::Config qw( $TOPDIR $DBDIR @ARCHIVES @SUITES ); &Packages::Config::init( './' ); @@ -50,6 +51,8 @@ my %priorities = (); $/ = ""; +-d $DBDIR || mkpath( $DBDIR ); + for my $suite (@SUITES) { my %package_names_suite = (); my %packages_all_db; @@ -59,6 +62,10 @@ for my $suite (@SUITES) { for my $archive (@ARCHIVES) { print "Reading $archive/$suite...\n"; + if (!-d "$TOPDIR/archive/$archive/$suite/") { + print "\tseems not to exist, skipping...\n"; + next; + } open PKG, "zcat $TOPDIR/archive/$archive/$suite/$what/{,debian-installer/}binary-*/Packages.gz|"; while () { next if /^\s*$/; diff --git a/bin/parse-sources b/bin/parse-sources index 7321126..8ec35db 100755 --- a/bin/parse-sources +++ b/bin/parse-sources @@ -29,6 +29,7 @@ my $what = $ARGV[0] ? "non-free" : "*"; my $MAX_SOURCE_POSTFIXES = 100; use DB_File; +use File::Path; use Packages::Config qw( $TOPDIR $DBDIR @ARCHIVES @SUITES ); &Packages::Config::init( './' ); my %sources_small = (); @@ -37,6 +38,8 @@ my %source_postfixes = (); $/ = ""; +-d $DBDIR || mkpath( $DBDIR ); + for my $archive (@ARCHIVES) { for my $suite (@SUITES) { @@ -46,6 +49,10 @@ for my $archive (@ARCHIVES) { tie %sources_all_db, "DB_File", "$DBDIR/sources_all_$suite.db.new", O_RDWR|O_CREAT, 0666, $DB_BTREE or die "Error creating DB: $!"; + if (!-d "$TOPDIR/archive/$archive/$suite/") { + print "\tseems not to exist, skipping...\n"; + next; + } open PKG, "zcat $TOPDIR/archive/$archive/$suite/$what/source/Sources.gz|"; while () { next if /^\s*$/;