r76465 - in /trunk/dh-make-perl: debian/changelog debian/control dh-make-perl lib/DhMakePerl/Command/make.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Fri Jun 24 12:49:56 UTC 2011


Author: dmn
Date: Fri Jun 24 12:49:54 2011
New Revision: 76465

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=76465
Log:
--vcs git now sets up the initial repository

Modified:
    trunk/dh-make-perl/debian/changelog
    trunk/dh-make-perl/debian/control
    trunk/dh-make-perl/dh-make-perl
    trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm

Modified: trunk/dh-make-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/changelog?rev=76465&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Fri Jun 24 12:49:54 2011
@@ -18,7 +18,8 @@
   * Updated authorship notice
 
   [ Damyan Ivanov ]
-  * Add --vcs option, guiding VCS-* headers' creation in --pkg-perl mode
+  * Add --vcs option, guiding VCS-* headers' creation in --pkg-perl mode. It
+    also helps with the initial repository creation for Git
 
  -- Salvatore Bonaccorso <carnil at debian.org>  Wed, 25 May 2011 16:04:40 +0200
 

Modified: trunk/dh-make-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/control?rev=76465&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/control (original)
+++ trunk/dh-make-perl/debian/control Fri Jun 24 12:49:54 2011
@@ -3,6 +3,7 @@
 Priority: optional
 Build-Depends: debhelper (>= 8), perl
 Build-Depends-Indep: 
+ git,
  libapt-pkg-perl,
  libarray-unique-perl,
  libclass-accessor-perl,
@@ -62,7 +63,8 @@
  libwww-mechanize-perl,
  libyaml-perl,
  perl (>= 5.10.1) | libmodule-corelist-perl (>= 2.14)
-Recommends: apt-file
+Recommends: apt-file,
+ git
 Description: helper for creating Debian packages from perl modules
  dh-make-perl will create the files required to build a Debian source
  package out of a perl package.  This works for most simple packages

Modified: trunk/dh-make-perl/dh-make-perl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/dh-make-perl?rev=76465&op=diff
==============================================================================
--- trunk/dh-make-perl/dh-make-perl (original)
+++ trunk/dh-make-perl/dh-make-perl Fri Jun 24 12:49:54 2011
@@ -356,6 +356,28 @@
 In B<--pkg-perl> mode, use the specified version control system in the
 generated I<Vcs-*> fields. The default is C<svn> (still).
 
+If I<VCS> is C<git>, C<dh-make-perl> will setup a Git repository with three
+branches:
+
+=over
+
+=item upstream
+
+The initial branch containing upstream sources
+
+=item master
+
+The branch where packaging is done, forked off C<upstream> and with the
+contents of the C<debian/> directory added.
+
+=item pristine-tar
+
+A pranch to keep L<pristine-tar(1)> data.
+
+=back
+
+Also, an C<origin> remote is added pointing to the repository on I<git.debian.org>.
+
 =item B<--verbose> | B<--no-verbose>
 
 Print additional information while processing.

Modified: trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm?rev=76465&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm Fri Jun 24 12:49:54 2011
@@ -197,6 +197,10 @@
         if $self->cfg->build or $self->cfg->install;
     $self->install_package if $self->cfg->install;
     print "--- Done\n" if $self->cfg->verbose;
+
+    $self->setup_git_repository()
+        if $self->cfg->{pkg_perl}
+            and $self->cfg->{vcs} eq 'git';
 
     $self->package_already_exists($apt_contents) 
         or $self->modules_already_packaged($apt_contents);
@@ -580,6 +584,35 @@
     return $found ? 1 : 0;
 }
 
+sub setup_git_repository {
+    my $self = shift;
+
+    use Git;
+    use IO::Dir;
+
+    Git::command( 'init', $self->main_dir );
+
+    my $git = Git->repository( $self->main_dir );
+    $git->command( qw(symbolic-ref HEAD refs/heads/upstream) );
+    my @upstream_files;
+    my $dh = IO::Dir->new( $self->main_dir );
+    while ( defined( my $f = $dh->read ) ) {
+        next if $f eq '.' or $f eq '..';
+        next if $f eq 'debian';
+        push @upstream_files, $f;
+    }
+    $git->command( 'add', @upstream_files );
+    $git->command( 'commit', '-m', "Import original source of ".$self->perlname.' '.$self->version );
+    $git->command( qw( checkout -b master upstream ) );
+    $git->command( 'add', 'debian' );
+    $git->command( 'commit', '-m', 'Initial packaging by dh-make-perl' );
+    $git->command(
+        qw( remote add origin ),
+        sprintf( "ssh://git.debian.org/git/pkg-perl/packages/%s.git",
+            $self->pkgname ),
+    );
+}
+
 =item warning I<string> ...
 
 In verbose mode, prints supplied arguments on STDERR, prepended with C<W: > and




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