X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=dgit;h=2c4d1bb8bbaabee2aa89740624cc8435f90b890d;hb=3f93d55e1ee34f82f041fd9ebe5c30f2bf5f086e;hp=edc3c2276294c9e86b36a50c11924dcc840aff6e;hpb=6a783c6b80a9cdd5d744e12637afcd5f10a987ba;p=dgit.git diff --git a/dgit b/dgit index edc3c227..2c4d1bb8 100755 --- a/dgit +++ b/dgit @@ -39,6 +39,8 @@ our $aliothpath = '/git/dgit-repos'; our $alioth_git = "git+ssh://$aliothname/$aliothpath"; our $alioth_sshtestbodge = [$aliothname,$aliothpath]; +our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)"); + our (@git) = qw(git); our (@dget) = qw(dget); our (@dput) = qw(dput); @@ -177,7 +179,7 @@ sub get_archive_dsc () { $dsc->parse($dscfh, 'dsc') or die "parsing of $dscurl failed\n"; print DEBUG Dumper($dsc); my $fmt = $dsc->{Format}; - die "unsupported format $fmt, sorry\n" unless $fmt eq '1.0'; + die "unsupported format $fmt, sorry\n" unless $format_ok{$fmt}; } sub check_for_git () { @@ -233,7 +235,7 @@ sub dsc_files () { sub is_orig_file ($) { local ($_) = @_; - m/\.orig\.tar\.\w+$/; + m/\.orig(?:-\w+)?\.tar\.\w+$/; } sub generate_commit_from_dsc () { @@ -370,7 +372,8 @@ sub fetch_from_archive () { } } -sub clone () { +sub clone ($) { + my ($dstdir) = @_; die "dry run makes no sense with clone" if $dryrun; get_archive_dsc(); $dsc_hash = $dsc->{$ourdscfield}; @@ -381,7 +384,6 @@ sub clone () { } else { print "last upload to archive has NO git hash\n"; } - my $dstdir = "$package"; my $branch = uploadbranch(); if (check_for_git()) { print "cloning existing git history\n"; @@ -480,14 +482,20 @@ sub dopush () { } sub cmd_clone { + my $dstdir; if (@ARGV==1) { ($package) = @ARGV; - } elsif (@ARGV==2) { + } elsif (@ARGV==2 && $ARGV[1] =~ m#^\w#) { ($package,$suite) = @ARGV; + } elsif (@ARGV==2 && $ARGV[1] =~ m#^[./]#) { + ($package,$dstdir) = @ARGV; + } elsif (@ARGV==3) { + ($package,$suite,$dstdir) = @ARGV; } else { die; } - clone(); + $dstdir ||= "$package"; + clone($dstdir); } sub branchsuite () {