r54455 - /trunk/dh-make-perl/lib/Debian/Control.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Wed Mar 17 20:32:12 UTC 2010


Author: dmn
Date: Wed Mar 17 20:32:05 2010
New Revision: 54455

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54455
Log:
Control: new utility method: is_arch_dep

Saves one from looking up the Architecture of the first
binary package

Modified:
    trunk/dh-make-perl/lib/Debian/Control.pm

Modified: trunk/dh-make-perl/lib/Debian/Control.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Control.pm?rev=54455&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Control.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Control.pm Wed Mar 17 20:32:05 2010
@@ -157,6 +157,33 @@
     }
 }
 
+=item is_arch_dep
+
+Returns true if the package is architecture-dependent. This is determined by
+the C<Architecture> field of the first binary package. If it equals to C<all>,
+then the package is architecture-independent; otherwise it is
+architecture-dependent.
+
+Returns I<undef> if it is not possible to determine whether the package is
+architecture-dependent or not. This is the case when there are no binary
+package stanzas present or the first has no C<Archiitecture> field.
+
+=cut
+
+sub is_arch_dep {
+    my $self = shift;
+
+    my $bin = $self->binary->Values(0);
+
+    return undef unless $bin;
+
+    my $arch = $bin->Architecture;
+
+    return undef unless defined($arch);
+
+    return ( $arch ne 'all' );
+}
+
 =back
 
 =head1 SEE ALSO




More information about the Pkg-perl-cvs-commits mailing list