Skip to content

Commit

Permalink
URI::PackageURL 2.21
Browse files Browse the repository at this point in the history
  • Loading branch information
giterlizzi committed Jul 24, 2024
1 parent 1ab394b commit ca3b3d0
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 21 deletions.
7 changes: 7 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Change history for URI-PackageURL

2.21 2024-07-24
- Use RFC 2119 terms for CPAN purl type specification (sjn)
- Added "swid" purl type support
- Moved normalization and validation check in "URI::PackageURL::Util"
- Dropped support for "version_prefix" qualifier for "github", "gitlab" and
"bitbucket" PURL types in "purl_to_urls" util (pombredanne via giterlizzi/perl-URI-PackageURL#14)

2.20 2024-05-13
- Added support for the official "cpan" PURL type specification (giterlizzi/perl-URI-PackageURL#8)
- Added "Version Range" (vers) support (giterlizzi/perl-URI-PackageURL#12)
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ use URI::PackageURL;
# OO-interface

# Encode components in PackageURL string
$purl = URI::PackageURL->new(type => cpan, namespace => 'GDT', name => 'URI-PackageURL', version => '2.20');
$purl = URI::PackageURL->new(type => cpan, namespace => 'GDT', name => 'URI-PackageURL', version => '2.21');

say $purl; # pkg:cpan/GDT/URI-PackageURL@2.20
say $purl; # pkg:cpan/GDT/URI-PackageURL@2.21

# Parse PackageURL string
$purl = URI::PackageURL->from_string('pkg:cpan/GDT/URI-PackageURL@2.20');
$purl = URI::PackageURL->from_string('pkg:cpan/GDT/URI-PackageURL@2.21');

# exported functions

$purl = decode_purl('pkg:cpan/GDT/URI-PackageURL@2.20');
$purl = decode_purl('pkg:cpan/GDT/URI-PackageURL@2.21');
say $purl->type; # cpan

$purl_string = encode_purl(type => cpan, namespace => 'GDT', name => 'URI::PackageURL', version => '2.20');
$purl_string = encode_purl(type => cpan, namespace => 'GDT', name => 'URI::PackageURL', version => '2.21');
```


Expand All @@ -31,22 +31,22 @@ $purl_string = encode_purl(type => cpan, namespace => 'GDT', name => 'URI::Packa
Inspect and export "purl" string in various formats (JSON, YAML, Data::Dumper, ENV):

```console
$ purl-tool pkg:cpan/GDT/URI-PackageURL@2.20 --json | jq
$ purl-tool pkg:cpan/GDT/URI-PackageURL@2.21 --json | jq
{
"name": "URI-PackageURL",
"namespace": "GDT",
"qualifiers": {},
"subpath": null,
"type": "cpan",
"version": "2.20"
"version": "2.21"
}
```


Download package using "purl" string:

```console
$ wget $(purl-tool pkg:cpan/GDT/URI-PackageURL@2.20 --download-url)
$ wget $(purl-tool pkg:cpan/GDT/URI-PackageURL@2.21 --download-url)
```


Expand All @@ -57,7 +57,7 @@ Use "purl" string in your shell-scripts:

set -e

PURL="pkg:cpan/GDT/URI-PackageURL@2.20"
PURL="pkg:cpan/GDT/URI-PackageURL@2.21"

eval $(purl-tool "$PURL" --env)

Expand All @@ -79,7 +79,7 @@ Create on-the-fly a "purl" string:
$ purl-tool --type cpan \
--namespace GDT \
--name URI-PackageURL \
--version 2.20
--version 2.21
```


Expand Down
6 changes: 3 additions & 3 deletions lib/URI/PackageURL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use constant DEBUG => $ENV{PURL_DEBUG};

use overload '""' => 'to_string', fallback => 1;

our $VERSION = '2.20_3';
our $VERSION = '2.21';
our @EXPORT = qw(encode_purl decode_purl);

my $PURL_REGEXP = qr{^pkg:[A-Za-z\\.\\-\\+][A-Za-z0-9\\.\\-\\+]*/.+};
Expand Down Expand Up @@ -283,7 +283,7 @@ URI::PackageURL - Perl extension for Package URL (aka "purl")
type => cpan,
namespace => 'GDT',
name => 'URI-PackageURL',
version => '2.20_3'
version => '2.21'
);
say $purl; # pkg:cpan/GDT/URI-PackageURL@2.20
Expand All @@ -296,7 +296,7 @@ URI::PackageURL - Perl extension for Package URL (aka "purl")
$purl = decode_purl('pkg:cpan/GDT/URI-PackageURL@2.20');
say $purl->type; # cpan
$purl_string = encode_purl(type => cpan, name => 'URI::PackageURL', version => '2.20_3');
$purl_string = encode_purl(type => cpan, name => 'URI::PackageURL', version => '2.21');
say $purl_string; # pkg:cpan/URI::PackageURL@2.20
=head1 DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion lib/URI/PackageURL/App.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use Data::Dumper ();

use URI::PackageURL ();

our $VERSION = '2.20_3';
our $VERSION = '2.21';

sub cli_error {
my ($error) = @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/URI/PackageURL/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use warnings;

use Exporter qw(import);

our $VERSION = '2.20_3';
our $VERSION = '2.21';
our @EXPORT = qw(purl_to_urls purl_components_normalize);

sub purl_components_normalize {
Expand Down
2 changes: 1 addition & 1 deletion lib/URI/VersionRange.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use constant FALSE => !!0;

use overload '""' => 'to_string', fallback => 1;

our $VERSION = '2.20_3';
our $VERSION = '2.21';
our @EXPORT = qw(encode_vers decode_vers);

my $VERS_REGEXP = qr{^vers:[a-z\\.\\-\\+][a-z0-9\\.\\-\\+]*/.+};
Expand Down
2 changes: 1 addition & 1 deletion lib/URI/VersionRange/App.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use Data::Dumper ();

use URI::VersionRange ();

our $VERSION = '2.20_3';
our $VERSION = '2.21';

sub cli_error {
my ($error) = @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/URI/VersionRange/Constraint.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use overload '""' => 'to_string', fallback => 1;

use URI::VersionRange::Version;

our $VERSION = '2.20_3';
our $VERSION = '2.21';

our %COMPARATOR = (
'=' => 'equal',
Expand Down
4 changes: 2 additions & 2 deletions t/40-cli.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ sub cmd {

}

my $t1 = 'pkg:cpan/GDT/URI-PackageURL@2.20';
my $t1 = 'pkg:cpan/GDT/URI-PackageURL@2.21';
my $t2 = 'vers:cpan/1.00|>=2.00|<5.00';

subtest "URI::PackageURL::App - '$t1' (JSON output)" => sub {
Expand All @@ -41,7 +41,7 @@ subtest "URI::PackageURL::App - '$t1' (JSON output)" => sub {
is($test_2->{type}, 'cpan', 'JSON output: Type');
is($test_2->{namespace}, 'GDT', 'JSON output: Namespace');
is($test_2->{name}, 'URI-PackageURL', 'JSON output: Name');
is($test_2->{version}, '2.20', 'JSON output: Version');
is($test_2->{version}, '2.21', 'JSON output: Version');

};

Expand Down
2 changes: 1 addition & 1 deletion t/90-cpan-distname-info.t
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ KMACLEOD/Frontier-RPC-0.07b4.tar.gz
RTFIREFLY/Frontier-RPC-0.07b4p1.tar.gz
AJPEACOCK/HTML-Table-2.08a.tar.gz
DANPEDER/MIME-Base32-1.02a.tar.gz
CPAN/authors/id/G/GD/GDT/URI-PackageURL-2.20.tar.gz
CPAN/authors/id/G/GD/GDT/URI-PackageURL-2.21.tar.gz

0 comments on commit ca3b3d0

Please sign in to comment.