[gentoo-commits] proj/portage-utils:master commit in: tests/rmspace/

2024-04-08 Thread Fabian Groffen
commit: 80468f8d60b0761e9e993d245c7c2e9a40815437
Author: Boris Staletic  protonmail  com>
AuthorDate: Fri Mar 29 17:26:56 2024 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Apr  8 09:16:36 2024 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=80468f8d

tests: Avoid buffer underflow when checking rmspace result

`s[len - 1]` is not allowed for strings whose length is 0.
Caught by clang's UBSAN.

PR: https://github.com/gentoo/portage-utils/pull/28
Signed-off-by: Fabian Groffen  gentoo.org>

 tests/rmspace/test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/rmspace/test.c b/tests/rmspace/test.c
index aac4fd9..843cccb 100644
--- a/tests/rmspace/test.c
+++ b/tests/rmspace/test.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2019 Gentoo Foundation
+ * Copyright 2005-2024 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  *
  * Copyright 2005-2008 Ned Ludd- 
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
for (i = 1; i < argc; ++i) {
s = rmspace(argv[i]);
len = strlen(s);
-   if (isspace(s[0]) || isspace(s[len - 1])) {
+   if (isspace(s[0]) || (len && isspace(s[len - 1]))) {
fprintf(stderr, "FAIL {%s}\n", s);
return 1;
}



[gentoo-commits] proj/portage-utils:master commit in: tests/copy_file/

2024-03-29 Thread Fabian Groffen
commit: 26fe1cf9fc9d99e2ae9f4add01bccd1938656712
Author: Boris Staletic  protonmail  com>
AuthorDate: Thu Mar 28 22:08:32 2024 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Fri Mar 29 10:58:26 2024 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=26fe1cf9

tests: Avoid leaking buf in copy_file/test.c

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/copy_file/test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/copy_file/test.c b/tests/copy_file/test.c
index 4482237..aa0edaa 100644
--- a/tests/copy_file/test.c
+++ b/tests/copy_file/test.c
@@ -72,6 +72,7 @@ int main(int argc, char *argv[])
assert(buf != NULL);
memset(buf, 0xaf, len);
testone(buf, len);
+   free(buf);
 
return 0;
 }



[gentoo-commits] proj/portage-utils:master commit in: tests/atom_explode/

2024-03-29 Thread Fabian Groffen
commit: 06d9fb823e99cce2c66c5c4888b91538e66d166e
Author: Boris Staletic  protonmail  com>
AuthorDate: Thu Mar 28 20:30:40 2024 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Fri Mar 29 10:58:25 2024 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=06d9fb82

tests: avoid leaking buf after exiting the loop in atom_explode

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/atom_explode/test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/atom_explode/test.c b/tests/atom_explode/test.c
index b794d3b..ff1c58d 100644
--- a/tests/atom_explode/test.c
+++ b/tests/atom_explode/test.c
@@ -64,6 +64,7 @@ int main(int argc, char *argv[])
boom(a, buf);
atom_implode(a);
}
+   free(buf);
}
 
return EXIT_SUCCESS;



[gentoo-commits] proj/portage-utils:master commit in: tests/rmspace/, /, tests/mkdir/, tests/atom_explode/, libq/, tests/copy_file/

2022-08-28 Thread Fabian Groffen
commit: 1ad6040d95a9c8733cec4388ac6cb3c73e8ddf0d
Author: David Seifert  gentoo  org>
AuthorDate: Sun Aug 28 11:40:31 2022 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Aug 28 11:51:06 2022 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1ad6040d

Remove libtool

* Libtool was only used for convenience libraries, which can
  be done in vanilla Automake. This allows passing `static`
  in LDFLAGS.

Bug: https://bugs.gentoo.org/841898
Signed-off-by: David Seifert  gentoo.org>
Signed-off-by: Fabian Groffen  gentoo.org>

 Makefile.am| 2 +-
 configure.ac   | 3 +--
 libq/Makefile.am   | 6 +++---
 tests/atom_explode/Makefile.am | 2 +-
 tests/copy_file/Makefile.am| 2 +-
 tests/mkdir/Makefile.am| 2 +-
 tests/rmspace/Makefile.am  | 2 +-
 7 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 13a6044..7dbcf42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,7 +78,7 @@ q_CPPFLAGS = \
$(LIBZ_CFLAGS) \
$(NULL)
 q_LDADD = \
-   $(top_builddir)/libq/libq.la \
+   $(top_builddir)/libq/libq.a \
$(top_builddir)/autotools/gnulib/libgnu.a \
$(OPENMP_CFLAGS) \
$(LIBSSL_LIBS) \

diff --git a/configure.ac b/configure.ac
index 5378795..9f892c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,8 +21,7 @@ gl_EARLY
 gl_INIT
 
 AM_PROG_AR
-LT_INIT
-AC_SUBST([LIBTOOL_DEPS])
+AC_PROG_LN_S
 
 headers='#ifdef HAVE_STDDEF_H
 #include 

diff --git a/libq/Makefile.am b/libq/Makefile.am
index c0402a4..879d4a7 100644
--- a/libq/Makefile.am
+++ b/libq/Makefile.am
@@ -34,9 +34,9 @@ QFILES += hash_md5_sha1.c hash_md5_sha1.h
 endif
 endif
 
-noinst_LTLIBRARIES = libq.la
-libq_la_SOURCES = $(QFILES)
-libq_la_CPPFLAGS = \
+noinst_LIBRARIES = libq.a
+libq_a_SOURCES = $(QFILES)
+libq_a_CPPFLAGS = \
$(OPENMP_CFLAGS) \
-I$(top_builddir)/autotools/gnulib \
-I$(top_srcdir)/autotools/gnulib

diff --git a/tests/atom_explode/Makefile.am b/tests/atom_explode/Makefile.am
index ecdcc58..03f5754 100644
--- a/tests/atom_explode/Makefile.am
+++ b/tests/atom_explode/Makefile.am
@@ -7,7 +7,7 @@ e_CPPFLAGS = -I$(top_srcdir) \
 -I$(top_srcdir)/libq \
 -I$(top_builddir)/autotools/gnulib \
 -I$(top_srcdir)/autotools/gnulib
-e_LDADD = $(top_builddir)/libq/libq.la \
+e_LDADD = $(top_builddir)/libq/libq.a \
  $(top_builddir)/autotools/gnulib/libgnu.a \
  $(LIB_CLOCK_GETTIME) \
  $(LIB_EACCESS)

diff --git a/tests/copy_file/Makefile.am b/tests/copy_file/Makefile.am
index 5fbdf15..41bbc72 100644
--- a/tests/copy_file/Makefile.am
+++ b/tests/copy_file/Makefile.am
@@ -7,7 +7,7 @@ m_CPPFLAGS = -I$(top_srcdir) \
 -I$(top_srcdir)/libq \
 -I$(top_builddir)/autotools/gnulib \
 -I$(top_srcdir)/autotools/gnulib
-m_LDADD = $(top_builddir)/libq/libq.la \
+m_LDADD = $(top_builddir)/libq/libq.a \
  $(top_builddir)/autotools/gnulib/libgnu.a \
  $(LIB_CLOCK_GETTIME) \
  $(LIB_EACCESS) \

diff --git a/tests/mkdir/Makefile.am b/tests/mkdir/Makefile.am
index e9d1536..4b17004 100644
--- a/tests/mkdir/Makefile.am
+++ b/tests/mkdir/Makefile.am
@@ -7,7 +7,7 @@ m_CPPFLAGS = -I$(top_srcdir) \
 -I$(top_srcdir)/libq \
 -I$(top_builddir)/autotools/gnulib \
 -I$(top_srcdir)/autotools/gnulib
-m_LDADD = $(top_builddir)/libq/libq.la \
+m_LDADD = $(top_builddir)/libq/libq.a \
  $(top_builddir)/autotools/gnulib/libgnu.a \
  $(LIB_CLOCK_GETTIME) \
  $(LIB_EACCESS)

diff --git a/tests/rmspace/Makefile.am b/tests/rmspace/Makefile.am
index cb54f32..0cb689d 100644
--- a/tests/rmspace/Makefile.am
+++ b/tests/rmspace/Makefile.am
@@ -7,7 +7,7 @@ m_CPPFLAGS = -I$(top_srcdir) \
 -I$(top_srcdir)/libq \
 -I$(top_builddir)/autotools/gnulib \
 -I$(top_srcdir)/autotools/gnulib
-m_LDADD = $(top_builddir)/libq/libq.la \
+m_LDADD = $(top_builddir)/libq/libq.a \
  $(top_builddir)/autotools/gnulib/libgnu.a \
  $(LIB_CLOCK_GETTIME) \
  $(LIB_EACCESS)



[gentoo-commits] proj/portage-utils:master commit in: tests/atom_compare/, libq/

2022-06-15 Thread Fabian Groffen
commit: 62503bbd9e82a5b0fdeec6e357a95e724ec3cef6
Author: Fabian Groffen  gentoo  org>
AuthorDate: Wed Jun 15 19:53:43 2022 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Wed Jun 15 19:53:43 2022 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=62503bbd

libq/atom: fix atom_compare for "0" version components

Bug: https://bugs.gentoo.org/852197
Signed-off-by: Fabian Groffen  gentoo.org>

 libq/atom.c | 36 ++--
 tests/atom_compare/static.good  |  1 +
 tests/atom_compare/static.tests |  1 +
 3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/libq/atom.c b/libq/atom.c
index 50e9520..31299f1 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -784,22 +784,38 @@ atom_compare_flg(const depend_atom *data, const 
depend_atom *query, int flags)
 *ends1 != '_';
 ends1++)
;
+   if (ends1 != s1)
+   ends1--;
for (ends2 = s2;
 *ends2 != '\0' &&
 *ends2 != '.' &&
 *ends2 != '_';
 ends2++)
;
-   /* 3.3L2-3: remove *trailing* 
zeros */
-   for (ends1--; ends1 > s1 && 
*ends1 == '0'; ends1--)
-   ;
-   for (ends2--; ends2 > s2 && 
*ends2 == '0'; ends2--)
-   ;
-   /* 3.3L4 ASCII stringwise 
comparison */
-   n1 = ends1 - s1;
-   n2 = ends2 - s2;
-   n1 = strncmp(s1, s2, n1 > n2 ? 
n1 : n2);
-   n2 = 0;
+   if (ends2 != s2)
+   ends2--;
+   /* bug 852197: leading 0 means 
something else
+*  must follow */
+   if (ends1 - s1 > 1 || ends2 - 
s2 > 1) {
+   /* 3.3L2-3: remove 
*trailing* zeros */
+   for (; ends1 > s1 && 
*ends1 == '0'; ends1--)
+   ;
+   for (; ends2 > s2 && 
*ends2 == '0'; ends2--)
+   ;
+   /* 3.3L4 ASCII 
stringwise comparison */
+   n1 = ends1 - s1;
+   n2 = ends2 - s2;
+   n1 = strncmp(s1, s2, n1 
> n2 ? n1 : n2);
+   n2 = 0;
+   } else {
+   /* repeat of 3.3#L9 
(else case below) */
+   n1 = strtoll(s1, 
, 10);
+   if (ends1 == s1)
+   n1 = -1;
+   n2 = strtoll(s2, 
, 10);
+   if (ends2 == s2)
+   n2 = -1;
+   }
} else {  /* 3.3#L9 */
n1 = strtoll(s1, , 10);
if (ends1 == s1)

diff --git a/tests/atom_compare/static.good b/tests/atom_compare/static.good
index 6da5553..83bf7ec 100644
--- a/tests/atom_compare/static.good
+++ b/tests/atom_compare/static.good
@@ -52,3 +52,4 @@ a-1 != =a-1.2z*
 a-1_alpha1 == =a-1*
 a-1 != =a-1_alpha1*
 a-1_alpha-r1 == =a-1_alpha*
+a-3.10.5 == >=a-3.10.0_p1_r1

diff --git a/tests/atom_compare/static.tests b/tests/atom_compare/static.tests
index 168f358..213fb5e 100644
--- a/tests/atom_compare/static.tests
+++ b/tests/atom_compare/static.tests
@@ -52,3 +52,4 @@ a-1 =a-1.2z*
 a-1_alpha1 

[gentoo-commits] proj/portage-utils:master commit in: tests/atom_compare/, /, libq/

2022-04-18 Thread Fabian Groffen
commit: 7de2f154c775e9de276f2fc1f619922f48a13b90
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Apr 18 09:35:48 2022 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Apr 18 09:35:48 2022 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=7de2f154

libq/atom: implement strict PMS 3.3 in atom_compare

Version comparisons are complex, stick with strict PMS definition for
it, so we produce the same results as Portage.

Bug: https://bugs.gentoo.org/838856
Signed-off-by: Fabian Groffen  gentoo.org>

 autogen.sh|   1 +
 libq/atom.c   | 249 --
 tests/atom_compare/static.q.good  |   3 +-
 tests/atom_compare/static.q.tests |   1 +
 4 files changed, 219 insertions(+), 35 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index ea564e0..df6e574 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -43,6 +43,7 @@ mods="
stat-time
strcasestr-simple
strncat
+   strtoll
symlinkat
sys_stat
unlinkat

diff --git a/libq/atom.c b/libq/atom.c
index 0b5fcdd..d1eb9a4 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2021 Gentoo Foundation
+ * Copyright 2005-2022 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  *
  * Copyright 2005-2008 Ned Ludd- 
@@ -694,41 +694,170 @@ atom_compare_flg(const depend_atom *data, const 
depend_atom *query, int flags)
 
/* check version */
if (data->PV && query->PV) {
-   char *s1, *s2;
-   uint64_t n1, n2;
-   /* first we compare the version [1.0]z_alpha1 */
-   s1 = data->PV;
-   s2 = query->PV;
-   while (s1 || s2) {
-   if (s1 && s2) {
-   /* deal with leading zeros */
-   while (*s1 == '0' && *s2 == '0') {
-   ++s1;
-   ++s2;
+   char  *s1;
+   char  *ends1;
+   char  *s2;
+   char  *ends2;
+   long long  n1;
+   long long  n2;
+   const atom_suffix *as1;
+   const atom_suffix *as2;
+
+   /* PMS 3.3 Version Comparison
+*
+* Algorithm 3.1: Version comparison top-level logic
+* 1:  let A and B be the versions to be compared
+* 2:  compare numeric components using Algorithm 3.2
+* 3:  compare letter components using Algorithm 3.4
+* 4:  compare suffixes using Algorithm 3.5
+* 5:  compare revision components using Algorithm 3.7
+* 6:  return  A = B
+*/
+
+   /* step 2: numeric components
+*
+* Algorithm 3.2: Version comparison logic for numeric
+* components
+*  1:  define the notations Ank and Bnk to mean the kth numeric
+*  component of A and B respectively, using 0-based 
indexing
+*  2:  if An0 > Bn0 using integer comparison then
+*  3:return  A > B
+*  4:  else if An0 < Bn0 using integer comparison then
+*  5:return  A < B
+*  6:  end if
+*  7:  let Ann be the number of numeric components of A
+*  8:  let Bnn be the number of numeric components of B
+*  9:  for all i such that i ≥ 1 and i < Ann and i < Bnn, in
+*  ascending order do
+* 10:compare Ani and Bni using Algorithm 3.3
+* 11:  end for
+* 12:  if Ann > Bnn then
+* 13:return  A > B
+* 14:  else if Ann < Bnn then
+* 15:return  A < B
+* 16:  end if
+*
+* Algorithm 3.3: Version comparison logic for each numeric
+* component after the first
+*  1:  if either Ani or Bni has a leading 0 then
+*  2:let An′i be Ani with any trailing 0s removed
+*  3:let Bn′i be Bni with any trailing 0s removed
+*  4:if An′i > Bn′i using ASCII stringwise comparison then
+*  5:  return  A > B
+*  6:else if An′i < Bn′i using ASCII stringwise comparison 
then
+*  7:  return  A < B
+*  8:end if
+*  9:  else
+* 10:if Ani > Bni using integer comparison then
+* 11:  return  A > B
+* 12:else if Ani < Bni using integer comparison then
+* 13:  return  A < B
+* 14:end if
+* 15:  

[gentoo-commits] proj/portage-utils:master commit in: tests/qcheck/, /

2022-04-09 Thread Fabian Groffen
commit: ede72d3cf08df8ffe7e59c4819d9a6c84ab1659f
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat Apr  9 11:17:39 2022 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat Apr  9 11:32:30 2022 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ede72d3c

qcheck: fix config-protect check, bug #837188

ensure we break out of the config-protect directories loop, instead of
just skipping one directory, such that we don't produce bogus amounts of
files, and also don't check despite we were told not to check (-P)

Bug: https://bugs.gentoo.org/837188
Signed-off-by: Fabian Groffen  gentoo.org>

 qcheck.c | 253 ---
 tests/qcheck/list05.good |   2 +-
 tests/qcheck/list07.good |   2 +-
 3 files changed, 156 insertions(+), 101 deletions(-)

diff --git a/qcheck.c b/qcheck.c
index 9d9a86c..813c1f7 100644
--- a/qcheck.c
+++ b/qcheck.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2020 Gentoo Foundation
+ * Copyright 2005-2022 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  *
  * Copyright 2005-2010 Ned Ludd- 
@@ -74,30 +74,30 @@ static int
 qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv)
 {
struct qcheck_opt_state *state = priv;
-   FILE *fp_contents_update;
-   size_t num_files;
-   size_t num_files_ok;
-   size_t num_files_unknown;
-   size_t num_files_ignored;
-   struct stat st;
-   char *buffer;
-   char *line;
-   char *savep;
-   int cp_argc;
-   int cpm_argc;
-   char **cp_argv;
-   char **cpm_argv;
-   depend_atom *atom;
-
-   fp_contents_update = NULL;
-
-   /* Open contents */
+   struct stat  st;
+   depend_atom *atom;
+   FILE*fp_contents_update = NULL;
+   size_t   num_files  = 0;
+   size_t   num_files_ok   = 0;
+   size_t   num_files_unknown  = 0;
+   size_t   num_files_ignored  = 0;
+   char*buffer;
+   char*line;
+   char*savep;
+   char*eprefix= NULL;
+   size_t   eprefix_len= 0;
+   int  cp_argc;
+   int  cpm_argc;
+   char   **cp_argv;
+   char   **cpm_argv;
+
+   /* get CONTENTS from meta */
line = tree_pkg_meta_get(pkg_ctx, CONTENTS);
if (line == NULL)
return EXIT_FAILURE;
 
atom = tree_get_atom(pkg_ctx, false);
-   num_files = num_files_ok = num_files_unknown = num_files_ignored = 0;
+
qcprintf("%sing %s ...\n",
(state->qc_update ? "Updat" : "Check"),
atom_format(state->fmt, atom));
@@ -124,6 +124,10 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv)
if (!state->chk_config_protect) {
makeargv(config_protect, _argc, _argv);
makeargv(config_protect_mask, _argc, _argv);
+
+   eprefix = tree_pkg_meta_get(pkg_ctx, EPREFIX);
+   if (eprefix != NULL)
+   eprefix_len = strlen(eprefix);
}
 
buffer = NULL;
@@ -136,8 +140,9 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv)
if (!entry)
continue;
 
-   /* run initial checks */
-   ++num_files;
+   num_files++;
+
+   /* handle skips */
if (array_cnt(state->regex_arr)) {
size_t n;
regex_t *regex;
@@ -145,15 +150,55 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv)
if (!regexec(regex, entry->name, 0, NULL, 0))
break;
if (n < array_cnt(state->regex_arr)) {
-   --num_files;
-   ++num_files_ignored;
+   num_files--;
+   num_files_ignored++;
+   if (verbose)
+   qcprintf(" %sSKIP%s %s: matches 
regex\n",
+YELLOW, NORM, 
entry->name);
+   if (state->qc_update)
+   fprintf(fp_contents_update, "%s\n", 
buffer);
continue;
}
}
+
+   /* handle CONFIG_PROTECT-ed files */
+   if (!state->chk_config_protect) {
+   inti;
+   char  *p;
+
+   /* compute path without EPREFIX */
+   p = entry->name;
+   if (strlen(p) > eprefix_len)
+   p += eprefix_len;
+
+  

[gentoo-commits] proj/portage-utils:master commit in: tests/mkdir/, libq/, tests/qatom/, tests/copy_file/, tests/atom_explode/, ...

2022-04-06 Thread Fabian Groffen
commit: 51ffbbc074affa45e9f82e0bd857fad4c15ad0f5
Author: Fabian Groffen  gentoo  org>
AuthorDate: Wed Apr  6 19:31:35 2022 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Wed Apr  6 19:31:35 2022 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=51ffbbc0

buildsys: regenerate

Signed-off-by: Fabian Groffen  gentoo.org>

 Makefile.in|   1 +
 autotools/gnulib/Makefile.in   |   1 +
 autotools/m4/libtool.m4| 227 ++-
 autotools/m4/ltoptions.m4  |   4 +-
 autotools/m4/ltsugar.m4|   2 +-
 autotools/m4/ltversion.m4  |  13 +-
 autotools/m4/lt~obsolete.m4|   4 +-
 configure  | 320 ++-
 libq/Makefile.in   |   1 +
 ltmain.sh  | 890 ++---
 tests/Makefile.in  |   1 +
 tests/atom_compare/Makefile.in |   1 +
 tests/atom_explode/Makefile.in |   1 +
 tests/copy_file/Makefile.in|   1 +
 tests/install/Makefile.in  |   1 +
 tests/mkdir/Makefile.in|   1 +
 tests/profile/Makefile.in  |   1 +
 tests/qatom/Makefile.in|   1 +
 tests/qcheck/Makefile.in   |   1 +
 tests/qdepends/Makefile.in |   1 +
 tests/qfile/Makefile.in|   1 +
 tests/qlist/Makefile.in|   1 +
 tests/qlop/Makefile.in |   1 +
 tests/qmanifest/Makefile.in|   1 +
 tests/qmerge/Makefile.in   |   1 +
 tests/qtbz2/Makefile.in|   1 +
 tests/quse/Makefile.in |   1 +
 tests/qxpak/Makefile.in|   1 +
 tests/rmspace/Makefile.in  |   1 +
 tests/source/Makefile.in   |   1 +
 30 files changed, 958 insertions(+), 525 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index bdeefb9..35403dd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -496,6 +496,7 @@ ERRNO_H = @ERRNO_H@
 ETAGS = @ETAGS@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
+FILECMD = @FILECMD@
 FLOAT_H = @FLOAT_H@
 GETOPT_CDEFS_H = @GETOPT_CDEFS_H@
 GETOPT_H = @GETOPT_H@

diff --git a/autotools/gnulib/Makefile.in b/autotools/gnulib/Makefile.in
index 0a271a7..7749a48 100644
--- a/autotools/gnulib/Makefile.in
+++ b/autotools/gnulib/Makefile.in
@@ -785,6 +785,7 @@ ERRNO_H = @ERRNO_H@
 ETAGS = @ETAGS@
 EXEEXT = @EXEEXT@
 FGREP = @FGREP@
+FILECMD = @FILECMD@
 FLOAT_H = @FLOAT_H@
 GETOPT_CDEFS_H = @GETOPT_CDEFS_H@
 GETOPT_H = @GETOPT_H@

diff --git a/autotools/m4/libtool.m4 b/autotools/m4/libtool.m4
index fd06b14..bf5d8bc 100644
--- a/autotools/m4/libtool.m4
+++ b/autotools/m4/libtool.m4
@@ -1,6 +1,7 @@
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
-#   Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc.
+#   Copyright (C) 1996-2001, 2003-2019, 2021-2022 Free Software
+#   Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -31,7 +32,7 @@ m4_define([_LT_COPYING], [dnl
 # along with this program.  If not, see .
 ])
 
-# serial 58 LT_INIT
+# serial 59 LT_INIT
 
 
 # LT_PREREQ(VERSION)
@@ -181,6 +182,7 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
 m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
 m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_DECL_FILECMD])dnl
 m4_require([_LT_CHECK_MAGIC_METHOD])dnl
 m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
@@ -219,8 +221,8 @@ esac
 ofile=libtool
 can_build_shared=yes
 
-# All known linkers require a '.a' archive for static linking (except MSVC,
-# which needs '.lib').
+# All known linkers require a '.a' archive for static linking (except MSVC and
+# ICC, which need '.lib').
 libext=a
 
 with_gnu_ld=$lt_cv_prog_gnu_ld
@@ -778,7 +780,7 @@ _LT_EOF
   # if finds mixed CR/LF and LF-only lines.  Since sed operates in
   # text mode, it properly converts lines to CR/LF.  This bash problem
   # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" \
+  $SED '$q' "$ltmain" >> "$cfgfile" \
  || (rm -f "$cfgfile"; exit 1)
 
mv -f "$cfgfile" "$ofile" ||
@@ -1042,8 +1044,8 @@ int forced_loaded() { return 2;}
 _LT_EOF
   echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >_MESSAGE_LOG_FD
   $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>_MESSAGE_LOG_FD
-  echo "$AR cru libconftest.a conftest.o" >_MESSAGE_LOG_FD
-  $AR cru libconftest.a conftest.o 2>_MESSAGE_LOG_FD
+  echo "$AR $AR_FLAGS libconftest.a conftest.o" >_MESSAGE_LOG_FD
+  $AR $AR_FLAGS libconftest.a conftest.o 2>_MESSAGE_LOG_FD
   echo "$RANLIB libconftest.a" >_MESSAGE_LOG_FD
   $RANLIB libconftest.a 2>_MESSAGE_LOG_FD
   cat > conftest.c << _LT_EOF
@@ -1067,17 +1069,12 @@ _LT_EOF
   _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
 darwin1.*)
   _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' 
;;
-darwin*) # darwin 5.x on
-  # if running on 10.5 or later, the deployment target 

[gentoo-commits] proj/portage-utils:master commit in: tests/

2022-02-06 Thread Fabian Groffen
commit: d57f8516cfad348c7871ebeee81b11ef6fcf4acf
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Feb  6 15:32:15 2022 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Feb  6 15:32:15 2022 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d57f8516

tests/init: remove last Travis cruft

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index 248e343..2b0a65f 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -32,12 +32,9 @@ export TZ='UTC 0'
 q -i -q
 
 # inject valgrind wrapper if necessary, unfortunately valgrind on Ubuntu
-# used by Travis segfaults on qmanifest and qcheck, so disable there to
-# be able to run the rest regularly
+# causes qmanifest to print stuff double, so skip it for that applet
 dovalgrind=${Q_RUN_WITH_VALGRIND}
