public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/, tests/profile/, /
@ 2019-11-27 12:34 Fabian Groffen
  0 siblings, 0 replies; only message in thread
From: Fabian Groffen @ 2019-11-27 12:34 UTC (permalink / raw
  To: gentoo-commits

commit:     042a38c90aa010f05ecf7222f9be929f109c581e
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 27 12:32:12 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Nov 27 12:32:12 2019 +0000
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 <grobian <AT> 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, &var->value_len);
 		break;
@@ -718,7 +723,7 @@ initialize_portage_env(void)
 		var = &vars_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, "<PORTDIR>");
-		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: <profile dir suffix> <variable> <value>
 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'


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-27 12:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-27 12:34 [gentoo-commits] proj/portage-utils:master commit in: tests/qmerge/, tests/profile/, / Fabian Groffen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox