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:           Sat Nov 23 22:30:30 UTC 2024

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

Log Message:
pkgtools/url2pkg: update to 23.4.0

Changes since 23.3.3:

Place Rust dependencies in a separate file cargo-depends.mk.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 pkgsrc/pkgtools/url2pkg/Makefile
cvs rdiff -u -r1.56 -r1.57 pkgsrc/pkgtools/url2pkg/files/url2pkg.py
cvs rdiff -u -r1.52 -r1.53 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/Makefile
diff -u pkgsrc/pkgtools/url2pkg/Makefile:1.141 pkgsrc/pkgtools/url2pkg/Makefile:1.142
--- pkgsrc/pkgtools/url2pkg/Makefile:1.141      Sat Oct 26 19:05:45 2024
+++ pkgsrc/pkgtools/url2pkg/Makefile    Sat Nov 23 22:30:29 2024
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.141 2024/10/26 19:05:45 schmonz Exp $
+# $NetBSD: Makefile,v 1.142 2024/11/23 22:30:29 rillig Exp $
 
-PKGNAME=       url2pkg-23.3.3
+PKGNAME=       url2pkg-23.4.0
 CATEGORIES=    pkgtools
 
 MAINTAINER=    rillig%NetBSD.org@localhost

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.56 pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.57
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.56       Sat Oct 26 19:05:45 2024
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.py    Sat Nov 23 22:30:30 2024
@@ -1,5 +1,5 @@
 #! @PYTHONBIN@
-# $NetBSD: url2pkg.py,v 1.56 2024/10/26 19:05:45 schmonz Exp $
+# $NetBSD: url2pkg.py,v 1.57 2024/11/23 22:30:30 rillig Exp $
 
 # Copyright (c) 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -688,6 +688,9 @@ class Adjuster:
     tool_depends: List[str]
     test_depends: List[str]
 
+    # the Rust dependencies of the package, in the form "package-version".
+    cargo_crate_depends: List[str]
+
     # .include, interleaved with BUILDLINK3_API_DEPENDS.
     # These lines are added at the bottom of the Makefile.
     bl3_lines: List[str]
@@ -736,6 +739,7 @@ class Adjuster:
         self.build_depends = []
         self.tool_depends = []
         self.test_depends = []
+        self.cargo_crate_depends = []
         self.bl3_lines = []
         self.includes = []
         self.build_vars = []
@@ -862,7 +866,7 @@ class Adjuster:
             self.add_dependency(kind, pkgbase, constraint, dep_dir)
 
     def sort_dependencies(self):
-        def key(d):
+        def key(d: str) -> str:
             a = d.removeprefix('# TODO: ')
             return re.sub('[<>=].*', '', a)
 
@@ -870,6 +874,7 @@ class Adjuster:
         self.build_depends.sort(key=key)
         self.tool_depends.sort(key=key)
         self.test_depends.sort(key=key)
+        self.cargo_crate_depends.sort(key=key)
 
     def set_or_add(self, varname: str, value: str):
         if not self.makefile_lines.set(varname, value):
@@ -1083,9 +1088,7 @@ class Adjuster:
 
                 if re.match(r'^source\s=\s"(\S+)"', line):
                     if name != '' and version != '':
-                        self.build_vars.append(Var(
-                            'CARGO_CRATE_DEPENDS', '+=', f'{name}-{version}'
-                        ))
+                        self.cargo_crate_depends.append(f'{name}-{version}')
                     name = ''
                     version = ''
 
@@ -1229,6 +1232,10 @@ class Adjuster:
         lines.add_vars(*build_vars)
         lines.add_vars(*self.extra_vars)
 
+        if self.cargo_crate_depends:
+            lines.add('.include "cargo-depends.mk"')
+            lines.add('')
+
         lines.add(*self.bl3_lines)
         lines.add(*(f'.include "{include}"' for include in self.includes))
 
@@ -1274,6 +1281,14 @@ class Adjuster:
         descr = (self.g.pkgdir / 'DESCR')
         descr.is_file() or Lines(*self.descr_lines).write_to(descr)
 
+        if self.cargo_crate_depends:
+            lines = Lines()
+            lines.add('# $NetBSD: url2pkg.py,v 1.57 2024/11/23 22:30:30 rillig Exp $')
+            lines.add('')
+            for dep in self.cargo_crate_depends:
+                lines.add(f'CARGO_CRATE_DEPENDS+=\t{dep}')
+            lines.write_to(self.g.pkgdir / 'cargo-depends.mk')
+
         if self.regenerate_distinfo:
             self.g.bmake('distinfo')
 

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.52 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.53
--- pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.52  Sat Oct 26 19:05:45 2024
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py       Sat Nov 23 22:30:30 2024
@@ -1,4 +1,4 @@
-# $NetBSD: url2pkg_test.py,v 1.52 2024/10/26 19:05:45 schmonz Exp $
+# $NetBSD: url2pkg_test.py,v 1.53 2024/11/23 22:30:30 rillig Exp $
 
 # URLs for manual testing:
 #
@@ -1063,7 +1063,7 @@ def test_Adjuster_adjust_cargo__not_foun
 
     adjuster.adjust_cargo()
 
-    assert str_vars(adjuster.build_vars) == []
+    assert adjuster.cargo_crate_depends == []
 
 
 def test_Adjuster_adjust_cargo__before_0_39(tmp_path: Path):
@@ -1089,8 +1089,8 @@ def test_Adjuster_adjust_cargo__before_0
 
     adjuster.adjust_cargo()
 
-    assert str_vars(adjuster.build_vars) == [
-        'CARGO_CRATE_DEPENDS+=aes-ctr-0.3.0',
+    assert adjuster.cargo_crate_depends == [
+        'aes-ctr-0.3.0',
     ]
 
 
@@ -1119,8 +1119,8 @@ def test_Adjuster_adjust_cargo__since_0_
 
     adjuster.adjust_cargo()
 
-    assert str_vars(adjuster.build_vars) == [
-        'CARGO_CRATE_DEPENDS+=aes-ctr-0.3.0',
+    assert adjuster.cargo_crate_depends == [
+        'aes-ctr-0.3.0',
     ]
 
 



Home | Main Index | Thread Index | Old Index