Fixed installing exact pkg versions on pkgs with hyphens, we use equal sign as delimiter now.
This commit is contained in:
@ -243,14 +243,16 @@ xbps_transaction_install_pkg(const char *pkg, bool reinstall)
|
||||
{
|
||||
prop_dictionary_t pkgd;
|
||||
pkg_state_t state;
|
||||
char *pkgname;
|
||||
size_t len, i;
|
||||
char *pkgname, *pkgstr = NULL;
|
||||
bool bypattern, best, exact;
|
||||
int rv;
|
||||
|
||||
if (xbps_pkgpattern_version(pkg)) {
|
||||
bypattern = true;
|
||||
best = false;
|
||||
exact = false;
|
||||
} else if (xbps_pkg_version(pkg)) {
|
||||
} else if (strchr(pkg, '=')) {
|
||||
exact = true;
|
||||
bypattern = false;
|
||||
best = false;
|
||||
@ -261,10 +263,23 @@ xbps_transaction_install_pkg(const char *pkg, bool reinstall)
|
||||
}
|
||||
|
||||
if (exact) {
|
||||
pkgname = xbps_pkg_name(pkg);
|
||||
/* find out pkgname */
|
||||
pkgname = strdup(pkg);
|
||||
assert(pkgname != NULL);
|
||||
len = strcspn(pkg, "=");
|
||||
for (i = 0; i < len; i++)
|
||||
pkgname[i] = pkg[i];
|
||||
pkgname[i] = '\0';
|
||||
pkgd = xbps_pkgdb_get_pkgd(pkgname, false);
|
||||
free(pkgname);
|
||||
/* replace equal with an hyphen */
|
||||
pkgstr = strdup(pkg);
|
||||
for (i = 0; i < strlen(pkgstr); i++) {
|
||||
if (pkgstr[i] == '=') {
|
||||
pkgstr[i] = '-';
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pkgd = xbps_pkgdb_get_pkgd(pkg, bypattern);
|
||||
}
|
||||
@ -280,7 +295,12 @@ xbps_transaction_install_pkg(const char *pkg, bool reinstall)
|
||||
return EEXIST;
|
||||
}
|
||||
}
|
||||
return transaction_find_pkg(pkg, bypattern, best, exact, TRANS_INSTALL);
|
||||
rv = transaction_find_pkg(pkgstr ? pkgstr : pkg, bypattern,
|
||||
best, exact, TRANS_INSTALL);
|
||||
if (pkgstr != NULL)
|
||||
free(pkgstr);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
|
Reference in New Issue
Block a user