[packages/gyp] - update to current git gyp; add patches from fc (including python 3 support but we still use python

arekm arekm at pld-linux.org
Sat Jan 25 21:46:04 CET 2020


commit f33fa2297eeabf2913dd0fd26fd63e7bd97e722d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Jan 25 21:45:52 2020 +0100

    - update to current git gyp; add patches from fc (including python 3 support but we still use python 2 for now)

 get-source.sh         | 23 ++++++++++---------
 gyp-fips.patch        | 35 ++++++++++++++++++++++++++++
 gyp-fix-cmake.patch   | 33 +++++++++++++++++++++++++++
 gyp-ninja-build.patch | 26 +++++++++++++++++++++
 gyp-python3.patch     | 36 +++++++++++++++++++++++++++++
 gyp-python38.patch    | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++
 gyp-python39.patch    | 55 ++++++++++++++++++++++++++++++++++++++++++++
 gyp-rpmoptflags.patch | 32 ++++++++++++++++++++++++++
 gyp.spec              | 24 +++++++++++++++-----
 9 files changed, 310 insertions(+), 17 deletions(-)
---
diff --git a/gyp.spec b/gyp.spec
index f19ff0d..0f008ff 100644
--- a/gyp.spec
+++ b/gyp.spec
@@ -2,19 +2,25 @@
 # Conditional build:
 %bcond_with	tests		# build without tests
 
-%define		svnrev	1602
-%define		rel	3
+%define		gitrev	e87d37d6
+%define		rel	1
 Summary:	Generate Your Projects
 Summary(pl.UTF-8):	GYP (Generate Your Projects) - narzędzie do generowania systemów budowania
 Name:		gyp
 # grep version= setup.py
 Version:	0.1
-Release:	0.svn%{svnrev}.%{rel}
+Release:	1.%{rel}.%{gitrev}
 License:	New BSD
 Group:		Development/Building
 # use get-source.sh
-Source0:	%{name}-%{svnrev}.tar.bz2
-# Source0-md5:	fd1809e1716f46a585684aa0fb2df897
+Source0:	%{name}-%{version}-git%{gitrev}.tar.xz
+# Source0-md5:	9b6f6c10bb8def91e26c17f0be1f7f90
+Patch0:         gyp-rpmoptflags.patch
+Patch1:         gyp-ninja-build.patch
+Patch2:         gyp-python3.patch
+Patch3:         gyp-python38.patch
+Patch4:         gyp-fix-cmake.patch
+Patch5:         gyp-python39.patch
 URL:		https://gyp.gsrc.io/
 BuildRequires:	python-devel
 BuildRequires:	rpm-pythonprov
@@ -61,7 +67,13 @@ poszczególnych platform, aby obsłużyć różnice między nimi.
 Ten pakiet zawiera moduły Pythona.
 
 %prep
-%setup -q -n %{name}
+%setup -q -c
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
 
 %build
 %py_build
diff --git a/get-source.sh b/get-source.sh
index e9a76ec..93ae28f 100755
--- a/get-source.sh
+++ b/get-source.sh
@@ -1,16 +1,17 @@
 #!/bin/sh
-p=gyp
-svn=http://$p.googlecode.com/svn/trunk
-revno=$1
-specfile=$p.spec
 
 set -e
-svn co $svn${revno:+@$revno} $p
-svnrev=$(svnversion $p)
-tar -cjf $p-$svnrev.tar.bz2 --exclude-vcs --exclude=gyp/test/* $p
-../dropin $p-$svnrev.tar.bz2
+
+git clone https://chromium.googlesource.com/external/gyp
+cd gyp
+version=$(grep version= setup.py|cut -d\' -f2)
+revision=$(git log --oneline|head -1|cut -d' ' -f1)
+tar -a --exclude-vcs -cf ../gyp-$version-git$revision.tar.xz *
+cd ..
+
+../dropin gyp-$version-git$revision.tar.xz
 
 sed -i -e "
-	s/^\(%define[ \t]\+svnrev[ \t]\+\)[0-9]\+\$/\1$svnrev/
-" $specfile
-../md5 $p.spec
+	s/^\(%define[ \t]\+gitrev[ \t]\+\)[0-9]\+\$/\1$revision/
+" gyp.spec
+../md5 gyp.spec
diff --git a/gyp-fips.patch b/gyp-fips.patch
new file mode 100644
index 0000000..639d1b5
--- /dev/null
+++ b/gyp-fips.patch
@@ -0,0 +1,35 @@
+diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py
+index 997eec08..06c763db 100644
+--- a/pylib/gyp/generator/make.py
++++ b/pylib/gyp/generator/make.py
+@@ -1774,7 +1774,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
+ 
+       # Hash the target name to avoid generating overlong filenames.
+       cmdstring = (command if command else self.target).encode('utf-8')
+-      cmddigest = hashlib.sha1(cmdstring).hexdigest()
++      cmddigest = hashlib.sha1(cmdstring, usedforsecurity=False).hexdigest()
+       intermediate = "%s.intermediate" % (cmddigest)
+       self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
+       self.WriteLn('\t%s' % '@:');
+diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
+index bf04e567..631ef7f2 100644
+--- a/pylib/gyp/generator/ninja.py
++++ b/pylib/gyp/generator/ninja.py
+@@ -751,7 +751,7 @@ class NinjaWriter(object):
+         if self.flavor == 'win':
+           # WriteNewNinjaRule uses unique_name for creating an rsp file on win.
+           extra_bindings.append(('unique_name',
+-              hashlib.md5(outputs[0]).hexdigest()))
++              hashlib.md5(outputs[0], usedforsecurity=False).hexdigest()))
+ 
+         self.ninja.build(outputs, rule_name, self.GypPathToNinja(source),
+                          implicit=inputs,
+@@ -2388,7 +2388,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
+     qualified_target_for_hash = gyp.common.QualifiedTarget(build_file, name,
+                                                            toolset)
+     qualified_target_for_hash = qualified_target_for_hash.encode('utf-8')
+-    hash_for_rules = hashlib.md5(qualified_target_for_hash).hexdigest()
++    hash_for_rules = hashlib.md5(qualified_target_for_hash, usedforsecurity=False).hexdigest()
+ 
+     base_path = os.path.dirname(build_file)
+     obj = 'obj'
diff --git a/gyp-fix-cmake.patch b/gyp-fix-cmake.patch
new file mode 100644
index 0000000..31bd7ac
--- /dev/null
+++ b/gyp-fix-cmake.patch
@@ -0,0 +1,33 @@
+--- a/pylib/gyp/generator/cmake.py
++++ b/pylib/gyp/generator/cmake.py
+@@ -40,9 +40,9 @@
+ 
+ try:
+   # maketrans moved to str in python3.
++  _maketrans = str.maketrans
++except NameError:
+   _maketrans = string.maketrans
+-except NameError:
+-  _maketrans = str.maketrans
+ 
+ generator_default_variables = {
+   'EXECUTABLE_PREFIX': '',
+@@ -281,7 +281,7 @@
+     dirs = set(dir for dir in (os.path.dirname(o) for o in outputs) if dir)
+ 
+     if int(action.get('process_outputs_as_sources', False)):
+-      extra_sources.extend(zip(cmake_outputs, outputs))
++      extra_sources.extend(list(zip(cmake_outputs, outputs)))
+ 
+     # add_custom_command
+     output.write('add_custom_command(OUTPUT ')
+@@ -987,7 +987,7 @@
+ 
+     # XCode settings
+     xcode_settings = config.get('xcode_settings', {})
+-    for xcode_setting, xcode_value in xcode_settings.viewitems():
++    for xcode_setting, xcode_value in xcode_settings.items():
+       SetTargetProperty(output, cmake_target_name,
+                         "XCODE_ATTRIBUTE_%s" % xcode_setting, xcode_value,
+                         '' if isinstance(xcode_value, str) else ' ')
+
diff --git a/gyp-ninja-build.patch b/gyp-ninja-build.patch
new file mode 100644
index 0000000..74d8522
--- /dev/null
+++ b/gyp-ninja-build.patch
@@ -0,0 +1,26 @@
+diff -pruN gyp-0.1-gitfcd686f1.orig/pylib/gyp/generator/ninja.py gyp-0.1-gitfcd686f1/pylib/gyp/generator/ninja.py
+--- gyp-0.1-gitfcd686f1.orig/pylib/gyp/generator/ninja.py	2019-08-14 09:05:50.000000000 +0000
++++ gyp-0.1-gitfcd686f1/pylib/gyp/generator/ninja.py	2019-08-14 09:19:26.668031638 +0000
+@@ -2073,11 +2073,11 @@ def GenerateOutputForConfig(target_list,
+     # .c files. This should be handled by mspdbsrv, but rarely errors out with
+     #   c1xx : fatal error C1033: cannot open program database
+     # By making the rules target separate pdb files this might be avoided.
+-    cc_command = ('ninja -t msvc -e $arch ' +
++    cc_command = ('ninja-build -t msvc -e $arch ' +
+                   '-- '
+                   '$cc /nologo /showIncludes /FC '
+                   '@$out.rsp /c $in /Fo$out /Fd$pdbname_c ')
+-    cxx_command = ('ninja -t msvc -e $arch ' +
++    cxx_command = ('ninja-build -t msvc -e $arch ' +
+                    '-- '
+                    '$cxx /nologo /showIncludes /FC '
+                    '@$out.rsp /c $in /Fo$out /Fd$pdbname_cc ')
+@@ -2453,7 +2453,7 @@ def PerformBuild(data, configurations, p
+   options = params['options']
+   for config in configurations:
+     builddir = os.path.join(options.toplevel_dir, 'out', config)
+-    arguments = ['ninja', '-C', builddir]
++    arguments = ['ninja-build', '-C', builddir]
+     print('Building [%s]: %s' % (config, arguments))
+     subprocess.check_call(arguments)
+ 
diff --git a/gyp-python3.patch b/gyp-python3.patch
new file mode 100644
index 0000000..6235b82
--- /dev/null
+++ b/gyp-python3.patch
@@ -0,0 +1,36 @@
+diff -pruN gyp-0.1-gitfcd686f1.orig/gyp gyp-0.1-gitfcd686f1/gyp
+--- gyp-0.1-gitfcd686f1.orig/gyp	2015-04-30 09:48:21.000000000 +0000
++++ gyp-0.1-gitfcd686f1/gyp	2019-08-14 09:41:05.343208034 +0000
+@@ -5,4 +5,4 @@
+ 
+ set -e
+ base=$(dirname "$0")
+-exec python "${base}/gyp_main.py" "$@"
++exec python3 "${base}/gyp_main.py" "$@"
+diff -pruN gyp-0.1-gitfcd686f1.orig/gyp_main.py gyp-0.1-gitfcd686f1/gyp_main.py
+--- gyp-0.1-gitfcd686f1.orig/gyp_main.py	2016-10-17 02:00:37.000000000 +0000
++++ gyp-0.1-gitfcd686f1/gyp_main.py	2019-08-14 09:41:43.380207320 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ 
+ # Copyright (c) 2009 Google Inc. All rights reserved.
+ # Use of this source code is governed by a BSD-style license that can be
+diff -pruN gyp-0.1-gitfcd686f1.orig/gyptest.py gyp-0.1-gitfcd686f1/gyptest.py
+--- gyp-0.1-gitfcd686f1.orig/gyptest.py	2019-08-14 09:05:50.000000000 +0000
++++ gyp-0.1-gitfcd686f1/gyptest.py	2019-08-14 09:41:48.578208719 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # Copyright (c) 2012 Google Inc. All rights reserved.
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+diff -pruN gyp-0.1-gitfcd686f1.orig/setup.py gyp-0.1-gitfcd686f1/setup.py
+--- gyp-0.1-gitfcd686f1.orig/setup.py	2015-04-30 09:48:21.000000000 +0000
++++ gyp-0.1-gitfcd686f1/setup.py	2019-08-14 09:41:53.510210046 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ 
+ # Copyright (c) 2009 Google Inc. All rights reserved.
+ # Use of this source code is governed by a BSD-style license that can be
diff --git a/gyp-python38.patch b/gyp-python38.patch
new file mode 100644
index 0000000..e1dc703
--- /dev/null
+++ b/gyp-python38.patch
@@ -0,0 +1,63 @@
+commit 7b0a3fd85beb67c990da3fb1b690444a27a6ee42
+Author: Tom Hughes <tom at compton.nu>
+Date:   Fri Aug 23 09:33:14 2019 +0100
+
+    Fix python 3.8 warnings
+
+diff --git a/pylib/gyp/input.py b/pylib/gyp/input.py
+index 42c279cf..013231dc 100644
+--- a/pylib/gyp/input.py
++++ b/pylib/gyp/input.py
+@@ -1181,7 +1181,7 @@ def LoadVariablesFromVariablesDict(variables, the_dict, the_dict_key):
+       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.
+diff --git a/test/lib/TestCmd.py b/test/lib/TestCmd.py
+index 1ec50933..457694c8 100644
+--- a/test/lib/TestCmd.py
++++ b/test/lib/TestCmd.py
+@@ -283,7 +283,7 @@ if os.name in ('posix', 'nt'):
+ else:
+     tempfile.template = 'testcmd.'
+ 
+-re_space = re.compile('\s')
++re_space = re.compile(r'\s')
+ 
+ _Cleanup = []
+ 
+@@ -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']
+@@ -1103,7 +1103,7 @@ class TestCmd(object):
+         the temporary working directories to be preserved for all
+         conditions.
+         """
+-        if conditions is ():
++        if len(conditions) == 0:
+             conditions = ('pass_test', 'fail_test', 'no_result')
+         for cond in conditions:
+             self._preserve[cond] = 1
+diff --git a/test/lib/TestGyp.py b/test/lib/TestGyp.py
+index cba2d3cc..43865ee1 100644
+--- a/test/lib/TestGyp.py
++++ b/test/lib/TestGyp.py
+@@ -742,7 +742,7 @@ def FindVisualStudioInstallation():
+           build_tool = None
+       if not build_tool:
+         args1 = ['reg', 'query',
+-                    'HKLM\Software\Microsoft\VisualStudio\SxS\VS7',
++                    r'HKLM\Software\Microsoft\VisualStudio\SxS\VS7',
+                     '/v', '15.0', '/reg:32']
+         build_tool = subprocess.check_output(args1).decode(
+             'utf-8', 'ignore').strip().split(b'\r\n').pop().split(b' ').pop()
diff --git a/gyp-python39.patch b/gyp-python39.patch
new file mode 100644
index 0000000..cb5f2e1
--- /dev/null
+++ b/gyp-python39.patch
@@ -0,0 +1,55 @@
+diff --git a/pylib/gyp/common.py b/pylib/gyp/common.py
+index b268d229..03c99cab 100644
+--- a/pylib/gyp/common.py
++++ b/pylib/gyp/common.py
+@@ -4,7 +4,6 @@
+ 
+ from __future__ import with_statement
+ 
+-import collections
+ import errno
+ import filecmp
+ import os.path
+@@ -12,6 +11,11 @@ import re
+ import tempfile
+ import sys
+ 
++try:
++  from collections.abc import MutableSet
++except ImportError:
++  from collections import MutableSet
++
+ 
+ # A minimal memoizing decorator. It'll blow up if the args aren't immutable,
+ # among other "problems".
+@@ -494,7 +498,7 @@ def uniquer(seq, idfun=None):
+ 
+ 
+ # Based on http://code.activestate.com/recipes/576694/.
+-class OrderedSet(collections.MutableSet):
++class OrderedSet(MutableSet):
+   def __init__(self, iterable=None):
+     self.end = end = []
+     end += [None, end, end]         # sentinel node for doubly linked list
+diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py
+index 843e7067..327fe8d2 100644
+--- a/pylib/gyp/generator/msvs.py
++++ b/pylib/gyp/generator/msvs.py
+@@ -4,7 +4,7 @@
+ 
+ from __future__ import print_function
+ 
+-import collections
++from collections import OrderedDict
+ import copy
+ import ntpath
+ import os
+@@ -195,7 +195,7 @@ def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None,
+   if not prefix: prefix = []
+   result = []
+   excluded_result = []
+-  folders = collections.OrderedDict()
++  folders = OrderedDict()
+   # Gather files into the final result, excluded, or folders.
+   for s in sources:
+     if len(s) == 1:
diff --git a/gyp-rpmoptflags.patch b/gyp-rpmoptflags.patch
new file mode 100644
index 0000000..b2246e8
--- /dev/null
+++ b/gyp-rpmoptflags.patch
@@ -0,0 +1,32 @@
+diff -pruN gyp.orig/pylib/gyp/generator/make.py gyp/pylib/gyp/generator/make.py
+--- gyp.orig/pylib/gyp/generator/make.py	2011-08-23 16:47:59.000000000 +0900
++++ gyp/pylib/gyp/generator/make.py	2011-08-23 17:31:13.000000000 +0900
+@@ -1554,6 +1554,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)
+     # Write configuration-specific variables for CFLAGS, etc.
+     for configname in sorted(configs.keys()):
+       config = configs[configname]
++      rpmoptflags = ['$(RPM_OPT_FLAGS)']
+       self.WriteList(config.get('defines'), 'DEFS_%s' % configname, prefix='-D',
+           quoter=EscapeCppDefine)
+ 
+@@ -1565,8 +1566,20 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)
+         cflags_objcc = self.xcode_settings.GetCflagsObjCC(configname)
+       else:
+         cflags = config.get('cflags')
++        if cflags:
++          cflags += rpmoptflags
++        else:
++          cflags = rpmoptflags
+         cflags_c = config.get('cflags_c')
++        if cflags_c:
++          cflags_c += rpmoptflags
++        else:
++          cflags_c = rpmoptflags
+         cflags_cc = config.get('cflags_cc')
++        if cflags_cc:
++          cflags_cc += rpmoptflags
++        else:
++          cflags_cc = rpmoptflags
+ 
+       self.WriteLn("# Flags passed to all source files.");
+       self.WriteList(cflags, 'CFLAGS_%s' % configname)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/gyp.git/commitdiff/f33fa2297eeabf2913dd0fd26fd63e7bd97e722d



More information about the pld-cvs-commit mailing list