Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc mk/haskell.mk: only add PLIST_SUBST and PRINT_PLIST_AW...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bd24dad66424
branches:  trunk
changeset: 435057:bd24dad66424
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Jun 29 20:30:13 2020 +0000

description:
mk/haskell.mk: only add PLIST_SUBST and PRINT_PLIST_AWK if useful

The PLIST_SUBST and PLIST_PRINT_AWK definitions for Haskell library
packages are only useful if the package-description file exists.  If
that file is absent though, these are skipped.

The test whether the file exists is made as late as possible since that
file does not yet exist at the point where the package Makefile is
parsed.

This also affects the show-all-haskell target, which only shows these
values after the install phase.  This is not perfect but good enough for
practical cases.

diffstat:

 mk/haskell.mk                      |  28 ++++++++++--------
 regress/infra-unittests/haskell.sh |  57 +------------------------------------
 2 files changed, 17 insertions(+), 68 deletions(-)

diffs (121 lines):

diff -r 491ae2b8292f -r bd24dad66424 mk/haskell.mk
--- a/mk/haskell.mk     Mon Jun 29 20:12:34 2020 +0000
+++ b/mk/haskell.mk     Mon Jun 29 20:30:13 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: haskell.mk,v 1.22 2020/06/29 18:07:45 rillig Exp $
+# $NetBSD: haskell.mk,v 1.23 2020/06/29 20:30:13 rillig Exp $
 #
 # This Makefile fragment handles Haskell Cabal packages.
 # See: http://www.haskell.org/cabal/
@@ -246,18 +246,20 @@
 _HASKELL_PL_PKGID=     ${_HASKELL_PL_PKGID_CMD:sh}
 _HASKELL_PL_VER=       ${_HASKELL_VERSION:S,-,,}
 
-PLIST_SUBST+=          HS_INTF=${_HASKELL_PL_INTF}
-PLIST_SUBST+=          HS_IMPL=${_HASKELL_PL_IMPL}
-PLIST_SUBST+=          HS_DOCS=${_HASKELL_PL_DOCS}
-PLIST_SUBST+=          HS_PLATFORM=${_HASKELL_PL_PLATFORM}
-PLIST_SUBST+=          HS_PKGID=${_HASKELL_PL_PKGID}
-PLIST_SUBST+=          HS_VER=${_HASKELL_PL_VER}
-PRINT_PLIST_AWK+=      { sub("^${_HASKELL_PL_INTF}",       "$${HS_INTF}") }
-PRINT_PLIST_AWK+=      { sub("^${_HASKELL_PL_IMPL}",       "$${HS_IMPL}") }
-PRINT_PLIST_AWK+=      { sub("^${_HASKELL_PL_DOCS}",       "$${HS_DOCS}") }
-PRINT_PLIST_AWK+=      { sub("/${_HASKELL_PL_PLATFORM}/", "/$${HS_PLATFORM}/") }
-PRINT_PLIST_AWK+=      { sub( "${_HASKELL_PL_PKGID}",      "$${HS_PKGID}") }
-PRINT_PLIST_AWK+=      { sub( "${_HASKELL_PL_VER}",        "$${HS_VER}") }
+_HS_PLIST_SUBST+=      HS_INTF=${_HASKELL_PL_INTF}
+_HS_PLIST_SUBST+=      HS_IMPL=${_HASKELL_PL_IMPL}
+_HS_PLIST_SUBST+=      HS_DOCS=${_HASKELL_PL_DOCS}
+_HS_PLIST_SUBST+=      HS_PLATFORM=${_HASKELL_PL_PLATFORM}
+_HS_PLIST_SUBST+=      HS_PKGID=${_HASKELL_PL_PKGID}
+_HS_PLIST_SUBST+=      HS_VER=${_HASKELL_PL_VER}
+PLIST_SUBST+=          ${exists(${DESTDIR}${_HASKELL_PKG_DESCR_FILE}):?${_HS_PLIST_SUBST}:}
+_HS_PRINT_PLIST_AWK+=  { sub("^${_HASKELL_PL_INTF}",       "$${HS_INTF}") }
+_HS_PRINT_PLIST_AWK+=  { sub("^${_HASKELL_PL_IMPL}",       "$${HS_IMPL}") }
+_HS_PRINT_PLIST_AWK+=  { sub("^${_HASKELL_PL_DOCS}",       "$${HS_DOCS}") }
+_HS_PRINT_PLIST_AWK+=  { sub("/${_HASKELL_PL_PLATFORM}/", "/$${HS_PLATFORM}/") }
+_HS_PRINT_PLIST_AWK+=  { sub( "${_HASKELL_PL_PKGID}",      "$${HS_PKGID}") }
+_HS_PRINT_PLIST_AWK+=  { sub( "${_HASKELL_PL_VER}",        "$${HS_VER}") }
+PRINT_PLIST_AWK+=      ${exists(${DESTDIR}${_HASKELL_PKG_DESCR_FILE}):?${_HS_PRINT_PLIST_AWK}:}
 
 HS_UPDATE_PLIST?=      no
 
