Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
OBS:Server:Unstable
perl-Net-Docker-Registry
_service:obs_scm:Net-Docker-Registry-0.0.2.git2...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa.obscpio of Package perl-Net-Docker-Registry
07070100000000000081A40000000000000000000000016346E86C00000037000000000000000000000000000000000000004000000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/.gitignoreetc/* Build MYMETA.json MYMETA.yml _build/ blib/ *.sw? 07070100000001000081A40000000000000000000000016346E86C000002C2000000000000000000000000000000000000003E00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/Build.PLuse 5.006; use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'Net::Docker::Registry', license => 'artistic_2', dist_author => q{Frank Schreiner <m0ses@samaxi.de>}, dist_version_from => 'lib/Net/Docker/Registry.pm', release_status => 'stable', configure_requires => { 'Module::Build' => '0', }, build_requires => { 'Test::More' => '0', }, requires => { 'LWP::UserAgent' => '0', 'HTTP::Request' => '0', 'JSON::MaybeXS' => '0', 'URI::Escape' => '0', }, add_to_cleanup => [ 'Net-Docker-Registry-*' ], ); $builder->create_build_script(); 07070100000002000081A40000000000000000000000016346E86C00000077000000000000000000000000000000000000003D00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/ChangesRevision history for Net-Docker-Registry 0.01 Date/time First version, released on an unsuspecting world. 07070100000003000081A40000000000000000000000016346E86C000000A5000000000000000000000000000000000000003E00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/MANIFESTBuild.PL Changes lib/Net/Docker/Registry.pm lib/Net/Docker/Registry/Client.pm MANIFEST This list of files README t/00-load.t t/manifest.t t/pod-coverage.t t/pod.t 07070100000004000081A40000000000000000000000016346E86C00000CD9000000000000000000000000000000000000003C00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/READMENet-Docker-Registry The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for example C compilers and installed libraries) and any other information that should be provided before the module is installed. A README file is required for CPAN modules since CPAN extracts the README file from a module distribution so that people browsing the archive can use it to get an idea of the module's uses. It is usually a good idea to provide version information here so that people can decide whether fixes for the module are worth downloading. INSTALLATION To install this module, run the following commands: perl Build.PL ./Build ./Build test ./Build install SUPPORT AND DOCUMENTATION After installing, you can find documentation for this module with the perldoc command. perldoc Net::Docker::Registry You can also look for information at: RT, CPAN's request tracker (report bugs here) http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Docker-Registry AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/Net-Docker-Registry CPAN Ratings http://cpanratings.perl.org/d/Net-Docker-Registry Search CPAN http://search.cpan.org/dist/Net-Docker-Registry/ LICENSE AND COPYRIGHT Copyright (C) 2018 Frank Schreiner This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: L<http://www.perlfoundation.org/artistic_license_2_0> Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 07070100000005000081A40000000000000000000000016346E86C0000003F000000000000000000000000000000000000003F00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/README.md# THIS IS ONLY A PROOF OF CONCEPT. # DO NOT USE IN PRODUCTION! 07070100000006000041ED0000000000000000000000026346E86C00000000000000000000000000000000000000000000003D00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/contrib07070100000007000081ED0000000000000000000000016346E86C0000031F000000000000000000000000000000000000004800000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/contrib/example.pl#!/usr/bin/env perl use strict; use warnings; use FindBin; use YAML; use Data::Dumper; BEGIN { unshift @::INC, "$FindBin::Bin/../lib" }; use Net::Docker::Registry::Client; my $config = YAML::LoadFile("$FindBin::Bin/../etc/config.yml"); my $drc = Net::Docker::Registry::Client->new(%$config); print "\n"; for my $rep (@{$drc->repositories()}) { print "- Found repository $rep\n"; for my $tag (@{$drc->list_tags($rep)}) { print "-- Found tag $tag\n"; my $manifest = $drc->manifests($rep, $tag); print " Name : $manifest->{name}\n"; print " Tag : $manifest->{tag}\n"; print " Arch : $manifest->{architecture}\n"; print " Layers:\n"; foreach my $layer (@{$manifest->{fsLayers}}) { print " - $layer->{blobSum}\n"; } } print "\n\n"; } exit 0; 07070100000008000041ED0000000000000000000000026346E86C00000000000000000000000000000000000000000000003A00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/dist07070100000009000081A40000000000000000000000016346E86C000005E6000000000000000000000000000000000000005800000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/dist/perl-Net-Docker-Registry.spec# # spec file for package perl-Net-Docker-Registry # # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %define pname Net-Docker-Registry Name: perl-%{pname} Version: 0.0.0 Release: 0 Summary: Perl library to interact with docker registry License: GPL-2.0-or-later Group: Development/Libraries/Perl Url: https://github.com/M0ses/Net-Docker-Registry Source: %{pname}-%{version}.tar.xz BuildRequires: perl(Module::Build) BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires: perl(LWP::UserAgent) Requires: perl(JSON::MaybeXS) %description %prep %setup -q -n %{pname}-%{version} %build perl Build.PL --installdirs vendor --destdir %{buildroot} ./Build %install ./Build install %files %defattr(-,root,root) %doc Changes README README.md %{perl_vendorlib}/* %{_mandir}/man?/* %changelog 0707010000000A000041ED0000000000000000000000026346E86C00000000000000000000000000000000000000000000003900000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/etc0707010000000B000081A40000000000000000000000016346E86C00000045000000000000000000000000000000000000004D00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/etc/config.yml.templateproto: https host: test-registry port: 443 user: myuser pass: mypass 0707010000000C000081A40000000000000000000000016346E86C000000D0000000000000000000000000000000000000004000000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/ignore.txtMakefile Makefile.old Build Build.bat META.* MYMETA.* .build/ _build/ cover_db/ blib/ inc/ .lwpcookies .last_cover_stats nytprof.out pod2htm*.tmp pm_to_blib Net-Docker-Registry-* Net-Docker-Registry-*.tar.gz 0707010000000D000041ED0000000000000000000000036346E86C00000000000000000000000000000000000000000000003900000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/lib0707010000000E000041ED0000000000000000000000036346E86C00000000000000000000000000000000000000000000003D00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/lib/Net0707010000000F000041ED0000000000000000000000036346E86C00000000000000000000000000000000000000000000004400000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/lib/Net/Docker07070100000010000041ED0000000000000000000000026346E86C00000000000000000000000000000000000000000000004D00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/lib/Net/Docker/Registry07070100000011000081A40000000000000000000000016346E86C00000DB7000000000000000000000000000000000000005000000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/lib/Net/Docker/Registry.pmpackage Net::Docker::Registry; use 5.006; use strict; use warnings; =head1 NAME Net::Docker::Registry - Handle docker registries in perl =head1 VERSION Version 0.01 =cut our $VERSION = '0.01'; =head1 SYNOPSIS Quick summary of what the module does. Perhaps a little code snippet. use Net::Docker::Registry::Client; my $drc = Net::Docker::Registry::Client->new({...}); my @repos = $drc->repositories(); my @tags = $drc->list_tags($repos[0]); my $manifest = $drc->manifests($repos[0], $tags[0]); print " Name : $manifest->{name}\n"; print " Tag : $manifest->{tag}\n"; print " Arch : $manifest->{architecture}\n"; print " Layers:\n"; foreach my $layer (@{$manifest->{fsLayers}}) { print " - $layer->{blobSum}\n"; } =head1 AUTHOR Frank Schreiner, C<< <m0ses at samaxi.de> >> =head1 BUGS AND FEATURE REQUESTS Please report any bugs or feature requests through the web interface at L<https://github.com/M0ses/Net-Docker-Registry/issues>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Net::Docker::Registry You can also look for information at: =over 1 =item * Github's issue tracker (report bugs here) L<https://github.com/M0ses/Net-Docker-Registry/issues> =back =head1 SEE ALSO perldoc Net::Docker::Registry::Client =head1 ACKNOWLEDGEMENTS =head1 LICENSE AND COPYRIGHT Copyright 2018 Frank Schreiner. This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: L<http://www.perlfoundation.org/artistic_license_2_0> Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =cut 1; # End of Net::Docker::Registry 07070100000012000081A40000000000000000000000016346E86C00000F65000000000000000000000000000000000000005700000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/lib/Net/Docker/Registry/Client.pmpackage Net::Docker::Registry::Client; use strict; use warnings; use LWP::UserAgent; use HTTP::Request; use JSON::MaybeXS; use URI::Escape; use Data::Dumper; use Carp; sub new { my ($class,%opts) = @_; return bless \%opts, $class } sub catalog { my ($self) = @_; my $api_url = '/v2/_catalog'; return $self->_get("/v2/_catalog", 'repositories'); } sub manifests { my ($self, $name, $reference) = @_; return $self->_get("/v2/$name/manifests/$reference"); } sub list_tags { my ($self, $name) = @_; return $self->_get("/v2/$name/tags/list", 'tags')->{tags}; } sub repositories { my ($self, $name) = @_; return $self->catalog()->{repositories}; } sub obs_info_json { my ($self, $name) = @_; return $self->_get("/v2/$name/info.json"); } sub manifestinfos { my ($self, $name, $distmanifest) = @_; return $self->_get("/v2/$name/manifestinfos/$distmanifest"); } sub _get { my ($self, $url, $merge) = @_; my $port = ($self->{port}) ? ":$self->{port}" : ''; my $uri = ( $self->{proto} || 'https' ) . "://$self->{host}$port$url"; my $req = HTTP::Request->new(GET => $uri); # User-Agent: $req->header("Host" => $self->{host}); $req->authorization_basic($self->{user}, $self->{pass}) if ($self->{user} && $self->{pass}); my $ua = LWP::UserAgent->new(); my $res = $ua->request($req); if ( $res->is_success ) { my $result = decode_json($res->content); my $link = $res->header('Link'); if ($link) { die "Do not know what to merge ($url)" if (!$merge); $link =~ s/<(.*)>.*/$1/; my $mresult = $self->_get($link, $merge); if (ref($mresult->{$merge}) eq 'ARRAY' && ref($result->{$merge}) eq 'ARRAY') { push (@{$result->{$merge}}, @{$mresult->{$merge}}); } } return $result; } elsif ($res->code == 401) { $self->_authenticate($res); } else { my $err = $res->status_line . " ($uri)\n"; if ($self->{trace}) { $err .= "### REQUEST ################################################\n"; $err .= $req->as_string; $err .= "### RESPONSE ################################################\n"; $err .= $res->as_string; $err .= "### END ################################################\n"; } croak $err; } } sub _authenticate { my ($self, $response) = @_; my $realms = $self->_split_realms($response); my $type2meth = { Bearer => "_oauth_Bearer", }; while (my $next = shift(@$realms)) { my $method = $type2meth->{$next->{type}}; if ($method) { my $auth = $self->$method($next); return $auth if $auth; } } } sub _oauth_Bearer { my ($self, $data) = @_; my $post_data = { grant_type => 'password', client_id => 'perl-client', scope => $data->{scope}, service => $data->{service}, username => $self->{user}, password => $self->{pass} }; my $req = HTTP::Request->new('POST', $data->{realm}); $req->header('content-type'=>'application/x-www-form-urlencoded'); my @ds; while ( my ($k, $v) = each(%$post_data) ) { next if ($k eq 'realm' or $k eq 'type'); push @ds, "$k=".uri_escape($v); } $req->content(join('&',@ds)); print $req->as_string(); my $ua = LWP::UserAgent->new(); my $res = $ua->request($req); if ( $res->is_success ) { return decode_json($res->content); } else { die $res->status_line; } } sub _split_realms { my ($self, $response) = @_; my $auth_header = $response->header('www-authenticate'); my @aheader = split(/,/, $auth_header); my $realms = []; my $rc = 0; foreach my $ahf (@aheader) { if ($ahf =~ /^(\S*) realm=(?:"|')?([^,"']+)(?:"|')?$/) { $rc++; $realms->[$rc-1]{type} = $1; $realms->[$rc-1]{realm} = $2; } else { my ($field, $value) = split(/=/,$ahf,2); $value =~ s/^(?:"|')?([^,"']+)(?:"|')?$/$1/; $realms->[$rc-1]{$field} = $value; } } print Dumper($realms); return $realms; } 1; 07070100000013000041ED0000000000000000000000026346E86C00000000000000000000000000000000000000000000003700000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/t07070100000014000081A40000000000000000000000016346E86C00000138000000000000000000000000000000000000004100000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/t/00-load.t#!perl -T use 5.006; use strict; use warnings; use Test::More; plan tests => 2; BEGIN { use_ok( 'Net::Docker::Registry' ) || print "Bail out!\n"; use_ok( 'Net::Docker::Registry::Client' ) || print "Bail out!\n"; } diag( "Testing Net::Docker::Registry $Net::Docker::Registry::VERSION, Perl $], $^X" ); 07070100000015000081A40000000000000000000000016346E86C00000138000000000000000000000000000000000000004200000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/t/manifest.t#!perl -T use 5.006; use strict; use warnings; use Test::More; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } my $min_tcm = 0.9; eval "use Test::CheckManifest $min_tcm"; plan skip_all => "Test::CheckManifest $min_tcm required" if $@; ok_manifest(); 07070100000016000081A40000000000000000000000016346E86C000002A8000000000000000000000000000000000000004600000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/t/pod-coverage.t#!perl -T use 5.006; use strict; use warnings; use Test::More; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } # Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; eval "use Test::Pod::Coverage $min_tpc"; plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" if $@; # Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, # but older versions don't recognize some common documentation styles my $min_pc = 0.18; eval "use Pod::Coverage $min_pc"; plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" if $@; all_pod_coverage_ok(); 07070100000017000081A40000000000000000000000016346E86C0000015E000000000000000000000000000000000000003D00000000Net-Docker-Registry-0.0.2.git20221012T181644.f0930aa/t/pod.t#!perl -T use 5.006; use strict; use warnings; use Test::More; unless ( $ENV{RELEASE_TESTING} ) { plan( skip_all => "Author tests not required for installation" ); } # Ensure a recent version of Test::Pod my $min_tp = 1.22; eval "use Test::Pod $min_tp"; plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; all_pod_files_ok(); 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!41 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor