commit: c10cf2ddccf06d863b3bdfca96d54a8c14ad399c Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Wed Aug 20 16:02:39 2025 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Wed Aug 20 16:02:39 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c10cf2dd
gpkg: implement GLEP-78 gpkg support Activated by -g, build gpkg.tar instead of tbz2 (xpak) files. This is not the default yet, because the -s option for signing still needs to be implemented, and qmerge needs to support unpacking them too. Bug: https://bugs.gentoo.org/833571 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> Makefile.am | 2 + Makefile.in | 9 +- autotools/gnulib/Makefile.in | 2 + config.h.in | 6 + configure | 227 ++++++++++++++++++-------- configure.ac | 59 ++++--- libq/Makefile.in | 2 + libq/hash.c | 9 -- libq/hash.h | 9 ++ man/qpkg.1 | 5 +- qmanifest.c | 10 +- qpkg.c | 358 ++++++++++++++++++++++++++++++++++++++++- tests/Makefile.in | 2 + tests/atom_compare/Makefile.in | 2 + tests/atom_explode/Makefile.in | 2 + tests/copy_file/Makefile.in | 2 + tests/install/Makefile.in | 2 + tests/mkdir/Makefile.in | 2 + tests/profile/Makefile.in | 2 + tests/qatom/Makefile.in | 2 + tests/qcheck/Makefile.in | 2 + tests/qdepends/Makefile.in | 2 + tests/qfile/Makefile.in | 2 + tests/qlist/Makefile.in | 2 + tests/qlop/Makefile.in | 2 + tests/qmanifest/Makefile.in | 2 + tests/qmerge/Makefile.in | 2 + tests/qtbz2/Makefile.in | 2 + tests/quse/Makefile.in | 2 + tests/qxpak/Makefile.in | 2 + tests/rmspace/Makefile.in | 2 + tests/source/Makefile.in | 2 + 32 files changed, 627 insertions(+), 111 deletions(-) diff --git a/Makefile.am b/Makefile.am index d3ebafc..9f62153 100644 --- a/Makefile.am +++ b/Makefile.am @@ -78,6 +78,7 @@ q_CPPFLAGS = \ $(OPENMP_CFLAGS) \ $(LIBBL2_CFLAGS) \ $(LIBZ_CFLAGS) \ + $(LIBARCHIVE_CFLAGS) \ $(NULL) q_LDADD = \ $(top_builddir)/libq/libq.a \ @@ -86,6 +87,7 @@ q_LDADD = \ $(LIBBL2_LIBS) \ $(LIBZ_LIBS) \ $(GPGME_LIBS) \ + $(LIBARCHIVE_LIBS) \ $(LIB_CRYPTO) \ $(LIB_CLOCK_GETTIME) \ $(LIB_EACCESS) \ diff --git a/Makefile.in b/Makefile.in index a947a0b..7896551 100644 --- a/Makefile.in +++ b/Makefile.in @@ -292,7 +292,8 @@ q_DEPENDENCIES = $(top_builddir)/libq/libq.a \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -1318,6 +1319,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ @@ -1804,7 +1807,8 @@ q_SOURCES = main.c q.c qatom.c qcheck.c qdepends.c qfile.c qgrep.c \ $(am__append_1) q_CPPFLAGS = -I$(top_srcdir)/libq -I$(top_builddir)/autotools/gnulib \ -I$(top_srcdir)/autotools/gnulib $(OPENMP_CFLAGS) \ - $(LIBBL2_CFLAGS) $(LIBZ_CFLAGS) $(NULL) $(am__append_2) + $(LIBBL2_CFLAGS) $(LIBZ_CFLAGS) $(LIBARCHIVE_CFLAGS) $(NULL) \ + $(am__append_2) q_LDADD = \ $(top_builddir)/libq/libq.a \ $(top_builddir)/autotools/gnulib/libgnu.a \ @@ -1812,6 +1816,7 @@ q_LDADD = \ $(LIBBL2_LIBS) \ $(LIBZ_LIBS) \ $(GPGME_LIBS) \ + $(LIBARCHIVE_LIBS) \ $(LIB_CRYPTO) \ $(LIB_CLOCK_GETTIME) \ $(LIB_EACCESS) \ diff --git a/autotools/gnulib/Makefile.in b/autotools/gnulib/Makefile.in index b409a62..28c6bff 100644 --- a/autotools/gnulib/Makefile.in +++ b/autotools/gnulib/Makefile.in @@ -1629,6 +1629,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/config.h.in b/config.h.in index 0701db4..4811d0a 100644 --- a/config.h.in +++ b/config.h.in @@ -677,6 +677,9 @@ /* Define to 1 if you have the 'gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY +/* Define if you have gpgme */ +#undef HAVE_GPGME + /* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */ #undef HAVE_INTMAX_T @@ -705,6 +708,9 @@ /* Define if the ldexp function is available in libc. */ #undef HAVE_LDEXP_IN_LIBC +/* Define if you have libarchive */ +#undef HAVE_LIBARCHIVE + /* Define to 1 if you have the <libgen.h> header file. */ #undef HAVE_LIBGEN_H diff --git a/configure b/configure index cfe4ddf..97f2c61 100755 --- a/configure +++ b/configure @@ -655,10 +655,12 @@ LTLIBOBJS LIBOBJS QMANIFEST_ENABLED_FALSE QMANIFEST_ENABLED_TRUE -GPGME_LIBS -GPGME_CFLAGS LIBZ_LIBS LIBZ_CFLAGS +LIBARCHIVE_LIBS +LIBARCHIVE_CFLAGS +GPGME_LIBS +GPGME_CFLAGS LIBBL2_LIBS LIBBL2_CFLAGS PKG_CONFIG_LIBDIR @@ -2158,10 +2160,12 @@ PKG_CONFIG_PATH PKG_CONFIG_LIBDIR LIBBL2_CFLAGS LIBBL2_LIBS -LIBZ_CFLAGS -LIBZ_LIBS GPGME_CFLAGS -GPGME_LIBS' +GPGME_LIBS +LIBARCHIVE_CFLAGS +LIBARCHIVE_LIBS +LIBZ_CFLAGS +LIBZ_LIBS' # Initialize some variables set by options. @@ -2838,11 +2842,15 @@ Some influential environment variables: LIBBL2_CFLAGS C compiler flags for LIBBL2, overriding pkg-config LIBBL2_LIBS linker flags for LIBBL2, overriding pkg-config - LIBZ_CFLAGS C compiler flags for LIBZ, overriding pkg-config - LIBZ_LIBS linker flags for LIBZ, overriding pkg-config GPGME_CFLAGS C compiler flags for GPGME, overriding pkg-config GPGME_LIBS linker flags for GPGME, overriding pkg-config + LIBARCHIVE_CFLAGS + C compiler flags for LIBARCHIVE, overriding pkg-config + LIBARCHIVE_LIBS + linker flags for LIBARCHIVE, overriding pkg-config + LIBZ_CFLAGS C compiler flags for LIBZ, overriding pkg-config + LIBZ_LIBS linker flags for LIBZ, overriding pkg-config Use these variables to override the choices made by 'configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -37267,6 +37275,7 @@ then : fi +# always check libb2, gpgme and libarchive, necessary for gpkg support @@ -37402,9 +37411,6 @@ fi if test -z "$PKG_CONFIG"; then as_fn_error $? "pkg-config not found" "$LINENO" 5 fi -if test "x${enable_qmanifest}" != "xno" -then : - pkg_failed=no { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libb2" >&5 @@ -37465,31 +37471,31 @@ fi echo "$LIBBL2_PKG_ERRORS" >&5 - if test "x${enable_qmanifest}" = "xyes" + if test "x${enable_qmanifest}" = "xyes" then : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "--enable-qmanifest was given, but libb2.pc could not be found See 'config.log' for more details" "$LINENO" 5; } fi - LIBBL2="no: missing dependencies" + LIBBL2="no: missing dependencies" elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - if test "x${enable_qmanifest}" = "xyes" + if test "x${enable_qmanifest}" = "xyes" then : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} as_fn_error $? "--enable-qmanifest was given, but libb2.pc could not be found See 'config.log' for more details" "$LINENO" 5; } fi - LIBBL2="no: missing dependencies" + LIBBL2="no: missing dependencies" else LIBBL2_CFLAGS=$pkg_cv_LIBBL2_CFLAGS @@ -37500,25 +37506,25 @@ printf "%s\n" "yes" >&6; } printf "%s\n" "#define HAVE_BLAKE2B 1" >>confdefs.h - LIBBL2="yes" + LIBBL2="yes" fi pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5 -printf %s "checking for zlib... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gpgme" >&5 +printf %s "checking for gpgme... " >&6; } -if test -n "$LIBZ_CFLAGS"; then - pkg_cv_LIBZ_CFLAGS="$LIBZ_CFLAGS" +if test -n "$GPGME_CFLAGS"; then + pkg_cv_GPGME_CFLAGS="$GPGME_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5 - ($PKG_CONFIG --exists --print-errors "zlib") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gpgme\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gpgme") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_LIBZ_CFLAGS=`$PKG_CONFIG --cflags "zlib" 2>/dev/null` + pkg_cv_GPGME_CFLAGS=`$PKG_CONFIG --cflags "gpgme" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -37526,16 +37532,16 @@ fi else pkg_failed=untried fi -if test -n "$LIBZ_LIBS"; then - pkg_cv_LIBZ_LIBS="$LIBZ_LIBS" +if test -n "$GPGME_LIBS"; then + pkg_cv_GPGME_LIBS="$GPGME_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5 - ($PKG_CONFIG --exists --print-errors "zlib") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gpgme\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gpgme") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_LIBZ_LIBS=`$PKG_CONFIG --libs "zlib" 2>/dev/null` + pkg_cv_GPGME_LIBS=`$PKG_CONFIG --libs "gpgme" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -37556,68 +37562,68 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBZ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib" 2>&1` + GPGME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gpgme" 2>&1` else - LIBZ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib" 2>&1` + GPGME_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gpgme" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$LIBZ_PKG_ERRORS" >&5 + echo "$GPGME_PKG_ERRORS" >&5 - if test "x${enable_qmanifest}" = "xyes" + if test "x${enable_qmanifest}" = "xyes" then : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "--enable-qmanifest was given, but zlib.pc could not be found +as_fn_error $? "--enable-qmanifest was given, but gpgme.pc could not be found See 'config.log' for more details" "$LINENO" 5; } fi - LIBZ="no: missing dependencies" + GPGME="no: missing dependencies" elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - if test "x${enable_qmanifest}" = "xyes" + if test "x${enable_qmanifest}" = "xyes" then : - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "--enable-qmanifest was given, but zlib.pc could not be found +as_fn_error $? "--enable-qmanifest was given, but gpgme.pc could not be found See 'config.log' for more details" "$LINENO" 5; } fi - LIBZ="no: missing dependencies" + GPGME="no: missing dependencies" else - LIBZ_CFLAGS=$pkg_cv_LIBZ_CFLAGS - LIBZ_LIBS=$pkg_cv_LIBZ_LIBS + GPGME_CFLAGS=$pkg_cv_GPGME_CFLAGS + GPGME_LIBS=$pkg_cv_GPGME_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } -printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h +printf "%s\n" "#define HAVE_GPGME 1" >>confdefs.h - LIBZ="yes" + GPGME="yes" fi pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gpgme" >&5 -printf %s "checking for gpgme... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libarchive" >&5 +printf %s "checking for libarchive... " >&6; } -if test -n "$GPGME_CFLAGS"; then - pkg_cv_GPGME_CFLAGS="$GPGME_CFLAGS" +if test -n "$LIBARCHIVE_CFLAGS"; then + pkg_cv_LIBARCHIVE_CFLAGS="$LIBARCHIVE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gpgme\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gpgme") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libarchive\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libarchive") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GPGME_CFLAGS=`$PKG_CONFIG --cflags "gpgme" 2>/dev/null` + pkg_cv_LIBARCHIVE_CFLAGS=`$PKG_CONFIG --cflags "libarchive" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -37625,16 +37631,16 @@ fi else pkg_failed=untried fi -if test -n "$GPGME_LIBS"; then - pkg_cv_GPGME_LIBS="$GPGME_LIBS" +if test -n "$LIBARCHIVE_LIBS"; then + pkg_cv_LIBARCHIVE_LIBS="$LIBARCHIVE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gpgme\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gpgme") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libarchive\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libarchive") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_GPGME_LIBS=`$PKG_CONFIG --libs "gpgme" 2>/dev/null` + pkg_cv_LIBARCHIVE_LIBS=`$PKG_CONFIG --libs "libarchive" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -37655,12 +37661,96 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GPGME_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gpgme" 2>&1` + LIBARCHIVE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libarchive" 2>&1` else - GPGME_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gpgme" 2>&1` + LIBARCHIVE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libarchive" 2>&1` fi # Put the nasty error message in config.log where it belongs - echo "$GPGME_PKG_ERRORS" >&5 + echo "$LIBARCHIVE_PKG_ERRORS" >&5 + + + LIBARCHIVE="no: missing dependencies" + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + LIBARCHIVE="no: missing dependencies" + +else + LIBARCHIVE_CFLAGS=$pkg_cv_LIBARCHIVE_CFLAGS + LIBARCHIVE_LIBS=$pkg_cv_LIBARCHIVE_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + +printf "%s\n" "#define HAVE_LIBARCHIVE 1" >>confdefs.h + + LIBARCHIVE="yes" + +fi + +if test "x${enable_qmanifest}" != "xno" +then : + + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5 +printf %s "checking for zlib... " >&6; } + +if test -n "$LIBZ_CFLAGS"; then + pkg_cv_LIBZ_CFLAGS="$LIBZ_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBZ_CFLAGS=`$PKG_CONFIG --cflags "zlib" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBZ_LIBS"; then + pkg_cv_LIBZ_LIBS="$LIBZ_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"zlib\""; } >&5 + ($PKG_CONFIG --exists --print-errors "zlib") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBZ_LIBS=`$PKG_CONFIG --libs "zlib" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBZ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "zlib" 2>&1` + else + LIBZ_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "zlib" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBZ_PKG_ERRORS" >&5 if test "x${enable_qmanifest}" = "xyes" @@ -37668,11 +37758,11 @@ then : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "--enable-qmanifest was given, but gpgme.pc could not be found +as_fn_error $? "--enable-qmanifest was given, but zlib.pc could not be found See 'config.log' for more details" "$LINENO" 5; } fi - GPGME="no: missing dependencies" + LIBZ="no: missing dependencies" elif test $pkg_failed = untried; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -37683,19 +37773,22 @@ then : { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "--enable-qmanifest was given, but gpgme.pc could not be found +as_fn_error $? "--enable-qmanifest was given, but zlib.pc could not be found See 'config.log' for more details" "$LINENO" 5; } fi - GPGME="no: missing dependencies" + LIBZ="no: missing dependencies" else - GPGME_CFLAGS=$pkg_cv_GPGME_CFLAGS - GPGME_LIBS=$pkg_cv_GPGME_LIBS + LIBZ_CFLAGS=$pkg_cv_LIBZ_CFLAGS + LIBZ_LIBS=$pkg_cv_LIBZ_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - GPGME="yes" + +printf "%s\n" "#define HAVE_LIBZ 1" >>confdefs.h + + LIBZ="yes" fi @@ -40286,3 +40379,5 @@ printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 fi +# vim: set ts=2 sw=2 softtabstop=2 expandtab: + diff --git a/configure.ac b/configure.ac index 7d101c4..04fe65c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# Copyright 2011-2022 Gentoo Authors +# Copyright 2011-2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # # Copyright 2011-2014 Mike Frysinger - <[email protected]> @@ -53,17 +53,43 @@ AC_SUBST([CONFIG_EPREFIX], ["$with_eprefix"]) AC_ARG_ENABLE([qmanifest], [AS_HELP_STRING([--enable-qmanifest], [support qmanifest applet])]) -AS_IF([test "x${enable_qmanifest}" != "xno"], [ - PKG_CHECK_MODULES([LIBBL2], [libb2], [ - AC_DEFINE([HAVE_BLAKE2B], [1], [Define if you have blake2b]) - LIBBL2="yes" - ], [ - AS_IF([test "x${enable_qmanifest}" = "xyes"], [ - AC_MSG_FAILURE([--enable-qmanifest was given, but libb2.pc could not be found]) - ]) - LIBBL2="no: missing dependencies" - ]) +# always check libb2, gpgme and libarchive, necessary for gpkg support +PKG_CHECK_MODULES([LIBBL2], [libb2], + [ + AC_DEFINE([HAVE_BLAKE2B], [1], [Define if you have blake2b]) + LIBBL2="yes" + ], + [ + AS_IF([test "x${enable_qmanifest}" = "xyes"], + [ + AC_MSG_FAILURE([--enable-qmanifest was given, but libb2.pc could not be found]) + ]) + LIBBL2="no: missing dependencies" + ]) + +PKG_CHECK_MODULES([GPGME], [gpgme], + [ + AC_DEFINE([HAVE_GPGME], [1], [Define if you have gpgme]) + GPGME="yes" + ], + [ + AS_IF([test "x${enable_qmanifest}" = "xyes"], + [ + AC_MSG_FAILURE([--enable-qmanifest was given, but gpgme.pc could not be found]) + ]) + GPGME="no: missing dependencies" + ]) + +PKG_CHECK_MODULES([LIBARCHIVE], [libarchive], + [ + AC_DEFINE([HAVE_LIBARCHIVE], [1], [Define if you have libarchive]) + LIBARCHIVE="yes" + ], + [ + LIBARCHIVE="no: missing dependencies" + ]) +AS_IF([test "x${enable_qmanifest}" != "xno"], [ PKG_CHECK_MODULES([LIBZ], [zlib], [ AC_DEFINE([HAVE_LIBZ], [1], [Define if you have zlib]) LIBZ="yes" @@ -74,15 +100,6 @@ AS_IF([test "x${enable_qmanifest}" != "xno"], [ LIBZ="no: missing dependencies" ]) - PKG_CHECK_MODULES([GPGME], [gpgme], [ - GPGME="yes" - ], [ - AS_IF([test "x${enable_qmanifest}" = "xyes"], [ - AC_MSG_FAILURE([--enable-qmanifest was given, but gpgme.pc could not be found]) - ]) - GPGME="no: missing dependencies" - ]) - AC_MSG_CHECKING([whether to enable qmanifest]) AS_IF([test "x${LIBBL2}${LIBZ}${GPGME}" = "xyesyesyes"], [ AC_MSG_RESULT([yes]) @@ -154,3 +171,5 @@ AC_CONFIG_FILES([ tests/source/Makefile ]) AC_OUTPUT + +# vim: set ts=2 sw=2 softtabstop=2 expandtab: diff --git a/libq/Makefile.in b/libq/Makefile.in index f7100bb..1f8231f 100644 --- a/libq/Makefile.in +++ b/libq/Makefile.in @@ -1218,6 +1218,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/libq/hash.c b/libq/hash.c index f3a440f..2e8b72d 100644 --- a/libq/hash.c +++ b/libq/hash.c @@ -12,15 +12,6 @@ #include "main.h" -#ifdef HAVE_BLAKE2B -# include <blake2.h> -#endif - -#include "md5.h" -#include "sha1.h" -#include "sha256.h" -#include "sha512.h" - #include "hash.h" void diff --git a/libq/hash.h b/libq/hash.h index bc72e52..85fc71d 100644 --- a/libq/hash.h +++ b/libq/hash.h @@ -13,6 +13,15 @@ #include <sys/stat.h> #include <fcntl.h> +#ifdef HAVE_BLAKE2B +# include <blake2.h> +#endif + +#include "md5.h" +#include "sha1.h" +#include "sha256.h" +#include "sha512.h" + enum hash_impls { HASH_MD5 = 1<<0, HASH_SHA1 = 1<<1, diff --git a/man/qpkg.1 b/man/qpkg.1 index 5408474..71a2573 100644 --- a/man/qpkg.1 +++ b/man/qpkg.1 @@ -1,5 +1,5 @@ .\" generated by mkman.py, please do NOT edit! -.TH qpkg "1" "Jan 2024" "Gentoo Foundation" "qpkg" +.TH qpkg "1" "Aug 2025" "Gentoo Foundation" "qpkg" .SH NAME qpkg \- create or manipulate Gentoo binpkgs .SH SYNOPSIS @@ -18,6 +18,9 @@ clean pkgdir of files that are not installed. \fB\-E\fR, \fB\-\-eclean\fR clean pkgdir of files that are not in the tree anymore. .TP +\fB\-g\fR, \fB\-\-gpkg\fR +build gpkg instead of tbz2 package. +.TP \fB\-p\fR, \fB\-\-pretend\fR pretend only. .TP diff --git a/qmanifest.c b/qmanifest.c index bf08a61..7ee6f3a 100644 --- a/qmanifest.c +++ b/qmanifest.c @@ -29,8 +29,6 @@ #include <sys/stat.h> #include <sys/types.h> #include <sys/time.h> -#include <openssl/sha.h> -#include <blake2.h> #include <zlib.h> #include <gpgme.h> @@ -185,8 +183,8 @@ write_hashes( gzFile gm) { size_t flen = 0; - char sha256[(SHA256_DIGEST_LENGTH * 2) + 1]; - char sha512[(SHA512_DIGEST_LENGTH * 2) + 1]; + char sha256[(SHA256_DIGEST_SIZE * 2) + 1]; + char sha512[(SHA512_DIGEST_SIZE * 2) + 1]; char blak2b[(BLAKE2B_OUTBYTES * 2) + 1]; char data[8192]; char fname[8192]; @@ -1036,8 +1034,8 @@ verify_file(const char *dir, char *mfline, const char *mfest, verify_msg **msgs) char *p; char buf[8192]; size_t flen = 0; - char sha256[(SHA256_DIGEST_LENGTH * 2) + 1]; - char sha512[(SHA512_DIGEST_LENGTH * 2) + 1]; + char sha256[(SHA256_DIGEST_SIZE * 2) + 1]; + char sha512[(SHA512_DIGEST_SIZE * 2) + 1]; char blak2b[(BLAKE2B_OUTBYTES * 2) + 1]; char ret = 0; diff --git a/qpkg.c b/qpkg.c index 85dbbcf..6b71eed 100644 --- a/qpkg.c +++ b/qpkg.c @@ -1,5 +1,5 @@ /* - * Copyright 2005-2024 Gentoo Foundation + * Copyright 2005-2025 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 * * Copyright 2005-2010 Ned Ludd - <[email protected]> @@ -18,6 +18,11 @@ #include <sys/types.h> #include <sys/stat.h> +#ifdef HAVE_LIBARCHIVE +# include <archive.h> +# include <archive_entry.h> +#endif + #include "atom.h" #include "basename.h" #include "contents.h" @@ -32,10 +37,11 @@ #include "xmkdir.h" #include "xpak.h" -#define QPKG_FLAGS "cEpP:" COMMON_FLAGS +#define QPKG_FLAGS "cEgpP:" COMMON_FLAGS static struct option const qpkg_long_opts[] = { {"clean", no_argument, NULL, 'c'}, {"eclean", no_argument, NULL, 'E'}, + {"gpkg", no_argument, NULL, 'g'}, {"pretend", no_argument, NULL, 'p'}, {"pkgdir", a_argument, NULL, 'P'}, COMMON_LONG_OPTS @@ -43,6 +49,7 @@ static struct option const qpkg_long_opts[] = { static const char * const qpkg_opts_help[] = { "clean pkgdir of files that are not installed", "clean pkgdir of files that are not in the tree anymore", + "build gpkg instead of tbz2 package", "pretend only", "alternate package directory", COMMON_OPTS_HELP @@ -168,6 +175,329 @@ check_pkg_install_mask(char *name) return ret; } +/* this is a simplified version of write_hadhes from qmanifest, maybe + * one day consolidate the two? */ +static void +write_hashes +( + const char *fname, + const char *type, + int fd +) +{ + size_t flen = 0; + char sha512[(SHA512_DIGEST_SIZE * 2) + 1]; + char blak2b[(BLAKE2B_OUTBYTES * 2) + 1]; + char data[8192]; + size_t len; + const char *name; + + name = strrchr(fname, '/'); + if (name != NULL) + name++; + else + name = ""; + + /* this is HASH_DEFAULT, but we still have to set the right buffers, + * so do it statically */ + hash_compute_file(fname, NULL, sha512, blak2b, &flen, + HASH_SHA512 | HASH_BLAKE2B); + + len = snprintf(data, sizeof(data), "%s %s %zd", type, name, flen); + len += snprintf(data + len, sizeof(data) - len, + " SHA512 %s", sha512); + len += snprintf(data + len, sizeof(data) - len, + " BLAKE2B %s", blak2b); + len += snprintf(data + len, sizeof(data) - len, "\n"); + + write(fd, data, len); +} + +static char * +qgpkg_set_compression(struct archive *a) +{ + /* we compress the metadata and image using zstd as the compression + * ratios are close, but the decompression speed is a lot faster, + * when unavailable, we go down to xz, bzip2, gzip, lz4 and finally + * none */ + if (archive_write_add_filter_zstd(a) == ARCHIVE_OK) + return ".zst"; + if (archive_write_add_filter_xz(a) == ARCHIVE_OK) + return ".xz"; + if (archive_write_add_filter_bzip2(a) == ARCHIVE_OK) + return ".bz2"; + if (archive_write_add_filter_gzip(a) == ARCHIVE_OK) + return ".gz"; + if (archive_write_add_filter_lz4(a) == ARCHIVE_OK) + return ".lz4"; + + /* none, no filtering */ + return ""; +} + +static int +qgpkg_make(tree_pkg_ctx *pkg) +{ +#ifdef HAVE_LIBARCHIVE + struct archive *a; + struct archive_entry *entry; + struct stat st; + struct dirent **files = NULL; + char tmpdir[BUFSIZE]; + char gpkg[BUFSIZE + 32]; + char buf[BUFSIZE * 4]; + char ename[BUFSIZE]; + char *filter; + char *line; + char *savep; + int i; + int cnt; + int dirfd; + int fd; + int mfd; + mode_t mask; + depend_atom *atom = tree_get_atom(pkg, false); + size_t len; + + if (pretend) { + printf(" %s-%s %s:\n", + GREEN, NORM, atom_format("%[CATEGORY]%[PF]", atom)); + return 0; + } + + line = tree_pkg_meta_get(pkg, CONTENTS); + if (line == NULL) + return -1; + + snprintf(tmpdir, sizeof(tmpdir), "%s/qpkg.XXXXXX", qpkg_bindir); + mask = umask(0077); + i = mkstemp(tmpdir); + umask(mask); + if (i == -1) + return -2; + close(i); + unlink(tmpdir); + if (mkdir(tmpdir, 0750)) + return -3; + + printf(" %s-%s %s: ", GREEN, NORM, atom_format("%[CATEGORY]%[PF]", atom)); + fflush(stdout); + + snprintf(buf, sizeof(buf), "%s/Manifest", tmpdir); + mfd = open(buf, O_WRONLY | O_CREAT | O_TRUNC); + if (mfd < 0) { + rmdir(tmpdir); + printf("%sFAIL%s\n", RED, NORM); + return -4; + } + + /* we first 1. create metadata (vdb), 2. image (actual data) and + * then 3. the container gpkg image */ + + /* 1. VDB into metadata.tar.zst */ + a = archive_write_new(); + archive_write_set_format_ustar(a); /* as required by GLEP-78 */ + filter = qgpkg_set_compression(a); + snprintf(gpkg, sizeof(gpkg), "%s/metadata.tar%s", tmpdir, filter); + archive_write_open_filename(a, gpkg); + + snprintf(buf, sizeof(buf), "%s%s/%s/%s", + portroot, portvdb, atom->CATEGORY, atom->PF); + cnt = 0; + if ((dirfd = open(buf, O_RDONLY)) >= 0) + cnt = scandirat(dirfd, ".", &files, filter_self_parent, alphasort); + for (i = 0; i < cnt; i++) { + if ((fd = openat(dirfd, files[i]->d_name, O_RDONLY)) < 0) + continue; + if (fstat(fd, &st) < 0 || !(st.st_mode & S_IFREG)) { + close(fd); + continue; + } + + entry = archive_entry_new(); + snprintf(buf, sizeof(buf), "metadata/%s", files[i]->d_name); + archive_entry_set_pathname(entry, buf); + archive_entry_set_size(entry, st.st_size); + archive_entry_set_mtime(entry, st.st_mtime, 0); + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_perm(entry, 0644); + archive_write_header(a, entry); + while ((len = read(fd, buf, sizeof(buf))) > 0) + archive_write_data(a, buf, len); + close(fd); + archive_entry_free(entry); + } + archive_write_close(a); + archive_write_free(a); + scandir_free(files, cnt); + if (dirfd >= 0) + close(dirfd); + write_hashes(gpkg, "DATA", mfd); + + /* 2. the actual files into image.tar.zst */ + a = archive_write_new(); + archive_write_set_format_ustar(a); /* as required by GLEP-78 */ + filter = qgpkg_set_compression(a); + snprintf(gpkg, sizeof(gpkg), "%s/image.tar%s", tmpdir, filter); + archive_write_open_filename(a, gpkg); + for (; (line = strtok_r(line, "\n", &savep)) != NULL; line = NULL) { + contents_entry *e; + e = contents_parse_line(line); + if (!e || e->type == CONTENTS_DIR) + continue; + if (check_pkg_install_mask(e->name) != 0) + continue; + if (e->type == CONTENTS_OBJ && verbose) { + char *hash = hash_file(e->name, HASH_MD5); + if (hash != NULL) { + if (strcmp(e->digest, hash) != 0) + warn("MD5: mismatch expected %s got %s for %s", + e->digest, hash, e->name); + } + } + + if ((fd = open(e->name, O_RDONLY)) < 0) + continue; + if (fstat(fd, &st) < 0) { + close(fd); + continue; + } + + entry = archive_entry_new(); + snprintf(buf, sizeof(buf), "image/%s", e->name + 1); + archive_entry_set_pathname(entry, buf); + archive_entry_set_size(entry, st.st_size); + archive_entry_set_mtime(entry, st.st_mtime, 0); + archive_entry_set_filetype(entry, st.st_mode & S_IFMT); + archive_entry_set_perm(entry, st.st_mode & ~S_IFMT); + archive_write_header(a, entry); + while ((len = read(fd, buf, sizeof(buf))) > 0) + archive_write_data(a, buf, len); + close(fd); + archive_entry_free(entry); + } + archive_write_close(a); + archive_write_free(a); + write_hashes(gpkg, "DATA", mfd); + + /* 3. the final gpkg file (to be renamed properly when it all + * succeeds */ + snprintf(gpkg, sizeof(gpkg), "%s/bin.gpkg.tar", tmpdir); + a = archive_write_new(); + archive_write_set_format_ustar(a); /* as required by GLEP-78 */ + archive_write_open_filename(a, gpkg); + /* 3.1 the package format identifier file gpkg-1 */ + entry = archive_entry_new(); + snprintf(ename, sizeof(ename), "%s/gpkg-1", atom->PF); + archive_entry_set_pathname(entry, ename); + /* contractually we don't have to put anything in here, but we drop + * our signature in here */ + len = snprintf(buf, sizeof(buf), "portage-utils-%s", VERSION); + archive_entry_set_size(entry, len); + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_mtime(entry, time(NULL), 0); + archive_entry_set_perm(entry, 0644); + archive_write_header(a, entry); + archive_write_data(a, buf, len); + archive_entry_free(entry); + /* 3.2 the metadata archive metadata.tar${comp} */ + snprintf(buf, sizeof(buf), "%s/metadata.tar%s", tmpdir, filter); + /* this must succeed, no? */ + if ((fd = open(buf, O_RDONLY)) >= 0 && + fstat(fd, &st) >= 0) + { + entry = archive_entry_new(); + snprintf(ename, sizeof(ename), "%s/metadata.tar%s", atom->PF, filter); + archive_entry_set_pathname(entry, ename); + archive_entry_set_size(entry, st.st_size); + archive_entry_set_mtime(entry, st.st_mtime, 0); + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_perm(entry, 0644); + archive_write_header(a, entry); + while ((len = read(fd, buf, sizeof(buf))) > 0) + archive_write_data(a, buf, len); + close(fd); + archive_entry_free(entry); + } + unlink(buf); + /* 3.3 TODO: with gpgme write metadata signature */ + /* 3.4 the filesystem image archive image.tar${comp} */ + snprintf(buf, sizeof(buf), "%s/image.tar%s", tmpdir, filter); + /* this must succeed, no? */ + if ((fd = open(buf, O_RDONLY)) >= 0 && + fstat(fd, &st) >= 0) + { + entry = archive_entry_new(); + snprintf(ename, sizeof(ename), "%s/image.tar%s", atom->PF, filter); + archive_entry_set_pathname(entry, ename); + archive_entry_set_size(entry, st.st_size); + archive_entry_set_mtime(entry, st.st_mtime, 0); + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_perm(entry, 0644); + archive_write_header(a, entry); + while ((len = read(fd, buf, sizeof(buf))) > 0) + archive_write_data(a, buf, len); + close(fd); + archive_entry_free(entry); + } + unlink(buf); + /* 3.5 TODO: with gpgme write image signature */ + /* 3.6 the package Manifest data file Manifest (clear-signed when + * gpgme) */ + close(mfd); + snprintf(buf, sizeof(buf), "%s/Manifest", tmpdir); + if ((fd = open(buf, O_RDONLY)) >= 0 && + fstat(fd, &st) >= 0) + { + entry = archive_entry_new(); + snprintf(ename, sizeof(ename), "%s/Manifest", atom->PF); + archive_entry_set_pathname(entry, ename); + archive_entry_set_size(entry, st.st_size); + archive_entry_set_mtime(entry, st.st_mtime, 0); + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_perm(entry, 0644); + archive_write_header(a, entry); + while ((len = read(fd, buf, sizeof(buf))) > 0) + archive_write_data(a, buf, len); + close(fd); + archive_entry_free(entry); + } + unlink(buf); + archive_write_close(a); + archive_write_free(a); + + /* create dirs, if necessary */ + snprintf(buf, sizeof(buf), "%s/%s", qpkg_bindir, atom->CATEGORY); + mkdir_p(buf, 0755); + + /* at this point we use PF as package name (and directory above, + * which should match according to GLEP-78), however, Portage seems + * to use <PF>-1 or something, which is unspecified at this point + * what it means, or how to use it */ + snprintf(buf, sizeof(buf), "%s/%s/%s.gpkg.tar", + qpkg_bindir, atom->CATEGORY, atom->PF); + if (rename(gpkg, buf)) { + warnp("could not move '%s' to '%s'", gpkg, buf); + return 1; + } + + rmdir(tmpdir); + + if (stat(buf, &st) == -1) { + warnp("could not stat '%s': %s", buf, strerror(errno)); + return 1; + } + + printf("%s%s%s KiB\n", + RED, make_human_readable_str(st.st_size, 1, KILOBYTE), NORM); + + return 0; +#else + warnp("gpkg support not compiled in"); + return 1; +#endif +} + static int qpkg_make(tree_pkg_ctx *pkg) { @@ -307,6 +637,17 @@ qpkg_make(tree_pkg_ctx *pkg) return 0; } +static int +qgpkg_cb(tree_pkg_ctx *pkg, void *priv) +{ + size_t *pkgs_made = priv; + + if (qgpkg_make(pkg) == 0) + (*pkgs_made)++; + + return 0; +} + static int qpkg_cb(tree_pkg_ctx *pkg, void *priv) { @@ -321,7 +662,9 @@ qpkg_cb(tree_pkg_ctx *pkg, void *priv) int qpkg_main(int argc, char **argv) { tree_ctx *ctx; - size_t s, pkgs_made; + tree_pkg_cb *cb_func = qpkg_cb; + size_t s; + size_t pkgs_made; int i; struct stat st; depend_atom *atom; @@ -334,6 +677,7 @@ int qpkg_main(int argc, char **argv) switch (i) { case 'E': eclean = qclean = 1; break; case 'c': qclean = 1; break; + case 'g': cb_func = qgpkg_cb; break; case 'p': pretend = 1; break; case 'P': restrict_chmod = 1; @@ -384,7 +728,7 @@ int qpkg_main(int argc, char **argv) * completion would do) */ pkgs_made = 0; s = strlen(portvdb); - for (i = optind; i < argc; ++i) { + for (i = optind; i < argc; i++) { size_t asize = strlen(argv[i]); if (asize == 0) { argv[i] = NULL; @@ -410,13 +754,13 @@ int qpkg_main(int argc, char **argv) } /* now try to run through vdb and locate matches for user inputs */ - for (i = optind; i < argc; ++i) { + for (i = optind; i < argc; i++) { if (argv[i] == NULL) continue; if (strcmp(argv[i], "world") == 0) { /* this is a crude hack, we include all packages for this, * which isn't exactly @world, but all its deps too */ - tree_foreach_pkg_fast(ctx, qpkg_cb, &pkgs_made, NULL); + tree_foreach_pkg_fast(ctx, cb_func, &pkgs_made, NULL); break; /* no point in continuing since we did everything */ } atom = atom_explode(argv[i]); @@ -424,7 +768,7 @@ int qpkg_main(int argc, char **argv) continue; s = pkgs_made; - tree_foreach_pkg_fast(ctx, qpkg_cb, &pkgs_made, atom); + tree_foreach_pkg_fast(ctx, cb_func, &pkgs_made, atom); if (s == pkgs_made) warn("no match for '%s'", argv[i]); atom_implode(atom); diff --git a/tests/Makefile.in b/tests/Makefile.in index 1aa1459..4ce04a4 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1207,6 +1207,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/atom_compare/Makefile.in b/tests/atom_compare/Makefile.in index e07646f..00d3257 100644 --- a/tests/atom_compare/Makefile.in +++ b/tests/atom_compare/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/atom_explode/Makefile.in b/tests/atom_explode/Makefile.in index 5c666c8..e241791 100644 --- a/tests/atom_explode/Makefile.in +++ b/tests/atom_explode/Makefile.in @@ -1190,6 +1190,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/copy_file/Makefile.in b/tests/copy_file/Makefile.in index b96f31e..1a56b25 100644 --- a/tests/copy_file/Makefile.in +++ b/tests/copy_file/Makefile.in @@ -1191,6 +1191,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/install/Makefile.in b/tests/install/Makefile.in index 27b2052..784e7ac 100644 --- a/tests/install/Makefile.in +++ b/tests/install/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/mkdir/Makefile.in b/tests/mkdir/Makefile.in index c1f8043..067eee6 100644 --- a/tests/mkdir/Makefile.in +++ b/tests/mkdir/Makefile.in @@ -1190,6 +1190,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/profile/Makefile.in b/tests/profile/Makefile.in index 280b9e3..2b36280 100644 --- a/tests/profile/Makefile.in +++ b/tests/profile/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qatom/Makefile.in b/tests/qatom/Makefile.in index f2d5a82..0779011 100644 --- a/tests/qatom/Makefile.in +++ b/tests/qatom/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qcheck/Makefile.in b/tests/qcheck/Makefile.in index fe80b5c..52e2358 100644 --- a/tests/qcheck/Makefile.in +++ b/tests/qcheck/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qdepends/Makefile.in b/tests/qdepends/Makefile.in index 7063df5..ff82005 100644 --- a/tests/qdepends/Makefile.in +++ b/tests/qdepends/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qfile/Makefile.in b/tests/qfile/Makefile.in index b87b4db..0a58dbb 100644 --- a/tests/qfile/Makefile.in +++ b/tests/qfile/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qlist/Makefile.in b/tests/qlist/Makefile.in index 61fd822..17c4606 100644 --- a/tests/qlist/Makefile.in +++ b/tests/qlist/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qlop/Makefile.in b/tests/qlop/Makefile.in index 9a69130..e8ccc45 100644 --- a/tests/qlop/Makefile.in +++ b/tests/qlop/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qmanifest/Makefile.in b/tests/qmanifest/Makefile.in index 3f0efc4..786c895 100644 --- a/tests/qmanifest/Makefile.in +++ b/tests/qmanifest/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qmerge/Makefile.in b/tests/qmerge/Makefile.in index ad8418f..486b42a 100644 --- a/tests/qmerge/Makefile.in +++ b/tests/qmerge/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qtbz2/Makefile.in b/tests/qtbz2/Makefile.in index 08e00fa..5418c1a 100644 --- a/tests/qtbz2/Makefile.in +++ b/tests/qtbz2/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/quse/Makefile.in b/tests/quse/Makefile.in index 154123b..c3b35dd 100644 --- a/tests/quse/Makefile.in +++ b/tests/quse/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/qxpak/Makefile.in b/tests/qxpak/Makefile.in index d04e698..dbb8574 100644 --- a/tests/qxpak/Makefile.in +++ b/tests/qxpak/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/rmspace/Makefile.in b/tests/rmspace/Makefile.in index 9a12ad3..1deaaeb 100644 --- a/tests/rmspace/Makefile.in +++ b/tests/rmspace/Makefile.in @@ -1190,6 +1190,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@ diff --git a/tests/source/Makefile.in b/tests/source/Makefile.in index c14376a..2f7fdd4 100644 --- a/tests/source/Makefile.in +++ b/tests/source/Makefile.in @@ -1146,6 +1146,8 @@ LC_MONETARY_IMPLEMENTED = @LC_MONETARY_IMPLEMENTED@ LC_NUMERIC_IMPLEMENTED = @LC_NUMERIC_IMPLEMENTED@ LC_TIME_IMPLEMENTED = @LC_TIME_IMPLEMENTED@ LDFLAGS = @LDFLAGS@ +LIBARCHIVE_CFLAGS = @LIBARCHIVE_CFLAGS@ +LIBARCHIVE_LIBS = @LIBARCHIVE_LIBS@ LIBBL2_CFLAGS = @LIBBL2_CFLAGS@ LIBBL2_LIBS = @LIBBL2_LIBS@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
