Compare commits

...

10 Commits

Author SHA1 Message Date
classabbyamp 50fb2017d0 xbps-uhelper: add verbose output for cmpver/pkgmatch
I can never remember which retval means which thing. This only prints if
-v/--verbose is specified.

Examples:
```
$ ./bin/xbps-uhelper/xbps-uhelper -v cmpver 1 2 ; echo ret: $?
1 < 2
ret: 255
$ ./bin/xbps-uhelper/xbps-uhelper -v cmpver 1 1 ; echo ret: $?
1 = 1
ret: 0
$ ./bin/xbps-uhelper/xbps-uhelper -v cmpver 2 1 ; echo ret: $?
2 > 1
ret: 1
$ ./bin/xbps-uhelper/xbps-uhelper -v pkgmatch 'foo-1.0_1' 'foo>=0' ; echo ret: $?
foo-1.0_1 matches foo>=0
ret: 1
$ ./bin/xbps-uhelper/xbps-uhelper -v pkgmatch 'foo-1.0_1' 'foo<0.1_1' ; echo ret: $?
foo-1.0_1 does not match foo<0.1_1
ret: 0
```

it also seems that getting an error from pkgmatch is currently impossible
2023-06-01 20:21:57 +02:00
classabbyamp b5b26630e9 lib/fetch/http.c: remove unused variable
thanks clang!

fetch/http.c:605:9: error: variable 'r' set but not used [-Werror,-Wunused-but-set-variable]
        int t, r;
               ^
2023-05-30 21:20:05 +02:00
classabbyamp 79f29ed53e bin/xbps-pkgdb: use -errno values for error states
...when checking a package. This will give more relevant information
than before, removes a message that is misleading in many cases, and
allows for some minor simplification.

before:
```
$ doas xbps-pkgdb runit-void; echo $?
ERROR: runit-void: hash mismatch for /etc/runit/2.
ERROR: runit-void: files check FAILED.
Failed to check `runit-void': Operation not permitted
1
```

after:
```
$ doas xbps-pkgdb runit-void; echo $?
ERROR: runit-void: hash mismatch for /etc/runit/2.
ERROR: runit-void: files check FAILED.
1
```

this does not change the behaviour of `xbps-pkgdb -a`
2023-05-30 21:20:05 +02:00
classabbyamp c78231f00c .github/workflows: add doxygen deployment to github pages 2023-02-21 03:24:23 +01:00
Duncan Overbruck 48c3a8208d
doc: tweak doxygen a bit 2023-02-21 02:44:57 +01:00
classabbyamp 426b3090f8 bin/xbps-create/xbps-create.1: add --sourcepkg, alphabetise
for #538

alpha order used: shortopts (upper before lower for each letter), then longopts
2023-02-15 21:46:51 +01:00
Duncan Overbruck e0144062a4 bin/xbps-create: add sourcepkg metadata variable
This can be used similar to source-revisions, it should be set to the
pkgver of the template. This then allows to find removed subpackages by
looking for packages with outdated sourcepkg versions.
2023-02-15 21:46:43 +01:00
classabbyamp 305404744b .github/workflows/ci.yaml: disable pcc CI 2023-02-11 21:33:14 +01:00
classabbyamp d2f5317469 configure: add optional verbose output for flag tests
to aid future debugging, this will show stderr from the compiler when
--verbose is passed to configure.
2023-02-11 21:33:14 +01:00
Duncan Overbruck be2525adc0
bin/xbps-uhelper: format usage like other xbps binaries 2023-02-11 21:32:36 +01:00
12 changed files with 156 additions and 77 deletions

View File

@ -24,11 +24,6 @@ jobs:
- c_library: musl
void_image: ghcr.io/void-linux/void-linux:20220530rc01-full-x86_64-musl
- c_library: musl
void_image: ghcr.io/void-linux/void-linux:20220530rc01-full-x86_64-musl
c_compiler: pcc
extra_deps: gcc
runs-on: ubuntu-latest
container: ${{ matrix.void_image }}
steps:

45
.github/workflows/doxygen.yaml vendored Normal file
View File

@ -0,0 +1,45 @@
name: Deploy Doxygen
on:
push:
branches: [ "master" ]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/void-linux/void-linux:20220530rc01-full-x86_64
steps:
- name: Prepare container
run: |
xbps-install -Syu || xbps-install -yu xbps
xbps-install -Sy bash git gcc make pkg-config zlib-devel openssl-devel libarchive-devel doxygen graphviz
- uses: classabbyamp/treeless-checkout-action@v1
- name: Build
run: |
./configure --enable-api-docs
make -j -C include && make -j -C doc
rm -rf ./api/html/Nodes.xml Info.plist Makefile Tokens.xml
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./api/html
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

View File

@ -827,33 +827,34 @@ main(int argc, char **argv)
{
const char *shortopts = "A:B:C:c:D:F:G:H:hl:M:m:n:P:pqr:R:S:s:t:V";
const struct option longopts[] = {
{ "alternatives", required_argument, NULL, '4' },
{ "architecture", required_argument, NULL, 'A' },
{ "build-options", required_argument, NULL, '2' },
{ "built-with", required_argument, NULL, 'B' },
{ "source-revisions", required_argument, NULL, 'G' },
{ "changelog", required_argument, NULL, 'c'},
{ "compression", required_argument, NULL, '3' },
{ "config-files", required_argument, NULL, 'F' },
{ "conflicts", required_argument, NULL, 'C' },
{ "dependencies", required_argument, NULL, 'D' },
{ "config-files", required_argument, NULL, 'F' },
{ "homepage", required_argument, NULL, 'H' },
{ "desc", required_argument, NULL, 's' },
{ "help", no_argument, NULL, 'h' },
{ "homepage", required_argument, NULL, 'H' },
{ "license", required_argument, NULL, 'l' },
{ "mutable-files", required_argument, NULL, 'M' },
{ "long-desc", required_argument, NULL, 'S' },
{ "maintainer", required_argument, NULL, 'm' },
{ "mutable-files", required_argument, NULL, 'M' },
{ "pkgver", required_argument, NULL, 'n' },
{ "provides", required_argument, NULL, 'P' },
{ "preserve", no_argument, NULL, 'p' },
{ "provides", required_argument, NULL, 'P' },
{ "quiet", no_argument, NULL, 'q' },
{ "replaces", required_argument, NULL, 'R' },
{ "reverts", required_argument, NULL, 'r' },
{ "long-desc", required_argument, NULL, 'S' },
{ "desc", required_argument, NULL, 's' },
{ "tags", required_argument, NULL, 't' },
{ "version", no_argument, NULL, 'V' },
{ "shlib-provides", required_argument, NULL, '0' },
{ "shlib-requires", required_argument, NULL, '1' },
{ "build-options", required_argument, NULL, '2' },
{ "compression", required_argument, NULL, '3' },
{ "alternatives", required_argument, NULL, '4' },
{ "changelog", required_argument, NULL, 'c'},
{ "source-revisions", required_argument, NULL, 'G' },
{ "sourcepkg", required_argument, NULL, '5'},
{ "tags", required_argument, NULL, 't' },
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
struct archive *ar;
@ -864,7 +865,7 @@ main(int argc, char **argv)
const char *provides, *pkgver, *replaces, *reverts, *desc, *ldesc;
const char *arch, *config_files, *mutable_files, *version, *changelog;
const char *buildopts, *shlib_provides, *shlib_requires, *alternatives;
const char *compression, *tags = NULL, *srcrevs = NULL;
const char *compression, *tags = NULL, *srcrevs = NULL, *sourcepkg = NULL;
char pkgname[XBPS_NAME_SIZE], *binpkg, *tname, *p, cwd[PATH_MAX-1];
bool quiet = false, preserve = false;
int c, pkg_fd;
@ -961,6 +962,9 @@ main(int argc, char **argv)
case '4':
alternatives = optarg;
break;
case '5':
sourcepkg = optarg;
break;
case '?':
default:
usage(true);
@ -1028,6 +1032,9 @@ main(int argc, char **argv)
if (srcrevs)
xbps_dictionary_set_cstring_nocopy(pkg_propsd,
"source-revisions", srcrevs);
if (sourcepkg)
xbps_dictionary_set_cstring_nocopy(pkg_propsd,
"sourcepkg", sourcepkg);
if (tags)
xbps_dictionary_set_cstring_nocopy(pkg_propsd,
"tags", tags);

View File

@ -27,6 +27,8 @@ The package builder string, free form.
A list of package patterns that this package should conflict with, separated
by whitespaces. Example:
.Ar 'foo>=1.0 blah<1.0' .
.It Fl c, Fl -changelog Ar string
The package changelog string.
.It Fl D, Fl -dependencies Ar list
A list of package patterns this package depends on, separated by whitespaces. Example:
.Ar 'foo>=1.0 blah-1.0_1' .
@ -70,6 +72,13 @@ A list of tags (categories) this package should be part of, separated by whitesp
.Ar 'development nonfree' .
.It Fl V, Fl -version
Show the version information.
.It Fl -alternatives Ar list
A list of alternatives provided by this package, separated by whitespaces. Example:
.Ar 'group:symlink:target group2:symlink:target' .
If
.Em symlink
is a relative path, the symlink will be created relative to
.Em target .
.It Fl -build-options Ar string
A string containing the build options used in package.
.It Fl -compression Ar none | gzip | bzip2 | xz | lz4 | zstd
@ -81,15 +90,8 @@ A list of provided shared libraries, separated by whitespaces. Example:
.It Fl -shlib-requires Ar list
A list of required shared libraries, separated by whitespaces. Example:
.Ar 'libz.so.1 libfoo.so.2' .
.It Fl -alternatives Ar list
A list of alternatives provided by this package, separated by whitespaces. Example:
.Ar 'group:symlink:target group2:symlink:target' .
If
.Em symlink
is a relative path, the symlink will be created relative to
.Em target .
.It Fl c, Fl -changelog Ar string
The package changelog string.
.It Fl -sourcepkg Ar string
The pkgver of the sourcepkg that was used to build this binary package.
.El
.Sh SEE ALSO
.Xr xbps-alternatives 1 ,

View File

@ -100,7 +100,7 @@ check_pkg_integrity(struct xbps_handle *xhp,
xbps_error_printf("%s: cannot read %s, ignoring...\n",
pkgname, buf);
free(buf);
return -1;
return -ENOENT;
}
rv = xbps_file_sha256_check(buf, sha256);
free(buf);
@ -112,7 +112,7 @@ check_pkg_integrity(struct xbps_handle *xhp,
xbps_object_release(filesd);
xbps_error_printf("%s: metadata file has been "
"modified!\n", pkgname);
return 1;
return -rv;
}
}
@ -135,5 +135,5 @@ do { \
#undef RUN_PKG_CHECK
return errors ? EXIT_FAILURE : EXIT_SUCCESS;
return errors;
}

View File

@ -183,9 +183,9 @@ main(int argc, char **argv)
} else {
for (i = optind; i < argc; i++) {
rv = check_pkg_integrity(&xh, NULL, argv[i]);
if (rv != 0)
if (rv < 0)
xbps_error_printf("Failed to check "
"`%s': %s\n", argv[i], strerror(rv));
"`%s': %s\n", argv[i], strerror(-rv));
}
}

