diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-04-04 00:12:14 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-04-04 00:12:14 -0700 |
commit | 10cd801bfaad93ab8563baa0b61aab616e17e030 (patch) | |
tree | 063d6c435d463c9b800728ba8390ad5b9bc72eda | |
parent | d085593e933c4b0792e7545ed891f7ce1cfcb781 (diff) | |
download | dotfiles-10cd801bfaad93ab8563baa0b61aab616e17e030.tar.gz |
look for a git.sr.ht remote
-rwxr-xr-x | bin/buildssrht-preupload | 23 |
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`); |