This chapter provides an overview of the MacPorts registry and its API. The registry is queried by MacPorts utilities for information about installed ports related to dependencies, port images, and simple user information about what is installed. It provides abstraction over a modular receipt storage layer; where the default format is a SQLite database.
The registry allows MacPorts utilities to:
The SQLite registry used by default is located at ${portdbpath}/registry
, which by default would be ${prefix}/var/macports/registry
.
All data is stored in a single file named registry.db
, although the additional directory portfiles
is used temporarily for extracting stored Portfiles from the registry.
Furthermore, access to the registry may be locked using .registry.lock
with the registry::exclusive_lock
and registry::exclusive_unlock
APIs.
The legacy flat file registry files are contained in ${portdbpath}/receipts
, which by default is location ${prefix}/var/macports/receipts
.
File mappings and dependency mappings are tracked in the flat file registry by file_map.db
and dep_map.bz2
.
If found, these will be automatically converted to the new SQLite registry.
The MacPorts registry provides a public API in the registry1.0 Tcl package.
Using this API listed below you can access the MacPorts Registry using the default receipt storage mechanism chosen in macports.conf
.
registry::new_entry {name version {revision 0} {variants ""}}
registry::open_entry {name {version 0} {revision 0} {variants ""}}
registry::entry_exists {name version {revision 0} {variants ""}}
registry::write_entry {ref}
registry::delete_entry {ref}
registry::property_store {ref property value}
registry::property_retrieve {ref property}
registry::installed {{name ""} {version ""}}
registry::location {portname portversion}
registry::open_file_map {args}
registry::file_registered {file}
registry::port_registered {name}
registry::register_file {file port}
registry::unregister_file {file}
registry::write_file_map {args}
registry::open_dep_map {args}
registry::fileinfo_for_file {fname}
Returns a list for the given file name representing all data currently known about the file. This is a 6-tuple in the form of:
registry::fileinfo_for_index {flist}
registry::list_depends {name}
registry::list_dependents {name}
registry::register_dep {dep type port}
registry::unregister_dep {dep type port}
registry::write_dep_map {args}