Dpkg

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    - Set PERL5LIB globally for the test suite to the local modules directory,
      to avoid using the system modules. Regression introduced in dpkg 1.17.8.
      Reported by Jérémy Bobbio <lunar@debian.org>. Closes: #801329
    - Use absolute buildir pathnames in PATH variable for the test suite.
    - Descend into scripts directory when cleaning up code coverage files.
    - Add new configure option --disable-devel-docs to select the kind of docs
      to generate, default for now is development documentation.
    - Try to use AM_GNU_GETTEXT_REQUIRE_VERSION to benefit from the latest
      installed gettext version, while guaranteeing a minimal required version.
  * Packaging:
    - Add missing Build-Depends for restriction formula support.
  * Documentation:
    - Move description for “target architecture” from the dpkg-architecture(1)
      ‘-A’ option to the TERMS section. Closes: #799046
    - Clarify that the md5sum check on «dpkg --verify» is performed on the
      file contents, and failures denote changed content. Closes: #760248
    - Document that dpkg-buildpackage -nc -S implies -d.
    - Clarify role of Build-Depends in deb-src-control(5).
      Prompted by Johannes Schauer <j.schauer@email.de>.
    - Document supported feature areas.
    - Clarify in dpkg-query(1) when binary:Package gets arch-qualified.

Changes  view on Meta::CPAN

    - Do not abort on --stop when only --pid or --ppid options are specified.
      Thanks to Christos Trochalakis <yatiohi@ideopolis.gr>. Closes: #763767
    - On kFreeBSD systems do not unnecessarily make kvm_openfiles() open
      /dev/mem. This causes issues on FreeBSD jails for example.
      Reported by Steven Chamberlain <steven@pyro.eu.org>.
    - On systems using libkvm, do not fail when kvm_getprocs() cannot find
      any process.
  * Map i786 to i386 also for the multiarch pathname in dpkg-architecture.
  * Handle omitted binary packages due to build profiles in dpkg-genchanges.
    Based on a patch by Johannes Schauer <j.schauer@email.de>. Closes: #758191
  * Update restriction formula syntax for build profiles:
    - Restriction lists are now restriction formulas.
    - Restriction formulas are given in disjunctive normal form expression:
      <foo> <bar baz> <blub>
    - Removal of the implicit prefix/namespace mechanic.
    - Construct the profiles entry of the Packages-List field by converting
      the "<bar baz> <blub>" syntax into "bar,baz+blub".
    - Include a temporary compatibility mapping with the old way to write
      the Build-Profiles field in binary packages which can be removed once
      all affected source packages have moved to the new syntax.
    Thanks to Johannes Schauer <j.schauer@email.de>. Closes: #760158
  * Normalize instdir in dpkg by removing trailing «/» and «/.». This gets
    rid of several inconsistencies and doubled «/» in syscalls and output

lib/Dpkg/BuildProfiles.pm  view on Meta::CPAN


package Dpkg::BuildProfiles 1.00;

use strict;
use warnings;

our @EXPORT_OK = qw(
    get_build_profiles
    set_build_profiles
    parse_build_profiles
    evaluate_restriction_formula
);

use Exporter qw(import);
use List::Util qw(any);

use Dpkg::BuildEnv;

my $cache_profiles;
my @build_profiles;

lib/Dpkg/BuildProfiles.pm  view on Meta::CPAN

=cut

sub parse_build_profiles {
    my $string = shift;

    $string =~ s/^\s*<\s*(.*)\s*>\s*$/$1/;

    return map { [ split ' ' ] } split /\s*>\s+<\s*/, $string;
}

=item evaluate_restriction_formula(\@formula, \@profiles)

Evaluate whether a restriction formula of the form "<foo bar> <baz>", given as
a nested array, is true or false, given the array of enabled build profiles.

=cut

