This is an automated email from the git hooks/post-receive script. intrigeri pushed a commit to branch master in repository libparse-debianchangelog-perl.
commit b116495aa822838c5d650d9e7cc5cd5421d75611 Author: Frank Lichtenheld <fr...@lichtenheld.de> Date: Mon Apr 4 17:30:20 2011 +0200 common_licenses: Update FSF licenses handling Account for new releases ((L)GPL v3) and additions to common licenses (GFDL). --- Changes | 4 +++- lib/Parse/DebianChangelog/ChangesFilters.pm | 20 ++++++++++++++------ t/Parse-DebianChangelog-ChangesFilters.t | 28 ++++++++++++++++++++-------- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/Changes b/Changes index 18f88d6..44db029 100644 --- a/Changes +++ b/Changes @@ -1,8 +1,10 @@ Parse-DebianChangelog (1.2.0) unstable; urgency=low - * ChangelogFilters: + * ChangesFilters: - Fix conversion of <http://something/> (Closes: #603341) - Allow to omit # before closed bug numbers (Closes: 446798 ;) + - Update gnu.org URLs and add more FSF licenses to account for + license releases and additions to common-licenses. -- Frank Lichtenheld <fr...@lichtenheld.de> Mon, 04 Apr 2011 16:43:54 +0200 diff --git a/lib/Parse/DebianChangelog/ChangesFilters.pm b/lib/Parse/DebianChangelog/ChangesFilters.pm index 17aa995..e31a76a 100644 --- a/lib/Parse/DebianChangelog/ChangesFilters.pm +++ b/lib/Parse/DebianChangelog/ChangesFilters.pm @@ -129,15 +129,23 @@ sub pseudo_markup { return $text; } +my $fsf_lics = 'http://www.gnu.org/licenses'; +my $fsf_old_lics = $fsf_lics."/old-licenses"; sub common_licenses { my ($text, $cgi) = @_; - $text=~ s|/usr/share/common-licenses/GPL(?:-2)? - |$cgi->a({ -href=>"http://www.gnu.org/copyleft/gpl.html" }, $&) - |xego; - $text=~ s|/usr/share/common-licenses/LGPL(?:-2(?:\.1)?)? - |$cgi->a({ -href=>"http://www.gnu.org/copyleft/lgpl.html" }, $&) - |xego; + $text=~ s;(/usr/share/common-licenses/GPL(?:-([1-3]))?) + ;($2 && $2 < 3) ? $cgi->a({ -href=>"$fsf_old_lics/gpl-$2.0.html" }, $1) + : $cgi->a({ -href=>"$fsf_lics/gpl.html" }, $1) + ;xego; + $text=~ s;(/usr/share/common-licenses/LGPL(?:-(2\.[01]|3))?) + ;($2 && $2 < 3) ? $cgi->a({ -href=>"$fsf_old_lics/lgpl-$2.html" }, $1) + : $cgi->a({ -href=>"$fsf_lics/lgpl.html" }, $1) + ;xego; + $text=~ s;(/usr/share/common-licenses/GFDL(?:-1\.([1-3]))?) + ;($2 && $2 < 3) ? $cgi->a({ -href=>"$fsf_old_lics/fdl-1.$2.html" }, $1) + : $cgi->a({ -href=>"$fsf_lics/fdl.html" }, $1) + ;xego; $text=~ s|/usr/share/common-licenses/Artistic |$cgi->a({ -href=>"http://www.opensource.org/licenses/artistic-license.php" }, $&) |xego; diff --git a/t/Parse-DebianChangelog-ChangesFilters.t b/t/Parse-DebianChangelog-ChangesFilters.t index 3b8a0c3..6484557 100644 --- a/t/Parse-DebianChangelog-ChangesFilters.t +++ b/t/Parse-DebianChangelog-ChangesFilters.t @@ -9,7 +9,7 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 10 + 8; BEGIN { use_ok('Parse::DebianChangelog::ChangesFilters', ':all' ); }; @@ -74,12 +74,24 @@ is( $text, 'This is a test for <em>emphasised texts -- and</em> <em>more</em>, we can also make this <strong>really really strong</strong>, <strong>really</strong>', 'pseudo_markup' ); -$text = common_licenses( 'And a quick test for /usr/share/common-licenses/GPL-2 license textes', - $cgi ); - -is( $text, - 'And a quick test for <a href="http://www.gnu.org/copyleft/gpl.html">/usr/share/common-licenses/GPL-2</a> license textes', - $cgi ); +my %lics = qw( + /usr/share/common-licenses/GPL http://www.gnu.org/licenses/gpl.html + /usr/share/common-licenses/GPL-3 http://www.gnu.org/licenses/gpl.html + /usr/share/common-licenses/GPL-2 http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + /usr/share/common-licenses/LGPL http://www.gnu.org/licenses/lgpl.html + /usr/share/common-licenses/LGPL-2.1 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + /usr/share/common-licenses/GFDL http://www.gnu.org/licenses/fdl.html + /usr/share/common-licenses/GFDL-1.3 http://www.gnu.org/licenses/fdl.html + /usr/share/common-licenses/GFDL-1.2 http://www.gnu.org/licenses/old-licenses/fdl-1.2.html +); + +while( my ($path, $url) = each %lics){ + $text = common_licenses( "And a quick test for $path license texts.", + $cgi ); + is( $text, + qq|And a quick test for <a href="$url">$path</a> license texts.|, + $path ); +} my $complete_text = <<'EOT'; hällö & tschüß <tt id="a">:)</tt> @@ -101,7 +113,7 @@ Frank Lichtenheld <<a href="http://qa.debian.org/developer.php?login=djpig@de This (Closes: <a class="buglink" href="http://bugs.debian.org/123456">#123456</a>, <a class="buglink" href="http://bugs.debian.org/4321">Bug#4321</a>, <a class="buglink" href="http://bugs.debian.org/222">#222</a>) (hopefully, maybe closes #72345, too) SECURITY FIXES (<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-9999">CAN-2005-9999</a>, <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-9999">CVE-2004-9999</a>): This is a test for <em>emphasised texts -- and</em> <em>more</em>, we can also make this <strong>really really strong</strong>, <strong>really</strong> -And a quick test for <a href="http://www.gnu.org/copyleft/gpl.html">/usr/share/common-licenses/GPL-2</a> license textes +And a quick test for <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">/usr/share/common-licenses/GPL-2</a> license textes EOR ; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libparse-debianchangelog-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits