Fink::PkgVersion(3) Fink documentation Fink::PkgVersion(3)NAMEFink::PkgVersion - a single version of a package
DESCRIPTION
Methods
new_backed
my $pv = Fink::PkgVersion->new_backed $file, $hashref;
Create a disk-backed PkgVersion, with initial properties from
$hashref. Other properties will be loaded as needed from $file.
Note that this constructor does not initialize the PkgVersion,
since it already has an initialized object on-disk.
WARNING:
When a PkgVersion object is created with new_backed, the first
access to the object MUST be with one of these methods:
Package: get_version, get_all_versions, get_matching_versions, get_all_providers
PkgVersion: get_parent, get_splitoffs, parent_splitoffs
Many of these methods take a $noload flag to allow callers to
disable loading. This should only be done rarely, when the caller
is CERTAIN that no unloaded fields will be used and when it results
in many fewer loads. There should be always be a comment nearby
with the text 'noload'.
In addition, the following fields should be accessed exclusively
through accessors:
Package: _providers, _versions
PkgVersion: _splitoffs_obj, parent_obj
load_fields
my $same_pv = $pv->load_fields;
Load any unloaded fields into this PkgVersion object. Loads are
shared among different PkgVersion objects. Returns this object.
load_fields must always be called, even for newly-created objects.
We set some fields here that are runtime-dependent, which needs to
happen even for packages that aren't cached.
get_init_fields
my $hashref = $pv->get_init_fields;
Get the minimum fields necessary for inserting a PkgVersion.
handle_infon_block
my $properties = &read_properties($filename);
($properties, $info_level) =
Fink::PkgVersion->handle_infon_block($properties, $filename);
For the .info file lines processed into the hash ref $properties
from file $filename, deal with the possibility that the whole thing
is in a InfoN: block.
If so, make sure this fink is new enough to understand this .info
format (i.e., N<=max_info_level). If so, promote the fields of the
block up to the top level of %$properties and return a ref to this
new hash. If called in a scalar context, the InfoN level is
returned in the "infon" field of the $properties hash. If called in
an array context, the InfoN level (or 1 if not an InfoN construct)
is returned as the second element.
If an error with InfoN occurs (N>max_info_level, more than one
InfoN block, or part of $properties existing outside the InfoN
block) print a warning message and return a ref to an empty hash
(i.e., ignore the .info file).
pkgversions_from_properties
my $properties = { field => $val, ... };
my @packages = Fink::Package->pkgversions_from_properties
$properties, %options;
Create Fink::PkgVersion objects based on a hash-ref of properties.
Do not yet add these packages to the current package database.
Returns all packages created, including split-offs if this is a
parent package.
Options are info_level and filename, and optionally parent.
The option "no_exclusions", if true, will cause the packages to be
created even if an Architcture field setting would normally disable
them.
pkgversions_from_info_file
my @packages = Fink::Package->pkgversions_from_info_file $filename;
my @packages = Fink::Package->pkgversions_from_info_file $filename, %options;
Create Fink::PkgVersion objects based on a .info file. Do not yet
add these packages to the current package database.
Returns all packages created, including split-offs.
Any given %options are passed to pkgversions_from_properties,
except for "filename" and "info_level", which are over-written.
one_pkgversion_from_info_file
my $pv = Fink::Package->one_pkgversion_from_info_file $filename;
my @pvs = Fink::Package->one_pkgversion_from_info_file $filename;
Convenience method to get a single Fink::PkgVersion object from a
.info file. Does not return splitoffs, only parents.
If the .info file uses variants, multiple objects will be returned.
By capturing just one, information may be lost, but at least the
caller will have a useful parent object.
initialize
$pv->initialize(%options);
Protected method, do not call directly.
Object initializer as specified in Fink:::Base.
The following elements may be in the options-hash for the
new_from_properties constructor.
filename
The name of the file from which this PkgVersion's properties
were read. Omission of this option is strongly discouraged.
info_level
The level of the package description syntax used to describe
this PkgVersion, ie: the InfoN field. Omission of this option
is strongly discouraged.
parent_obj
The parent PkgVersion of this package, if it has one.
param_default_expanded
my $value = $pv->param_default_expanded $field, $default;
my $value = $pv->param_default_expanded $field, $default, %options;
Expand percent chars in the given $field, if that field exists.
Return the expanded form but do not store it back into the field
data. If the field doesn't exist, return the $default. The
following %options may be used:
expand_override (optional)
A hashref containing a percent-expansion map to be used in
addition to (and overriding) that in the _expand pv package
data.
err_action (optional)
Specify the behavior when an unknown percent-expansion token is
encountered. See Fink::Services::expand_percent2 for details.
get_defaultscript_type
my $defaultscript_type = $pv->get_defaultscript_type;
Returns a string indicating the type of build system to assume for
%{default_script} and related processing. The value is an enum of:
autotools
makemaker
ruby
modulebuild
The value is controlled explicitly by the DefaultScript: field, or
else implicitly by certain Type: field tokens.
merge
$new_pv->merge($old_pv);
When one PkgVersion supplants another one, some properties of the
old one may still be relevant. This call method gives the new one a
chance to examine the old one and take things from it.
is_bootstrapping
my $bool = $pv->is_bootstrapping;
Are we in bootstrap mode?
get_name
get_version
get_revision
get_epoch
These accessors return strings for the various fundamental package
data. The values are all guaranteed to be defined (they default to
"0" if the field is missing from the package).
get_fullversion
get_fullname
These accessors return strings for the various derived package
data. The fullversion includes the epoch if the epoch is not zero
(prefixed to the version, delimited by a colon). The fullname never
includes the epoch.
get_filename
get_info_filename
These accessors return the .info filename from which this package's
database entry was constructed. If the package is generated by
VirtPackage or dpkg status data alone, get_filename() will return a
null string or undef, while get_info_filename() will always return
a null string in these situations.
get_debname
get_debpath
get_debfile
These accessors return information about the .deb archive file for
the package. The debname is the simple filename. The debpath is the
directory that would contain the debfile if it were locally built
(this is buried in %p/fink/dists, not the symlink dir %p/fink/debs
or a cache of downloaded precompiled (apt-get) binaries). The
debfile is the full path, composed of the debpath and debfile.
get_tree
my $tree = $pv->get_tree;
Get the last (highest priority) tree in which this package can be
found. This refers to just the "archive" component of the tree,
eg: 'main'.
get_trees
my @trees = $pv->get_trees;
Get a list of every tree in which this package can be found.
in_tree
my $bool = $pv->in_tree($tree);
Get whether or not this package can be found in the given tree.
parent_splitoffs
my @splitoffs = $pv->parent_splitoffs;
Returns the splitoffs of this package, not including itself, if
this is a parent package. Otherwise, returns false.
get_splitoffs
my @splitoffs = $pv->get_splitoffs;
my $splitoffs = $pv->get_splitoffs $with_parent, $with_self;
Get a list of the splitoffs of this package, or of its parent if
this package is a splitoff.
If $with_parent is true, includes the parent package (defaults
false). If $with_self is true, includes this package (defaults
false). If this package is the parent package, both $with_self and
$with_parent must both be true for this package to be included.
get_relatives
my @relatives = $pv->get_relatives;
Get the other packages that are splitoffs of this one (or of its
parent, if this package is a splitoff). Does not include this
package, but does include the parent (in case this package is a
splitoff).
type_hash_from_string
my $type_hash = Fink::PkgVersion->type_hash_from_string($string, $filename);
Given a $string representing the Type: field of a single package
(i.e., specific variant, not multivalue subtype lists), return a
ref to a hash of type=>subtype key/value pairs. The $filename is
used in error-reporting if the $string cannot be parsed.
get_license
This accessor returns the License field for the package, or a null
string if no license could be determined (the return is *always*
defined). This field can be given as a comma-delimitted list of
values, and each value may be controlled by a conditional. The
first value for which the conditional is true or that has no
conditional is used. Leading and trailing whitespace is removed. No
case-sanitizing is performed.
format_description
my $string_formatted = format_description $string;
Formats the multiline plain-text $string as a dpkg field value.
That means every line indented by 1 space and blank lines in
$string get converted to a line containing period character ("
.\n").
format_oneline
my $trunc_string = format_oneline $string;
my $trunc_string = format_oneline $string, $maxlen;
Force $string to fit into the given width $maxlen (if defined and
>0). Embedded newlines and leading and trailing whitespace is
removed. If the resulting string is wider than $maxlen, it is
truncated and an elipses ("...") is added to give a string of the
correct size. This function does *not* respect word-breaks when it
truncates the string.
get_shortdescription
my $desc = $self->get_shortdescription;
my $desc = $self->get_shortdescription $limit;
Returns the Description field for the PkgVersion object or a
standard dummy string if that field does not exist. The value is
not truncated if $limit is negative. It is truncated to $limit
chars if $limit is passed, otherwise it it truncated to 75 chars.
get_description
my $desc = $self->get_description;
my $desc = $self->get_description $style;
my $desc = $self->get_description $style, $canonical_prefix; # deprecated!
my $desc = $self->get_description %options;
Returns the description of the package, formatted for dpkg. The
exact fields used depend on the full_desc_only value in %options.
The $style and $canonical_prefix parameters have the same effect as
the full_desc_only and canonical_prefix values in %options,
respectively. The $canonical_prefix parameter is deprecated and
will be removed from the API soon. The following %options may be
used:
full_desc_only (optional)
If the value is true, only return Description (truncated to 75
chars) and DescDetail. If false, also include DescUsage,
Homepage, and Maintainer.
canonical_prefix (optional)
If the value is true, use "/sw" for %p when parsing the
DescDetail and DescUsage fields instead of the local fink's
normal installation path.
get_aptdb
my $hashref = get_aptdb();
Get a hashref with the current packages available via apt-get, and
the way apt wants to get those packages: downloading from a remote
site, or using a local .deb.
is_aptgetable
my $aptgetable = $pv->is_aptgetable;
my $aptgetable = $pv->is_aptgetable $type;
Get whether or not this package is available via apt-get.
If a type is specified, will only return true if apt get will get
the .deb in the desired way. Specify one of $APT_LOCAL or
$APT_REMOTE, or zero for any type. Defaults to $APT_REMOTE.
local_apt_location
my $path = $pv->local_apt_location;
Find the local path where apt says a deb can be found. Returns
undef if none found.
For packages that have a local non-apt deb file available, the
local deb should be preferred, so this method returns undef.
is_locally_present
my $bool = $pv->is_locally_present;
Find whether or not there is a .deb built locally which can be used
to install this package.
is_present
my $bool = $pv->is_present;
Find whether or not there is an existing .deb that can be used to
install this package.
find_local_debfile
my $path = $pv->find_local_debfile;
Find a path to an existing .deb for this package, which is known to
be built on this system. If no such .deb exists, return undef.
find_debfile
my $path = $pv->find_debfile;
Find a path to an existing .deb for this package. If no such .deb
exists, return undef.
get_depends
my $lol_struct = $self->get_depends($want_build, $want_conflicts)
Get the dependency (or conflicts) package list. If $want_build is
true, return the compile-time package list; if it is false, return
only the runtime package list. If $want_conflicts is true, return
the antidependencies (conflicts) list; if it is false, return the
dependencies.
Compile-time dependencies (1,0) is the union of the BuildDepends of
the package family's parent package and the Depends of the whole
package family. Compile-time conflicts (1,1) is the BuildConflicts
of the parent of the package family. This method is not recursive
in any other sense.
This method returns pkgnames and other Depends-style string data in
a list-of-lists structure, unlike resolve_depends, which gives a
flat list of PkgVersion objects.
check_bdo_violations
my $bool = $self->check_bdo_violations;
Check if any packages in the Depends of this package are
BuildDependsOnly:true. If any violations found, warn about each
such case and return true. If not, return false.
All providers of each package name are checked and all alternatives
are tested. Only one warning is issued for each %n:Depends:%n'
combination over the lifetime of the fink process.
check_obsolete_violations
my $bool = $self->check_obsolete_violations;
Return a boolean indicating if any dependencies are "obsolete".
See the atom_is_obsolete method for details about the checking.
atom_is_obsolete
my $bool = $self->atom_is_obsolete($atom,$field);
Returns a boolean indicating if the first available provider of the
given dependency $atom in the given $field name is obsolete. All
versions of all providers of the given package name are checked
(versioning is disregarded). An undef is returned if nothing
satisfies the dependency atom.
If any obsolete dependencies are found, issue a warning. Only one
warning is issued for each %n:DEP_FIELDNAME:%n' combination over
the lifetime of the fink process.
match_package
my $result = Fink::PkgVersion->match_package($pkgspec, %opts);
Find a PkgVersion by matching a specification. Return undef on
failure.
Valid options are:
quiet
Don't print messages. Defaults to false.
provides
This parameter controls what happens if no PkgVersion matches
the given specification, but a virtual package does.
If this parameter is 'return', then the Fink::Package object
for the virtual package is returned. The caller should test
with $result->isa('Fink::Package') to determine what sort of
result it is looking at.
Otherwise, undef will be returned, just as if the specification
could not be resolved. The user will be warned that a virtual
package was encountered if not in quiet mode. This is the
default.
phase_fetch_deb
$self->phase_fetch_deb();
$self->phase_fetch_deb($conditional, $dryrun);
$self->phase_fetch_deb($conditional, $dryrun, @packages);
Download the .deb files for some packages. If @packages is not
specified, will fetch the .deb for only this packages.
If $conditional is true, .deb files will only be fetched if they're
not already present (defaults to false).
If $dryrun is true, .deb files won't actually be fetched, but the
process will be simulated (defaults to false).
fetch_deb
$self->fetch_deb($dryrun, @packages);
Unconditionally download the .deb files for some packages. Die if
apt-get fails.
fetch_source_if_needed
my $archive = $pv->fetch_source_if_needed($suffix);
Makes sure that the sourcefile indicated by $suffix is downloaded
and has the correct checksums. If the file can't be found, it is
downloaded. If it exists, but has the wrong checksums, we ask the
user what to do.
phase_activate
phase_activate @packages;
phase_activate \@packages, %opts;
Use dpkg to install a list of packages. The packages are passed as
PkgVersion objects. Stale buildlocks are automatically removed if
@packages is passed by reference. The following option is known:
no_clean_bl (optional)
If present and true, do not check for stale buildlocks.
phase_deactivate
phase_deactivate @packages;
phase_deactivate \@packages, %opts;
Use dpkg to remove a list of packages, but leave their ConfFiles in
place. The packages are passed by name (no versioning requirements
allowed). Only real packages can be removed, not "Provides"
virtuals. Stale buildlocks are automatically removed if @packages
is passed by reference. The following option is known:
no_clean_bl (optional)
If present and true, do not check for stale buildlocks.
phase_deactivate_recursive
phase_deactivate_recursive @packages;
Use apt to remove a list of packages and all packages that depend
on them, but leave their ConfFiles in place. The packages are
passed by name (no versioning requirements allowed). Only real
packages can be removed, not "Provides" virtuals. No explicit
processing of buildlocks is done: stale ones that depend on
packages to be deactivated will be removed and live buildlocks
cannot be removed even via recursive removal.
phase_purge
phase_purge @packages;
phase_purge \@packages, %opts;
Use dpkg to remove a list of packages, including their ConfFiles.
The packages are passed by name (no versioning requirements
allowed). Only real packages can be removed, not "Provides"
virtuals. Stale buildlocks are automatically removed if @packages
is passed by reference. The following option is known:
no_clean_bl (optional)
If present and true, do not check for stale buildlocks.
phase_purge_recursive
phase_purge_recursive @packages;
Use apt to remove a list of packages and all packages that depend
on them, including their ConfFiles. The packages are passed by name
(no versioning information). Only real packages can be removed, not
"Provides" virtuals. No explicit processing of buildlocks is done:
stale ones that depend on packages to be deactivated will be
removed and live buildlocks cannot be removed even via recursive
removal.
ensure_libcxx_prefix
my $prefix_path = ensure_libcxx_prefix;
Ensures that a path-prefix directory exists to use libcxx wrapper
for the C++ compilers. Returns the path to the resulting
directory.
ensure_clang_prefix
my $prefix_path = ensure_clang_prefix;
Ensures that a path-prefix directory exists to use clang compilers
Returns the path to the resulting directory.
ensure_gpp106_prefix
my $prefix_path = ensure_gpp106_prefix $arch;
Ensures that a path-prefix directory exists to make compilers
single-arch Returns the path to the resulting directory.
ensure_gpp_prefix
my $prefix_path = ensure_gpp_prefix $gpp_version;
Ensures that a path-prefix directory exists for the given version
of g++. Returns the path to the resulting directory.
package_error
$self->package_error %opts;
Issue an error message, for when part of the build process fails.
The following %opts are known:
phase (required)
The phase of the build process ("patching", "compiling",
"installing", etc.)
nonfatal (optional)
If defined and true, the message is issued as a warning and
program control returns rather than aborting the script.
preamble (optional)
Text displayed prior to the standard error-message block.
get_install_directory
my $dir = $pv->get_install_directory;
my $dir = $pv->get_install_directory $pkg;
Get the directory into which the install phase will put files. If
$pkg is specified, will get get the destdir for a package of that
full-name.
get_control_section
my $section = $pv->get_control_section();
Get the section of the package for the purposes of .deb control
files. May be distinct from get_section.
get_priority
my $prio = $pv->get_priority();
Get the apt priority of this package.
make_spec
my $spec = $pv-make_spec;
Make a unique specifier for this package object.
resolve_spec
my $pv = Fink::PkgVersion->resolve_spec($spec);
Find the PkgVersion corresponding to the given specifier. If none
exists, die! Invalid specifiers should NOT exist.
is_essential
my $bool = $pv->is_essential;
Returns whether or not this package is essential.
built_with_essential
my $bool = $pv->built_with_essential;
Returns true if and only if building this package involves also
building an essential package.
is_obsolete
my $bool = $pv->is_obsolete;
Returns true if the package is marked as obsolete. That status is
indicated by listing a Depends:fink-obsolete-packages.
info_level
my $info_level = $pv->info_level;
Get the value of N in the InfoN that wrapped this package, or 1
(one) if no InfoN wrapper was used.
dpkg_changed
Fink::PkgVersion->dpkg_changed;
This method should be called whenever the state of dpkg has
changed, ie: whenever packages are installed or removed. It makes
sure that caches of dpkg information are regenerated.
log_output
$self->log_output;
$self->log_output $loggable;
If the $loggable is true, open a logfile in /tmp and begin sending
a copy of all STDOUT and STDERR to it. The logfile must not already
exist (there is no "append" or "overwrite" mode). If $loggable is
false (or not given), the logfile is closed. Multiple logfiles
cannot be chained together. If one is already active, from any
PkgVersion object, attempting to open another one will first close
the previously-opened one.
_instscript
print DPKG_SCRIPT $self->_instscript(@args);
Returns a bash shell fragment that checks for the fink-instscripts
helper program and calls it using the given @args list. $args[0] is
the script name (preinst, postinst, prerm, postrm) and $args[1] is
the script action type (for example, updatepod). The meaning of the
remainder of @args depends on the specific script and action type.
get_full_trees
my @trees = $pv->get_full_trees;
Get the fink.conf trees in which this package is located. This
includes both the 'Archive' and 'Component', eg: 'stable/main'.
get_full_tree
my $trees = $pv->get_full_tree;
Get the highest priority tree in which this package is located.
get_shlibs_field
my $shlibs_field = $pv->get_shlibs_field;
Returns a multiline string of the Shlibs entries. Conditionals are
supported as prefix to a whole entry (not to specific dependencies
like a pkglist field). The string will always be defined, but will
be null if no entries, and every entry (even last) will have
trailing newline.
scanpackages
scanpackages;
Scan the packages for the packages we built this run.
pkg_build_as_user_group
$self->pkg_build_as_user_group();
If BuildAsNobody: false is set, return {qw/ user root group admin
user:group root:admin /}
Otherwise, return the results from
Fink::Config::build_as_user_group()Fink 0.36.3.1 2013-12-30 Fink::PkgVersion(3)