diff -r 491ae2b8292f -r bd24dad66424 regress/infra-unittests/haskell.sh
--- a/regress/infra-unittests/haskell.sh        Mon Jun 29 20:12:34 2020 +0000
+++ b/regress/infra-unittests/haskell.sh        Mon Jun 29 20:30:13 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: haskell.sh,v 1.2 2020/06/29 20:12:34 rillig Exp $
+# $NetBSD: haskell.sh,v 1.3 2020/06/29 20:30:13 rillig Exp $
 #
 # Tests for mk/haskell.mk.
 #
@@ -427,23 +427,6 @@
 
        assert_that "$tmpdir/output" --file-is-lines \
                '_HS_PLIST_STATUS=missing' \
-               "awk: can't open file $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-description" \
-               ' source line number 1' \
-               'bmake: "awk '\''prev == "import-dirs:" { dir = $1; exit } { prev = $0 } END { print(dir ? dir : "never_match_this") }'\'' 
'"$destdir""$prefix"'/lib/package-1.0/ghc-8.8.1/package-description" returned non-zero status' \
-               "awk: can't open file $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-description" \
-               ' source line number 1' \
-               'bmake: "awk '\''prev == "import-dirs:" { dir = $1; exit } { prev = $0 } END { print(dir ? dir : "never_match_this") }'\'' 
'"$destdir""$prefix"'/lib/package-1.0/ghc-8.8.1/package-description" returned non-zero status' \
-               "awk: can't open file $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-description" \
-               ' source line number 1' \
-               'bmake: "awk '\''prev == "import-dirs:" { dir = $1; exit } { prev = $0 } END { print(dir ? dir : "never_match_this") }'\'' 
'"$destdir""$prefix"'/lib/package-1.0/ghc-8.8.1/package-description" returned non-zero status' \
-               "cat: $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-id: No such file or directory" \
-               "$make: \"cat $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-id\" returned non-zero status" \
-               'PLIST_SUBST HS_INTF=lib/package-1.0/ghc-8.8.1' \
-               'PLIST_SUBST HS_IMPL=' \
-               'PLIST_SUBST HS_DOCS=' \
-               'PLIST_SUBST HS_PLATFORM=never_match_this' \
-               'PLIST_SUBST HS_PKGID=' \
-               'PLIST_SUBST HS_VER=ghc8.8.1' \
                'PLIST_SUBST OPSYS=Opsys' \
                'PLIST_SUBST OS_VERSION=' \
                'PLIST_SUBST MACHINE_ARCH=arch' \
@@ -469,43 +452,7 @@
                'PLIST_SUBST TRUE=true' \
                'PLIST_SUBST PKGGNUDIR=' \
                'PLIST_SUBST PKGMANDIR=' \
-               "awk: can't open file $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-description" \
-               ' source line number 1' \
-               'bmake: "awk '\''prev == "import-dirs:" { dir = $1; exit } { prev = $0 } END { print(dir ? dir : "never_match_this") }'\'' 
'"$destdir""$prefix"'/lib/package-1.0/ghc-8.8.1/package-description" returned non-zero status' \
-               "awk: can't open file $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-description" \
-               ' source line number 1' \
-               'bmake: "awk '\''prev == "import-dirs:" { dir = $1; exit } { prev = $0 } END { print(dir ? dir : "never_match_this") }'\'' 
'"$destdir""$prefix"'/lib/package-1.0/ghc-8.8.1/package-description" returned non-zero status' \
-               "awk: can't open file $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-description" \
-               ' source line number 1' \
-               'bmake: "awk '\''prev == "import-dirs:" { dir = $1; exit } { prev = $0 } END { print(dir ? dir : "never_match_this") }'\'' 
'"$destdir""$prefix"'/lib/package-1.0/ghc-8.8.1/package-description" returned non-zero status' \
-               "cat: $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-id: No such file or directory" \
-               "$make: \"cat $destdir$prefix/lib/package-1.0/ghc-8.8.1/package-id\" returned non-zero status" \
-               'PRINT_PLIST_AWK {' \
-               'PRINT_PLIST_AWK sub("^lib/package-1.0/ghc-8.8.1",' \
-               'PRINT_PLIST_AWK "")' \
-               'PRINT_PLIST_AWK }' \
-               'PRINT_PLIST_AWK {' \
-               'PRINT_PLIST_AWK sub("^",' \
-               'PRINT_PLIST_AWK "")' \
-               'PRINT_PLIST_AWK }' \
-               'PRINT_PLIST_AWK {' \
-               'PRINT_PLIST_AWK sub("^",' \
-               'PRINT_PLIST_AWK "")' \
-               'PRINT_PLIST_AWK }' \
-               'PRINT_PLIST_AWK {' \
-               'PRINT_PLIST_AWK sub("/never_match_this/",' \
-               'PRINT_PLIST_AWK "//")' \
-               'PRINT_PLIST_AWK }' \
-               'PRINT_PLIST_AWK {' \
-               'PRINT_PLIST_AWK sub(' \
-               'PRINT_PLIST_AWK "",' \
-               'PRINT_PLIST_AWK "")' \
-               'PRINT_PLIST_AWK }' \
-               'PRINT_PLIST_AWK {' \
-               'PRINT_PLIST_AWK sub(' \
-               'PRINT_PLIST_AWK "ghc8.8.1",' \
-               'PRINT_PLIST_AWK "")' \
-               'PRINT_PLIST_AWK }'
+               'PRINT_PLIST_AWK '
 
        test_case_end
 fi



Home | Main Index | Thread Index | Old Index