pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg pkgtools/url2pkg: update to 19.3.7



details:   https://anonhg.NetBSD.org/pkgsrc/rev/31e908bf5142
branches:  trunk
changeset: 344266:31e908bf5142
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Nov 18 07:50:51 2019 +0000

description:
pkgtools/url2pkg: update to 19.3.7

Changes since 19.3.6:

Detect whether the package uses GNU Make, based on the top-level
Makefile.

diffstat:

 pkgtools/url2pkg/Makefile              |   4 ++--
 pkgtools/url2pkg/files/url2pkg.py      |  18 +++++++++++++++---
 pkgtools/url2pkg/files/url2pkg_test.py |  12 +++++++++++-
 3 files changed, 28 insertions(+), 6 deletions(-)

diffs (106 lines):

diff -r d144c0880cf2 -r 31e908bf5142 pkgtools/url2pkg/Makefile
--- a/pkgtools/url2pkg/Makefile Mon Nov 18 04:51:59 2019 +0000
+++ b/pkgtools/url2pkg/Makefile Mon Nov 18 07:50:51 2019 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.109 2019/11/14 20:03:47 rillig Exp $
+# $NetBSD: Makefile,v 1.110 2019/11/18 07:50:51 rillig Exp $
 
-PKGNAME=       url2pkg-19.3.6
+PKGNAME=       url2pkg-19.3.7
 CATEGORIES=    pkgtools
 
 MAINTAINER=    rillig%NetBSD.org@localhost
diff -r d144c0880cf2 -r 31e908bf5142 pkgtools/url2pkg/files/url2pkg.py
--- a/pkgtools/url2pkg/files/url2pkg.py Mon Nov 18 04:51:59 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.py Mon Nov 18 07:50:51 2019 +0000
@@ -1,5 +1,5 @@
 #! @PYTHONBIN@
-# $NetBSD: url2pkg.py,v 1.26 2019/11/14 20:03:47 rillig Exp $
+# $NetBSD: url2pkg.py,v 1.27 2019/11/18 07:50:51 rillig Exp $
 
 # Copyright (c) 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -47,7 +47,7 @@
 import subprocess
 import sys
 from pathlib import Path
-from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Union
+from typing import Any, Callable, Dict, List, NamedTuple, Optional, Set, Tuple, Union
 
 
 class Var(NamedTuple):
@@ -603,6 +603,9 @@
     # All these files will be included at the bottom of the Makefile.
     includes: List[str]
 
+    # the tools for USE_TOOLS. Examples are sed, echo, printf, perl5.
+    tools: Set[str]
+
     # a list of variable assignments that will make up the fourth
     # paragraph of the package Makefile, where the build configuration
     # takes place.
@@ -642,6 +645,7 @@
         self.bl3_lines = []
         self.includes = []
         self.build_vars = []
+        self.tools = set()
         self.extra_vars = []
         self.todos = []
         self.pkgname_prefix = ''
@@ -817,6 +821,10 @@
         if self.wrksrc_isfile('CMakeLists.txt'):
             self.build_vars.append(Var('USE_CMAKE', '=', 'yes'))
 
+    def adjust_gnu_make(self):
+        if self.wrksrc_isfile('Makefile') and self.wrksrc_grep('Makefile', r'^(?:ifeq|ifdef)\b'):
+            self.tools.add('gmake')
+
     def adjust_meson(self):
         if self.wrksrc_isfile('meson.build'):
             self.includes.append('../../devel/meson/build.mk')
@@ -1042,7 +1050,10 @@
         depend_vars.extend(Var('TEST_DEPENDS', '+=', d) for d in self.test_depends)
         lines.add_vars(*depend_vars)
 
-        lines.add_vars(*self.build_vars)
+        build_vars = self.build_vars
+        if self.tools:
+            build_vars.append(Var('USE_TOOLS', '+=', ' '.join(sorted(self.tools))))
+        lines.add_vars(*build_vars)
         lines.add_vars(*self.extra_vars)
 
         lines.add(*self.bl3_lines)
@@ -1074,6 +1085,7 @@
         self.adjust_descr()
         self.adjust_configure()
         self.adjust_cmake()
+        self.adjust_gnu_make()
         self.adjust_meson()
         self.adjust_gconf2_schemas()
         self.adjust_libtool()
diff -r d144c0880cf2 -r 31e908bf5142 pkgtools/url2pkg/files/url2pkg_test.py
--- a/pkgtools/url2pkg/files/url2pkg_test.py    Mon Nov 18 04:51:59 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg_test.py    Mon Nov 18 07:50:51 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: url2pkg_test.py,v 1.24 2019/10/28 20:17:24 rillig Exp $
+# $NetBSD: url2pkg_test.py,v 1.25 2019/11/18 07:50:51 rillig Exp $
 
 import pytest
 from url2pkg import *
@@ -889,6 +889,16 @@
     assert str_vars(adjuster.build_vars) == ['USE_CMAKE=yes']
 
 
+def test_Adjuster_adjust_gnu_make(tmp_path: Path):
+    adjuster = Adjuster(g, '', Lines())
+    adjuster.abs_wrksrc = tmp_path
+    (tmp_path / 'Makefile').write_text('ifdef HAVE_STDIO_H')
+
+    adjuster.adjust_gnu_make()
+
+    assert adjuster.tools == {'gmake'}
+
+
 def test_Adjuster_adjust_configure__none(tmp_path: Path):
     adjuster = Adjuster(g, '', Lines())
     adjuster.abs_wrksrc = tmp_path



Home | Main Index | Thread Index | Old Index