Databases¶
A database object represents a collection of packages. A database can be accessed by means of a Handle object, and can be used to query for package information.
-
class
Database
¶ -
name
(string)¶ The name of this database (for example, “core”)
-
servers
(list)¶ A list of servers from where this database was fetched
-
pkgcache
(list)¶ A list of references to the packages in this database
-
grpcache
(list)¶ A list of tuples of the form:
[ ( 'GROUPNAME', [package-list] ), ( 'GROUPNAME2', [...]), ... ]
-
get_pkg
(name: string)¶ - Retrieves a package instance with the name ‘name’
Parameters: name (str) – The name of the package (e.g., ‘coreutils’) Returns: a reference to the Package object with the name ‘name’ or None if it doesn’t exist
-
update
(force: boolean)¶ Attempts to update the sync database (i.e., alpm_db_update).
Parameters: force (bool) – If the database should be updated even if it’s up-to-date Returns: True if the update was successful, or an error if that’s not the case.
-
search
(query: string)¶ Search this database for a package with the name matching the query.
Parameters: query (str) – a regexp representing the package searched for. Returns: a list of package objects matching the query by name
-