sub evaluate_restriction_formula {
    my ($formula, $profiles) = @_;

    # Restriction formulas are in disjunctive normal form:
    # (foo AND bar) OR (blub AND bla)
    foreach my $restrlist (@{$formula}) {
        my $seen_profile = 1;

        foreach my $restriction (@$restrlist) {
            next if $restriction !~ m/^(!)?(.+)/;

            ## no critic (RegularExpressions::ProhibitCaptureWithoutTest)
            my $negated = defined $1 && $1 eq '!';
            my $profile = $2;
            my $found = any { $_ eq $profile } @{$profiles};

lib/Dpkg/Deps.pm  view on Meta::CPAN

Take into account the profile restriction part of the dependencies. Set
to 0 to completely ignore that information.

=item build_profiles (defaults to no profile)

Define the active build profiles. By default no profile is defined.

=item reduce_profiles (defaults to 0)

If set to 1, ignore dependencies that do not concern the current build
profile. This implicitly strips off the profile restriction formula so
that the resulting dependencies are directly applicable to the current
profiles.

=item reduce_restrictions (defaults to 0)

If set to 1, ignore dependencies that do not concern the current set of
restrictions. This implicitly strips off any architecture restriction list
or restriction formula so that the resulting dependencies are directly
applicable to the current restriction.
This currently implies C<reduce_arch> and C<reduce_profiles>, and overrides
them if set.

=item union (defaults to 0)

If set to 1, returns a L<Dpkg::Deps::Union> instead of a L<Dpkg::Deps::AND>.
Use this when parsing non-dependency fields like Conflicts.

=item virtual (defaults to 0)

lib/Dpkg/Deps/Simple.pm  view on Meta::CPAN

array ref. It can contain an exclusion list, in that case each
architecture is prefixed with an exclamation mark.

=item archqual

The arch qualifier of the dependency (can be undef if there is none).
In the dependency "python:any (>= 2.6)", the arch qualifier is "any".

=item restrictions

The restrictions formula for this dependency. It is undefined when there
is no restriction formula. Otherwise it is an array ref.

=back

=cut

package Dpkg::Deps::Simple 1.02;

use strict;
use warnings;

use Carp;

use Dpkg::Arch qw(debarch_is_concerned debarch_list_parse);
use Dpkg::BuildProfiles qw(parse_build_profiles evaluate_restriction_formula);
use Dpkg::Version;
use Dpkg::ErrorHandling;
use Dpkg::Gettext;

use parent qw(Dpkg::Interface::Storable);

=head1 METHODS

=over 4

lib/Dpkg/Deps/Simple.pm  view on Meta::CPAN


Returns true if the dependency applies to the indicated profile.

=cut

sub profile_is_concerned {
    my ($self, $build_profiles) = @_;

    return 0 if not defined $self->{package}; # Empty dep
    return 1 if not defined $self->{restrictions}; # Dep without restrictions
    return evaluate_restriction_formula($self->{restrictions}, $build_profiles);
}

=item $dep->reduce_profiles()

Simplifies the dependency to contain only information relevant to the given
profile. This object can be left empty after this operation. This trims off
the profile restriction list of this object.

=cut

t/Dpkg_BuildProfiles.t  view on Meta::CPAN

use Test::More tests => 8;

BEGIN {
    use_ok('Dpkg::BuildProfiles', qw(parse_build_profiles
                                     set_build_profiles
                                     get_build_profiles));
}

# TODO: Add actual test cases.

my $formula;

$formula = [ ];
is_deeply([ parse_build_profiles('') ], $formula,
    'parse build profiles formula empty');

$formula = [ [ qw(nocheck) ] ];
is_deeply([ parse_build_profiles('<nocheck>') ], $formula,
    'parse build profiles formula single');

$formula = [ [ qw(nocheck nodoc stage1) ] ];
is_deeply([ parse_build_profiles('<nocheck nodoc stage1>') ], $formula,
    'parse build profiles formula AND');

$formula = [ [ qw(nocheck) ], [ qw(nodoc) ] ];
is_deeply([ parse_build_profiles('<nocheck> <nodoc>') ], $formula,
    'parse build profiles formula OR');

$formula = [ [ qw(nocheck nodoc) ], [ qw(stage1) ] ];
is_deeply([ parse_build_profiles('<nocheck nodoc> <stage1>') ], $formula,
    'parse build profiles formula AND, OR');

{
    local $ENV{DEB_BUILD_PROFILES} = 'cross nodoc profile.name';
    is_deeply([ get_build_profiles() ], [ qw(cross nodoc profile.name) ],
        'get active build profiles from environment');
}

set_build_profiles(qw(nocheck stage1));
is_deeply([ get_build_profiles() ], [ qw(nocheck stage1) ],
    'get active build profiles explicitly set');

t/Dpkg_Deps.t  view on Meta::CPAN

is($dep_profiles->output(), 'dupe <stage1 cross>',
   'Simplification respects duplicated profiles');

TODO: {

local $TODO = 'not yet implemented';

$dep_profiles = deps_parse('tool <!cross>, tool <stage1 cross>');
$dep_profiles->simplify_deps($facts);
is($dep_profiles->output(), 'tool <!cross> <stage1 cross>',
   'Simplify restriction formulas');

} # TODO

$dep_profiles = deps_parse('libfoo-dev:native <!stage1>, libfoo-dev <!stage1 cross>', build_dep => 1);
$dep_profiles->simplify_deps($facts);
is($dep_profiles->output(),
   'libfoo-dev:native <!stage1>, libfoo-dev <!stage1 cross>',
   'Simplification respects archqualifiers and profiles');

my $dep_archqual = deps_parse('pkg, pkg:any');



( run in 0.319 second using v1.01-cache-2.11-cpan-26ccb49234f )