public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2016-06-06 21:15 Paul Varner
  0 siblings, 0 replies; 20+ messages in thread
From: Paul Varner @ 2016-06-06 21:15 UTC (permalink / raw
  To: gentoo-commits

commit:     d158f2e656bd72f01b72bb94cb734fb1021934b5
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  6 21:14:27 2016 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Mon Jun  6 21:14:27 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d158f2e6

glsa-check: Apply list only affected versions patch from bug 400763

Author: Roland Hopferwieser <gentoo <AT> int0x80.at>
X-Gentoo-bug: 400763
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=400763

 bin/glsa-check | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/bin/glsa-check b/bin/glsa-check
index 46088d7..3f691b8 100755
--- a/bin/glsa-check
+++ b/bin/glsa-check
@@ -240,11 +240,15 @@ def summarylist(myglsalist, fd1=sys.stdout, fd2=sys.stderr, encoding="utf-8"):
 			if len(myglsa.packages) > 3:
 				fd1.write("... ")
 		else:
-			for pkg in myglsa.packages.keys():
-				mylist = vardb.match(portage.dep_getkey(str(pkg)))
+			for cpv in myglsa.packages.keys():
+				pkg = myglsa.packages[cpv]
+				for path in pkg:
+					v_installed = reduce(operator.add, [match(v, "vartree") for v in path["vul_atoms"]], [])
+					u_installed = reduce(operator.add, [match(u, "vartree") for u in path["unaff_atoms"]], [])
+				mylist = sorted(set(v_installed).difference(set(u_installed)))
 				if len(mylist) > 0:
-					pkg = color(" ".join(mylist))
-				fd1.write(" " + pkg + " ")
+					cpv = color(" ".join(mylist))
+				fd1.write(" " + cpv + " ")
 
 		fd1.write(")")
 		if list_cve:


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2016-10-17 17:39 Paul Varner
  0 siblings, 0 replies; 20+ messages in thread
From: Paul Varner @ 2016-10-17 17:39 UTC (permalink / raw
  To: gentoo-commits

commit:     b5e71f6f2ed3483422df611fc2450081c72332ac
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 17 17:38:09 2016 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Mon Oct 17 17:38:09 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b5e71f6f

eread: Fix bash error when the elog directory is empty

This fixes the following error from bash which causes an infinite loop.

/usr/bin/eread: line 64: break: only meaningful in a `for', `while', or
`until' loop

X-Gentoo-bug: 597132
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=597132

 bin/eread | 124 +++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 62 insertions(+), 62 deletions(-)

diff --git a/bin/eread b/bin/eread
index fe095a6..2289f2d 100755
--- a/bin/eread
+++ b/bin/eread
@@ -57,72 +57,72 @@ find_files() {
 }
 
 select_loop() {
-	ANY_FILES=$(find_files)
-
-	if [[ -z ${ANY_FILES} ]]; then
-		echo "No log items to read"
-		break
-	fi
-
-	echo
-	echo "This is a list of portage log items. Choose a number to view that file or type q to quit."
-	echo
-
-	# Pick which file to read
-	select FILE in ${ANY_FILES}; do
-		case ${REPLY} in
-			q)
-				echo "Quitting"
-				QUIT="yes"
-				break
-				;;
-			a)
-				SORT="alphabet"
-				;;
-			t)
-				SORT="time"
-				;;
-			*)
-				if [ -f "$FILE" ]; then
-					${PAGER} ${FILE}
-					read -p "Delete file? [y/N] " DELETE
-					case ${DELETE} in
-						q)
-							echo "Quitting"
-							QUIT="yes"
-							break
-							;;
-						y|Y)
-							rm -f ${FILE}
-							SUCCESS=$?
-							if [[ ${SUCCESS} = 0 ]]; then
-								echo "Deleted ${FILE}"
-							else
-								echo "Unable to delete ${FILE}"
-							fi
-							;;
-						# Empty string defaults to N (save file)
-						n|N|"")
-							echo "Saving ${FILE}"
-							;;
-						*)
-							echo "Invalid response. Saving ${FILE}"
-							;;
-					esac
-				else
-					echo
-					echo "Invalid response."
-				fi
-				;;
-		esac
-		break
+	until [[ -n ${QUIT} ]]; do
+		ANY_FILES=$(find_files)
+
+		if [[ -z ${ANY_FILES} ]]; then
+			echo "No log items to read"
+			break
+		fi
+
+		echo
+		echo "This is a list of portage log items. Choose a number to view that file or type q to quit."
+		echo
+
+		# Pick which file to read
+		select FILE in ${ANY_FILES}; do
+			case ${REPLY} in
+				q)
+					echo "Quitting"
+					QUIT="yes"
+					break
+					;;
+				a)
+					SORT="alphabet"
+					;;
+				t)
+					SORT="time"
+					;;
+				*)
+					if [ -f "$FILE" ]; then
+						${PAGER} ${FILE}
+						read -p "Delete file? [y/N] " DELETE
+						case ${DELETE} in
+							q)
+								echo "Quitting"
+								QUIT="yes"
+								break
+								;;
+							y|Y)
+								rm -f ${FILE}
+								SUCCESS=$?
+								if [[ ${SUCCESS} = 0 ]]; then
+									echo "Deleted ${FILE}"
+								else
+									echo "Unable to delete ${FILE}"
+								fi
+								;;
+							# Empty string defaults to N (save file)
+							n|N|"")
+								echo "Saving ${FILE}"
+								;;
+							*)
+								echo "Invalid response. Saving ${FILE}"
+								;;
+						esac
+					else
+						echo
+						echo "Invalid response."
+					fi
+					;;
+			esac
+			break
+		done
 	done
 }
 
 pushd ${ELOGDIR} > /dev/null
 
-until [[ -n ${QUIT} ]]; do
-	select_loop
-done
+select_loop
 
 popd > /dev/null


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2020-03-16 14:24 Ben Kohler
  0 siblings, 0 replies; 20+ messages in thread
From: Ben Kohler @ 2020-03-16 14:24 UTC (permalink / raw
  To: gentoo-commits

commit:     26620fa90335a7b7921d41711ee9baf82eb41784
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 16 14:21:34 2020 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Mon Mar 16 14:23:57 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=26620fa9

euse: don't fail on repos missing use.desc

Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 bin/euse | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/euse b/bin/euse
index 56fc917..15a2a6e 100755
--- a/bin/euse
+++ b/bin/euse
@@ -842,7 +842,8 @@ showinstdesc() {
 	while [ -n "${1}" ]; do
 		case "${SCOPE}" in
 			"global")
-				if desc=$(grep "^${1}  *-" ${PORTAGE_REPO_PATHS[@]/%//profiles/use.desc}); then
+				local desc=$(grep "^${1}  *-" ${PORTAGE_REPO_PATHS[@]/%//profiles/use.desc} 2>/dev/null)
+				if [ ! -z "${desc}" ]; then
 					get_flagstatus "${1}"
 					echo "$desc"
 					# get list of installed packages matching this USE flag.


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2020-12-31 22:11 Matt Turner
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Turner @ 2020-12-31 22:11 UTC (permalink / raw
  To: gentoo-commits

commit:     9f01c8b098484866974407bb74680debf0d64e4f
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 20 22:12:49 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Dec 31 19:44:17 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9f01c8b0

bin: Add merge-driver-ekeyword

Since the KEYWORDS=... assignment is a single line, git struggles to
handle conflicts. When rebasing a series of commits that modify the
KEYWORDS=... it's usually easier to throw them away and reapply on the
new tree than it is to manually handle conflicts during the rebase.

git allows a 'merge driver' program to handle conflicts; this program
handles conflicts in the KEYWORDS=... assignment. E.g., given an ebuild
with these keywords:

KEYWORDS="~alpha amd64 arm arm64 ~hppa ppc ppc64 x86"

One developer drops the ~alpha keyword and pushes to gentoo.git, and
another developer stabilizes hppa. Without this merge driver, git
requires the second developer to manually resolve the conflict which is
tedious and prone to mistakes when rebasing a long series of patches.
With the custom merge driver, it automatically resolves the conflict.

To use the merge driver, configure your gentoo.git as such:

gentoo.git/.git/config:

	[merge "keywords"]
		name = KEYWORDS merge driver
		driver = merge-driver-ekeyword %O %A %B %P

gentoo.git/.git/info/attributes:

	*.ebuild merge=keywords

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 bin/merge-driver-ekeyword | 132 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
new file mode 100755
index 0000000..2df83fc
--- /dev/null
+++ b/bin/merge-driver-ekeyword
@@ -0,0 +1,132 @@
+#!/usr/bin/python
+#
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2 or later
+
+"""
+Custom git merge driver for handling conflicts in KEYWORDS assignments
+
+See https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
+"""
+
+import difflib
+import os
+import sys
+import tempfile
+
+from typing import List, Optional, Tuple
+
+from gentoolkit.ekeyword import ekeyword
+
+
+def keyword_array(keyword_line: str) -> List[str]:
+    # Find indices of string inside the double-quotes
+    i1: int = keyword_line.find('"') + 1
+    i2: int = keyword_line.rfind('"')
+
+    # Split into array of KEYWORDS
+    return keyword_line[i1:i2].split(' ')
+
+
+def keyword_line_changes(old: str, new: str) -> List[Tuple[Optional[str],
+                                                           Optional[str]]]:
+    a: List[str] = keyword_array(old)
+    b: List[str] = keyword_array(new)
+
+    s = difflib.SequenceMatcher(a=a, b=b)
+
+    changes = []
+    for tag, i1, i2, j1, j2 in s.get_opcodes():
+        if tag == 'replace':
+            changes.append((a[i1:i2], b[j1:j2]),)
+        elif tag == 'delete':
+            changes.append((a[i1:i2], None),)
+        elif tag == 'insert':
+            changes.append((None, b[j1:j2]),)
+        else:
+            assert tag == 'equal'
+    return changes
+
+
+def keyword_changes(ebuild1: str, ebuild2: str) -> List[Tuple[Optional[str],
+                                                              Optional[str]]]:
+    with open(ebuild1) as e1, open(ebuild2) as e2:
+        lines1 = e1.readlines()
+        lines2 = e2.readlines()
+
+        diff = difflib.unified_diff(lines1, lines2, n=0)
+        assert next(diff) == '--- \n'
+        assert next(diff) == '+++ \n'
+
+        hunk: int = 0
+        old: str = ''
+        new: str = ''
+
+        for line in diff:
+            if line.startswith('@@ '):
+                if hunk > 0:
+                    break
+                hunk += 1
+            elif line.startswith('-'):
+                if old or new:
+                    break
+                old = line
+            elif line.startswith('+'):
+                if not old or new:
+                    break
+                new = line
+        else:
+            if 'KEYWORDS=' in old and 'KEYWORDS=' in new:
+                return keyword_line_changes(old, new)
+        return None
+
+
+def apply_keyword_changes(ebuild: str, pathname: str,
+                          changes: List[Tuple[Optional[str],
+                                              Optional[str]]]) -> int:
+    result: int = 0
+
+    with tempfile.TemporaryDirectory() as tmpdir:
+        # ekeyword will only modify files named *.ebuild, so make a symlink
+        ebuild_symlink: str = os.path.join(tmpdir, os.path.basename(pathname))
+        os.symlink(os.path.join(os.getcwd(), ebuild), ebuild_symlink)
+
+        for removals, additions in changes:
+            args = []
+            for rem in removals:
+                # Drop leading '~' and '-' characters and prepend '^'
+                i = 1 if rem[0] in ('~', '-') else 0
+                args.append('^' + rem[i:])
+            if additions:
+                args.extend(additions)
+            args.append(ebuild_symlink)
+
+            result = ekeyword.main(args)
+            if result != 0:
+                break
+
+    return result
+
+
+def main(argv):
+    if len(argv) != 5:
+        sys.exit(-1)
+
+    O = argv[1] # %O - filename of original
+    A = argv[2] # %A - filename of our current version
+    B = argv[3] # %B - filename of the other branch's version
+    P = argv[4] # %P - original path of the file
+
+    # Get changes from %O to %B
+    changes = keyword_changes(O, B)
+    if changes:
+        # Apply O -> B changes to A
+        result: int = apply_keyword_changes(A, P, changes)
+        sys.exit(result)
+    else:
+        result: int = os.system(f"git merge-file -L HEAD -L base -L ours {A} {O} {B}")
+        sys.exit(0 if result == 0 else -1)
+
+
+if __name__ == "__main__":
+    main(sys.argv)


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2021-02-25  0:06 Matt Turner
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Turner @ 2021-02-25  0:06 UTC (permalink / raw
  To: gentoo-commits

commit:     6e85d8a770ebc9f00e53a61cdd098caefeb3cbbf
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 25 00:04:02 2021 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Feb 25 00:05:56 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6e85d8a7

bin: Handle case of no KEYWORD removals

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 bin/merge-driver-ekeyword | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index 2df83fc..d24aaf9 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -93,10 +93,11 @@ def apply_keyword_changes(ebuild: str, pathname: str,
 
         for removals, additions in changes:
             args = []
-            for rem in removals:
-                # Drop leading '~' and '-' characters and prepend '^'
-                i = 1 if rem[0] in ('~', '-') else 0
-                args.append('^' + rem[i:])
+            if removals:
+                for rem in removals:
+                    # Drop leading '~' and '-' characters and prepend '^'
+                    i = 1 if rem[0] in ('~', '-') else 0
+                    args.append('^' + rem[i:])
             if additions:
                 args.extend(additions)
             args.append(ebuild_symlink)


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2021-03-12  2:31 Matt Turner
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Turner @ 2021-03-12  2:31 UTC (permalink / raw
  To: gentoo-commits

commit:     273b4530ebb098fa140614d72532e5c6cb277df2
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 12 02:24:29 2021 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Mar 12 02:31:16 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=273b4530

bin: Fix type annotations

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 bin/merge-driver-ekeyword | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index d24aaf9..7f4a10b 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -14,11 +14,13 @@ import os
 import sys
 import tempfile
 
-from typing import List, Optional, Tuple
+from typing import List, Optional, Sequence, Tuple
 
 from gentoolkit.ekeyword import ekeyword
 
 
+KeywordChanges = List[Tuple[Optional[List[str]], Optional[List[str]]]]
+
 def keyword_array(keyword_line: str) -> List[str]:
     # Find indices of string inside the double-quotes
     i1: int = keyword_line.find('"') + 1
@@ -28,14 +30,13 @@ def keyword_array(keyword_line: str) -> List[str]:
     return keyword_line[i1:i2].split(' ')
 
 
-def keyword_line_changes(old: str, new: str) -> List[Tuple[Optional[str],
-                                                           Optional[str]]]:
+def keyword_line_changes(old: str, new: str) -> KeywordChanges:
     a: List[str] = keyword_array(old)
     b: List[str] = keyword_array(new)
 
     s = difflib.SequenceMatcher(a=a, b=b)
 
-    changes = []
+    changes: KeywordChanges = []
     for tag, i1, i2, j1, j2 in s.get_opcodes():
         if tag == 'replace':
             changes.append((a[i1:i2], b[j1:j2]),)
@@ -48,8 +49,7 @@ def keyword_line_changes(old: str, new: str) -> List[Tuple[Optional[str],
     return changes
 
 
-def keyword_changes(ebuild1: str, ebuild2: str) -> List[Tuple[Optional[str],
-                                                              Optional[str]]]:
+def keyword_changes(ebuild1: str, ebuild2: str) -> Optional[KeywordChanges]:
     with open(ebuild1) as e1, open(ebuild2) as e2:
         lines1 = e1.readlines()
         lines2 = e2.readlines()
@@ -82,8 +82,7 @@ def keyword_changes(ebuild1: str, ebuild2: str) -> List[Tuple[Optional[str],
 
 
 def apply_keyword_changes(ebuild: str, pathname: str,
-                          changes: List[Tuple[Optional[str],
-                                              Optional[str]]]) -> int:
+                          changes: KeywordChanges) -> int:
     result: int = 0
 
     with tempfile.TemporaryDirectory() as tmpdir:
@@ -109,7 +108,7 @@ def apply_keyword_changes(ebuild: str, pathname: str,
     return result
 
 
-def main(argv):
+def main(argv: Sequence[str]) -> int:
     if len(argv) != 5:
         sys.exit(-1)
 
@@ -122,10 +121,10 @@ def main(argv):
     changes = keyword_changes(O, B)
     if changes:
         # Apply O -> B changes to A
-        result: int = apply_keyword_changes(A, P, changes)
+        result = apply_keyword_changes(A, P, changes)
         sys.exit(result)
     else:
-        result: int = os.system(f"git merge-file -L HEAD -L base -L ours {A} {O} {B}")
+        result = os.system(f"git merge-file -L HEAD -L base -L ours {A} {O} {B}")
         sys.exit(0 if result == 0 else -1)
 
 


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2022-05-19  4:30 Sam James
  0 siblings, 0 replies; 20+ messages in thread
From: Sam James @ 2022-05-19  4:30 UTC (permalink / raw
  To: gentoo-commits

commit:     049b80cd6b4ffe3929fd95a9f9b21582fd2373f4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun May 15 05:47:58 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May 15 05:48:10 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=049b80cd

euse: egrep -> grep -E

egrep is considered an obsolete alias and newer greps will warn on this.

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

 bin/euse | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/bin/euse b/bin/euse
index c3b6638..daffd66 100755
--- a/bin/euse
+++ b/bin/euse
@@ -338,11 +338,11 @@ get_useflaglist() {
 		descdir="${profiledir}/profiles"
 		if [[ -z ${SCOPE} || ${SCOPE} == "global" ]]; then
 			[[ ! -s "${descdir}/use.desc" ]] && continue
-			egrep "^[^# ]+ +-" "${descdir}/use.desc"
+			grep -E "^[^# ]+ +-" "${descdir}/use.desc"
 		fi
 		if [[ -z ${SCOPE} || ${SCOPE} == "local" ]]; then
 			[[ ! -s "${descdir}/use.local.desc" ]] && continue
-			egrep "^[^# :]+:[^ ]+ +-" "${descdir}/use.local.desc" \
+			grep -E "^[^# :]+:[^ ]+ +-" "${descdir}/use.local.desc" \
 				| cut -d: -f 2
 		fi
 	done | cut -d " "  -f1 | sort --field=":" --key=1,1 --unique
@@ -370,7 +370,7 @@ get_useflaglist() {
 # ACTIVE_FLAGS - Array of current use flag info
 #
 get_useflaglist_ebuild() {
-	local known=$(echo "${ACTIVE_FLAGS[5]}" | egrep "^${1}")
+	local known=$(echo "${ACTIVE_FLAGS[5]}" | grep -E "^${1}")
 	local cacheformat
 	if [[ -n $known ]]; then
 		# No need to recache
@@ -397,7 +397,7 @@ get_useflaglist_ebuild() {
 			return 1
 		fi
 		append=$(set +f; ls ${portdir}/metadata/${cacheformat}/${1}-* \
-			| egrep "${1}-[0-9.]+" \
+			| grep -E "${1}-[0-9.]+" \
 			| sed -e "s:${portdir}/metadata/${cacheformat}/${1}-::g" \
 			| while read -d $'\n' version; do
 				IFS=$'\n'
@@ -454,7 +454,7 @@ traverse_profile() {
 	curdir="${2:-$(get_real_path ${MAKE_PROFILE_PATH})}"
 
 	if [[ -f "${curdir}/parent" ]]; then
-		for parent in $(egrep -v '(^#|^ *$)' ${curdir}/parent); do
+		for parent in $(grep -E -v '(^#|^ *$)' ${curdir}/parent); do
 			# Bug 231394, handle parent path being absolute
 			index=$(expr index "${parent}" :)
 			if [[ ${parent:0:1} == "/" ]]; then
@@ -906,9 +906,9 @@ showflags() {
 			get_flagstatus ${1}
 			echo
 		fi
-		if echo " ${ACTIVE_FLAGS[4]} " | egrep -e " -?${1} " > /dev/null; then
+		if echo " ${ACTIVE_FLAGS[4]} " | grep -E -e " -?${1} " > /dev/null; then
 			for pkg in $( echo "${ACTIVE_FLAGS[4]}" | \
-					egrep " -?${1} " | cut -d " " -f 2); do
+					grep -E " -?${1} " | cut -d " " -f 2); do
 				printf "%-20s" ${1}
 				SCOPE="local" get_flagstatus ${1} "${pkg}"
 				printf "(%s)\n" ${pkg}
@@ -992,7 +992,7 @@ scrub_use_flag() {
 		# If line only has this use flag, let it be removed
 		# (used if PACKAGE is not defined -- from pruning)
 		elif [[ -n $(echo "${line}" | \
-				egrep "^[^#]*${atom_re}.*-?${flag}") ]]; then
+				grep -E "^[^#]*${atom_re}.*-?${flag}") ]]; then
 			echo "Removing use flag from ${line}" >&2
 			if [[ -z $(echo "${line}" | \
 					grep -Ee "${atom_re} *-?${flag} *$") ]]; then
@@ -1068,10 +1068,10 @@ modify_package() {
 		# XXX: Handle version or version wildcard?
 		warn "USE flag \"${flag}\" is not used by $PACKAGE"
 		# Don't necessarily bail for this, just warn
-	elif [[ -n "${V}" && -z "$(egrep "<|>|=" <<< "${PACKAGE:0:1}")" ]]; then
+	elif [[ -n "${V}" && -z "$(grep -E "<|>|=" <<< "${PACKAGE:0:1}")" ]]; then
 		error "Invalid package atom. Did you forget the leading '='?"
 		continue
-	elif [[ -z "${V}" && -n "$(egrep "<|>|=" <<< "${PACKAGE:0:1}")" ]]; then
+	elif [[ -z "${V}" && -n "$(grep -E "<|>|=" <<< "${PACKAGE:0:1}")" ]]; then
 		error "Invalid package atom. Did you forget the version?"
 		continue
 	fi
@@ -1114,7 +1114,7 @@ modify_package() {
 			echo "Adding \"${PACKAGE}[${flag}]\" use flag in \"${filename}\""
 			local added=0
 		 	while read line; do
-				if [[ -n $(echo "${line}" | egrep -e "^[^#]*${PACKAGE} ") ]]; then
+				if [[ -n $(echo "${line}" | grep -E -e "^[^#]*${PACKAGE} ") ]]; then
 					echo $(reduce_package_use "${line} ${flag}")
 					added=1
 				else
@@ -1131,7 +1131,7 @@ modify_package() {
 			local filename
 			if [[ -d ${PACKAGE_USE_PATH} ]]; then
 				# Scan for file containing named package and use flag
-				filename=$(egrep -rle "${pkg_re}.*[^-]${flag}( |$)" "${PACKAGE_USE_PATH}")
+				filename=$(grep -E -rle "${pkg_re}.*[^-]${flag}( |$)" "${PACKAGE_USE_PATH}")
 				if [[ -z "${filename}" ]]; then
 					error ""${flag}" is not defined for package "${PACKAGE}""
 					continue
@@ -1251,7 +1251,7 @@ modify() {
 		# as the ending quote
 		if [ "${line:0:4}" == "USE=" ]; then inuse=1; line=${line:5}; fi
 		[ "${inuse}" == "0" ] && echo -E "${line}"
-		if [ "${inuse}" == "1" ] && echo "${line}" | egrep '" *(#.*)?$' > /dev/null; then
+		if [ "${inuse}" == "1" ] && echo "${line}" | grep -E '" *(#.*)?$' > /dev/null; then
 			echo -n 'USE="'
 			echo -ne "${NEW_MAKE_CONF_USE_2%% }"
 			echo '"'


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2022-07-09 19:50 Brian Dolbec
  0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2022-07-09 19:50 UTC (permalink / raw
  To: gentoo-commits

commit:     b22f6af5e32950859390dc2efd0379c572258bda
Author:     Hadrien Lacour <hadrien.lacour <AT> posteo <DOT> net>
AuthorDate: Sat Mar 31 20:39:01 2018 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jul  9 19:29:48 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b22f6af5

revdep-rebuild.sh: use awk instead of gawk

Bug: https://bugs.gentoo.org/652078
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoolkit/pull/6
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 bin/revdep-rebuild.sh | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 633701e..5fecf97 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -235,9 +235,19 @@ countdown() {
 # Replace whitespace with linebreaks, normalize repeated '/' chars, and sort -u
 # (If any libs have whitespace in their filenames, someone needs punishment.)
 clean_var() {
-	gawk 'BEGIN         {RS="[[:space:]]"}
-	     /-\*/         {exit}
-	     /[^[:space:]]/ {gsub(/\/\/+/, "/"); print}' | sort -u
+	awk '
+		BEGIN {FS = "[[:space:]]"}
+
+		{
+			for(i = 1; i <= NF; ++i) {
+				if($i ~ /-\*/)
+					exit
+				else if($i){
+					gsub(/\/\/+/, "/", $i)
+					print $i
+				}
+			}
+		}' | sort -u
 }
 ##
 # Exit and optionally output to sterr
@@ -805,8 +815,8 @@ main_checks() {
 					# Look for symbol not defined errors
 					if grep -vF "${LD_LIBRARY_MASK:=$'\a'}" <<< "$ldd_output" |
 						grep -q -E 'symbol .* not defined'; then
-						message=$(gawk '/symbol .* not defined/ {NF--; print $0}' <<< "$ldd_output")
-						broken_lib=$(gawk '/symbol .* not defined/ {print $NF}' <<< "$ldd_output" | \
+						message=$(awk '/symbol .* not defined/ {ORS = FS; for(i = 1; i < NF; ++i) print $i; printf "\n"}' <<< "$ldd_output")
+						broken_lib=$(awk '/symbol .* not defined/ {print $NF}' <<< "$ldd_output" | \
 							sed 's/[()]//g')
 						echo "obj $broken_lib" >> "$BROKEN_FILE"
 						echo_v "  broken $broken_lib ($message)"
@@ -820,7 +830,7 @@ main_checks() {
 					*)
 						if grep -vF "${LD_LIBRARY_MASK:=$'\a'}" <<< "$ldd_output" |
 							grep -q -F 'undefined symbol:'; then
-							message=$(gawk '/undefined symbol:/ {print $3}' <<< "$ldd_output")
+							message=$(awk '/undefined symbol:/ {print $3}' <<< "$ldd_output")
 							message="${message//$'\n'/ }"
 							echo "obj $target_file" >> "$BROKEN_FILE"
 							echo_v "  broken $target_file (undefined symbols(s): $message)"
@@ -835,7 +845,7 @@ main_checks() {
 				la_broken=""
 				la_lib=""
 				for depend in $(
-					gawk -F"[=']" '/^dependency_libs/{
+					awk -F"[=']" '/^dependency_libs/{
 						print $3
 					}' "$target_file"
 				); do
@@ -876,7 +886,7 @@ main_checks() {
 			done < <(
 				# Regexify LD_LIBRARY_MASK. Exclude it from the search.
 				LD_LIBRARY_MASK="${LD_LIBRARY_MASK//$'\n'/|}"
-				gawk -v ldmask="(${LD_LIBRARY_MASK//./\\\\.})" '
+				awk -v ldmask="(${LD_LIBRARY_MASK//./\\\\.})" '
 					/no version information available/ && $0 !~ ldmask {
 						gsub(/[()]/, "", $NF)
 						if (seen[$NF]++)  next
@@ -1068,7 +1078,7 @@ show_unowned_files() {
 		ewarn "The broken files are:"
 		while read filename junk; do
 			[[ $junk = *none* ]] && ewarn "  $filename"
-		done < "$OWNERS_FILE" | gawk '!s[$0]++' # (omit dupes)
+		done < "$OWNERS_FILE" | awk '!s[$0]++' # (omit dupes)
 	fi
 }
 


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2022-07-28 15:29 Brian Dolbec
  0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2022-07-28 15:29 UTC (permalink / raw
  To: gentoo-commits

commit:     4a56a7feff4fe8ed427cddff6e6b2719f0fe58c3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 12 00:58:23 2022 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jul 12 00:58:23 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=4a56a7fe

revdep-rebuild.sh: Create its cache dir if it doesn't exist

Bug: https://bugs.gentoo.org/382009

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 bin/revdep-rebuild.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/revdep-rebuild.sh b/bin/revdep-rebuild.sh
index 5fecf97..7ee3647 100755
--- a/bin/revdep-rebuild.sh
+++ b/bin/revdep-rebuild.sh
@@ -570,7 +570,8 @@ verify_tmpdir() {
 	elif [[ -d $1 ]]; then
 		cd "$1"
 	else
-		die 1 "Unable to find a satisfactory location for temporary files ($1)"
+		mkdir -p "$1"
+		cd "$1"
 	fi
 	[[ $VERBOSE ]] && einfo "Temporary cache files are located in $PWD"
 	setup_rm


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2022-12-03 13:54 Michał Górny
  0 siblings, 0 replies; 20+ messages in thread
From: Michał Górny @ 2022-12-03 13:54 UTC (permalink / raw
  To: gentoo-commits

commit:     62d22ed69cecd3ae416b3b899062244865659d5b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  3 13:54:06 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Dec  3 13:54:06 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=62d22ed6

ebump: Use `git rev-parse --is-inside-work-tree`

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 bin/ebump | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebump b/bin/ebump
index 06264c4..25e9a7c 100755
--- a/bin/ebump
+++ b/bin/ebump
@@ -277,7 +277,7 @@ get_vcs() {
 		return 0
 	else
 		if command -v git >/dev/null; then
-			if [ -n "$(git rev-parse --git-dir 2>/dev/null)" ]; then
+			if [ "$(git rev-parse --is-inside-work-tree)" = true ]; then
 				echo "git"
 				return 0
 			fi


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2022-12-03 13:54 Michał Górny
  0 siblings, 0 replies; 20+ messages in thread
From: Michał Górny @ 2022-12-03 13:54 UTC (permalink / raw
  To: gentoo-commits

commit:     932473493220d48457aeb547018d040138c1e161
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  3 13:45:14 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Dec  3 13:45:14 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=93247349

ebump: Replace which(1) with `command -v`

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 bin/ebump | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/ebump b/bin/ebump
index 7f6e3ce..06264c4 100755
--- a/bin/ebump
+++ b/bin/ebump
@@ -276,7 +276,7 @@ get_vcs() {
 		echo "svn"
 		return 0
 	else
-		if [ -x "$(which git)" ]; then
+		if command -v git >/dev/null; then
 			if [ -n "$(git rev-parse --git-dir 2>/dev/null)" ]; then
 				echo "git"
 				return 0


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2023-08-29  0:51 Sam James
  0 siblings, 0 replies; 20+ messages in thread
From: Sam James @ 2023-08-29  0:51 UTC (permalink / raw
  To: gentoo-commits

commit:     263e3d64adac1ee2968233e151d1ee590532f42d
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 29 00:50:11 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 29 00:51:32 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=263e3d64

bin/merge-driver-ekeyword: fix compatibility with >=git-2.42.0

Commit 2b7b788fb31a74bcbff4e4c6efc6f3db6c3a49b7 upstream makes more use
of the result from a merge driver.

Correctly surface the result from `git merge-file` so that we don't wrongly
throw away information but also don't make git think the driver crashed (-1
is for exceptional cases, not "failed to merge").

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

 bin/merge-driver-ekeyword | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index f75056c..e59e10c 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -127,7 +127,7 @@ def main(argv: Sequence[str]) -> int:
         sys.exit(result)
     else:
         result = os.system(f"git merge-file -L HEAD -L base -L ours {A} {O} {B}")
-        sys.exit(0 if result == 0 else -1)
+        sys.exit(result)
 
 
 if __name__ == "__main__":


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2023-08-29  1:38 Sam James
  0 siblings, 0 replies; 20+ messages in thread
From: Sam James @ 2023-08-29  1:38 UTC (permalink / raw
  To: gentoo-commits

commit:     fb45df369b4be7061fc14f5eb361c4d6c97e3f02
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 29 01:21:04 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 29 01:21:17 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=fb45df36

bin/merge-driver-ekeyword: mangle exit code correctly

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

 bin/merge-driver-ekeyword | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index e59e10c..0235a98 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -1,6 +1,6 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 #
-# Copyright 2020 Gentoo Authors
+# Copyright 2020-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2 or later
 
 """
@@ -127,8 +127,10 @@ def main(argv: Sequence[str]) -> int:
         sys.exit(result)
     else:
         result = os.system(f"git merge-file -L HEAD -L base -L ours {A} {O} {B}")
+        result = os.waitstatus_to_exitcode(result)
+        if result < 0 or result >= 128:
+            sys.exit(-1)
         sys.exit(result)
 
-
 if __name__ == "__main__":
     main(sys.argv)


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2023-08-29 15:48 Mike Gilbert
  0 siblings, 0 replies; 20+ messages in thread
From: Mike Gilbert @ 2023-08-29 15:48 UTC (permalink / raw
  To: gentoo-commits

commit:     67983750f9014d5b1821b9cd2522b34f04ce1795
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 29 15:25:55 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Aug 29 15:41:11 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=67983750

bin/merge-driver-ekeyword: replace os.system with os.execlp

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 bin/merge-driver-ekeyword | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index 0235a98..ae022f3 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -126,11 +126,10 @@ def main(argv: Sequence[str]) -> int:
         result = apply_keyword_changes(A, P, changes)
         sys.exit(result)
     else:
-        result = os.system(f"git merge-file -L HEAD -L base -L ours {A} {O} {B}")
-        result = os.waitstatus_to_exitcode(result)
-        if result < 0 or result >= 128:
+        try:
+            os.execlp("git", "git", "merge-file", "-L", "HEAD", "-L", "base", "-L", "ours", A, O, B)
+        except OSError:
             sys.exit(-1)
-        sys.exit(result)
 
 if __name__ == "__main__":
     main(sys.argv)


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2024-05-25  3:45 Matt Turner
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Turner @ 2024-05-25  3:45 UTC (permalink / raw
  To: gentoo-commits

commit:     a667d934de4e5980111fb0b4e3ecae19b477131f
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu May 23 23:23:23 2024 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat May 25 03:44:14 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=a667d934

bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commit

Previously we only looked for changes to the KEYWORDS= line in our local
commit being rebased. If it contained no changes to KEYWORDS= then the
merge-driver gave up.

However our local patch may conflict with an upstream patch that changed
KEYWORDS.

In that case, we can look for changes to the KEYWORDS= line in the other
patch and try to apply its change to ours.

This happened in gentoo.git commits

2c5cd6c4e004 ("sys-fs/squashfs-tools-ng: Stabilize 1.3.0 amd64, #930693")
7129c2e4e5f3 ("sys-fs/squashfs-tools-ng: run elibtoolize in non-live ebuild")

leading to a rebase mistake in the latter (later fixed by commit
7579afbd4aa1 ("sys-fs/squashfs-tools-ng: stabilize 1.3.0 for amd64")).

With this patch applied, the merge conflicts are automatically resolved
between the two commits regardless of which is "ours" vs "theirs".

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 bin/merge-driver-ekeyword | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index efdfbde..6d5f869 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 #
-# Copyright 2020-2023 Gentoo Authors
+# Copyright 2020-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2 or later
 
 """
@@ -119,12 +119,16 @@ def main(argv: Sequence[str]) -> int:
     B = argv[3]  # %B - filename of the other branch's version
     P = argv[4]  # %P - original path of the file
 
-    # Get changes from %O to %B
-    changes = keyword_changes(O, B)
-    if changes:
-        # Apply O -> B changes to A
+    # Get changes to KEYWORDS= from %O to %B
+    if changes := keyword_changes(O, B):
+        # Apply %O -> %B changes to %A
         result = apply_keyword_changes(A, P, changes)
         sys.exit(result)
+    # Get changes to KEYWORDS= from %O to %A
+    elif changes := keyword_changes(O, A):
+        # Apply %O -> %A changes to %B
+        result = apply_keyword_changes(B, P, changes)
+        sys.exit(result)
     else:
         try:
             os.execlp("git", "git", "merge-file", "-L", "HEAD", "-L", "base", "-L", "ours", A, O, B)


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2024-05-25  3:45 Matt Turner
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Turner @ 2024-05-25  3:45 UTC (permalink / raw
  To: gentoo-commits

commit:     1fd8e83235dcd5cfd9fb2615c77f32da8b89d062
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 15:50:11 2024 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat May 25 03:44:14 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1fd8e832

bin/merge-driver-ekeyword: Remove unused imports

Fixes: 1a2c70d ("Run `pyupgrade --py39-plus`")
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 bin/merge-driver-ekeyword | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index ae022f3..ff779c5 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -14,7 +14,7 @@ import os
 import sys
 import tempfile
 
-from typing import List, Optional, Tuple
+from typing import Optional
 from collections.abc import Sequence
 
 from gentoolkit.ekeyword import ekeyword


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2024-05-25  3:45 Matt Turner
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Turner @ 2024-05-25  3:45 UTC (permalink / raw
  To: gentoo-commits

commit:     6b6fa781352b306f7b5aa387fffa53b9bc63f209
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed May  1 15:51:45 2024 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sat May 25 03:44:14 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6b6fa781

bin/merge-driver-ekeyword: Two blank lines after function def

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 bin/merge-driver-ekeyword | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index ff779c5..efdfbde 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -131,5 +131,6 @@ def main(argv: Sequence[str]) -> int:
         except OSError:
             sys.exit(-1)
 
+
 if __name__ == "__main__":
     main(sys.argv)


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2024-06-24 18:05 Matt Turner
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Turner @ 2024-06-24 18:05 UTC (permalink / raw
  To: gentoo-commits

commit:     3cded564f41736854cd41c6e5c2318f4a7351d7f
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Tue May 28 02:26:23 2024 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Jun  7 15:02:43 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=3cded564

bin/merge-driver-ekeyword: Store merged output in correct location

Fixes: a667d93 ("bin/merge-driver-ekeyword: Look for KEYWORDS changes in upstream commit")
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 bin/merge-driver-ekeyword | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index 6d5f869..70c9b3a 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -11,6 +11,7 @@ See https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
 
 import difflib
 import os
+import shutil
 import sys
 import tempfile
 
@@ -128,6 +129,8 @@ def main(argv: Sequence[str]) -> int:
     elif changes := keyword_changes(O, A):
         # Apply %O -> %A changes to %B
         result = apply_keyword_changes(B, P, changes)
+        # Merged file should be left in %A
+        shutil.move(B, A)
         sys.exit(result)
     else:
         try:


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2024-06-24 18:05 Matt Turner
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Turner @ 2024-06-24 18:05 UTC (permalink / raw
  To: gentoo-commits

commit:     6f191a5c058c26722a9a16d8f03e04b0ffbef3cf
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Tue May 28 23:15:35 2024 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Jun  7 15:02:43 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6f191a5c

bin/merge-driver-ekeyword: Don't pass program name to main()

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 bin/merge-driver-ekeyword | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index 9a7a666..59527bb 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -112,13 +112,13 @@ def apply_keyword_changes(ebuild: str, pathname: str,
 
 
 def main(argv: Sequence[str]) -> int:
-    if len(argv) != 5:
+    if len(argv) != 4:
         return -1
 
-    O = argv[1]  # %O - filename of original
-    A = argv[2]  # %A - filename of our current version
-    B = argv[3]  # %B - filename of the other branch's version
-    P = argv[4]  # %P - original path of the file
+    O = argv[0]  # %O - filename of original
+    A = argv[1]  # %A - filename of our current version
+    B = argv[2]  # %B - filename of the other branch's version
+    P = argv[3]  # %P - original path of the file
 
     # Get changes to KEYWORDS= from %O to %B
     if changes := keyword_changes(O, B):
@@ -140,4 +140,4 @@ def main(argv: Sequence[str]) -> int:
 
 
 if __name__ == "__main__":
-    sys.exit(main(sys.argv))
+    sys.exit(main(sys.argv[1:]))


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

* [gentoo-commits] proj/gentoolkit:master commit in: bin/
@ 2024-06-24 18:05 Matt Turner
  0 siblings, 0 replies; 20+ messages in thread
From: Matt Turner @ 2024-06-24 18:05 UTC (permalink / raw
  To: gentoo-commits

commit:     345d92e0e17f0b179e5d27381cc2395786cdd856
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Tue May 28 02:34:38 2024 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Jun  7 15:02:43 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=345d92e0

bin/merge-driver-ekeyword: Don't sys.exit() from main()

Makes unit testing easier.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 bin/merge-driver-ekeyword | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bin/merge-driver-ekeyword b/bin/merge-driver-ekeyword
index 70c9b3a..9a7a666 100755
--- a/bin/merge-driver-ekeyword
+++ b/bin/merge-driver-ekeyword
@@ -113,7 +113,7 @@ def apply_keyword_changes(ebuild: str, pathname: str,
 
 def main(argv: Sequence[str]) -> int:
     if len(argv) != 5:
-        sys.exit(-1)
+        return -1
 
     O = argv[1]  # %O - filename of original
     A = argv[2]  # %A - filename of our current version
@@ -124,20 +124,20 @@ def main(argv: Sequence[str]) -> int:
     if changes := keyword_changes(O, B):
         # Apply %O -> %B changes to %A
         result = apply_keyword_changes(A, P, changes)
-        sys.exit(result)
+        return result
     # Get changes to KEYWORDS= from %O to %A
     elif changes := keyword_changes(O, A):
         # Apply %O -> %A changes to %B
         result = apply_keyword_changes(B, P, changes)
         # Merged file should be left in %A
         shutil.move(B, A)
-        sys.exit(result)
+        return result
     else:
         try:
             os.execlp("git", "git", "merge-file", "-L", "HEAD", "-L", "base", "-L", "ours", A, O, B)
         except OSError:
-            sys.exit(-1)
+            return -1
 
 
 if __name__ == "__main__":
-    main(sys.argv)
+    sys.exit(main(sys.argv))


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

end of thread, other threads:[~2024-06-24 18:05 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-16 14:24 [gentoo-commits] proj/gentoolkit:master commit in: bin/ Ben Kohler
  -- strict thread matches above, loose matches on Subject: below --
2024-06-24 18:05 Matt Turner
2024-06-24 18:05 Matt Turner
2024-06-24 18:05 Matt Turner
2024-05-25  3:45 Matt Turner
2024-05-25  3:45 Matt Turner
2024-05-25  3:45 Matt Turner
2023-08-29 15:48 Mike Gilbert
2023-08-29  1:38 Sam James
2023-08-29  0:51 Sam James
2022-12-03 13:54 Michał Górny
2022-12-03 13:54 Michał Górny
2022-07-28 15:29 Brian Dolbec
2022-07-09 19:50 Brian Dolbec
2022-05-19  4:30 Sam James
2021-03-12  2:31 Matt Turner
2021-02-25  0:06 Matt Turner
2020-12-31 22:11 Matt Turner
2016-10-17 17:39 Paul Varner
2016-06-06 21:15 Paul Varner

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