public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, bin/
@ 2019-01-13 23:38 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2019-01-13 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     8463281f6a6daec64a976693447c240f0d669f08
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 13 23:11:40 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jan 13 23:17:32 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8463281f

misc-functions.sh: restore canonicalize func (bug 675284)

The canonicalize function is required by install-qa-check.d/05prefix.

Fixes: aa0a94198794 ("ecompress: Replace with implementation from portage[mgorny]")
Bug: https://bugs.gentoo.org/670484
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/misc-functions.sh                            | 34 ++++++++++++++++++++++++
 lib/portage/tests/resolver/ResolverPlayground.py |  1 +
 2 files changed, 35 insertions(+)

diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index 5de26b44d..4f8a4112d 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -43,6 +43,40 @@ install_symlink_html_docs() {
 	fi
 }
 
+# replacement for "readlink -f" or "realpath"
+READLINK_F_WORKS=""
+canonicalize() {
+	if [[ -z ${READLINK_F_WORKS} ]] ; then
+		if [[ $(readlink -f -- /../ 2>/dev/null) == "/" ]] ; then
+			READLINK_F_WORKS=true
+		else
+			READLINK_F_WORKS=false
+		fi
+	fi
+	if ${READLINK_F_WORKS} ; then
+		readlink -f -- "$@"
+		return
+	fi
+
+	local f=$1 b n=10 wd=$(pwd)
+	while (( n-- > 0 )); do
+		while [[ ${f: -1} = / && ${#f} -gt 1 ]]; do
+			f=${f%/}
+		done
+		b=${f##*/}
+		cd "${f%"${b}"}" 2>/dev/null || break
+		if [[ ! -L ${b} ]]; then
+			f=$(pwd -P)
+			echo "${f%/}/${b}"
+			cd "${wd}"
+			return 0
+		fi
+		f=$(readlink "${b}")
+	done
+	cd "${wd}"
+	return 1
+}
+
 install_qa_check() {
 	local d f i qa_var x paths qa_checks=() checks_run=()
 	if ! ___eapi_has_prefix_variables; then

diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py
index 626a1f064..0d6340dc0 100644
--- a/lib/portage/tests/resolver/ResolverPlayground.py
+++ b/lib/portage/tests/resolver/ResolverPlayground.py
@@ -99,6 +99,7 @@ class ResolverPlayground(object):
 				"mkdir",
 				"mktemp",
 				"mv",
+				"readlink",
 				"rm",
 				"sed",
 				"sort",


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, bin/
@ 2019-11-17 20:21 Zac Medico
  0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2019-11-17 20:21 UTC (permalink / raw
  To: gentoo-commits

commit:     a49a7a29189e6a29da47bc9059739d54d72e2aca
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 20:11:24 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 20:15:31 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a49a7a29

helper-functions.sh: __multijob_init: handle errors

Also add mkfifo to ResolverPlayground essential_binaries, since it's
required by __multijob_init.

Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/helper-functions.sh                          | 7 ++++---
 bin/isolated-functions.sh                        | 5 +++--
 lib/portage/tests/resolver/ResolverPlayground.py | 1 +
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh
index 2d359762a..f76703f0c 100644
--- a/bin/helper-functions.sh
+++ b/bin/helper-functions.sh
@@ -19,15 +19,16 @@ __multijob_init() {
 	# read and write to not block ourselve, but use it for reading only.
 	# The second fd really is opened for write only, as Cygwin supports
 	# just one single read fd per FIFO. #583962
-	local pipe=$(mktemp -t multijob.XXXXXX)
+	local pipe
+	pipe=$(mktemp -t multijob.XXXXXX) || die
 	rm -f "${pipe}"
-	mkfifo -m 600 "${pipe}"
+	mkfifo -m 600 "${pipe}" || die
 	__redirect_alloc_fd mj_read_fd "${pipe}"
 	__redirect_alloc_fd mj_write_fd "${pipe}" '>'
 	rm -f "${pipe}"
 
 	# See how many children we can fork based on the user's settings.
-	mj_max_jobs=$(___makeopts_jobs "$@")
+	mj_max_jobs=$(___makeopts_jobs "$@") || die
 	mj_num_jobs=0
 }
 

diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 893c02f9b..e8d41fd64 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -453,8 +453,9 @@ fi
 
 ___makeopts_jobs() {
 	# Copied from eutils.eclass:makeopts_jobs()
-	local jobs=$(echo " ${MAKEOPTS} " | \
-		sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p')
+	local jobs
+	jobs=$(echo " ${MAKEOPTS} " | \
+		sed -r -n 's:.*[[:space:]](-j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p') || die
 	echo ${jobs:-1}
 }
 

diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py
index 3d48c244f..cc3056ab4 100644
--- a/lib/portage/tests/resolver/ResolverPlayground.py
+++ b/lib/portage/tests/resolver/ResolverPlayground.py
@@ -99,6 +99,7 @@ class ResolverPlayground(object):
 				"install",
 				"ln",
 				"mkdir",
+				"mkfifo",
 				"mktemp",
 				"mv",
 				"readlink",


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, bin/
@ 2023-12-10 22:01 Sam James
  0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2023-12-10 22:01 UTC (permalink / raw
  To: gentoo-commits

commit:     112594d7606bbb795da3ec8a01c6e295fba864d3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 23 13:16:23 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 10 22:01:48 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=112594d7

Small pyupgrade fixes

Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/dispatch-conf                                |  2 +-
 lib/portage/tests/resolver/ResolverPlayground.py | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index 849be562ee..601110ce87 100755
--- a/bin/dispatch-conf
+++ b/bin/dispatch-conf
@@ -475,7 +475,7 @@ class dispatch:
 
         try:
             os.rename(newconf, curconf)
-        except (OSError, os.error) as why:
+        except OSError as why:
             writemsg(
                 f"dispatch-conf: Error renaming {newconf} to {curconf}: {str(why)}; fatal\n",
                 noiselevel=-1,

diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py
index 115800a606..962550df37 100644
--- a/lib/portage/tests/resolver/ResolverPlayground.py
+++ b/lib/portage/tests/resolver/ResolverPlayground.py
@@ -262,7 +262,7 @@ class ResolverPlayground:
 
             try:
                 os.makedirs(profile_path)
-            except os.error:
+            except OSError:
                 pass
 
             repo_name_file = os.path.join(profile_path, "repo_name")
@@ -305,7 +305,7 @@ class ResolverPlayground:
             ebuild_path = os.path.join(ebuild_dir, a.cpv.split("/")[1] + ".ebuild")
             try:
                 os.makedirs(ebuild_dir)
-            except os.error:
+            except OSError:
                 pass
 
             with open(ebuild_path, "w") as f:
@@ -411,7 +411,7 @@ class ResolverPlayground:
             vdb_pkg_dir = os.path.join(self.vdbdir, a.cpv)
             try:
                 os.makedirs(vdb_pkg_dir)
-            except os.error:
+            except OSError:
                 pass
 
             metadata = installed[cpv].copy()
@@ -457,7 +457,7 @@ class ResolverPlayground:
 
         try:
             os.makedirs(user_config_dir)
-        except os.error:
+        except OSError:
             pass
 
         for repo in self._repositories:
@@ -639,7 +639,7 @@ class ResolverPlayground:
 
         try:
             os.makedirs(default_sets_conf_dir)
-        except os.error:
+        except OSError:
             pass
 
         provided_sets_portage_conf = os.path.join(str(cnf_path), "sets", "portage.conf")
@@ -652,7 +652,7 @@ class ResolverPlayground:
 
         try:
             os.makedirs(set_config_dir)
-        except os.error:
+        except OSError:
             pass
 
         for sets_file, lines in sets.items():


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-10 22:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-10 22:01 [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, bin/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2019-11-17 20:21 Zac Medico
2019-01-13 23:38 Zac Medico

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