View File

@ -41,34 +41,31 @@ static void __attribute__((noreturn))
usage(void)
{
fprintf(stdout,
"usage: xbps-uhelper [options] [action] [args]\n"
"\n"
" Available actions:\n"
" binpkgarch, binpkgver, cmpver, getpkgdepname,\n"
" getpkgname, getpkgrevision, getpkgversion, pkgmatch, version,\n"
" real-version, arch, getsystemdir, getname, getversion\n"
"\n"
" Action arguments:\n"
" binpkgarch <binpkg> ...\n"
" binpkgver <binpkg> ...\n"
" cmpver <instver> <reqver>\n"
" getpkgdepname <string> ...\n"
" getpkgdepversion <string> ...\n"
" getpkgname <string> ...\n"
" getpkgrevision <string> ...\n"
" getpkgversion <string> ...\n"
" getname <string> ...\n"
" getversion <string> ...\n"
" pkgmatch <pkg-version> <pkg-pattern>\n"
" version <pkgname> ...\n"
" real-version <pkgname> ...\n"
"\n"
" Options shared by all actions:\n"
" -C, --config Path to xbps.conf file.\n"
" -d, --debug Debugging messages to stderr.\n"
" -r, --rootdir <rootdir>\n"
" -V, --version Prints the xbps release version\n");
"Usage: xbps-uhelper [OPTIONS] [MODE] [ARGUMENTS]\n\n"
"OPTIONS\n"
" -C --config <dir> Path to confdir (xbps.d)\n"
" -d --debug Debug mode shown to stderr\n"
" -r --rootdir <dir> Full path to rootdir\n"
" -v --verbose Verbose messages\n"
" -V --version Show XBPS verison\n"
"\n"
"MODE\n"
" arch Prints the configured XBPS architecture\n"
" binpkgarch <binpkg...> Prints the architecture of binpkg names\n"
" binpkgver <binpkg...> Prints the pkgver of binpkg names\n"
" cmpver <version> <version> Compare two version strings\n"
" getname <pkgver|dep...> Prints pkgname from pkgvers or dependencies\n"
" getpkgdepname <dep...> Prints pkgname from dependencies\n"
" getpkgdepversion <dep...> Prints version constraint from dependencies\n"
" getpkgname <pkgver...> Prints pkgname from pkgvers\n"
" getpkgrevision <pkgver...> Prints revision from pkgvers\n"
" getpkgversion <pkgver...> Prints version from pkgvers\n"
" getversion <pkgver|dep...> Prints version from patterns or pkgvers\n"
" pkgmatch <pkgver> <dep> Match pkgver against dependency\n"
" real-version <pkgname...> Prints version of installed real packages\n"
" version <pkgname...> Prints version of installed packages\n"
" getsystemdir Prints the system xbps.d directory\n"
);
exit(EXIT_FAILURE);
}
@ -100,11 +97,12 @@ main(int argc, char **argv)
{ "config", required_argument, NULL, 'C' },
{ "debug", no_argument, NULL, 'd' },
{ "rootdir", required_argument, NULL, 'r' },
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
while ((c = getopt_long(argc, argv, "C:dr:V", longopts, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "C:dr:vV", longopts, NULL)) != -1) {
switch (c) {
case 'C':
confdir = optarg;
@ -116,6 +114,9 @@ main(int argc, char **argv)
case 'd':
flags |= XBPS_FLAG_DEBUG;
break;
case 'v':
flags |= XBPS_FLAG_VERBOSE;
break;
case 'V':
printf("%s\n", XBPS_RELVER);
exit(EXIT_SUCCESS);
@ -322,14 +323,29 @@ main(int argc, char **argv)
/* Matches a pkg with a pattern */
if (argc != 3)
usage();
exit(xbps_pkgpattern_match(argv[1], argv[2]));
rv = xbps_pkgpattern_match(argv[1], argv[2]);
if (flags & XBPS_FLAG_VERBOSE) {
if (rv >= 0)
fprintf(stderr, "%s %s %s\n",
argv[1],
(rv == 1) ? "matches" : "does not match",
argv[2]);
else
xbps_error_printf("%s: not a pattern\n", argv[2]);
}
exit(rv);
} else if (strcmp(argv[0], "cmpver") == 0) {
/* Compare two version strings, installed vs required */
if (argc != 3)
usage();
exit(xbps_cmpver(argv[1], argv[2]));
rv = xbps_cmpver(argv[1], argv[2]);
if (flags & XBPS_FLAG_VERBOSE)
fprintf(stderr, "%s %s %s\n",
argv[1],
(rv == 1) ? ">" : ((rv == 0) ? "=" : "<"),
argv[2]);
exit(rv);
} else if (strcmp(argv[0], "arch") == 0) {
/* returns the xbps native arch */
if (argc != 1)

View File

@ -59,6 +59,8 @@ Enables extra debugging shown to stderr.
Show the help message.
.It Fl r, Fl -rootdir Ar dir
Specifies a full path for the target root directory.
.It Fl v, Fl -verbose
Enables verbose messages.
.It Fl V, Fl -version
Show the version information.
.El
@ -85,6 +87,14 @@ strings,
See
.Sx EXIT STATUS
for more information.
If
.Fl -verbose
is specified, also prints
.Qo
.Ar instver
<|=|>
.Ar reqver
.Qc .
.It Cm getname Ar string ...
Prints the pkgname of
.Ar pkgpatterns
@ -126,6 +136,15 @@ with a
See
.Sx EXIT STATUS
for more information.
If
.Fl -verbose
is specified, also prints
.Qo
.Ar pkgver
matches|does not match
.Ar pkgpattern
.Qc ,
or an error.
.It Cm real-version Ar pkgname ...
Prints the version of installed real packages.
.It Cm version Ar pkgname ...

1
configure vendored
View File

@ -262,6 +262,7 @@ EOF
rv=1
echo "no."
fi
[ -z "$SILENT" ] && cat _ccflag.err
rm -f _ccflag.c _ccflag _ccflag.err
return $rv
}

View File

@ -229,10 +229,7 @@ _xbps_uchroot() {
_xbps_uhelper() {
local ret=1
_arguments \
{-C,--config=-}'[Full path to configuration file]:config file:_files' \
{-d,--debug}'[Debug mode shown to stderr]' \
{-r,--rootdir=-}'[Full path to rootdir]:root dir:_files -/' \
{-V,--version}'[Show XBPS version]' \
$_xbps_common \
'1:action:->actions' \
'*:: :->args' && ret=0
case $state in

View File

@ -313,7 +313,7 @@ SUBGROUPING = YES
# @ingroup) instead of on a separate page (for HTML and Man pages) or
# section (for LaTeX and RTF).
INLINE_GROUPED_CLASSES = NO
INLINE_GROUPED_CLASSES = YES
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
# unions with only public data fields will be shown inline in the documentation
@ -464,14 +464,14 @@ INLINE_INFO = YES
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
SORT_MEMBER_DOCS = NO
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
# brief documentation of file, namespace and class members alphabetically
# by member name. If set to NO (the default) the members will appear in
# declaration order.
SORT_BRIEF_DOCS = YES
SORT_BRIEF_DOCS = NO
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
# will sort the (brief and detailed) documentation of class members so that

View File

@ -602,13 +602,12 @@ http_base64(const char *src)
"0123456789+/";
char *str, *dst;
size_t l;
int t, r;
int t;
l = strlen(src);
if ((str = malloc(((l + 2) / 3) * 4 + 1)) == NULL)
return (NULL);
dst = str;
r = 0;
while (l >= 3) {
t = (src[0] << 16) | (src[1] << 8) | src[2];
@ -617,7 +616,7 @@ http_base64(const char *src)
dst[2] = base64[(t >> 6) & 0x3f];
dst[3] = base64[(t >> 0) & 0x3f];
src += 3; l -= 3;
dst += 4; r += 4;
dst += 4;
}
switch (l) {
@ -628,7 +627,6 @@ http_base64(const char *src)
dst[2] = base64[(t >> 6) & 0x3f];
dst[3] = '=';
dst += 4;
r += 4;
break;
case 1:
t = src[0] << 16;
@ -636,7 +634,6 @@ http_base64(const char *src)
dst[1] = base64[(t >> 12) & 0x3f];
dst[2] = dst[3] = '=';
dst += 4;
r += 4;
break;
case 0:
break;