xbps-digest(1): new utility that replaces "xbps-uhelper digest".

See the manual page:

XBPS-DIGEST(1)              General Commands Manual             XBPS-DIGEST(1)

NAME
     xbps-digest - XBPS utility to generate message digests

SYNOPSIS
     xbps-digest [OPTIONS] [FILE] [FILE+N]

DESCRIPTION
     The xbps-digest utility generates message digests for specified FILE or
     stdin if unset.

OPTIONS
     -m, --mode mode
         Sets the message digest mode. Supported: sha256.  If unset, defaults
         to sha256.

     -h, --help
         Show the help message.

     -V, --version
         Show the version information.

SEE ALSO
     xbps.d(5), xbps-checkvers(1), xbps-create(1), xbps-dgraph(1),
     xbps-fbulk(1), xbps-install(1), xbps-pkgdb(1), xbps-query(1),
     xbps-reconfigure(1), xbps-remove(1), xbps-rindex(1), xbps-uchroot(1),
     xbps-uunshare(1)

AUTHORS
     Juan Romero Pardines <xtraeme@gmail.com>

BUGS
     Probably, but I try to make this not happen. Use it under your own
     responsibility and enjoy your life.

     Report bugs at https://github.com/void-linux/xbps/issues

                                 June 12, 2019

Signed-off-by: Juan RP <xtraeme@gmail.com>
This commit is contained in:
Juan RP
2019-06-12 14:34:58 +02:00
committed by Duncan Overbruck
parent cf4f0f4aa0
commit 9cda7ef72a
20 changed files with 197 additions and 33 deletions

View File

@ -44,7 +44,7 @@ usage(void)
"usage: xbps-uhelper [options] [action] [args]\n"
"\n"
" Available actions:\n"
" binpkgarch, binpkgver, cmpver, digest, fetch, getpkgdepname,\n"
" binpkgarch, binpkgver, cmpver, fetch, getpkgdepname,\n"
" getpkgname, getpkgrevision, getpkgversion, pkgmatch, version,\n"
" real-version, arch, getsystemdir\n"
"\n"
@ -52,7 +52,6 @@ usage(void)
" binpkgarch\t<binpkg>\n"
" binpkgver\t<binpkg>\n"
" cmpver\t\t<instver> <reqver>\n"
" digest\t\t<file> <file1+N>\n"
" fetch\t\t<URL[>filename]> <URL1+N[>filename]>\n"
" getpkgdepname\t<string>\n"
" getpkgdepversion\t<string>\n"
@ -71,7 +70,6 @@ usage(void)
"\n"
" Examples:\n"
" $ xbps-uhelper cmpver 'foo-1.0_1' 'foo-2.1_1'\n"
" $ xbps-uhelper digest file ...\n"
" $ xbps-uhelper fetch http://www.foo.org/file.blob ...\n"
" $ xbps-uhelper getpkgdepname 'foo>=0'\n"
" $ xbps-uhelper getpkgdepversion 'foo>=0'\n"
@ -105,7 +103,7 @@ main(int argc, char **argv)
struct xbps_handle xh;
struct xferstat xfer;
const char *version, *rootdir = NULL, *confdir = NULL;
char *pkgname, *hash, *filename;
char *pkgname, *filename;
int flags = 0, c, rv = 0;
const struct option longopts[] = {
{ NULL, 0, NULL, 0 }
@ -291,21 +289,6 @@ main(int argc, char **argv)
usage();
printf("%s\n", XBPS_SYSDEFCONF_PATH);
} else if (strcmp(argv[0], "digest") == 0) {
/* Prints SHA256 hashes for specified files */
if (argc < 2)
usage();
for (int i = 1; i < argc; i++) {
hash = xbps_file_hash(argv[i]);
if (hash == NULL) {
fprintf(stderr,
"E: couldn't get hash for %s (%s)\n",
argv[i], strerror(errno));
exit(EXIT_FAILURE);
}
printf("%s\n", hash);
}
} else if (strcmp(argv[0], "fetch") == 0) {
/* Fetch a file from specified URL */
if (argc < 2)