XBPS major changes in June 2011.
- A configuration file "xbps-conf.plist" replaces the (un)register target in xbps-repo(8) and (un)set-prop in xbps-bin(8). For now, you can set the repositories and prefered virtual packages. - New package pattern matching code from NetBSD. Supports more ways of matching patterns in packages. - Multiple bugs fixed in virtual packages related matching code. --HG-- rename : LICENSE => COPYING
This commit is contained in:
@@ -53,18 +53,15 @@
|
||||
int
|
||||
xbps_check_pkg_integrity_all(void)
|
||||
{
|
||||
prop_dictionary_t d;
|
||||
const struct xbps_handle *xhp;
|
||||
prop_object_t obj;
|
||||
prop_object_iterator_t iter = NULL;
|
||||
const char *pkgname, *version;
|
||||
int rv = 0;
|
||||
size_t npkgs = 0, nbrokenpkgs = 0;
|
||||
|
||||
d = xbps_regpkgdb_dictionary_get();
|
||||
if (d == NULL)
|
||||
return ENODEV;
|
||||
|
||||
iter = xbps_array_iter_from_dict(d, "packages");
|
||||
xhp = xbps_handle_get();
|
||||
iter = xbps_array_iter_from_dict(xhp->regpkgdb_dictionary, "packages");
|
||||
if (iter == NULL) {
|
||||
rv = ENOENT;
|
||||
goto out;
|
||||
@@ -86,8 +83,6 @@ out:
|
||||
if (iter)
|
||||
prop_object_iterator_release(iter);
|
||||
|
||||
xbps_regpkgdb_dictionary_release();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@@ -60,7 +60,7 @@ match_files_by_pattern(prop_dictionary_t pkg_filesd, prop_dictionary_keysym_t ke
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &filestr);
|
||||
if ((strcmp(filestr, pattern) == 0) ||
|
||||
(xbps_pkgpattern_match(filestr, __UNCONST(pattern)) == 1))
|
||||
(xbps_pkgpattern_match(filestr, pattern) == 1))
|
||||
printf("%s: %s (%s)\n", pkgname, filestr, typestr);
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
|
@@ -181,13 +181,13 @@ unpack_progress_cb(void *data)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
prop_dictionary_t dict;
|
||||
const struct xbps_handle *xhp;
|
||||
struct xbps_handle xh;
|
||||
struct xbps_unpack_progress_data xupd;
|
||||
struct xbps_fetch_progress_data xfpd;
|
||||
struct list_pkgver_cb lpc;
|
||||
struct sigaction sa;
|
||||
const char *rootdir, *cachedir;
|
||||
const char *rootdir, *cachedir, *conffile;
|
||||
int i , c, flags, rv;
|
||||
bool yes, purge, with_debug, force_rm_with_deps, recursive_rm;
|
||||
bool install_auto, install_manual, show_download_pkglist_url;
|
||||
@@ -197,11 +197,14 @@ main(int argc, char **argv)
|
||||
yes = purge = force_rm_with_deps = recursive_rm = with_debug = false;
|
||||
install_auto = install_manual = show_download_pkglist_url = false;
|
||||
|
||||
while ((c = getopt(argc, argv, "Ac:dDFfMpRr:Vvy")) != -1) {
|
||||
while ((c = getopt(argc, argv, "AC:c:dDFfMpRr:Vvy")) != -1) {
|
||||
switch (c) {
|
||||
case 'A':
|
||||
install_auto = true;
|
||||
break;
|
||||
case 'C':
|
||||
conffile = optarg;
|
||||
break;
|
||||
case 'c':
|
||||
cachedir = optarg;
|
||||
break;
|
||||
@@ -282,34 +285,23 @@ main(int argc, char **argv)
|
||||
xh.rootdir = rootdir;
|
||||
xh.cachedir = cachedir;
|
||||
xh.flags = flags;
|
||||
xh.conffile = conffile;
|
||||
xh.install_reason_manual = install_manual;
|
||||
xh.install_reason_auto = install_auto;
|
||||
xbps_init(&xh);
|
||||
|
||||
if ((dict = xbps_regpkgdb_dictionary_get()) == NULL) {
|
||||
if (errno && errno != ENOENT) {
|
||||
fprintf(stderr,
|
||||
"E: couldn't initialize regpkgdb dict: %s\n",
|
||||
strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if ((rv = xbps_repository_pool_init()) != 0) {
|
||||
if (rv != ENOENT) {
|
||||
fprintf(stderr,
|
||||
"E: couldn't initialize repository pool: %s\n",
|
||||
strerror(rv));
|
||||
goto out;
|
||||
}
|
||||
if ((rv = xbps_init(&xh)) != 0) {
|
||||
xbps_error_printf("xbps-bin: couldn't initialize library: %s\n",
|
||||
strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
xhp = xbps_handle_get();
|
||||
|
||||
if (strcasecmp(argv[0], "list") == 0) {
|
||||
/* Lists packages currently registered in database. */
|
||||
if (argc < 1 || argc > 2)
|
||||
usage();
|
||||
|
||||
if (dict == NULL) {
|
||||
if (xhp->regpkgdb_dictionary == NULL) {
|
||||
printf("No packages currently installed.\n");
|
||||
goto out;
|
||||
}
|
||||
@@ -335,9 +327,9 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* Find the longest pkgver string to pretty print the output.
|
||||
*/
|
||||
lpc.pkgver_len = find_longest_pkgver(dict);
|
||||
rv = xbps_callback_array_iter_in_dict(dict, "packages",
|
||||
list_pkgs_in_dict, &lpc);
|
||||
lpc.pkgver_len = find_longest_pkgver(xhp->regpkgdb_dictionary);
|
||||
rv = xbps_callback_array_iter_in_dict(xhp->regpkgdb_dictionary,
|
||||
"packages", list_pkgs_in_dict, &lpc);
|
||||
|
||||
} else if (strcasecmp(argv[0], "install") == 0) {
|
||||
/* Installs a binary package and required deps. */
|
||||
@@ -472,8 +464,8 @@ main(int argc, char **argv)
|
||||
if (argc != 1)
|
||||
usage();
|
||||
|
||||
rv = xbps_callback_array_iter_in_dict(dict, "packages",
|
||||
list_manual_packages, NULL);
|
||||
rv = xbps_callback_array_iter_in_dict(xhp->regpkgdb_dictionary,
|
||||
"packages", list_manual_packages, NULL);
|
||||
|
||||
} else if (strcasecmp(argv[0], "show-revdeps") == 0) {
|
||||
/*
|
||||
@@ -494,23 +486,6 @@ main(int argc, char **argv)
|
||||
|
||||
rv = find_files_in_packages(argv[1]);
|
||||
|
||||
} else if (strcasecmp(argv[0], "set-prop") == 0) {
|
||||
if (argc < 2 || argc > 3)
|
||||
usage();
|
||||
/*
|
||||
* Sets a property in a package.
|
||||
*/
|
||||
rv = xbps_property_set(argv[1], argv[2]);
|
||||
|
||||
} else if (strcasecmp(argv[0], "unset-prop") == 0) {
|
||||
/*
|
||||
* Unsets a property in a package.
|
||||
*/
|
||||
if (argc < 2 || argc > 3)
|
||||
usage();
|
||||
|
||||
rv = xbps_property_unset(argv[1], argv[2]);
|
||||
|
||||
} else {
|
||||
usage();
|
||||
}
|
||||
|
@@ -37,31 +37,14 @@
|
||||
int
|
||||
show_pkg_info_from_metadir(const char *pkgname)
|
||||
{
|
||||
prop_dictionary_t d, regpkgd, pkgpropsd;
|
||||
prop_dictionary_t d;
|
||||
|
||||
d = xbps_dictionary_from_metadata_plist(pkgname, XBPS_PKGPROPS);
|
||||
if (d == NULL)
|
||||
return EINVAL;
|
||||
|
||||
regpkgd = xbps_regpkgdb_dictionary_get();
|
||||
pkgpropsd = xbps_find_pkg_in_dict_by_name(regpkgd,
|
||||
"properties", pkgname);
|
||||
if (pkgpropsd == NULL) {
|
||||
show_pkg_info(d);
|
||||
prop_object_release(d);
|
||||
goto out;
|
||||
}
|
||||
if (prop_dictionary_get(pkgpropsd, "hold"))
|
||||
prop_dictionary_set_bool(d, "hold", true);
|
||||
if (prop_dictionary_get(pkgpropsd, "update-first"))
|
||||
prop_dictionary_set_bool(d, "update-first", true);
|
||||
if (prop_dictionary_get(pkgpropsd, "provides"))
|
||||
prop_dictionary_set_bool(d, "virtual-prefer", true);
|
||||
|
||||
show_pkg_info(d);
|
||||
prop_object_release(d);
|
||||
out:
|
||||
xbps_regpkgdb_dictionary_release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -187,7 +187,7 @@ show_pkg_files(prop_dictionary_t filesd)
|
||||
prop_array_t array;
|
||||
prop_object_iterator_t iter = NULL;
|
||||
prop_object_t obj;
|
||||
const char *file, *array_str;
|
||||
const char *file, *array_str, *target;
|
||||
int i = 0;
|
||||
|
||||
/* This will print links, conf_files and files respectively. */
|
||||
@@ -209,7 +209,11 @@ show_pkg_files(prop_dictionary_t filesd)
|
||||
|
||||
while ((obj = prop_object_iterator_next(iter))) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
|
||||
printf("%s\n", file);
|
||||
printf("%s", file);
|
||||
if (prop_dictionary_get_cstring_nocopy(obj,
|
||||
"target", &target))
|
||||
printf(" -> %s", target);
|
||||
printf("\n");
|
||||
}
|
||||
prop_object_iterator_release(iter);
|
||||
}
|
||||
|
@@ -1,13 +1,4 @@
|
||||
'\" t
|
||||
.\" Title: xbps-bin
|
||||
.\" Author: [see the "AUTHORS" section]
|
||||
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
|
||||
.\" Date: 02/26/2011
|
||||
.\" Manual: \ \&
|
||||
.\" Source: \ \&
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "XBPS\-BIN" "8" "02/26/2011" "\ \&" "\ \&"
|
||||
.TH "XBPS\-BIN" "8" "06/04/2011" "\ \&" "\ \&"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * set default formatting
|
||||
.\" -----------------------------------------------------------------
|
||||
@@ -37,6 +28,11 @@ Use of this option takes effect in the \fIautoupdate\fR, \fIinstall\fR and
|
||||
matched.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-C\fR \fIconffile\fR
|
||||
.RS 4
|
||||
Full path to the \fIxbps-conf.plist\fR plist configuration file.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-c\fR \fIcachedir\fR
|
||||
.RS 4
|
||||
Sets the cache directory to store downloaded binary packages from remote repositories\&. By default it\(cqs set to
|
||||
@@ -243,26 +239,6 @@ option is used, package files will be
|
||||
\fBremoved even if its SHA256 hash don\(cqt match\fR\&.
|
||||
.RE
|
||||
.PP
|
||||
\fBset\-prop \fR\fB\fIproperty\fR\fR\fB \fR\fB\fIpkgname\fR\fR
|
||||
.RS 4
|
||||
Sets a
|
||||
\fIproperty\fR
|
||||
for a package as specified in
|
||||
\fIpkgname\fR\&. See the
|
||||
\fIPROPERTIES\fR
|
||||
section below for more information\&.
|
||||
.RE
|
||||
.PP
|
||||
\fBunset\-prop \fR\fB\fIproperty\fR\fR\fB \fR\fB\fIpkgname\fR\fR
|
||||
.RS 4
|
||||
Unsets a
|
||||
\fIproperty\fR
|
||||
for a package as specified in
|
||||
\fIpkgname\fR\&. See the
|
||||
\fIPROPERTIES\fR
|
||||
section below for more information\&.
|
||||
.RE
|
||||
.PP
|
||||
\fBshow \fR\fB\fIpkgname\fR\fR
|
||||
.RS 4
|
||||
Shows information for installed package
|
||||
@@ -318,35 +294,14 @@ The package has been unpacked in destination root directory, but it is not fully
|
||||
.RS 4
|
||||
The package has been removed but configuration files and its metadata directory are still available (and it is still registered in the package database)\&. You can purge safely packages that are in this state, modified configuration files will be preserved\&.
|
||||
.RE
|
||||
.SH "PROPERTIES"
|
||||
.sp
|
||||
Properties can be specified for packages to control behaviour of some aspects in XBPS\&. The following is the list of properties currently implemented:
|
||||
.PP
|
||||
\fBhold\fR
|
||||
.RS 4
|
||||
When this property is set for a package, it will be put on
|
||||
\fIhold\fR
|
||||
i\&.e the package won\(cqt be updated even if there is a newer version in registered repositories\&.
|
||||
.RE
|
||||
.PP
|
||||
\fBupdate\-first\fR
|
||||
.RS 4
|
||||
When this property is set, the package will always be updated before all other packages, regardless of its package dependencies\&.
|
||||
.RE
|
||||
.PP
|
||||
\fBvirtual\fR
|
||||
.RS 4
|
||||
When this property is set, the virtual packages that target package supports via the
|
||||
\fBprovides\fR
|
||||
object will have preference over other packages matching its
|
||||
\fIpackage name\fR\&. A real example is any package that
|
||||
\fIprovides\fR
|
||||
the
|
||||
\fBsyslog\-daemon\-0\fR
|
||||
virtual package, if there are two packages supporting this you can choose which one will be installed\&.
|
||||
.RE
|
||||
.SH "FILES"
|
||||
.PP
|
||||
\fB/etc/xbps-conf.plist\fR
|
||||
.RS 4
|
||||
Default XBPS configuration file\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB/var/db/xbps\fR
|
||||
.RS 4
|
||||
xbps global metadata directory\&.
|
||||
@@ -419,18 +374,6 @@ $ xbps\-bin \-yp remove proplib\-devel
|
||||
|
||||
$ xbps\-bin \-Rp remove bsdtar
|
||||
.RE
|
||||
.PP
|
||||
\fBSets\fR the \fIvirtual\fR property in the \fBxbps\-devel\fR package:
|
||||
.RS 4
|
||||
|
||||
$ xbps\-bin set\-prop virtual xbps\-devel
|
||||
.RE
|
||||
.PP
|
||||
\fBUnsets\fR the \fIhold\fR property in the \fBcoreutils\fR package:
|
||||
.RS 4
|
||||
|
||||
$ xbps\-bin unset\-prop hold coreutils
|
||||
.RE
|
||||
.SH "BUGS"
|
||||
.sp
|
||||
Probably, but I try to make this not happen\&. Use it under your own responsability and enjoy your life\&.
|
||||
|
Reference in New Issue
Block a user