regress/plus_build_version: RCS Id extraction for +BUILD_VERSION
In pkgtools/pkglint, there are several lines that look almost like RCS Ids. Some parts of the pkgsrc infrastructure expand them and some others don't. This needs to be fixed so that all parts of pkgsrc agree what is a complete RCS Id and what isn't. As long as that is not the case, pbulk unnecessarily builds pkglint over and over again, even if nothing changed. There are probably other unintended side effects as well that just haven't been discovered or considered grave enough.
This commit is contained in:
parent
8e0ae875e3
commit
155c26548f
8 changed files with 84 additions and 0 deletions
6
regress/plus_build_version/files/010-only-first-line
Normal file
6
regress/plus_build_version/files/010-only-first-line
Normal file
|
@ -0,0 +1,6 @@
|
|||
From each file, only the first RCS Id is extracted.
|
||||
|
||||
first $NetBSD: 010-only-first-line,v 1.1 2020/01/11 12:24:32 rillig Exp $
|
||||
second $NetBSD: 010-only-first-line,v 1.1 2020/01/11 12:24:32 rillig Exp $
|
||||
|
||||
For this reason, each of these test cases is in its own file.
|
6
regress/plus_build_version/files/020-short-name
Normal file
6
regress/plus_build_version/files/020-short-name
Normal file
|
@ -0,0 +1,6 @@
|
|||
The D at the end of the name is missing intentionally.
|
||||
|
||||
Because of this missing letter, this file does not get recorded in
|
||||
+BUILD_VERSION.
|
||||
|
||||
$NetBS
|
7
regress/plus_build_version/files/021-long-name
Normal file
7
regress/plus_build_version/files/021-long-name
Normal file
|
@ -0,0 +1,7 @@
|
|||
The RCS Id must be exactly NetBSD, not any longer name that happens to
|
||||
start with NetBSD. Only the exact name is expanded by CVS, therefore
|
||||
recording the other occurrences doesn't make sense.
|
||||
|
||||
As of January 2020, this line gets recorded nevertheless.
|
||||
|
||||
$NetBSDFoundation$
|
|
@ -0,0 +1,7 @@
|
|||
A complete RCS Id needs a colon or a dollar, otherwise it is not
|
||||
expanded.
|
||||
|
||||
As of January 2020, this line gets unnecessarily recorded in
|
||||
+BUILD_VERSION.
|
||||
|
||||
$NetBSD
|
|
@ -0,0 +1,7 @@
|
|||
Each RCS Id must end with a second dollar in the same line. Just having
|
||||
the colon is not enough.
|
||||
|
||||
As of January 2020, this line gets unnecessarily recorded in
|
||||
+BUILD_VERSION.
|
||||
|
||||
$NetBSD:
|
4
regress/plus_build_version/files/050-cvs
Normal file
4
regress/plus_build_version/files/050-cvs
Normal file
|
@ -0,0 +1,4 @@
|
|||
The default CVS Id is not taken into account for the package build
|
||||
versions, even though it is expanded(?).
|
||||
|
||||
$Id: 050-cvs,v 1.1 2020/01/11 12:24:32 rillig Exp $
|
5
regress/plus_build_version/files/expected
Normal file
5
regress/plus_build_version/files/expected
Normal file
|
@ -0,0 +1,5 @@
|
|||
regress/plus_build_version/files/010-only-first-line: *NetBSD*
|
||||
regress/plus_build_version/files/021-long-name: *NetBSDFoundation*
|
||||
regress/plus_build_version/files/030-missing-colon-or-dollar: *
|
||||
regress/plus_build_version/files/040-missing-dollar-after-colon: *
|
||||
regress/plus_build_version/spec: *NetBSD*
|
42
regress/plus_build_version/spec
Normal file
42
regress/plus_build_version/spec
Normal file
|
@ -0,0 +1,42 @@
|
|||
#! /bin/sh
|
||||
# $NetBSD: spec,v 1.1 2020/01/11 12:24:32 rillig Exp $
|
||||
|
||||
# This test demonstrates how the RCS Ids from the package files end up in
|
||||
# the +BUILD_VERSION file of the binary package.
|
||||
#
|
||||
# There are several places in pkgsrc that make use of these RCS Ids:
|
||||
#
|
||||
# * The SHA1 hash for a patch file ignores RCS Id lines.
|
||||
# * The RCS Ids end up in the +BUILD_VERSION of the binary package.
|
||||
# * The pbulk checks the RCS Ids to see whether the package needs to be
|
||||
# built again.
|
||||
#
|
||||
# All these places must use the same patterns for extracting the RCS Ids.
|
||||
# As of January 2020, they don't.
|
||||
|
||||
set -u
|
||||
|
||||
tmpdir="${TMPDIR-/tmp}/plus-build-version"
|
||||
actual="$tmpdir/.pkgdb/+BUILD_VERSION"
|
||||
|
||||
do_test() {
|
||||
rm -rf "$tmpdir"
|
||||
mkdir -p "$tmpdir/.pkgdb"
|
||||
$TEST_MAKE \
|
||||
PKGNAME="package-1.0" \
|
||||
WRKDIR="$tmpdir" \
|
||||
-f "../../mk/bsd.pkg.mk" \
|
||||
"$actual"
|
||||
}
|
||||
|
||||
check_result() {
|
||||
# In files/expected, the $ characters are replaced with * to
|
||||
# prevent them from being expanded by CVS.
|
||||
tr '*' '$' < "files/expected" > "$tmpdir/expected"
|
||||
|
||||
diff -u "$tmpdir/expected" "$actual" || regress_fail "differ"
|
||||
}
|
||||
|
||||
do_cleanup() {
|
||||
rm -rf "$tmpdir"
|
||||
}
|
Loading…
Reference in a new issue