Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package perl-Archive-Extract for 
openSUSE:Factory checked in at 2021-05-12 19:31:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Archive-Extract (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Archive-Extract.new.2988 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Archive-Extract"

Wed May 12 19:31:29 2021 rev:9 rq:891850 version:0.88

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/perl-Archive-Extract/perl-Archive-Extract.changes    
    2019-12-11 12:04:43.216750572 +0100
+++ 
/work/SRC/openSUSE:Factory/.perl-Archive-Extract.new.2988/perl-Archive-Extract.changes
      2021-05-12 19:31:47.091144821 +0200
@@ -1,0 +2,9 @@
+Fri May  7 03:06:04 UTC 2021 - Tina M??ller <timueller+p...@suse.de>
+
+- updated to 0.88
+   see /usr/share/doc/packages/perl-Archive-Extract/CHANGES
+
+  0.88    Thu May  6 14:11:31 BST 2021
+  * Refactor type detection into type_for() function
+
+-------------------------------------------------------------------

Old:
----
  Archive-Extract-0.86.tar.gz

New:
----
  Archive-Extract-0.88.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Archive-Extract.spec ++++++
--- /var/tmp/diff_new_pack.NGKlRH/_old  2021-05-12 19:31:47.639142632 +0200
+++ /var/tmp/diff_new_pack.NGKlRH/_new  2021-05-12 19:31:47.639142632 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Archive-Extract
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,18 +16,16 @@
 #
 
 
+%define cpan_name Archive-Extract
 Name:           perl-Archive-Extract
-Version:        0.86
+Version:        0.88
 Release:        0
-%define cpan_name Archive-Extract
 Summary:        Generic archive extracting mechanism
 License:        Artistic-1.0 OR GPL-1.0-or-later
-Group:          Development/Libraries/Perl
-Url:            https://metacpan.org/release/%{cpan_name}
+URL:            https://metacpan.org/release/%{cpan_name}
 Source0:        
https://cpan.metacpan.org/authors/id/B/BI/BINGOS/%{cpan_name}-%{version}.tar.gz
 Source1:        cpanspec.yml
 BuildArch:      noarch
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  perl
 BuildRequires:  perl-macros
 BuildRequires:  perl(IPC::Cmd) >= 0.64
@@ -51,11 +49,11 @@
 See the 'HOW IT WORKS' section further down for details.
 
 %prep
-%setup -q -n %{cpan_name}-%{version}
+%autosetup  -n %{cpan_name}-%{version}
 
 %build
 perl Makefile.PL INSTALLDIRS=vendor
-make %{?_smp_mflags}
+%make_build
 
 %check
 make test
@@ -66,7 +64,6 @@
 %perl_gen_filelist
 
 %files -f %{name}.files
-%defattr(-,root,root,755)
 %doc CHANGES README
 
 %changelog

++++++ Archive-Extract-0.86.tar.gz -> Archive-Extract-0.88.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Archive-Extract-0.86/CHANGES 
new/Archive-Extract-0.88/CHANGES
--- old/Archive-Extract-0.86/CHANGES    2019-12-05 21:54:46.000000000 +0100
+++ new/Archive-Extract-0.88/CHANGES    2021-05-06 15:11:57.000000000 +0200
@@ -1,3 +1,6 @@
+0.88    Thu May  6 14:11:31 BST 2021
+* Refactor type detection into type_for() function
+
 0.86    Thu Dec  5 20:53:07 GMT 2019
 * Fix RT#131072 which was due to tar.exe and CRLF line endings
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Archive-Extract-0.86/META.json 
new/Archive-Extract-0.88/META.json
--- old/Archive-Extract-0.86/META.json  2019-12-05 21:55:39.000000000 +0100
+++ new/Archive-Extract-0.88/META.json  2021-05-06 15:13:14.000000000 +0200
@@ -4,7 +4,7 @@
       "Jos Boumans <kane[at]cpan.org>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter 
version 2.150010",
+   "generated_by" : "ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter 
version 2.150010",
    "license" : [
       "perl_5"
    ],
@@ -50,6 +50,6 @@
          "url" : "https://github.com/jib/archive-extract";
       }
    },
-   "version" : "0.86",
-   "x_serialization_backend" : "JSON::PP version 4.04"
+   "version" : "0.88",
+   "x_serialization_backend" : "JSON::PP version 4.06"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Archive-Extract-0.86/META.yml 
new/Archive-Extract-0.88/META.yml
--- old/Archive-Extract-0.86/META.yml   2019-12-05 21:55:39.000000000 +0100
+++ new/Archive-Extract-0.88/META.yml   2021-05-06 15:13:14.000000000 +0200
@@ -7,7 +7,7 @@
 configure_requires:
   ExtUtils::MakeMaker: '0'
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter version 
2.150010'
+generated_by: 'ExtUtils::MakeMaker version 7.62, CPAN::Meta::Converter version 
2.150010'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -29,5 +29,5 @@
   if: '0'
 resources:
   repository: https://github.com/jib/archive-extract
-version: '0.86'
+version: '0.88'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Archive-Extract-0.86/lib/Archive/Extract.pm 
new/Archive-Extract-0.88/lib/Archive/Extract.pm
--- old/Archive-Extract-0.86/lib/Archive/Extract.pm     2019-12-05 
21:55:01.000000000 +0100
+++ new/Archive-Extract-0.88/lib/Archive/Extract.pm     2021-05-06 
15:12:17.000000000 +0200
@@ -48,7 +48,7 @@
             $_ALLOW_BIN $_ALLOW_PURE_PERL $_ALLOW_TAR_ITER
          ];
 
-$VERSION            = '0.86';
+$VERSION            = '0.88';
 $PREFER_BIN         = 0;
 $WARN               = 1;
 $DEBUG              = 0;
@@ -188,6 +188,21 @@
                     }
     }
 
+sub type_for {
+    local $_ = shift;
+    return /.+?\.(?:tar\.gz|tgz)$/i         ? TGZ   :
+           /.+?\.gz$/i                      ? GZ    :
+           /.+?\.tar$/i                     ? TAR   :
+           /.+?\.(zip|jar|ear|war|par)$/i   ? ZIP   :
+           /.+?\.(?:tbz2?|tar\.bz2?)$/i     ? TBZ   :
+           /.+?\.bz2$/i                     ? BZ2   :
+           /.+?\.Z$/                        ? Z     :
+           /.+?\.lzma$/                     ? LZMA  :
+           /.+?\.(?:txz|tar\.xz)$/i         ? TXZ   :
+           /.+?\.xz$/                       ? XZ    :
+           '';
+}
+
 =head1 METHODS
 
 =head2 $ae = Archive::Extract->new(archive => '/path/to/archive',[type => 
TYPE])
@@ -195,7 +210,7 @@
 Creates a new C<Archive::Extract> object based on the archive file you
 passed it. Automatically determines the type of archive based on the
 extension, but you can override that by explicitly providing the
-C<type> argument.
+C<type> argument, potentially by calling C<type_for()>.
 
 Valid values for C<type> are:
 
@@ -272,21 +287,7 @@
         my $ar = $parsed->{archive} = File::Spec->rel2abs( $parsed->{archive} 
);
 
         ### figure out the type, if it wasn't already specified ###
-        unless ( $parsed->{type} ) {
-            $parsed->{type} =
-                $ar =~ /.+?\.(?:tar\.gz|tgz)$/i         ? TGZ   :
-                $ar =~ /.+?\.gz$/i                      ? GZ    :
-                $ar =~ /.+?\.tar$/i                     ? TAR   :
-                $ar =~ /.+?\.(zip|jar|ear|war|par)$/i   ? ZIP   :
-                $ar =~ /.+?\.(?:tbz2?|tar\.bz2?)$/i     ? TBZ   :
-                $ar =~ /.+?\.bz2$/i                     ? BZ2   :
-                $ar =~ /.+?\.Z$/                        ? Z     :
-                $ar =~ /.+?\.lzma$/                     ? LZMA  :
-                $ar =~ /.+?\.(?:txz|tar\.xz)$/i         ? TXZ   :
-                $ar =~ /.+?\.xz$/                       ? XZ    :
-                '';
-
-        }
+        $parsed->{type} ||= type_for $ar;
 
         bless $parsed, $class;
 
@@ -1619,6 +1620,22 @@
 
 =pod
 
+=head1 UTILITY FUNCTION
+
+=head2 type_for($archive)
+
+Given an archive file name, it determins the type by parsing the file
+name extension. Used by C<new()> when the C<type> parameter is not passed.
+Also useful when the archive file does not include a suffix but the file
+name is otherwise known, such as when a file is uploaded to a web server
+and stored with a temporary name that differs from the original name, and
+you want to use the same detection pattern as Archive::Extract. Example:
+
+  my $ae = Archive::Extract->new(
+      archive => '/tmp/02af6s',
+      type    => Archive::Extract::type_for('archive.zip'),
+  );
+
 =head1 HOW IT WORKS
 
 C<Archive::Extract> tries first to determine what type of archive you
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Archive-Extract-0.86/t/01_Archive-Extract.t 
new/Archive-Extract-0.88/t/01_Archive-Extract.t
--- old/Archive-Extract-0.86/t/01_Archive-Extract.t     2013-05-12 
17:18:41.000000000 +0200
+++ new/Archive-Extract-0.88/t/01_Archive-Extract.t     2021-05-06 
13:32:13.000000000 +0200
@@ -279,6 +279,21 @@
         like( $warnings, qr/Cannot determine file type for/,
                                 "           Error is: unknown file type" );
     }
+
+    ### test reading the type
+    my %type_exts = map { $_ => [$_] } @types;
+    push @{ $type_exts{tgz} } => qw(tar.gz);
+    push @{ $type_exts{zip} } => qw(jar ear war par);
+    push @{ $type_exts{tbz} } => qw(tbz2 tar.bz tar.bz2);
+    push @{ $type_exts{txz} } => qw(tar.xz);
+    while (my ($type, $exts) = each %type_exts) {
+        for my $ext (@{ $exts }) {
+            is(
+                Archive::Extract::type_for("foo.$ext"), $type,
+                "Should detect type '$type' for 'foo.$ext",
+            );
+        }
+    }
 }
 
 ### test multiple errors

Reply via email to