[pkg-perl-tools] 02/02: dpt-salsa: mrconfig(): write to .mrconfig.packages

gregor herrmann gregoa at debian.org
Sat Feb 17 18:58:31 UTC 2018


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository pkg-perl-tools.

commit a4f66ed14dd4f81c70d2fe230635a1dd23948850
Author: gregor herrmann <gregoa at debian.org>
Date:   Sat Feb 17 19:56:09 2018 +0100

    dpt-salsa: mrconfig(): write to .mrconfig.packages
    
    which can then be included in .mrconfig
    (and should probably be run in pre_update)
    
    Gbp-Dch: ignore
---
 scripts/salsa | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/scripts/salsa b/scripts/salsa
index 0c9c1b5..953769f 100755
--- a/scripts/salsa
+++ b/scripts/salsa
@@ -343,11 +343,16 @@ sub changerepo {
 }
 
 ## mrconfig
-## XXX: TODO: this is a sketch
 sub mrconfig {
+    die 'DPT_PACKAGES not set.' unless $config{packages};
+    my $outdir = File::Spec->catdir( $config{packages}, '..' );
+    die "Can't find directory '$outdir'." unless -d $outdir;
 
-    # XXX outfh
-    # XXX read template/header for .mrconfig before dumping packages
+    my $mrconfig = File::Spec->catfile( $outdir, '.mrconfig' );
+    die "Can't find '.mrconfig' in '$outdir'" unless -f $mrconfig;
+    my $outfile = File::Spec->catfile( $outdir, '.mrconfig.packages' );
+    open( my $fh, '>', "$outfile.new" )
+        or die "Can't open '$outfile.new': $!";
 
     my $paginator = $api->paginator(
         'group_projects',
@@ -356,9 +361,12 @@ sub mrconfig {
     );
     while ( my $repo = $paginator->next() ) {
         my $reponame = $repo->{name};
-        say "[packages/$reponame]";
-        say "checkout = git_checkout $reponame\n";
+        say $fh "[packages/$reponame]";
+        say $fh "checkout = git_checkout $reponame\n";
     }
+    rename "$outfile.new", "$outfile"
+        or die "Can't rename '$outfile.new' to '$outfile': $!";
+    close $fh;
 }
 
 ## githashes
@@ -669,10 +677,9 @@ internal use.
 
 =head3 I<mrconfig>
 
-Helper for creating a F<.mrconfig> file for all active packages of the
-I<modules> subgroup of the I<perl-team> group.
-
-B<WARNING>: Currently just a stub.
+Helper for creating a F<.mrconfig.packages> file in the local clone of
+C<meta.git> for all active packages of the I<modules> subgroup of the
+I<perl-team> group which is then included from F<.mrconfig>.
 
 =head3 I<githashes>
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/pkg-perl-tools.git



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