ZIF Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#define ZIF_UTILS_ERROR enum ZifUtilsError; #define ZIF_PACKAGE_ID_NAME #define ZIF_PACKAGE_ID_VERSION #define ZIF_PACKAGE_ID_ARCH #define ZIF_PACKAGE_ID_DATA GQuark zif_utils_error_quark (void
); void zif_list_print_array (GPtrArray *array
); const gchar * zif_guess_content_type (const gchar *filename
); gchar * zif_package_id_build (const gchar *name
,const gchar *version
,const gchar *arch
,const gchar *data
); gchar * zif_package_id_from_nevra (const gchar *name
,guint epoch
,const gchar *version
,const gchar *release
,const gchar *arch
,const gchar *data
); gboolean zif_boolean_from_text (const gchar *text
); gint zif_compare_evr (const gchar *a
,const gchar *b
); gint zif_compare_evr_full (const gchar *a
,const gchar *b
,ZifPackageCompareMode compare_mode
); gboolean zif_arch_is_native (const gchar *a
,const gchar *b
); gboolean zif_file_untar (const gchar *filename
,const gchar *directory
,GError **error
); gboolean zif_file_decompress (const gchar *in
,const gchar *out
,ZifState *state
,GError **error
); gchar * zif_file_get_uncompressed_name (const gchar *filename
); gboolean zif_file_is_compressed_name (const gchar *filename
); gchar ** zif_package_id_split (const gchar *package_id
); gchar * zif_package_id_get_name (const gchar *package_id
); gchar * zif_package_id_get_printable (const gchar *package_id
); gboolean zif_package_id_check (const gchar *package_id
); guint zif_time_string_to_seconds (const gchar *value
); gboolean zif_package_convert_evr (gchar *evr
,const gchar **epoch
,const gchar **version
,const gchar **release
); gboolean zif_package_convert_evr_full (gchar *evr
,const gchar **epoch
,const gchar **version
,const gchar **release
,const gchar **distro
); gboolean zif_utils_gpg_verify (const gchar *filename
,const gchar *filename_gpg
,GError **error
); gboolean zif_package_id_compare_nevra (const gchar *package_id1
,const gchar *package_id2
); gboolean zif_package_id_to_nevra (const gchar *package_id
,gchar **name
,guint *epoch
,gchar **version
,gchar **release
,gchar **arch
); gchar * zif_package_id_convert_basic (const gchar *package_id
);
typedef enum { ZIF_UTILS_ERROR_FAILED, ZIF_UTILS_ERROR_FAILED_TO_READ, ZIF_UTILS_ERROR_FAILED_TO_WRITE, ZIF_UTILS_ERROR_CANCELLED, ZIF_UTILS_ERROR_LAST } ZifUtilsError;
void zif_list_print_array (GPtrArray *array
);
Print an array of strings to STDOUT
.
|
An array of ZifPackage's to print |
Since 0.1.0
const gchar * zif_guess_content_type (const gchar *filename
);
Guesses a content type, based on the filename ending.
|
The target filename |
Returns : |
a content type, or NULL
|
Since 0.1.5
gchar * zif_package_id_build (const gchar *name
,const gchar *version
,const gchar *arch
,const gchar *data
);
Formats a PackageId structure.
|
The package name, e.g. "hal" |
|
The package version, e.g. "1.0.0-fc14" |
|
The package architecture, e.g. "i386" |
|
The package data, typically the repo name, or "installed" |
Returns : |
A PackageId value, or NULL if invalid |
Since 0.2.4
gchar * zif_package_id_from_nevra (const gchar *name
,guint epoch
,const gchar *version
,const gchar *release
,const gchar *arch
,const gchar *data
);
Formats a PackageId structure from a NEVRA.
|
The package name, e.g. "hal" |
|
The package epoch, e.g. 1 or 0 for none. |
|
The package version, e.g. "1.0.0" |
|
The package release, e.g. "2" |
|
The package architecture, e.g. "i386" |
|
The package data, typically the repo name, or "installed" |
Returns : |
A PackageId value, or NULL if invalid |
Since 0.1.0
gboolean zif_boolean_from_text (const gchar *text
);
Convert a text boolean into it's enumerated boolean state
Since 0.1.0
gint zif_compare_evr (const gchar *a
,const gchar *b
);
Compare two [epoch:]version[-release] strings
|
The first version string, or NULL
|
|
The second version string, or NULL
|
Returns : |
1 for a>b, 0 for a==b, -1 for b>a |
Since 0.1.0
gint zif_compare_evr_full (const gchar *a
,const gchar *b
,ZifPackageCompareMode compare_mode
);
Compare two [epoch:]version[-release] strings
|
The first version string, or NULL
|
|
The second version string, or NULL
|
|
the way the versions are compared |
Returns : |
1 for a>b, 0 for a==b, -1 for b>a |
Since 0.2.1
gboolean zif_arch_is_native (const gchar *a
,const gchar *b
);
Compare two architectures to see if they are native, so for instance i386 is native on a i686 system, but x64 isn't.
|
The first arch string |
|
The second arch string |
Returns : |
TRUE if the architecture is compatible |
Since 0.1.3
gboolean zif_file_untar (const gchar *filename
,const gchar *directory
,GError **error
);
Untar files into a directory
|
A filename to unpack |
|
The directory to unpack into |
|
A GError
|
Returns : |
TRUE if the file was decompressed |
Since 0.1.0
gboolean zif_file_decompress (const gchar *in
,const gchar *out
,ZifState *state
,GError **error
);
Decompress files into a directory
|
A filename to unpack |
|
The file to create |
|
A ZifState to use for progress reporting |
|
A GError
|
Returns : |
TRUE if the file was decompressed |
Since 0.1.0
gchar * zif_file_get_uncompressed_name (const gchar *filename
);
Finds the uncompressed filename for a compressed file.
|
A filename, e.g. "/lib/dave.tar.gz" |
Returns : |
The uncompressed file name, e.g. /lib/dave.tar, use g_free() to free. |
Since 0.1.0
gboolean zif_file_is_compressed_name (const gchar *filename
);
Finds out if the filename is compressed
|
A filename, e.g. /lib/dave.tar.gz |
Returns : |
TRUE if the file needs decompression |
Since 0.1.0
gchar ** zif_package_id_split (const gchar *package_id
);
Splits a PackageID into the correct number of parts, checking the correct number of delimiters are present.
|
The ';' delimited PackageID to split |
Returns : |
A GStrv or NULL if invalid. [element-type utf8][transfer full]
|
Since 0.1.0
gchar * zif_package_id_get_name (const gchar *package_id
);
Gets the package name for a PackageID. This is 9x faster than using
zif_package_id_split()
where you only need the ZIF_PACKAGE_ID_NAME
component.
|
The ';' delimited PackageID to split |
Returns : |
A string or NULL if invalid, use g_free() to free |
Since 0.1.1
gchar * zif_package_id_get_printable (const gchar *package_id
);
Formats the package ID in a way that is suitable to show the user.
Since 0.1.3
gboolean zif_package_id_check (const gchar *package_id
);
|
A PackageID to check |
Returns : |
TRUE if the PackageID was well formed. |
Since 0.1.0
guint zif_time_string_to_seconds (const gchar *value
);
Converts a yum time string into the number of seconds.
|
A yum time string, e.g. "7h" |
Returns : |
A number of seconds, or zero for failure to parse. |
Since 0.1.0
gboolean zif_package_convert_evr (gchar *evr
,const gchar **epoch
,const gchar **version
,const gchar **release
);
Modifies evr, so pass in copy
|
epoch, version, release |
|
The package epoch |
|
The package version |
|
The package release (note: with any distro) |
Returns : |
TRUE if the EVR was parsed |
Since 0.1.0
gboolean zif_package_convert_evr_full (gchar *evr
,const gchar **epoch
,const gchar **version
,const gchar **release
,const gchar **distro
);
Modifies evr, so pass in copy
|
epoch, version, release |
|
The package epoch |
|
The package version |
|
The package release |
|
The package distro, or NULL
|
Returns : |
TRUE if the EVR was parsed |
Since 0.2.1
gboolean zif_utils_gpg_verify (const gchar *filename
,const gchar *filename_gpg
,GError **error
);
gboolean zif_package_id_compare_nevra (const gchar *package_id1
,const gchar *package_id2
);
Compares the NEVRA sections in two package ID strings, ignoring the fourth data section.
|
The package ID, e.g. "hal;1:1.01-3;i386;fedora" |
|
The package ID, e.g. "hal;1:1.01-3;i386;updates-testing" |
Returns : |
TRUE if the NEVRA are equal |
Since 0.2.5
gboolean zif_package_id_to_nevra (const gchar *package_id
,gchar **name
,guint *epoch
,gchar **version
,gchar **release
,gchar **arch
);
Parses a PackageId structure to a NEVRA.
|
The package ID, e.g. "hal;1:1.01-3;i386;fedora" |
|
The returned package name, e.g. "hal" |
|
The returned package epoch, e.g. 1 or 0 for none. |
|
The returned package version, e.g. "1.0.0" |
|
The returned package release, e.g. "2" |
|
The returned package architecture, e.g. "i386" |
Returns : |
TRUE if the string was parsed okay |
Since 0.1.3
gchar * zif_package_id_convert_basic (const gchar *package_id
);
Returns a "basic" package-id that does not have the repo appended. For instance, "hal;0.1.2;i386;installed:fedora" would be converted to "hal;0.1.2;i386;installed".
|
A package ID |
Returns : |
The basic package-id. |
Since 0.2.5