Fixed installing exact pkg versions on pkgs with hyphens, we use equal sign as delimiter now.
This commit is contained in:
parent
f9c72e1d06
commit
34c1269504
3
NEWS
3
NEWS
@ -3,9 +3,10 @@ xbps-0.16 (???):
|
||||
* xbps-bin(8): the 'install' target now can (re)install an exact package
|
||||
version as specified on its arguments, i.e:
|
||||
|
||||
$ xbps-bin install foo-1.0
|
||||
$ xbps-bin install foo=1.0
|
||||
|
||||
If that version is not available no other version will be installed.
|
||||
The equal sign must be used to specify exact versions.
|
||||
|
||||
* xbps-repo(8): 'genindex' target is now able to remove binary packages
|
||||
when a greater version exists on the index.
|
||||
|
@ -56,7 +56,7 @@
|
||||
*/
|
||||
#define XBPS_PKGINDEX_VERSION "1.5"
|
||||
|
||||
#define XBPS_API_VERSION "20120602"
|
||||
#define XBPS_API_VERSION "20120603"
|
||||
#define XBPS_VERSION "0.16"
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user