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 Oct 17 22:39:01 UTC 2020
Modified Files:
pkgsrc/pkgtools/url2pkg: Makefile
pkgsrc/pkgtools/url2pkg/files: url2pkg.py url2pkg_test.py
Log Message:
pkgtools/url2pkg: update to 20.3.0
Changes since 20.2.0:
Fixed detection for V2 Cargo.lock files. Patch provided by snow flurry
via tech-pkg, slightly adjusted. The test case for Cargo.lock file
detection had been incomplete and unrealistic. It has been extended to
show the relevant section of a whole package.
https://mail-index.netbsd.org/tech-pkg/2020/10/12/msg023897.html
https://mail-index.netbsd.org/tech-pkg/2020/10/13/msg023901.html
https://mail-index.netbsd.org/tech-pkg/2020/10/13/msg023902.html
To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 pkgsrc/pkgtools/url2pkg/Makefile
cvs rdiff -u -r1.27 -r1.28 pkgsrc/pkgtools/url2pkg/files/url2pkg.py
cvs rdiff -u -r1.26 -r1.27 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.114 pkgsrc/pkgtools/url2pkg/Makefile:1.115
--- pkgsrc/pkgtools/url2pkg/Makefile:1.114 Mon Aug 31 18:10:59 2020
+++ pkgsrc/pkgtools/url2pkg/Makefile Sat Oct 17 22:39:00 2020
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.114 2020/08/31 18:10:59 wiz Exp $
+# $NetBSD: Makefile,v 1.115 2020/10/17 22:39:00 rillig Exp $
-PKGNAME= url2pkg-20.2.0
-PKGREVISION= 1
+PKGNAME= url2pkg-20.3.0
CATEGORIES= pkgtools
MAINTAINER= rillig%NetBSD.org@localhost
Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.27 pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.28
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.27 Mon Nov 18 07:50:51 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.py Sat Oct 17 22:39:01 2020
@@ -1,5 +1,5 @@
#! @PYTHONBIN@
-# $NetBSD: url2pkg.py,v 1.27 2019/11/18 07:50:51 rillig Exp $
+# $NetBSD: url2pkg.py,v 1.28 2020/10/17 22:39:01 rillig Exp $
# Copyright (c) 2019 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -922,9 +922,32 @@ class Adjuster:
if not self.wrksrc_isfile('Cargo.lock'):
return
- # "checksum cargo-package-name cargo-package-version
- for (name, version) in self.wrksrc_grep('Cargo.lock', r'^"checksum\s(\S+)\s(\S+)'):
- self.build_vars.append(Var('CARGO_CRATE_DEPENDS', '+=', f'{name}-{version}'))
+ # pull name and version from package entries
+ with self.wrksrc_open('Cargo.lock') as f:
+ name = ''
+ version = ''
+ for line in f:
+ if line.startswith('[[package]]'):
+ # new package, reset name and version to be safe
+ name = ''
+ version = ''
+ continue
+
+ m = re.match(r'^name\s=\s"(\S+)"', line)
+ if m:
+ name = m[1]
+
+ m = re.match(r'^version\s=\s"(\S+)"', line)
+ if m:
+ version = m[1]
+
+ if re.match(r'^source\s=\s"(\S+)"', line):
+ if name != '' and version != '':
+ self.build_vars.append(Var(
+ 'CARGO_CRATE_DEPENDS', '+=', f'{name}-{version}'
+ ))
+ name = ''
+ version = ''
self.includes.append('../../lang/rust/cargo.mk')
@@ -1033,7 +1056,7 @@ class Adjuster:
lines = Lines(*self.makefile_lines.lines[: marker_index])
if lines.get('PKGNAME') == '' and \
- (self.pkgname_prefix != '' or self.pkgname_transform != ''):
+ (self.pkgname_prefix != '' or self.pkgname_transform != ''):
distname_index = lines.index(r'^DISTNAME=(\t+)')
if distname_index != -1:
pkgname_line = f'PKGNAME=\t{self.pkgname_prefix}${{DISTNAME{self.pkgname_transform}}}'
Index: pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.26 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.27
--- pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.26 Mon Nov 18 07:56:02 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py Sat Oct 17 22:39:01 2020
@@ -1,7 +1,8 @@
-# $NetBSD: url2pkg_test.py,v 1.26 2019/11/18 07:56:02 rillig Exp $
+# $NetBSD: url2pkg_test.py,v 1.27 2020/10/17 22:39:01 rillig Exp $
import pytest
from url2pkg import *
+from textwrap import dedent
mkcvsid = '# $''NetBSD$'
g: Globals
@@ -943,15 +944,61 @@ def test_Adjuster_adjust_cargo__not_foun
assert str_vars(adjuster.build_vars) == []
-def test_Adjuster_adjust_cargo__found(tmp_path: Path):
+def test_Adjuster_adjust_cargo__before_0_39(tmp_path: Path):
adjuster = Adjuster(g, '', Lines())
adjuster.abs_wrksrc = tmp_path
- (tmp_path / 'Cargo.lock').write_text('"checksum cargo-pkg 1.2.3 1234"')
+ (tmp_path / 'Cargo.lock').write_text(dedent('''\
+ [[package]]
+ name = "aes-ctr"
+ version = "0.3.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ dependencies = [
+ "aes-soft 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "aesni 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ctr 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "stream-cipher 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ ]
+
+ [metadata]
+ ...
+ "checksum aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "..."
+ ...
+ '''))
adjuster.adjust_cargo()
assert str_vars(adjuster.build_vars) == [
- 'CARGO_CRATE_DEPENDS+=cargo-pkg-1.2.3',
+ 'CARGO_CRATE_DEPENDS+=aes-ctr-0.3.0',
+ ]
+
+
+def test_Adjuster_adjust_cargo__since_0_39(tmp_path: Path):
+ """
+ https://github.com/rust-lang/cargo/pull/7070/commits/34bca035ae133abe7e62acd0e90698943d471080
+
+ There is no [metadata] section anymore.
+ The checksum has been moved directly into the [[package]] section.
+ """
+ adjuster = Adjuster(g, '', Lines())
+ adjuster.abs_wrksrc = tmp_path
+ (tmp_path / 'Cargo.lock').write_text(dedent('''\
+ [[package]]
+ name = "aes-ctr"
+ version = "0.3.0"
+ source = "registry+https://github.com/rust-lang/crates.io-index"
+ checksum = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee"
+ dependencies = [
+ "aes-soft",
+ "aesni",
+ "ctr",
+ "stream-cipher",
+ ]
+ '''))
+
+ adjuster.adjust_cargo()
+
+ assert str_vars(adjuster.build_vars) == [
+ 'CARGO_CRATE_DEPENDS+=aes-ctr-0.3.0',
]
Home |
Main Index |
Thread Index |
Old Index