xbps-bin: really fix previous, by using a hack for now.
--HG-- extra : convert_revision : xtraeme%40gmail.com-20100114052501-e8xak6rhwf8tonf6
This commit is contained in:
parent
37008d3c75
commit
7230203be4
@ -28,6 +28,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include <xbps_api.h>
|
#include <xbps_api.h>
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
@ -318,35 +319,75 @@ xbps_autoupdate_pkgs(bool yes)
|
|||||||
return xbps_exec_transaction(yes);
|
return xbps_exec_transaction(yes);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static char *
|
||||||
xbps_install_new_pkg(const char *pkg)
|
pkgname_from_pkgmatch(const char *pkg)
|
||||||
{
|
{
|
||||||
prop_dictionary_t pkgd;
|
const char *version;
|
||||||
char *pkgname;
|
char *pkgname = NULL;
|
||||||
int rv = 0;
|
|
||||||
bool pkgmatch = false;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if 'pkg' string is a pkgmatch valid pattern or it
|
* Check if 'pkg' string is a pkgmatch valid pattern or it
|
||||||
* is just a pkgname.
|
* is just a pkgname.
|
||||||
|
*
|
||||||
|
* XXX REALLY FIX THIS CRAP! I haven't found much easier ways...
|
||||||
*/
|
*/
|
||||||
if ((pkgname = xbps_get_pkgdep_name(pkg))) {
|
if ((version = xbps_get_pkgdep_version(pkg))) {
|
||||||
if (xbps_cmpver("0.0", pkgname) <= 0)
|
while (*version) {
|
||||||
pkgmatch = true;
|
if (isdigit((unsigned char)*version)) {
|
||||||
else {
|
version++;
|
||||||
free(pkgname);
|
continue;
|
||||||
pkgname = NULL;
|
}
|
||||||
|
if (xbps_cmpver("0", version) <= 0)
|
||||||
|
pkgname = xbps_get_pkgdep_name(pkg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pkgname == NULL && (pkgname = xbps_get_pkg_name(pkg))) {
|
if ((version = xbps_get_pkg_version(pkg))) {
|
||||||
if (xbps_cmpver("0.0", pkgname) <= 0)
|
while (*version) {
|
||||||
pkgmatch = true;
|
if (!isdigit((unsigned char)*version)) {
|
||||||
else {
|
version++;
|
||||||
free(pkgname);
|
continue;
|
||||||
pkgname = NULL;
|
}
|
||||||
|
|
||||||
|
const char *tmp = version;
|
||||||
|
size_t ndigits = 0, tmplen = strlen(tmp);
|
||||||
|
bool dot = false, digit = false;
|
||||||
|
|
||||||
|
while (*tmp) {
|
||||||
|
if (isdigit((unsigned char)*tmp)) {
|
||||||
|
digit = true;
|
||||||
|
ndigits++;
|
||||||
|
}
|
||||||
|
if (*tmp == '.')
|
||||||
|
dot = true;
|
||||||
|
else if (*tmp == '_')
|
||||||
|
ndigits++;
|
||||||
|
|
||||||
|
tmp++;
|
||||||
|
}
|
||||||
|
if ((!dot && !digit) || (!dot && tmplen != ndigits))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (xbps_cmpver("0", version) <= 0)
|
||||||
|
pkgname = xbps_get_pkg_name(pkg);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pkgname == NULL)
|
|
||||||
|
return pkgname;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
xbps_install_new_pkg(const char *pkg)
|
||||||
|
{
|
||||||
|
prop_dictionary_t pkgd;
|
||||||
|
char *pkgname = NULL;
|
||||||
|
int rv = 0;
|
||||||
|
bool pkgmatch = false;
|
||||||
|
|
||||||
|
if ((pkgname = pkgname_from_pkgmatch(pkg)))
|
||||||
|
pkgmatch = true;
|
||||||
|
else
|
||||||
pkgname = __UNCONST(pkg);
|
pkgname = __UNCONST(pkg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user