pacutils - utility library for libalpm front-ends
pu_config_t *config = pu_config_new_from_file("/etc/pacman.conf");
alpm_handle_t *handle = pu_initialize_handle_from_config(config);
alpm_list_t *syncdbs = pu_register_syncdbs(config->repos);
alpm_option_set_progresscb(handle, pu_cb_progress, NULL);
alpm_option_set_dlcb(handle, pu_cb_download, NULL);
/* do something with handle... */
alpm_list_free(sync_dbs);
alpm_release(handle);
pu_config_free(config);
pacutils encapsulates several of the common tasks that most users of libalpm need to perform, such as parsing pacman.conf and providing standard output functions for callbacks. The included programs can also be used as guides for how to accomplish particular tasks using libalpm.
Parse a pacman configuration file into a pu_config_t
structure. Note: this is the final configuration as parsed by pacman. Include
directives will be processed, defaults are set, $repo
and $arch
will be replaced in Server
directives and Architecture
will be replaced if set to auto
.
Package mtree reading functions are provided to fill gaps in libarchive's mtree reader, notably md5digest
and sha256digest
which are currently not read by libarchive. Support is incomplete and libalpm's mtree reader should be used whenever possible.
typedef struct pu_mtree_t {
char *path;
char type[16];
uid_t uid;
gid_t gid;
mode_t mode;
off_t size;
char md5digest[33];
char sha256digest[65];
} pu_mtree_t;
Returns a list of mtree entries for pkg
.
A pkgspec
is a string consisting of sufficient information to uniquely identify an individual package. Currently recognized formats are:
ftp://ftp.archlinux.org/core/os/x86_64/pacman-4.1.2-5-x86_64.pkg.tar.xz
file:///var/cache/pacman/pkg/pacman-4.1.2-5-x86_64.pkg.tar.xz
There are several programs located in src/. Refer to each program's documentation for more information.
Query compile time libalpm features.
paccapability signatures >/dev/null && echo "libalpm built with signature support"
Query pacman's configuration file. Useful for shell scripts:
dbpath=$(pacconf dbpath)
color=$(pacconf color)
[[ -n $color ]] && ... # print something in color
Note: this is the final configuration as parsed by pacman. Include
directives will be processed, defaults are set, $repo
and $arch
will be replaced in Server
directives and Architecture
will be replaced if set to auto
.
Query a pacman-style INI configuration file.
Updates repository databases. Equivalent to pacman -Sy
.
Install/remove packages in a single transaction.
NOTE: alpm support for installation and removal in a single transaction is flaky; some options may be ignored.
Display information for packages, similar to pacman -Qi
and pacman -Si
. Input should be a list of pkgspecs.
Package search/filter tool. Combine with pacinfo to display brief package information similar to pacman -Qs
and pacman -Ss
:
pacsift --name pacman | pacinfo --short
Display information about a file. Includes information from pacman -Qo
, pacman -Qkk
, and pacman -Qii
. Expects input to match the path stored in pacman's database with or without the root prepended. realpath can be used to call with relative paths or paths containing symbolic links:
pacfile "$(realpath ./foo)"
Repair file properties based on pacman's database.
find /usr/share | pacrepairfile --uid --gid
Provide script-friendly database locking and unlocking.
paclock --run -- paccache --dryrun --verbose
Filter pacman log entries. If multiple filters are provided, the entries returned are the union of all filters. Output can be piped to a second instance to find the intersection of filters instead:
paclog --caller ALPM | paclog --after "$(date -I --date '3 days ago')"
Attempt to repair broken entries in libalpm's database by reinstalling affected packages from the cache:
paccheck --files --db-files --list-broken | pacrepairdb
Generate a report of installed packages including:
Verify installed packages against pacman's database.
Not implemented yet:
Copyright (c) 2012-2016 Andrew Gregory
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4