[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

sources.list pour les scripts



Bonjour,

Je suis rentré de vacances et j'ai bien trouvé mon inscription à free et
le mot de passe dans ma boîte aux lettres, je me suis donc empêché de
mettre en ligne ce qu'il faut pour apt. Il vous suffit d'ajouter le
ligne suivante à votre sources.list et tout devient magique :

deb http://nico.bertol.free.fr/debian bertol/fr/

ou si vous préférez avoir les descriptions en anglais :
deb http://nico.bertol.free.fr/debian bertol/

Les sources sont aussi en ligne pour ceux que ça intéresse.

J'en ai profité pour faire une nouvelle version de ddts-script. Voici le
journal des modifications :
 ddts-script (0.4.15) unstable; urgency=low
 .
   * fix magic line to comply with Debian Perl Policy 4.1
   * fix package description
   * remove end of pod documentation
   * use Getopt::Long module to parse options
   * turn back `while' loop into `until'
   * add sub to display usage message
   * add help option

Le diff est attaché (pour la page de manuel, je ne compte pas faire de
diff, mais s'il y a la demande, je ferai, ce n'est pas long, c'est juste
pour éviter de trop polluer la liste).


Nicolas
-- 
--- ddts-script_0.4.14	Sat Feb  9 00:00:00 2002
+++ ddts-script_0.4.15	Tue Feb 12 12:28:06 2002
@@ -1,6 +1,8 @@
-#! /usr/bin/perl -w
+#!/usr/bin/perl
 
 use strict;
+use warnings;
+use Getopt::Long;
 
 # Config part
 # Things you must change in your $HOME/.ddts-script
@@ -51,7 +53,7 @@
 # End of the config part
 
 
-my $version = "0.4.14";
+my $version = "0.4.15";
 
 # Test if configuration as been made
 die "Script unconfigured: email address is `me\@my.isp.org'\n!" if ($mail_addr =~ /me\@my.isp.org/);
@@ -890,11 +892,7 @@
 		$filename =~ s/^new(\..*)?/new/;			# new\..* contains descriptions to translate
 		open  FILE, ">$temp_dir/ddts-$filename-$$"	|| die "Can't create temp file `ddts-$filename-$$': $!";
 		print FILE "begin-base64 400 $temp_dir/ddts-$filename-$$\n";
-		#print FILE $_ until (($_=<>) =~ /^$/);
-		while (<>) {
-			last if /^$/;
-			print FILE $_;
-		}
+		print FILE $_ until (($_=<>) =~ /^$/);
 		print FILE "====";
 		close FILE					|| die "Can't write temp file `ddts-$filename-$$': $!";
 
@@ -1228,103 +1226,71 @@
 	}
 }
 
