Wednesday, March 01, 2023

devel/gyp needs some love

I needed gyp to test something and it turns out that it's broken since
at least the Python 3.8 -> 3.9 transition:

AttributeError: module 'collections' has no attribute 'MutableSet'

Upstream has some fixes and the below worked well enough for my purposes.

Tests hang here:

[249/356] (ninja) test/variables/commands/gyptest-commands-ignore-env.py

and once tests were run, 'make clean' fails with permission errors.

If anyone wants to pick this up and push it over the line, they are most
welcome to do so. I have no real interest in this. All consumers go via
lang/v8, which has been broken since the clang 13 transition, so I
suspect I'm not alone...

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/gyp/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- Makefile 14 Nov 2022 17:16:53 -0000 1.14
+++ Makefile 1 Mar 2023 13:44:52 -0000
@@ -2,10 +2,9 @@ COMMENT= generate SCons/Makefiles from p

GH_ACCOUNT= chromium
GH_PROJECT= gyp
-GH_COMMIT= caa60026e223fc501e8b337fd5086ece4028b1c6
+GH_COMMIT= 9d09418933ea2f75cc416e5ce38d15f62acd5c9a

-DISTNAME= gyp-0.20200512
-REVISION= 2
+DISTNAME= gyp-0.20220714

CATEGORIES= devel

@@ -21,8 +20,9 @@ TEST_DEPENDS= devel/ninja
pre-configure:
${SUBST_CMD} ${WRKSRC}/gyp

+# XXX make clean is broken after running tests
do-test:
ln -fs ${MODPY_BIN} ${WRKDIR}/bin/python
- cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MODPY_BIN} gyptest.py -a
+ cd ${WRKSRC}; ${_PBUILD} ${SETENV} ${MAKE_ENV} ${MODPY_BIN} gyptest.py -a

.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/gyp/distinfo,v
retrieving revision 1.3
diff -u -p -r1.3 distinfo
--- distinfo 27 Feb 2021 21:09:36 -0000 1.3
+++ distinfo 28 Feb 2023 21:58:35 -0000
@@ -1,2 +1,2 @@
-SHA256 (gyp-0.20200512-caa60026.tar.gz) = m0Q8V6tBZv0JhEzn2R0ePQtMcFEoXWZApvT9D6jZNvQ=
-SIZE (gyp-0.20200512-caa60026.tar.gz) = 630532
+SHA256 (gyp-0.20220714-9d094189.tar.gz) = XE35KMoHL6v8wk9JfWXwk9RqkQKartQHUxkE/bmmvxE=
+SIZE (gyp-0.20220714-9d094189.tar.gz) = 630527
Index: patches/patch-gyp
===================================================================
RCS file: /cvs/ports/devel/gyp/patches/patch-gyp,v
retrieving revision 1.2
diff -u -p -r1.2 patch-gyp
--- patches/patch-gyp 11 Mar 2022 18:50:11 -0000 1.2
+++ patches/patch-gyp 28 Feb 2023 22:01:30 -0000
@@ -1,9 +1,12 @@
Index: gyp
--- gyp.orig
+++ gyp
-@@ -5,4 +5,4 @@
+@@ -5,7 +5,7 @@

- set -e
+ set -eu
base=$(dirname "$0")
--exec python "${base}/gyp_main.py" "$@"
+-if type python3 >& /dev/null; then
+exec ${MODPY_BIN} "${base}/gyp_main.py" "$@"
+ python=python3
+ else
+ python=python
Index: patches/patch-pylib_gyp_input_py
===================================================================
RCS file: patches/patch-pylib_gyp_input_py
diff -N patches/patch-pylib_gyp_input_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-pylib_gyp_input_py 28 Feb 2023 22:03:16 -0000
@@ -0,0 +1,12 @@
+Index: pylib/gyp/input.py
+--- pylib/gyp/input.py.orig
++++ pylib/gyp/input.py
+@@ -1183,7 +1183,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict
+ if variable_name in variables:
+ # If the variable is already set, don't set it.
+ continue
+- if the_dict_key is 'variables' and variable_name in the_dict:
++ if the_dict_key == 'variables' and variable_name in the_dict:
+ # If the variable is set without a % in the_dict, and the_dict is a
+ # variables dict (making |variables| a varaibles sub-dict of a
+ # variables dict), use the_dict's definition.
Index: patches/patch-test_lib_TestCmd_py
===================================================================
RCS file: patches/patch-test_lib_TestCmd_py
diff -N patches/patch-test_lib_TestCmd_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-test_lib_TestCmd_py 28 Feb 2023 22:01:47 -0000
@@ -0,0 +1,12 @@
+Index: test/lib/TestCmd.py
+--- test/lib/TestCmd.py.orig
++++ test/lib/TestCmd.py
+@@ -882,7 +882,7 @@ class TestCmd(object):
+ #self.diff_function = difflib.unified_diff
+ self._dirlist = []
+ self._preserve = {'pass_test': 0, 'fail_test': 0, 'no_result': 0}
+- if 'PRESERVE' in os.environ and os.environ['PRESERVE'] is not '':
++ if 'PRESERVE' in os.environ and os.environ['PRESERVE'] != '':
+ self._preserve['pass_test'] = os.environ['PRESERVE']
+ self._preserve['fail_test'] = os.environ['PRESERVE']
+ self._preserve['no_result'] = os.environ['PRESERVE']

No comments:

Post a Comment