summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/plus_build_version/files/010-only-first-line6
-rw-r--r--regress/plus_build_version/files/020-short-name6
-rw-r--r--regress/plus_build_version/files/021-long-name7
-rw-r--r--regress/plus_build_version/files/030-missing-colon-or-dollar7
-rw-r--r--regress/plus_build_version/files/040-missing-dollar-after-colon7
-rw-r--r--regress/plus_build_version/files/050-cvs4
-rw-r--r--regress/plus_build_version/files/expected5
-rw-r--r--regress/plus_build_version/spec42
8 files changed, 84 insertions, 0 deletions
diff --git a/regress/plus_build_version/files/010-only-first-line b/regress/plus_build_version/files/010-only-first-line
new file mode 100644
index 00000000000..2575fc19910
--- /dev/null
+++ b/regress/plus_build_version/files/010-only-first-line
@@ -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.
diff --git a/regress/plus_build_version/files/020-short-name b/regress/plus_build_version/files/020-short-name
new file mode 100644
index 00000000000..4bc1d5206f6
--- /dev/null
+++ b/regress/plus_build_version/files/020-short-name
@@ -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
diff --git a/regress/plus_build_version/files/021-long-name b/regress/plus_build_version/files/021-long-name
new file mode 100644
index 00000000000..0c969c1657c
--- /dev/null
+++ b/regress/plus_build_version/files/021-long-name
@@ -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$
diff --git a/regress/plus_build_version/files/030-missing-colon-or-dollar b/regress/plus_build_version/files/030-missing-colon-or-dollar
new file mode 100644
index 00000000000..b095a93ff27
--- /dev/null
+++ b/regress/plus_build_version/files/030-missing-colon-or-dollar
@@ -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
diff --git a/regress/plus_build_version/files/040-missing-dollar-after-colon b/regress/plus_build_version/files/040-missing-dollar-after-colon
new file mode 100644
index 00000000000..535cc701fb7
--- /dev/null
+++ b/regress/plus_build_version/files/040-missing-dollar-after-colon
@@ -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:
diff --git a/regress/plus_build_version/files/050-cvs b/regress/plus_build_version/files/050-cvs
new file mode 100644
index 00000000000..07a3a2c3dff
--- /dev/null
+++ b/regress/plus_build_version/files/050-cvs
@@ -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 $
diff --git a/regress/plus_build_version/files/expected b/regress/plus_build_version/files/expected
new file mode 100644
index 00000000000..92f1dba2f75
--- /dev/null
+++ b/regress/plus_build_version/files/expected
@@ -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*
diff --git a/regress/plus_build_version/spec b/regress/plus_build_version/spec
new file mode 100644
index 00000000000..d99fb982da2
--- /dev/null
+++ b/regress/plus_build_version/spec
@@ -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"
+}