-# Parse command line
-my $v = 0;
-my $d;
-do {
-	$d = "";
-	$_ = shift || "";
-
-	if (/^-v/) {
-		$d = 1;
-		$debug = $v = 1 unless ($v);
-		$debug++ while (($_ =shift || "") =~ /^-v/);
-	}
-	if (/^-q/) {
-		$d = 1;
-		$debug = $v = 0;
-	}
-	if (/^-s/) {
-		$d = 1;
-		$mail_self = "yes";
-	}
-	if (/-n/) {
-		$d = 1;
-		$mail_self = "no";
-	}
-	if (/^--quiet/) {
-		$d = 1;
-		$debug = $v = 0;
-	}
-	if (/^--verbose/) {
-		$d = 1;
-		$debug = shift || "";
-		$debug =~ s/(\D)//g;
-		$d = $debug;
-	}
-	if (/^--mail-self/) {
-		$d = 1;
-		$mail_self = shift || "";
-		next if ($mail_self eq "yes");
-		next if ($mail_self eq "no");
-		$d = "";
-	}
-} while $d;
-if	 ($_ eq "parse") {
-	&parse;
-} elsif  ($_ eq "mail")  {
-	&mail;
-} elsif  ($_ eq "fix")  {
-	&fix;
-} elsif  ($_ eq "clean") {
-	&clean;
-} elsif  ($_ eq "stats") {
-	&stats;
-} else {
+#
+# Print help message
+# 
+
+sub print_help() {
 	my $me = $0;				# get command name with path
-	$me =~ s/.*\/([^\/]*)$/$1/;		# keep script name
-	die "Usage: $me [-q] [--quiet] [-v] [--verbose n] [-s] [-n]\n"
-	   ."  [--mail-self yes|no] parse|mail|fix|clean|stats\n"
-	   ."\n"
-	   ."commands:\n"
-	   ."  parse: extract the package descriptions from a ddts mail\n"
-	   ."  mail:  send mails back to the ddts\n"
-	   ."  fix:   create a fixed description from bugs\n"
-	   ."  clean: remove obsolete files\n"
-	   ."  stats: print statistics\n"
-	   ."\n"
-	   ."options:\n"
-	   ."  -q, --quiet      quiet mode\n"
-	   ."  -v               verbose, add more for more verbosity\n"
-	   ."      --verbose    set verbosity to n\n"
-	   ."  -s               mail also to oneself\n"
-	   ."  -n               no mail to oneself\n"
-	   ."      --mail-self  mail also to oneself if `yes', don't if `no'\n"
-	   ."in order of appearence, last option overrides previous one if incompatible\n"
-	   ."\n"
-	   ."$me version $version\n";
-}
-
-=head1 LICENSE
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; either version 2 of the License, or (at your option) any later
-version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-Place, Suite 330, Boston, MA  02111-1307  USA
-
-On Debian GNU/Linux systems, the complete text of the GNU General
-Public License can be found in `/usr/share/doc/common-licenses/GPL'.
-
-=head1 AUTHOR
-
-Nicolas Bertolissio <nico.bertol@wanadoo.fr>
-  
-=cut
+	   $me =~ s/.*\/([^\/]*)$/$1/;		# keep script name
+	print "Usage: $me [OPTIONS] parse|mail|fix|clean|stats|help\n"
+	     ."\n"
+	     ."commands:\n"
+	     ."  parse: extract the package descriptions from a ddts mail\n"
+	     ."  mail:  send mails back to the ddts\n"
+	     ."  fix:   create a fixed description from bugs\n"
+	     ."  clean: remove obsolete files\n"
+	     ."  stats: print statistics\n"
+	     ."  help:  print this message and exit\n"
+	     ."\n"
+	     ."options:\n"
+	     ."  -q, --quiet        quiet mode\n"
+	     ."  -v                 verbose, add more for more verbosity\n"
+	     ."      --verbose      set verbosity to n\n"
+	     ."  -s, --mail-self    mail also to oneself\n"
+	     ."  -n, --nomail-self  no mail to oneself\n"
+	     ."  -h, --help         print this message and exit\n"
+	     ."\n"
+	     ."$me version $version\n";
+}
+
+#
+# Parse command line
+#
+
+{
+	my $v;
+	my $m;
+	Getopt::Long::Configure("gnu_getopt");			# set standard gnu options
+	Getopt::Long::GetOptions (
+		'verbose=i'	=> \$v,				# verbose <value>
+		'v+'		=> \$v,				# incremental
+		'quiet|q'	=> sub { $v = 0 },		# quiet
+		'mail-self!'	=> \$m,				# mail-self negatable
+		's'		=> \$m,				# short
+		'n'		=> sub { $m = 0 },		# short no
+		'help|h'	=> sub { $ARGV[0] = 'help' },	# help
+	) or $ARGV[0] = 'help';
+	$debug = $v		if defined $v;			# set debug
+	$debug = ($debug < 0) ? 0 :				# min 0
+		 ($debug > 9) ? 9 :				# max 9
+		  $debug;
+	$mail_self = $m ? "yes" : "no" if defined $m;		# set mail_self
+
+	$_ = $ARGV[0] || 'help';				# get command
+	my %commands = (					# command references
+		'parse'	=> \&parse,
+		'mail'	=> \&mail,
+		'fix'	=> \&fix,
+		'clean'	=> \&clean,
+		'stats'	=> \&stats,
+		'help'	=> \&print_help,
+		 );
+
+	if (defined $commands{$_}) {
+		&{$commands{$_}};				# execute known command
+	} else {
+		print "Unknown command `$_'\n";			# unknown command
+		print_help;
+	}
+}

Reply to: