Browse Source

Dpkg::Arch: Add new import tags

This makes using the module a bit easier.
Guillem Jover 7 years ago
parent
commit
21699eb533
6 changed files with 47 additions and 9 deletions
  1. 1 0
      debian/changelog
  2. 42 1
      scripts/Dpkg/Arch.pm
  3. 1 2
      scripts/Dpkg/Shlibs.pm
  4. 1 5
      scripts/dpkg-architecture.pl
  5. 1 1
      scripts/dpkg-source.pl
  6. 1 0
      t/pod-spell.t

+ 1 - 0
debian/changelog

@@ -5,6 +5,7 @@ dpkg (1.18.19) UNRELEASED; urgency=medium
     - Fix Debian architecture wildcard parsing so that matching four-tuple
       matchings work. Missed in dpkg 1.18.11.
       Reported by Julian Andres Klode <jak@debian.org>.
+    - Add new import tags for Dpkg::Arch.
   * Documentation:
     - Cleanup software requirements in README.
     - Move control member file references from dpkg(1) to deb(5).

+ 42 - 1
scripts/Dpkg/Arch.pm

@@ -26,13 +26,17 @@ Dpkg::Arch - handle architectures
 The Dpkg::Arch module provides functions to handle Debian architectures,
 wildcards, and mapping from and to GNU triplets.
 
+No symbols are exported by default. The :all tag can be used to import all
+symbols. The :getters, :parsers, :mappers and :operators tags can be used
+to import specific symbol subsets.
+
 =cut
 
 use strict;
 use warnings;
 use feature qw(state);
 
-our $VERSION = '1.01';
+our $VERSION = '1.02';
 our @EXPORT_OK = qw(
     get_raw_build_arch
     get_raw_host_arch
@@ -56,6 +60,39 @@ our @EXPORT_OK = qw(
     gnutriplet_to_debtuple
     gnutriplet_to_multiarch
 );
+our %EXPORT_TAGS = (
+    all => [ @EXPORT_OK ],
+    getters => [ qw(
+        get_raw_build_arch
+        get_raw_host_arch
+        get_build_arch
+        get_host_arch
+        get_host_gnu_type
+        get_valid_arches
+    ) ],
+    parsers => [ qw(
+        debarch_list_parse
+    ) ],
+    mappers => [ qw(
+        debarch_to_cpuattrs
+        debarch_to_gnutriplet
+        debarch_to_debtuple
+        debarch_to_multiarch
+        debtuple_to_debarch
+        debtuple_to_gnutriplet
+        gnutriplet_to_debarch
+        gnutriplet_to_debtuple
+        gnutriplet_to_multiarch
+    ) ],
+    operators => [ qw(
+        debarch_eq
+        debarch_is
+        debarch_is_wildcard
+        debarch_is_illegal
+        debarch_is_concerned
+    ) ],
+);
+
 
 use Exporter qw(import);
 use POSIX qw(:errno_h);
@@ -623,6 +660,10 @@ __END__
 
 =head1 CHANGES
 
+=head2 Version 1.02 (dpkg 1.18.19)
+
+New import tags: ":all", ":getters", ":parsers", ":mappers", ":operators".
+
 =head2 Version 1.01 (dpkg 1.18.5)
 
 New functions: debarch_is_illegal(), debarch_list_parse().

+ 1 - 2
scripts/Dpkg/Shlibs.pm

@@ -37,8 +37,7 @@ use Dpkg::ErrorHandling;
 use Dpkg::Shlibs::Objdump;
 use Dpkg::Util qw(:list);
 use Dpkg::Path qw(resolve_symlink canonpath);
-use Dpkg::Arch qw(debarch_to_gnutriplet get_build_arch get_host_arch
-                  gnutriplet_to_multiarch debarch_to_multiarch);
+use Dpkg::Arch qw(get_build_arch get_host_arch :mappers);
 
 use constant DEFAULT_LIBRARY_PATH =>
     qw(/lib /usr/lib);

+ 1 - 5
scripts/dpkg-architecture.pl

@@ -26,11 +26,7 @@ use Dpkg ();
 use Dpkg::Gettext;
 use Dpkg::Getopt;
 use Dpkg::ErrorHandling;
-use Dpkg::Arch qw(get_raw_build_arch get_raw_host_arch get_host_gnu_type
-                  debarch_to_cpuattrs
-                  get_valid_arches debarch_eq debarch_is debarch_to_debtuple
-                  debarch_to_gnutriplet gnutriplet_to_debarch
-                  debarch_to_multiarch);
+use Dpkg::Arch qw(:getters :mappers debarch_eq debarch_is);
 
 textdomain('dpkg-dev');
 

+ 1 - 1
scripts/dpkg-source.pl

@@ -36,7 +36,7 @@ use Dpkg ();
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::Util qw(:list);
-use Dpkg::Arch qw(debarch_eq debarch_is debarch_is_wildcard debarch_is_illegal);
+use Dpkg::Arch qw(:operators);
 use Dpkg::Deps;
 use Dpkg::Compression;
 use Dpkg::Conf;

+ 1 - 0
t/pod-spell.t

@@ -73,6 +73,7 @@ envvar
 fieldnames
 ge
 gettext
+getters
 hurd
 keyrings
 le