Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/regress/infra-unittests mk/pkgformat/metadata.mk: fix ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4f9b9ec216d0
branches:  trunk
changeset: 432395:4f9b9ec216d0
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu May 21 18:48:43 2020 +0000

description:
mk/pkgformat/metadata.mk: fix relative paths in PATCHDIR and FILESDIR

Before, relative paths had been stored as-is.  This affected those
packages that defined PATCHDIR or FILESDIR as relative directory instead
of prefixing it with ${.CURDIR}.

Since there are already several other paths that are interpreted relative
to the package directory (CONFLICTS, DEPENDS), allow PATCHDIR and
FILESDIR to be specified as relative paths, too.  This makes the package
Makefiles a bit shorter.

diffstat:

 mk/pkgformat/pkg/metadata.mk                      |   8 ++++----
 regress/infra-unittests/pkgformat-pkg-metadata.sh |  12 +++++-------
 2 files changed, 9 insertions(+), 11 deletions(-)

diffs (72 lines):

diff -r a044d2c06eca -r 4f9b9ec216d0 mk/pkgformat/pkg/metadata.mk
--- a/mk/pkgformat/pkg/metadata.mk      Thu May 21 18:26:46 2020 +0000
+++ b/mk/pkgformat/pkg/metadata.mk      Thu May 21 18:48:43 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: metadata.mk,v 1.24 2020/05/15 22:13:39 maya Exp $
+# $NetBSD: metadata.mk,v 1.25 2020/05/21 18:48:43 rillig Exp $
 
 ######################################################################
 ### The targets below are all PRIVATE.
@@ -175,7 +175,7 @@
        ${RUN}${RM} -f ${.TARGET}.tmp
        ${RUN}                                                          \
        exec 1>>${.TARGET}.tmp;                                         \
-       for f in ${.CURDIR}/Makefile ${FILESDIR}/* ${PKGDIR}/*; do      \
+       for f in ${.CURDIR}/Makefile ${FILESDIR:tA}/* ${PKGDIR:tA}/*; do \
                ${TEST} ! -f "$$f" || ${ECHO} "$$f";                    \
        done
        ${RUN}                                                          \
@@ -185,7 +185,7 @@
        ${AWK} 'NF == 4 && $$3 == "=" { gsub("[()]", "", $$2); print $$2 }' | \
        while read file; do                                             \
                ${TEST} ! -f "${PATCHDIR}/$$file" ||                    \
-                       ${ECHO} "${PATCHDIR}/$$file";                   \
+                       ${ECHO} "${PATCHDIR:tA}/$$file";                \
        done
        ${RUN}                                                          \
        exec 1>>${.TARGET}.tmp;                                         \
@@ -193,7 +193,7 @@
        cd ${PATCHDIR}; for f in *; do                                  \
                case "$$f" in                                           \
                "*"|*.orig|*.rej|*~)    ;;                              \
-               patch-*)                ${ECHO} "${PATCHDIR}/$$f" ;;    \
+               patch-*)                ${ECHO} "${PATCHDIR:tA}/$$f" ;; \
                esac;                                                   \
        done
        ${RUN}                                                          \
diff -r a044d2c06eca -r 4f9b9ec216d0 regress/infra-unittests/pkgformat-pkg-metadata.sh
--- a/regress/infra-unittests/pkgformat-pkg-metadata.sh Thu May 21 18:26:46 2020 +0000
+++ b/regress/infra-unittests/pkgformat-pkg-metadata.sh Thu May 21 18:48:43 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: pkgformat-pkg-metadata.sh,v 1.1 2020/05/19 06:09:53 rillig Exp $
+# $NetBSD: pkgformat-pkg-metadata.sh,v 1.2 2020/05/21 18:48:43 rillig Exp $
 #
 # Demonstrates how mk/pkgformat/pkg/metadata.mk creates the versioning
 # information in +BUILD_VERSION.
@@ -74,7 +74,8 @@
 
 if test_case_begin 'relative paths'; then
 
-       # As of May 2020, the +BUILD_VERSION contains corrupt data.
+       # Up to 2020-05-21, relative paths were stored wrong in the
+       # +BUILD_VERSION file.
 
        wrkdir="$PWD"
        pkgdir="$mocked_pkgsrcdir/category/package"
@@ -104,13 +105,10 @@
 
        assert_that "$exitcode" --equals '0'
        assert_that "$tmpdir/output" --file-is-empty
-       # FIXME: All files listed here are supposed to be relative to
-       # the pkgsrc root directory.
        assert_that "$wrkdir/.pkgdb/+BUILD_VERSION" --file-is-lines \
-               "./Makefile:    $cvsid" \
                "category/package/Makefile:     $cvsid" \
-               "files/README:  $cvsid" \
-               "patches/patch-aa:      $cvsid"
+               "category/package/files/README: $cvsid" \
+               "category/package/patches/patch-aa:     $cvsid"
 
        test_case_end
 fi



Home | Main Index | Thread Index | Old Index