ZIF Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy |
#define ZIF_PACKAGE_ERROR enum ZifPackageEnsureType; enum ZifPackageTrustKind; enum ZifPackageCompareMode; enum ZifPackageCompareFlags; struct ZifPackage; struct ZifPackageClass; enum ZifPackageError; GQuark zif_package_error_quark (void
); ZifPackage * zif_package_new (void
); const gchar * zif_package_get_id (ZifPackage *package
); const gchar * zif_package_get_id_basic (ZifPackage *package
); const gchar * zif_package_get_printable (ZifPackage *package
); const gchar * zif_package_get_name_arch (ZifPackage *package
); const gchar * zif_package_get_name_version (ZifPackage *package
); const gchar * zif_package_get_name_version_arch (ZifPackage *package
); const gchar * zif_package_get_name (ZifPackage *package
); const gchar * zif_package_get_version (ZifPackage *package
); const gchar * zif_package_get_version_arch (ZifPackage *package
); const gchar * zif_package_get_arch (ZifPackage *package
); const gchar * zif_package_get_data (ZifPackage *package
); ZifPackageTrustKind zif_package_get_trust_kind (ZifPackage *package
); const gchar * zif_package_get_summary (ZifPackage *package
,ZifState *state
,GError **error
); const gchar * zif_package_get_description (ZifPackage *package
,ZifState *state
,GError **error
); const gchar * zif_package_get_license (ZifPackage *package
,ZifState *state
,GError **error
); const gchar * zif_package_get_url (ZifPackage *package
,ZifState *state
,GError **error
); const gchar * zif_package_get_filename (ZifPackage *package
,ZifState *state
,GError **error
); const gchar * zif_package_get_category (ZifPackage *package
,ZifState *state
,GError **error
); const gchar * zif_package_get_group (ZifPackage *package
,ZifState *state
,GError **error
); const gchar * zif_package_get_pkgid (ZifPackage *package
); const gchar * zif_package_get_cache_filename (ZifPackage *package
,ZifState *state
,GError **error
); const gchar * zif_package_get_source_filename (ZifPackage *package
,ZifState *state
,GError **error
); GFile * zif_package_get_cache_file (ZifPackage *package
,ZifState *state
,GError **error
); guint64 zif_package_get_size (ZifPackage *package
,ZifState *state
,GError **error
); GPtrArray * zif_package_get_files (ZifPackage *package
,ZifState *state
,GError **error
); GPtrArray * zif_package_get_requires (ZifPackage *package
,ZifState *state
,GError **error
); GPtrArray * zif_package_get_provides (ZifPackage *package
,ZifState *state
,GError **error
); GPtrArray * zif_package_get_obsoletes (ZifPackage *package
,ZifState *state
,GError **error
); GPtrArray * zif_package_get_conflicts (ZifPackage *package
,ZifState *state
,GError **error
); guint64 zif_package_get_time_file (ZifPackage *package
); gboolean zif_package_provides (ZifPackage *package
,ZifDepend *depend
,ZifDepend **satisfies
,ZifState *state
,GError **error
); gboolean zif_package_conflicts (ZifPackage *package
,ZifDepend *depend
,ZifDepend **satisfies
,ZifState *state
,GError **error
); gboolean zif_package_requires (ZifPackage *package
,ZifDepend *depend
,ZifDepend **satisfies
,ZifState *state
,GError **error
); gboolean zif_package_obsoletes (ZifPackage *package
,ZifDepend *depend
,ZifDepend **satisfies
,ZifState *state
,GError **error
); const gchar * zif_package_get_package_id (ZifPackage *package
); void zif_package_print (ZifPackage *package
); gboolean zif_package_is_devel (ZifPackage *package
); gboolean zif_package_is_gui (ZifPackage *package
); gboolean zif_package_is_installed (ZifPackage *package
); gboolean zif_package_is_free (ZifPackage *package
); gboolean zif_package_is_native (ZifPackage *package
); gint zif_package_compare (ZifPackage *a
,ZifPackage *b
); gint zif_package_compare_full (ZifPackage *a
,ZifPackage *b
,ZifPackageCompareFlags flags
); gboolean zif_package_is_compatible_arch (ZifPackage *a
,ZifPackage *b
); const gchar * zif_package_ensure_type_to_string (ZifPackageEnsureType type
); const gchar * zif_package_trust_kind_to_string (ZifPackageTrustKind trust_kind
); void zif_package_set_compare_mode (ZifPackage *package
,ZifPackageCompareMode compare_mode
); ZifPackageCompareMode zif_package_compare_mode_from_string (const gchar *value
); const gchar * zif_package_compare_mode_to_string (ZifPackageCompareMode value
);
GObject +----ZifPackage +----ZifPackageLocal +----ZifPackageMeta +----ZifPackageRemote +----ZifPackageRhn
typedef enum { ZIF_PACKAGE_ENSURE_TYPE_FILES, ZIF_PACKAGE_ENSURE_TYPE_SUMMARY, ZIF_PACKAGE_ENSURE_TYPE_LICENCE, ZIF_PACKAGE_ENSURE_TYPE_DESCRIPTION, ZIF_PACKAGE_ENSURE_TYPE_URL, ZIF_PACKAGE_ENSURE_TYPE_SIZE, ZIF_PACKAGE_ENSURE_TYPE_GROUP, ZIF_PACKAGE_ENSURE_TYPE_CATEGORY, ZIF_PACKAGE_ENSURE_TYPE_REQUIRES, ZIF_PACKAGE_ENSURE_TYPE_PROVIDES, ZIF_PACKAGE_ENSURE_TYPE_CONFLICTS, ZIF_PACKAGE_ENSURE_TYPE_OBSOLETES, ZIF_PACKAGE_ENSURE_TYPE_CACHE_FILENAME, ZIF_PACKAGE_ENSURE_TYPE_SOURCE_FILENAME, /* Since: 0.2.5 */ ZIF_PACKAGE_ENSURE_TYPE_LAST } ZifPackageEnsureType;
typedef enum { ZIF_PACKAGE_TRUST_KIND_UNKNOWN, /* must be first */ ZIF_PACKAGE_TRUST_KIND_NONE, ZIF_PACKAGE_TRUST_KIND_PUBKEY, ZIF_PACKAGE_TRUST_KIND_PUBKEY_UNVERIFIED, /* Since: 0.2.4 */ ZIF_PACKAGE_TRUST_KIND_LAST } ZifPackageTrustKind;
typedef enum { ZIF_PACKAGE_COMPARE_MODE_VERSION, ZIF_PACKAGE_COMPARE_MODE_DISTRO, ZIF_PACKAGE_COMPARE_MODE_UNKNOWN } ZifPackageCompareMode;
typedef enum { ZIF_PACKAGE_COMPARE_FLAG_CHECK_NAME = 1, ZIF_PACKAGE_COMPARE_FLAG_CHECK_ARCH = 2, ZIF_PACKAGE_COMPARE_FLAG_CHECK_INSTALLED = 4, ZIF_PACKAGE_COMPARE_FLAG_CHECK_VERSION = 8, ZIF_PACKAGE_COMPARE_FLAG_CHECK_DATA = 16, ZIF_PACKAGE_COMPARE_FLAG_CHECK_LAST } ZifPackageCompareFlags;
struct ZifPackageClass { GObjectClass parent_class; /* vtable */ gboolean (*ensure_data) (ZifPackage *package, ZifPackageEnsureType type, ZifState *state, GError **error); /* Padding for future expansion */ void (*_zif_reserved1) (void); void (*_zif_reserved2) (void); void (*_zif_reserved3) (void); void (*_zif_reserved4) (void); };
typedef enum { ZIF_PACKAGE_ERROR_FAILED, ZIF_PACKAGE_ERROR_NO_SUPPORT, ZIF_PACKAGE_ERROR_LAST } ZifPackageError;
GQuark zif_package_error_quark (void
);
Returns : |
An error quark. |
Since 0.1.0
ZifPackage * zif_package_new (void
);
Returns : |
A new ZifPackage instance. |
Since 0.1.0
const gchar * zif_package_get_id (ZifPackage *package
);
Gets the id uniquely identifying the package in all repos.
|
A ZifPackage |
Returns : |
A PackageId representing the package. |
Since 0.1.0
const gchar * zif_package_get_id_basic (ZifPackage *package
);
Gets the package ID without the ":repo" suffix.
|
A ZifPackage |
Returns : |
A PackageId representing the package. |
Since 0.2.5
const gchar * zif_package_get_printable (ZifPackage *package
);
Gets a string that identifies the package, and is printable
|
A ZifPackage |
Returns : |
A nice string, e.g. "hal-0.5.4-2.fc13.i386 (fedora)" |
Since 0.1.3
const gchar * zif_package_get_name_arch (ZifPackage *package
);
Gets a string which is the package name and architecture. This is often useful for matching on a multiarch system.
|
A ZifPackage |
Returns : |
A name.arch key string, e.g. "hal.i386" |
Since 0.1.6
const gchar * zif_package_get_name_version (ZifPackage *package
);
Gets a string which is the package name and version.
|
A ZifPackage |
Returns : |
A name-version key string, e.g. "hal-0.5.8-1.fc16" |
Since 0.2.4
const gchar * zif_package_get_name_version_arch (ZifPackage *package
);
Gets a string which is the package name, version and arch.
|
A ZifPackage |
Returns : |
A name-version.arch key string, e.g. "hal-0.5.8-1.fc16.i386" |
Since 0.2.4
const gchar * zif_package_get_name (ZifPackage *package
);
Gets the package name.
|
A ZifPackage |
Returns : |
The package name. |
Since 0.1.0
const gchar * zif_package_get_version (ZifPackage *package
);
Gets the package version.
|
A ZifPackage |
Returns : |
The package version, e.g. "0.1.2". |
Since 0.1.1
const gchar * zif_package_get_version_arch (ZifPackage *package
);
Gets a string which is the version and arch.
|
A ZifPackage |
Returns : |
A version.arch key string, e.g. "0.5.8-1.fc16.i386" |
Since 0.2.9
const gchar * zif_package_get_arch (ZifPackage *package
);
Gets the package architecture, e.g. "i386".
|
A ZifPackage |
Returns : |
The package architecture. |
Since 0.1.1
const gchar * zif_package_get_data (ZifPackage *package
);
Gets the package source data, e.g. "fedora".
|
A ZifPackage |
Returns : |
The package data. |
Since 0.1.1
ZifPackageTrustKind zif_package_get_trust_kind (ZifPackage *package
);
Gets the package trusted status. Packages that are trusted are usually signed by a trusted private key.
The trust value ZIF_PACKAGE_TRUST_KIND_PUBKEY
will not be set on a
package until zif_transaction_prepare()
has been called and the
actual package has been downloaded and verified.
Packages that are supposed to be trusted but cannot be verified have
the trust value ZIF_PACKAGE_TRUST_KIND_PUBKEY_UNVERIFIED
. This is
_only_ an indication that the repository that the package is supposed
to come from has public key signing enabled.
|
A ZifPackage |
Returns : |
The ZifPackageTrustKind enumerated type. |
Since 0.1.3
const gchar * zif_package_get_summary (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the package summary.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
A string or NULL
|
Since 0.1.0
const gchar * zif_package_get_description (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the package description.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
A string or NULL
|
Since 0.1.0
const gchar * zif_package_get_license (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the package licence.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
A string or NULL
|
Since 0.1.0
const gchar * zif_package_get_url (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the homepage URL for the package.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
A string or NULL
|
Since 0.1.0
const gchar * zif_package_get_filename (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the remote filename for the package, e.g. Packages/net-snmp-5.4.2-3.fc10.i386.rpm
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
A string or NULL
|
Since 0.1.0
const gchar * zif_package_get_category (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the category the packag is in.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
A string or NULL
|
Since 0.1.0
const gchar * zif_package_get_group (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the package group.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
A group name string |
Since 0.1.0
const gchar * zif_package_get_pkgid (ZifPackage *package
);
Gets the package pkgid, which is normally the SHA1 hash of the header. Every package has a pkgid, either virtual, local or remote. This function cannot fail.
|
A ZifPackage |
Returns : |
A SHA1 string |
Since 0.1.3
const gchar * zif_package_get_cache_filename (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the filename used to create this package when using
zif_package_local_set_from_filename()
for a local package or the
filename of the cached file for a remote package.
For example, the full local path of a remote package would be: /var/cache/yum/i386/fedora/hal-0.5.7-1.fc13.rpm
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
The package filename, or NULL
|
Since 0.1.3
const gchar * zif_package_get_source_filename (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the source RPM filename.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
The source RPM filename, or NULL
|
Since 0.2.5
GFile * zif_package_get_cache_file (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the GFile used to create this package when using
zif_package_local_set_from_filename()
for a local package or the
filename of the cached file for a remote package.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
The package GFile, or NULL . Do not unref this object. [transfer none]
|
Since 0.1.3
guint64 zif_package_get_size (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the size of the package. This is the installed size for installed packages, and the download size for remote packages.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
The package size, or 0 for failure |
Since 0.1.0
GPtrArray * zif_package_get_files (ZifPackage *package
,ZifState *state
,GError **error
);
Gets the file list for the package.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of strings. The returned array should be
freed with g_ptr_array_unref() when no longer needed. [element-type utf8][transfer container]
|
Since 0.1.0
GPtrArray * zif_package_get_requires (ZifPackage *package
,ZifState *state
,GError **error
);
Gets all the package requires.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
an array of ZifDepend's. The returned array should be
freed with g_ptr_array_unref() when no longer needed. [element-type ZifDepend][transfer container]
|
Since 0.1.0
GPtrArray * zif_package_get_provides (ZifPackage *package
,ZifState *state
,GError **error
);
Get all the package provides.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
an array of ZifDepend's. The returned array should be
freed with g_ptr_array_unref() when no longer needed. [element-type ZifDepend][transfer container]
|
Since 0.1.0
GPtrArray * zif_package_get_obsoletes (ZifPackage *package
,ZifState *state
,GError **error
);
Get all the package obsoletes.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
an array of ZifDepend's. [element-type ZifDepend][transfer container] |
Since 0.1.3
GPtrArray * zif_package_get_conflicts (ZifPackage *package
,ZifState *state
,GError **error
);
Get all the package conflicts.
|
A ZifPackage |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
A reference counted GPtrArray. The returned array
should be freed with g_ptr_array_unref() when no longer needed. [element-type ZifDepend][transfer container]
|
Since 0.1.3
guint64 zif_package_get_time_file (ZifPackage *package
);
Get the time the file was created.
|
A ZifPackage |
Returns : |
The UNIX time, or 0 for unknown. |
Since 0.1.2
gboolean zif_package_provides (ZifPackage *package
,ZifDepend *depend
,ZifDepend **satisfies
,ZifState *state
,GError **error
);
Gets the package dependency that satisfies the supplied dependency.
|
A ZifPackage |
|
The dependency to try and satisfy |
|
A matched dependency if not NULL
|
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE if the package was searched.
Use satisfies == NULL to detect a missing dependency. |
Since 0.1.3
gboolean zif_package_conflicts (ZifPackage *package
,ZifDepend *depend
,ZifDepend **satisfies
,ZifState *state
,GError **error
);
Gets the package dependency that satisfies the supplied dependency.
|
A ZifPackage |
|
The dependency to try and satisfy |
|
A matched dependency if not NULL
|
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE if the package was searched.
Use satisfies == NULL to detect a missing dependency. |
Since 0.1.3
gboolean zif_package_requires (ZifPackage *package
,ZifDepend *depend
,ZifDepend **satisfies
,ZifState *state
,GError **error
);
Gets the package dependency that satisfies the supplied dependency.
|
A ZifPackage |
|
The dependency to try and satisfy |
|
The matched dependency if not NULL
|
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE if the package was searched.
Use satisfies == NULL to detect a missing dependency. |
Since 0.1.3
gboolean zif_package_obsoletes (ZifPackage *package
,ZifDepend *depend
,ZifDepend **satisfies
,ZifState *state
,GError **error
);
Gets the package dependency that satisfies the supplied dependency.
|
A ZifPackage |
|
The dependency to try and satisfy |
|
A matched dependency if not NULL
|
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE if the package was searched.
Use satisfies == NULL to detect a missing dependency. |
Since 0.1.3
const gchar * zif_package_get_package_id (ZifPackage *package
);
Gets the id (as text) uniquely identifying the package in all repos.
DO NOT USE THIS FUNCTION. Use zif_package_get_id()
instead.
|
A ZifPackage |
Returns : |
A package-id representing the package. |
Since 0.1.0
void zif_package_print (ZifPackage *package
);
Prints details about a package to STDOUT
.
|
A ZifPackage |
Since 0.1.0
gboolean zif_package_is_devel (ZifPackage *package
);
Finds out if a package is a development package.
|
A ZifPackage |
Returns : |
TRUE or FALSE
|
Since 0.1.0
gboolean zif_package_is_gui (ZifPackage *package
);
Finds out if a package is a GUI package.
|
A ZifPackage |
Returns : |
TRUE or FALSE
|
Since 0.1.0
gboolean zif_package_is_installed (ZifPackage *package
);
Finds out if a package is installed.
|
A ZifPackage |
Returns : |
TRUE or FALSE
|
Since 0.1.0
gboolean zif_package_is_free (ZifPackage *package
);
Check the string license_text for free licenses, indicated by their short names as documented at http://fedoraproject.org/wiki/Licensing
Licenses can be grouped by " or " to indicate that the package can be redistributed under any of the licenses in the group. For instance: GPLv2+ or Artistic or FooLicense.
Also, if a license ends with "+", the "+" is removed before comparing it to the list of valid licenses. So if license "FooLicense" is free, then "FooLicense+" is considered free.
Groups of licenses can be grouped with " and " to indicate that parts of the package are distributed under one group of licenses, while other parts of the package are distributed under another group. Groups may be wrapped in parenthesis. For instance: (GPLv2+ or Artistic) and (GPL+ or Artistic) and FooLicense.
At least one license in each group must be free for the package to be considered Free Software. If the license_text is empty, the package is considered non-free.
|
A ZifPackage |
Returns : |
TRUE or FALSE
|
Since 0.1.0
gboolean zif_package_is_native (ZifPackage *package
);
Finds out if a package is the native architecture for the system.
|
A ZifPackage |
Returns : |
TRUE or FALSE
|
Since 0.1.0
gint zif_package_compare (ZifPackage *a
,ZifPackage *b
);
Compares one package versions against each other. If the package names or architectures are different, then an error is returned.
|
The first package to compare |
|
The second package to compare |
Returns : |
1 for a>b, 0 for a==b, -1 for b>a, or G_MAXINT for error |
Since 0.1.0
gint zif_package_compare_full (ZifPackage *a
,ZifPackage *b
,ZifPackageCompareFlags flags
);
Compares one package versions against each other. The order for comparison is, assuming all flags are set:
1. ZifPackage object 2. Installed status (optional) 3. Name (optional) 4. Architecture compatibility (optional) 5. Version (optional) 6. Repo name (optional)
|
The first package to compare |
|
The second package to compare |
|
The amount of checking to do, e.g. ZIF_PACKAGE_COMPARE_FLAG_CHECK_NAME
|
Returns : |
1 for a>b, 0 for a==b, -1 for b>a, or G_MAXINT for error |
Since 0.2.1
gboolean zif_package_is_compatible_arch (ZifPackage *a
,ZifPackage *b
);
Finds if the package architectures are compatible. In this sense, i386 is compatible with i586, but not x86_64
|
The first package to compare |
|
The second package to compare |
Returns : |
TRUE is compatible |
Since 0.1.3
const gchar * zif_package_ensure_type_to_string (ZifPackageEnsureType type
);
Gets the string representation of a ZifPackageEnsureType
|
A ZifPackageEnsureType enumerated value |
Returns : |
A string |
Since 0.1.3
const gchar * zif_package_trust_kind_to_string (ZifPackageTrustKind trust_kind
);
Gets the string representation of a ZifPackageTrustKind
|
A ZifPackageTrustKind enumerated value |
Returns : |
A string |
Since 0.1.3
void zif_package_set_compare_mode (ZifPackage *package
,ZifPackageCompareMode compare_mode
);
Sets the compare mode for packages.
|
A ZifPackage |
|
The mode to use when comparing this package to others |
Since 0.2.1
ZifPackageCompareMode zif_package_compare_mode_from_string
(const gchar *value
);
Converts a string to a ZifPackageCompareMode.
|
the compare mode to convert |
Returns : |
a enum, or ZIF_PACKAGE_COMPARE_MODE_UNKNOWN for invalid |
Since 0.2.1
const gchar * zif_package_compare_mode_to_string (ZifPackageCompareMode value
);
Converts the ZifPackageCompareMode to a string.
|
the compare mode to convert |
Returns : |
a const string, or NULL for invalid |
Since 0.2.1