[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/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/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/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/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/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/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/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?*)