summaryrefslogtreecommitdiffstats
path: root/RPM4/lib/RPM4/Header/Dependencies.pm
blob: ecdf5afc2b4ecc9ced34b09afe67e6f534ba15dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
##- Nanar <nanardon@zarb.org>
##-
##- This program is free software; you can redistribute it and/or modify
##- it under the terms of the GNU General Public License as published by
##- the Free Software Foundation; either version 2, or (at your option)
##- any later version.
##-
##- This program is distributed in the hope that it will be useful,
##- but WITHOUT ANY WARRANTY; without even the implied warranty of
##- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##- GNU General Public License for more details.
##-
##- You should have received a copy of the GNU General Public License
##- along with this program; if not, write to the Free Software
##- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# $Id$

package RPM4::Header::Dependencies;

sub new {
    my ($class, $deptag, $initdep, @depdesc) = @_;
    print "$deptag, $initdep\n";
    my $dep = RPM4::Header::Dependencies->newsingle($deptag, @$initdep) or return;
    foreach (@depdesc) {
        print "$_\n";
        $dep->add(@$_);
    }
    return $dep;
}

1;

__END__

=head1 NAME

Hdlist::Header::Dependencies - A set of dependencies

=head1 METHODS

=head2 Hdlist::Header::Dependencies->new($tagtype, $dep1, [$dep2, ...])

Create a new arbitrary dependencies set.
$tagtype is the rpm tag {PROVIDE/REQUIRE/CONFLICT/OBSOLETE/TRIGGER}NAME.

Next arguments are array ref for each dependancy to add in the dependencies set,
in form a name and optionnaly as sense flags and a version.

For example:

    $d = Hdlist::Header::Dependencies->new(
        "REQUIRENAME"
        [ "rpm" ],
        [ "rpm", 2, "4.0" ],
        [ "rpm", [ qw/LESS/ ], "4.0" ]
    );

=head2 $deps->count

Return the number of dependencies contained by this set.

=head2 $deps->move($index)

Move internal index to $index (0 by default).

=head2 $deps->init

Reset internal index and set it to -1, see L<next>

=head2 $deps->hasnext

Advance to next dependency in the set.
Return FALSE if no further dependency available, TRUE otherwise.

=head2 $deps->next

Advance to next dependency in the set.
Return -1 if no further dependency available, next index otherwise.

=head2 $deps->color

Return the 'color' of the current dependency in the depencies set.

=head2 $deps->overlap($depb)

Compare two dependency from two dependencies set and return TRUE if match.

=head2 $deps->info

Return information about current dependency from dependencies set.

=head2 $deps->tag

Return the type of the dependencies set as a rpmtag (PROVIDENAME, REQUIRENAME,
PROVIDENAME, OBSOLETENAME of TRIGGERNAME).

=head2 $deps->name

Return the name of dependency from dependencies set.

=head2 $deps->flags

Return the sense flag of dependency from dependencies set.

=head2 $deps->evr

Return the version of dependency from dependencies set.

=head2 $deps->nopromote($nopromote)

Set or return the nopromote flags of the dependencies set.

=head1 SEE ALSO

L<Hdlist>
L<Hdlist::Header>