xref: /openbsd-src/usr.sbin/pkg_add/OpenBSD/PkgCfl.pod (revision 6e49571c59fe1f1e78405e5a57a1e8dc40029e00)
1$OpenBSD: PkgCfl.pod,v 1.1 2020/12/20 15:30:58 daniel Exp $
2
3=head1 NAME
4
5OpenBSD::PkgCfl - C<pkg_create(1)> C<@conflict> handling
6
7=head1 SYNOPSIS
8
9    use OpenBSD::PkgCfl;
10
11    $clist = OpenBSD::PkgCfl->make_conflicts_list($plist);
12    @cfls = $clist->conflicts_with(@pkgnames);
13
14    OpenBSD::PkgCfl::register($plist, $state);
15    OpenBSD::PkgCfl::unregister($plist, $state);
16    @cfls = OpenBSD::PkgCfl::find_all($plist, $state);
17
18=head1 DESCRIPTION
19
20C<OpenBSD::PkgCfl> is the canonical interface to packing-list conflict
21handling.
22
23Conflict information can be extracted from a packing-list
24(see L<OpenBSD::PackingList>) through the
25C<OpenBSD::PkgCfl> class method. The result is an opaque object C<$clist> that
26can be queried to find out which package names conflict with the
27packing-list.   A query of the form C<$clist-E<gt>conflicts_with(@pkgnames)>
28will extract from the list the package names that actually conflict with
29the packing-list.
30
31Most handling of conflict information happens through the higher level
32interface: C<OpenBSD::PkgCfl::register>, C<OpenBSD::PkgCfl::unregister>
33and C<OpenBSD::PkgCfl::find_all>.  Package tools usually handle installed
34packages, and this interface automatically takes the initial set of installed
35packages into account. The C<register> and C<unregister> functions must
36be used to add and remove a packing-list from the set of installed packages,
37where conflict information is concerned.
38
39The C<find_all> function can be used to find out about all possible conflicts
40a new packing-list will entail, before actually adding the package.
41
42The extra argument C<$state> is a hash used to record system-wide options.
43In this case, it acts as a hidden object that records all conflict
44information. The hash key C<conflict_list> is reserved for that purpose.
45