pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/url2pkg/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Thu Oct  3 18:28:29 UTC 2019

Modified Files:
        pkgsrc/pkgtools/url2pkg/files: url2pkg.py url2pkg_test.py

Log Message:
pkgtools/url2pkg: ignore commented variables


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 pkgsrc/pkgtools/url2pkg/files/url2pkg.py
cvs rdiff -u -r1.4 -r1.5 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.5 pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.6
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.5        Thu Oct  3 16:43:58 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.py    Thu Oct  3 18:28:29 2019
@@ -1,5 +1,5 @@
 #! @PYTHONBIN@
-# $NetBSD: url2pkg.py,v 1.5 2019/10/03 16:43:58 rillig Exp $
+# $NetBSD: url2pkg.py,v 1.6 2019/10/03 18:28:29 rillig Exp $
 
 # Copyright (c) 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -386,7 +386,7 @@ class Lines:
         string.
         """
         varassign = self.unique_varassign(varname)
-        return varassign.value if varassign is not None else ''
+        return varassign.value if varassign is not None and varassign.varname == varname else ''
 
     def remove_if(self, varname: str, expected_value: str) -> bool:
         """ Removes a variable assignment if its value is the expected one. """
@@ -775,7 +775,7 @@ class Adjuster:
 
         lines = Lines(*self.makefile_lines.lines[: marker_index])
 
-        if lines.index(r'^PKGNAME=') == -1:
+        if lines.get('PKGNAME=') == '':
             distname_index = lines.index(r'^DISTNAME=(\t+)')
             if distname_index != -1:
                 pkgname_line = 'PKGNAME=\t%s${DISTNAME%s}' % (self.pkgname_prefix, self.pkgname_transform)

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.4 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.5
--- pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.4   Thu Oct  3 16:43:58 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py       Thu Oct  3 18:28:29 2019
@@ -1,4 +1,4 @@
-# $NetBSD: url2pkg_test.py,v 1.4 2019/10/03 16:43:58 rillig Exp $
+# $NetBSD: url2pkg_test.py,v 1.5 2019/10/03 18:28:29 rillig Exp $
 
 from url2pkg import *
 
@@ -250,12 +250,14 @@ def test_Lines_get():
     lines = Lines(
         "VAR=value",
         "VAR=\tvalue # comment",
-        "UNIQUE=\tunique"
+        "UNIQUE=\tunique",
+        "#COMMENTED=\tvalue",
     )
 
     assert lines.get("VAR") == ""  # too many values
     assert lines.get("ENOENT") == ""  # no value at all
     assert lines.get("UNIQUE") == "unique"
+    assert lines.get("COMMENTED") == ""  # commented out
 
 
 def test_generate_initial_package_Makefile_lines__GitHub_archive():



Home | Main Index | Thread Index | Old Index