This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=71a8b54e2b412f1d34dc4f5529f932e893f6dab0 commit 71a8b54e2b412f1d34dc4f5529f932e893f6dab0 Author: Guillem Jover <[email protected]> AuthorDate: Sat Nov 26 04:07:03 2022 +0100 libdpkg: Add new options-dirs module to handle directory option parsing This will centralize all directory option parsing, which we will refactor from the various programs. But we start with the admindir setter, which currently has no function to refactor from. --- lib/dpkg/Makefile.am | 1 + lib/dpkg/{t/t-test-skip.c => options-dirs.c} | 16 +++++++++------- lib/dpkg/options.h | 3 +++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am index d001878f8..892a11278 100644 --- a/lib/dpkg/Makefile.am +++ b/lib/dpkg/Makefile.am @@ -92,6 +92,7 @@ libdpkg_la_SOURCES = \ namevalue.c \ nfmalloc.c \ options.c \ + options-dirs.c \ options-parsers.c \ pager.c \ parse.c \ diff --git a/lib/dpkg/t/t-test-skip.c b/lib/dpkg/options-dirs.c similarity index 71% copy from lib/dpkg/t/t-test-skip.c copy to lib/dpkg/options-dirs.c index 972cdf129..0147c0f19 100644 --- a/lib/dpkg/t/t-test-skip.c +++ b/lib/dpkg/options-dirs.c @@ -1,8 +1,8 @@ /* * libdpkg - Debian packaging suite library routines - * t-test-skip.c - test suite self tests, skip all + * options-dirs.c - CLI options parsing directories * - * Copyright © 2014 Guillem Jover <[email protected]> + * Copyright © 2022 Guillem Jover <[email protected]> * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,11 +21,13 @@ #include <config.h> #include <compat.h> -#include <dpkg/test.h> +#include <dpkg/macros.h> +#include <dpkg/dpkg.h> +#include <dpkg/dpkg-db.h> +#include <dpkg/options.h> -TEST_ENTRY(test) +void +set_admindir(const struct cmdinfo *cip, const char *value) { - test_skip_all("ignore all tests"); - - test_fail(1); + dpkg_db_set_dir(value); } diff --git a/lib/dpkg/options.h b/lib/dpkg/options.h index c820fadcd..5c07d1a89 100644 --- a/lib/dpkg/options.h +++ b/lib/dpkg/options.h @@ -84,6 +84,9 @@ void setobsolete(const struct cmdinfo *cip, const char *value); #define OBSOLETE(longopt, shortopt) \ { longopt, shortopt, 0, NULL, NULL, setobsolete, 0, NULL, NULL } +void +set_admindir(const struct cmdinfo *cip, const char *value); + /** @} */ DPKG_END_DECLS -- Dpkg.Org's dpkg

