Author: jamessan
Date: 2008-11-13 07:26:09 +0000 (Thu, 13 Nov 2008)
New Revision: 1724

Modified:
   trunk/debian/changelog
   trunk/scripts/debcheckout.pl
Log:
debcheckout:  Add support for working around repositories that don't follow 
standard behavior (like bzr.d.o not running a smart server).

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-11-11 19:18:01 UTC (rev 1723)
+++ trunk/debian/changelog      2008-11-13 07:26:09 UTC (rev 1724)
@@ -29,6 +29,10 @@
     package, suggest using "--force" in order to tag all the bugs as
     pending without attempting to query the BTS.
 
+  [ James Vega ]
+  * debcheckout:  Add support for working around repositories that don't
+    follow standard behavior (like bzr.d.o not running a smart server).
+
  -- Patrick Schoenfeld <[EMAIL PROTECTED]>  Thu, 06 Nov 2008 13:39:09 +0100
 
 devscripts (2.10.40) unstable; urgency=low

Modified: trunk/scripts/debcheckout.pl
===================================================================
--- trunk/scripts/debcheckout.pl        2008-11-11 19:18:01 UTC (rev 1723)
+++ trunk/scripts/debcheckout.pl        2008-11-13 07:26:09 UTC (rev 1724)
@@ -371,8 +371,8 @@
     return $url;
 }
 
-# Patch a given repository URL to ensure that the checkoud out repository can 
be
-# committed to. Only works for well known repositories (mainly Alioth's).
+# Patch a given repository URL to ensure that the checked out out repository
+# can be committed to. Only works for well known repositories (mainly 
Alioth's).
 sub set_auth($$$$) {
     my ($repo_type, $url, $user, $dont_act) = @_;
 
@@ -385,7 +385,7 @@
 
     switch ($repo_type) {
        case "bzr" {
-           $url =~ s|^\w+://(bzr\.debian\.org)/(.*)|sftp://$user$1/bzr/$2|;
+           $url =~ s|^[\w+]+://(bzr\.debian\.org)/(.*)|sftp://$user$1/bzr/$2|;
            $url =~ 
s[^\w+://(?:(bazaar|code)\.)?(launchpad\.net/.*)][bzr+ssh://${user}bazaar.$2];
        }
        case "darcs"  {
@@ -425,6 +425,21 @@
     return $url;
 }
 
+# Hack around specific, known deficiencies in repositories that don't follow
+# standard behavior.
+sub munge_url($$)
+{
+    my ($repo_type, $repo_url) = @_;
+
+    switch ($repo_type) {
+       case 'bzr' {
+           # bzr.d.o explicitly doesn't run a smart server.  Need to use 
nosmart
+           $repo_url =~ 
s|^http://(bzr\.debian\.org)/(.*)|nosmart+http://$1/$2|;
+       }
+    }
+    return $repo_url;
+}
+
 # Checkout a given repository in a given destination directory.
 sub checkout_repo($$$) {
     my ($repo_type, $repo_url, $destdir) = @_;
@@ -859,6 +874,7 @@
        $browse_url = find_browse($pkg, $version) if @files;
     }
 
+    $repo_url = munge_url($repo_type, $repo_url);
     $repo_url = set_auth($repo_type, $repo_url, $user, $dont_act)
        if $auth and not @files;
     print_repo($repo_type, $repo_url) if $print_mode;          # ... then quit
@@ -870,9 +886,9 @@
     my $rc;
     if (@files) {
        $rc = checkout_files($repo_type, $repo_url, $destdir, $browse_url);
-    } else {    
+    } else {
        $rc = checkout_repo($repo_type, $repo_url, $destdir);
-    }  # XXX: there is no way to know for sure what is the destdir :-(
+    }   # XXX: there is no way to know for sure what is the destdir :-(
     die "checkout failed (the command above returned a non-zero exit code)\n"
        if $rc != 0;
 



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

Reply via email to