Libzypp/ZMD/ZMD7/sqlite

< Libzypp‎ | ZMD
Şuraya atla: kullan, ara

sqlite API for ZMD7.1 (Defender)

Last updated: Mon Jan 30 13:48:12 EET 2006 Written by: Tambet Ingo (tambet@ximian.com)


ZYPP backend for zmd.


Helpers

  • find-file

Syntax:
find-file <database> <filename>

Find packages that own the given file. The ids of found packages are taken from the packages table and their ids are printed to standard output. Note that this (currently?) works only with local and installed packages. All warnings and errors are written to standard error using the common messaging format defined below. The helper returns 0 on success and anything else in case of failure.


  • package-files

Syntax:
package-files <database> <package id>

Used to read package contents. The helper first gets the package from packages table by id and then queries it's file list from the system package management database. The result is written to files table. All warnings and errors are written to standard error using the common messaging format defined below. The helper returns 0 on success and anything else in case of failure.


  • query-files

Syntax:
query-files <database> <uri> [catalog id]

Used to query package files on the local file system and produce metadata. The uri argument must start with 'file://' and contain path to local file or directory. If the uri points to a directory, the uri can contain an additional query part 'recursive' which makes the helper to scan the directory itself plus all it's subdirectories. Some examples of correct uris:

file:///tmp/packages/perl-5.8.6-2.i586.rpm
file://tmp/packages?recursive=1

Metadata of all found packages is written to the packages table. If the command line had catalog id, it's written to the 'channel' field, otherwise a well known id '@local' is used. All warnings and errors are written to standard error using the common messaging format defined below. The helper returns 0 on success and anything else in case of failure.


  • query-system

Syntax:
query-system <database>

Used to read installed packages from system package manager. The result is written to packages table with a well known catalog id '@system'. All warnings and errors are written to standard error using the common messaging format defined below. The helper returns 0 on success and anything else in case of failure.


  • resolve-dependencies

Syntax:
resolve-dependencies <database> [verify]

Used to resolve dependencies. Proposed transaction is read from the transactions table. Rows are defined as:

action - 0 for removals and 1 for installations
id - id of the resolvable

All available and installed resolvables must be read from packages table, zmd is responsible for populating it. System packages should not be touched. The results are added to the transactions table with appropriate message in 'details' field. If the optional verify argument is used, the system's internal dependency tree is checked and if it's not clean, suggested changes are written to the transactions table with appropriate messages. In case of dependency failures, the error message is written to the standard output, one item per line. All warnings and errors are written to standard error using the common messaging format defined below. The helper returns 0 on success and anything else in case of failure.


  • transact

Syntax:
transact <database> [dry-run]

As the helper name indicates, transact. Available packages are read from packages table. Proposed changes are read from the transactions table. Progress reporting is written to standard output and the format depends on the type of the progress message. Here's the full list:

Transaction start message:
0|total steps(int)

Transaction step message:
1|sequence number(int)|step(int)|message(string)

Transaction progress step message:
2|amount(int)|total(int)

Transaction failure message:
3|message(string)

Transaction done message:
4

All warnings and errors are written to standard error using the common messaging format defined below. The helper returns 0 on success and anything else in case of failure.


Logging

The logging is usually implemented over standard error. Messages produced by helpers are in the following format, one message per line.

Log level|Error message

Log level is one of the following:
Always  -1
Never    0
Error    1
Critical 2
Warning  3
Message  4
Info     5
Debug    6

Tables

catalogs

	id VARCHAR PRIMARY KEY
	name VARCHAR
	alias VARCHAR
	description VARCHAR
	priority INTEGER
	priority_unsubd INTEGER

dependencies

	resolvable_id INTEGER NOT NULL
	dep_type INTEGER NOT NULL
	name VARCHAR
	version VARCHAR
	release VARCHAR
	epoch INTEGER
	arch INTEGER
	relation INTEGER

resolvable_id is the foreign key for resolvables.id.
dep_type is one of the following:
0 - require
1 - provide
2 - conflict
3 - obsolete

arch is one of the following:
-1 - Unknown
0 - Noarch,
1 - i386
2 - i486
3 - i586
4 - i686
5 - x86_64
6 - IA32E
7 - Athlon
8 - PPC
9 - PPC64
10 - S390
11 - S390X
12 - IA64

relation is one of the following:
-1 - Invalid
0 - Any
1 - Equal
2 - Less
3 - Less or equal
4 - Greater
5 - Greater or equal
6 - Not equal
7 - None

files

	resolvable_id INTEGER NOT NULL
	filename VARCHAR
	size INTEGER
	md5sum VARCHAR
	uid INTEGER
	gid INTEGER
	mode INTEGER
	mtime INTEGER
	ghost INTEGER
	link_target VARCHAR

resolvable_id is the foreign key for resolvables.id.
ghost is either 0 or 1 (from RPM header).
link_target is set if the entry is link.

locks

	id INTEGER PRIMARY KEY AUTOINCREMENT
	name VARCHAR
	version VARCHAR
	release VARCHAR
	epoch INTEGER
	arch INTEGER
	relation INTEGER
	catalog VARCHAR
	glob VARCHAR
	importance INTEGER
	importance_gteq INTEGER

arch: See dependencies.arch
relation: See dependencies.relation
catalog: catalogs.id
importance: one of the following:
-1 - Invalid
0 - Necessary
1 - Urgent
2 - Suggested
3 - Feature
4 - Minor

importance_gteq is 1 if the importance should be greater or equal or
0 otherwise.

resolvables

	id INTEGER PRIMARY KEY AUTOINCREMENT
	name VARCHAR
	version VARCHAR
	release VARCHAR
	epoch INTEGER
	arch INTEGER
	file_size INTEGER
	installed_size INTEGER
	catalog VARCHAR
	installed INTEGER
	local INTEGER
	install_only INTEGER

arch: See dependencies.arch.
catalog: catalogs.id
local: 1 if resolvable is on local file system, 0 otherwise.
install_only: Don't upgrade this resolvable, install it.

package_details

	resolvable_id INTEGER NOT NULL
	section INTEGER
	summary VARCHAR
	description VARCHAR
	package_filename VARCHAR
	signature_filename VARCHAR

resolvable_id is the foreign key for resolvables.id.
section: remove me.

packages (SQL VIEW, read only)
	CREATE VIEW packages AS SELECT * FROM resolvables, package_details
	WHERE resolvables.id = package_details.resolvable_id;

transactions

	action INTEGER
	id INTEGER
	details VARCHAR

action: 0 - remove, 1 - install.
id: resolvables.id

Last edit in Trac '02/03/06 11:44:57' by 'kkaempf'


Last edit in Trac '02/03/06 11:44:57' by 'kkaempf'


Last edit in Trac '02/03/06 11:44:57' by 'kkaempf'


Last edit in Trac '02/03/06 11:44:57' by 'kkaempf'