URPM man page on OpenMandriva

Man page or keyword search:  
man Server   8135 pages
apropos Keyword Search (all sections)
Output format
OpenMandriva logo
[printable version]

URPM(3)		      User Contributed Perl Documentation	       URPM(3)

NAME
       URPM - Manipulate RPM files and headers

SYNOPSIS
	   use URPM;

	   # using the local RPM database
	   my $db = URPM::DB::open();
	   $db->traverse(sub {
	       my ($package) = @_; # this is a URPM::Package object
	       print $package->name, "\n";
	       # ...
	   });

	   # loading and parsing a synthesis file
	   my $urpm = new URPM;
	   $urpm->parse_synthesis("synthesis.sample.cz");
	   $urpm->traverse(sub {
	       # retrieve all packages from the dependency list
	       # ...
	   });

DESCRIPTION
       The URPM module allows you to manipulate RPM files, RPM header files
       and hdlist files and manage them in memory. It is notably used by the
       urpmi utility. It provides four classes : "URPM", "URPM::DB",
       "URPM::Package", and "URPM::Transaction".

   The URPM class
       URPM->new()
	   The constructor creates a new, empty URPM object. It's a blessed
	   hash that contains three fields:

	   ·   depslist is an arrayref containing the list of depending
	       packages (which are "URPM::Package" objects).

	   ·   obsoletes is an hashref containing as keys the list of property
	       names obsoleted by the URPM object.

	   ·   provides is an hashref containing as keys the list of property
	       names provided by the URPM object. The associated value is true
	       if the property is versioned.

	   If the constructor is called with the arguments "nofatal => 1",
	   various fatal error messages are suppressed (file not found in
	   parse_hdlist() and parse_synthesis()).

       URPM::read_config_files()
	   Force the re-reading of the RPM configuration files.

       URPM::ranges_overlap($range1, $range2)
	   This utility function compares two version ranges, in order to
	   calculate dependencies properly. The ranges have roughly the form

	       [<|<=|==|=>|>] [epoch:]version[-release][:distepoch]

	   where epoch, version, release and distepoch are RPM-style version
	   numbers.

       URPM::rpmEVRcmp($a, $b)
	   Segmented string compare.

       URPM::rpmEVRcompare($a, $b)
	   Compare EVR containers for equality.

       $urpm->parse_synthesis($file [, callback => sub {...} ])
	   This method gets the depslist and the provides from a synthesis
	   file and adds them to the URPM object.

	   Callback signature is callback("URPM", "URPM::Package").

	   The return value is a two-element array containing the first and
	   the last id parsed.

       $urpm->parse_hdlist($file, %options)
	   This method loads rpm informations from rpm headers contained in an
	   hdlist file and adds them to the URPM object. Allowed options are

	       packing => 0 / 1
	       callback => sub { ... }
	       keep_all_tags => 0 / 1

	   Callback signature is callback("URPM", "URPM::Package").

	   The return value is a two-element array containing the first and
	   the last id parsed.

       $urpm->parse_rpm($file, %options)
	   This method gets the depslist and the provides from an RPM file and
	   adds them to the URPM object. Allowed options are

	       packing => 0 / 1
	       keep_all_tags => 0 / 1
	       callback => sub { ... }

	   If "keep_all_tags" isn't specified, URPM will drop all memory-
	   consuming tags (notably changelogs, filelists, scriptlets).

	   Callback signature is callback(URPM::Package).

       $urpm->packages_providing($name)
	   Returns a list of "URPM::Package" providing <$name>

       $urpm->packages_by_name($name)
	   Returns a list of "URPM::Package" corresponding to the wanted
	   <$name>

       $urpm->search($name, %options)
	   Search an RPM by name or by part of name in the list of RPMs
	   represented by this $urpm. The behaviour of the search is
	   influenced by several options:

	       strict_name => 0 / 1
	       strict_fullname => 0 / 1
	       src => 0 / 1

       $urpm->traverse($callback)
	   Executes the callback for each package in the depslist, passing a
	   "URPM::Package" object as argument the callback.

	   This is used when faking a URPM::DB: $urpm can be used as-a $db

       $urpm->traverse_tag($tag, $names, $callback)
	   $tag may be one of "name", "providename", "requirename",
	   "whatconflicts", "group", "triggeredby", or "path".	$names is a
	   reference to an array, holding the acceptable values of the said
	   tag for the searched variables.  Then, $callback is called for each
	   matching package in the depslist.

	   Callback signature is callback(URPM::Package).

	   This is used when faking a URPM::DB: $urpm can be used as-a $db

       $urpm->traverse_tag_find($tag,$name,$callback)
	   Quite similar to "traverse_tag", but stops when $callback returns
	   true.

	   (also note that only one $name is handled)

	   Callback signature is callback(URPM::Package).

	   This is used when faking a URPM::DB: $urpm can be used as-a $db

       URPM::verify_rpm($file, %options)
	   Verifies an RPM file.  Returns 0 on failure, 1 on success.
	   Recognized options are:

	       nodigests => 0 / 1
	       nosignatures => 0 / 1

       URPM::verify_signature($file)
	   Verifies the signature of an RPM file. Returns a string that will
	   contain "OK" or "NOT OK" as well as a description of the found key
	   (if successful) or of the error (if signature verification failed.)

       $urpm->import_pubkey(%options)
	   Imports a key in the RPM database.

	       db => $urpm_db
	       root => '...'
	       block => '...'
	       filename => '...'

       URPM::spec2srcheader($specfile)
	   Returns a URPM::Package object containing the header of the source
	   rpm produced by the evaluation of the specfile whose path is given
	   as argument. All dependencies stored in this header are exactly the
	   one needed to build the specfile.

   The URPM::DB class
       open($prefix, $write_perm)
	   Returns a new "URPM::DB" object pointing on the local RPM database
	   (or "undef" on failure).

	   $prefix defaults to "" and indicates the RPM DB root directory
	   prefix if any. (See the --root option to rpm(1)).

	   $write_perm is a boolean that defaults to false, and that indicates
	   whether the RPM DB should be open in read/write mode.

       info($prefix)
	   Return berkeley db type and byte ordering of it in an array
	   (@(type, ordering)).	 If type is unknown, 'array' will be
	   undefined, if database is empty, 'ordering' will be undefined.  If
	   no rpm database is found under $prefix, 0 will be returned.

       convert($prefix, $type, $swap=0, $rebuild=0)
	   Convert the rpmdb in $prefix to $type (only "hash" and "btree" is
	   currently supported).  If $swap is 1, swab to big endian, if -1,
	   swab to little endian.  If $rebuild is true, rebuild the rpmdb
	   after the conversion.

       rebuild($prefix)
	   Rebuilds the RPM database (like "rpm --rebuilddb"). $prefix
	   defaults to "".

       $db->traverse($callback)
	   Executes the specified callback (a code reference) for each package
	   in the DB, passing a "URPM::Package" object as argument the
	   callback.

	   Returns the number of packages seen (all).

       $db->traverse_tag($tag,$names,$callback)
	   $tag may be one of "name", "providename", "requirename",
	   "whatconflicts", "group", "triggeredby", or "path".	$names is a
	   reference to an array, holding the acceptable values of the said
	   tag for the searched variables.  Then, $callback is called for each
	   matching package in the DB.

	   Callback signature is callback(URPM::Package).

	   Returns the number of packages seen (all those that matched
	   provided names).

       $db->traverse_tag_find($tag,$name,$callback)
	   Quite similar to "traverse_tag", but stops when $callback returns
	   true.

	   (also note that only one $name is handled)

	   Callback signature is callback(URPM::Package).

	   Returns whether callback returned true once.

       $db->create_transaction()
	   Creates and returns a new transaction (an "URPM::Transaction"
	   object) on the specified DB.

   The URPM::Package class
       Most methods of "URPM::Package" are accessors for the various
       properties of an RPM package.

       $package->arch()
	   Gives the package architecture

       $package->build_header($fileno)
	   Writes the rpm header to the specified file ($fileno being an
	   integer).

       $package->build_info($fileno, [$provides_files])
	   Writes a line of information in a synthesis file.

       $package->buildarchs()
       $package->buildhost()
       $package->buildtime()
       $package->changelog_name()
       $package->changelog_text()
       $package->changelog_time()
       $package->compare($evr)
       $package->compare_pkg($other_pkg)
       $package->conf_files()
       $package->conflicts()
	   Full conflicts tags

       $package->conflicts_nosense()
	   Just the conflicted package name.  This is only used when faking a
	   URPM::DB: $urpm can be used as-a $db

       $package->description()
       $package->dirnames()
       $package->distribution()
       $package->epoch()
       $package->EVR()
       $package->excludearchs()
       $package->exclusivearchs()
       $package->filelinktos()
       $package->files()
	   List of files in this rpm.

       $package->files_digest()
       $package->files_flags()
       $package->files_gid()
       $package->files_group()
       $package->files_mode()
       $package->files_mtime()
       $package->files_owner()
       $package->files_size()
       $package->files_uid()
       $package->flag($name)
       $package->flag_available()
       $package->flag_base()
       $package->flag_disable_obsolete()
       $package->flag_installed()
       $package->flag_requested()
       $package->flag_required()
       $package->flag_selected()
       $package->flag_skip()
       $package->flag_upgrade()
       $package->free_header()
       $package->fullname()
	   Returns a 6 element list: name, version, release, disttag,
	   distepoch and architecture in an array context. Returns a string
	   NAME-VERSION-RELEASE[-DISTTAGDISTEPOCH].ARCH in scalar context.

       $package->get_tag($tagname)
	   Returns an array containing values of $tagname. $tagname is the
	   name of a valid rpm tag.

       $package->queryformat($format)
	   Querying the package like rpm --queryformat do.

	   The function calls directly the rpmlib, then use header
	   informations, so it silently failed if you use synthesis instead of
	   hdlist/rpm/header files or rpmdb.

       $package->get_tag_modifiers($tagname)
	   Return an array of human readable view of tag values. $tagname is
	   the name of a valid rpm tag.

       $package->group()
       $package->id()
       $package->installtid()
       $package->is_arch_compat()
	   Returns whether this package is compatible with the current
	   machine's architecture. 0 means not compatible. The lower the
	   result is, the preferred the package is.

       $package->is_platform_compat()
	   Return whether this package is compatible with the current
	   machine's platform configuration (/etc/rpm/platform). 0 mean not
	   compatible.	The lower the result is the preferred the package is.

       $package->license()
       $package->name()
	   The rpm's bare name.

       $package->obsoletes()
	   Full obsoletes tags =item $package->obsoletes_nosense()

	   Just the obsoleted package name.  =item
	   $package->obsoletes_overlap($s)

       $package->os()
       $package->pack_header()
       $package->packager()
       $package->payload_format()
       $package->provides()
	   Full provides tags =item $package->provides_nosense()

	   Just the provided package name.  =item
	   $package->provides_overlap($s)

       $package->rate()
       $package->release()
       $package->requires()
	   Full requires tags

       $package->requires_nosense()
	   Just the required package name.

       $package->rflags()
       $package->filesize()
	   Size of the rpm file (ie the rpm header + cpio body)

       $package->set_flag($name, $value)
       $package->set_flag_base($value)
       $package->set_flag_disable_obsolete($value)
       $package->set_flag_installed($value)
       $package->set_flag_requested($value)
       $package->set_flag_required($value)
       $package->set_flag_skip($value)
       $package->set_flag_upgrade($value)
       $package->set_id($id)
       $package->set_rate($rate)
       $package->set_rflags(...)
       $package->size()
       $package->sourcerpm()
       $package->summary()
       $package->update_header($filename, ...)
       $package->url()
       $package->vendor()
       $package->version()

   The URPM::Transaction class
       $trans->set_script_fd($fileno)
	   Sets the transaction output filehandle.

       $trans->add($pkg, %options)
	   Adds a package to be installed to the transaction represented by
	   $trans.  $pkg is an "URPM::Package" object.

	   Options are:

	       update => 0 / 1 : indicates whether this is an upgrade
	       excludepath => [ ... ]

       $trans->remove($keyp, [$tagname = "nvra"])
	   Adds a package to be erased to the transaction represented by
	   $trans.  $keyp is by default the full name of the package, unless a
	   different tag to match has been specified with $tagname.

       $trans->check(%options)
	   Checks that all dependencies can be resolved in this transaction.

	   Options are:

	       raw_message => 0 / 1
	       translate_message => 0 / 1

	   In list context, returns an array of problems (an empty array
	   indicates success).

       $trans->order()
	   Determines package order in a transaction set according to
	   dependencies. In list context, returns an array of problems (an
	   empty array indicates success).

       $trans->run($data, %options)
	   Runs the transaction.

	   $data is an arbitrary user-provided piece of data to be passed to
	   callbacks.  It's usually the $urpm object.

	   Recognized options are:

	       callback_close  => sub { ... }
	       callback_error  => sub { ... }
	       callback_inst   => sub { ... }
	       callback_open   => sub { ... }
	       callback_trans  => sub { ... }
	       callback_uninst => sub { ... }
	       delta => used for progress callbacks (trans, uninst, inst)
	       excludedocs => 0 / 1
	       force => 0 / 1
	       ignorearch => 0 / 1
	       nosize => 0 / 1
	       noscripts => 0 / 1
	       oldpackage => 0 / 1
	       repackage => 0 / 1
	       test => 0 / 1
	       translate_message => 1

	   They roughly correspond to command-line options to rpm(1).

	   'callback_open' signature is ($data, $cb_type, $pkg_id). It _must_
	   return a file handler for the asked package.

	   'callback_close' signature is ($data, $cb_type, $pkg_id). It is
	   called just before URPM close the fd for the installed package.

	   $cb_type is one of 'open' or 'close'.

	   Other Callbacks signature is callback($data, $cb_type, $pkg_id,
	   $subtype, $amout, $total)

	   $cb_type is one of 'error', 'inst', 'trans' or 'uninst'. $subtype
	   can be 'start', 'progress' or 'stop'.  For 'error', it can be
	   'cpio', 'script' or 'unpack'.

	   The purpose of those callbacks is to report progress (the two last
	   parameters ($amount & $total) enable to compute progress
	   percentage).

       $trans->traverse($callback)
	   Executes the specified callback (a code reference) for each package
	   in the transaction, passing a "URPM::Package" object as argument
	   the callback.

   Macro handling functions
       loadmacrosfile($filename)
	   Load the specified macro file. Sets $! if the file can't be read.

       expand($name)
	   Expands the specified macro.

       add_macro($macro_definition)
       add_macro_noexpand($macro_definition)
	   Define a macro. For example,

	       URPM::add_macro("vendor Mandriva");
	       my $vendor = URPM::expand("%vendor");

	   The 'noexpand' version doesn't expand literal newline characters in
	   the macro definition.

       del_macro($name)
	   Delete a macro.

       resetmacros()
	   Destroys macros.

   Misc other functions
   Misc other functions
       setVerbosity($level)
	   Sets rpm verbosity level. $level is an integer between 0
	   (RPMLOG_EMERG) and 7 (RPMLOG_DEBUG).

       rpmErrorString()
       rpmErrorWriteTo($fd)
       platformscore($platform)
	   Return the score of $platform according computer's configuration.
	   0 mean not compatible, lower is prefered.

       archscore($arch)
	   Return the score of the given arch. 0 mean not compatible, lower is
	   prefered.

       osscore($os)
	   Return the score of the given os. 0 mean not compatible, lower is
	   prefered.

       rpmtag_from_string($tagstring)
	   Returns integer constant value of $tagstring.

   The $state object
       It has the following fields:

       backtrack: {
	  selected => { id => undef },
	  deadlock => { id|property => undef },
	}

       cached_installed: { property_name => { fullname => undef } }

       oldpackage: int
	  # will be passed to $trans->run to set RPMPROB_FILTER_OLDPACKAGE

       selected: { id => {
	    requested => bool, install => bool,
	    from => pkg, psel => pkg,
	    promote => name, unsatisfied => [ id|property ]
	} }

       rejected: { fullname => {
	    size => int, removed => { fullname|"asked" => undef },
	    obsoleted => { fullname|"asked" => undef },
	    backtrack => { # those info are only used to display why package
       is unselected
		promote => [ name ], keep => [ fullname ],
		unsatisfied => [ id|property ],
		conflicts => [ fullname ],
	    },
	    closure => { fullname => { old_requested => bool,
				       unsatisfied => [ id|property ],
				       conflicts => property },
				       avoid => bool },
	    },
	} }

       rejected_already_installed: { id => pkg }

       orphans_to_remove: [ pkg ]

       requirename: { name => { id => undef } }
	  # reversed requires_nosense for selected packages

       unselected_uninstalled: [ pkg ]
	  # (old) packages which are needed, but installed package is newer

       more fields only used in build_transaction_set and its callers):

       transaction: [ { upgrade => [ id ], remove => [ fullname ] } ]

       transaction_state: $state object

COPYRIGHT
       Copyright 2002, 2003, 2004, 2005 MandrakeSoft SA

       Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011 Mandriva SA

       Francois Pons (original author), Rafael Garcia-Suarez, Pascal "Pixel"
       Rigaux, Christophe Fergeau, Per Xyvind Karlsen <peroyvind@mandriva.org>
       (current maintainer)

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

perl v5.16.3			  2014-04-02			       URPM(3)
[top]

List of man pages available for OpenMandriva

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net