Author: adam-guest
Date: 2008-03-24 01:13:42 +0000 (Mon, 24 Mar 2008)
New Revision: 1190

Modified:
   trunk/scripts/debcheckout.pl
   trunk/scripts/debdiff.pl
Log:
Allow -f to guess a gitweb URL based on the git URL if a browse URL isn't 
available (either because the package doesn't ship it, or a URL was passed on 
the command line)

Modified: trunk/scripts/debcheckout.pl
===================================================================
--- trunk/scripts/debcheckout.pl        2008-03-24 00:15:37 UTC (rev 1189)
+++ trunk/scripts/debcheckout.pl        2008-03-24 01:13:42 UTC (rev 1190)
@@ -429,6 +429,14 @@
         }
       }
       case "git" {
+       # If there isn't a browse URL (either because the package
+       # doesn't ship one, or because we were called with a URL,
+       # try a common pattern for gitweb
+       if (!$browse_url) {
+           if ($repo_url =~ m%^\w+://([^/]+)/(?:git/)?(.*)$%) {
+               $browse_url = "http://$1/?p=$2";;
+           }
+       }
         if (have_lwp and $browse_url =~ /^http/) {
           $escaped_file =~ s|/|%2F|g;
 

Modified: trunk/scripts/debdiff.pl
===================================================================
--- trunk/scripts/debdiff.pl    2008-03-24 00:15:37 UTC (rev 1189)
+++ trunk/scripts/debdiff.pl    2008-03-24 01:13:42 UTC (rev 1190)
@@ -19,6 +19,7 @@
 use Cwd;
 use File::Basename;
 use File::Temp qw/ tempdir /;
+use File::Copy qw/ move /;
 
 # Predeclare functions
 sub process_debc($$);
@@ -466,10 +467,14 @@
            opendir DIR,${"dir$i"}.'/'.${"sdir$i"};
            while ($_ = readdir(DIR)) {
                    if ($_ =~ /tar.gz$/) {
-                       system qq(cd ${"dir$i"}/${"sdir$i"} && tar zxf $_ 
>/dev/null); 
+                       my $filename = $_;
+                       $filename =~ s%(.*)\.tar\.gz%$1%;
+                       system qq(cd ${"dir$i"}/${"sdir$i"} && tar zxf $_ 
>/dev/null && mv $filename =unpacked-tar-gz=); 
                    }
                    if ($_ =~ /tar.bz$/ || $_ =~ /tar.bz2$/) {
-                       system qq(cd ${"dir$i"}/${"sdir$i"} && tar jxf $_ 
>/dev/null);
+                       my $filename = $_;
+                       $filename =~ s%(.*)\.tar\.bz2?%$1%;
+                       system qq(cd ${"dir$i"}/${"sdir$i"} && tar jxf $_ 
>/dev/null && mv $filename =unpacked-tar-bz=);
                    }
            }
            closedir(DIR);
@@ -826,7 +831,7 @@
     no strict 'refs';
 
     for my $i (1,2) {
-       ${"dir$i"}=tempdir( CLEANUP => 1 );
+       ${"dir$i"}=tempdir( CLEANUP => 0 );
        fatal "Couldn't create temp directory"
            if not defined ${"dir$i"};
     }



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to