73b6b1b574
Without this xbps-checkvers(1) failed to check for the correct binpkg version in xbps repos.
82 lines
2.3 KiB
Diff
82 lines
2.3 KiB
Diff
Sync xbps-checkvers(1) with code from 0.58.
|
|
This fixes detection of subpkgs in xbps repos.
|
|
--xtraeme
|
|
|
|
--- bin/xbps-checkvers/main.c.orig 2019-10-27 09:50:11.000000000 +0100
|
|
+++ bin/xbps-checkvers/main.c 2020-01-04 11:24:38.109708818 +0100
|
|
@@ -46,22 +46,15 @@
|
|
#define GOT_REVISION_VAR 0x4
|
|
|
|
typedef struct _rcv_t {
|
|
- const char *prog, *fname;
|
|
- char *xbps_conf, *rootdir, *distdir;
|
|
- char *buf;
|
|
- size_t bufsz;
|
|
- size_t len;
|
|
- char *ptr;
|
|
+ const char *prog, *fname, *format;
|
|
+ char *xbps_conf, *rootdir, *distdir, *buf, *ptr, *cachefile;
|
|
+ size_t bufsz, len;
|
|
uint8_t have_vars;
|
|
+ bool show_all, manual, installed;
|
|
xbps_dictionary_t env;
|
|
xbps_dictionary_t pkgd;
|
|
xbps_dictionary_t cache;
|
|
struct xbps_handle xhp;
|
|
- bool show_all;
|
|
- bool manual;
|
|
- bool installed;
|
|
- const char *format;
|
|
- char *cachefile;
|
|
} rcv_t;
|
|
|
|
typedef int (*rcv_check_func)(rcv_t *);
|
|
@@ -535,9 +528,10 @@ static int
|
|
rcv_check_version(rcv_t *rcv)
|
|
{
|
|
const char *repover = NULL;
|
|
- char srcver[BUFSIZ] = { '\0' };
|
|
+ char srcver[BUFSIZ] = { '\0' }, *binpkgname = NULL, *s = NULL;
|
|
const char *pkgname, *version, *revision, *reverts, *repourl;
|
|
int sz;
|
|
+ size_t len;
|
|
|
|
assert(rcv);
|
|
|
|
@@ -568,17 +562,24 @@ rcv_check_version(rcv_t *rcv)
|
|
if (sz < 0 || (size_t)sz >= sizeof srcver)
|
|
exit(EXIT_FAILURE);
|
|
|
|
+ /* Check against binpkg's pkgname, not pkgname from template */
|
|
+ s = strchr(rcv->fname, '/');
|
|
+ len = s ? strlen(rcv->fname) - strlen(s) : strlen(rcv->fname);
|
|
+ binpkgname = strndup(rcv->fname, len);
|
|
+ assert(binpkgname);
|
|
+
|
|
repourl = NULL;
|
|
if (rcv->installed) {
|
|
- rcv->pkgd = xbps_pkgdb_get_pkg(&rcv->xhp, pkgname);
|
|
+ rcv->pkgd = xbps_pkgdb_get_pkg(&rcv->xhp, binpkgname);
|
|
} else {
|
|
- rcv->pkgd = xbps_rpool_get_pkg(&rcv->xhp, pkgname);
|
|
+ rcv->pkgd = xbps_rpool_get_pkg(&rcv->xhp, binpkgname);
|
|
xbps_dictionary_get_cstring_nocopy(rcv->pkgd, "repository", &repourl);
|
|
}
|
|
xbps_dictionary_get_cstring_nocopy(rcv->pkgd, "pkgver", &repover);
|
|
if (repover)
|
|
- repover += strlen(pkgname)+1;
|
|
+ repover += strlen(binpkgname)+1;
|
|
|
|
+ free(binpkgname);
|
|
if (!repover && rcv->manual)
|
|
;
|
|
else if (rcv->show_all)
|
|
@@ -717,7 +718,7 @@ main(int argc, char **argv)
|
|
free(tmp);
|
|
}
|
|
|
|
- rcv.cachefile = xbps_xasprintf("%s/.xbps-checkvers.plist", rcv.distdir);
|
|
+ rcv.cachefile = xbps_xasprintf("%s/.xbps-checkvers-0.58.plist", rcv.distdir);
|
|
|
|
argc -= optind;
|
|
argv += optind;
|