-[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qmanifest ]] && dovalgrind=
-[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qcheck ]] && dovalgrind=
-[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qmerge ]] && dovalgrind=
+[[ ${RUNNER_OS}:${as##*/} == Linux:qmanifest ]] && dovalgrind=
 if [[ -n ${dovalgrind} ]] ; then
chmod 755 "@abs_top_srcdir@/tests/valgrind-wrapper/qvalgrind"
for f in @abs_top_builddir@/q?* ; do



[gentoo-commits] proj/portage-utils:master commit in: tests/valgrind-wrapper/, travis/, /

2022-02-06 Thread Fabian Groffen
commit: e106383b82df59b81bf1a5a862f893717547fd6d
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Feb  6 12:31:15 2022 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Feb  6 12:31:15 2022 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e106383b

travis: remove

Signed-off-by: Fabian Groffen  gentoo.org>

 .travis.yml  | 67 
 tests/valgrind-wrapper/qvalgrind |  2 +-
 travis/install-blake2.sh | 33 
 travis/lib.sh| 38 ---
 travis/main.sh   | 37 --
 5 files changed, 1 insertion(+), 176 deletions(-)

diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index af1504c..000
--- a/.travis.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-# Travis build integration.
-# https://docs.travis-ci.com/
-
-language: c
-dist: focal
-os: linux
-osx_image: xcode11.3.1
-
-jobs:
-  include:
-- compiler: gcc
-  arch: amd64
-- compiler: gcc
-  arch: arm64
-- compiler: gcc
-  arch: ppc64le
-- compiler: gcc
-  arch: s390x
-- compiler: clang
-  arch: amd64
-- compiler: coverity
-  arch: amd64
-  env:
-- COVERITY_SCAN_PROJECT_NAME="$TRAVIS_REPO_SLUG"
-- COVERITY_SCAN_BRANCH_PATTERN="master"
-- COVERITY_SCAN_NOTIFICATION_EMAIL="grob...@gentoo.org"
-- COVERITY_SCAN_BUILD_COMMAND="make"
-- compiler: valgrind
-  arch: amd64
-  env:
-- CFLAGS="-g"
-- Q_RUN_WITH_VALGRIND=1
-- compiler: clang
-  os: osx
-  env:
-- LDFLAGS="-L/usr/local/opt/libressl/lib"
-- CPPFLAGS="-I/usr/local/opt/libressl/include"
-- PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
-- PATH="$(brew --prefix)/opt/coreutils/libexec/gnubin:$PATH"
-
-env:
-  global:
-- secure: 
"qF/ueXvm1uawirfQL+jK5LSJW1P+ZVXDx5t9HljFP1jC45D/1aqEs1ffaNkvBJohUJy6mABnXN5+ZP0PoQ+ZA01t+6NDc/LrowGP87T02KGwjBukQ9tQK8zVutsT+0CY3qUPhRcaLH5Gt3c+uPDKlLndg/bXWS6cRpMt6tC3VTy+WpAlvHHfZJjSZVYp8qhCattnaZ7GvzqGqbjBZ6X7TrQnwIDdGAyg5r4xnViDxu9lO4ZH4zS6Rc7DxesrqC3zxwPRw5HLNsGbJiGQF3meXH6rVNt1uxKwwOQoDcL0NKiyAMpXwu5iGeuMILoy3KMpFwZFnhyXqMGRORakDuDNB9oMgzp+PB3Zb7TICXbhxbrQ46lSlv0VWkwn3bcJ0lek53NzDUmM2uywvCUYybPgn3xCqY9jG0zwO2ZIACc1ekGh7y0gFXfBoSZGhl1VthV5hWMJ01p/n5jK7XdDmK4G/+0wN2WlHhyvjoF6XyJ+SRC85l6VhpBNbFJA2bGT2Y4+p/CzF7M8DVYR3o+OfCWxsiZyE+Vnmpdg4U829oy97obIuBeCvBd1Vp0hoB+RpzaeqzS69N+S4tgCIXvIdu168HltFaTUPtvIGoDtIAPCaUZC8jVO22cA6RpNkac3HjpLSceYYtdkiph4VuBMwHZj6/N2+m46Y9Uxrh01KzLy/GY="
-
-addons:
-  apt:
-packages:
-- libgpgme11-dev
-- gnupg2
-- valgrind
-- liblz4-tool
-- lzop
-- zstd
-- lzip
-- brotli
-  homebrew:
-packages:
-- gpgme
-- gnupg
-- gnu-sed
-- coreutils
-- bash
-- libressl
-
-before_install:
-  - ./travis/install-blake2.sh
-script: ./travis/main.sh

diff --git a/tests/valgrind-wrapper/qvalgrind b/tests/valgrind-wrapper/qvalgrind
index 7240e98..5286cf6 100755
--- a/tests/valgrind-wrapper/qvalgrind
+++ b/tests/valgrind-wrapper/qvalgrind
@@ -16,7 +16,7 @@ if [[ ${ret} == 234 ]] ; then
mv q-valgrind.log q-valgrind.$$.log
echo "valgrind log can be found at ${PWD}/q-valgrind.$$.log" > 
/dev/stderr
# dump complaints in Travis' log, as we cannot retrieve them lateron
-   [[ -n ${TRAVIS_OS_NAME} ]] && cat q-valgrind.$$.log > /dev/stderr
+   [[ -n ${RUNNER_OS} ]] && cat q-valgrind.$$.log > /dev/stderr
 else
rm q-valgrind.log
 fi

diff --git a/travis/install-blake2.sh b/travis/install-blake2.sh
deleted file mode 100755
index 92e58ff..000
--- a/travis/install-blake2.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash -e
-
-. "${0%/*}"/lib.sh
-
-main() {
-   local pv="0.98.1"
-   local S="libb2-${pv}"
-   travis_fold start dep-blake2
-   rm -rf libb2*
-   v mkdir -p ../sysroot
-   v wget 
https://github.com/BLAKE2/libb2/releases/download/v${pv}/libb2-${pv}.tar.gz
-   v tar xf libb2-${pv}.tar.gz
-   (
-   cd "${S}"
-   ./configure \
-   --enable-static \
-   --disable-shared \
-   --disable-openmp \
-   --prefix=/ \
-   --libdir=/ \
-   --includedir=/
-   m
-   m DESTDIR="${PWD}/../../sysroot" install
-   )
-   v rm -f ../sysroot/*.la
-   v rm -rf libb2*
-   travis_fold end dep-blake2
-}
-
-if [[ ${CC} == valgrind || ${CC} == coverity ]] ; then
-   export CC=gcc
-fi
-main "$@"

diff --git a/travis/lib.sh b/travis/lib.sh
deleted file mode 100644
index 687ed41..000
--- a/travis/lib.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-# Common funcs for working w/Travis.
-
-travis_fold() {
-   if [[ -n ${TRAVIS_OS_NAME} ]] ; then
-   printf 'travis_fold:%s:%s\r\n' "$@" | sed 's: :_:g'
-   fi
-}

[gentoo-commits] proj/portage-utils:master commit in: tests/

2021-12-27 Thread Fabian Groffen
commit: 7c6f5256f98b2804626cf7c0d8518e1792099183
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Dec 27 17:57:18 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Dec 27 17:57:18 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=7c6f5256

tests/init.sh.in: filter NOCOLOR, bug #830105

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index c44320b..248e343 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -22,7 +22,7 @@ setup_env() {
 setup_env
 
 # clean any random vars from the host system
-unset ROOT PORTAGE_CONFIGROOT PORTAGE_QUIET PORTDIR
+unset ROOT PORTAGE_CONFIGROOT PORTAGE_QUIET PORTDIR NOCOLOR
 # but make sure we don't implicitly rely on user's setup
 export PORTAGE_CONFIGROOT="${ab}/not/a/real/path"
 # Always use UTC for timestamps to keep tests stable. #551806



[gentoo-commits] proj/portage-utils:master commit in: tests/profile/, tests/qfile/, tests/quse/, tests/qlist/, tests/qmerge/, ...

2021-12-23 Thread Fabian Groffen
commit: d898bfafd82926945fded7552f7bf1f89d375d7c
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Dec 23 11:49:16 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Dec 23 11:49:16 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d898bfaf

tests: drop all -C/NOCOLOR usage

this actually hides a problem, and we don't want that

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/install/dotest |  2 +-
 tests/profile/dotest |  6 ++
 tests/qfile/dotest   | 16 
 tests/qlist/dotest   | 32 
 tests/qmerge/dotest  |  2 +-
 tests/quse/dotest| 18 +-
 6 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/tests/install/dotest b/tests/install/dotest
index b312f1b..cdbb3b3 100755
--- a/tests/install/dotest
+++ b/tests/install/dotest
@@ -4,7 +4,7 @@
 
 rm -f q
 
-applets=$(q -Ch | \
+applets=$(q -h | \
sed -n '/^Currently defined applets:/,/^Options/p' | \
grep ' : ' | \
awk '{print $1}'

diff --git a/tests/profile/dotest b/tests/profile/dotest
index 97dc2d1..1da75c0 100755
--- a/tests/profile/dotest
+++ b/tests/profile/dotest
@@ -17,16 +17,14 @@ tenv() {
fi
 }
 
-# clear out env vars that would affect our tests, keep NOCOLOR
-unset $(q -e | cut -d= -f1 | grep -v NOCOLOR)
+# clear out env vars that would affect our tests
+unset $(q -e | cut -d= -f1)
 
 # test vars that should default to known values.
 # cannot test too many more as portage's default
 # make.globals will kick in.  also can't test
 # some vars (e.g. PORTAGE_BINHOST) that we default
 # on some platforms.
-echo "NOCOLOR=${NOCOLOR}"
-tenv inv NOCOLOR 1
 tenv inv ROOT /
 tenv inv ARCH
 

diff --git a/tests/qfile/dotest b/tests/qfile/dotest
index 023630e..25255ee 100755
--- a/tests/qfile/dotest
+++ b/tests/qfile/dotest
@@ -6,28 +6,28 @@ export ROOT=${as}/root
 export Q_VDB=/
 
 tests=(
-   "qfile -Cq /bin/bash /bin/X"
+   "qfile -q /bin/bash /bin/X"
"app-shells/bash"
 
-   "qfile -Co /bin/bash /bin/X"
+   "qfile -o /bin/bash /bin/X"
"/bin/X"
 
-   "qfile -Co -x bash /bin/bash"
+   "qfile -o -x bash /bin/bash"
"/bin/bash"
 
-   "qfile -Co -x app-shells/bash /bin/bash"
+   "qfile -o -x app-shells/bash /bin/bash"
"/bin/bash"
 
-   "qfile -Co -x bash:0 /bin/bash"
+   "qfile -o -x bash:0 /bin/bash"
"/bin/bash"
 
-   "qfile -Co -x app-shells/bash:0 /bin/bash"
+   "qfile -o -x app-shells/bash:0 /bin/bash"
"/bin/bash"
 
-   "(cd ${ROOT}/bin; qfile -RCq bash)"
+   "(cd ${ROOT}/bin; qfile -Rq bash)"
"app-shells/bash"
 
-   "(cd ${ROOT}/; qfile -Co whatever)"
+   "(cd ${ROOT}/; qfile -o whatever)"
"whatever"
 )
 

diff --git a/tests/qlist/dotest b/tests/qlist/dotest
index 509a20d..9afe2ec 100755
--- a/tests/qlist/dotest
+++ b/tests/qlist/dotest
@@ -23,52 +23,52 @@ test() {
 }
 
 # simple install check
-test 01 0 "qlist -IC"
+test 01 0 "qlist -I"
 
 # simple files list
-test 02 0 "qlist -C --showdebug cpio"
+test 02 0 "qlist --showdebug cpio"
 
 # symlink verbose list
-test 03 0 "qlist -C --showdebug mtools -e -v"
+test 03 0 "qlist --showdebug mtools -e -v"
 
 # dir test
-test 04 0 "qlist -C --showdebug mtools -d"
+test 04 0 "qlist --showdebug mtools -d"
 
 # obj test
-test 05 0 "qlist -C --showdebug mtools -o"
+test 05 0 "qlist --showdebug mtools -o"
 
 # sym test
-test 06 0 "qlist -C --showdebug mtools -s"
+test 06 0 "qlist --showdebug mtools -s"
 
 # SLOT test
-test 07 0 "qlist -ICS"
+test 07 0 "qlist -IS"
 
 # showdebug test #1
-test 08 0 "qlist -C cpio"
+test 08 0 "qlist cpio"
 
 # dir test
-test 09 0 "qlist -C mtools -d"
+test 09 0 "qlist mtools -d"
 
 # ver test
-test 10 0 "qlist -ICv =mtools-4*"
+test 10 0 "qlist -Iv =mtools-4*"
 
 # repo test
-test 11 0 "qlist -ICR"
+test 11 0 "qlist -IR"
 
 # slot with repo test
-test 12 0 "qlist -ICSR"
+test 12 0 "qlist -ISR"
 
 # exact CAT/PN:slot::repo files list test
-test 13 0 "qlist -Ce --showdebug app-arch/cpio:0::gentoo"
+test 13 0 "qlist -e --showdebug app-arch/cpio:0::gentoo"
 
 # sub-SLOT test
-test 14 0 "qlist -ICSS"
+test 14 0 "qlist -ISS"
 
 # no matches
-test 15 1 "qlist -ICv lajsdflkjasdflkjasdfljasdf"
+test 15 1 "qlist -Iv lajsdflkjasdflkjasdfljasdf"
 
 # match test w/out sub-SLOT
-test 16 0 "qlist -ICSS virtual/sub-2:1"
+test 16 0 "qlist -ISS virtual/sub-2:1"
 
 # check USE retrieval
 test 17 0 "qlist -IUv mtools"

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index f715ee5..be91d8f 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -21,7 +21,7 @@ mkdir -p "${ROOT}/var/db/pkg"
 set +e
 
 # sanity check on environment
-q -Cev
+q -ev
 qlist -kIv
 
 # Do a merge into an empty tree.

diff --git a/tests/quse/dotest b/tests/quse/dotest
index 93bef56..7fcbe33 100755
--- a/tests/quse/dotest
+++ b/tests/quse/dotest
@@ -9,8 +9,8 @@ mktmpdir
 mkportdir "${as}/portdir"
 
 # check 

[gentoo-commits] proj/portage-utils:master commit in: tests/

2021-12-23 Thread Fabian Groffen
commit: 95abc1123af8697a97425f515c9efa7d3259487f
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Dec 23 11:42:04 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Dec 23 11:42:04 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=95abc112

Revert "tests/init: force colours off for all tests"

This reverts commit 704a36ae325d8cbd3cee5b40cd4ad7bf937ab724.
It actually hides a problem (as seen in bug #829837)

Bug: https://bugs.gentoo.org/829837
Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index c030156..c44320b 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -27,8 +27,6 @@ unset ROOT PORTAGE_CONFIGROOT PORTAGE_QUIET PORTDIR
 export PORTAGE_CONFIGROOT="${ab}/not/a/real/path"
 # Always use UTC for timestamps to keep tests stable. #551806
 export TZ='UTC 0'
-# don't use colours
-export NOCOLOR=true
 
 # create symlinks for applets
 q -i -q



[gentoo-commits] proj/portage-utils:master commit in: tests/qlist/

2021-12-21 Thread Fabian Groffen
commit: f730546c72921b2b665557e55a218127316d8930
Author: Fabian Groffen  gentoo  org>
AuthorDate: Tue Dec 21 10:08:36 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Tue Dec 21 10:08:36 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f730546c

tests/qlist: add missing file

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qlist/list17.good | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qlist/list17.good b/tests/qlist/list17.good
new file mode 100644
index 000..bb1c9ab
--- /dev/null
+++ b/tests/qlist/list17.good
@@ -0,0 +1 @@
+sys-fs/mtools-4.0.13 X -abi_x86_32 abi_x86_64 -static-libs



[gentoo-commits] proj/portage-utils:master commit in: tests/qlist/, tests/qlist/root/sys-fs/mtools-4.0.13/, /

2021-12-19 Thread Fabian Groffen
commit: 74b75c453354a10af3c499aac15d3a2ae0e1c7ee
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Dec 19 09:51:16 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Dec 19 09:51:16 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=74b75c45

qlist: fix matching of USE-flags

Thanks to Michael Yagliyan for finding this bug and proposing the fix.

We cannot perform merge-sort if the comparison in use is different
between sorting and processing afterwards.  Use case-sensitive sort
everywhere, for it is cheaper, matches Portage and is safer/more
correct/inline with PMS.  This does change the default output ordering
of the flags though.

Added a test that ensures capital USE-flag is now matched correctly.

Bug: https://bugs.gentoo.org/829579
Signed-off-by: Fabian Groffen  gentoo.org>

 qlist.c| 5 +++--
 tests/qlist/dotest | 3 +++
 tests/qlist/root/sys-fs/mtools-4.0.13/IUSE | 1 +
 tests/qlist/root/sys-fs/mtools-4.0.13/USE  | 1 +
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/qlist.c b/qlist.c
index 48f7707..318ae3d 100644
--- a/qlist.c
+++ b/qlist.c
@@ -64,8 +64,9 @@ static const char * const qlist_opts_help[] = {
 static int
 cmpstringp(const void *p1, const void *p2)
 {
-   /* case insensitive comparator */
-   return strcasecmp(*((char * const *)p1), *((char * const *)p2));
+   /* PMS 3.1.4: USE-flag names may contain any of the characters
+* [A-Za-z0-9+_@-]. */
+   return strcmp(*((char * const *)p1), *((char * const *)p2));
 }
 
 /*

diff --git a/tests/qlist/dotest b/tests/qlist/dotest
index 0bb031b..509a20d 100755
--- a/tests/qlist/dotest
+++ b/tests/qlist/dotest
@@ -70,6 +70,9 @@ test 15 1 "qlist -ICv lajsdflkjasdflkjasdfljasdf"
 # match test w/out sub-SLOT
 test 16 0 "qlist -ICSS virtual/sub-2:1"
 
+# check USE retrieval
+test 17 0 "qlist -IUv mtools"
+
 cleantmpdir
 
 end

diff --git a/tests/qlist/root/sys-fs/mtools-4.0.13/IUSE 
b/tests/qlist/root/sys-fs/mtools-4.0.13/IUSE
new file mode 100644
index 000..a834dce
--- /dev/null
+++ b/tests/qlist/root/sys-fs/mtools-4.0.13/IUSE
@@ -0,0 +1 @@
+X static-libs abi_x86_32 abi_x86_64

diff --git a/tests/qlist/root/sys-fs/mtools-4.0.13/USE 
b/tests/qlist/root/sys-fs/mtools-4.0.13/USE
new file mode 100644
index 000..c91abd8
--- /dev/null
+++ b/tests/qlist/root/sys-fs/mtools-4.0.13/USE
@@ -0,0 +1 @@
+abi_x86_64 elibc_SunOS kernel_SunOS prefix X



[gentoo-commits] proj/portage-utils:master commit in: tests/source/

2021-12-16 Thread Fabian Groffen
commit: 9c52b98ab84ba81daa915806ac5884076df81090
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Dec 16 19:21:30 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Dec 16 19:21:30 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=9c52b98a

tests/source: remove some checks

these tests are somewhat expensive, so reduce them

- style is kind of personal
- noone should really have the need to use PATH_MAX any more (wrapped)
- combine obsolete funcs and headers

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/source/dotest | 74 +
 1 file changed, 6 insertions(+), 68 deletions(-)

diff --git a/tests/source/dotest b/tests/source/dotest
index 426a6cf..51215ba 100755
--- a/tests/source/dotest
+++ b/tests/source/dotest
@@ -76,73 +76,11 @@ testit src.typos
 
 
 #
-# don't allow obsolete functions
+# don't allow obsolete functions or headers (portability)
 #
+funcs='\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utime)\>[[:space:]]*\('
+hdrs='\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>'
 find ${ats} "${src_files[@]}" -print0 | xargs -0 \
-   grep -n -E -e 
'\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utime)\>[[:space:]]*\(' \
-   | sed -e "s:^\.\./\.\./::g" > src.obsolete.funcs
-testit src.obsolete.funcs
-
-
-
-#
-# make sure people use our constants
-#
-find ${ats} "${src_files[@]}" -print0 | xargs -0 \
-   grep -n -E -e '\' | grep -v _Q_PATH_MAX \
-   | sed -e "s:^\.\./\.\./::g" > src.bad.constants
-testit src.bad.constants
-
-
-
-#
-# don't allow obsolete headers
-#
-find ${ats} "${src_files[@]}" -print0 | xargs -0 \
-   grep -n -E -e 
'\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' \
-   | sed -e "s:^\.\./\.\./::g" > src.obsolete.headers
-testit src.obsolete.headers
-
-
-
-#
-# make sure people use the x* helper funcs
-#
-find ${ats} "${src_files[@]}" -print0 | xargs -0 \
-   grep -n -E -e '\<(malloc|strdup)[[:space:]]*\(' \
-   | grep -v libq/x \
-   | sed -e "s:^\.\./\.\./::g" > src.use.xfuncs
-testit src.use.xfuncs
-
-
-#
-# check for style
-#
-find ${ats} "${src_files[@]}" -print0 | xargs -0 \
-   grep -n -E \
-   -e '\<(for|if|switch|while)\(' \
-   -e '\<(for|if|switch|while) \( ' \
-   -e ' ;' \
-   -e '[[:space:]]$' \
-   -e '\){' \
-   -e '(^|[^:])//' \
-   | sed -e "s:^\.\./\.\./::g" > src.style
-testit src.style
-
-
-#
-# Auto clean up the space issues
-#
-for x in $(find ${ats} "${src_files[@]}" -print); do
-   # skip paths we don't have write access to
-   touch "$x~" 2>/dev/null || continue
-   ${s}/space "$x" > "$x~"
-   if ! diff -u "$x" "$x~" ; then
-   echo "New file: $x~"
-   else
-   rm -f "$x~"
-   fi
-done > src.space
-testit src.space
-
-end
+   grep -n -E -e "(${funcs}|${hdrs})" \
+   | sed -e "s:^\.\./\.\./::g" > src.obsolete.funcs.hdrs
+testit src.obsolete.funcs.hdrs



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/, /

2021-12-16 Thread Fabian Groffen
commit: ba9f14cf0aebb606e2818a9d21863763709a1fcb
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Dec 16 18:46:24 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Dec 16 18:46:24 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ba9f14cf

main: fix memory overwrite in strincr_var

This caused memory corruption, and a subsequent crash in qmanifest.

Signed-off-by: Fabian Groffen  gentoo.org>

 main.c | 5 +++--
 tests/qmanifest/dotest | 8 +---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/main.c b/main.c
index 37ba036..06c52b7 100644
--- a/main.c
+++ b/main.c
@@ -265,9 +265,10 @@ strincr_var(const char *name, const char *s, char **value, 
size_t *value_len)
if (haddashstar && len < *value_len) {
p = *value;
*p = '\0';  /* in case len == 0 */
+   } else if (haddashstar) {
+   p = *value = xrealloc(*value, len + 1);
} else {
-   *value = xrealloc(*value,
- (haddashstar ? (*value_len + 
1) : 0) + len + 1);
+   *value = xrealloc(*value, *value_len + 1 + len + 1);
p = &(*value)[*value_len];
if (*value_len > 0)
*p++ = ' ';

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 4031c8b..e7f6d05 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -12,14 +12,14 @@ mktmpdir
 test() {
local num=$1 exp=$2 ret=0
shift 2
-   eval "$@" > manifest 2>&1 || ret=$?
+   eval "$*" > manifest 2>&1 || ret=$?
sed -i -e '/^checked [0-9]/s/ in [0-9.]\+s$//' manifest
if ! diff -u ${as}/manifest${num}.good manifest; then
tfail "output does not match"
[[ -e gpgme.log ]] && cat gpgme.log
fi
if [[ ${exp} -ne ${ret} ]] ; then
-   tfail "exit code (${ret}) does not match expected (${exp}) for 
test ${num}"
+   tfail "exit code (${ret}) does not match expected (${exp}) for 
test ${num} (args: $*)"
fi
tend $? "$*"
 }
@@ -74,6 +74,8 @@ set +e
 if gpg_import "${as}"/key.gpg qmanifest ; then
 set -e
 
+tend 0 "gpg import key"
+
 # make it a fully valid tree
 rm testtree/my-cat/mypackage/unrecorded-file
 # drop ROOT, we'll work here in T
@@ -82,7 +84,7 @@ SIGNAS=0x3D695C8C0F87966B62DC5AFCDCFABA8E07F52261
 KEYPASS=qmanifest
 export GPGME_DEBUG=9:${PWD}/gpgme.log
 rm -f gpgme.log
-test 06 0 "echo ${KEYPASS} | qmanifest -g -s ${SIGNAS} -p testtree"
+test 06 0 "qmanifest -g -s ${SIGNAS} -p testtree <<< ${KEYPASS}"
 
 # validate the just generated tree
 rm -f gpgme.log



[gentoo-commits] proj/portage-utils:master commit in: tests/

2021-12-13 Thread Fabian Groffen
commit: 704a36ae325d8cbd3cee5b40cd4ad7bf937ab724
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Dec 13 07:24:37 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Dec 13 07:24:37 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=704a36ae

tests/init: force colours off for all tests

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index c44320b..c030156 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -27,6 +27,8 @@ unset ROOT PORTAGE_CONFIGROOT PORTAGE_QUIET PORTDIR
 export PORTAGE_CONFIGROOT="${ab}/not/a/real/path"
 # Always use UTC for timestamps to keep tests stable. #551806
 export TZ='UTC 0'
+# don't use colours
+export NOCOLOR=true
 
 # create symlinks for applets
 q -i -q



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/, /

2021-06-22 Thread Fabian Groffen
commit: a46be5455a621fd243297b7b1e238cc859d87678
Author: Fabian Groffen  gentoo  org>
AuthorDate: Tue Jun 22 19:00:48 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Tue Jun 22 19:00:48 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a46be545

qmerge: run pkg_* phases according to PMS 9.2 Call Order

Signed-off-by: Fabian Groffen  gentoo.org>

 qmerge.c| 41 +
 tests/qmerge/dotest |  3 ++-
 2 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/qmerge.c b/qmerge.c
index 1f1bb1e..e3be6a2 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -723,10 +723,11 @@ pkg_run_func_at(
"keepdir() { dodir \"$@\" && touch 
\"$@\"/.keep_${CATEGORY}_${PN}-${SLOT%%/*}; }\n"
/* TODO: This should be fatal upon error */
"emake() { ${MAKE:-make} ${MAKEOPTS} \"$@\"; }\n"
-   /* Unpack the env if need be */
-   "[ -e '%1$s/environment' ] || { bzip2 -dc 
'%1$s/environment.bz2' > '%1$s/environment' || exit 1; }\n"
+   /* Unpack the env */
+   "{ bzip2 -dc '%1$s/environment.bz2' > \"%6$s/environment\" "
+ "|| exit 1; }\n"
/* Load the main env */
-   ". '%1$s/environment'\n"
+   ". \"%6$s/environment\"\n"
/* Reload env vars that matter to us */
"export FILESDIR=/.does/not/exist/anywhere\n"
"export MERGE_TYPE=binary\n"
@@ -741,7 +742,7 @@ pkg_run_func_at(
"export T=\"%6$s\"\n"
/* we do not support preserve-libs yet, so force
 * preserve_old_lib instead */
-   "export FEATURES=\"${FEATURES/preserve-libs/disabled}\"\n"
+   "export FEATURES=\"${FEATURES/preserve-libs/}\"\n"
/* Finally run the func */
"%7$s%2$s\n"
/* Ignore func return values (not exit values) */
@@ -1340,7 +1341,10 @@ pkg_merge(int level, const depend_atom *qatom, const 
tree_match_ctx *mpkg)
 
fflush(stdout);
 
-   eat_file("vdb/EPREFIX", , _len);
+   /* we won't realloc, so we can loose the alloc size */
+   eprefix_len = eat_file("vdb/EPREFIX", , _len) ?
+   strlen(eprefix) : 0;
+   /* don't care/use the string lengths on these */
eat_file("vdb/EAPI", , _len);
eat_file("vdb/DEFINED_PHASES", _phases, _phases_len);
 
@@ -1393,9 +1397,6 @@ pkg_merge(int level, const depend_atom *qatom, const 
tree_match_ctx *mpkg)
close(imagefd);
}
 
-   if (eprefix != NULL)
-   free(eprefix);
-
makeargv(config_protect, _argc, _argv);
makeargv(config_protect_mask, _argc, _argv);
 
@@ -1420,18 +1421,6 @@ pkg_merge(int level, const depend_atom *qatom, const 
tree_match_ctx *mpkg)
fclose(contents);
}
 
-   /* run postinst */
-   if (!pretend)
-   pkg_run_func("vdb", pm_phases, PKG_POSTINST, D, T, eapi);
-
-   if (eapi != NULL)
-   free(eapi);
-   if (pm_phases != NULL)
-   free(pm_phases);
-
-   /* XXX: hmm, maybe we'll want to strip more ? */
-   unlink("vdb/environment");
-
/* Unmerge any stray pieces from the older version which we didn't
 * replace */
switch (replacing) {
@@ -1450,6 +1439,17 @@ pkg_merge(int level, const depend_atom *qatom, const 
tree_match_ctx *mpkg)
break;
}
 
+   /* run postinst */
+   if (!pretend)
+   pkg_run_func("vdb", pm_phases, PKG_POSTINST, D, T, eapi);
+
+   if (eprefix != NULL)
+   free(eprefix);
+   if (eapi != NULL)
+   free(eapi);
+   if (pm_phases != NULL)
+   free(pm_phases);
+
tree_match_close(previnst);
 
freeargv(cp_argc, cp_argv);
@@ -1521,6 +1521,7 @@ pkg_unmerge(tree_pkg_ctx *pkg_ctx, set *keep,
if (!pretend) {
buf = tree_pkg_meta_get(pkg_ctx, EAPI);
phases = tree_pkg_meta_get(pkg_ctx, DEFINED_PHASES);
+   buf = tree_pkg_meta_get(pkg_ctx, EAPI);  /* when phases caused 
ralloc */
if (phases != NULL) {
mkdirat(pkg_ctx->fd, "temp", 0755);
pkg_run_func_at(pkg_ctx->fd, ".", phases, PKG_PRERM, T, 
T, buf);

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 0f870ef..f715ee5 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -53,7 +53,8 @@ tend $? "qmerge-test: [R] re-emerge" || die "${out}"
 tend $? "qmerge-test: [R] installed expected files" || die "$(treedir 
"${ROOT}")"
 
 order=$(echo "${out}" | awk '$1 == "@@@" && $2 ~ /^pkg_/ { printf "%s ", $NF 
}')
-[[ ${order} == "pkg_pretend pkg_setup pkg_preinst pkg_postinst pkg_prerm 
pkg_postrm " ]]
+# PMS 9.2
+[[ ${order} == "pkg_pretend pkg_setup pkg_preinst pkg_prerm pkg_postrm 
pkg_postinst " ]]
 tend $? "qmerge-test: [R] 

[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/, tests/qmerge/packages/sys-devel/, /, tests/qmerge/packages/

2021-06-14 Thread Fabian Groffen
commit: f1cf942274c47dce50bbaff45d41a8a83102e3fd
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Jun 14 09:32:02 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Jun 14 09:32:02 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f1cf9422

qmerge: once over to make better/more use of libq/tree

- unify best_version and grab_binpkg_info, into single function using
  tree_match_atom to benefit from cache and abstract any particulars
- default to install action when no action given
- unmerge previous package on merge upgrade again
- possibly fix bug #792273 by exporting vars

Bug: https://bugs.gentoo.org/792273
Signed-off-by: Fabian Groffen  gentoo.org>

 qmerge.c   | 782 -
 tests/qmerge/dotest|  52 +-
 tests/qmerge/packages/Packages |  13 +
 .../qmerge/packages/sys-devel/qmerge-test-2.0.tbz2 | Bin 0 -> 7334 bytes
 4 files changed, 356 insertions(+), 491 deletions(-)

diff --git a/qmerge.c b/qmerge.c
index 8f1ca3d..f5386f2 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -49,8 +49,6 @@
 /* #define BUSYBOX "/bin/busybox" */
 #define BUSYBOX ""
 
-int old_repo = 0;
-
 #define QMERGE_FLAGS "fFsKUpuyO" COMMON_FLAGS
 static struct option const qmerge_long_opts[] = {
{"fetch",   no_argument, NULL, 'f'},
@@ -91,25 +89,6 @@ char update_only = 0;
 bool debug = false;
 const char Packages[] = "Packages";
 
-/*
-   "CHOST", "DEPEND", "DESCRIPTION", "EAPI",
-   "IUSE", "KEYWORDS", "LICENSE", "PDEPEND",
-   "PROVIDE", "RDEPEND", "SLOT", "USE"
-*/
-struct pkg_t {
-   char PF[64];
-   char CATEGORY[64];
-   char DESC[126];
-   char LICENSE[64];
-   char RDEPEND[BUFSIZ];
-   char MD5[34];
-   char SHA1[42];
-   char SLOT[64];
-   size_t SIZE;
-   char USE[BUFSIZ];
-   char REPO[64];
-};
-
 struct llist_char_t {
char *data;
struct llist_char_t *next;
@@ -117,17 +96,16 @@ struct llist_char_t {
 
 typedef struct llist_char_t llist_char;
 
-static void pkg_fetch(int, const depend_atom *, const struct pkg_t *);
-static void pkg_merge(int, const depend_atom *, const struct pkg_t *);
+static void pkg_fetch(int, const depend_atom *, const tree_match_ctx *);
+static void pkg_merge(int, const depend_atom *, const tree_match_ctx *);
 static int pkg_unmerge(tree_pkg_ctx *, set *, int, char **, int, char **);
-static struct pkg_t *grab_binpkg_info(depend_atom *);
 
 static bool
-prompt(const char *p)
+qmerge_prompt(const char *p)
 {
printf("%s? [Y/n] ", p);
fflush(stdout);
-   switch (getc(stdin)) {
+   switch (fgetc(stdin)) {
case '\n':
case 'y':
case 'Y':
@@ -143,8 +121,7 @@ fetch(const char *destdir, const char *src)
if (!binhost[0])
return;
 
-   fflush(stdout);
-   fflush(stderr);
+   fflush(NULL);
 
 #if 0
if (getenv("FETCHCOMMAND") != NULL) {
@@ -161,18 +138,15 @@ fetch(const char *destdir, const char *src)
 
xasprintf(, "%s/%s", binhost, src);
 
+   /* wget -c -q -P   */
char prog[] = "wget";
-   char argv_c[] = "-c";
-   char argv_P[] = "-P";
-   char argv_q[] = "-q";
-   char *argv_dir = xstrdup(destdir);
-   char *argv[] = {
+   char *const argv[] = {
prog,
-   argv_c,
-   argv_P,
-   argv_dir,
+   (char *)"-c",
+   (char *)"-P",
+   (char *)destdir,
path,
-   quiet ? argv_q : NULL,
+   quiet ? (char *)"-q" : NULL,
NULL,
};
if (!(force_download || install) && pretend)
@@ -187,7 +161,6 @@ fetch(const char *destdir, const char *src)
}
 
free(path);
-   free(argv_dir);
 
waitpid(p, , 0);
 #if 0
@@ -205,7 +178,7 @@ qmerge_initialize(void)
 {
char *buf;
 
-   if (strlen(BUSYBOX))
+   if (strlen(BUSYBOX) > 0)
if (access(BUSYBOX, X_OK) != 0)
err(BUSYBOX " must be installed");
 
@@ -232,52 +205,78 @@ qmerge_initialize(void)
free(buf);
 }
 
-static char _best_version_retbuf[4096];
-static int
-qmerge_best_version_cb(tree_pkg_ctx *pkg_ctx, void *priv)
+static tree_ctx *_qmerge_vdb_tree= NULL;
+static tree_ctx *_qmerge_binpkg_tree = NULL;
+#define BV_INSTALLED BV_VDB
+#define BV_BINARYBV_BINPKG
+#define BV_EBUILD(1<<0)  /* not yet supported */
+#define BV_VDB   (1<<1)
+#define BV_BINPKG(1<<2)
+static tree_match_ctx *
+best_version(const depend_atom *atom, int mode)
 {
-   depend_atom *sa = priv;
-   depend_atom *a = tree_get_atom(pkg_ctx, true);  /* need SLOT 

[gentoo-commits] proj/portage-utils:master commit in: tests/atom_compare/

2021-03-13 Thread Fabian Groffen
commit: d3975af1ff58208d45feb0ef040fcf04dbbceba9
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat Mar 13 12:42:29 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat Mar 13 12:42:29 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d3975af1

buildsys: regen

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/atom_compare/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/atom_compare/Makefile.in b/tests/atom_compare/Makefile.in
index 9b0a4c8..9b031fd 100644
--- a/tests/atom_compare/Makefile.in
+++ b/tests/atom_compare/Makefile.in
@@ -1617,7 +1617,7 @@ uninstall-am:
 .PRECIOUS: Makefile
 
 
-check-local: static static.q portage
+check-local: static static.q
 
 static: $(s)/static.tests $(atb)/q
$(call t,atom -c)



[gentoo-commits] proj/portage-utils:master commit in: tests/atom_compare/

2021-02-27 Thread Fabian Groffen
commit: f34b76d4ad4097f249cd160c8fd15647e7c1e2fc
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat Feb 27 11:31:17 2021 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat Feb 27 11:31:17 2021 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f34b76d4

tests/atom_compare: drop portage test

We have no real need to test what Portage's doing here, and dropping the
test means we're Python and Portage free.

Bug: https://bugs.gentoo.org/772983
Signed-off-by: Fabian Groffen  gentoo.org>

 tests/atom_compare/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/atom_compare/Makefile.am b/tests/atom_compare/Makefile.am
index 388fd19..cd27e36 100644
--- a/tests/atom_compare/Makefile.am
+++ b/tests/atom_compare/Makefile.am
@@ -4,7 +4,7 @@ s = $(abs_top_srcdir)/$(this_subdir)
 atb = $(abs_top_builddir)
 mkdir = $(if $(wildcard $(dir $(1))),:,mkdir -p "$(dir $(1))")
 
-check-local: static static.q portage
+check-local: static static.q
 
 t = \
@set -f && \



[gentoo-commits] proj/portage-utils:master commit in: tests/

2020-05-25 Thread Fabian Groffen
commit: e63b811e6f81e2a2d85137195d58f17bb4543c52
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon May 25 19:14:53 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon May 25 19:14:53 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e63b811e

test/init: qmerge makes valgrind coredump too, Travis--

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index 8b67070..c44320b 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -37,6 +37,7 @@ q -i -q
 dovalgrind=${Q_RUN_WITH_VALGRIND}
 [[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qmanifest ]] && dovalgrind=
 [[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qcheck ]] && dovalgrind=
+[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qmerge ]] && dovalgrind=
 if [[ -n ${dovalgrind} ]] ; then
chmod 755 "@abs_top_srcdir@/tests/valgrind-wrapper/qvalgrind"
for f in @abs_top_builddir@/q?* ; do



[gentoo-commits] proj/portage-utils:master commit in: tests/

2020-05-25 Thread Fabian Groffen
commit: d0e3592a032d607f2668d89fde671110586c3b90
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon May 25 19:05:51 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon May 25 19:05:51 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d0e3592a

tests/init: re-enact valgrind block on Travis

Somehow Travis env cannot be replicated, and still has a coredumping
valgrind

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index 6cdfccf..8b67070 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -35,6 +35,8 @@ q -i -q
 # used by Travis segfaults on qmanifest and qcheck, so disable there to
 # be able to run the rest regularly
 dovalgrind=${Q_RUN_WITH_VALGRIND}
+[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qmanifest ]] && dovalgrind=
+[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qcheck ]] && dovalgrind=
 if [[ -n ${dovalgrind} ]] ; then
chmod 755 "@abs_top_srcdir@/tests/valgrind-wrapper/qvalgrind"
for f in @abs_top_builddir@/q?* ; do



[gentoo-commits] proj/portage-utils:master commit in: tests/

2020-05-25 Thread Fabian Groffen
commit: 93ab3a3b0a280d83d5d65af2e4740cb3227a38a2
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon May 25 18:38:49 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon May 25 18:38:49 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=93ab3a3b

tests/init: drop valgrind exclusions

After some manual testing and fixes on a Bionic VM, valgrind no longer
dumps core there, so let's hope we can finally run the full suite using
valgrind on Travis too.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index 8b67070..6cdfccf 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -35,8 +35,6 @@ q -i -q
 # used by Travis segfaults on qmanifest and qcheck, so disable there to
 # be able to run the rest regularly
 dovalgrind=${Q_RUN_WITH_VALGRIND}
-[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qmanifest ]] && dovalgrind=
-[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qcheck ]] && dovalgrind=
 if [[ -n ${dovalgrind} ]] ; then
chmod 755 "@abs_top_srcdir@/tests/valgrind-wrapper/qvalgrind"
for f in @abs_top_builddir@/q?* ; do



[gentoo-commits] proj/portage-utils:master commit in: tests/valgrind-wrapper/

2020-05-25 Thread Fabian Groffen
commit: 69eb365ccb660696ed470dac9c18c203f8a81a99
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon May 25 13:24:42 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon May 25 13:24:42 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=69eb365c

tests/valgrind-wrapper: use --track-origins for easier debugging

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/valgrind-wrapper/qvalgrind | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/valgrind-wrapper/qvalgrind b/tests/valgrind-wrapper/qvalgrind
index ad02269..7240e98 100755
--- a/tests/valgrind-wrapper/qvalgrind
+++ b/tests/valgrind-wrapper/qvalgrind
@@ -4,6 +4,7 @@
 valgrind \
--leak-check=full \
--track-fds=yes \
+   --track-origins=yes \
--malloc-fill=0xdb \
--free-fill=0xbd \
--log-file=q-valgrind.log \



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/

2020-05-25 Thread Fabian Groffen
commit: 1feb7c2887f1e257506a1577cd3f3f4d28e12ace
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon May 25 10:41:15 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon May 25 10:41:15 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1feb7c28

tests: add qmerge tests for different compression schemes in binpkgs

While we had support for installing various compressed binpkgs, we never
tested this at all.  Especially since zstd now became the new standard
Portage uses, it is a good idea to ensure we cope well with this.

This new blob of tests, checks qtbz2, qlist and qmerge to disassemble,
assemble and install binpkgs with all known supported compressors.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmerge/dotest | 36 +++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 208bc3b..59f249d 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -130,8 +130,42 @@ out=$(yes | qmerge -FU qmerge-test)
 tend $? "qmerge-test: [M] uninstall" || die "${out}"
 [[ ! -e ${ROOT}/usr/bin/qmerge-test ]]
 tend $? "qmerge-test: [M] /usr/bin/qmerge-test removed" || die "$(treedir 
"${ROOT}")"
-set -e
+
+# try all compressions we know to see if we handle them properly
+pkgver=qmerge-test-1.3
+rev=0
+mkdir -p pkgs/sys-devel
+qtbz2 -s ${PKGDIR}/sys-devel/${pkgver}.tbz2
+export PKGDIR=${PWD}/pkgs
+bzip2 -dc < ${pkgver}.tar.bz2 > ${pkgver}.tar
+for compr in "" brotli gzip bzip2 xz lz4 zstd lzip lzop ; do
+   if [[ ${compr} != "" ]] ; then
+   cexec=$(type -P ${compr} 2>/dev/null)
+   echo "compressor: ${compr} = ${cexec}"
+   [[ -x ${cexec} ]] || continue
+   f=${pkgver}.tar.${compr}
+   ${cexec} -c < ${pkgver}.tar > ${f}
+   else
+   echo "plain tar"
+   f=${pkgver}.tar
+   fi
+   : $((rev++))
+   qtbz2 -j ${f} ${pkgver}.xpak pkgs/sys-devel/${pkgver}-r${rev}.tbz2
+   ls -l pkgs/sys-devel/${pkgver}-r${rev}.tbz2
+   ROOT=/ qlist -kIv | tee /dev/stderr | wc -l
+
+   # see if we can install this package
+   out=$(yes | qmerge -Fv qmerge-test)
+   tend $? "qmerge-test: [X] install ${pkgver}-r${rev}" || die "${out}"
+   qlist -Iv
+   out=$(yes | qmerge -FU qmerge-test)
+   tend $? "qmerge-test: [X] uninstall ${pkgver}-r${rev}" || die "${out}"
+
+   rm pkgs/sys-devel/${pkgver}-r${rev}.tbz2
+done
 
 cleantmpdir
 
+set -e
+
 end



[gentoo-commits] proj/portage-utils:master commit in: /, tests/

2020-05-17 Thread Fabian Groffen
commit: 0e665655ea718a92147c8bd9694256da3152a8d7
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun May 17 08:44:03 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun May 17 08:44:03 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=0e665655

travis: disable qcheck for valgrind too

it's really a shame that valgrind crashes so often in the travis setup

Signed-off-by: Fabian Groffen  gentoo.org>

 .travis.yml  | 1 -
 tests/init.sh.in | 5 +++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index f0c180c..44431cc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,7 +16,6 @@ jobs:
 - COVERITY_SCAN_NOTIFICATION_EMAIL="grob...@gentoo.org"
 - COVERITY_SCAN_BUILD_COMMAND="make"
 - compiler: valgrind
-  dist: xenial
   env:
 - CFLAGS="-g"
 - Q_RUN_WITH_VALGRIND=1

diff --git a/tests/init.sh.in b/tests/init.sh.in
index 5ffc7ef..8b67070 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -32,10 +32,11 @@ export TZ='UTC 0'
 q -i -q
 
 # inject valgrind wrapper if necessary, unfortunately valgrind on Ubuntu
-# used by Travis segfaults on qmanifest, so disable there to be able to
-# run the rest regularly
+# used by Travis segfaults on qmanifest and qcheck, so disable there to
+# be able to run the rest regularly
 dovalgrind=${Q_RUN_WITH_VALGRIND}
 [[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qmanifest ]] && dovalgrind=
+[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qcheck ]] && dovalgrind=
 if [[ -n ${dovalgrind} ]] ; then
chmod 755 "@abs_top_srcdir@/tests/valgrind-wrapper/qvalgrind"
for f in @abs_top_builddir@/q?* ; do



[gentoo-commits] proj/portage-utils:master commit in: tests/

2020-01-18 Thread Fabian Groffen
commit: 87aee5be6981ecf3dc30614f273488ab3a87bde9
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat Jan 18 13:05:29 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat Jan 18 13:05:29 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=87aee5be

tests/init.sh: clear PORTDIR from env

Portage seems to inject PORTDIR (with a weird value) in the environment.
This shows up during make check on some systems.  (Bug #701402.)
Always remove it from the environment to avoid interference.

Bug: https://bugs.gentoo.org/701402
Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index 7f5db06..5ffc7ef 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -22,7 +22,7 @@ setup_env() {
 setup_env
 
 # clean any random vars from the host system
-unset ROOT PORTAGE_CONFIGROOT PORTAGE_QUIET
+unset ROOT PORTAGE_CONFIGROOT PORTAGE_QUIET PORTDIR
 # but make sure we don't implicitly rely on user's setup
 export PORTAGE_CONFIGROOT="${ab}/not/a/real/path"
 # Always use UTC for timestamps to keep tests stable. #551806



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/

2020-01-03 Thread Fabian Groffen
commit: 4d6b231cf0973e1d3b869d98a0e263155f04b20c
Author: Fabian Groffen  gentoo  org>
AuthorDate: Fri Jan  3 12:43:49 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Fri Jan  3 12:43:49 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4d6b231c

tests/qmerge: test masking an intermediate level in INSTALL_MASK

this tests the case from the archives:
  /usr/foo -/usr/foo/bar /usr/foo/bar/baz

Bug: https://bugs.gentoo.org/699376
Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmerge/dotest | 12 
 1 file changed, 12 insertions(+)

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 1bbf5f7..208bc3b 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -118,6 +118,18 @@ tend $? "qmerge-test: [M] uninstall" || die "${out}"
 [[ ! -e ${ROOT}/usr/bin/dummy ]]
 tend $? "qmerge-test: [M] /usr/bin/dummy removed" || die "$(treedir "${ROOT}")"
 
+export INSTALL_MASK="/usr -/usr/bin /usr/bin/dummy"
+out=$(yes | qmerge -F qmerge-test)
+tend $? "qmerge-test: [M] install except /usr/bin/dummy" || die "${out}"
+[[ ! -e ${ROOT}/usr/bin/dummy ]]
+tend $? "qmerge-test: [M] found no /usr/bin/dummy" || die "$(treedir 
"${ROOT}")"
+[[ -e ${ROOT}/usr/bin/qmerge-test ]]
+tend $? "qmerge-test: [M] found /usr/bin/qmerge-test" || die "$(treedir 
"${ROOT}")"
+
+out=$(yes | qmerge -FU qmerge-test)
+tend $? "qmerge-test: [M] uninstall" || die "${out}"
+[[ ! -e ${ROOT}/usr/bin/qmerge-test ]]
+tend $? "qmerge-test: [M] /usr/bin/qmerge-test removed" || die "$(treedir 
"${ROOT}")"
 set -e
 
 cleantmpdir



[gentoo-commits] proj/portage-utils:master commit in: /, tests/qmerge/, tests/qmerge/packages/sys-devel/, tests/qmerge/packages/

2020-01-03 Thread Fabian Groffen
commit: fbf7ee544f0efeb6f5a8254f6a994d1daa5a4573
Author: Fabian Groffen  gentoo  org>
AuthorDate: Fri Jan  3 12:39:02 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Fri Jan  3 12:39:02 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=fbf7ee54

tests/qmerge: add 2-level negation INSTALL_MASK test

Bug: https://bugs.gentoo.org/699376
Signed-off-by: Fabian Groffen  gentoo.org>

 TODO.md  |   3 +++
 qmerge.c |   8 
 tests/qmerge/dotest  |  15 ++-
 tests/qmerge/packages/Packages   |   6 +++---
 tests/qmerge/packages/sys-devel/qmerge-test-1.3.tbz2 | Bin 7264 -> 7289 bytes
 5 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/TODO.md b/TODO.md
index 71a0ce1..e401123 100644
--- a/TODO.md
+++ b/TODO.md
@@ -40,6 +40,7 @@
 - test should work on local vdb (so TRAVIS can test it too)
 - fixup lame misnaming of force\_download (--fetch/--force) actually
   not-forcing things
+- use xpak.h instead of shelling out to qxpak binary
 
 # qdepends
 - -v should lookup whether packages are installed for || cases/colouring
@@ -50,6 +51,8 @@
- newer installed version available
 - integrate qxpak and qtbz2 with this package (the latter are confusing,
   and qpkg is doing parts of qtbz2's compose
+- share install\_mask code from qmerge to handle negatives from
+  pkg\_install\_mask too
 
 # qgrep
 - make it use standard xarray instead of its own buf\_list

diff --git a/qmerge.c b/qmerge.c
index 588b868..464f45f 100644
--- a/qmerge.c
+++ b/qmerge.c
@@ -573,15 +573,15 @@ install_mask_pwd(int iargc, char **iargv, const struct 
stat * const st, int fd)
}
 
 #if EBUG
-   printf("applying install masks:\n");
+   fprintf(warnout, "applying install masks:\n");
for (cnt = 0; cnt < masksc; cnt++) {
ssize_t plen = (ssize_t)masksv[cnt][0];
-   printf("%3zd  ", plen);
+   fprintf(warnout, "%3zd  ", plen);
if (plen < 0)
plen = -plen;
for (i = 1; i <= plen; i++)
-   printf("%s ", masksv[cnt][i]);
-   printf(" %zd\n", (size_t)masksv[cnt][i]);
+   fprintf(warnout, "%s ", masksv[cnt][i]);
+   fprintf(warnout, " %zd\n", (size_t)masksv[cnt][i]);
}
 #endif
 

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 23f3ca7..1bbf5f7 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -29,7 +29,7 @@ out=$(yes | qmerge -F qmerge-test)
 tend $? "qmerge-test: [N] basic merge" || die "${out}"
 
 [[ ${out} != *"FAIL"* ]]
-tend $? "qmerge-test: [N] FAIL messages" || die "${out}"
+tend $? "qmerge-test: [N] no FAIL messages" || die "${out}"
 
 order=$(echo "${out}" | awk '$1 == ">>>" && $2 ~ /^pkg_/ { printf "%s ", $NF 
}')
 [[ ${order} == "pkg_pretend pkg_setup pkg_preinst pkg_postinst " ]]
@@ -105,6 +105,19 @@ tend $? "qmerge-test: [M] uninstall" || die "${out}"
 [[ ! -e ${ROOT}/etc ]]
 tend $? "qmerge-test: [M] /etc removed" || die "$(treedir "${ROOT}")"
 
+export INSTALL_MASK="/usr -/usr/bin/dummy"
+out=$(yes | qmerge -F qmerge-test)
+tend $? "qmerge-test: [M] install only /usr/bin/dummy" || die "${out}"
+[[ -e ${ROOT}/usr/bin/dummy ]]
+tend $? "qmerge-test: [M] found /usr/bin/dummy" || die "$(treedir "${ROOT}")"
+[[ ! -e ${ROOT}/usr/bin/qmerge-test ]]
+tend $? "qmerge-test: [M] /usr/bin/qmerge-test absent" || die "$(treedir 
"${ROOT}")"
+
+out=$(yes | qmerge -FU qmerge-test)
+tend $? "qmerge-test: [M] uninstall" || die "${out}"
+[[ ! -e ${ROOT}/usr/bin/dummy ]]
+tend $? "qmerge-test: [M] /usr/bin/dummy removed" || die "$(treedir "${ROOT}")"
+
 set -e
 
 cleantmpdir

diff --git a/tests/qmerge/packages/Packages b/tests/qmerge/packages/Packages
index c03180c..e6fa3a2 100644
--- a/tests/qmerge/packages/Packages
+++ b/tests/qmerge/packages/Packages
@@ -22,9 +22,9 @@ DESC: my desc
 EAPI: 4
 KEYWORDS: ~amd64 ~x86
 LICENSE: GPL-2
-MD5: 07aef33aaacf4aeccd012712aff93f19
+MD5: 6c6633c64b0666f04df62da2f8b30d32
 MTIME: 1367290147
-SHA1: 38d8ababc531e2e12783326ef73f0771371ece93
-SIZE: 7264
+SHA1: 47f731ce30149f5ab15f0c47dc19b46e4b189d60
+SIZE: 7289
 REPO: local
 

diff --git a/tests/qmerge/packages/sys-devel/qmerge-test-1.3.tbz2 
b/tests/qmerge/packages/sys-devel/qmerge-test-1.3.tbz2
index feeff2e..24b6164 100644
Binary files a/tests/qmerge/packages/sys-devel/qmerge-test-1.3.tbz2 and 
b/tests/qmerge/packages/sys-devel/qmerge-test-1.3.tbz2 differ



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/

2020-01-03 Thread Fabian Groffen
commit: 61fdfd4d8cc40da77455c6f8b36a3ec36aa5b146
Author: Fabian Groffen  gentoo  org>
AuthorDate: Fri Jan  3 11:26:49 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Fri Jan  3 11:26:49 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=61fdfd4d

tests/qmerge: add case for INSTALL_MASK

This tests INSTALL_MASK on a simple and a inversed path, with one level
difference.

Bug: https://bugs.gentoo.org/699376
Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmerge/dotest | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 1563595..23f3ca7 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -79,6 +79,32 @@ tend $? "qmerge-test: [C] pkg_* order of execution" || die 
"$(printf '%s\n' "${o
! -d ${ROOT}/var/db/pkg/sys-devel ]]
 tend $? "qmerge-test: [C] uninstalled expected files" || die "$(treedir 
"${ROOT}")"
 
+# cleanup
+rm -Rf "${ROOT}"/etc
+
+# check if INSTALL_MASK is applied well
+export INSTALL_MASK="/etc"
+out=$(yes | qmerge -F qmerge-test)
+tend $? "qmerge-test: [M] install no /etc" || die "${out}"
+[[ ! -e ${ROOT}/etc ]]
+tend $? "qmerge-test: [M] found no /etc" || die "$(treedir "${ROOT}")"
+
+out=$(yes | qmerge -FU qmerge-test)
+tend $? "qmerge-test: [M] uninstall" || die "${out}"
+[[ ! -e ${ROOT}/etc ]]
+tend $? "qmerge-test: [M] /etc removed" || die "$(treedir "${ROOT}")"
+
+export INSTALL_MASK="/etc -/etc/some.conf"
+out=$(yes | qmerge -F qmerge-test)
+tend $? "qmerge-test: [M] install only /etc/some.conf" || die "${out}"
+[[ ! -e ${ROOT}/etc/another.conf ]]
+tend $? "qmerge-test: [M] found /etc/another.conf" || die "$(treedir 
"${ROOT}")"
+
+out=$(yes | qmerge -FU qmerge-test)
+tend $? "qmerge-test: [M] uninstall" || die "${out}"
+[[ ! -e ${ROOT}/etc ]]
+tend $? "qmerge-test: [M] /etc removed" || die "$(treedir "${ROOT}")"
+
 set -e
 
 cleantmpdir



[gentoo-commits] proj/portage-utils:master commit in: tests/

2020-01-02 Thread Fabian Groffen
commit: 68712a990b7ec0111d0f82019aed36c3ba5c11c2
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Jan  2 21:25:09 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Jan  2 21:25:09 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=68712a99

tests: fix retrieving test name

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index c5cd8f3..7f5db06 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -35,7 +35,7 @@ q -i -q
 # used by Travis segfaults on qmanifest, so disable there to be able to
 # run the rest regularly
 dovalgrind=${Q_RUN_WITH_VALGRIND}
-[[ ${TRAVIS_OS_NAME}:${a} == linux:qmanifest ]] && dovalgrind=
+[[ ${TRAVIS_OS_NAME}:${as##*/} == linux:qmanifest ]] && dovalgrind=
 if [[ -n ${dovalgrind} ]] ; then
chmod 755 "@abs_top_srcdir@/tests/valgrind-wrapper/qvalgrind"
for f in @abs_top_builddir@/q?* ; do



[gentoo-commits] proj/portage-utils:master commit in: tests/

2020-01-02 Thread Fabian Groffen
commit: b9051664bb3c37b2894d94cf655adfdae7862bf8
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Jan  2 20:47:54 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Jan  2 20:47:54 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=b9051664

tests: workound env issue on Travis

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index 8f52086..c5cd8f3 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -31,8 +31,12 @@ export TZ='UTC 0'
 # create symlinks for applets
 q -i -q
 
-# inject valgrind wrapper if necessary
-if [[ -n ${Q_RUN_WITH_VALGRIND} ]] ; then
+# inject valgrind wrapper if necessary, unfortunately valgrind on Ubuntu
+# used by Travis segfaults on qmanifest, so disable there to be able to
+# run the rest regularly
+dovalgrind=${Q_RUN_WITH_VALGRIND}
+[[ ${TRAVIS_OS_NAME}:${a} == linux:qmanifest ]] && dovalgrind=
+if [[ -n ${dovalgrind} ]] ; then
chmod 755 "@abs_top_srcdir@/tests/valgrind-wrapper/qvalgrind"
for f in @abs_top_builddir@/q?* ; do
[[ -L ${f} ]] || continue



[gentoo-commits] proj/portage-utils:master commit in: /, tests/qcheck/

2020-01-02 Thread Fabian Groffen
commit: 6d6d693b3e0cd3aa6ea19ffe036e5f50c15aa7dd
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Jan  2 15:22:52 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Jan  2 15:22:52 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6d6d693b

qcheck: fix tests

Signed-off-by: Fabian Groffen  gentoo.org>

 qcheck.c | 5 +++--
 tests/qcheck/list04.good | 2 +-
 tests/qcheck/list05.good | 2 +-
 tests/qcheck/list06.good | 2 +-
 tests/qcheck/list07.good | 2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/qcheck.c b/qcheck.c
index e8db1b8..1217a8a 100644
--- a/qcheck.c
+++ b/qcheck.c
@@ -346,7 +346,7 @@ qcheck_cb(tree_pkg_ctx *pkg_ctx, void *priv)
(num_files_ignored > 1 ? "s were" : " was"));
qcprintf("\n");
 
-   if (num_files_ok != num_files)
+   if (num_files_ok != num_files && !state->qc_update)
return EXIT_FAILURE;
else
return EXIT_SUCCESS;
@@ -410,6 +410,7 @@ int qcheck_main(int argc, char **argv)
ret = -1;
if (vdb != NULL) {
if (array_cnt(atoms) != 0) {
+   ret = 0;
array_for_each(atoms, i, atom) {
ret |= tree_foreach_pkg_sorted(vdb, qcheck_cb, 
, atom);
}
@@ -427,5 +428,5 @@ int qcheck_main(int argc, char **argv)
array_for_each(atoms, i, atom)
atom_implode(atom);
xarrayfree_int(atoms);
-   return ret;
+   return ret != 0;
 }

diff --git a/tests/qcheck/list04.good b/tests/qcheck/list04.good
index 604d20c..2f9f512 100644
--- a/tests/qcheck/list04.good
+++ b/tests/qcheck/list04.good
@@ -8,4 +8,4 @@ Checking a-b/pkg ...
  AFK: /missing-dir/missing-sym
   * 4 out of 11 files are good (2 files were ignored)
 Checking virtual/pkg ...
-  * 0 out of 0 file are good
+  * 0 out of 0 files are good

diff --git a/tests/qcheck/list05.good b/tests/qcheck/list05.good
index 35a0ff5..688c177 100644
--- a/tests/qcheck/list05.good
+++ b/tests/qcheck/list05.good
@@ -8,4 +8,4 @@ Checking a-b/pkg ...
  AFK: /missing-dir/missing-sym
   * 4 out of 11 files are good (2 files were ignored)
 Checking virtual/pkg ...
-  * 0 out of 0 file are good
+  * 0 out of 0 files are good

diff --git a/tests/qcheck/list06.good b/tests/qcheck/list06.good
index fb241db..6129032 100644
--- a/tests/qcheck/list06.good
+++ b/tests/qcheck/list06.good
@@ -5,4 +5,4 @@ Checking a-b/pkg ...
  MTIME: /bin/bad-mtime-sym
   * 4 out of 8 files are good (5 files were ignored)
 Checking virtual/pkg ...
-  * 0 out of 0 file are good
+  * 0 out of 0 files are good

diff --git a/tests/qcheck/list07.good b/tests/qcheck/list07.good
index ae80975..847b0b5 100644
--- a/tests/qcheck/list07.good
+++ b/tests/qcheck/list07.good
@@ -1,4 +1,4 @@
 Checking a-b/pkg ...
   * 4 out of 4 files are good (9 files were ignored)
 Checking virtual/pkg ...
-  * 0 out of 0 file are good
+  * 0 out of 0 files are good



[gentoo-commits] proj/portage-utils:master commit in: tests/valgrind-wrapper/, /, travis/

2020-01-02 Thread Fabian Groffen
commit: c23a51e58606afb2b98177caf47ae6aa6c6dc610
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Jan  2 12:01:26 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Jan  2 12:01:26 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c23a51e5

travis: try running tests using Valgrind

Signed-off-by: Fabian Groffen  gentoo.org>

 .travis.yml  | 1 +
 tests/valgrind-wrapper/qvalgrind | 2 ++
 travis/main.sh   | 5 +
 3 files changed, 8 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 83a6ff6..97c8e85 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,6 +24,7 @@ addons:
 packages:
 - libgpgme11-dev
 - gnupg2
+- valgrind
 
 before_install:
   - ./travis/install-blake2.sh

diff --git a/tests/valgrind-wrapper/qvalgrind b/tests/valgrind-wrapper/qvalgrind
index 679c387..ad02269 100755
--- a/tests/valgrind-wrapper/qvalgrind
+++ b/tests/valgrind-wrapper/qvalgrind
@@ -14,6 +14,8 @@ ret=$?
 if [[ ${ret} == 234 ]] ; then
mv q-valgrind.log q-valgrind.$$.log
echo "valgrind log can be found at ${PWD}/q-valgrind.$$.log" > 
/dev/stderr
+   # dump complaints in Travis' log, as we cannot retrieve them lateron
+   [[ -n ${TRAVIS_OS_NAME} ]] && cat q-valgrind.$$.log > /dev/stderr
 else
rm q-valgrind.log
 fi

diff --git a/travis/main.sh b/travis/main.sh
index c5f7670..50f10c7 100755
--- a/travis/main.sh
+++ b/travis/main.sh
@@ -49,6 +49,11 @@ main() {
do_run ${DEFARGS} --enable-qmanifest --disable-qtegrity
do_run ${DEFARGS} --disable-qmanifest --disable-qtegrity
 
+   if [[ ${TRAVIS_OS_NAME} == linux ]] ; then
+   do_run CFLAGS=-g Q_RUN_WITH_VALGRIND=1 \
+   ${DEFARGS} --enable-qmanifest --enable-qtegrity
+   fi
+
# LSan needs sudo, which we don't use at the moment
# Debug build w/ASAN and such enabled.
#m debug



[gentoo-commits] proj/portage-utils:master commit in: /, tests/atom_explode/, libq/

2020-01-01 Thread Fabian Groffen
commit: c6537da04a6695656d655bf4e48813fb041ec010
Author: Fabian Groffen  gentoo  org>
AuthorDate: Wed Jan  1 12:50:18 2020 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Wed Jan  1 12:50:18 2020 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c6537da0

libq/atom: stick to PMS for PVR

rework allocations somewhat, and make sure PVR does NOT include -r0, in
addition add PF to the structure, so this one can be grabbed more easily

Signed-off-by: Fabian Groffen  gentoo.org>

 TODO.md   |   9 +--
 libq/atom.c   | 149 ++
 libq/atom.h   |   1 +
 tests/atom_explode/test.c |  22 +--
 4 files changed, 107 insertions(+), 74 deletions(-)

diff --git a/TODO.md b/TODO.md
index dffaa91..cd4f2b2 100644
--- a/TODO.md
+++ b/TODO.md
@@ -22,13 +22,8 @@
 - replace all strtok by strtok\_r, because the latter is already used,
   so we can
 
-# Atoms
-
-- only 32bit values are supported for revision (-r#)
-- only 64bit values are supported in any individual version component
-  foo-(1234)\_alpha(56789)
-- these limits should not be an issue for all practical purposes
-- make PVR match PMS https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-10800011
+- parse package.accept\_keywords such that we can provide the latest
+  "available" version like Portage
 
 # qmerge
 

diff --git a/libq/atom.c b/libq/atom.c
index 05b138c..6f70847 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2019 Gentoo Foundation
+ * Copyright 2005-2020 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  *
  * Copyright 2005-2008 Ned Ludd- 
@@ -39,6 +39,9 @@ const char * const atom_op_str[] = {
 
 const char * const booga[] = {"!!!", "!=", "==", ">", "<"};
 
+/* split string into individual components, known as an atom
+ * for a definition of which variable contains what, see:
+ * https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-10800011 */
 depend_atom *
 atom_explode(const char *atom)
 {
@@ -48,18 +51,33 @@ atom_explode(const char *atom)
size_t slen;
size_t idx;
size_t sidx;
-
-   /* we allocate mem for atom struct and two strings (strlen(atom)).
-* the first string is for CAT/PN/PV while the second is for PVR.
-* PVR needs 3 extra bytes for possible implicit '-r0'. */
-   slen = strlen(atom);
-   len = sizeof(*ret) + (slen + 1) * sizeof(*atom) * 3 + 3;
+   char *lastpv = NULL;
+   char *pv;
+
+   /* PMS 11.1 recap:
+* CAT  The package’s categoryapp-editors
+* PF   Package name, version, and revision (if any)  
vim-7.0.174-r1
+* PVR  Package version and revision (if any) 
7.0.174-r1
+* PPackage name and version, without the revision part   
vim-7.0.174
+* PV   Package version, with no revision 
7.0.174
+* PN   Package name  vim
+* PR   Package revision, or r0 if none exists  
  r1
+*
+* Thus, CAT/PF is the full allocation of the input string, for the
+* rest (P, PN, PV, PR, PVR) we need copies.  We represent PR as an
+* integer, which leaves the set to PN, P and PV.
+* PVR is an offset inside PF, likewise, PV is an offset inside P.
+* We allocate memory for atom struct, one string for CAT/PF + PVR,
+* another to cover PN and a final one for P + PV. */
+   slen = strlen(atom) + 1;
+   len = sizeof(*ret) + (slen * 3);
ret = xmalloc(len);
memset(ret, '\0', sizeof(*ret));
-   ptr = (char *)ret;
-   ret->P = ptr + sizeof(*ret);
-   ret->PVR = ret->P + slen + 1;
-   ret->CATEGORY = ret->PVR + slen + 1 + 3;
+
+   /* assign pointers to the three storage containers */
+   ret->CATEGORY = (char *)ret + sizeof(*ret); /* CAT PF PVR */
+   ret->P= ret->CATEGORY + slen;   /* P   PV */
+   ret->PN   = ret->P + slen;  /* PN */
 
/* check for blocker operators */
ret->blocker = ATOM_BL_NONE;
@@ -95,13 +113,15 @@ atom_explode(const char *atom)
ret->pfx_op += ATOM_OP_EQUAL;
atom++;
}
+
+   /* fill in full block */
strcpy(ret->CATEGORY, atom);
 
/* eat file name crap when given an (autocompleted) path */
if ((ptr = strstr(ret->CATEGORY, ".ebuild")) != NULL)
*ptr = '\0';
 
-   /* chip off the trailing [::REPO] as needed */
+   /* chip off the trailing ::REPO as needed */
if ((ptr = strstr(ret->CATEGORY, "::")) != NULL) {
ret->REPO = ptr + 2;
*ptr = '\0';
@@ -172,7 +192,7 @@ atom_explode(const char *atom)
*ptr++ = '\0';
}
 
-   /* chip off the trailing [:SLOT] as needed */
+   

[gentoo-commits] proj/portage-utils:master commit in: /, tests/qmanifest/

2019-12-31 Thread Fabian Groffen
commit: 55e64136dc0bf63a563da1faff1e7a4fb1ce6a9c
Author: Fabian Groffen  gentoo  org>
AuthorDate: Tue Dec 31 09:03:16 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Tue Dec 31 09:03:16 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=55e64136

main: replace iniparser by a small bit of custom code

This make portage-utils dep-free (when qmanifest/qtegrity are not
compiled in) again, thus easier for the static binary case.

Small bonus is that the repo order is now deterministic (as found in the
config file(s)), which may help reduce test differences.

Signed-off-by: Fabian Groffen  gentoo.org>

 TODO.md |  3 +-
 main.c  | 89 ++---
 tests/qmanifest/manifest00.good |  2 +-
 3 files changed, 69 insertions(+), 25 deletions(-)

diff --git a/TODO.md b/TODO.md
index 00ccdea..dffaa91 100644
--- a/TODO.md
+++ b/TODO.md
@@ -19,7 +19,8 @@
   to use foreach\_pkg and get\_atom -- set is ready for storing objects
   now
 
-- implement our own iniparser so we *can* be dep-free
+- replace all strtok by strtok\_r, because the latter is already used,
+  so we can
 
 # Atoms
 

diff --git a/main.c b/main.c
index f0a8841..c6ef973 100644
--- a/main.c
+++ b/main.c
@@ -10,7 +10,6 @@
 #include "main.h"
 #include "applets.h"
 
-#include 
 #include 
 #include 
 #include 
@@ -540,7 +539,7 @@ read_portage_profile(const char *profile, env_vars vars[], 
set *masks)
 * treat parent profiles as defaults, that can be overridden by
 * *this* profile. */
strcpy(profile_file + profile_len, "parent");
-   if (eat_file(profile_file, , _len) == 0) {
+   if (!eat_file(profile_file, , _len)) {
if (buf != NULL)
free(buf);
return;
@@ -637,37 +636,82 @@ set *package_masks = NULL;
 static void
 read_one_repos_conf(const char *repos_conf, char **primary)
 {
-   int nsec;
-   char *conf;
char rrepo[_Q_PATH_MAX];
-   const char *main_repo;
-   const char *repo;
-   const char *path;
-   dictionary *dict;
+   char *main_repo;
+   char *repo;
+   char *buf = NULL;
+   size_t buf_len = 0;
+   char *s;
+   char *p;
+   char *q;
+   char *r;
+   char *e;
+   bool do_trim;
+   bool is_default;
 
if (getenv("DEBUG"))
fprintf(stderr, "  parse %s\n", repos_conf);
 
-   dict = iniparser_load(repos_conf);
+   if (!eat_file(repos_conf, , _len)) {
+   if (buf != NULL)
+   free(buf);
+   return;
+   }
 
-   main_repo = iniparser_getstring(dict, "DEFAULT:main-repo", NULL);
+   main_repo = NULL;
+   repo = NULL;
+   for (p = strtok_r(buf, "\n", ); p != NULL; p = strtok_r(NULL, "\n", 
))
+   {
+   /* trim trailing whitespace, remove comments, locate = */
+   do_trim = true;
+   e = NULL;
+   for (r = q = s - 2; q >= p; q--) {
+   if (do_trim && isspace((int)*q)) {
+   *q = '\0';
+   r = q - 1;
+   } else if (*q == '#') {
+   do_trim = true;
+   *q = '\0';
+   r = q - 1;
+   } else {
+   if (*q == '=')
+   e = q;
+   do_trim = false;
+   }
+   }
+   /* make q point to the last char */
+   q = r;
 
-   nsec = iniparser_getnsec(dict);
-   while (nsec-- > 0) {
-   repo = iniparser_getsecname(dict, nsec);
-   if (strcmp(repo, "DEFAULT") == 0)  /* already handled above */
+   if (*p == '[' && *q == ']') {  /* section header */
+   repo = p + 1;
+   *q = '\0';
+   is_default = strcmp(repo, "DEFAULT") == 0;
+   continue;
+   } else if (*p == '\0') {   /* empty line */
+   continue;
+   } else if (e == NULL) {/* missing = */
continue;
+   } else if (repo == NULL) { /* not in a section */
+   continue;
+   }
 
-   xasprintf(, "%s:location", repo);
-   path = iniparser_getstring(dict, conf, NULL);
-   if (path) {
+   /* trim off whitespace before = */
+   for (r = e - 1; r >= p && isspace((int)*r); r--)
+   *r = '\0';
+   /* and after the = */
+   for (e++; e < q && isspace((int)*e); e++)
+   ;
+
+   if (is_default && strcmp(p, "main-repo") == 0) {
+   main_repo = e;
+   } else if 

[gentoo-commits] proj/portage-utils:master commit in: tests/rmspace/, tests/qatom/, autotools/gnulib/, tests/qmanifest/, ...

2019-12-29 Thread Fabian Groffen
commit: f4dbe34b34cb5bb9ce049ad9c8ac27f09a03c549
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Dec 29 12:35:01 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Dec 29 12:35:01 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f4dbe34b

buildsys: regen after configure.ac change

Signed-off-by: Fabian Groffen  gentoo.org>

 Makefile.in|  1 +
 autotools/gnulib/Makefile.in   |  1 +
 config.h.in|  3 +++
 configure  | 17 -
 libq/Makefile.in   |  1 +
 tests/Makefile.in  |  1 +
 tests/atom_compare/Makefile.in |  1 +
 tests/atom_explode/Makefile.in |  1 +
 tests/copy_file/Makefile.in|  1 +
 tests/install/Makefile.in  |  1 +
 tests/mkdir/Makefile.in|  1 +
 tests/profile/Makefile.in  |  1 +
 tests/qatom/Makefile.in|  1 +
 tests/qcheck/Makefile.in   |  1 +
 tests/qdepends/Makefile.in |  1 +
 tests/qfile/Makefile.in|  1 +
 tests/qlist/Makefile.in|  1 +
 tests/qlop/Makefile.in |  1 +
 tests/qmanifest/Makefile.in|  1 +
 tests/qmerge/Makefile.in   |  1 +
 tests/qtbz2/Makefile.in|  1 +
 tests/quse/Makefile.in |  1 +
 tests/qxpak/Makefile.in|  1 +
 tests/rmspace/Makefile.in  |  1 +
 tests/source/Makefile.in   |  1 +
 25 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/Makefile.in b/Makefile.in
index ec8d83f..0ffd8c6 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1579,6 +1579,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@

diff --git a/autotools/gnulib/Makefile.in b/autotools/gnulib/Makefile.in
index 60d258c..8be76d3 100644
--- a/autotools/gnulib/Makefile.in
+++ b/autotools/gnulib/Makefile.in
@@ -1605,6 +1605,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@

diff --git a/config.h.in b/config.h.in
index a0714f6..c8155e2 100644
--- a/config.h.in
+++ b/config.h.in
@@ -473,6 +473,9 @@
 /* Define to 1 if you have the `flockfile' function. */
 #undef HAVE_FLOCKFILE
 
+/* Define to 1 if you have the `fmemopen' function. */
+#undef HAVE_FMEMOPEN
+
 /* Define if the frexpl function is available in libc. */
 #undef HAVE_FREXPL_IN_LIBC
 

diff --git a/configure b/configure
index 0bb18e8..360cfb1 100755
--- a/configure
+++ b/configure
@@ -1770,6 +1770,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -1859,6 +1860,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -2111,6 +2113,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
 silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
 ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -2248,7 +2259,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-   libdir localedir mandir
+   libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -2401,6 +2412,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIRread-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIRmodifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR   modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIRobject code libraries [EPREFIX/lib]
   --includedir=DIRC header files [PREFIX/include]
   --oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -3591,6 +3603,7 @@ as_fn_append ac_func_list " vasnprintf"
 as_fn_append ac_header_list " features.h"
 as_fn_append ac_func_list " snprintf"
 as_fn_append ac_header_list " crtdefs.h"
+as_fn_append ac_func_list " fmemopen"
 as_fn_append ac_func_list " scandirat"
 # Check that the precious variables saved in the cache have kept the same
 # 

[gentoo-commits] proj/portage-utils:master commit in: /, tests/qmanifest/

2019-12-29 Thread Fabian Groffen
commit: f46111eb2e10cfd8317f728e0638b947ac47ab62
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Dec 29 10:03:59 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Dec 29 10:03:59 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f46111eb

tests: fix after last commit

Signed-off-by: Fabian Groffen  gentoo.org>

 q.c | 2 +-
 tests/qmanifest/manifest04.good | 2 +-
 tests/qmanifest/manifest05.good | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/q.c b/q.c
index 6d7eced..a6a9a0b 100644
--- a/q.c
+++ b/q.c
@@ -62,7 +62,7 @@ APPLET lookup_applet(const char *applet)
/* this is possibly an alias like "belongs"
 * NOTE: we continue where the previous loop left, e.g. on the first
 * alias (desc == NULL) */
-   for ( ; applets[i].name != NULL; i++) {
+   for (/*i*/; applets[i].name != NULL; i++) {
if (strcmp(applets[i].name, applet) == 0) {
unsigned int j;
 

diff --git a/tests/qmanifest/manifest04.good b/tests/qmanifest/manifest04.good
index 4831674..613d7a9 100644
--- a/tests/qmanifest/manifest04.good
+++ b/tests/qmanifest/manifest04.good
@@ -1 +1 @@
-manifest: cannot change directory to not_a_tree: No such file or directory
+qmanifest: cannot change directory to not_a_tree: No such file or directory

diff --git a/tests/qmanifest/manifest05.good b/tests/qmanifest/manifest05.good
index 77a54c5..4849a71 100644
--- a/tests/qmanifest/manifest05.good
+++ b/tests/qmanifest/manifest05.good
@@ -1 +1 @@
-manifest: no such overlay: notatree
+qmanifest: no such overlay: notatree



[gentoo-commits] proj/portage-utils:master commit in: tests/qlop/, /

2019-12-27 Thread Fabian Groffen
commit: 1e5b2c8d3fb58335990e411af98498f249b54980
Author: Fabian Groffen  gentoo  org>
AuthorDate: Fri Dec 27 20:38:44 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Fri Dec 27 20:38:44 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1e5b2c8d

qlop: some changes to -r (running) mode

- warn when qlop needs to defer to log heuristics (#701968)
- print running packages most recent first
- suppress identical running packages (#701392)
- ignore batches in emerge.log that appear to be backwards in time

Bug: https://bugs.gentoo.org/701968
Bug: https://bugs.gentoo.org/701392
Signed-off-by: Fabian Groffen  gentoo.org>

 qlop.c | 50 +++---
 tests/qlop/list01.good |  2 +-
 tests/qlop/list10.good |  4 ++--
 tests/qlop/sync.log| 12 ++--
 4 files changed, 52 insertions(+), 16 deletions(-)

diff --git a/qlop.c b/qlop.c
index 7cc8f44..634431a 100644
--- a/qlop.c
+++ b/qlop.c
@@ -371,6 +371,7 @@ static int do_emerge_log(
char *p;
char *q;
time_t tstart = LONG_MAX;
+   time_t tlast = tbegin;
time_t tstart_emerge = 0;
time_t last_merge = 0;
time_t sync_start = 0;
@@ -531,6 +532,9 @@ static int do_emerge_log(
}
 
tstart = atol(buf);
+   if (tstart < tlast)
+   continue;
+   tlast = tstart;
if (tstart < tbegin || tstart > tend)
continue;
 
@@ -845,6 +849,7 @@ static int do_emerge_log(
fclose(fp);
if (flags->do_running) {
time_t cutofftime;
+   set *pkgs_seen = create_set();
 
tstart = time(NULL);
 
@@ -856,7 +861,8 @@ static int do_emerge_log(
 
/* can't report endtime for non-finished operations */
flags->do_endtime = 0;
-   sync_time /= sync_cnt;
+   if (sync_time > 0)
+   sync_time /= sync_cnt;
if (sync_start >= cutofftime) {
elapsed = tstart - sync_start;
if (elapsed >= sync_time)
@@ -876,9 +882,10 @@ static int do_emerge_log(
fmt_elapsedtime(flags, 
sync_time - elapsed));
}
}
-   array_for_each(merge_matches, i, pkgw) {
+   array_for_each_rev(merge_matches, i, pkgw) {
time_t maxtime = 0;
bool isMax = false;
+   bool notseen;
 
if (pkgw->tbegin < cutofftime)
continue;
@@ -886,6 +893,11 @@ static int do_emerge_log(
snprintf(afmt, sizeof(afmt), "%s/%s",
pkgw->atom->CATEGORY, pkgw->atom->PN);
 
+   /* eliminate dups, bug #701392 */
+   add_set_unique(afmt, pkgs_seen, );
+   if (!notseen)
+   continue;
+
elapsed = tstart - pkgw->tbegin;
pkg = get_set(afmt, merge_averages);
if (pkg != NULL) {
@@ -923,9 +935,11 @@ static int do_emerge_log(
maxtime > 0 && verbose ?
isMax ? " (longest run)" : " 
(average run)" : "");
}
+   clear_set(pkgs_seen);
array_for_each(unmerge_matches, i, pkgw) {
time_t maxtime = 0;
bool isMax = false;
+   bool notseen;
 
if (pkgw->tbegin < cutofftime)
continue;
@@ -933,6 +947,11 @@ static int do_emerge_log(
snprintf(afmt, sizeof(afmt), "%s/%s",
pkgw->atom->CATEGORY, pkgw->atom->PN);
 
+   /* eliminate dups, bug #701392 */
+   add_set_unique(afmt, pkgs_seen, );
+   if (!notseen)
+   continue;
+
elapsed = tstart - pkgw->tbegin;
pkg = get_set(afmt, unmerge_averages);
if (pkg != NULL) {
@@ -959,6 +978,7 @@ static int do_emerge_log(
maxtime > 0 && verbose ?
isMax ? " (longest run)" : " 
(average run)" : "");
}
+   free_set(pkgs_seen);
} else if (flags->do_average) {
size_t total_merges = 0;
size_t total_unmerges = 0;
@@ -1135,9 +1155,22 @@ static array_t *probe_proc(array_t *atoms)
scandir_free(procs, procslen);
} else {
/* flag /proc doesn't exist */
+   warn("/proc doesn't exist, 

[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-12-15 Thread Fabian Groffen
commit: 6886e365b76c8555260d79a9d4cc3b7f1d658cb0
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Dec 15 09:39:27 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Dec 15 09:39:27 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6886e365

tests/qmanifest: add some debugging for #701402

Bug: https://bugs.gentoo.org/701402
Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 900b9ea..4031c8b 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -25,6 +25,7 @@ test() {
 }
 
 # verify we see our overlays
+DEBUG=1 q -ev
 test 00 0 "q -o"
 
 # simple run check (should do bad_tree)



[gentoo-commits] proj/portage-utils:master commit in: /, tests/qmerge/, tests/quse/, libq/

2019-11-30 Thread Fabian Groffen
commit: d1442dee24b0760665a103c5c1b3ad838eef02f9
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat Nov 30 16:25:18 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat Nov 30 16:26:43 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d1442dee

misc fixes for valgrind

mainly memory and socket leaks, sometimes using invalid data, this is
related to bug #701402

Signed-off-by: Fabian Groffen  gentoo.org>

 libq/atom.c |  5 +
 main.c  | 58 +++--
 q.c |  4 ++--
 qatom.c |  2 +-
 qdepends.c  | 14 +
 qlop.c  | 39 ++-
 qmanifest.c | 49 ++--
 qmerge.c| 11 --
 tests/qmerge/dotest | 25 +--
 tests/quse/dotest   |  4 
 10 files changed, 160 insertions(+), 51 deletions(-)

diff --git a/libq/atom.c b/libq/atom.c
index 6e12c0a..efd32d1 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -335,6 +335,11 @@ atom_implode(depend_atom *atom)
 {
if (!atom)
errf("Atom is empty !");
+   while (atom->usedeps != NULL) {
+   atom_usedep *n = atom->usedeps->next;
+   free(atom->usedeps);
+   atom->usedeps = n;
+   }
free(atom->suffixes);
free(atom);
 }

diff --git a/main.c b/main.c
index ba15c8c..d6bbacf 100644
--- a/main.c
+++ b/main.c
@@ -224,8 +224,6 @@ makeargv(const char *string, int *argc, char ***argv)
 
*argc = 1;
(*argv)[0] = xstrdup(argv0);
-   q = xstrdup(string);
-   str = q;
 
/* shortcut empty strings */
while (isspace((int)*string))
@@ -233,6 +231,9 @@ makeargv(const char *string, int *argc, char ***argv)
if (*string == '\0')
return;
 
+   q = xstrdup(string);
+   str = q;
+
remove_extra_space(str);
rmspace(str);
 
@@ -744,18 +745,44 @@ initialize_portage_env(void)
snprintf(pathbuf, sizeof(pathbuf), "%.*s", (int)i, configroot);
read_repos_conf(pathbuf, "/usr/share/portage/config/repos.conf");
read_repos_conf(pathbuf, "/etc/portage/repos.conf");
-   if (orig_main_overlay != main_overlay)
-   free(orig_main_overlay);
-   if (array_cnt(overlays) == 0) {
-   xarraypush_ptr(overlays, main_overlay);
-   xarraypush_str(overlay_names, "");
-   xarraypush_str(overlay_src, STR_DEFAULT);
-   } else if (orig_main_overlay == main_overlay) {
-   /* if no explicit overlay was flagged as main, take the first 
one */
+   /* special handling of PORTDIR envvar, else it comes too late, see
+* also below where we handle the environment */
+   if ((s = getenv("PORTDIR")) != NULL) {
+   char *overlay;
+
+   array_for_each(overlays, i, overlay) {
+   if (strcmp(overlay, s) == 0)
+   break;
+   overlay = NULL;
+   }
+   if (overlay == NULL) {
+   main_overlay = xarraypush_str(overlays, s);
+   xarraypush_str(overlay_names, "");
+   xarraypush_str(overlay_src, "PORTDIR");
+   } else {
+   free(array_get_elem(overlay_src, i));
+   array_get_elem(overlay_src, i) = xstrdup("PORTDIR");
+   main_overlay = overlay;
+   }
+   free(vars_to_read[11 /* PORTDIR */].src);
+   vars_to_read[11 /* PORTDIR */].src = xstrdup("PORTDIR");
+   }
+   if (orig_main_overlay != main_overlay) {
free(orig_main_overlay);
-   main_overlay = array_get_elem(overlays, 0);
-   set_portage_env_var(_to_read[11] /* PORTDIR */, 
main_overlay,
-   (char *)array_get_elem(overlay_src, 0));
+   } else {
+   if (array_cnt(overlays) == 0) {
+   xarraypush_ptr(overlays, main_overlay);
+   xarraypush_str(overlay_names, "");
+   xarraypush_str(overlay_src, STR_DEFAULT);
+   } else {
+   /* if no explicit overlay was flagged as main, take the
+* first one */
+   free(orig_main_overlay);
+   main_overlay = array_get_elem(overlays, 0);
+   free(vars_to_read[11 /* PORTDIR */].src);
+   vars_to_read[11 /* PORTDIR */].src =
+   xstrdup((char *)array_get_elem(overlay_src, 0));
+   }
}
 
/* consider Portage's defaults */
@@ -781,10 +808,11 @@ initialize_portage_env(void)
read_portage_env_file(pathbuf, vars_to_read);
 
/* finally, check the env */
-   for (i = 0; 

[gentoo-commits] proj/portage-utils:master commit in: tests/, tests/qfile/, tests/valgrind-wrapper/

2019-11-30 Thread Fabian Groffen
commit: bf1eba183f9253a9013ce36a7b0a6d72acb90038
Author: Fabian Groffen  gentoo  org>
AuthorDate: Fri Nov 29 16:03:14 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat Nov 30 16:26:39 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=bf1eba18

tests: allow running all tests using valgrind

use Q_RUN_WITH_VALGRIND to run the tests using valgrind

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 10 ++
 tests/qfile/dotest   | 16 
 tests/valgrind-wrapper/qvalgrind | 21 +
 3 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index 875e2af..8f52086 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -31,6 +31,16 @@ export TZ='UTC 0'
 # create symlinks for applets
 q -i -q
 
+# inject valgrind wrapper if necessary
+if [[ -n ${Q_RUN_WITH_VALGRIND} ]] ; then
+   chmod 755 "@abs_top_srcdir@/tests/valgrind-wrapper/qvalgrind"
+   for f in @abs_top_builddir@/q?* ; do
+   [[ -L ${f} ]] || continue
+   f=${f##*/}
+   eval "$f() { 
"@abs_top_srcdir@/tests/valgrind-wrapper/qvalgrind" $f \"\${@}\" ; }"
+   done
+fi
+
 tret=0
 tpassed=0
 tfailed=0

diff --git a/tests/qfile/dotest b/tests/qfile/dotest
index 7769a51..023630e 100755
--- a/tests/qfile/dotest
+++ b/tests/qfile/dotest
@@ -6,28 +6,28 @@ export ROOT=${as}/root
 export Q_VDB=/
 
 tests=(
-   "q file -Cq /bin/bash /bin/X"
+   "qfile -Cq /bin/bash /bin/X"
"app-shells/bash"
 
-   "q file -Co /bin/bash /bin/X"
+   "qfile -Co /bin/bash /bin/X"
"/bin/X"
 
-   "q file -Co -x bash /bin/bash"
+   "qfile -Co -x bash /bin/bash"
"/bin/bash"
 
-   "q file -Co -x app-shells/bash /bin/bash"
+   "qfile -Co -x app-shells/bash /bin/bash"
"/bin/bash"
 
-   "q file -Co -x bash:0 /bin/bash"
+   "qfile -Co -x bash:0 /bin/bash"
"/bin/bash"
 
-   "q file -Co -x app-shells/bash:0 /bin/bash"
+   "qfile -Co -x app-shells/bash:0 /bin/bash"
"/bin/bash"
 
-   "(cd ${ROOT}/bin; q file -RCq bash)"
+   "(cd ${ROOT}/bin; qfile -RCq bash)"
"app-shells/bash"
 
-   "(cd ${ROOT}/; q file -Co whatever)"
+   "(cd ${ROOT}/; qfile -Co whatever)"
"whatever"
 )
 

diff --git a/tests/valgrind-wrapper/qvalgrind b/tests/valgrind-wrapper/qvalgrind
new file mode 100755
index 000..679c387
--- /dev/null
+++ b/tests/valgrind-wrapper/qvalgrind
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# --errors-for-leak-kinds= drop possible due to Solaris libc/_findbuf
+valgrind \
+   --leak-check=full \
+   --track-fds=yes \
+   --malloc-fill=0xdb \
+   --free-fill=0xbd \
+   --log-file=q-valgrind.log \
+   --errors-for-leak-kinds=definite \
+   --error-exitcode=234 \
+   "${@}"
+ret=$?
+if [[ ${ret} == 234 ]] ; then
+   mv q-valgrind.log q-valgrind.$$.log
+   echo "valgrind log can be found at ${PWD}/q-valgrind.$$.log" > 
/dev/stderr
+else
+   rm q-valgrind.log
+fi
+
+exit ${ret}



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/, tests/profile/, /

2019-11-27 Thread Fabian Groffen
commit: 042a38c90aa010f05ecf7222f9be929f109c581e
Author: Fabian Groffen  gentoo  org>
AuthorDate: Wed Nov 27 12:32:12 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Wed Nov 27 12:32:12 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=042a38c9

set_portage_env_var: don't include built-in value for incremental vars

discard the built-in value when any other value is found from the
profiles

Signed-off-by: Fabian Groffen  gentoo.org>

 main.c   | 17 +++--
 tests/profile/dotest | 16 +++-
 tests/qmerge/dotest  |  2 ++
 3 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/main.c b/main.c
index 5ffe0ba..056e09c 100644
--- a/main.c
+++ b/main.c
@@ -51,6 +51,8 @@ static char *portedb;
 static char *eprefix;
 static char *accept_license;
 
+#define STR_DEFAULT "built-in default"
+
 /* helper functions for showing errors */
 const char *argv0;
 
@@ -333,15 +335,18 @@ set_portage_env_var(env_vars *var, const char *value, 
const char *src)
var->src = xstrdup(src);
break;
case _Q_ISTR:
-   if (*var->value.s == NULL) {
-   free(var->src);
-   var->src = xstrdup(src);
-   } else {
+   if (strcmp(var->src, STR_DEFAULT) != 0) {
size_t l = strlen(var->src) + 2 + strlen(src) + 1;
char *p = xmalloc(sizeof(char) * l);
snprintf(p, l, "%s, %s", var->src, src);
free(var->src);
var->src = p;
+   } else {
+   free(*var->value.s);
+   *var->value.s = NULL;
+   var->value_len = 0;
+   free(var->src);
+   var->src = xstrdup(src);
}
strincr_var(var->name, value, var->value.s, >value_len);
break;
@@ -718,7 +723,7 @@ initialize_portage_env(void)
var = _to_read[i];
if (var->type != _Q_BOOL)
*var->value.s = xstrdup(var->default_value);
-   var->src = xstrdup("built-in default");
+   var->src = xstrdup(STR_DEFAULT);
}
 
/* figure out where to find our config files */
@@ -740,7 +745,7 @@ initialize_portage_env(void)
if (array_cnt(overlays) == 0) {
xarraypush_ptr(overlays, main_overlay);
xarraypush_str(overlay_names, "");
-   xarraypush_str(overlay_src, "built-in default");
+   xarraypush_str(overlay_src, STR_DEFAULT);
} else if (orig_main_overlay == main_overlay) {
/* if no explicit overlay was flagged as main, take the first 
one */
main_overlay = array_get_elem(overlays, 0);

diff --git a/tests/profile/dotest b/tests/profile/dotest
index 2b77ee9..02c9fc4 100755
--- a/tests/profile/dotest
+++ b/tests/profile/dotest
@@ -2,32 +2,22 @@
 
 . ../init.sh || exit 1
 
-qenv() {
-   # get q to dump its processed env so we can check
-   DEBUG= q -V 2>&1 >/dev/null
-}
-
 # Usage:   
 tenv() {
local profile=$1 var=$2 exp=$3
 
export PORTAGE_CONFIGROOT=${as}/profile${profile}
-   local e=$(qenv)
-
-   res=$(echo "${e}" | sed -n "/^${var} = /{s:^${var} = ::;p}")
+   res=$(q -e "${var}")
 
[[ ${res} == "${exp}" ]]
if ! tend $? "(${profile}) ${var} = ${exp}" ; then
echo "we got: {${res}}"
-   echo "full env:"
-   echo "${e}" | while read line ; do
-   printf '\t{%s}\n' "${line}"
-   done
+   echo "full env: $(q -ev "${var}")"
fi
 }
 
 # clear out env vars that would affect our tests
-unset $(qenv | awk '{print $1}')
+unset $(q -e | cut -d= -f1)
 
 # test vars that should default to known values.
 # cannot test too many more as portage's default

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 83cb991..86c6147 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -4,6 +4,8 @@
 
 set -e
 
+unset CONFIG_PROTECT CONFIG_PROTECT_MASK EPREFIX
+
 export QMERGE=1
 export PKGDIR=${as}/packages
 export FEATURES='config-protect-if-modified'



[gentoo-commits] proj/portage-utils:master commit in: /, tests/quse/

2019-11-25 Thread Fabian Groffen
commit: 291f2707236477bc654976b70d68526cb3115531
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Nov 25 19:33:28 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Nov 25 19:33:28 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=291f2707

main: fix unintended memory freeing

env_vars keep pointers to global variables, so modifying those variables
is enough to change the values

Signed-off-by: Fabian Groffen  gentoo.org>

 main.c| 34 +-
 tests/quse/dotest |  4 
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/main.c b/main.c
index 081d72a..fb2340b 100644
--- a/main.c
+++ b/main.c
@@ -333,8 +333,7 @@ set_portage_env_var(env_vars *var, const char *value, const 
char *src)
var->src = xstrdup(src);
break;
case _Q_ISTR:
-   strincr_var(var->name, value, var->value.s, >value_len);
-   if (strcmp(var->src, "built-in default") == 0) {
+   if (*var->value.s == NULL) {
free(var->src);
var->src = xstrdup(src);
} else {
@@ -344,6 +343,7 @@ set_portage_env_var(env_vars *var, const char *value, const 
char *src)
free(var->src);
var->src = p;
}
+   strincr_var(var->name, value, var->value.s, >value_len);
break;
}
 }
@@ -616,14 +616,30 @@ read_one_repos_conf(const char *repos_conf)
xasprintf(, "%s:location", repo);
path = iniparser_getstring(dict, conf, NULL);
if (path) {
-   void *ele = xarraypush_str(overlays, path);
-   xarraypush_str(overlay_names, repo);
-   xarraypush_str(overlay_src, repos_conf);
-   if (main_repo && !strcmp(repo, main_repo)) {
-   main_overlay = ele;
-   set_portage_env_var(_to_read[11] /* 
PORTDIR */,
-   main_overlay, repos_conf);
+   void *ele;
+   size_t n;
+   char *overlay;
+
+   array_for_each(overlay_names, n, overlay) {
+   if (strcmp(overlay, repo) == 0)
+   break;
+   overlay = NULL;
}
+   if (overlay != NULL) {
+   /* replace overlay */
+   ele = array_get_elem(overlay_src, n);
+   free(ele);
+   array_get_elem(overlay_src, n) = 
xstrdup(repos_conf);
+   ele = array_get_elem(overlays, n);
+   free(ele);
+   ele = array_get_elem(overlays, n) = 
xstrdup(path);
+   } else {
+   ele = xarraypush_str(overlays, path);
+   xarraypush_str(overlay_names, repo);
+   xarraypush_str(overlay_src, repos_conf);
+   }
+   if (main_repo && strcmp(repo, main_repo) == 0)
+   main_overlay = ele;
}
free(conf);
}

diff --git a/tests/quse/dotest b/tests/quse/dotest
index 2a5cc5e..ada7bd9 100755
--- a/tests/quse/dotest
+++ b/tests/quse/dotest
@@ -13,10 +13,6 @@ entries() {
sed -e 's:#.*::' -e '/^$/d' "$1"
 }
 
-# temp for Travis debugging
-q -Cov
-q -Cev
-
 # check use.desc
 f="$d/use.desc"
 all=$(entries "$f" | awk '{print $1}')



[gentoo-commits] proj/portage-utils:master commit in: tests/quse/

2019-11-24 Thread Fabian Groffen
commit: 1157d817ac0f453b09ceac0f6e573e1ae8bbc9be
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Nov 24 20:21:08 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Nov 24 20:21:08 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1157d817

tests/quse: spit out some debugging for Travis run

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/quse/dotest | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/quse/dotest b/tests/quse/dotest
index ada7bd9..2a5cc5e 100755
--- a/tests/quse/dotest
+++ b/tests/quse/dotest
@@ -13,6 +13,10 @@ entries() {
sed -e 's:#.*::' -e '/^$/d' "$1"
 }
 
+# temp for Travis debugging
+q -Cov
+q -Cev
+
 # check use.desc
 f="$d/use.desc"
 all=$(entries "$f" | awk '{print $1}')



[gentoo-commits] proj/portage-utils:master commit in: tests/quse/

2019-11-24 Thread Fabian Groffen
commit: f6ccf33a61742a1097767423249c64427cd848a0
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Nov 24 20:10:39 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Nov 24 20:10:39 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f6ccf33a

tests/quse: show diffs from expected to actual

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/quse/dotest | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/quse/dotest b/tests/quse/dotest
index 850f393..ada7bd9 100755
--- a/tests/quse/dotest
+++ b/tests/quse/dotest
@@ -20,10 +20,10 @@ for x in ${all} ; do
quse -eCD $x > x
sed -n -e "/^$x - /{s|^[^ ]* - |global[$x] |;p}" "$f" > good
cat good >> all.good
-   diff -u x good
+   diff -u good x
 done
 quse -eCD ${all} > x
-diff -u x all.good
+diff -u all.good x
 rm x good all.good
 tpass "use.desc"
 
@@ -34,10 +34,10 @@ for x in ${all} ; do
quse -eCD $x > x
sed -n -e "/^[^:]*:$x - /{s|^\([^:]*\):[^ ]* - |\1[$x] |;p}" "$f" > good
cat good >> all.good
-   diff -u x good
+   diff -u good x
 done
 quse -eCD ${all} > x
-diff -u x all.good
+diff -u all.good x
 rm x good all.good
 tpass "use.local.desc"
 
@@ -51,10 +51,10 @@ for x in ${all} ; do
dispf=${dispf^^}
sed -n -e "/^$x - /{s|^[^ ]* - |${dispf}[$x] |;p}" "$f" > good
cat good >> all.good
-   diff -u x good
+   diff -u good x
 done
 quse -eCD ${all} > x
-diff -u x all.good
+diff -u all.good x
 rm x good all.good
 tpass "desc/elibc.desc"
 



[gentoo-commits] proj/portage-utils:master commit in: tests/qlist/

2019-11-17 Thread Fabian Groffen
commit: 1f03317929c7ee02eea0c3fdb3975b3323408200
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Nov 17 12:45:47 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Nov 17 12:45:47 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1f033179

tests: improve qlist error output

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qlist/dotest | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/qlist/dotest b/tests/qlist/dotest
index 2ba7033..0bb031b 100755
--- a/tests/qlist/dotest
+++ b/tests/qlist/dotest
@@ -13,8 +13,8 @@ test() {
local num=$1 exp=$2 ret=0
shift 2
eval "$@" > list || ret=$?
-   if ! diff -u list ${as}/list${num}.good ; then
-   tfail "output does not match"
+   if ! diff -u ${as}/list${num}.good list ; then
+   tfail "output does not match for: $*"
fi
if [[ ${exp} -ne ${ret} ]] ; then
tfail "exit code (${ret}) does not match expected (${exp})"
@@ -50,7 +50,7 @@ test 08 0 "qlist -C cpio"
 test 09 0 "qlist -C mtools -d"
 
 # ver test
-test 10 0 "qlist -Iv =mtools-4*"
+test 10 0 "qlist -ICv =mtools-4*"
 
 # repo test
 test 11 0 "qlist -ICR"
@@ -65,7 +65,7 @@ test 13 0 "qlist -Ce --showdebug app-arch/cpio:0::gentoo"
 test 14 0 "qlist -ICSS"
 
 # no matches
-test 15 1 "qlist -Iv lajsdflkjasdflkjasdfljasdf"
+test 15 1 "qlist -ICv lajsdflkjasdflkjasdfljasdf"
 
 # match test w/out sub-SLOT
 test 16 0 "qlist -ICSS virtual/sub-2:1"



[gentoo-commits] proj/portage-utils:master commit in: /, tests/qlop/

2019-10-27 Thread Fabian Groffen
commit: 27f35b8a59b2afcc090c5e576a69ad7f1eb14b12
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Oct 27 12:46:06 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Oct 27 12:46:06 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=27f35b8a

qlop: allow forcing non-proc running mode using -rr for testing

Adapt test to use -rr to force falling back to scanning emerge.log, and
give -d to the data range in which things happen, such that the 10-day
cutoff can be calculated based on that for deterministic output.

Signed-off-by: Fabian Groffen  gentoo.org>

 qlop.c | 25 ++---
 tests/qlop/dotest  |  4 ++--
 tests/qlop/list10.good |  6 +++---
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/qlop.c b/qlop.c
index 6cb2c04..7083ea7 100644
--- a/qlop.c
+++ b/qlop.c
@@ -344,7 +344,6 @@ New format:
 1550953125:  *** exiting successfully.
 1550953125:  *** terminating.
 
-
 Currently running merges can be found in the /proc filesystem:
 - Linux: readlink(/proc//fd/X)
 - Solaris: readlink(/proc//path/X)
@@ -846,16 +845,18 @@ static int do_emerge_log(
if (flags->do_running) {
time_t cutofftime;
 
+   tstart = time(NULL);
+
/* emerge.log can be interrupted, incorrect and hopelessly lost,
 * so to eliminate some unfinished crap from there, we just
 * ignore anything that's > cutofftime, 10 days for now. */
cutofftime = 10 * 24 * 60 * 60;  /* when we consider entries 
stale */
+   cutofftime = (tbegin > 0 ? tbegin : tstart) - cutofftime;
 
/* can't report endtime for non-finished operations */
flags->do_endtime = 0;
-   tstart = time(NULL);
sync_time /= sync_cnt;
-   if (sync_start >= tstart - cutofftime) {
+   if (sync_start >= cutofftime) {
elapsed = tstart - sync_start;
if (elapsed >= sync_time)
sync_time = 0;
@@ -878,7 +879,7 @@ static int do_emerge_log(
time_t maxtime = 0;
bool isMax = false;
 
-   if (pkgw->tbegin < tstart - cutofftime)
+   if (pkgw->tbegin < cutofftime)
continue;
 
snprintf(afmt, sizeof(afmt), "%s/%s",
@@ -925,7 +926,7 @@ static int do_emerge_log(
time_t maxtime = 0;
bool isMax = false;
 
-   if (pkgw->tbegin < tstart - cutofftime)
+   if (pkgw->tbegin < cutofftime)
continue;
 
snprintf(afmt, sizeof(afmt), "%s/%s",
@@ -1140,6 +1141,7 @@ int qlop_main(int argc, char **argv)
char *q;
depend_atom *atom;
DECLARE_ARRAY(atoms);
+   int runningmode = 0;
 
start_time = 0;
end_time = LONG_MAX;
@@ -1173,7 +1175,8 @@ int qlop_main(int argc, char **argv)
  m.show_lastmerge = 1;
  m.show_emerge = 1;
  verbose = 1;  break;
-   case 'r': m.do_running = 1; break;
+   case 'r': m.do_running = 1;
+ runningmode++;break;
case 'a': m.do_average = 1; break;
case 'c': m.do_summary = 1; break;
case 'H': m.do_human = 1;   break;
@@ -1312,14 +1315,14 @@ int qlop_main(int argc, char **argv)
if (m.do_running) {
array_t *new_atoms = probe_proc(atoms);
 
-   if (new_atoms != NULL && array_cnt(new_atoms) == 0) {
-   /* proc supported, found nothing running */
-   start_time = LONG_MAX;
-   } else {
+   if (runningmode > 1 || new_atoms == NULL) {
warn("/proc not available, deducing running "
"merges from emerge.log");
+   } else if (array_cnt(new_atoms) == 0) {
+   /* proc supported, found nothing running */
+   start_time = LONG_MAX;
}
-
+   /* NOTE: new_atoms == atoms when new_atoms != NULL */
}
 
if (start_time < LONG_MAX)

diff --git a/tests/qlop/dotest b/tests/qlop/dotest
index bf5edc0..321f7d2 100755
--- a/tests/qlop/dotest
+++ b/tests/qlop/dotest
@@ -10,7 +10,7 @@ test() {
local num=$1 exp=$2 ret=0
shift 2
eval "$@" > list || ret=$?
-   if ! diff -u list ${as}/list${num}.good ; then
+   if ! diff -u ${as}/list${num}.good list ; then
tfail "output does not match"
fi
if [[ ${exp} -ne ${ret} ]] ; 

[gentoo-commits] proj/portage-utils:master commit in: tests/qlop/

2019-10-20 Thread Fabian Groffen
commit: c8d6b8c4ce4909b8cec932e615e53796f46f4d88
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Oct 20 09:14:42 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Oct 20 09:14:42 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c8d6b8c4

tests: add forgotten test output file

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qlop/list10.good | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/qlop/list10.good b/tests/qlop/list10.good
new file mode 100644
index 000..845573f
--- /dev/null
+++ b/tests/qlop/list10.good
@@ -0,0 +1,3 @@
+2019-09-20T12:27:40 >>> dev-qt/qtmultimedia... (96 of 129) ETA: unknown
+2019-09-20T16:17:50 >>> kde-frameworks/kxmlgui... (98 of 129) ETA: unknown
+2019-09-20T16:18:28 >>> net-analyzer/wireshark... (99 of 129) ETA: unknown



[gentoo-commits] proj/portage-utils:master commit in: /, tests/qlop/

2019-10-20 Thread Fabian Groffen
commit: e526bb8f26e2065bf990a0783ef3b1a9ad1fdb3d
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Oct 20 09:07:31 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Oct 20 09:07:31 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=e526bb8f

qlop: don't "forget" merges when a parallel merge finishes

Stop seeing finishing emerge processes double, thereby wrongly
calculating the current parallel merges.

Bug: https://bugs.gentoo.org/697068
Signed-off-by: Fabian Groffen  gentoo.org>

 qlop.c  |  3 +--
 tests/qlop/dotest   |  4 
 tests/qlop/parallel.log | 53 +
 3 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/qlop.c b/qlop.c
index 4347699..7a93656 100644
--- a/qlop.c
+++ b/qlop.c
@@ -474,8 +474,7 @@ static int do_emerge_log(
 * finished without knowledge of another instance */
if (flags->do_running &&
(strncmp(p, "  *** emerge ", 13) == 0 ||
-strncmp(p, "  *** terminating.", 18) == 0 ||
-strncmp(p, "  *** exiting ", 14) == 0))
+strncmp(p, "  *** terminating.", 18) == 0))
{
if (p[7] == 'm') {
parallel_emerge++;

diff --git a/tests/qlop/dotest b/tests/qlop/dotest
index 51cdb8a..bf5edc0 100755
--- a/tests/qlop/dotest
+++ b/tests/qlop/dotest
@@ -46,6 +46,10 @@ test 08 0 "qlop -mv -f ${as}/sync.log -d 1104898893"
 # deal with aborted merges
 test 09 0 "qlop -Hacv automake -f ${as}/aborts.log"
 
+# https://bugs.gentoo.org/697068: a parallel emerge finishing should
+# wipe the outstanding emerges from other emerges
+test 10 0 "qlop -r -f ${as}/parallel.log"
+
 cleantmpdir
 
 end

diff --git a/tests/qlop/parallel.log b/tests/qlop/parallel.log
new file mode 100644
index 000..0841097
--- /dev/null
+++ b/tests/qlop/parallel.log
@@ -0,0 +1,53 @@
+1568976528: Started emerge on: Sep 20, 2019 12:48:48
+1568976528:  *** emerge --autounmask-continue --autounmask-write 
--backtrack=100 --jobs=2 --load-average=8.0 --with-bdeps=y --sync
+1568976528:  === sync
+1568976528: >>> Syncing repository 'gentoo' into '/usr/portage'...
+1568976547: === Sync completed for gentoo
+1568976570:  *** terminating.
+1568976571: Started emerge on: Sep 20, 2019 12:49:31
+1568976571:  *** emerge --newuse --update --ask --autounmask-continue 
--autounmask-write --backtrack=100 --deep --jobs=2 --load-average=8.0 
--with-bdeps=y --verbose @world
+1568982446:  >>> emerge (95 of 129) kde-frameworks/qqc2-desktop-style-5.62.0 
to /
+1568982460:  >>> emerge (96 of 129) dev-qt/qtmultimedia-5.12.5 to /
+1568982460:  === (96 of 129) Cleaning 
(dev-qt/qtmultimedia-5.12.5::/usr/portage/dev-qt/qtmultimedia/qtmultimedia-5.12.5.ebuild)
+1568982460:  === (96 of 129) Compiling/Merging 
(dev-qt/qtmultimedia-5.12.5::/usr/portage/dev-qt/qtmultimedia/qtmultimedia-5.12.5.ebuild)
+1568982446:  === (95 of 129) Cleaning 
(kde-frameworks/qqc2-desktop-style-5.62.0::/usr/portage/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-5.62.0.ebuild)
+1568982446:  === (95 of 129) Compiling/Merging 
(kde-frameworks/qqc2-desktop-style-5.62.0::/usr/portage/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-5.62.0.ebuild)
+1568982462:  === (95 of 129) Merging 
(kde-frameworks/qqc2-desktop-style-5.62.0::/usr/portage/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-5.62.0.ebuild)
+1568982480:  === (95 of 129) Post-Build Cleaning 
(kde-frameworks/qqc2-desktop-style-5.62.0::/usr/portage/kde-frameworks/qqc2-desktop-style/qqc2-desktop-style-5.62.0.ebuild)
+1568982480:  ::: completed emerge (95 of 129) 
kde-frameworks/qqc2-desktop-style-5.62.0 to /
+1568982686:  === (96 of 129) Merging 
(dev-qt/qtmultimedia-5.12.5::/usr/portage/dev-qt/qtmultimedia/qtmultimedia-5.12.5.ebuild)
+1568982695:  >>> AUTOCLEAN: dev-qt/qtmultimedia:5
+1568982695:  === Unmerging... (dev-qt/qtmultimedia-5.12.4)
+1568982700:  >>> unmerge success: dev-qt/qtmultimedia-5.12.4
+1568982708:  === (96 of 129) Post-Build Cleaning 
(dev-qt/qtmultimedia-5.12.5::/usr/portage/dev-qt/qtmultimedia/qtmultimedia-5.12.5.ebuild)
+1568982708:  XXX completed emerge (96 of 129) dev-qt/qtmultimedia-5.12.5 to /
+1568988624: Started emerge on: Sep 20, 2019 16:10:23
+1568988624:  *** emerge --ask --autounmask-continue --autounmask-write 
--backtrack=100 --jobs=2 --load-average=8.0 --with-bdeps=y --verbose ktouch
+1568991194:  >>> emerge (1 of 2) kde-apps/kqtquickcharts-19.08.1 to /
+1568991195:  === (1 of 2) Cleaning 
(kde-apps/kqtquickcharts-19.08.1::/usr/portage/kde-apps/kqtquickcharts/kqtquickcharts-19.08.1.ebuild)
+1568991196:  === (1 of 2) Compiling/Merging 
(kde-apps/kqtquickcharts-19.08.1::/usr/portage/kde-apps/kqtquickcharts/kqtquickcharts-19.08.1.ebuild)
+1568991249:  === (1 of 2) Merging 

[gentoo-commits] proj/portage-utils:master commit in: tests/, /

2019-07-14 Thread Fabian Groffen
commit: 6e0f64cb72a3e2948fdb8b6a59aac9bb57223dc2
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Jul 14 13:07:42 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Jul 14 13:07:42 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6e0f64cb

qtegrity: use libq/hash iso shelling out to shaXsum

Use libq/hash functionality (as used by qmanifest) in qtegrity to obtain
hashes for files.  This adds a dep on openssl currently, so allow
disabling this applet.

Signed-off-by: Fabian Groffen  gentoo.org>

 Makefile.am   | 13 ++-
 configure.ac  | 33 ++--
 qtegrity.c| 65 ---
 tests/Makefile.am |  4 +++-
 4 files changed, 60 insertions(+), 55 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index fc0619c..e8b11f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -64,7 +64,6 @@ q_SOURCES = \
qsearch.c \
qsize.c \
qtbz2.c \
-   qtegrity.c \
quse.c \
qxpak.c \
$(NULL)
@@ -95,6 +94,18 @@ q_LDADD += \
 dist_man_MANS += man/qmanifest.1
 APPLETS += qmanifest
 endif
+if QTEGRITY_ENABLED
+q_SOURCES += qtegrity.c
+if !QMANIFEST_ENABLED
+q_CPPFLAGS += \
+   $(OPENMP_CFLAGS)
+q_LDADD += \
+   $(OPENMP_CFLAGS)
+endif
+dist_man_MANS += man/qtegrity.1
+APPLETS += qtegrity
+endif
+
 
 install-exec-hook:
cd $(DESTDIR)$(bindir); \

diff --git a/configure.ac b/configure.ac
index bda5a84..0577d07 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,11 +35,15 @@ AC_SUBST([CONFIG_EPREFIX], ["$with_eprefix"])
 AC_ARG_ENABLE([qmanifest], [AS_HELP_STRING([--enable-qmanifest],
  [support qmanifest applet])],
  [], [enable_qmanifest=auto])
+AC_ARG_ENABLE([qtegrity], [AS_HELP_STRING([--enable-qtegrity],
+ [support qtegrity applet])],
+ [], [enable_qtegrity=auto])
 LIBSSL=
 LIBBL2=
 LIBZ=
 HASGPGME=
-AS_IF([test "x$enable_qmanifest" != xno],
+
+AS_IF([test "x${enable_qmanifest}x${enable_qtegrity}" != xnoxno],
  [AC_CHECK_HEADERS([openssl/err.h \
 openssl/ssl.h], [], [LIBSSL=_missing_header])
   AC_CHECK_LIB([ssl${LIBSSL}], [SSL_connect],
@@ -55,9 +59,33 @@ AS_IF([test "x$enable_qmanifest" != xno],
 AC_MSG_FAILURE(
   [--enable-qmanifest was given, but 
test for ssl failed])
 fi
+if test "x$enable_qtegrity" != xauto; 
then
+AC_MSG_FAILURE(
+  [--enable-qtegrity was given, but 
test for ssl failed])
+fi
 LIBSSL=
])
-  AC_CHECK_HEADERS([blake2.h], [], [LIBBL2=_missing_header])
+  AC_MSG_CHECKING([whether to enable qtegrity])
+  case "x${LIBSSL}" in
+  "x-lssl"*)
+   AC_MSG_RESULT([yes])
+   ;;
+  *)
+  enable_qtegrity=no
+  AC_MSG_RESULT([no: missing dependencies])
+  ;;
+  esac
+  if test "x$enable_qtegrity" != xno ; then
+  AC_DEFINE([ENABLE_QTEGRITY], [1],
+[Define if qtegrity should be 
compiled])
+  fi
+   ],
+   [
+  AC_MSG_CHECKING([whether to enable qtegrity])
+  AC_MSG_RESULT([no: disabled by configure argument])
+   ])
+AS_IF([test "x$enable_qmanifest" != xno],
+ [AC_CHECK_HEADERS([blake2.h], [], [LIBBL2=_missing_header])
   AC_CHECK_LIB([b2${LIBBL2}], [blake2b_update],
[LIBBL2="-lb2"
 AC_DEFINE([HAVE_BLAKE2B], [1],
@@ -104,6 +132,7 @@ AS_IF([test "x$enable_qmanifest" != xno],
   AC_MSG_RESULT([no: disabled by configure argument])
])
 AM_CONDITIONAL([QMANIFEST_ENABLED], [test "x$enable_qmanifest" != xno])
+AM_CONDITIONAL([QTEGRITY_ENABLED], [test "x$enable_qtegrity" != xno])
 
 AX_CFLAGS_WARN_ALL
 AC_DEFUN([PT_CHECK_CFLAG],[AX_CHECK_COMPILER_FLAGS([$1],[CFLAGS="$CFLAGS 
$1"])])

diff --git a/qtegrity.c b/qtegrity.c
index 70a99d5..0d23a7f 100644
--- a/qtegrity.c
+++ b/qtegrity.c
@@ -5,10 +5,12 @@
  * Copyright 2005-2010 Ned Ludd- 
  * Copyright 2005-2014 Mike Frysinger  - 
  * Copyright 2017-2018 Sam Besselink
+ * Copyright 2019- Fabian Groffen  - 
  */
 
 #include "main.h"
 #include "applets.h"
+#include "libq/hash.h"
 
 #include 
 #include 
@@ -60,63 +62,24 @@ struct qtegrity_opt_state {
 #define SHA256_LENGTH (SHA256_PREFIX_LENGTH + SHA256_DIGEST_LENGTH)
 #define SHA512_DIGEST_LENGTH 128
 
-static void 

[gentoo-commits] proj/portage-utils:master commit in: tests/, /

2019-07-14 Thread Fabian Groffen
commit: d801e8d09d8aa9c79122d8fa7f6da406d5a9f904
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Jul 14 13:09:30 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Jul 14 13:09:30 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d801e8d0

buildsys: regen

Signed-off-by: Fabian Groffen  gentoo.org>

 Makefile.in   |  59 -
 config.h.in   |   3 +
 configure | 250 +-
 tests/Makefile.in |   4 +-
 4 files changed, 195 insertions(+), 121 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 15b2a2f..6166e5f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -99,6 +99,15 @@ bin_PROGRAMS = q$(EXEEXT)
 
 @QMANIFEST_ENABLED_TRUE@am__append_4 = man/qmanifest.1
 @QMANIFEST_ENABLED_TRUE@am__append_5 = qmanifest
+@QTEGRITY_ENABLED_TRUE@am__append_6 = qtegrity.c
+@QMANIFEST_ENABLED_FALSE@@QTEGRITY_ENABLED_TRUE@am__append_7 = \
+@QMANIFEST_ENABLED_FALSE@@QTEGRITY_ENABLED_TRUE@   $(OPENMP_CFLAGS)
+
+@QMANIFEST_ENABLED_FALSE@@QTEGRITY_ENABLED_TRUE@am__append_8 = \
+@QMANIFEST_ENABLED_FALSE@@QTEGRITY_ENABLED_TRUE@   $(OPENMP_CFLAGS)
+
+@QTEGRITY_ENABLED_TRUE@am__append_9 = man/qtegrity.1
+@QTEGRITY_ENABLED_TRUE@am__append_10 = qtegrity
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/autotools/m4/00gnulib.m4 \
@@ -257,24 +266,26 @@ am__installdirs = "$(DESTDIR)$(bindir)" 
"$(DESTDIR)$(man1dir)"
 PROGRAMS = $(bin_PROGRAMS)
 am__q_SOURCES_DIST = main.c q.c qatom.c qcheck.c qdepends.c qfile.c \
qgrep.c qkeyword.c qlist.c qlop.c qmerge.c qpkg.c qsearch.c \
-   qsize.c qtbz2.c qtegrity.c quse.c qxpak.c qmanifest.c
+   qsize.c qtbz2.c quse.c qxpak.c qmanifest.c qtegrity.c
 @QMANIFEST_ENABLED_TRUE@am__objects_1 = q-qmanifest.$(OBJEXT)
+@QTEGRITY_ENABLED_TRUE@am__objects_2 = q-qtegrity.$(OBJEXT)
 am_q_OBJECTS = q-main.$(OBJEXT) q-q.$(OBJEXT) q-qatom.$(OBJEXT) \
q-qcheck.$(OBJEXT) q-qdepends.$(OBJEXT) q-qfile.$(OBJEXT) \
q-qgrep.$(OBJEXT) q-qkeyword.$(OBJEXT) q-qlist.$(OBJEXT) \
q-qlop.$(OBJEXT) q-qmerge.$(OBJEXT) q-qpkg.$(OBJEXT) \
q-qsearch.$(OBJEXT) q-qsize.$(OBJEXT) q-qtbz2.$(OBJEXT) \
-   q-qtegrity.$(OBJEXT) q-quse.$(OBJEXT) q-qxpak.$(OBJEXT) \
-   $(am__objects_1)
+   q-quse.$(OBJEXT) q-qxpak.$(OBJEXT) $(am__objects_1) \
+   $(am__objects_2)
 q_OBJECTS = $(am_q_OBJECTS)
 am__DEPENDENCIES_1 =
 @QMANIFEST_ENABLED_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+@QMANIFEST_ENABLED_FALSE@@QTEGRITY_ENABLED_TRUE@am__DEPENDENCIES_3 = 
$(am__DEPENDENCIES_1)
 q_DEPENDENCIES = $(top_builddir)/libq/libq.la \
$(top_builddir)/autotools/gnulib/libgnu.a \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-   $(am__DEPENDENCIES_2)
+   $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
@@ -1586,20 +1597,22 @@ SUBDIRS = \
 
 APPLETS = q qatom qcheck qdepends qfile qgrep qkeyword qlist qlop \
qmerge qpkg qsearch qsize qtbz2 qtegrity quse qxpak $(NULL) \
-   $(am__append_5)
+   $(am__append_5) $(am__append_10)
 dist_man_MANS = man/q.1 man/qatom.1 man/qcheck.1 man/qdepends.1 \
man/qfile.1 man/qgrep.1 man/qkeyword.1 man/qlist.1 man/qlop.1 \
man/qmerge.1 man/qpkg.1 man/qsearch.1 man/qsize.1 man/qtbz2.1 \
-   man/qtegrity.1 man/quse.1 man/qxpak.1 $(NULL) $(am__append_4)
+   man/qtegrity.1 man/quse.1 man/qxpak.1 $(NULL) $(am__append_4) \
+   $(am__append_9)
 q_SOURCES = main.c q.c qatom.c qcheck.c qdepends.c qfile.c qgrep.c \
qkeyword.c qlist.c qlop.c qmerge.c qpkg.c qsearch.c qsize.c \
-   qtbz2.c qtegrity.c quse.c qxpak.c $(NULL) $(am__append_1)
+   qtbz2.c quse.c qxpak.c $(NULL) $(am__append_1) $(am__append_6)
 q_CPPFLAGS = -I$(top_srcdir)/libq -I$(top_builddir)/autotools/gnulib \
-   -I$(top_srcdir)/autotools/gnulib $(NULL) $(am__append_2)
+   -I$(top_srcdir)/autotools/gnulib $(NULL) $(am__append_2) \
+   $(am__append_7)
 q_LDADD = $(top_builddir)/libq/libq.la \
$(top_builddir)/autotools/gnulib/libgnu.a -liniparser \
$(LIBSSL) $(LIBBL2) $(LIBZ) $(GPGME_LIBS) $(LIB_CLOCK_GETTIME) \
-   $(LIB_EACCESS) $(NULL) $(am__append_3)
+   $(LIB_EACCESS) $(NULL) $(am__append_3) $(am__append_8)
 EXTRA_DIST = \
autotools/m4/gnulib-cache.m4 \
applets.h \
@@ -1976,20 +1989,6 @@ q-qtbz2.obj: qtbz2.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) 
$(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o q-qtbz2.obj 
`if test -f 'qtbz2.c'; then $(CYGPATH_W) 'qtbz2.c'; else $(CYGPATH_W) 
'$(srcdir)/qtbz2.c'; fi`
 
-q-qtegrity.o: qtegrity.c

[gentoo-commits] proj/portage-utils:master commit in: /, tests/qcheck/

2019-07-12 Thread Fabian Groffen
commit: 667a6170ad2536aa3800bf35b3ea38f227d739b7
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat Jun 29 11:44:55 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat Jun 29 11:44:55 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=667a6170

qcheck: add -F argument

Signed-off-by: Fabian Groffen  gentoo.org>

 q.c  |  2 +-
 qcheck.c | 38 ++
 tests/qcheck/dotest  |  2 +-
 tests/qcheck/list01.good |  2 +-
 tests/qcheck/list02.good |  2 +-
 tests/qcheck/list04.good |  4 ++--
 tests/qcheck/list05.good |  4 ++--
 tests/qcheck/list06.good |  4 ++--
 tests/qcheck/list07.good |  4 ++--
 tests/qcheck/list09.good |  4 ++--
 10 files changed, 36 insertions(+), 30 deletions(-)

diff --git a/q.c b/q.c
index 31427f3..3dd49f7 100644
--- a/q.c
+++ b/q.c
@@ -129,7 +129,7 @@ int q_main(int argc, char **argv)
rret = readlink("/proc/self/exe", buf, sizeof(buf) - 1);
 #endif
if (rret == -1) {
-   warnfp("haha no symlink love for you");
+   warnfp("haha no symlink love for you ... :(");
return 1;
}
buf[rret] = '\0';

diff --git a/qcheck.c b/qcheck.c
index 97070f2..f77a501 100644
--- a/qcheck.c
+++ b/qcheck.c
@@ -24,8 +24,12 @@
 #include "xasprintf.h"
 #include "xregex.h"
 
-#define QCHECK_FLAGS "s:uABHTPp" COMMON_FLAGS
+#define QCHECK_FORMAT "%[CATEGORY]%[PN]"
+#define QCHECK_FORMAT_VERBOSE "%[CATEGORY]%[PF]"
+
+#define QCHECK_FLAGS "F:s:uABHTPp" COMMON_FLAGS
 static struct option const qcheck_long_opts[] = {
+   {"format",  a_argument, NULL, 'F'},
{"skip",a_argument, NULL, 's'},
{"update", no_argument, NULL, 'u'},
{"noafk",  no_argument, NULL, 'A'},
@@ -37,6 +41,7 @@ static struct option const qcheck_long_opts[] = {
COMMON_LONG_OPTS
 };
 static const char * const qcheck_opts_help[] = {
+   "Custom output format (default: " QCHECK_FORMAT ")",
"Ignore files matching the regular expression ",
"Update missing files, chksum and mtimes for packages",
"Ignore missing files",
@@ -61,6 +66,7 @@ struct qcheck_opt_state {
bool chk_mtime;
bool chk_config_protect;
bool undo_prelink;
+   const char *fmt;
 };
 
 static int
@@ -97,7 +103,7 @@ qcheck_process_contents(tree_pkg_ctx *pkg_ctx, struct 
qcheck_opt_state *state)
num_files = num_files_ok = num_files_unknown = num_files_ignored = 0;
qcprintf("%sing %s ...\n",
(state->qc_update ? "Updat" : "Check"),
-   atom_format("%[CATEGORY]%[PF]", atom));
+   atom_format(state->fmt, atom));
if (state->qc_update) {
fp_contents_update = tree_pkg_vdb_fopenat_rw(pkg_ctx, 
"CONTENTS~");
if (fp_contents_update == NULL) {
@@ -328,13 +334,8 @@ qcheck_process_contents(tree_pkg_ctx *pkg_ctx, struct 
qcheck_opt_state *state)
if (!verbose)
return EXIT_SUCCESS;
}
-   if (state->bad_only && num_files_ok != num_files) {
-   if (verbose)
-   printf("%s\n", atom_format("%[CATEGORY]%[PF]", atom));
-   else {
-   printf("%s\n", atom_format("%[CATEGORY]%[PN]", atom));
-   }
-   }
+   if (state->bad_only && num_files_ok != num_files)
+   printf("%s\n", atom_format(state->fmt, atom));
qcprintf("  %2$s*%1$s %3$s%4$zu%1$s out of %3$s%5$zu%1$s file%6$s are 
good",
NORM, BOLD, BLUE, num_files_ok, num_files,
(num_files > 1 ? "s" : ""));
@@ -398,6 +399,7 @@ int qcheck_main(int argc, char **argv)
.chk_mtime = true,
.chk_config_protect = true,
.undo_prelink = false,
+   .fmt = NULL,
};
 
while ((ret = GETOPT_LONG(QCHECK, qcheck, "")) != -1) {
@@ -409,16 +411,20 @@ int qcheck_main(int argc, char **argv)
xarraypush(regex_arr, , sizeof(preg));
break;
}
-   case 'u': state.qc_update = true; break;
-   case 'A': state.chk_afk = false; break;
-   case 'B': state.bad_only = true; break;
-   case 'H': state.chk_hash = false; break;
-   case 'T': state.chk_mtime = false; break;
-   case 'P': state.chk_config_protect = false; break;
-   case 'p': state.undo_prelink = prelink_available(); break;
+   case 'u': state.qc_update = true;break;
+   case 'A': state.chk_afk = false; break;
+   case 'B': state.bad_only = true; break;
+   case 'H': state.chk_hash = false;break;
+   case 'T': state.chk_mtime = false; 

[gentoo-commits] proj/portage-utils:master commit in: tests/qatom/

2019-06-13 Thread Fabian Groffen
commit: 36b47b9434c7166c3b4b4d62de07d530294c
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Jun 13 18:31:48 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Jun 13 18:31:48 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=36b47bcc

tests/qatom: add exact usage from Puppet provider as test

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qatom/dotest | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/qatom/dotest b/tests/qatom/dotest
index 0d04f40..f478f1c 100755
--- a/tests/qatom/dotest
+++ b/tests/qatom/dotest
@@ -64,6 +64,10 @@ test f20 "cat/pkg"-F '%[CATEGORY]%[PF]' \
 test f21 "pkg-123-r4:5::repo" \
   -F '%[PF]%[SLOT]%[REPO]' \
"cat/pkg-123-r4:5::repo"
+# Puppet portage provider
+test p01 "[app-admin] [syslog-ng] [] [] [] [] []" \
+  -F "[%[CATEGORY]] [%[PN]] [%[PV]] [%[PR]] [%[SLOT]] 
[%[pfx]] [%[sfx]]" \
+   "app-admin/syslog-ng"
 
 # Comparison tests
 test c01 "cat/pkg-123-r3 == pkg" \



[gentoo-commits] proj/portage-utils:master commit in: tests/qatom/, /, libq/

2019-06-13 Thread Fabian Groffen
commit: b2418b1406551ce5b540aaf8d332ec53ddd52e01
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Jun 13 18:13:57 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Jun 13 18:13:57 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=b2418b14

libq/atom: make atom_format smarter to unbreak Puppet

The default portage provider in Puppet uses qatom in a rather clumpsy
way.  The newer formatting broke it because they don't use explicit
formatting.  Make atom_format somewhat smarter to unbreak Puppet's
usage.

Signed-off-by: Fabian Groffen  gentoo.org>

 libq/atom.c| 38 ++
 libq/atom.h|  4 ++--
 qatom.c|  2 +-
 qcheck.c   |  6 +++---
 qdepends.c |  6 +++---
 qfile.c|  4 ++--
 qgrep.c|  2 +-
 qlist.c|  4 ++--
 qlop.c | 24 
 qmerge.c   |  2 +-
 qsearch.c  |  2 +-
 qsize.c|  2 +-
 quse.c |  6 +++---
 tests/qatom/dotest | 12 +---
 14 files changed, 63 insertions(+), 51 deletions(-)

diff --git a/libq/atom.c b/libq/atom.c
index 12a393a..8ce7f18 100644
--- a/libq/atom.c
+++ b/libq/atom.c
@@ -683,7 +683,7 @@ atom_to_string_r(char *buf, size_t buflen, depend_atom *a)
 /**
  * Run printf on an atom.  The format field takes the form:
  *  %{keyword}: Always display the field that matches "keyword" or 
- *  %[keyword]: Only display the field when it's set (or pverbose)
+ *  %[keyword]: Only display the field when it's set
  * The possible "keywords" are:
  *  CATEGORY  P  PN  PV  PVR  PF  PR  SLOT  SUBSLOT  REPO  USE
  *- these are all the standard portage variables (so see ebuild(5))
@@ -695,14 +695,14 @@ atom_format_r(
char *buf,
size_t buflen,
const char *format,
-   const depend_atom *atom,
-   int pverbose)
+   const depend_atom *atom)
 {
char bracket;
const char *fmt;
const char *p;
size_t len;
bool showit;
+   bool connected;
char *ret;
 
if (!atom) {
@@ -725,21 +725,25 @@ atom_format_r(
return ret;
} else if (fmt != p) {
append_buf(buf, buflen, "%.*s", (int)(fmt - p), p);
+   connected = false;
+   } else {
+   connected = true;
}
 
bracket = fmt[1];
if (bracket == '{' || bracket == '[') {
+   connected &= bracket == '[';
fmt += 2;
-   p = strchr(fmt, bracket == '{' ? '}' : ']');
-   if (p) {
+   if ((p = strchr(fmt, bracket == '{' ? '}' : ']')) != 
NULL) {
len = p - fmt;
-   showit = (bracket == '{') || pverbose;
+   showit = bracket == '{';
 #define HN(X) (X ? X : "")
if (!strncmp("CATEGORY", fmt, len)) {
+   connected = (p[1] == '%') & (bracket == 
'[');
if (showit || atom->CATEGORY)
append_buf(buf, buflen, 
"%s%s%s%s",
BOLD, 
HN(atom->CATEGORY),
-   bracket == '[' 
? "/" : "", NORM);
+   connected ? "/" 
: "", NORM);
} else if (!strncmp("P", fmt, len)) {
if (showit || atom->P)
append_buf(buf, buflen, 
"%s%s%s",
@@ -772,21 +776,21 @@ atom_format_r(
if (showit || atom->SLOT)
append_buf(buf, buflen, 
"%s%s%s%s",
YELLOW,
-   bracket == '[' 
? ":" : "",
+   connected ? ":" 
: "",
atom->SLOT ? 
atom->SLOT : "",
NORM);
} else if (!strncmp("SUBSLOT", fmt, len)) {
if (showit || atom->SUBSLOT)
append_buf(buf, buflen, 
"%s%s%s%s%s",
YELLOW,
-   bracket == '[' 
? "/" : "",
+   connected ? "/" 
: "",

[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-06-13 Thread Fabian Groffen
commit: 3f59ae89004adfb1c6111acee7197758722ae69b
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Jun 13 11:31:33 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Jun 13 11:31:33 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=3f59ae89

tests/qmanifest: allow gpg_import to fail

bash on Travis responds differently (more correct?) than bash on my test
env, disable error-is-fail behaviour for the test

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 0770ed1..900b9ea 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -69,7 +69,9 @@ gpg_import() {
 # - Ubuntu uses old/ancient gnupg which doesn't grok arguments and key (Travis)
 # - HOME (T) may be too long to hold a socket, especially on Linux this
 #   pathlength is very short, Portage's T may be too long by default
+set +e
 if gpg_import "${as}"/key.gpg qmanifest ; then
+set -e
 
 # make it a fully valid tree
 rm testtree/my-cat/mypackage/unrecorded-file



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-06-13 Thread Fabian Groffen
commit: bcbcec8baad9790b8df4da526ad2d0cdd9f13fd1
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Jun 13 11:24:22 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Jun 13 11:24:22 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=bcbcec8b

tests/qmanifest: skip sign test if importing key fails

gnupg's socket path may be too long due to T being somewhere too deep,
so simply skip the signing test in that case

Bug: https://bugs.gentoo.org/687982
Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest  | 21 ++---
 tests/qmanifest/manifest01.good |  8 
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 525dc8b..0770ed1 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -42,15 +42,11 @@ test 04 1 "qmanifest -d not_a_tree"
 # overlay test
 test 05 1 "qmanifest -o notatree"
 
-# Travis uses old Ubuntu, and Ubuntu uses prehistoric gpg, which just
-# won't work.  Too bad, really.
-if [[ ${TRAVIS_OS_NAME} != linux ]] ; then
-
 # generate a valid tree
 rm -Rf testtree
 cp -r "${ROOT}/simpletree" testtree || echo try it anyway
-export HOME=$(mktemp -d)  # for gnupg home
-mkdir "${HOME}"/.gnupg
+export HOME=${PWD}  # for gpgme/gnupg home
+mkdir -p "${HOME}"/.gnupg
 # silence gpg warnings
 chmod -R og-rwx "${HOME}"/.gnupg
 
@@ -68,8 +64,12 @@ gpg_import() {
 
echo "${pass}" | gpg "${args[@]}"
 }
-# import key
-gpg_import "${as}"/key.gpg qmanifest
+# import key, if this fails, skip the test, couple of reasons why this
+# could fail:
+# - Ubuntu uses old/ancient gnupg which doesn't grok arguments and key (Travis)
+# - HOME (T) may be too long to hold a socket, especially on Linux this
+#   pathlength is very short, Portage's T may be too long by default
+if gpg_import "${as}"/key.gpg qmanifest ; then
 
 # make it a fully valid tree
 rm testtree/my-cat/mypackage/unrecorded-file
@@ -85,11 +85,10 @@ test 06 0 "echo ${KEYPASS} | qmanifest -g -s ${SIGNAS} -p 
testtree"
 rm -f gpgme.log
 test 07 0 "qmanifest testtree | sed -e '/Manifest timestamp/d' -e 's/made .* 
UTC by/made by/'"
 
+fi  # gpgimport
+
 # shut down agents and whatnot
 gpgconf --kill all
-rm -Rf "${HOME}"
-
-fi  # TRAVIS_OS_NAME==Linux
 
 cleantmpdir
 

diff --git a/tests/qmanifest/manifest01.good b/tests/qmanifest/manifest01.good
index a9a087a..f97cced 100644
--- a/tests/qmanifest/manifest01.good
+++ b/tests/qmanifest/manifest01.good
@@ -8,12 +8,12 @@ my-cat/mypackage/Manifest::mypackage-1.ebuild:
   expected: 237
 my-cat/mypackage/Manifest::mypackage-2.ebuild:
 - BLAKE2B hash mismatch
-  computed: 
'2bcad0952735a0a5bf631fe1c65b...ea81babd2a90f3076daa1e6e62ecf042a0b'
-  Manifest: 
'2410d545e7441e6402c32ca3ce7e...9fb575bd6f74e7cd92e125181af722500a3'
+  computed: 
'2bcad0952735a0a5bf631fe1c65bc6eb96eb5511f52850e55a8ad9b80480a37ea4a4b01fc6f4f7ccd94942536be3cea81babd2a90f3076daa1e6e62ecf042a0b'
+  Manifest: 
'2410d545e7441e6402c32ca3ce7e80d6eda82306db1c7d9732ed35d273a20f0983a4a40b02492fbad4145cc776f249fb575bd6f74e7cd92e125181af722500a3'
 my-cat/mypackage/Manifest::mypackage-2.ebuild:
 - SHA512 hash mismatch
-  computed: 
'baf9a3bf09b590997d77db13d171...548c3403ac9b2dc22cb78a3112305a68889'
-  Manifest: 
'b22f73bd10773a7b01456a237b52...62307fba13d8b04988c5aeb417f2e286d61'
+  computed: 
'baf9a3bf09b590997d77db13d171e9b104e8acd3687b5be9a8734f0d4680bc4c34f5d0612ba11c6f5d2d34e9b659f548c3403ac9b2dc22cb78a3112305a68889'
+  Manifest: 
'b22f73bd10773a7b01456a237b5224226c4178cc0755d0e84c8b8597071683b148f3b9f56d8b5c7fb8e58f7e618fd62307fba13d8b04988c5aeb417f2e286d61'
 my-cat/mypackage/Manifest::mypackage-3.ebuild:
 - DATA file listed in Manifest, but not found
 my-cat/mypackage/Manifest:



[gentoo-commits] proj/portage-utils:master commit in: tests/quse/

2019-06-10 Thread Fabian Groffen
commit: f9688c8c486dfa387d9f29f8192488f9a3b7cf14
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Jun 10 16:16:47 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Jun 10 16:16:47 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f9688c8c

tests/quse: really need a recent bash

Use bash from Prefix, if possible, it's most likely more up-to-date.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/quse/dotest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/quse/dotest b/tests/quse/dotest
index ed0511d..850f393 100755
--- a/tests/quse/dotest
+++ b/tests/quse/dotest
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 . ../init.sh || exit 1
 



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/

2019-06-10 Thread Fabian Groffen
commit: baeb01a45cc4855f86e3ae4028b8c94f5a2d5364
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Jun 10 14:03:12 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Jun 10 14:03:12 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=baeb01a4

tests/qmerge: fix vdb path

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmerge/dotest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 17187f9..83cb991 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -71,7 +71,7 @@ tend $? "qmerge-test: [C] pkg_* order of execution" || printf 
'%s\n' "${order}"
 [[ ! -x ${ROOT}/usr/bin/qmerge-test && \
  -f ${ROOT}/etc/some.conf && \
! -f ${ROOT}/etc/another.conf && \
-   ! -d ${ROOT}/var/pkg/db/sys-devel ]]
+   ! -d ${ROOT}/var/db/pkg/sys-devel ]]
 tend $? "qmerge-test: [C] uninstalled expected files" || treedir "${ROOT}"
 
 set -e



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/

2019-06-10 Thread Fabian Groffen
commit: 503044450b77a64949bb15d65d4d5ecfc2b3c2d0
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Jun 10 12:29:47 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Jun 10 12:29:47 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=50304445

buildsys: regenerate

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmerge/Makefile.in | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/tests/qmerge/Makefile.in b/tests/qmerge/Makefile.in
index 274a0fe..4dc 100644
--- a/tests/qmerge/Makefile.in
+++ b/tests/qmerge/Makefile.in
@@ -1395,8 +1395,6 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 this_subdir = tests/qmerge
 s = $(abs_top_srcdir)/$(this_subdir)
-PKGDIR = $(s)/packages
-PACKAGES = $(PKGDIR)/Packages
 all: all-am
 
 .SUFFIXES:
@@ -1594,14 +1592,9 @@ uninstall-am:
 .PRECIOUS: Makefile
 
 
-check-local: $(PACKAGES)
+check-local:
$(Q)$(s)/dotest
 
-# Ignore failures to pass tests on non-Gentoo hosts.
-# Hopefully we don't hit real failures on Gentoo systems ...
-$(PACKAGES): $(wildcard $(PKGDIR)/*/*.tbz2)
-   PKGDIR=$(PKGDIR) emaint binhost -f || :
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/

2019-06-10 Thread Fabian Groffen
commit: 96e0ade61c8f7549f5b3e301e1d4a54b66761bd1
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Jun 10 12:29:21 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Jun 10 12:29:21 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=96e0ade6

tests/qmerge: drop unnecessary emaint call

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmerge/Makefile.am | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/tests/qmerge/Makefile.am b/tests/qmerge/Makefile.am
index 62ca5d2..bbf462f 100644
--- a/tests/qmerge/Makefile.am
+++ b/tests/qmerge/Makefile.am
@@ -1,13 +1,5 @@
 this_subdir = tests/qmerge
 s = $(abs_top_srcdir)/$(this_subdir)
 
-PKGDIR = $(s)/packages
-PACKAGES = $(PKGDIR)/Packages
-
-check-local: $(PACKAGES)
+check-local:
$(Q)$(s)/dotest
-
-# Ignore failures to pass tests on non-Gentoo hosts.
-# Hopefully we don't hit real failures on Gentoo systems ...
-$(PACKAGES): $(wildcard $(PKGDIR)/*/*.tbz2)
-   PKGDIR=$(PKGDIR) emaint binhost -f || :



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/

2019-06-10 Thread Fabian Groffen
commit: 317a31dfc1519d8baa10bca736f719faa83692b8
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Jun 10 10:05:12 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Jun 10 10:05:12 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=317a31df

tests/qmerge: drop restriction on Gentoo system

define VDB path such that qmerge tests can run successfully anywhere,
most notably by Travis, so we don't silently get breakage

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmerge/dotest | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 57e2940..17187f9 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -1,11 +1,5 @@
 #!/bin/bash
 
-# TODO: Make these work with local vdb instead of requiring /.
-if [[ -n ${TRAVIS_OS_NAME} ]] ; then
-   echo "TODO: Make it work on non-Gentoo system"
-   exit 0
-fi
-
 . ../init.sh || exit 1
 
 set -e
@@ -14,14 +8,11 @@ export QMERGE=1
 export PKGDIR=${as}/packages
 export FEATURES='config-protect-if-modified'
 
-if [[ ! -e ${PKGDIR}/Packages ]] ; then
-   emaint binhost -f
-fi
-
 mktmpdir
 
 export ROOT=${PWD}/root
 export PORTAGE_TMPDIR=${PWD}
+export Q_VDB=/var/db/pkg
 
 mkdir -p "${ROOT}/var/db/pkg"
 



[gentoo-commits] proj/portage-utils:master commit in: tests/

2019-06-10 Thread Fabian Groffen
commit: f45d8de0bc9d477dce9b3ae7a0d958e089307473
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Jun 10 09:58:25 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Jun 10 09:58:25 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f45d8de0

tests: allow tmpdir to reside in a place defined by Q_TMPDIR

when using NFS or something like that, using local storage iso builddir
is nice, because of speed but more because also not all operations are
allowed on network shares, so using this in some scenarios allows to
pass the tests

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/init.sh.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/init.sh.in b/tests/init.sh.in
index c031ae3..875e2af 100644
--- a/tests/init.sh.in
+++ b/tests/init.sh.in
@@ -68,7 +68,7 @@ end() {
 }
 
 mktmpdir() {
-   local d=${1:-${ab}/tmp}
+   local d=${1:-${Q_TMPDIR:-${ab}}/q-tmp}
rm -rf "$d" && \
mkdir -p "$d" && \
pushd "$d" >/dev/null \
@@ -76,7 +76,7 @@ mktmpdir() {
 }
 _cleantmpdir() {
local cmd=$1; shift
-   local d=${1:-${ab}/tmp}
+   local d=${1:-${Q_TMPDIR:-${ab}}/q-tmp}
popd >/dev/null
${cmd} "${d}" || fail "could not clean tmp dir '$d'"
 }



[gentoo-commits] proj/portage-utils:master commit in: tests/atom_explode/

2019-06-10 Thread Fabian Groffen
commit: 555eff4c66aad27a02fbf8edffa0820d2bdbdfb6
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Jun  9 18:20:20 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Jun  9 18:20:20 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=555eff4c

tests/atom_explode: don't use Portage install

relying on actual data can reveal all kinds of problems which may be
unrelated to atom parsing

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/atom_explode/dotest | 31 ---
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/tests/atom_explode/dotest b/tests/atom_explode/dotest
index f47d44f..8302529 100755
--- a/tests/atom_explode/dotest
+++ b/tests/atom_explode/dotest
@@ -2,34 +2,19 @@
 
 . ../init.sh || exit 1
 
-PORTDIR=$(DEBUG=: q -Ch 2>&1 | grep ^PORTDIR | awk '{print $NF}')
-if [[ -z ${TRAVIS_OS_NAME} && -d "${PORTDIR}"/metadata/md5-cache ]] &&
-   "$s"/atom-explode.py < /dev/null >& /dev/null ;
-then
-   pushd "${PORTDIR}"/metadata/md5-cache >/dev/null || exit $?
-
-   if [[ $1 == -v ]] ; then
-   find . -mindepth 2 -type f -printf '%P\n%f\n' | while read line 
; do
-   echo "TESTING $line: "
-   "$b"/e "${line}"
-   done
-   exit 0
-   fi
-
-   # split the disk i/o out so both tests are CPU bound only
-   files=$(find . -mindepth 2 -type f ! -name "Manifest.*" -printf 
'%P\n%f\n')
-   popd >/dev/null
-else
-   files=$(xzcat ebuildlist.xz)
-fi
+files=$(xzcat ebuildlist.xz)
 
 printf "atom_explode():"
 time echo "${files}" | "$b"/e > "$b"/me || exit $?
 echo
 
-printf "portage:"
-time echo "${files}" | "$s"/atom-explode.py > "$b"/py || xzcat portageatoms.xz 
> "$b"/py
-echo
+if [[ -n ${QATOM_COMPARE_TO_PORTAGE} ]] ; then
+   printf "portage:"
+   time echo "${files}" | "$s"/atom-explode.py > "$b"/py
+   echo
+else
+   xzcat portageatoms.xz > "$b"/py
+fi
 
 diff -U 0 "$b"/me "$b"/py
 tend $? "portage-utils vs portage atom parsing"



[gentoo-commits] proj/portage-utils:master commit in: tests/rmspace/, tests/qdepends/, tests/mkdir/, tests/profile/, ...

2019-06-08 Thread Fabian Groffen
commit: c6d4f9e54776fafbb89df79b8a1ee489d8592cab
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat Jun  8 18:13:14 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat Jun  8 18:13:14 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c6d4f9e5

buildsys: regenerate with automake-1.16.1

Signed-off-by: Fabian Groffen  gentoo.org>

 Makefile.in| 195 +--
 ar-lib |   4 +-
 autotools/gnulib/Makefile.in   | 527 +++--
 autotools/m4/libtool.m4|   2 +-
 compile|   8 +-
 configure  | 193 +++
 depcomp|   8 +-
 install-sh |  34 ++-
 libq/Makefile.in   | 157 
 missing|  14 +-
 tests/Makefile.in  |  15 +-
 tests/atom_compare/Makefile.in |  13 +-
 tests/atom_explode/Makefile.in |  49 ++--
 tests/copy_file/Makefile.in|  54 +++--
 tests/install/Makefile.in  |  13 +-
 tests/mkdir/Makefile.in|  54 +++--
 tests/profile/Makefile.in  |  13 +-
 tests/qatom/Makefile.in|  13 +-
 tests/qatom/dotest |   2 +-
 tests/qcheck/Makefile.in   |  13 +-
 tests/qdepends/Makefile.in |  13 +-
 tests/qfile/Makefile.in|  13 +-
 tests/qlist/Makefile.in|  13 +-
 tests/qlop/Makefile.in |  13 +-
 tests/qmanifest/Makefile.in|  13 +-
 tests/qmerge/Makefile.in   |  13 +-
 tests/qtbz2/Makefile.in|  13 +-
 tests/quse/Makefile.in |  13 +-
 tests/qxpak/Makefile.in|  13 +-
 tests/rmspace/Makefile.in  |  54 +++--
 tests/source/Makefile.in   |  13 +-
 31 files changed, 1032 insertions(+), 533 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index c5fd207..15b2a2f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
 
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -90,8 +90,15 @@ build_triplet = @build@
 host_triplet = @host@
 bin_PROGRAMS = q$(EXEEXT)
 @QMANIFEST_ENABLED_TRUE@am__append_1 = qmanifest.c
-@QMANIFEST_ENABLED_TRUE@am__append_2 = man/qmanifest.1
-@QMANIFEST_ENABLED_TRUE@am__append_3 = qmanifest
+@QMANIFEST_ENABLED_TRUE@am__append_2 = \
+@QMANIFEST_ENABLED_TRUE@   $(OPENMP_CFLAGS) \
+@QMANIFEST_ENABLED_TRUE@   $(GPGME_CFLAGS)
+
+@QMANIFEST_ENABLED_TRUE@am__append_3 = \
+@QMANIFEST_ENABLED_TRUE@   $(OPENMP_CFLAGS)
+
+@QMANIFEST_ENABLED_TRUE@am__append_4 = man/qmanifest.1
+@QMANIFEST_ENABLED_TRUE@am__append_5 = qmanifest
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/autotools/m4/00gnulib.m4 \
@@ -261,11 +268,13 @@ am_q_OBJECTS = q-main.$(OBJEXT) q-q.$(OBJEXT) 
q-qatom.$(OBJEXT) \
$(am__objects_1)
 q_OBJECTS = $(am_q_OBJECTS)
 am__DEPENDENCIES_1 =
-q_DEPENDENCIES = $(am__DEPENDENCIES_1) $(top_builddir)/libq/libq.la \
+@QMANIFEST_ENABLED_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+q_DEPENDENCIES = $(top_builddir)/libq/libq.la \
$(top_builddir)/autotools/gnulib/libgnu.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_2)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
 am__v_lt_0 = --silent
@@ -284,7 +293,17 @@ am__v_at_0 = @
 am__v_at_1 = 
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/q-main.Po ./$(DEPDIR)/q-q.Po \
+   ./$(DEPDIR)/q-qatom.Po ./$(DEPDIR)/q-qcheck.Po \
+   ./$(DEPDIR)/q-qdepends.Po ./$(DEPDIR)/q-qfile.Po \
+   ./$(DEPDIR)/q-qgrep.Po ./$(DEPDIR)/q-qkeyword.Po \
+   ./$(DEPDIR)/q-qlist.Po ./$(DEPDIR)/q-qlop.Po \
+   ./$(DEPDIR)/q-qmanifest.Po ./$(DEPDIR)/q-qmerge.Po \
+   ./$(DEPDIR)/q-qpkg.Po ./$(DEPDIR)/q-qsearch.Po \
+   ./$(DEPDIR)/q-qsize.Po ./$(DEPDIR)/q-qtbz2.Po \
+   ./$(DEPDIR)/q-qtegrity.Po ./$(DEPDIR)/q-quse.Po \
+   ./$(DEPDIR)/q-qxpak.Po
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -356,7 +375,7 @@ am__recursive_targets = \
   $(RECURSIVE_CLEAN_TARGETS) \
   $(am__extra_recursive_targets)
 AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
-   cscope distdir dist dist-all distcheck
+   cscope distdir distdir-am dist dist-all distcheck
 am__tagged_files = $(HEADERS) $(SOURCES) 

[gentoo-commits] proj/portage-utils:master commit in: tests/qfile/root/app-shells/bash-4.4_p23-r1/, tests/qfile/, ...

2019-05-30 Thread Fabian Groffen
commit: 3f0f9750f9dbe8a2e5680926de445f1ae417775f
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu May 30 08:53:22 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu May 30 08:55:12 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=3f0f9750

tests/qfile: lift non-Gentoo system restriction

Use a local (dummy) VDB to provide the bash qfile query input.  This
allows Travis to run the tests, as well as to be indifferent to host
setup of the system being tested.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qfile/dotest |  13 +-
 .../root/app-shells/bash-4.4_p23-r1/BUILD_TIME |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/CATEGORY |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/CBUILD |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/CFLAGS |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/CHOST  |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/CONTENTS | 153 
 .../qfile/root/app-shells/bash-4.4_p23-r1/COUNTER  |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/CXXFLAGS |   1 +
 .../root/app-shells/bash-4.4_p23-r1/DEFINED_PHASES |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/DEPEND |   1 +
 .../root/app-shells/bash-4.4_p23-r1/DESCRIPTION|   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/EAPI   |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/FEATURES |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/HOMEPAGE |   1 +
 .../root/app-shells/bash-4.4_p23-r1/INHERITED  |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/IUSE   |   1 +
 .../root/app-shells/bash-4.4_p23-r1/IUSE_EFFECTIVE |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/KEYWORDS |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/LDFLAGS  |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/LICENSE  |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/NEEDED |   1 +
 .../root/app-shells/bash-4.4_p23-r1/NEEDED.ELF.2   |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/PF |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/RDEPEND  |   1 +
 .../qfile/root/app-shells/bash-4.4_p23-r1/REQUIRES |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/SIZE   |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/SLOT   |   1 +
 tests/qfile/root/app-shells/bash-4.4_p23-r1/USE|   1 +
 .../bash-4.4_p23-r1/bash-4.4_p23-r1.ebuild | 260 +
 .../root/app-shells/bash-4.4_p23-r1/repository |   1 +
 tests/qfile/root/bin/bash  |   0
 32 files changed, 446 insertions(+), 8 deletions(-)

diff --git a/tests/qfile/dotest b/tests/qfile/dotest
index a9d1c55..7769a51 100755
--- a/tests/qfile/dotest
+++ b/tests/qfile/dotest
@@ -1,13 +1,10 @@
 #!/bin/bash
 
-# TODO: Make these work with local vdb instead of requiring /.
-if [[ -n ${TRAVIS_OS_NAME} ]] ; then
-   echo "TODO: Make it work on non-Gentoo system"
-   exit 0
-fi
-
 . ../init.sh || exit 1
 
+export ROOT=${as}/root
+export Q_VDB=/
+
 tests=(
"q file -Cq /bin/bash /bin/X"
"app-shells/bash"
@@ -27,10 +24,10 @@ tests=(
"q file -Co -x app-shells/bash:0 /bin/bash"
"/bin/bash"
 
-   "(cd /bin; q file -Cq bash)"
+   "(cd ${ROOT}/bin; q file -RCq bash)"
"app-shells/bash"
 
-   "(cd /; q file -Co whatever)"
+   "(cd ${ROOT}/; q file -Co whatever)"
"whatever"
 )
 

diff --git a/tests/qfile/root/app-shells/bash-4.4_p23-r1/BUILD_TIME 
b/tests/qfile/root/app-shells/bash-4.4_p23-r1/BUILD_TIME
new file mode 100644
index 000..9b6c3b8
--- /dev/null
+++ b/tests/qfile/root/app-shells/bash-4.4_p23-r1/BUILD_TIME
@@ -0,0 +1 @@
+1547713708

diff --git a/tests/qfile/root/app-shells/bash-4.4_p23-r1/CATEGORY 
b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CATEGORY
new file mode 100644
index 000..23665dc
--- /dev/null
+++ b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CATEGORY
@@ -0,0 +1 @@
+app-shells

diff --git a/tests/qfile/root/app-shells/bash-4.4_p23-r1/CBUILD 
b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CBUILD
new file mode 100644
index 000..f733b5f
--- /dev/null
+++ b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CBUILD
@@ -0,0 +1 @@
+x86_64-pc-linux-gnu

diff --git a/tests/qfile/root/app-shells/bash-4.4_p23-r1/CFLAGS 
b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CFLAGS
new file mode 100644
index 000..38b744e
--- /dev/null
+++ b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CFLAGS
@@ -0,0 +1 @@
+-O3 -march=native -pipe

diff --git a/tests/qfile/root/app-shells/bash-4.4_p23-r1/CHOST 
b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CHOST
new file mode 100644
index 000..f733b5f
--- /dev/null
+++ b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CHOST
@@ -0,0 +1 @@
+x86_64-pc-linux-gnu

diff --git a/tests/qfile/root/app-shells/bash-4.4_p23-r1/CONTENTS 
b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CONTENTS
new file mode 100644
index 000..76fe036
--- /dev/null
+++ b/tests/qfile/root/app-shells/bash-4.4_p23-r1/CONTENTS
@@ -0,0 +1,153 @@
+dir /usr

[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-05-25 Thread Fabian Groffen
commit: f75ba72b67be73d847a8937e3cd4bdbf3e4777f4
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 17:05:30 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 17:05:30 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f75ba72b

tests/qmanifest: TRAVIS_OS_NAME != $(uname)

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index fcb5bf0..525dc8b 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -44,7 +44,7 @@ test 05 1 "qmanifest -o notatree"
 
 # Travis uses old Ubuntu, and Ubuntu uses prehistoric gpg, which just
 # won't work.  Too bad, really.
-if [[ ${TRAVIS_OS_NAME} != Linux ]] ; then
+if [[ ${TRAVIS_OS_NAME} != linux ]] ; then
 
 # generate a valid tree
 rm -Rf testtree



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-05-25 Thread Fabian Groffen
commit: 5b2115597e4143cea0eef2aa7b3a062ddb122073
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 16:57:38 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 16:57:38 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5b211559

tests/qmanifest: give up on Travis

Debuntu is just t old.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 9587141..fcb5bf0 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -42,6 +42,10 @@ test 04 1 "qmanifest -d not_a_tree"
 # overlay test
 test 05 1 "qmanifest -o notatree"
 
+# Travis uses old Ubuntu, and Ubuntu uses prehistoric gpg, which just
+# won't work.  Too bad, really.
+if [[ ${TRAVIS_OS_NAME} != Linux ]] ; then
+
 # generate a valid tree
 rm -Rf testtree
 cp -r "${ROOT}/simpletree" testtree || echo try it anyway
@@ -58,16 +62,11 @@ gpg_import() {
--quiet
--no-tty
--passphrase-fd 0
+   --pinentry-mode loopback
--import "${key}"
)
-   local killpinentry="--pinentry-mode loopback"
 
-   # see if gpg is new enough for killpinentry
-   if echo "${pass}" | gpg -n ${killpinentry} "${args[@]}" ; then
-   echo "${pass}" | gpg ${killpinentry} "${args[@]}"
-   else
-   echo "${pass}" | gpg "${args[@]}"
-   fi
+   echo "${pass}" | gpg "${args[@]}"
 }
 # import key
 gpg_import "${as}"/key.gpg qmanifest
@@ -90,6 +89,8 @@ test 07 0 "qmanifest testtree | sed -e '/Manifest 
timestamp/d' -e 's/made .* UTC
 gpgconf --kill all
 rm -Rf "${HOME}"
 
+fi  # TRAVIS_OS_NAME==Linux
+
 cleantmpdir
 
 end



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-05-25 Thread Fabian Groffen
commit: f221763fa8d77019f9ef033002ed04eacfef0493
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 15:58:26 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 15:58:26 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f221763f

tests/qmanifest: skip sanity check

old gpg output is vastly different and cannot be patched up, so skip it

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest  | 3 +--
 tests/qmanifest/manifestp6.good | 5 -
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index abab463..9587141 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -69,9 +69,8 @@ gpg_import() {
echo "${pass}" | gpg "${args[@]}"
fi
 }
-# import key and sanity check
+# import key
 gpg_import "${as}"/key.gpg qmanifest
-test p6 0 "gpg --list-keys | sed '1,2d'"
 
 # make it a fully valid tree
 rm testtree/my-cat/mypackage/unrecorded-file

diff --git a/tests/qmanifest/manifestp6.good b/tests/qmanifest/manifestp6.good
deleted file mode 100644
index ece3fa7..000
--- a/tests/qmanifest/manifestp6.good
+++ /dev/null
@@ -1,5 +0,0 @@
-pub   rsa2048 2019-05-24 [SC]
-  3D695C8C0F87966B62DC5AFCDCFABA8E07F52261
-uid   [ unknown] Qmanifest Test Key
-sub   rsa2048 2019-05-24 [E]
-



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-05-25 Thread Fabian Groffen
commit: a6267f74a20233bd45161370558ce0a11b47dca8
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 15:55:12 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 15:55:12 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=a6267f74

tests/qmanifest: forgot about set -e, work around it

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index a6b1431..abab463 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -63,11 +63,10 @@ gpg_import() {
local killpinentry="--pinentry-mode loopback"
 
# see if gpg is new enough for killpinentry
-   echo "${pass}" | gpg -n ${killpinentry} "${args[@]}"
-   if [[ $? -ne 0 ]] ; then
-   echo "${pass}" | gpg "${args[@]}"
-   else
+   if echo "${pass}" | gpg -n ${killpinentry} "${args[@]}" ; then
echo "${pass}" | gpg ${killpinentry} "${args[@]}"
+   else
+   echo "${pass}" | gpg "${args[@]}"
fi
 }
 # import key and sanity check



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-05-25 Thread Fabian Groffen
commit: 25accafd2e792b338dd9bc2cbeb5fdd3232062a1
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 15:51:29 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 15:51:29 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=25accafd

tests/qmanifest: try and work with old gpg

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 549223b..a6b1431 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -50,14 +50,28 @@ mkdir "${HOME}"/.gnupg
 # silence gpg warnings
 chmod -R og-rwx "${HOME}"/.gnupg
 
+gpg_import() {
+   local key=$1
+   local pass=$2
+   local args=(
+   --batch
+   --quiet
+   --no-tty
+   --passphrase-fd 0
+   --import "${key}"
+   )
+   local killpinentry="--pinentry-mode loopback"
+
+   # see if gpg is new enough for killpinentry
+   echo "${pass}" | gpg -n ${killpinentry} "${args[@]}"
+   if [[ $? -ne 0 ]] ; then
+   echo "${pass}" | gpg "${args[@]}"
+   else
+   echo "${pass}" | gpg ${killpinentry} "${args[@]}"
+   fi
+}
 # import key and sanity check
-echo qmanifest | gpg \
-   --batch \
-   --quiet \
-   --no-tty \
-   --passphrase-fd 0 \
-   --pinentry-mode loopback \
-   --import "${as}"/key.gpg
+gpg_import "${as}"/key.gpg qmanifest
 test p6 0 "gpg --list-keys | sed '1,2d'"
 
 # make it a fully valid tree



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/root/.gnupg/private-keys-v1.d/, tests/qmanifest/, ...

2019-05-25 Thread Fabian Groffen
commit: 06d6dd34b03439b7b85938f2da655c42884fe72e
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 15:34:51 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 15:34:51 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=06d6dd34

tests/qmanifest: switch to reconstructing gpg keyring

debuntu/travis apparently comes with a prehistoric version of gpg, so
let's see if the key format is compatible.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest   |  11 +--
 tests/qmanifest/key.gpg  | Bin 0 -> 2607 bytes
 tests/qmanifest/manifestp6.good  |   2 +-
 .../1F0A2C7F1E80A6EEEA3B9C30068FB3349702B3A7.key | Bin 1171 -> 0 bytes
 .../E37F9F3C8E4A940C625EC65B7070255F4AAA55F9.key | Bin 1155 -> 0 bytes
 tests/qmanifest/root/.gnupg/pubring.kbx  | Bin 1435 -> 0 bytes
 tests/qmanifest/root/.gnupg/random_seed  | Bin 600 -> 0 bytes
 tests/qmanifest/root/.gnupg/trustdb.gpg  | Bin 1280 -> 0 bytes
 8 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 177a913..549223b 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -46,11 +46,18 @@ test 05 1 "qmanifest -o notatree"
 rm -Rf testtree
 cp -r "${ROOT}/simpletree" testtree || echo try it anyway
 export HOME=$(mktemp -d)  # for gnupg home
-cp -r "${ROOT}/.gnupg" "${HOME}/"
+mkdir "${HOME}"/.gnupg
 # silence gpg warnings
 chmod -R og-rwx "${HOME}"/.gnupg
 
-# sanity check
+# import key and sanity check
+echo qmanifest | gpg \
+   --batch \
+   --quiet \
+   --no-tty \
+   --passphrase-fd 0 \
+   --pinentry-mode loopback \
+   --import "${as}"/key.gpg
 test p6 0 "gpg --list-keys | sed '1,2d'"
 
 # make it a fully valid tree

diff --git a/tests/qmanifest/key.gpg b/tests/qmanifest/key.gpg
new file mode 100644
index 000..e178118
Binary files /dev/null and b/tests/qmanifest/key.gpg differ

diff --git a/tests/qmanifest/manifestp6.good b/tests/qmanifest/manifestp6.good
index 6a392a3..ece3fa7 100644
--- a/tests/qmanifest/manifestp6.good
+++ b/tests/qmanifest/manifestp6.good
@@ -1,5 +1,5 @@
 pub   rsa2048 2019-05-24 [SC]
   3D695C8C0F87966B62DC5AFCDCFABA8E07F52261
-uid   [ultimate] Qmanifest Test Key
+uid   [ unknown] Qmanifest Test Key
 sub   rsa2048 2019-05-24 [E]
 

diff --git 
a/tests/qmanifest/root/.gnupg/private-keys-v1.d/1F0A2C7F1E80A6EEEA3B9C30068FB3349702B3A7.key
 
b/tests/qmanifest/root/.gnupg/private-keys-v1.d/1F0A2C7F1E80A6EEEA3B9C30068FB3349702B3A7.key
deleted file mode 100644
index b4ed767..000
Binary files 
a/tests/qmanifest/root/.gnupg/private-keys-v1.d/1F0A2C7F1E80A6EEEA3B9C30068FB3349702B3A7.key
 and /dev/null differ

diff --git 
a/tests/qmanifest/root/.gnupg/private-keys-v1.d/E37F9F3C8E4A940C625EC65B7070255F4AAA55F9.key
 
b/tests/qmanifest/root/.gnupg/private-keys-v1.d/E37F9F3C8E4A940C625EC65B7070255F4AAA55F9.key
deleted file mode 100644
index 4b07401..000
Binary files 
a/tests/qmanifest/root/.gnupg/private-keys-v1.d/E37F9F3C8E4A940C625EC65B7070255F4AAA55F9.key
 and /dev/null differ

diff --git a/tests/qmanifest/root/.gnupg/pubring.kbx 
b/tests/qmanifest/root/.gnupg/pubring.kbx
deleted file mode 100644
index 848dc93..000
Binary files a/tests/qmanifest/root/.gnupg/pubring.kbx and /dev/null differ

diff --git a/tests/qmanifest/root/.gnupg/random_seed 
b/tests/qmanifest/root/.gnupg/random_seed
deleted file mode 100644
index 5da25bd..000
Binary files a/tests/qmanifest/root/.gnupg/random_seed and /dev/null differ

diff --git a/tests/qmanifest/root/.gnupg/trustdb.gpg 
b/tests/qmanifest/root/.gnupg/trustdb.gpg
deleted file mode 100644
index 78308c6..000
Binary files a/tests/qmanifest/root/.gnupg/trustdb.gpg and /dev/null differ



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-05-25 Thread Fabian Groffen
commit: 4551aa7c34b13bf71359d288cd2bee39eed61590
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 14:24:16 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 14:24:16 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4551aa7c

tests/qmanifest: attempt to verify gpg setup

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest  | 4 
 tests/qmanifest/manifestp6.good | 5 +
 2 files changed, 9 insertions(+)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index c248cae..177a913 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -49,6 +49,10 @@ export HOME=$(mktemp -d)  # for gnupg home
 cp -r "${ROOT}/.gnupg" "${HOME}/"
 # silence gpg warnings
 chmod -R og-rwx "${HOME}"/.gnupg
+
+# sanity check
+test p6 0 "gpg --list-keys | sed '1,2d'"
+
 # make it a fully valid tree
 rm testtree/my-cat/mypackage/unrecorded-file
 # drop ROOT, we'll work here in T

diff --git a/tests/qmanifest/manifestp6.good b/tests/qmanifest/manifestp6.good
new file mode 100644
index 000..6a392a3
--- /dev/null
+++ b/tests/qmanifest/manifestp6.good
@@ -0,0 +1,5 @@
+pub   rsa2048 2019-05-24 [SC]
+  3D695C8C0F87966B62DC5AFCDCFABA8E07F52261
+uid   [ultimate] Qmanifest Test Key
+sub   rsa2048 2019-05-24 [E]
+



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-05-25 Thread Fabian Groffen
commit: 63b9c1b3a7d0c5420f46a7ff31bf478d3fd3cbc1
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 13:49:30 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 13:49:30 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=63b9c1b3

tests/qmanifest: enable GPGME debugging for Travis

 tests/qmanifest/dotest | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 4e8c66f..c248cae 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -16,6 +16,7 @@ test() {
sed -i -e '/^checked [0-9]/s/ in [0-9.]\+s$//' manifest
if ! diff -u ${as}/manifest${num}.good manifest; then
tfail "output does not match"
+   [[ -e gpgme.log ]] && cat gpgme.log
fi
if [[ ${exp} -ne ${ret} ]] ; then
tfail "exit code (${ret}) does not match expected (${exp}) for 
test ${num}"
@@ -54,9 +55,12 @@ rm testtree/my-cat/mypackage/unrecorded-file
 unset ROOT PORTAGE_CONFIGROOT
 SIGNAS=0x3D695C8C0F87966B62DC5AFCDCFABA8E07F52261
 KEYPASS=qmanifest
+export GPGME_DEBUG=9:${PWD}/gpgme.log
+rm -f gpgme.log
 test 06 0 "echo ${KEYPASS} | qmanifest -g -s ${SIGNAS} -p testtree"
 
 # validate the just generated tree
+rm -f gpgme.log
 test 07 0 "qmanifest testtree | sed -e '/Manifest timestamp/d' -e 's/made .* 
UTC by/made by/'"
 
 # shut down agents and whatnot



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-05-25 Thread Fabian Groffen
commit: b009f6e6e3218e80e79e7e01d21beb52ec09aa89
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 13:15:59 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 13:15:59 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=b009f6e6

tests/qmanifest: silence some gpg warnings about permissions

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index fb2aa22..9d28133 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -44,9 +44,12 @@ test 05 1 "qmanifest -o notatree"
 # generate a valid tree
 rm -Rf testtree
 cp -r "${ROOT}/simpletree" testtree || echo try it anyway
-# make it a fully valid tree
 export HOME=${ROOT}  # for gnupg home
+# silence gpg warnings
+chmod -R og-rwx "${ROOT}"/.gnupg
+# make it a fully valid tree
 rm testtree/my-cat/mypackage/unrecorded-file
+# drop ROOT, we'll work here in T
 unset ROOT PORTAGE_CONFIGROOT
 SIGNAS=0x3D695C8C0F87966B62DC5AFCDCFABA8E07F52261
 KEYPASS=qmanifest



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/

2019-05-25 Thread Fabian Groffen
commit: 5db00ff1e743cc7383849cea9434a7d5df3b80e0
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 13:35:37 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 13:35:37 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5db00ff1

tests/qmanifest: move GNUPG homedir to TMPDIR

Hopefully, TMPDIR is shorter than our T.  gpgme is pretty annoying when
it comes to paths, it often considers a path to be too long, so we need
to keep it to a minimum.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/dotest | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 9d28133..4e8c66f 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -44,9 +44,10 @@ test 05 1 "qmanifest -o notatree"
 # generate a valid tree
 rm -Rf testtree
 cp -r "${ROOT}/simpletree" testtree || echo try it anyway
-export HOME=${ROOT}  # for gnupg home
+export HOME=$(mktemp -d)  # for gnupg home
+cp -r "${ROOT}/.gnupg" "${HOME}/"
 # silence gpg warnings
-chmod -R og-rwx "${ROOT}"/.gnupg
+chmod -R og-rwx "${HOME}"/.gnupg
 # make it a fully valid tree
 rm testtree/my-cat/mypackage/unrecorded-file
 # drop ROOT, we'll work here in T
@@ -60,6 +61,7 @@ test 07 0 "qmanifest testtree | sed -e '/Manifest 
timestamp/d' -e 's/made .* UTC
 
 # shut down agents and whatnot
 gpgconf --kill all
+rm -Rf "${HOME}"
 
 cleantmpdir
 



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/root/notatree/

2019-05-25 Thread Fabian Groffen
commit: cbb1db7ad516bee1ebb3c1dd6796aaf1d2ece329
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 13:00:06 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 13:00:06 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=cbb1db7a

tests/qmanifest: add dummy .keep file to retain dir

qmanifest02 test is about checking an existing path really is a tree,
but git doesn't store directories, only files, so the empty dir notatree
was never kept by git, but existed in my working copy.  Result: the test
worked for me on multiple systems using the same repo, but Travis kept
having problems.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmanifest/root/notatree/.keep | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/tests/qmanifest/root/notatree/.keep 
b/tests/qmanifest/root/notatree/.keep
new file mode 100644
index 000..e69de29



[gentoo-commits] proj/portage-utils:master commit in: tests/qfile/, tests/qmanifest/root/.gnupg/

2019-05-25 Thread Fabian Groffen
commit: 79156b638cd323b3309eaf1a4e23fa9f127a5266
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat May 25 12:18:36 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat May 25 12:18:36 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=79156b63

tests/qfile: fix test to work with new qfile behaviour

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qfile/dotest  |   4 ++--
 tests/qmanifest/root/.gnupg/random_seed | Bin 600 -> 600 bytes
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qfile/dotest b/tests/qfile/dotest
index 8e8d842..a9d1c55 100755
--- a/tests/qfile/dotest
+++ b/tests/qfile/dotest
@@ -30,8 +30,8 @@ tests=(
"(cd /bin; q file -Cq bash)"
"app-shells/bash"
 
-   "(cd /; q file -Co bash)"
-   "bash"
+   "(cd /; q file -Co whatever)"
+   "whatever"
 )
 
 set -- "${tests[@]}"

diff --git a/tests/qmanifest/root/.gnupg/random_seed 
b/tests/qmanifest/root/.gnupg/random_seed
index e0d638e..5da25bd 100644
Binary files a/tests/qmanifest/root/.gnupg/random_seed and 
b/tests/qmanifest/root/.gnupg/random_seed differ



[gentoo-commits] proj/portage-utils:master commit in: /, tests/qmanifest/root/.gnupg/

2019-05-24 Thread Fabian Groffen
commit: 35c252312d61c203deac250e5034aba5f9c706b9
Author: Fabian Groffen  gentoo  org>
AuthorDate: Fri May 24 12:25:24 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Fri May 24 12:25:24 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=35c25231

qmanifest: avoid reading uninitialised memory

this likely fixes the problem Travis found that I cannot repeat here

Signed-off-by: Fabian Groffen  gentoo.org>

 qmanifest.c |   2 ++
 tests/qmanifest/root/.gnupg/random_seed | Bin 600 -> 600 bytes
 2 files changed, 2 insertions(+)

diff --git a/qmanifest.c b/qmanifest.c
index ed203a6..b5bbd79 100644
--- a/qmanifest.c
+++ b/qmanifest.c
@@ -1777,6 +1777,8 @@ qmanifest_main(int argc, char **argv)
} else {
snprintf(path, sizeof(path), "./%s", overlay);
}
+   } else {
+   snprintf(path, sizeof(path), "%s", overlay);
}
 
snprintf(path2, sizeof(path2), "%s%s", portroot, path);

diff --git a/tests/qmanifest/root/.gnupg/random_seed 
b/tests/qmanifest/root/.gnupg/random_seed
index d32d054..e0d638e 100644
Binary files a/tests/qmanifest/root/.gnupg/random_seed and 
b/tests/qmanifest/root/.gnupg/random_seed differ



[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/root/.gnupg/, tests/qmanifest/, /, man/, man/include/, ...

2019-05-24 Thread Fabian Groffen
commit: f1d02fbf01683c42ddb0cdfbfe7815c5ff37e035
Author: Fabian Groffen  gentoo  org>
AuthorDate: Fri May 24 11:58:26 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Fri May 24 11:58:26 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f1d02fbf

qmanifest: allow GPG-signing top-level Manifest

Signed-off-by: Fabian Groffen  gentoo.org>

 man/include/qmanifest-01-generation.include|  17 ++
 man/include/qmanifest.optdesc.yaml |   8 +
 man/qmanifest.1|  30 ++-
 qmanifest.c| 214 -
 tests/qmanifest/dotest |  16 +-
 tests/qmanifest/manifest04.good|   3 +-
 tests/qmanifest/manifest07.good|  11 +-
 .../1F0A2C7F1E80A6EEEA3B9C30068FB3349702B3A7.key   | Bin 0 -> 1171 bytes
 .../E37F9F3C8E4A940C625EC65B7070255F4AAA55F9.key   | Bin 0 -> 1155 bytes
 tests/qmanifest/root/.gnupg/pubring.kbx| Bin 0 -> 1435 bytes
 tests/qmanifest/root/.gnupg/random_seed| Bin 0 -> 600 bytes
 tests/qmanifest/root/.gnupg/trustdb.gpg| Bin 0 -> 1280 bytes
 12 files changed, 233 insertions(+), 66 deletions(-)

diff --git a/man/include/qmanifest-01-generation.include 
b/man/include/qmanifest-01-generation.include
new file mode 100644
index 000..5a24a02
--- /dev/null
+++ b/man/include/qmanifest-01-generation.include
@@ -0,0 +1,17 @@
+.SH "GENERATING A SIGNED TREE"
+.PP
+By default, \fBqmanifest\fR will not try to sign the top-level Manifest
+when it generating thick Manifests.  A tree as such isn't completely
+valid (as it misses the final signature), but still correct.  To sign
+the top-level Manifest, the \fB-s\fR flag needs to be used to provide
+the GPG keyid to sign with.  The passphrase is requested by \fBgpg\fR(1)
+itself, unless the \fB-p\fR flag is given, in which case \fBqmanifest\fR
+attempts to read the passphrase from \fIstdin\fR and then pass that
+passphrase onto \fBgpg\fR.  This is useful for scenarios in which the
+signing of a tree is scripted.
+.PP
+To generate a tree signed by GPG keyid \fI0x123567ABC\fR using
+passphrase \fImypasswd\fR, one could use:
+.nf\fI
+   $ echo mypasswd | qmanifest -g -s 0x123567ABC -p /path/to/tree
+.fi

diff --git a/man/include/qmanifest.optdesc.yaml 
b/man/include/qmanifest.optdesc.yaml
new file mode 100644
index 000..8bf1ce7
--- /dev/null
+++ b/man/include/qmanifest.optdesc.yaml
@@ -0,0 +1,8 @@
+signas: |
+Sign generated Manifest using GPG key.  This key must exist in your
+keyring and be valid for signing.
+passphrase: |
+Ask for GPG key password (instead of relying on gpg-agent).  While
+this option is not very useful compared to gpg's ways of gathering a
+password, it is mainly intended for automated setups where the
+password is piped in using \fIstdin\fR.

diff --git a/man/qmanifest.1 b/man/qmanifest.1
index e223122..15027f6 100644
--- a/man/qmanifest.1
+++ b/man/qmanifest.1
@@ -38,7 +38,17 @@ with the desired maximum amount of threads in use by 
\fIqmanifest\fR.
 .SH OPTIONS
 .TP
 \fB\-g\fR, \fB\-\-generate\fR
-Generate thick Manifests and sign.
+Generate thick Manifests.
+.TP
+\fB\-s\fR \fI\fR, \fB\-\-signas\fR \fI\fR
+Sign generated Manifest using GPG key.  This key must exist in your
+keyring and be valid for signing.
+.TP
+\fB\-p\fR, \fB\-\-passphrase\fR
+Ask for GPG key password (instead of relying on gpg-agent).  While
+this option is not very useful compared to gpg's ways of gathering a
+password, it is mainly intended for automated setups where the
+password is piped in using \fIstdin\fR.
 .TP
 \fB\-d\fR, \fB\-\-dir\fR
 Treat arguments as directories.
@@ -63,7 +73,23 @@ Print this help and exit.
 .TP
 \fB\-V\fR, \fB\-\-version\fR
 Print version and exit.
-
+.SH "GENERATING A SIGNED TREE"
+.PP
+By default, \fBqmanifest\fR will not try to sign the top-level Manifest
+when it generating thick Manifests.  A tree as such isn't completely
+valid (as it misses the final signature), but still correct.  To sign
+the top-level Manifest, the \fB-s\fR flag needs to be used to provide
+the GPG keyid to sign with.  The passphrase is requested by \fBgpg\fR(1)
+itself, unless the \fB-p\fR flag is given, in which case \fBqmanifest\fR
+attempts to read the passphrase from \fIstdin\fR and then pass that
+passphrase onto \fBgpg\fR.  This is useful for scenarios in which the
+signing of a tree is scripted.
+.PP
+To generate a tree signed by GPG keyid \fI0x123567ABC\fR using
+passphrase \fImypasswd\fR, one could use:
+.nf\fI
+   $ echo mypasswd | qmanifest -g -s 0x123567ABC -p /path/to/tree
+.fi
 .SH "REPORTING BUGS"
 Please report bugs via http://bugs.gentoo.org/
 .br

diff --git a/qmanifest.c b/qmanifest.c
index 88352fa..ed203a6 100644
--- a/qmanifest.c
+++ b/qmanifest.c
@@ -39,15 +39,19 @@
 #include "eat_file.h"
 #include "hash.h"
 
-#define QMANIFEST_FLAGS "gdo" COMMON_FLAGS
+#define 

[gentoo-commits] proj/portage-utils:master commit in: /, tests/

2019-05-21 Thread Fabian Groffen
commit: ce44bd0686411b53c1cdfee265b90744a35e2501
Author: Fabian Groffen  gentoo  org>
AuthorDate: Tue May 21 14:11:41 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Tue May 21 14:11:41 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=ce44bd06

build-sys: regenerate

Signed-off-by: Fabian Groffen  gentoo.org>

 Makefile.in   | 119 +-
 TODO.md   |   3 ++
 configure |  17 +++-
 tests/Makefile.in |  13 +++---
 4 files changed, 62 insertions(+), 90 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index eadaa63..c5fd207 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -89,6 +89,9 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 bin_PROGRAMS = q$(EXEEXT)
+@QMANIFEST_ENABLED_TRUE@am__append_1 = qmanifest.c
+@QMANIFEST_ENABLED_TRUE@am__append_2 = man/qmanifest.1
+@QMANIFEST_ENABLED_TRUE@am__append_3 = qmanifest
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/autotools/m4/00gnulib.m4 \
@@ -245,13 +248,17 @@ CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
 PROGRAMS = $(bin_PROGRAMS)
+am__q_SOURCES_DIST = main.c q.c qatom.c qcheck.c qdepends.c qfile.c \
+   qgrep.c qkeyword.c qlist.c qlop.c qmerge.c qpkg.c qsearch.c \
+   qsize.c qtbz2.c qtegrity.c quse.c qxpak.c qmanifest.c
+@QMANIFEST_ENABLED_TRUE@am__objects_1 = q-qmanifest.$(OBJEXT)
 am_q_OBJECTS = q-main.$(OBJEXT) q-q.$(OBJEXT) q-qatom.$(OBJEXT) \
q-qcheck.$(OBJEXT) q-qdepends.$(OBJEXT) q-qfile.$(OBJEXT) \
q-qgrep.$(OBJEXT) q-qkeyword.$(OBJEXT) q-qlist.$(OBJEXT) \
-   q-qlop.$(OBJEXT) q-qmanifest.$(OBJEXT) q-qmerge.$(OBJEXT) \
-   q-qpkg.$(OBJEXT) q-qsearch.$(OBJEXT) q-qsize.$(OBJEXT) \
-   q-qtbz2.$(OBJEXT) q-qtegrity.$(OBJEXT) q-quse.$(OBJEXT) \
-   q-qxpak.$(OBJEXT)
+   q-qlop.$(OBJEXT) q-qmerge.$(OBJEXT) q-qpkg.$(OBJEXT) \
+   q-qsearch.$(OBJEXT) q-qsize.$(OBJEXT) q-qtbz2.$(OBJEXT) \
+   q-qtegrity.$(OBJEXT) q-quse.$(OBJEXT) q-qxpak.$(OBJEXT) \
+   $(am__objects_1)
 q_OBJECTS = $(am_q_OBJECTS)
 am__DEPENDENCIES_1 =
 q_DEPENDENCIES = $(am__DEPENDENCIES_1) $(top_builddir)/libq/libq.la \
@@ -298,7 +305,7 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
 am__v_CCLD_0 = @echo "  CCLD" $@;
 am__v_CCLD_1 = 
 SOURCES = $(q_SOURCES)
-DIST_SOURCES = $(q_SOURCES)
+DIST_SOURCES = $(am__q_SOURCES_DIST)
 RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
@@ -1558,70 +1565,16 @@ SUBDIRS = \
tests \
$(NULL)
 
-APPLETS = \
-   q \
-   qatom \
-   qcheck \
-   qdepends \
-   qfile \
-   qgrep \
-   qkeyword \
-   qlist \
-   qlop \
-   qmanifest \
-   qmerge \
-   qpkg \
-   qsearch \
-   qsize \
-   qtbz2 \
-   qtegrity \
-   quse \
-   qxpak \
-   $(NULL)
-
-dist_man_MANS = \
-   man/q.1 \
-   man/qatom.1 \
-   man/qcheck.1 \
-   man/qdepends.1 \
-   man/qfile.1 \
-   man/qgrep.1 \
-   man/qkeyword.1 \
-   man/qlist.1 \
-   man/qlop.1 \
-   man/qmanifest.1 \
-   man/qmerge.1 \
-   man/qpkg.1 \
-   man/qsearch.1 \
-   man/qsize.1 \
-   man/qtbz2.1 \
-   man/qtegrity.1 \
-   man/quse.1 \
-   man/qxpak.1 \
-   $(NULL)
-
-q_SOURCES = \
-   main.c \
-   q.c \
-   qatom.c \
-   qcheck.c \
-   qdepends.c \
-   qfile.c \
-   qgrep.c \
-   qkeyword.c \
-   qlist.c \
-   qlop.c \
-   qmanifest.c \
-   qmerge.c \
-   qpkg.c \
-   qsearch.c \
-   qsize.c \
-   qtbz2.c \
-   qtegrity.c \
-   quse.c \
-   qxpak.c \
-   $(NULL)
-
+APPLETS = q qatom qcheck qdepends qfile qgrep qkeyword qlist qlop \
+   qmerge qpkg qsearch qsize qtbz2 qtegrity quse qxpak $(NULL) \
+   $(am__append_3)
+dist_man_MANS = man/q.1 man/qatom.1 man/qcheck.1 man/qdepends.1 \
+   man/qfile.1 man/qgrep.1 man/qkeyword.1 man/qlist.1 man/qlop.1 \
+   man/qmerge.1 man/qpkg.1 man/qsearch.1 man/qsize.1 man/qtbz2.1 \
+   man/qtegrity.1 man/quse.1 man/qxpak.1 $(NULL) $(am__append_2)
+q_SOURCES = main.c q.c qatom.c qcheck.c qdepends.c qfile.c qgrep.c \
+   qkeyword.c qlist.c qlop.c qmerge.c qpkg.c qsearch.c qsize.c \
+   qtbz2.c qtegrity.c quse.c qxpak.c $(NULL) $(am__append_1)
 q_CPPFLAGS = \
$(OPENMP_CFLAGS) \
$(GPGME_CFLAGS) \
@@ -1943,20 +1896,6 @@ q-qlop.obj: qlop.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@  DEPDIR=$(DEPDIR) $(CCDEPMODE) 
$(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) 
$(INCLUDES) $(q_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o q-qlop.obj 
`if test -f 'qlop.c'; then $(CYGPATH_W) 'qlop.c'; else 

[gentoo-commits] proj/portage-utils:master commit in: tests/qmanifest/root/simpletree/my-cat/mypackage/, ...

2019-05-21 Thread Fabian Groffen
commit: 41ee2bc0d5792c91bd0d087301c791b067b2d775
Author: Fabian Groffen  gentoo  org>
AuthorDate: Tue May 21 14:10:52 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Tue May 21 14:10:52 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=41ee2bc0

qmanifest: import tests from hashgen repo

Signed-off-by: Fabian Groffen  gentoo.org>

 configure.ac   |1 +
 tests/Makefile.am  |4 +
 tests/qmanifest/Makefile.am|5 +
 tests/qmanifest/Makefile.in| 1597 
 tests/qmanifest/dotest |   55 +
 tests/qmanifest/manifest00.good|2 +
 tests/qmanifest/manifest01.good|   22 +
 tests/qmanifest/manifest02.good|2 +
 tests/qmanifest/manifest03.good|2 +
 tests/qmanifest/manifest04.good|2 +
 tests/qmanifest/manifest05.good|1 +
 tests/qmanifest/manifest06.good|0
 tests/qmanifest/manifest07.good|7 +
 .../root/etc/portage/repos.conf/qtest.conf |8 +
 tests/qmanifest/root/simpletree/Manifest   |2 +
 tests/qmanifest/root/simpletree/Manifest.files.gz  |  Bin 0 -> 437 bytes
 .../qmanifest/root/simpletree/metadata/Manifest.gz |  Bin 0 -> 219 bytes
 .../qmanifest/root/simpletree/metadata/layout.conf |1 +
 tests/qmanifest/root/simpletree/my-cat/Manifest.gz |  Bin 0 -> 231 bytes
 .../root/simpletree/my-cat/mypackage/Manifest  |6 +
 .../root/simpletree/my-cat/mypackage/metadata.xml  |   10 +
 .../simpletree/my-cat/mypackage/mypackage-0.ebuild |   16 +
 .../simpletree/my-cat/mypackage/mypackage-1.ebuild |   18 +
 .../simpletree/my-cat/mypackage/mypackage-2.ebuild |   16 +
 .../simpletree/my-cat/mypackage/unrecorded-file|1 +
 25 files changed, 1778 insertions(+)

diff --git a/configure.ac b/configure.ac
index c0284be..bda5a84 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,6 +150,7 @@ AC_CONFIG_FILES([
tests/qfile/Makefile
tests/qlist/Makefile
tests/qlop/Makefile
+   tests/qmanifest/Makefile
tests/qmerge/Makefile
tests/qtbz2/Makefile
tests/quse/Makefile

diff --git a/tests/Makefile.am b/tests/Makefile.am
index a3c7d45..3a7a00b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,6 +3,10 @@ SUBDIRS = \
qatom qcheck qdepends qfile qlist qlop qmerge qtbz2 quse qxpak \
install profile source
 
+if QMANIFEST_ENABLED
+SUBDIRS += qmanifest
+endif
+
 %_subdir:
$(Q)cd $(@:_subdir=) || exit 1; \
out=`$(MAKE) check 2>&1`; \

diff --git a/tests/qmanifest/Makefile.am b/tests/qmanifest/Makefile.am
new file mode 100644
index 000..bb8191c
--- /dev/null
+++ b/tests/qmanifest/Makefile.am
@@ -0,0 +1,5 @@
+this_subdir = tests/qmanifest
+s = $(abs_top_srcdir)/$(this_subdir)
+
+check-local:
+   $(Q)$(s)/dotest

diff --git a/tests/qmanifest/Makefile.in b/tests/qmanifest/Makefile.in
new file mode 100644
index 000..f32ac63
--- /dev/null
+++ b/tests/qmanifest/Makefile.in
@@ -0,0 +1,1597 @@
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+VPATH = @srcdir@
+am__is_gnu_make = { \
+  if test -z '$(MAKELEVEL)'; then \
+false; \
+  elif test -n '$(MAKE_HOST)'; then \
+true; \
+  elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+true; \
+  else \
+false; \
+  fi; \
+}
+am__make_running_with_option = \
+  case $${target_option-} in \
+  ?) ;; \
+  *) echo "am__make_running_with_option: internal error: invalid" \
+  "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+sane_makeflags=$$MFLAGS; \
+  else \
+case $$MAKEFLAGS in \
+  *\\[\ \  ]*) \
+bs=\\; \
+sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+  | sed "s/$$bs$$bs[$$bs $$bs  ]*//g"`;; \
+esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+test $$skip_next = yes && { skip_next=no; continue; }; \
+case $$flg in \
+  *=*|--*) continue;; \
+-*I) strip_trailopt 'I'; skip_next=yes;; \
+  -*I?*) 

[gentoo-commits] proj/portage-utils:master commit in: tests/profile/, tests/rmspace/, /, tests/quse/, tests/qlist/, tests/qlop/, ...

2019-05-21 Thread Fabian Groffen
commit: d7315a72c1313e5f7ecc3034311f0543800fe8fa
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon May 20 17:55:05 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon May 20 17:55:05 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d7315a72

build-sys: regenerate

Signed-off-by: Fabian Groffen  gentoo.org>

 Makefile.in|  43 ++-
 autotools/gnulib/Makefile.in   |   7 +
 config.h.in|  24 ++
 configure  | 656 ++---
 libq/Makefile.in   |  19 +-
 man/q.1|   9 +-
 man/qatom.1|   1 +
 man/qcheck.1   |   1 +
 man/qdepends.1 |   1 +
 man/qfile.1|   1 +
 man/qgrep.1|   1 +
 man/qkeyword.1 |   1 +
 man/qlist.1|   1 +
 man/qlop.1 |   1 +
 man/qmerge.1   |   1 +
 man/qpkg.1 |   1 +
 man/qsearch.1  |   1 +
 man/qsize.1|   1 +
 man/qtbz2.1|   1 +
 man/qtegrity.1 |   1 +
 man/quse.1 |   1 +
 man/qxpak.1|   1 +
 tests/Makefile.in  |   7 +
 tests/atom_compare/Makefile.in |   7 +
 tests/atom_explode/Makefile.in |   7 +
 tests/copy_file/Makefile.in|   7 +
 tests/install/Makefile.in  |   7 +
 tests/mkdir/Makefile.in|   7 +
 tests/profile/Makefile.in  |   7 +
 tests/qatom/Makefile.in|   7 +
 tests/qcheck/Makefile.in   |   7 +
 tests/qdepends/Makefile.in |   7 +
 tests/qfile/Makefile.in|   7 +
 tests/qlist/Makefile.in|   7 +
 tests/qlop/Makefile.in |   7 +
 tests/qmerge/Makefile.in   |   7 +
 tests/qtbz2/Makefile.in|   7 +
 tests/quse/Makefile.in |   7 +
 tests/qxpak/Makefile.in|   7 +
 tests/rmspace/Makefile.in  |   7 +
 tests/source/Makefile.in   |   7 +
 41 files changed, 854 insertions(+), 53 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index eafe369..eadaa63 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -248,13 +248,16 @@ PROGRAMS = $(bin_PROGRAMS)
 am_q_OBJECTS = q-main.$(OBJEXT) q-q.$(OBJEXT) q-qatom.$(OBJEXT) \
q-qcheck.$(OBJEXT) q-qdepends.$(OBJEXT) q-qfile.$(OBJEXT) \
q-qgrep.$(OBJEXT) q-qkeyword.$(OBJEXT) q-qlist.$(OBJEXT) \
-   q-qlop.$(OBJEXT) q-qmerge.$(OBJEXT) q-qpkg.$(OBJEXT) \
-   q-qsearch.$(OBJEXT) q-qsize.$(OBJEXT) q-qtbz2.$(OBJEXT) \
-   q-qtegrity.$(OBJEXT) q-quse.$(OBJEXT) q-qxpak.$(OBJEXT)
+   q-qlop.$(OBJEXT) q-qmanifest.$(OBJEXT) q-qmerge.$(OBJEXT) \
+   q-qpkg.$(OBJEXT) q-qsearch.$(OBJEXT) q-qsize.$(OBJEXT) \
+   q-qtbz2.$(OBJEXT) q-qtegrity.$(OBJEXT) q-quse.$(OBJEXT) \
+   q-qxpak.$(OBJEXT)
 q_OBJECTS = $(am_q_OBJECTS)
 am__DEPENDENCIES_1 =
-q_DEPENDENCIES = $(top_builddir)/libq/libq.la \
+q_DEPENDENCIES = $(am__DEPENDENCIES_1) $(top_builddir)/libq/libq.la \
$(top_builddir)/autotools/gnulib/libgnu.a \
+   $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+   $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -815,6 +818,9 @@ GNULIB_WMEMMOVE = @GNULIB_WMEMMOVE@
 GNULIB_WMEMSET = @GNULIB_WMEMSET@
 GNULIB_WRITE = @GNULIB_WRITE@
 GNULIB__EXIT = @GNULIB__EXIT@
+GPGME_CFLAGS = @GPGME_CFLAGS@
+GPGME_CONFIG = @GPGME_CONFIG@
+GPGME_LIBS = @GPGME_LIBS@
 GREP = @GREP@
 HAVE_ACOSF = @HAVE_ACOSF@
 HAVE_ACOSL = @HAVE_ACOSL@
@@ -1151,13 +1157,16 @@ INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@
 INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
+LIBBL2 = @LIBBL2@
 LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
 LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
 LIBINTL = @LIBINTL@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
+LIBSSL = @LIBSSL@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIBZ = @LIBZ@
 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
 LIB_EACCESS = @LIB_EACCESS@
 LIMITS_H = @LIMITS_H@
@@ -1216,6 +1225,7 @@ NM = @NM@
 NMEDIT = @NMEDIT@
 OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
 OTOOL = @OTOOL@
 OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
@@ -1558,6 +1568,7 @@ APPLETS = \
qkeyword \
qlist \
qlop \
+   qmanifest \
qmerge \
qpkg \
qsearch \
@@ -1578,6 +1589,7 @@ dist_man_MANS = \
man/qkeyword.1 \
man/qlist.1 \
man/qlop.1 \
+   man/qmanifest.1 \
man/qmerge.1 \
man/qpkg.1 \
man/qsearch.1 \
@@ -1599,6 +1611,7 @@ q_SOURCES = \
qkeyword.c \
qlist.c \
qlop.c \
+   qmanifest.c \
qmerge.c \
qpkg.c \
qsearch.c \
@@ -1610,15 +1623,22 @@ q_SOURCES = \
$(NULL)
 
 q_CPPFLAGS = \
+   $(OPENMP_CFLAGS) \
+   $(GPGME_CFLAGS) \
-I$(top_srcdir)/libq \

[gentoo-commits] proj/portage-utils:master commit in: tests/source/

2019-05-21 Thread Fabian Groffen
commit: 1c2468786a305db5e0462e0baa15c7ec46046dcd
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon May 20 17:04:28 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon May 20 17:04:28 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1c246878

test/source: utime is obsolete, utimes is POSIX.1.2001

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/source/dotest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/source/dotest b/tests/source/dotest
index f39addf..426a6cf 100755
--- a/tests/source/dotest
+++ b/tests/source/dotest
@@ -79,7 +79,7 @@ testit src.typos
 # don't allow obsolete functions
 #
 find ${ats} "${src_files[@]}" -print0 | xargs -0 \
-   grep -n -E -e 
'\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utimes)\>[[:space:]]*\(' \
+   grep -n -E -e 
'\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utime)\>[[:space:]]*\(' \
| sed -e "s:^\.\./\.\./::g" > src.obsolete.funcs
 testit src.obsolete.funcs
 



[gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/

2019-05-10 Thread Fabian Groffen
commit: 3d1497795246724e8f7b03e90272ed4dcbc950c1
Author: Fabian Groffen  gentoo  org>
AuthorDate: Fri May 10 11:43:25 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Fri May 10 11:43:25 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=3d149779

tests/qmerge: DEFINED_PHASES of test package is empty

pkg_prerm and postrm won't be run because they aren't defined

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qmerge/dotest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 224f3b9..57e2940 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -56,7 +56,7 @@ tend $? "qmerge-test: [R] re-emerge" || echo "${out}"
 tend $? "qmerge-test: [R] installed expected files" || treedir "${ROOT}"
 
 order=$(echo "${out}" | awk '$1 == ">>>" && $2 ~ /^pkg_/ { printf "%s ", $NF 
}')
-[[ ${order} == "pkg_pretend pkg_setup pkg_preinst pkg_postinst pkg_prerm 
pkg_postrm " ]]
+[[ ${order} == "pkg_pretend pkg_setup pkg_preinst pkg_postinst " ]]
 tend $? "qmerge-test: [R] pkg_* order of execution" || printf '%s\n' 
"${order}" "${out}"
 
 [[ -x ${ROOT}/usr/bin/qmerge-test && \



[gentoo-commits] proj/portage-utils:master commit in: tests/qatom/

2019-05-06 Thread Fabian Groffen
commit: 93a6fe6ffa64230847644beb1592eb7567e8ea2d
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon May  6 07:30:33 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon May  6 07:30:33 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=93a6fe6f

tests: adapt qatom new output

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qatom/dotest | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/qatom/dotest b/tests/qatom/dotest
index 2e16b25..24bd67b 100755
--- a/tests/qatom/dotest
+++ b/tests/qatom/dotest
@@ -30,6 +30,7 @@ test l07 "cat pkg 123 = *" "=cat/pkg-123*"
 
 # Explicit format.
 test f01 "cat"-F '%{CATEGORY}' "cat/pkg"
+test f19 "cat/"   -F '%[CATEGORY]' "cat/pkg"
 test f02 ""-F '%{CATEGORY}' "pkg"
 test f03 ""   -F '%[CATEGORY]' "pkg"
 test f04 "cat"-F '%{CATEGORY}' "cat/pkg-123-r4:5"
@@ -39,7 +40,8 @@ test f07 "123"-F '%{PV}'   "cat/pkg-123-r4:5"
 test f08 "123-r4" -F '%{PVR}'  "cat/pkg-123-r4:5"
 test f09 "pkg-123-r4" -F '%{PF}'   "cat/pkg-123-r4:5"
 test f10 "r4" -F '%{PR}'   "cat/pkg-123-r4:5"
-test f11 ":5" -F '%{SLOT}' "cat/pkg-123-r4:5"
+test f11 "5"  -F '%{SLOT}' "cat/pkg-123-r4:5"
+test f18 "repo"   -F '%{REPO}' "cat/pkg-123-r4:5::repo"
 test f12 "pkg-c"  -F '%{PN}'   "cat/pkg-c"  # bug #639978
 test f13 "mod_perl 1.5_p20180304 r5" \
   -F '%{PN} %{PV} %{PR}' \



[gentoo-commits] proj/portage-utils:master commit in: tests/qlist/root/cat/pkg-1/, tests/qlist/, tests/qcheck/root/cat/pkg-1/, libq/, ...

2019-04-25 Thread Fabian Groffen
commit: c26adcb74a24c169fd2b2b83b5e72cdd478e6b34
Author: Fabian Groffen  gentoo  org>
AuthorDate: Tue Apr 23 08:39:11 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Tue Apr 23 08:39:11 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=c26adcb7

q_vdb_filter_cat: make name check more strict

Validate to exclude things like distfiles, metadata, profiles.  Require
the hyphen except for "virtual".  This isn't strictly conforming to PMS
but matches Gentoo reality.

Signed-off-by: Fabian Groffen  gentoo.org>

 libq/vdb.c | 40 +-
 tests/qcheck/list04.good   |  2 +-
 tests/qcheck/list05.good   |  2 +-
 tests/qcheck/list06.good   |  2 +-
 tests/qcheck/list07.good   |  2 +-
 tests/qcheck/root/{cat => virtual}/pkg-1/CONTENTS  |  0
 tests/qcheck/root/{cat => virtual}/pkg-1/SLOT  |  0
 .../qcheck/root/{cat => virtual}/pkg-1/repository  |  0
 tests/qlist/dotest |  2 +-
 tests/qlist/list01.good|  4 +--
 tests/qlist/list07.good|  4 +--
 tests/qlist/list11.good|  4 +--
 tests/qlist/list12.good|  4 +--
 tests/qlist/list14.good|  4 +--
 tests/qlist/list16.good|  2 +-
 tests/qlist/root/{cat => virtual}/pkg-1/CONTENTS   |  0
 tests/qlist/root/{cat => virtual}/pkg-1/SLOT   |  0
 tests/qlist/root/{cat => virtual}/pkg-1/repository |  0
 tests/qlist/root/{cat => virtual}/sub-2/CONTENTS   |  0
 tests/qlist/root/{cat => virtual}/sub-2/SLOT   |  0
 tests/qlist/root/{cat => virtual}/sub-2/repository |  0
 21 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/libq/vdb.c b/libq/vdb.c
index 974986c..6b973e8 100644
--- a/libq/vdb.c
+++ b/libq/vdb.c
@@ -68,6 +68,7 @@ int
 q_vdb_filter_cat(const struct dirent *de)
 {
int i;
+   bool founddash;
 
 #ifdef DT_UNKNOWN
if (de->d_type != DT_UNKNOWN &&
@@ -76,24 +77,31 @@ q_vdb_filter_cat(const struct dirent *de)
return 0;
 #endif
 
-   if (de->d_name[0] == '.' || de->d_name[0] == '-')
-   return 0;
-
-   for (i = 0; de->d_name[i]; ++i) {
-   if (!isalnum(de->d_name[i])) { /* [A-Za-z0-9+_.-] */
-   switch (de->d_name[i]) {
-   case '+':
-   case '_':
-   case '.':
-   case '-':
-   if (i)
-   break;
-   /* fall through */
-   default:
-   return 0;
-   }
+   /* PMS 3.1.1 */
+   founddash = false;
+   for (i = 0; de->d_name[i] != '\0'; i++) {
+   switch (de->d_name[i]) {
+   case '_':
+   break;
+   case '-':
+   founddash = true;
+   /* fall through */
+   case '+':
+   case '.':
+   if (i)
+   break;
+   return 0;
+   default:
+   if ((de->d_name[i] >= 'A' && de->d_name[i] <= 
'Z') ||
+   (de->d_name[i] >= 'a' && 
de->d_name[i] <= 'z') ||
+   (de->d_name[i] >= '0' && 
de->d_name[i] <= '9'))
+   break;
+   return 0;
}
}
+   if (!founddash && strcmp(de->d_name, "virtual") != 0)
+   return 0;
+
return i;
 }
 

diff --git a/tests/qcheck/list04.good b/tests/qcheck/list04.good
index 930f896..b90a759 100644
--- a/tests/qcheck/list04.good
+++ b/tests/qcheck/list04.good
@@ -7,5 +7,5 @@ Checking a-b/pkg-1.0 ...
  AFK: /missing-dir/missing-file
  AFK: /missing-dir/missing-sym
   * 4 out of 11 files are good (2 files were ignored)
-Checking cat/pkg-1 ...
+Checking virtual/pkg-1 ...
   * 0 out of 0 file are good

diff --git a/tests/qcheck/list05.good b/tests/qcheck/list05.good
index d4c4243..6a6d206 100644
--- a/tests/qcheck/list05.good
+++ b/tests/qcheck/list05.good
@@ -7,5 +7,5 @@ Checking a-b/pkg-1.0 ...
  AFK: /missing-dir/missing-file
  AFK: /missing-dir/missing-sym
   * 4 out of 11 files are good (2 files were ignored)
-Checking cat/pkg-1 ...
+Checking virtual/pkg-1 ...
   * 0 out of 0 file are good

diff --git a/tests/qcheck/list06.good b/tests/qcheck/list06.good
index 3cd48f7..a924758 100644
--- a/tests/qcheck/list06.good
+++ b/tests/qcheck/list06.good
@@ -4,5 

[gentoo-commits] proj/portage-utils:master commit in: /, tests/, tests/reinitialize/

2019-04-25 Thread Fabian Groffen
commit: 1cd2f17f673a790caaa967341b7f2b1072968e51
Author: Fabian Groffen  gentoo  org>
AuthorDate: Thu Apr 25 07:56:48 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Thu Apr 25 07:56:48 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1cd2f17f

reinitialize_flat: remove

remove the flat cache (just a file list of directory contents)
- it can easily get stale
- traversing a directory isn't that expensive nowadays (and we don't do
  VAX)

the code should switch to using libq/cache instead

Signed-off-by: Fabian Groffen  gentoo.org>

 applets.h  |2 -
 main.c |  139 
 q.c|   48 +-
 qgrep.c|7 +-
 qpkg.c |4 +-
 quse.c |6 +-
 tests/Makefile.am  |2 +-
 tests/Makefile.in  |2 +-
 tests/reinitialize/Makefile.am |5 -
 tests/reinitialize/Makefile.in | 1589 
 tests/reinitialize/dotest  |8 -
 11 files changed, 11 insertions(+), 1801 deletions(-)

diff --git a/applets.h b/applets.h
index e2d487c..5889de6 100644
--- a/applets.h
+++ b/applets.h
@@ -146,7 +146,6 @@ extern char *config_protect;
 extern char *config_protect_mask;
 extern char *portvdb;
 extern char *portlogdir;
-extern int portcachedir_type;
 extern char *pkg_install_mask;
 extern char *binhost;
 extern char *pkgdir;
@@ -162,7 +161,6 @@ void usage(int status, const char *flags, struct option 
const opts[],
   const char * const help[], const char *desc, int blabber);
 int lookup_applet_idx(const char *);
 APPLET lookup_applet(const char *applet);
-const char *initialize_flat(const char *overlay, int cache_type, bool force);
 void freeargv(int argc, char **argv);
 void makeargv(const char *string, int *argc, char ***argv);
 

diff --git a/main.c b/main.c
index 7e56101..159b262 100644
--- a/main.c
+++ b/main.c
@@ -47,7 +47,6 @@ char *module_name = NULL;
 char *modpath = NULL;
 int verbose = 0;
 int quiet = 0;
-int portcachedir_type = 0;
 char pretend = 0;
 char *portroot;
 char *config_protect;
@@ -65,8 +64,6 @@ DECLARE_ARRAY(overlays);
 static char *main_overlay;
 static char *portarch;
 static char *portedb;
-const char portcachedir_pms[] = "metadata/cache";
-const char portcachedir_md5[] = "metadata/md5-cache";
 static char *eprefix;
 static char *accept_license;
 
@@ -783,142 +780,6 @@ initialize_portage_env(void)
color_remap();
 }
 
-const char *
-initialize_flat(const char *overlay, int cache_type, bool force)
-{
-   struct dirent **category, **pn, **eb;
-   struct stat st;
-   struct timeval start, finish;
-   char *cache_file;
-   char *p;
-   int i;
-   int frac, secs, count;
-   FILE *fp;
-
-   xasprintf(_file, "%s/dep/%s/%s", portedb, overlay,
-   (cache_type == CACHE_EBUILD ? ".ebuild.x" : ".metadata.x"));
-
-   /* If we aren't forcing a regen, make sure the file is somewhat sane. */
-   if (!force) {
-   if (stat(cache_file, ) != -1)
-   if (st.st_size)
-   return cache_file;
-   }
-
-   warn("Updating ebuild %scache for %s ... ",
-   cache_type == CACHE_EBUILD ? "" : "meta", overlay);
-
-   count = frac = secs = 0;
-
-   int overlay_fd, subdir_fd;
-   overlay_fd = open(overlay, O_RDONLY|O_CLOEXEC|O_PATH);
-
-   if (cache_type == CACHE_METADATA) {
-   subdir_fd = openat(overlay_fd, portcachedir_md5, 
O_RDONLY|O_CLOEXEC);
-   if (subdir_fd == -1) {
-   subdir_fd = openat(overlay_fd, portcachedir_pms,
-   O_RDONLY|O_CLOEXEC);
-   if (subdir_fd == -1) {
-   warnp("could not read md5 or pms cache dirs in 
%s", overlay);
-   goto ret;
-   }
-   portcachedir_type = CACHE_METADATA_PMS;
-   } else
-   portcachedir_type = CACHE_METADATA_MD5;
-   } else
-   subdir_fd = overlay_fd;
-
-   if ((fp = fopen(cache_file, "we")) == NULL) {
-   warnfp("opening cache failed: %s", cache_file);
-   if (errno == EACCES)
-   warnf("You should run this command as root: q -%c",
-   cache_type == CACHE_EBUILD ? 'r' : 'm');
-   goto ret;
-   }
-
-   gettimeofday(, NULL);
-
-   int cat_cnt;
-   cat_cnt = scandirat(subdir_fd, ".", , q_vdb_filter_cat, 
alphasort);
-   if (cat_cnt < 0)
-   goto ret;
-
-   for (i = 0; i < cat_cnt; i++) {
-   if (fstatat(subdir_fd, category[i]->d_name, , 0))
-   continue;
-   if (!S_ISDIR(st.st_mode))
-   continue;
-   if 

[gentoo-commits] proj/portage-utils:master commit in: tests/source/, tests/qlist/, tests/install/, tests/qtbz2/, tests/qfile/, ...

2019-04-17 Thread Fabian Groffen
commit: 6d9ab292b82660699045e4ccdf9c89bf065e4c42
Author: Fabian Groffen  gentoo  org>
AuthorDate: Wed Apr 17 19:14:10 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Wed Apr 17 19:14:10 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6d9ab292

tests: don't run tests by default

remnant of pre-automake Makefiles having default all: check rule

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/atom_compare/Makefile.am |  6 ++
 tests/atom_compare/Makefile.in | 36 +++-
 tests/install/Makefile.am  |  8 ++--
 tests/install/Makefile.in  | 38 +++---
 tests/profile/Makefile.am  |  6 +-
 tests/profile/Makefile.in  | 32 +++-
 tests/qatom/Makefile.am|  8 +---
 tests/qatom/Makefile.in| 36 +---
 tests/qcheck/Makefile.am   |  8 +---
 tests/qcheck/Makefile.in   | 36 +---
 tests/qdepends/Makefile.am |  8 +---
 tests/qdepends/Makefile.in | 36 +---
 tests/qfile/Makefile.am|  8 +---
 tests/qfile/Makefile.in| 36 +---
 tests/qlist/Makefile.am|  8 +---
 tests/qlist/Makefile.in| 36 +---
 tests/qlop/Makefile.am |  8 +---
 tests/qlop/Makefile.in | 36 +---
 tests/qmerge/Makefile.am   |  8 +---
 tests/qmerge/Makefile.in   | 36 +---
 tests/qtbz2/Makefile.am|  8 +---
 tests/qtbz2/Makefile.in| 36 +---
 tests/quse/Makefile.am |  8 ++--
 tests/quse/Makefile.in | 38 +++---
 tests/qxpak/Makefile.am|  8 +---
 tests/qxpak/Makefile.in| 36 +---
 tests/reinitialize/Makefile.am |  8 +---
 tests/reinitialize/Makefile.in | 36 +---
 tests/source/Makefile.am   |  8 +---
 tests/source/Makefile.in   | 36 +---
 30 files changed, 277 insertions(+), 379 deletions(-)

diff --git a/tests/atom_compare/Makefile.am b/tests/atom_compare/Makefile.am
index 06ad041..388fd19 100644
--- a/tests/atom_compare/Makefile.am
+++ b/tests/atom_compare/Makefile.am
@@ -4,9 +4,7 @@ s = $(abs_top_srcdir)/$(this_subdir)
 atb = $(abs_top_builddir)
 mkdir = $(if $(wildcard $(dir $(1))),:,mkdir -p "$(dir $(1))")
 
-all: test
-
-test check: static static.q portage
+check-local: static static.q portage
 
 t = \
@set -f && \
@@ -38,7 +36,7 @@ static.q: $(s)/static.q.tests $(atb)/q
 portage: $(s)/static.tests $(s)/atom-compare.py
$(call t)
 
-clean:
+clean-local:
rm -f $(b)/static $(b)/static.q $(b)/portage
 
 .PHONY: all check clean test

diff --git a/tests/atom_compare/Makefile.in b/tests/atom_compare/Makefile.in
index da4e185..8512dee 100644
--- a/tests/atom_compare/Makefile.in
+++ b/tests/atom_compare/Makefile.in
@@ -1487,6 +1487,7 @@ distdir: $(DISTFILES)
  fi; \
done
 check-am: all-am
+   $(MAKE) $(AM_MAKEFLAGS) check-local
 check: check-am
 all-am: Makefile
 installdirs:
@@ -1520,7 +1521,9 @@ distclean-generic:
 maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-clean-am: clean-generic clean-libtool mostlyclean-am
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
 
 distclean: distclean-am
-rm -f Makefile
@@ -1584,26 +1587,25 @@ ps-am:
 
 uninstall-am:
 
-.MAKE: install-am install-strip
+.MAKE: check-am install-am install-strip
 
-.PHONY: all all-am check check-am clean clean-generic clean-libtool \
-   cscopelist-am ctags-am distclean distclean-generic \
-   distclean-libtool distdir dvi dvi-am html html-am info info-am \
-   install install-am install-data install-data-am install-dvi \
-   install-dvi-am install-exec install-exec-am install-html \
-   install-html-am install-info install-info-am install-man \
-   install-pdf install-pdf-am install-ps install-ps-am \
-   install-strip installcheck installcheck-am installdirs \
-   maintainer-clean maintainer-clean-generic mostlyclean \
-   mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-   tags-am uninstall uninstall-am
+.PHONY: all all-am check check-am check-local clean clean-generic \
+   clean-libtool clean-local cscopelist-am ctags-am distclean \
+   distclean-generic distclean-libtool distdir dvi dvi-am html \
+   html-am info info-am install install-am install-data \
+   install-data-am install-dvi install-dvi-am install-exec \
+   install-exec-am install-html install-html-am install-info \
+   

[gentoo-commits] proj/portage-utils:master commit in: tests/copy_file/, tests/atom_explode/, tests/rmspace/, tests/mkdir/

2019-04-14 Thread Fabian Groffen
commit: 4b84f159c55e1b73515dafb3c647e1e243a95778
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sun Apr 14 15:46:43 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sun Apr 14 15:46:43 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4b84f159

tests: avoid race due to duplicate check target

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/atom_explode/Makefile.am | 6 ++
 tests/atom_explode/Makefile.in | 9 -
 tests/copy_file/Makefile.am| 4 +---
 tests/copy_file/Makefile.in| 7 +++
 tests/mkdir/Makefile.am| 4 +---
 tests/mkdir/Makefile.in| 7 +++
 tests/rmspace/Makefile.am  | 4 +---
 tests/rmspace/Makefile.in  | 7 +++
 8 files changed, 18 insertions(+), 30 deletions(-)

diff --git a/tests/atom_explode/Makefile.am b/tests/atom_explode/Makefile.am
index ddaaf8c..ecdcc58 100644
--- a/tests/atom_explode/Makefile.am
+++ b/tests/atom_explode/Makefile.am
@@ -12,8 +12,6 @@ e_LDADD = $(top_builddir)/libq/libq.la \
  $(LIB_CLOCK_GETTIME) \
  $(LIB_EACCESS)
 
-test check: dotest basic
-
 basic: e
./e < $(s)/basic.tests > basic
diff -u $(s)/basic.good basic
@@ -21,7 +19,7 @@ basic: e
 dotest: e
$(s)/dotest
 
+check-local: dotest basic
+
 clean-local:
rm -f me py q basic
-
-.PHONY: all basic dotest test check clean-local

diff --git a/tests/atom_explode/Makefile.in b/tests/atom_explode/Makefile.in
index cdec9c8..662044b 100644
--- a/tests/atom_explode/Makefile.in
+++ b/tests/atom_explode/Makefile.in
@@ -1629,6 +1629,7 @@ distdir: $(DISTFILES)
done
 check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+   $(MAKE) $(AM_MAKEFLAGS) check-local
 check: check-am
 all-am: Makefile
 installdirs:
@@ -1735,7 +1736,7 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \
clean-checkPROGRAMS clean-generic clean-libtool clean-local \
cscopelist-am ctags ctags-am distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
@@ -1752,8 +1753,6 @@ uninstall-am:
 .PRECIOUS: Makefile
 
 
-test check: dotest basic
-
 basic: e
./e < $(s)/basic.tests > basic
diff -u $(s)/basic.good basic
@@ -1761,11 +1760,11 @@ basic: e
 dotest: e
$(s)/dotest
 
+check-local: dotest basic
+
 clean-local:
rm -f me py q basic
 
-.PHONY: all basic dotest test check clean-local
-
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:

diff --git a/tests/copy_file/Makefile.am b/tests/copy_file/Makefile.am
index 13d22a8..87290be 100644
--- a/tests/copy_file/Makefile.am
+++ b/tests/copy_file/Makefile.am
@@ -12,9 +12,7 @@ m_LDADD = $(top_builddir)/libq/libq.la \
  $(LIB_CLOCK_GETTIME) \
  $(LIB_EACCESS)
 
-test check: dotest
-
 dotest: m
$(s)/dotest
 
-.PHONY: all basic dotest test check
+check-local: dotest

diff --git a/tests/copy_file/Makefile.in b/tests/copy_file/Makefile.in
index 0d3c832..159ba5d 100644
--- a/tests/copy_file/Makefile.in
+++ b/tests/copy_file/Makefile.in
@@ -1629,6 +1629,7 @@ distdir: $(DISTFILES)
done
 check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+   $(MAKE) $(AM_MAKEFLAGS) check-local
 check: check-am
 all-am: Makefile
 installdirs:
@@ -1735,7 +1736,7 @@ uninstall-am:
 
 .MAKE: check-am install-am install-strip
 
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \
clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
@@ -1752,12 +1753,10 @@ uninstall-am:
 .PRECIOUS: Makefile
 
 
-test check: dotest
-
 dotest: m
$(s)/dotest
 
-.PHONY: all basic dotest test check
+check-local: dotest
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.

diff --git a/tests/mkdir/Makefile.am b/tests/mkdir/Makefile.am
index 88b555f..e9d1536 100644
--- a/tests/mkdir/Makefile.am
+++ b/tests/mkdir/Makefile.am
@@ -12,9 +12,7 @@ m_LDADD = $(top_builddir)/libq/libq.la \
  $(LIB_CLOCK_GETTIME) \
  $(LIB_EACCESS)
 
-test check: dotest
-
 dotest: m
$(s)/dotest
 
-.PHONY: all basic dotest test check
+check-local: dotest

diff --git a/tests/mkdir/Makefile.in b/tests/mkdir/Makefile.in
index 916924e..2aadccc 100644
--- a/tests/mkdir/Makefile.in
+++ b/tests/mkdir/Makefile.in
@@ -1629,6 +1629,7 @@ distdir: $(DISTFILES)
done
 check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+   $(MAKE) $(AM_MAKEFLAGS) 

[gentoo-commits] proj/portage-utils:master commit in: tests/qlist/

2019-04-13 Thread Fabian Groffen
commit: 030db6ff6e1d53b9a3b2a9447943aacfcaa5a4cb
Author: Fabian Groffen  gentoo  org>
AuthorDate: Sat Apr 13 06:26:25 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Sat Apr 13 06:26:25 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=030db6ff

tests: approve changed qlist output

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qlist/list03.good | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qlist/list03.good b/tests/qlist/list03.good
index 28fa101..ede9f31 100644
--- a/tests/qlist/list03.good
+++ b/tests/qlist/list03.good
@@ -1,3 +1,4 @@
+sys-fs/mtools-4.0.13 CONTENTS:
 /usr/bin/minfo -> mtools
 /usr/bin/mpartition -> mtools
 /usr/bin/mrd -> mtools



[gentoo-commits] proj/portage-utils:master commit in: tests/qdepends/

2019-04-08 Thread Fabian Groffen
commit: dfaa42c80bb27b73ab826e5f949f76c12a2739ad
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Apr  8 09:31:16 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Apr  8 09:31:16 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=dfaa42c8

travis: skip over to interesting test

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qdepends/dotest | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qdepends/dotest b/tests/qdepends/dotest
index fb1c694..8971d6e 100755
--- a/tests/qdepends/dotest
+++ b/tests/qdepends/dotest
@@ -51,6 +51,7 @@ test() {
 
 testf() { test "$1" "${3:-0}" -f "$2"; }
 
+if false ; then
 # basic sanity checks
 testf 00 '|' 1
 testf 01 ''
@@ -63,6 +64,7 @@ testf 05 '|| ( || ( || ( x ) a ) )'
 
 # hande use deps on atoms #470180
 testf 06 'a[foo(+)]'
+fi
 
 testQ() { test "$1" "${3:-0}" -Q "$2"; }
 



[gentoo-commits] proj/portage-utils:master commit in: tests/qdepends/

2019-04-08 Thread Fabian Groffen
commit: 5a792fca6a20b83adaa1cfa6994bd019509c5a56
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Apr  8 09:27:11 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Apr  8 09:30:43 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=5a792fca

travis: generate debug messages to perhaps get a glimpse of the problem

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qdepends/dotest | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/qdepends/dotest b/tests/qdepends/dotest
index 6378fc7..fb1c694 100755
--- a/tests/qdepends/dotest
+++ b/tests/qdepends/dotest
@@ -24,11 +24,14 @@ test() {
# qdepends output is based on a hash, which may differ based on
# endiannes, so sort the output so we get a deterministic set
while IFS= read -r line ; do
+   echo "I read: ${line} with ${SHELL}/${BASH}"
case "${line}" in
-   *:*)
+   *":"*)
+   echo "I found a :"
# dinosaur style for Travis' /bin/bash (or /bin/sh?)
pkg="$(echo "${line}" | cut -d':' -f1)"
line="$(echo "${line}" | cut -d':' -f2-)"
+   echo "I think pkg=${pkg}, line=${line}"
env LC_ALL=C \
echo "${pkg}: $(echo "${line}" | xargs -n1 | 
sort | xargs)"
;;



[gentoo-commits] proj/portage-utils:master commit in: tests/qdepends/

2019-04-08 Thread Fabian Groffen
commit: f61e96c0883459f29679e736cd136e63a60c1b92
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Apr  8 09:44:46 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Apr  8 09:44:46 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=f61e96c0

travis: see if sort is called

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qdepends/dotest | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/qdepends/dotest b/tests/qdepends/dotest
index 516d793..c507f08 100755
--- a/tests/qdepends/dotest
+++ b/tests/qdepends/dotest
@@ -28,8 +28,7 @@ test() {
*:*)
pkg=${line%%:*}
line=${line#*:}
-   env LC_ALL=C \
-   echo "${pkg}: $(echo "${line}" | tr ' ' '\n' | 
sort | xargs)"
+   echo "${pkg}: sort? $(echo "${line}" | tr ' ' '\n' | 
LC_ALL=C sort | xargs)"
;;
*)
echo "${line}"



[gentoo-commits] proj/portage-utils:master commit in: tests/qdepends/

2019-04-08 Thread Fabian Groffen
commit: 04cffcbb0e1b109ab8f36cd304798c1727c22082
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Apr  8 09:47:37 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Apr  8 09:47:37 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=04cffcbb

travis: remove debug marker, see if output matches without

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qdepends/dotest | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qdepends/dotest b/tests/qdepends/dotest
index c507f08..6a8c3d6 100755
--- a/tests/qdepends/dotest
+++ b/tests/qdepends/dotest
@@ -28,7 +28,7 @@ test() {
*:*)
pkg=${line%%:*}
line=${line#*:}
-   echo "${pkg}: sort? $(echo "${line}" | tr ' ' '\n' | 
LC_ALL=C sort | xargs)"
+   echo "${pkg}: $(echo "${line}" | tr ' ' '\n' | LC_ALL=C 
sort | xargs)"
;;
*)
echo "${line}"



[gentoo-commits] proj/portage-utils:master commit in: tests/qdepends/

2019-04-08 Thread Fabian Groffen
commit: 93279f2848d01437bf203c11ec0a7a14d43e3ad1
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Apr  8 09:38:05 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Apr  8 09:38:05 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=93279f28

travis: try line splitting for xargs

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qdepends/dotest | 14 --
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/tests/qdepends/dotest b/tests/qdepends/dotest
index 8971d6e..516d793 100755
--- a/tests/qdepends/dotest
+++ b/tests/qdepends/dotest
@@ -24,16 +24,12 @@ test() {
# qdepends output is based on a hash, which may differ based on
# endiannes, so sort the output so we get a deterministic set
while IFS= read -r line ; do
-   echo "I read: ${line} with ${SHELL}/${BASH}"
case "${line}" in
-   *":"*)
-   echo "I found a :"
-   # dinosaur style for Travis' /bin/bash (or /bin/sh?)
-   pkg="$(echo "${line}" | cut -d':' -f1)"
-   line="$(echo "${line}" | cut -d':' -f2-)"
-   echo "I think pkg=${pkg}, line=${line}"
+   *:*)
+   pkg=${line%%:*}
+   line=${line#*:}
env LC_ALL=C \
-   echo "${pkg}: $(echo "${line}" | xargs -n1 | 
sort | xargs)"
+   echo "${pkg}: $(echo "${line}" | tr ' ' '\n' | 
sort | xargs)"
;;
*)
echo "${line}"
@@ -51,7 +47,6 @@ test() {
 
 testf() { test "$1" "${3:-0}" -f "$2"; }
 
-if false ; then
 # basic sanity checks
 testf 00 '|' 1
 testf 01 ''
@@ -64,7 +59,6 @@ testf 05 '|| ( || ( || ( x ) a ) )'
 
 # hande use deps on atoms #470180
 testf 06 'a[foo(+)]'
-fi
 
 testQ() { test "$1" "${3:-0}" -Q "$2"; }
 



[gentoo-commits] proj/portage-utils:master commit in: tests/qdepends/

2019-04-08 Thread Fabian Groffen
commit: 519ea2292367f3fc2cab6ec357d613cb6bb00bba
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Apr  8 09:19:09 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Apr  8 09:19:09 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=519ea229

tests: last attempt (?) to get qdepends test running on Travis

Perhaps old bash, or perhaps using dash (even though it shouldn't), well
maybe the greedy matches aren't supported well, replace with old cut to
split up strings.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qdepends/dotest | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/qdepends/dotest b/tests/qdepends/dotest
index 11f7aad..6378fc7 100755
--- a/tests/qdepends/dotest
+++ b/tests/qdepends/dotest
@@ -26,9 +26,11 @@ test() {
while IFS= read -r line ; do
case "${line}" in
*:*)
-   pkg=${line%%:*}
+   # dinosaur style for Travis' /bin/bash (or /bin/sh?)
+   pkg="$(echo "${line}" | cut -d':' -f1)"
+   line="$(echo "${line}" | cut -d':' -f2-)"
env LC_ALL=C \
-   echo "${pkg}: $(echo ${line#*:} | xargs -n1 | 
sort | xargs)"
+   echo "${pkg}: $(echo "${line}" | xargs -n1 | 
sort | xargs)"
;;
*)
echo "${line}"



[gentoo-commits] proj/portage-utils:master commit in: tests/qdepends/

2019-04-08 Thread Fabian Groffen
commit: 1ff2dedfee5b06d1ee67faf56938b3dc7b683907
Author: Fabian Groffen  gentoo  org>
AuthorDate: Mon Apr  8 09:00:56 2019 +
Commit: Fabian Groffen  gentoo  org>
CommitDate: Mon Apr  8 09:00:56 2019 +
URL:https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=1ff2dedf

tests: avoid string comparison in qdepends

Travis seems to not match this, so rewrite using a case-switch.  Perhaps
the shell used isn't bash or some version which doesn't grok the use I
envisioned.

Signed-off-by: Fabian Groffen  gentoo.org>

 tests/qdepends/dotest | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/qdepends/dotest b/tests/qdepends/dotest
index ab5e2d3..11f7aad 100755
--- a/tests/qdepends/dotest
+++ b/tests/qdepends/dotest
@@ -24,13 +24,16 @@ test() {
# qdepends output is based on a hash, which may differ based on
# endiannes, so sort the output so we get a deterministic set
while IFS= read -r line ; do
-   if [[ ${line} == *:* ]] ; then
+   case "${line}" in
+   *:*)
pkg=${line%%:*}
env LC_ALL=C \
echo "${pkg}: $(echo ${line#*:} | xargs -n1 | 
sort | xargs)"
-   else
+   ;;
+   *)
echo "${line}"
-   fi
+   ;;
+   esac
done < list | diff list - | patch -s list
 
local good="${as}/list${num}.good"



  1   2   >