[pkg-perl-tools] 01/02: Switch links to https in scripts/debian-upstream
Alex Muntada
alexm-guest at moszumanska.debian.org
Sun May 22 14:17:27 UTC 2016
This is an automated email from the git hooks/post-receive script.
alexm-guest pushed a commit to branch master
in repository pkg-perl-tools.
commit beff0e01a720d1cdc55032f2876ed9e325241858
Author: Alex Muntada <alexm at alexm.org>
Date: Sun May 22 00:09:45 2016 +0200
Switch links to https in scripts/debian-upstream
---
TODO | 2 --
debian/copyright | 1 +
scripts/debian-upstream | 39 ++++++++++++++++++++++++++++++++++++++-
3 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/TODO b/TODO
index 99809d6..c5914e1 100644
--- a/TODO
+++ b/TODO
@@ -19,8 +19,6 @@ TODOS:
than an issue with a link to the patch. maybe with the unused debian-perl
organisation on github.
- forward: set Forwarded (but not Bug) header when using --mailto
-- upstream-repo/debian-upstream: maybe s/http/https/ for github/cpan URLs
- on creation/updates ...
- push: push tags of native packages
- autopkgtest: smoke: the dummy package should "use strict;", otherwise:
# Failed test 'Test::Perl::Critic for "lib/Debian/pkgperl/Foobar.pm"'
diff --git a/debian/copyright b/debian/copyright
index fa71050..4ee36d2 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -160,6 +160,7 @@ License: Artistic or GPL-1+
Files: scripts/debian-upstream scripts/upstream-repo
Copyright: 2013-2014, gregor herrmann <gregoa at debian.org>
2014, David Bremner <bremner at debian.org>
+ 2016, Alex Muntada <alexm at alexm.org>
License: Artistic or GPL-1+
Files: scripts/import-orig
diff --git a/scripts/debian-upstream b/scripts/debian-upstream
index 21fd306..e051b51 100755
--- a/scripts/debian-upstream
+++ b/scripts/debian-upstream
@@ -17,6 +17,7 @@ if ( -r 'META.json' ) {
croak 'Neither META.json nor META.yml found.';
}
+# Read values from META
$upstream->{"Archive"} = 'CPAN';
$upstream->{"Name"} = $meta->{name};
$upstream->{"Contact"} = join( ', ', @{ $meta->{author} } );
@@ -26,6 +27,28 @@ $upstream->{"Bug-Submit"} = $meta->{resources}->{bugtracker}->{mailto};
$upstream->{"Repository"} = $meta->{resources}->{repository}->{url};
$upstream->{"Repository-Browse"} = $meta->{resources}->{repository}->{web};
+my %secure_URL = (
+ 'https://rt.cpan.org/' => [qw(
+ http://rt.cpan.org/
+ )],
+
+ 'https://github.com/' => [qw(
+ git://github.com/
+ ssh://git@github.com/
+ git at github.com:
+ )],
+);
+
+# Switch to secure URLs
+for my $replacement (keys %secure_URL) {
+ my $regex = build_regex(@{ $secure_URL{$replacement} });
+ $upstream->{$_} =~ s|$regex|$replacement| for (qw(
+ Bug-Database
+ Repository
+ Repository-Browse
+ ));
+}
+
foreach ( keys %{$upstream} ) {
delete $upstream->{$_} unless defined $upstream->{$_};
}
@@ -33,6 +56,12 @@ foreach ( keys %{$upstream} ) {
mkdir('debian/upstream');
DumpFile( 'debian/upstream/metadata', $upstream );
+sub build_regex {
+ my @prefixes = map quotemeta, @_;
+ my $regex = '(' . join('|', @prefixes) . ')';
+ return qr/$regex/;
+}
+
=pod
=head1 NAME
@@ -49,6 +78,8 @@ B<dpt debian-upstream> reads information from F<META.json> or F<META.yml> and
writes them to F<debian/upstream/metadata>, according to the UpstreamMetaData
specification.
+Please, note that upstream links will be switched to https URLs.
+
=head1 SEE ALSO
=over
@@ -65,7 +96,13 @@ L<UpstreamMetaData|https://wiki.debian.org/UpstreamMetadata>
=head1 COPYRIGHT AND LICENSE
-Copyright 2013-2014, gregor herrmann L<gregoa at debian.org>
+=over
+
+=item Copyright 2013-2014, gregor herrmann L<gregoa at debian.org>
+
+=item Copyright 2016, Alex Muntada L<alexm at alexm.org>
+
+=back
This program is free software and can be distributed under the same terms as
Perl.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/pkg-perl-tools.git
More information about the Pkg-perl-cvs-commits
mailing list