Package: dh-make-perl Version: 0.92 Severity: normal Tags: patch The Respository URL in d/upstream/metadata should use https and not git but dh-make-perl does not identify this issue. The attached patch identifies this and fixes it for github (I am unsure if the fix can be generalized for any host but I guess it is possible for a host to support git:// and not http://). It also automatically fill a missing Repository-Browse for github.
-- System Information: Debian Release: 9.0 APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 4.8.0-2-amd64 (SMP w/32 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages dh-make-perl depends on: ii debhelper 10.2.3 ii dpkg-dev 1.18.18 ii fakeroot 1.21-3 ii libapt-pkg-perl 0.1.30 ii libarray-unique-perl 0.08-2 ii libclass-accessor-perl 0.34-1 ii libconfig-ini-perl 1:0.025-1 ii libdebian-source-perl 0.92 ii libdpkg-perl 1.18.18 ii libemail-address-perl 1.908-1 ii libemail-date-format-perl 1.005-1 ii libfile-which-perl 1.21-1 ii liblist-moreutils-perl 0.416-1+b1 ii libmodule-depends-perl 0.16-3 ii libparse-debianchangelog-perl 1.2.0-12 ii libsoftware-license-perl 0.103012-1 ii libtie-ixhash-perl 1.23-2 ii libwww-mechanize-perl 1.83-1 ii libwww-perl 6.15-1 ii libyaml-libyaml-perl 0.63-2 ii libyaml-perl 1.21-1 ii make 4.1-9 ii perl 5.24.1~rc4-1 ii perl-modules-5.22 [libcpan-meta-perl] 5.22.2-1 ii perl-modules-5.24 [libcpan-meta-perl] 5.24.1~rc4-1 Versions of packages dh-make-perl recommends: ii apt 1.4~beta3 ii apt-file 3.1.3 ii git 1:2.11.0-2 ii libdpkg-parse-perl 0.03-1 ii libmodule-build-perl 0.422000-1 ii pristine-tar 1.37 dh-make-perl suggests no packages. -- no debconf information
From 8627d079c027584d2edb3ee2e0293d4b412fa697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carn=C3=AB=20Draug?= <carandraug+...@gmail.com> Date: Fri, 27 Jan 2017 19:46:25 +0000 Subject: [PATCH] Fix github Repository* on d/upstream/metadata (git://, and no Browser) * DhMakePerl::Command::Packaging (create_upstream_metadata): automatically fix Repository with git protocol and missing Repository-Browse when host is github. --- debian/changelog | 6 +++++- lib/DhMakePerl/Command/Packaging.pm | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index f74f951..3233a5b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ dh-make-perl (0.94) UNRELEASED; urgency=medium - * <dummy entry to bump version> + [ Carnë Draug ] + * DhMakePerl::Command::Packaging (create_upstream_metadata): + automatically fix Repository with git protocol and missing + Repository-Browse when host is github. Done to support further + logic on automatic fixes. -- gregor herrmann <gre...@debian.org> Thu, 26 Jan 2017 20:29:31 +0100 diff --git a/lib/DhMakePerl/Command/Packaging.pm b/lib/DhMakePerl/Command/Packaging.pm index 690740a..69b19db 100644 --- a/lib/DhMakePerl/Command/Packaging.pm +++ b/lib/DhMakePerl/Command/Packaging.pm @@ -1641,6 +1641,34 @@ sub create_upstream_metadata { $upstream{"Repository"} = $meta->{resources}->{repository}->{url}; $upstream{"Repository-Browse"} = $meta->{resources}->{repository}->{web}; + if (defined $upstream{"Repository"}) { + my $fix_browse = ! defined $upstream{"Repository-Browse"}; + + my $url_parser = qr|(?:([^:/?\#]+):)? # protocol + (?://([^/?\#]*))? # domain name + ([^?\#]*) # path + (?:\?([^\#]*))? # query + (?:\#(.*))? # fragment + |x; + + my ($protocol, $domain, $path, $query, $fragment) + = $upstream{"Repository"} =~ $url_parser; + + my $host = { + 'github.com' => 'github', + }->{$domain}; + + if ($host eq "github") { + if ($protocol eq "git") { + $upstream{"Repository"} = "https://$domain$path"; + } + if ($fix_browse) { + $path =~ s/\.git$//; + $upstream{"Repository-Browse"} = "https://$domain$path"; + } + } + } + foreach ( keys %upstream ) { delete $upstream{$_} unless defined $upstream{$_}; } -- 2.11.0