URPM man page on Mandriva

Man page or keyword search:  
man Server   17060 pages
apropos Keyword Search (all sections)
Output format
Mandriva 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 two fields:

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

	   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 [, $nopromoteepoch])
	   This utility function compares two version ranges, in order to
	   calculate dependencies properly. The ranges have roughly the form

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

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

	   If the optional parameter $nopromoteepoch is true, and if the 2nd
	   range has no epoch while the first one has one, then the 2nd range
	   is assumed to have an epoch "== 0".

	   Warning: $nopromoteepoch actually defaults to 1, so if you're going
	   to pass a variable, make sure undef is treated like 1, not 0.

       $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.

       $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

	   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).

       $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", "whatprovides", "whatrequires",
	   "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.

	   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.

       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.

       $db->traverse_tag($tag,$names,$callback)
	   $tag may be one of "name", "whatprovides", "whatrequires",
	   "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.

       $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)

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

   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()
       $package->conflicts_nosense()
       $package->description()
       $package->dirnames()
       $package->distribution()
       $package->epoch()
       $package->excludearchs()
       $package->exclusivearchs()
       $package->filelinktos()
       $package->files()
	   List of files in this rpm.

       $package->files_flags()
       $package->files_gid()
       $package->files_group()
       $package->files_md5sum()
       $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 4 element list: name, version, release and architecture
	   in an array context. Returns a string NAME-VERSION-RELEASE.ARCH in
	   scalar context.

       $package->get_tag($tagid)
	   Returns an array containing values of $tagid. $tagid is the
	   numerical value of rpm tags. See rpmlib.h.

       $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($tagid)
	   Return an array of human readable view of tag values. $tagid is the
	   numerical value of rpm tags.

       $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()
       $package->obsoletes_nosense()
       $package->obsoletes_overlap($s, [$nopromoteepoch, [$direction] ])
       $package->os()
       $package->pack_header()
       $package->packager()
       $package->payload_format()
       $package->provides()
       $package->provides_nosense()
       $package->provides_overlap($s, [$nopromoteepoch,] [$direction])
       $package->rate()
       $package->release()
       $package->requires()
       $package->requires_nosense()
       $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($name)
	   Adds a package to be erased to the transaction represented by
	   $trans.  $name is the name of the package.

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

	   Options are:

	       translate_message => 0 / 1 (currently ignored.)

	   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.

	   Recognized options are:

	       callback_close  => 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).

       $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.

       setVerbosity($level)
	   Sets rpm verbosity level. $level is an integer between 2
	   (RPMMESS_CRIT) and 7 (RPMMESS_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.

   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 ]

       whatrequires: { 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 Mandriva SA

       Francois Pons (original author), Rafael Garcia-Suarez, Pixel
       <pixel@mandriva.com> (current maintainer)

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

perl v5.10.1			  2010-11-18			       URPM(3)
[top]

List of man pages available for Mandriva

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