[Debian-l10n-commits] r1213 - in /ddtp-web: Packages2packages_tb.pl Packages2packages_tb.sh packages_tb2Packages.pl
grisu at users.alioth.debian.org
grisu at users.alioth.debian.org
Fri Aug 15 12:22:58 UTC 2008
Author: grisu
Date: Fri Aug 15 12:22:57 2008
New Revision: 1213
URL: http://svn.debian.org/wsvn/?sc=1&rev=1213
Log:
* read and write from/to stdin/stdout
Modified:
ddtp-web/Packages2packages_tb.pl
ddtp-web/Packages2packages_tb.sh
ddtp-web/packages_tb2Packages.pl
Modified: ddtp-web/Packages2packages_tb.pl
URL: http://svn.debian.org/wsvn/ddtp-web/Packages2packages_tb.pl?rev=1213&op=diff
==============================================================================
--- ddtp-web/Packages2packages_tb.pl (original)
+++ ddtp-web/Packages2packages_tb.pl Fri Aug 15 12:22:57 2008
@@ -16,10 +16,6 @@
my $data = "/org/ddtp.debian.net/Packages/";
-my $DIST = shift || "etch";
-my $SECTION = shift || "main";
-my $ARCH = shift || "i386";
-
my %descrmd5; # $descrmd5{$md5} = $desc_id, represents all known descriptions
my %descrlist; # $descrlist{$package}{$md5} exists for each package in package file
# $descrlist{$package}{priority} = package priority
@@ -31,8 +27,8 @@
sub load_packages
{
- print STDERR "Loading package file Packages_${DIST}_${SECTION}_${ARCH}.bz2";
- my $fh = open_bz2_file( "$data/Packages_${DIST}_${SECTION}_${ARCH}.bz2" );
+ print STDERR " Loading package file ";
+ my $fh = open_stdin( );
parse_header_format( $fh, \&process_package );
close $fh;
my $sth = $dbh->prepare("SELECT count(packages_id) FROM packages_tb");
@@ -72,13 +68,11 @@
}
}
-sub open_bz2_file
+sub open_stdin
{
- my $file = shift;
-
my $fh;
- open $fh, "bzcat $file |" or die "Couldn't open $file ($!)\n";
+ open $fh, "</dev/stdin" or die "Couldn't open /dev/stdin ($!)\n";
return $fh;
}
Modified: ddtp-web/Packages2packages_tb.sh
URL: http://svn.debian.org/wsvn/ddtp-web/Packages2packages_tb.sh?rev=1213&op=diff
==============================================================================
--- ddtp-web/Packages2packages_tb.sh (original)
+++ ddtp-web/Packages2packages_tb.sh Fri Aug 15 12:22:57 2008
@@ -37,12 +37,14 @@
for arch in $DISTS
do
- [ -f Packages/Packages_${distribution}_${part}_${arch}.bz2 ] && echo -n `date` :
- [ -f Packages/Packages_${distribution}_${part}_${arch}.bz2 ] && $INPORT2DB $distribution $part $arch
- [ -f Packages/Packages_${distribution}_${part}_${arch}.bz2 ] || echo no Packages_${distribution}_${part}_${arch}.bz2
+ file="Packages/Packages_${distribution}_${part}_${arch}.bz2"
+
+ [ -f $file ] && echo -n `date` : $file
+ [ -f $file ] && bzcat $file | $INPORT2DB
+ [ -f $file ] || echo no $file
done
- $DB2FILE $distribution $part
+ $DB2FILE > $file
done
done
# Regular vacuum to cut disk usage
Modified: ddtp-web/packages_tb2Packages.pl
URL: http://svn.debian.org/wsvn/ddtp-web/packages_tb2Packages.pl?rev=1213&op=diff
==============================================================================
--- ddtp-web/packages_tb2Packages.pl (original)
+++ ddtp-web/packages_tb2Packages.pl Fri Aug 15 12:22:57 2008
@@ -32,8 +32,8 @@
{
my ($package,$source,$version,$tag,$priority,$maintainer,$task,$section,$description);
- print STDERR "Export package file Packages_${DIST}_${SECTION}.bz2\n";
- my $fh = open_bz2_file( "$data/Packages_${DIST}_${SECTION}.bz2" );
+ print STDERR " Export package file \n";
+ my $fh = open_stdout( );
my $sth = $dbh->prepare("SELECT package,source,version,tag,priority,maintainer,task,section,description FROM packages_tb ORDER BY package");
$sth->execute;
@@ -53,13 +53,11 @@
}
# Helper for load_packages
-sub open_bz2_file
+sub open_stdout
{
- my $file = shift;
-
my $fh;
- open $fh, "| bzip2 > $file " or die "Couldn't open $file ($!)\n";
+ open $fh, "| bzip2 " or die "Couldn't open stdout ($!)\n";
return $fh;
}
More information about the Debian-l10n-commits
mailing list