summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-04-04 00:12:14 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-04-04 00:12:14 -0700
commit10cd801bfaad93ab8563baa0b61aab616e17e030 (patch)
tree063d6c435d463c9b800728ba8390ad5b9bc72eda
parentd085593e933c4b0792e7545ed891f7ce1cfcb781 (diff)
downloaddotfiles-10cd801bfaad93ab8563baa0b61aab616e17e030.tar.gz
look for a git.sr.ht remote
-rwxr-xr-xbin/buildssrht-preupload23
1 files changed, 16 insertions, 7 deletions
diff --git a/bin/buildssrht-preupload b/bin/buildssrht-preupload
index 9d81e592..075af545 100755
--- a/bin/buildssrht-preupload
+++ b/bin/buildssrht-preupload
@@ -28,17 +28,26 @@ use Getopt::Long;
use Git::Wrapper;
use Cwd;
-my $user = "~spwhitton"; # TODO could fetch from API
-my $dist = "unstable";
-my $remote = "origin";
-my $quilt = "auto";
+my $git = Git::Wrapper->new(getcwd);
+
+my $user = "~spwhitton"; # TODO could fetch from API
+my $dist = "unstable";
+my ($remote, $clone_uri);
+my $quilt = "auto";
GetOptions
"distribution|d=s" => \$dist,
"remote=s" => \$remote,
"quilt=s" => \$quilt;
-
-my $git = Git::Wrapper->new(getcwd);
-my ($clone_uri) = $git->remote("get-url", $remote);
+unless ($remote) {
+ # see if there is a git.sr.ht remote; use that if possible as
+ # clone to builds.sr.ht will be faster
+ foreach my $r ($git->remote) {
+ my ($u) = $git->remote("get-url", $r);
+ $u =~ /git\.sr\.ht/ and $remote = $r, $clone_uri = $u;
+ }
+}
+$remote ||= "origin";
+$clone_uri or ($clone_uri) = $git->remote("get-url", $remote);
chomp(my $source = `dpkg-parsechangelog -SSource`);
chomp(my $version = `dpkg-parsechangelog -SVersion`);