ZIF Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
#define ZIF_MD_ERROR struct ZifMd; struct ZifMdClass; enum ZifMdKind; enum ZifMdError; GQuark zif_md_error_quark (void
); ZifMd * zif_md_new (void
); void zif_md_set_store (ZifMd *md
,ZifStore *remote
); void zif_md_set_id (ZifMd *md
,const gchar *id
); void zif_md_set_filename (ZifMd *md
,const gchar *filename
); void zif_md_set_timestamp (ZifMd *md
,guint timestamp
); void zif_md_set_location (ZifMd *md
,const gchar *location
); void zif_md_set_checksum (ZifMd *md
,const gchar *checksum
); void zif_md_set_checksum_uncompressed (ZifMd *md
,const gchar *checksum_uncompressed
); void zif_md_set_checksum_type (ZifMd *md
,GChecksumType checksum_type
); void zif_md_set_max_age (ZifMd *md
,guint64 max_age
); const gchar * zif_md_kind_to_text (ZifMdKind type
); gboolean zif_md_get_is_loaded (ZifMd *md
); ZifStore * zif_md_get_store (ZifMd *md
); const gchar * zif_md_get_id (ZifMd *md
); ZifMdKind zif_md_get_kind (ZifMd *md
); const gchar * zif_md_get_filename (ZifMd *md
); const gchar * zif_md_get_filename_uncompressed (ZifMd *md
); const gchar * zif_md_get_location (ZifMd *md
); gboolean zif_md_load (ZifMd *md
,ZifState *state
,GError **error
); gboolean zif_md_unload (ZifMd *md
,ZifState *state
,GError **error
); gboolean zif_md_clean (ZifMd *md
,GError **error
); gboolean zif_md_file_check (ZifMd *md
,gboolean use_uncompressed
,gboolean *valid
,ZifState *state
,GError **error
); gboolean zif_md_check_compressed (ZifMd *md
,ZifState *state
,GError **error
); gboolean zif_md_check_uncompressed (ZifMd *md
,ZifState *state
,GError **error
); GPtrArray * zif_md_search_file (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
); GPtrArray * zif_md_search_name (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
); GPtrArray * zif_md_search_details (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
); GPtrArray * zif_md_search_group (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
); GPtrArray * zif_md_search_pkgid (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
); GPtrArray * zif_md_what_provides (ZifMd *md
,GPtrArray *depends
,ZifState *state
,GError **error
); GPtrArray * zif_md_what_requires (ZifMd *md
,GPtrArray *depends
,ZifState *state
,GError **error
); GPtrArray * zif_md_what_obsoletes (ZifMd *md
,GPtrArray *depends
,ZifState *state
,GError **error
); GPtrArray * zif_md_what_conflicts (ZifMd *md
,GPtrArray *depends
,ZifState *state
,GError **error
); GPtrArray * zif_md_resolve (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
); GPtrArray * zif_md_resolve_full (ZifMd *md
,gchar **search
,ZifStoreResolveFlags flags
,ZifState *state
,GError **error
); GPtrArray * zif_md_get_packages (ZifMd *md
,ZifState *state
,GError **error
); GPtrArray * zif_md_find_package (ZifMd *md
,const gchar *package_id
,ZifState *state
,GError **error
); GPtrArray * zif_md_get_changelog (ZifMd *md
,const gchar *pkgid
,ZifState *state
,GError **error
); GPtrArray * zif_md_get_files (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
); GPtrArray * zif_md_get_requires (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
); GPtrArray * zif_md_get_provides (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
); GPtrArray * zif_md_get_obsoletes (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
); GPtrArray * zif_md_get_conflicts (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
);
GObject +----ZifMd +----ZifMdComps +----ZifMdDelta +----ZifMdFilelistsSql +----ZifMdFilelistsXml +----ZifMdMetalink +----ZifMdMirrorlist +----ZifMdOtherSql +----ZifMdPrimarySql +----ZifMdPrimaryXml +----ZifMdUpdateinfo
"filename" gchar* : Read / Write "kind" guint : Read / Write / Construct "location" gchar* : Read / Write
This provides an abstract metadata class. It is implemented by ZifMdFilelistsSql, ZifMdFilelistsXml, ZifMdPrimaryXml, ZifMdPrimarySql and many others.
struct ZifMdClass { GObjectClass parent_class; /* vtable */ gboolean (*load) (ZifMd *md, ZifState *state, GError **error); gboolean (*unload) (ZifMd *md, ZifState *state, GError **error); GPtrArray *(*search_file) (ZifMd *md, gchar **search, ZifState *state, GError **error); GPtrArray *(*search_name) (ZifMd *md, gchar **search, ZifState *state, GError **error); GPtrArray *(*search_details) (ZifMd *md, gchar **search, ZifState *state, GError **error); GPtrArray *(*search_group) (ZifMd *md, gchar **search, ZifState *state, GError **error); GPtrArray *(*search_pkgid) (ZifMd *md, gchar **search, ZifState *state, GError **error); GPtrArray *(*what_provides) (ZifMd *md, GPtrArray *depends, ZifState *state, GError **error); GPtrArray *(*what_requires) (ZifMd *md, GPtrArray *depends, ZifState *state, GError **error); GPtrArray *(*what_obsoletes) (ZifMd *md, GPtrArray *depends, ZifState *state, GError **error); GPtrArray *(*what_conflicts) (ZifMd *md, GPtrArray *depends, ZifState *state, GError **error); GPtrArray *(*resolve) (ZifMd *md, gchar **search, ZifStoreResolveFlags flags, ZifState *state, GError **error); GPtrArray *(*get_packages) (ZifMd *md, ZifState *state, GError **error); GPtrArray *(*find_package) (ZifMd *md, const gchar *package_id, ZifState *state, GError **error); GPtrArray *(*get_changelog) (ZifMd *md, const gchar *pkgid, ZifState *state, GError **error); GPtrArray *(*get_files) (ZifMd *md, ZifPackage *package, ZifState *state, GError **error); GPtrArray *(*get_provides) (ZifMd *md, ZifPackage *package, ZifState *state, GError **error); GPtrArray *(*get_requires) (ZifMd *md, ZifPackage *package, ZifState *state, GError **error); GPtrArray *(*get_obsoletes) (ZifMd *md, ZifPackage *package, ZifState *state, GError **error); GPtrArray *(*get_conflicts) (ZifMd *md, ZifPackage *package, 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_MD_KIND_UNKNOWN, ZIF_MD_KIND_PRIMARY_SQL, ZIF_MD_KIND_PRIMARY_XML, ZIF_MD_KIND_FILELISTS_SQL, ZIF_MD_KIND_FILELISTS_XML, ZIF_MD_KIND_OTHER_SQL, ZIF_MD_KIND_OTHER_XML, ZIF_MD_KIND_COMPS_GZ, ZIF_MD_KIND_COMPS, ZIF_MD_KIND_METALINK, ZIF_MD_KIND_MIRRORLIST, ZIF_MD_KIND_PRESTODELTA, ZIF_MD_KIND_UPDATEINFO, ZIF_MD_KIND_PKGTAGS, ZIF_MD_KIND_LAST } ZifMdKind;
typedef enum { ZIF_MD_ERROR_FAILED, ZIF_MD_ERROR_NO_SUPPORT, ZIF_MD_ERROR_FAILED_TO_LOAD, ZIF_MD_ERROR_FAILED_AS_OFFLINE, ZIF_MD_ERROR_FAILED_DOWNLOAD, ZIF_MD_ERROR_BAD_SQL, ZIF_MD_ERROR_FILE_TOO_OLD, ZIF_MD_ERROR_NO_FILENAME, ZIF_MD_ERROR_FILE_NOT_EXISTS, ZIF_MD_ERROR_CHECKSUM_INVALID, ZIF_MD_ERROR_LAST } ZifMdError;
void zif_md_set_store (ZifMd *md
,ZifStore *remote
);
Sets the remote store for this metadata.
Since 0.2.1
void zif_md_set_id (ZifMd *md
,const gchar *id
);
Sets the repository ID for this metadata.
|
A ZifMd |
|
The repository id, e.g. "fedora" |
Since 0.1.0
void zif_md_set_filename (ZifMd *md
,const gchar *filename
);
Sets the filename of the compressed file.
|
A ZifMd |
|
The base filename, e.g. "master.xml.bz2" |
Since 0.1.0
void zif_md_set_timestamp (ZifMd *md
,guint timestamp
);
Sets the timestamp of the compressed file.
|
A ZifMd |
|
The timestamp value |
Since 0.1.0
void zif_md_set_location (ZifMd *md
,const gchar *location
);
Sets the location of the compressed file, e.g. "repodata/35d817e-primary.sqlite.bz2"
|
A ZifMd |
|
The location |
Since 0.1.0
void zif_md_set_checksum (ZifMd *md
,const gchar *checksum
);
Sets the checksum of the compressed file.
|
A ZifMd |
|
The checksum value |
Since 0.1.0
void zif_md_set_checksum_uncompressed (ZifMd *md
,const gchar *checksum_uncompressed
);
Sets the checksum of the uncompressed file.
|
A ZifMd |
|
The uncompressed checksum value |
Since 0.1.0
void zif_md_set_checksum_type (ZifMd *md
,GChecksumType checksum_type
);
Sets the checksum_type of the files.
|
A ZifMd |
|
The checksum type |
Since 0.1.0
void zif_md_set_max_age (ZifMd *md
,guint64 max_age
);
Sets the maximum age of the metadata file. Any files older than this will be deleted and re-downloaded.
|
A ZifMd |
|
The maximum permitted value of the metadata, or 0 |
Since 0.1.0
gboolean zif_md_get_is_loaded (ZifMd *md
);
Gets if the metadata has already been loaded.
Since 0.1.0
ZifStore * zif_md_get_store (ZifMd *md
);
Gets the remote store for this metadata.
Since 0.2.1
const gchar * zif_md_get_id (ZifMd *md
);
Gets the md identifier, usually the repo name.
|
A ZifMd |
Returns : |
The repo identifier. |
Since 0.1.0
ZifMdKind zif_md_get_kind (ZifMd *md
);
Gets the type of the repo.
|
A ZifMd |
Returns : |
The type |
Since 0.1.0
const gchar * zif_md_get_filename (ZifMd *md
);
Gets the compressed filename of the repo.
|
A ZifMd |
Returns : |
The filename, e.g. "/var/cache/dave.xml.bz2" |
Since 0.1.0
const gchar * zif_md_get_filename_uncompressed (ZifMd *md
);
Gets the uncompressed filename of the repo.
|
A ZifMd |
Returns : |
The uncompressed filename, e.g. "/var/cache/dave.xml" |
Since 0.1.0
const gchar * zif_md_get_location (ZifMd *md
);
Gets the location of the repo.
|
A ZifMd |
Returns : |
The location |
Since 0.1.0
gboolean zif_md_load (ZifMd *md
,ZifState *state
,GError **error
);
Load the metadata store.
|
A ZifMd |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.1.0
gboolean zif_md_unload (ZifMd *md
,ZifState *state
,GError **error
);
Unload the metadata store.
|
A ZifMd |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE for success, FALSE otherwise |
Since 0.1.0
gboolean zif_md_clean (ZifMd *md
,GError **error
);
Clean the metadata store.
Since 0.1.0
gboolean zif_md_file_check (ZifMd *md
,gboolean use_uncompressed
,gboolean *valid
,ZifState *state
,GError **error
);
Check the metadata files to make sure they are valid.
NOTE: Don't use this function, the semantics are horrible.
|
A ZifMd |
|
If we should check only the uncompresed version |
|
If the metadata is valid, i.e. the checksums are correct |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE if the MD file was read and checked. |
Since 0.1.0
gboolean zif_md_check_compressed (ZifMd *md
,ZifState *state
,GError **error
);
Check the metadata files to make sure they are valid.
|
A ZifMd |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE if the MD file was read and checked. |
Since 0.2.2
gboolean zif_md_check_uncompressed (ZifMd *md
,ZifState *state
,GError **error
);
Check the metadata files to make sure they are valid.
|
A ZifMd |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
TRUE if the MD file was read and checked. |
Since 0.2.2
GPtrArray * zif_md_search_file (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
);
Gets a list of all packages that contain the file. Results are pkgId's descriptors, i.e. 64 bit hashes as test.
|
A ZifMd |
|
Search term, e.g. "/usr/bin/powertop" |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
A string list of pkgId's. [element-type utf8][transfer container] |
Since 0.1.0
GPtrArray * zif_md_search_name (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
);
Finds all packages that match the name.
|
A ZifMd |
|
Search term, e.g. "power" |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.0
GPtrArray * zif_md_search_details (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
);
Finds all packages that match the name or description.
|
A ZifMd |
|
Search term, e.g. "advanced" |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.0
GPtrArray * zif_md_search_group (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
);
Finds all packages that match the group.
|
A ZifMd |
|
Search term, e.g. "games/console" |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.0
GPtrArray * zif_md_search_pkgid (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
);
Finds all packages that match the given pkgId.
|
A ZifMd |
|
The search terms as a 64 bit hash. [array zero-terminated=1][element-type utf8] |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.0
GPtrArray * zif_md_what_provides (ZifMd *md
,GPtrArray *depends
,ZifState *state
,GError **error
);
Finds all packages that match the given provide.
|
A ZifMd |
|
an array of ZifDepend's provide |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.3
GPtrArray * zif_md_what_requires (ZifMd *md
,GPtrArray *depends
,ZifState *state
,GError **error
);
Finds all packages that match the given provide.
|
A ZifMd |
|
an array of ZifDepend's provide |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.3
GPtrArray * zif_md_what_obsoletes (ZifMd *md
,GPtrArray *depends
,ZifState *state
,GError **error
);
Finds all packages that obsolete the given provide.
|
A ZifMd |
|
an array of ZifDepend's obsolete |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.3
GPtrArray * zif_md_what_conflicts (ZifMd *md
,GPtrArray *depends
,ZifState *state
,GError **error
);
Finds all packages that conflict with the given depends.
|
A ZifMd |
|
an array of ZifDepend's conflict |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.3
GPtrArray * zif_md_resolve (ZifMd *md
,gchar **search
,ZifState *state
,GError **error
);
Finds all remote packages that match the name exactly.
|
A ZifMd |
|
Search term, e.g. "gnome-power-manager" |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.0
GPtrArray * zif_md_resolve_full (ZifMd *md
,gchar **search
,ZifStoreResolveFlags flags
,ZifState *state
,GError **error
);
Finds all remote packages that match the name exactly.
|
A ZifMd |
|
Search term, e.g. "gnome-power-manager" |
|
A bitfield of ZifStoreResolveFlags , e.g. ZIF_STORE_RESOLVE_FLAG_USE_NAME_ARCH
|
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.2.4
GPtrArray * zif_md_get_packages (ZifMd *md
,ZifState *state
,GError **error
);
Returns all packages in the repo.
|
A ZifMd |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.0
GPtrArray * zif_md_find_package (ZifMd *md
,const gchar *package_id
,ZifState *state
,GError **error
);
Finds all packages that match PackageId.
|
A ZifMd |
|
A PackageId to match |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifPackageRemote's. [element-type ZifPackageRemote][transfer container] |
Since 0.1.0
GPtrArray * zif_md_get_changelog (ZifMd *md
,const gchar *pkgid
,ZifState *state
,GError **error
);
Gets the changelog data for a specific package
|
A ZifMd |
|
A internal pkgid to match |
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
An array of ZifChangeset's. [element-type ZifChangeset][transfer container] |
Since 0.1.0
GPtrArray * zif_md_get_files (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
);
Gets the file list for a specific package.
|
A ZifMd |
|
A ZifPackage
|
|
A ZifState to use for progress reporting |
|
A GError, or NULL
|
Returns : |
an array of strings. [element-type utf8][transfer container] |
Since 0.1.0
GPtrArray * zif_md_get_requires (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
);
Gets the requires for a specific package.
|
A ZifMd |
|
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_md_get_provides (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
);
Gets the provides for a specific package.
|
A ZifMd |
|
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_md_get_obsoletes (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
);
Gets the obsoletes for a specific package.
|
A ZifMd |
|
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_md_get_conflicts (ZifMd *md
,ZifPackage *package
,ZifState *state
,GError **error
);
Gets the conflicts for a specific package.
|
A ZifMd |
|
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