xbps-reconfigure(8): new option -i, --ignore to ignore pkgs with -a, --all.
-i, --ignore can be specified multiple times and can be used to ignore configuration of those packages while configuration of all packages is being performed. Close #67
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
* state is XBPS_PKG_STATE_INSTALLED.
|
||||
*/
|
||||
int
|
||||
xbps_configure_packages(struct xbps_handle *xhp)
|
||||
xbps_configure_packages(struct xbps_handle *xhp, xbps_array_t ignpkgs)
|
||||
{
|
||||
xbps_dictionary_t pkgd;
|
||||
xbps_object_t obj;
|
||||
@@ -62,6 +62,14 @@ xbps_configure_packages(struct xbps_handle *xhp)
|
||||
while ((obj = xbps_object_iterator_next(iter))) {
|
||||
pkgd = xbps_dictionary_get_keysym(xhp->pkgdb, obj);
|
||||
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
|
||||
if (xbps_array_count(ignpkgs)) {
|
||||
if ((xbps_match_string_in_array(ignpkgs, pkgver)) ||
|
||||
(xbps_match_pkgver_in_array(ignpkgs, pkgver))) {
|
||||
xbps_dbg_printf(xhp, "%s: ignoring pkg %s\n",
|
||||
__func__, pkgver);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
rv = xbps_configure_pkg(xhp, pkgver, true, false);
|
||||
if (rv != 0) {
|
||||
xbps_dbg_printf(xhp, "%s: failed to configure %s: %s\n",
|
||||
|
@@ -128,7 +128,7 @@ match_string_in_array(xbps_array_t array, const char *str, int mode)
|
||||
break;
|
||||
}
|
||||
} else if (mode == 1) {
|
||||
/* match by pkgname */
|
||||
/* match by pkgname against pkgver */
|
||||
pkgdep = xbps_string_cstring_nocopy(obj);
|
||||
if (strchr(pkgdep, '_') == NULL) {
|
||||
tmp = xbps_xasprintf("%s_1", pkgdep);
|
||||
@@ -146,6 +146,18 @@ match_string_in_array(xbps_array_t array, const char *str, int mode)
|
||||
}
|
||||
free(curpkgname);
|
||||
} else if (mode == 2) {
|
||||
/* match by pkgver against pkgname */
|
||||
pkgdep = xbps_string_cstring_nocopy(obj);
|
||||
curpkgname = xbps_pkg_name(str);
|
||||
if (curpkgname == NULL)
|
||||
break;
|
||||
if (strcmp(curpkgname, pkgdep) == 0) {
|
||||
free(curpkgname);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
free(curpkgname);
|
||||
} else if (mode == 3) {
|
||||
/* match pkgpattern against pkgdep */
|
||||
pkgdep = xbps_string_cstring_nocopy(obj);
|
||||
if (strchr(pkgdep, '_') == NULL) {
|
||||
@@ -161,7 +173,7 @@ match_string_in_array(xbps_array_t array, const char *str, int mode)
|
||||
if (tmp != NULL)
|
||||
free(tmp);
|
||||
|
||||
} else if (mode == 3) {
|
||||
} else if (mode == 4) {
|
||||
/* match pkgdep against pkgpattern */
|
||||
pkgdep = xbps_string_cstring_nocopy(obj);
|
||||
if (strchr(pkgdep, '_') == NULL) {
|
||||
@@ -195,14 +207,20 @@ xbps_match_pkgname_in_array(xbps_array_t array, const char *pkgname)
|
||||
return match_string_in_array(array, pkgname, 1);
|
||||
}
|
||||
|
||||
bool
|
||||
xbps_match_pkgver_in_array(xbps_array_t array, const char *pkgver)
|
||||
{
|
||||
return match_string_in_array(array, pkgver, 2);
|
||||
}
|
||||
|
||||
bool
|
||||
xbps_match_pkgpattern_in_array(xbps_array_t array, const char *pattern)
|
||||
{
|
||||
return match_string_in_array(array, pattern, 2);
|
||||
return match_string_in_array(array, pattern, 3);
|
||||
}
|
||||
|
||||
bool
|
||||
xbps_match_pkgdep_in_array(xbps_array_t array, const char *pkgver)
|
||||
{
|
||||
return match_string_in_array(array, pkgver, 3);
|
||||
return match_string_in_array(array, pkgver, 4);
|
||||
}
|
||||
|
Reference in New Issue
Block a user