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 20.3.0
details: https://anonhg.NetBSD.org/pkgsrc/rev/de037ae01fc1
branches: trunk
changeset: 440755:de037ae01fc1
user: rillig <rillig%pkgsrc.org@localhost>
date: Sat Oct 17 22:39:00 2020 +0000
description:
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
diffstat:
pkgtools/url2pkg/Makefile | 5 +-
pkgtools/url2pkg/files/url2pkg.py | 33 +++++++++++++++++---
pkgtools/url2pkg/files/url2pkg_test.py | 55 +++++++++++++++++++++++++++++++--
3 files changed, 81 insertions(+), 12 deletions(-)
diffs (146 lines):
diff -r fe2c21f7ce19 -r de037ae01fc1 pkgtools/url2pkg/Makefile
--- a/pkgtools/url2pkg/Makefile Sat Oct 17 22:03:31 2020 +0000
+++ b/pkgtools/url2pkg/Makefile Sat Oct 17 22:39:00 2020 +0000
@@ -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
diff -r fe2c21f7ce19 -r de037ae01fc1 pkgtools/url2pkg/files/url2pkg.py
--- a/pkgtools/url2pkg/files/url2pkg.py Sat Oct 17 22:03:31 2020 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.py Sat Oct 17 22:39:00 2020 +0000
@@ -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 @@
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 @@
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}}}'
diff -r fe2c21f7ce19 -r de037ae01fc1 pkgtools/url2pkg/files/url2pkg_test.py
--- a/pkgtools/url2pkg/files/url2pkg_test.py Sat Oct 17 22:03:31 2020 +0000
+++ b/pkgtools/url2pkg/files/url2pkg_test.py Sat Oct 17 22:39:00 2020 +0000
@@ -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 @@
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