pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/url2pkg



Module Name:    pkgsrc
Committed By:   rillig
Date:           Fri May 10 06:33:04 UTC 2024

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

Log Message:
pkgtools/url2pkg: use deterministic filesystem lookups

Some filesystems return the filenames in unsorted order, so sort each
result of a 'glob' call. Reported by Adam Ciarcinski.

When looking for candidates for a package in the pkgsrc tree, only
consider directories that contain a Makefile. One of the url2pkg tests
looks for pkglint, and while a 'cvs update' is running, there is an old
entry 'devel/pkglint' in the filesystem that made the test fail.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 pkgsrc/pkgtools/url2pkg/Makefile
cvs rdiff -u -r1.54 -r1.55 pkgsrc/pkgtools/url2pkg/files/url2pkg.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/Makefile
diff -u pkgsrc/pkgtools/url2pkg/Makefile:1.137 pkgsrc/pkgtools/url2pkg/Makefile:1.138
--- pkgsrc/pkgtools/url2pkg/Makefile:1.137      Fri May 10 05:06:12 2024
+++ pkgsrc/pkgtools/url2pkg/Makefile    Fri May 10 06:33:04 2024
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.137 2024/05/10 05:06:12 adam Exp $
+# $NetBSD: Makefile,v 1.138 2024/05/10 06:33:04 rillig Exp $
 
-PKGNAME=       url2pkg-23.3.0
+PKGNAME=       url2pkg-23.3.1
 CATEGORIES=    pkgtools
 
 MAINTAINER=    rillig%NetBSD.org@localhost

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.54 pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.55
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.54       Wed Jan 17 21:01:07 2024
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.py    Fri May 10 06:33:04 2024
@@ -1,5 +1,5 @@
 #! @PYTHONBIN@
-# $NetBSD: url2pkg.py,v 1.54 2024/01/17 21:01:07 rillig Exp $
+# $NetBSD: url2pkg.py,v 1.55 2024/05/10 06:33:04 rillig Exp $
 
 # Copyright (c) 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -100,9 +100,11 @@ class Globals:
             self.err.write(f'url2pkg: {msg}\n')
 
     def find_package(self, pkgbase: str) -> str:
-        candidates = list(self.pkgsrcdir.glob(f'*/{pkgbase}'))
-        self.debug('candidates for package {0} are {1}', pkgbase, candidates)
+        makefiles = sorted(self.pkgsrcdir.glob(f'*/{pkgbase}/Makefile'))
+        candidates = [p.parent for p in makefiles]
         if len(candidates) != 1:
+            self.debug('candidates for package {0} are {1}',
+                       pkgbase, candidates)
             return ''
         return str(candidates[0]).replace(str(self.pkgsrcdir), '../..')
 
@@ -896,7 +898,7 @@ class Adjuster:
         def search(f):
             return re.search(what, f) if type(what) == str else what(f)
 
-        return list(sorted(filter(search, self.wrksrc_files)))
+        return sorted(filter(search, self.wrksrc_files))
 
     def wrksrc_grep(self, filename: str,
                     pattern: str) -> List[Union[str, List[str]]]:
@@ -1127,10 +1129,8 @@ class Adjuster:
         Sets abs_wrksrc depending on abs_wrkdir and the files found there.
         """
 
-        def relevant(f: Union[Path, Any]) -> bool:
-            return f.is_dir() and not f.name.startswith('.')
-
-        subdirs = [f.name for f in self.abs_wrkdir.glob('*') if relevant(f)]
+        subdirs = sorted([f.name for f in self.abs_wrkdir.glob('*')
+                          if f.is_dir() and not f.name.startswith('.')])
 
         if len(subdirs) == 1:
             if subdirs[0] != self.makefile_lines.get('DISTNAME'):
@@ -1247,7 +1247,7 @@ class Adjuster:
                  only: Callable[[Path], bool]) -> List[str]:
             relevant = (f for f in basedir.rglob('*') if only(f))
             relative = (str(f.relative_to(basedir)) for f in relevant)
-            return list(sorted((f for f in relative if not f.startswith('.'))))
+            return sorted((f for f in relative if not f.startswith('.')))
 
         self.g.debug('Adjusting the Makefile')
         self.makefile_lines = Lines.read_from(self.g.pkgdir / 'Makefile')



Home | Main Index | Thread Index | Old Index