r53436 - in /trunk/dh-make-perl: dh-make-perl lib/DhMakePerl/Config.pm t/dists.t

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Sun Feb 28 22:13:37 UTC 2010


Author: dmn
Date: Sun Feb 28 22:13:07 2010
New Revision: 53436

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53436
Log:
deprecate '--command' in favour of 'command'

--command is still supported, but not documented, and
a warning is issued when --command is used

Modified:
    trunk/dh-make-perl/dh-make-perl
    trunk/dh-make-perl/lib/DhMakePerl/Config.pm
    trunk/dh-make-perl/t/dists.t

Modified: trunk/dh-make-perl/dh-make-perl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/dh-make-perl?rev=53436&op=diff
==============================================================================
--- trunk/dh-make-perl/dh-make-perl (original)
+++ trunk/dh-make-perl/dh-make-perl Sun Feb 28 22:13:07 2010
@@ -18,15 +18,15 @@
 
 =over
 
-=item dh-make-perl [--make] {I<SOURCE_DIR> | --cpan I<MODULE>} I<options...>
-
-=item dh-make-perl --refresh {I<--only ...>} [directory]
-
-=item dh-make-perl --locate Foo::Bar
-
-=item dh-make-perl --refresh-cache
-
-=item dh-make-perl --dump-config
+=item dh-make-perl [make] {I<SOURCE_DIR> | --cpan I<MODULE>} I<options...>
+
+=item dh-make-perl refresh {I<--only ...>} [directory]
+
+=item dh-make-perl locate Foo::Bar
+
+=item dh-make-perl refresh-cache
+
+=item dh-make-perl dump-config
 
 =item cpan2deb I<DIST> I<options...>
 
@@ -70,12 +70,12 @@
 
 =over
 
-=item --make
+=item make
 
 Default command if no command is given. Creates debianisation from scratch.
 Fails with an error if F<debian/> directory already exists.
 
-=item --refresh [directory]
+=item refresh [directory]
 
 For refreshing a package. C<directory> defaults to the current working
 directory. Rebuilds F<debian/copyright>, F<debian/rules>, F<debian/compat>
@@ -99,7 +99,7 @@
 separated by a comma. The option can be given multiple times, accumulating
 arguments.
 
-=item --locate I<MODULE>
+=item locate I<MODULE>
 
 Tries to locate the package that conains the given Perl I<MODULE>.
 
@@ -107,7 +107,7 @@
 
     dh-make-perl --locate IPC::Run3
 
-=item --refresh-cache
+=item refresh-cache
 
 B<dh-make-perl> parses the Contents files, fetched by L<apt-file(1)> and stores
 the result in a cache. The cache is refreshed automatically if it is older than
@@ -118,7 +118,7 @@
 
 Does nothing if the cache is newer that the Contents files.
 
-=item --dump-config
+=item dump-config
 
 Causes the current config, including any default settings to be printed to the
 standard output.

Modified: trunk/dh-make-perl/lib/DhMakePerl/Config.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Config.pm?rev=53436&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Config.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Config.pm Sun Feb 28 22:13:07 2010
@@ -150,12 +150,32 @@
     GetOptions( \%opts, $self->commands )
         or die "Error parsing command-line options\n";
 
-    # by default, create source package
-    %opts = ( make => 1 ) unless %opts;
+    if (%opts) {
+        my $cmd = ( keys %opts )[0];
+        warn "WARNING: double dashes in front of sub-commands are deprecated\n";
+        warn "WARNING: for instance, use '$cmd' instead of '--$cmd'\n";
+    }
+    else {
+        my %cmds;
+        for( $self->commands ) {
+            my $c = $_;
+            $c =~ s/\|.+//;     # strip short alternatives
+            $cmds{$c} = 1;
+        }
+
+        # treat the first non-option as command
+        # if it looks like one
+        $opts{ shift(@ARGV) } = 1
+            if $ARGV[0]
+                and $cmds{ $ARGV[0] };
+
+        # by default, create source package
+        $opts{make} = 1 unless %opts;
+    }
 
     if ( scalar( keys %opts ) > 1 ) {
         die "Only one of " .
-            map( "--$_", $self->commands ) . " can be specified\n";
+            map( $_, $self->commands ) . " can be specified\n";
     }
 
     $self->command( ( keys %opts )[0] );

Modified: trunk/dh-make-perl/t/dists.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/dists.t?rev=53436&op=diff
==============================================================================
--- trunk/dh-make-perl/t/dists.t (original)
+++ trunk/dh-make-perl/t/dists.t Sun Feb 28 22:13:07 2010
@@ -94,12 +94,12 @@
             $ENV{NO_NETWORK} ? '--no-network' : (),
             "--sources-list",
             "$Bin/contents/sources.list", "--email", "joemaint\@test.local",
-            "--refresh",
+            "refresh",
             $dist );
 
-    is( $?, 0, "$dist_dir --refresh: system returned 0" );
+    is( $?, 0, "$dist_dir refresh: system returned 0" );
 
-    compare_tree( "$dist/debian", "$dist/wanted-debian--refresh", '--refresh' );
+    compare_tree( "$dist/debian", "$dist/wanted-debian--refresh", 'refresh' );
 
     unlink File::Find::Rule->file->name('*.bak')->in("$dist/debian");
 
@@ -110,17 +110,17 @@
             $ENV{NO_NETWORK} ? '--no-network' : (),
             "--sources-list",
             "$Bin/contents/sources.list", "--email", "joemaint\@test.local",
-            "--refresh", '--source-format', '3.0 (quilt)',
+            "refresh", '--source-format', '3.0 (quilt)',
             $dist );
 
     is( $?, 0,
-        "$dist_dir --refresh --source-format '3.0 (quilt)': system returned 0"
+        "$dist_dir refresh --source-format '3.0 (quilt)': system returned 0"
     );
 
     compare_tree(
         "$dist/debian",
         "$dist/wanted-debian--refresh--source-format=3.0_quilt",
-        '--refresh --source-format 3.0 (quilt)'
+        'refresh --source-format 3.0 (quilt)'
     );
 
     # clean after the test




More information about the Pkg-perl-cvs-commits mailing list