chiark / gitweb /
automatic agpl compliance: abstract away shell scripts rather than whole code for...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 23 Feb 2013 20:07:09 +0000 (20:07 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 23 Feb 2013 20:07:09 +0000 (20:07 +0000)
cgi-auth-flexible.pm

index 5292075..987170e 100644 (file)
@@ -253,8 +253,7 @@ sub srcdump_process_item ($$$$$$) {
            }
 #print STDERR "VCS $item $upwards $try GO\n";
            $try =~ m/\w+/ or die;
-           return $v->_ch(('srcdump_byvcs_'.lc $&),
-                          $dumpdir, $upwards, $outfn);
+           return $v->_ch('srcdump_byvcs', $dumpdir, $upwards, $outfn, lc $&);
        }
        $upwards =~ s#/*[^/]+$##;
     }
@@ -278,14 +277,11 @@ sub srcdump_novcs ($$$$$) {
     }
 }
 
-sub srcdump_byvcs_git ($$$$$) {
-    my ($c, $v, $dumpdir, $dir, $outfn) = @_;
+sub srcdump_byvcs ($$$$$$) {
+    my ($c, $v, $dumpdir, $dir, $outfn, $vcs) = @_;
 #print STDERR "BYVCS GIT $dir\n";
-    return srcdump_dir_cpio($c,$v,$dumpdir,$dir,$outfn,'git',"
-                 git ls-files -z
-                 git ls-files -z --others --exclude-from=.gitignore
-                 find .git -print0
-                            ");
+    return srcdump_dir_cpio($c,$v,$dumpdir,$dir,$outfn,$vcs,
+                           $v->{S}{"srcdump_vcsscript_$vcs"});
 }
 
 sub srcdump_file ($$$$) {
@@ -319,7 +315,7 @@ sub srcdump_dir_cpio ($$$$$$$) {
        die $!;
     }
     $!=0; (waitpid $pid, 0) == $pid or die "$!";
-    die "$dir ($script) $outfile $?" if $?;
+    die "$dir ($how $script) $outfile $?" if $?;
 }
 
 sub srcdump_dirscan_prepare ($$) {
@@ -480,11 +476,17 @@ sub new_verifier {
                $_[2] =~ m#^/etc/|^/usr/(?!local/)(?!lib/cgi)#;
            },
            srcdump_process_item => \&srcdump_process_item,
-           srcdump_vcs_dirs => [qw(.git .hg .svn CVS)],
-           srcdump_byvcs_git => \&srcdump_byvcs_git,
-           srcdump_byvcs_hg => \&srcdump_byvcs_hg,
-           srcdump_byvcs_svn => \&srcdump_byvcs_svn,
-           srcdump_byvcs_cvs => \&srcdump_byvcs_cvs,
+           srcdump_vcs_dirs => [qw(.git .hg .bzr .svn CVS)],
+           srcdump_vcsscript_git => "
+                 git ls-files -z
+                 git ls-files -z --others --exclude-from=.gitignore
+                 find .git -print0
+                            ",
+           srcdump_vcsscript_hg => "false hg",
+           srcdump_vcsscript_bzr => "false bzr",
+           srcdump_vcsscript_svn => "false svn",
+           srcdump_vcsscript_cvs => "false cvs",
+           srcdump_byvcs => \&srcdump_byvcs,
            srcdump_novcs => \&srcdump_novcs,
            srcdump_excludes => [qw(*~ *.bak *.tmp), '#*#'],
            dump => \&dump_plain,