xbps-checkvers: implement -s,--show-all.
This replaces -s,--show-missing. This now prints all processed packages and outputs in the following format: pkgname repover srcver if `repover` or `srcver` can't be known, '?' is print. Will be used in xbps-src soon. Thanks to @duncaen for ideas. Signed-off-by: Juan RP <xtraeme@gmail.com>
This commit is contained in:
parent
f6116fc2ac
commit
79bffac877
@ -82,7 +82,7 @@ typedef struct _rcv_t {
|
|||||||
map_t *env;
|
map_t *env;
|
||||||
struct xbps_handle xhp;
|
struct xbps_handle xhp;
|
||||||
xbps_dictionary_t pkgd;
|
xbps_dictionary_t pkgd;
|
||||||
bool show_missing;
|
bool show_all;
|
||||||
bool manual;
|
bool manual;
|
||||||
bool installed;
|
bool installed;
|
||||||
} rcv_t;
|
} rcv_t;
|
||||||
@ -202,7 +202,7 @@ show_usage(const char *prog)
|
|||||||
" -i,--ignore-conf-repos Ignore repositories defined in xbps.d.\n"
|
" -i,--ignore-conf-repos Ignore repositories defined in xbps.d.\n"
|
||||||
" -R,--repository=URL Append repository to the head of repository list.\n"
|
" -R,--repository=URL Append repository to the head of repository list.\n"
|
||||||
" -r,--rootdir=DIRECTORY Set root directory (defaults to /).\n"
|
" -r,--rootdir=DIRECTORY Set root directory (defaults to /).\n"
|
||||||
" -s,--show-missing List any binary packages which are not built.\n"
|
" -s,--show-all List all packages, in the format 'pkgname repover srcver'.\n"
|
||||||
"\n [FILES...] Extra packages to process with the outdated\n"
|
"\n [FILES...] Extra packages to process with the outdated\n"
|
||||||
" ones (only processed if missing).\n\n",
|
" ones (only processed if missing).\n\n",
|
||||||
prog);
|
prog);
|
||||||
@ -614,21 +614,27 @@ rcv_check_version(rcv_t *rcv)
|
|||||||
|
|
||||||
xbps_dictionary_get_cstring_nocopy(rcv->pkgd, "pkgver", &repover);
|
xbps_dictionary_get_cstring_nocopy(rcv->pkgd, "pkgver", &repover);
|
||||||
|
|
||||||
|
if (!repover && rcv->manual) {
|
||||||
if (repover == NULL && (rcv->show_missing || rcv->manual )) {
|
printf("%.*s ? %s\n",
|
||||||
printf("pkgname: %.*s repover: ? srcpkgver: %s\n",
|
|
||||||
(int)pkgname.v.len, pkgname.v.s, srcver+pkgname.v.len+1);
|
(int)pkgname.v.len, pkgname.v.s, srcver+pkgname.v.len+1);
|
||||||
}
|
} else if (repover && !rcv->show_all) {
|
||||||
if (repover != NULL && rcv->show_missing == false) {
|
|
||||||
if (xbps_cmpver(repover+pkgname.v.len+1,
|
if (xbps_cmpver(repover+pkgname.v.len+1,
|
||||||
srcver+pkgname.v.len+1) < 0 ||
|
srcver+pkgname.v.len+1) < 0 ||
|
||||||
check_reverts(repover+pkgname.v.len+1, reverts)) {
|
check_reverts(repover+pkgname.v.len+1, reverts)) {
|
||||||
printf("pkgname: %.*s repover: %s srcpkgver: %s\n",
|
printf("%.*s %s %s\n",
|
||||||
(int)pkgname.v.len, pkgname.v.s,
|
(int)pkgname.v.len, pkgname.v.s,
|
||||||
repover+pkgname.v.len+1,
|
repover+pkgname.v.len+1,
|
||||||
srcver+pkgname.v.len+1);
|
srcver+pkgname.v.len+1);
|
||||||
}
|
}
|
||||||
|
} else if (rcv->show_all) {
|
||||||
|
const char *p = NULL;
|
||||||
|
if (repover == NULL)
|
||||||
|
p = "?";
|
||||||
|
|
||||||
|
printf("%.*s %s %s\n", (int)pkgname.v.len, pkgname.v.s,
|
||||||
|
p ? p : repover+pkgname.v.len+1, srcver+pkgname.v.len+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -689,7 +695,7 @@ main(int argc, char **argv)
|
|||||||
int i, c;
|
int i, c;
|
||||||
rcv_t rcv;
|
rcv_t rcv;
|
||||||
char *distdir = NULL;
|
char *distdir = NULL;
|
||||||
const char *prog = argv[0], *sopts = "hC:D:diR:r:sV", *tmpl;
|
const char *prog = argv[0], *sopts = "hC:D:diIR:r:sV", *tmpl;
|
||||||
const struct option lopts[] = {
|
const struct option lopts[] = {
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "config", required_argument, NULL, 'C' },
|
{ "config", required_argument, NULL, 'C' },
|
||||||
@ -699,7 +705,7 @@ main(int argc, char **argv)
|
|||||||
{ "ignore-conf-repos", no_argument, NULL, 'i' },
|
{ "ignore-conf-repos", no_argument, NULL, 'i' },
|
||||||
{ "repository", required_argument, NULL, 'R' },
|
{ "repository", required_argument, NULL, 'R' },
|
||||||
{ "rootdir", required_argument, NULL, 'r' },
|
{ "rootdir", required_argument, NULL, 'r' },
|
||||||
{ "show-missing", no_argument, NULL, 's' },
|
{ "show-all", no_argument, NULL, 's' },
|
||||||
{ "version", no_argument, NULL, 'V' },
|
{ "version", no_argument, NULL, 'V' },
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
@ -735,7 +741,7 @@ main(int argc, char **argv)
|
|||||||
rcv.rootdir = strdup(optarg);
|
rcv.rootdir = strdup(optarg);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
rcv.show_missing = true;
|
rcv.show_all = true;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
printf("%s\n", XBPS_RELVER);
|
printf("%s\n", XBPS_RELVER);
|
||||||
|
Loading…
Reference in New Issue
Block a user