pkgsrc-Changes archive

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

CVS commit: pkgsrc/regress/plus_build_version



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sat Jan 11 12:24:32 UTC 2020

Added Files:
        pkgsrc/regress/plus_build_version: spec
        pkgsrc/regress/plus_build_version/files: 010-only-first-line
            020-short-name 021-long-name 030-missing-colon-or-dollar
            040-missing-dollar-after-colon 050-cvs expected

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/regress/plus_build_version/spec
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/regress/plus_build_version/files/010-only-first-line \
    pkgsrc/regress/plus_build_version/files/020-short-name \
    pkgsrc/regress/plus_build_version/files/021-long-name \
    pkgsrc/regress/plus_build_version/files/030-missing-colon-or-dollar \
    pkgsrc/regress/plus_build_version/files/040-missing-dollar-after-colon \
    pkgsrc/regress/plus_build_version/files/050-cvs \
    pkgsrc/regress/plus_build_version/files/expected

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/regress/plus_build_version/spec
diff -u /dev/null pkgsrc/regress/plus_build_version/spec:1.1
--- /dev/null   Sat Jan 11 12:24:32 2020
+++ pkgsrc/regress/plus_build_version/spec      Sat Jan 11 12:24:32 2020
@@ -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"
+}

Index: pkgsrc/regress/plus_build_version/files/010-only-first-line
diff -u /dev/null pkgsrc/regress/plus_build_version/files/010-only-first-line:1.1
--- /dev/null   Sat Jan 11 12:24:32 2020
+++ pkgsrc/regress/plus_build_version/files/010-only-first-line Sat Jan 11 12:24:32 2020
@@ -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.
Index: pkgsrc/regress/plus_build_version/files/020-short-name
diff -u /dev/null pkgsrc/regress/plus_build_version/files/020-short-name:1.1
--- /dev/null   Sat Jan 11 12:24:32 2020
+++ pkgsrc/regress/plus_build_version/files/020-short-name      Sat Jan 11 12:24:32 2020
@@ -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
Index: pkgsrc/regress/plus_build_version/files/021-long-name
diff -u /dev/null pkgsrc/regress/plus_build_version/files/021-long-name:1.1
--- /dev/null   Sat Jan 11 12:24:32 2020
+++ pkgsrc/regress/plus_build_version/files/021-long-name       Sat Jan 11 12:24:32 2020
@@ -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$
Index: pkgsrc/regress/plus_build_version/files/030-missing-colon-or-dollar
diff -u /dev/null pkgsrc/regress/plus_build_version/files/030-missing-colon-or-dollar:1.1
--- /dev/null   Sat Jan 11 12:24:32 2020
+++ pkgsrc/regress/plus_build_version/files/030-missing-colon-or-dollar Sat Jan 11 12:24:32 2020
@@ -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
Index: pkgsrc/regress/plus_build_version/files/040-missing-dollar-after-colon
diff -u /dev/null pkgsrc/regress/plus_build_version/files/040-missing-dollar-after-colon:1.1
--- /dev/null   Sat Jan 11 12:24:32 2020
+++ pkgsrc/regress/plus_build_version/files/040-missing-dollar-after-colon      Sat Jan 11 12:24:32 2020
@@ -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:
Index: pkgsrc/regress/plus_build_version/files/050-cvs
diff -u /dev/null pkgsrc/regress/plus_build_version/files/050-cvs:1.1
--- /dev/null   Sat Jan 11 12:24:32 2020
+++ pkgsrc/regress/plus_build_version/files/050-cvs     Sat Jan 11 12:24:32 2020
@@ -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 $
Index: pkgsrc/regress/plus_build_version/files/expected
diff -u /dev/null pkgsrc/regress/plus_build_version/files/expected:1.1
--- /dev/null   Sat Jan 11 12:24:32 2020
+++ pkgsrc/regress/plus_build_version/files/expected    Sat Jan 11 12:24:32 2020
@@ -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*



Home | Main Index | Thread Index | Old Index