pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/regress/plus_build_version regress/plus_build_version:...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/262d4b414070
branches:  trunk
changeset: 347438:262d4b414070
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Jan 11 12:24:32 2020 +0000

description:
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.

diffstat:

 regress/plus_build_version/files/010-only-first-line            |   6 +
 regress/plus_build_version/files/020-short-name                 |   6 +
 regress/plus_build_version/files/021-long-name                  |   7 +
 regress/plus_build_version/files/030-missing-colon-or-dollar    |   7 +
 regress/plus_build_version/files/040-missing-dollar-after-colon |   7 +
 regress/plus_build_version/files/050-cvs                        |   4 +
 regress/plus_build_version/files/expected                       |   5 +
 regress/plus_build_version/spec                                 |  42 ++++++++++
 8 files changed, 84 insertions(+), 0 deletions(-)

diffs (116 lines):

diff -r 1195b6201819 -r 262d4b414070 regress/plus_build_version/files/010-only-first-line
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/plus_build_version/files/010-only-first-line      Sat Jan 11 12:24:32 2020 +0000
@@ -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 -r 1195b6201819 -r 262d4b414070 regress/plus_build_version/files/020-short-name
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/plus_build_version/files/020-short-name   Sat Jan 11 12:24:32 2020 +0000
@@ -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 -r 1195b6201819 -r 262d4b414070 regress/plus_build_version/files/021-long-name
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/plus_build_version/files/021-long-name    Sat Jan 11 12:24:32 2020 +0000
@@ -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 -r 1195b6201819 -r 262d4b414070 regress/plus_build_version/files/030-missing-colon-or-dollar
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/plus_build_version/files/030-missing-colon-or-dollar      Sat Jan 11 12:24:32 2020 +0000
@@ -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 -r 1195b6201819 -r 262d4b414070 regress/plus_build_version/files/040-missing-dollar-after-colon
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/plus_build_version/files/040-missing-dollar-after-colon   Sat Jan 11 12:24:32 2020 +0000
@@ -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 -r 1195b6201819 -r 262d4b414070 regress/plus_build_version/files/050-cvs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/plus_build_version/files/050-cvs  Sat Jan 11 12:24:32 2020 +0000
@@ -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 -r 1195b6201819 -r 262d4b414070 regress/plus_build_version/files/expected
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/plus_build_version/files/expected Sat Jan 11 12:24:32 2020 +0000
@@ -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 -r 1195b6201819 -r 262d4b414070 regress/plus_build_version/spec
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/plus_build_version/spec   Sat Jan 11 12:24:32 2020 +0000
@@ -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"
+}



Home | Main Index | Thread Index | Old Index