pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/mk/pkgtasks
Module Name: pkgsrc
Committed By: jlam
Date: Thu Aug 10 05:41:23 UTC 2017
Modified Files:
pkgsrc/mk/pkgtasks: files.mk
pkgsrc/mk/pkgtasks/tests: files_test
Log Message:
mk/pkgtasks: Fix bug in postinstall CONF_FILES assertion.
If ${DESTDIR} was non-empty and the source file was an absolute
path, the postinstall check target defined in mk/pkgtasks/files.mk
was improperly failing. Fix the bug by only prepending ${PREFIX}
if the source path is relative, and always prepending ${DESTDIR}.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 pkgsrc/mk/pkgtasks/files.mk
cvs rdiff -u -r1.2 -r1.3 pkgsrc/mk/pkgtasks/tests/files_test
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/mk/pkgtasks/files.mk
diff -u pkgsrc/mk/pkgtasks/files.mk:1.6 pkgsrc/mk/pkgtasks/files.mk:1.7
--- pkgsrc/mk/pkgtasks/files.mk:1.6 Thu Aug 10 05:37:44 2017
+++ pkgsrc/mk/pkgtasks/files.mk Thu Aug 10 05:41:23 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.mk,v 1.6 2017/08/10 05:37:44 jlam Exp $
+# $NetBSD: files.mk,v 1.7 2017/08/10 05:41:23 jlam Exp $
#
# Copyright (c) 2017 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -222,42 +222,60 @@ _pkgtasks-files-postinstall-check: .PHON
${RUN}set -- args ${_CONF_FILES}; shift; \
while ${TEST} "$$#" -gt 0; do \
${TEST} "$$#" -gt 2 || break; \
- egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1"; shift 2; \
+ case $$1 in \
+ /*) egfile=${DESTDIR:Q}"$$1" ;; \
+ *) egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1" ;; \
+ esac; shift 2; \
${TEST} -f "$$egfile" || ${TEST} -c "$$egfile" || \
${FAIL_MSG} "CONF_FILES $$egfile does not exist."; \
done
${RUN}set -- args ${_CONF_FILES_PERMS}; shift; \
while ${TEST} "$$#" -gt 0; do \
${TEST} "$$#" -gt 5 || break; \
- egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1"; shift 5; \
+ case $$1 in \
+ /*) egfile=${DESTDIR:Q}"$$1" ;; \
+ *) egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1" ;; \
+ esac; shift 5; \
${TEST} -f "$$egfile" || ${TEST} -c "$$egfile" || \
${FAIL_MSG} "CONF_FILES_PERMS $$egfile does not exist.";\
done
${RUN}set -- args ${_REQD_FILES}; shift; \
while ${TEST} "$$#" -gt 0; do \
${TEST} "$$#" -gt 2 || break; \
- egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1"; shift 2; \
+ case $$1 in \
+ /*) egfile=${DESTDIR:Q}"$$1" ;; \
+ *) egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1" ;; \
+ esac; shift 2; \
${TEST} -f "$$egfile" || ${TEST} -c "$$egfile" || \
${FAIL_MSG} "REQD_FILES $$egfile does not exist."; \
done
${RUN}set -- args ${_REQD_FILES_PERMS}; shift; \
while ${TEST} "$$#" -gt 0; do \
${TEST} "$$#" -gt 5 || break; \
- egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1"; shift 5; \
+ case $$1 in \
+ /*) egfile=${DESTDIR:Q}"$$1" ;; \
+ *) egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1" ;; \
+ esac; shift 5; \
${TEST} -f "$$egfile" || ${TEST} -c "$$egfile" || \
${FAIL_MSG} "REQD_FILES_PERMS $$egfile does not exist.";\
done
${RUN}set -- args ${__INIT_SCRIPTS}; shift; \
while ${TEST} "$$#" -gt 0; do \
${TEST} "$$#" -gt 2 || break; \
- egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1"; shift 2; \
+ case $$1 in \
+ /*) egfile=${DESTDIR:Q}"$$1" ;; \
+ *) egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1" ;; \
+ esac; shift 2; \
${TEST} -f "$$egfile" || ${TEST} -c "$$egfile" || \
${FAIL_MSG} "REQD_FILES $$egfile does not exist."; \
done
${RUN}set -- args ${__INIT_SCRIPTS_PERMS}; shift; \
while ${TEST} "$$#" -gt 0; do \
${TEST} "$$#" -gt 5 || break; \
- egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1"; shift 5; \
+ case $$1 in \
+ /*) egfile=${DESTDIR:Q}"$$1" ;; \
+ *) egfile=${DESTDIR:Q}${PREFIX:Q}"/$$1" ;; \
+ esac; shift 5; \
${TEST} -f "$$egfile" || ${TEST} -c "$$egfile" || \
${FAIL_MSG} "REQD_FILES_PERMS $$egfile does not exist.";\
done
Index: pkgsrc/mk/pkgtasks/tests/files_test
diff -u pkgsrc/mk/pkgtasks/tests/files_test:1.2 pkgsrc/mk/pkgtasks/tests/files_test:1.3
--- pkgsrc/mk/pkgtasks/tests/files_test:1.2 Fri Jun 2 16:12:26 2017
+++ pkgsrc/mk/pkgtasks/tests/files_test Thu Aug 10 05:41:23 2017
@@ -1,6 +1,6 @@
#!/usr/bin/env atf-sh
#
-# $NetBSD: files_test,v 1.2 2017/06/02 16:12:26 jlam Exp $
+# $NetBSD: files_test,v 1.3 2017/08/10 05:41:23 jlam Exp $
#
# Copyright (c) 2017 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -123,6 +123,7 @@ atf_test_case test2
test2_head()
{
atf_set "descr" "_pkgtasks-files-postinstall-check"
+ atf_set "require.files" "/dev/null"
}
test2_body()
@@ -138,26 +139,39 @@ test2_body()
( exec > source$n )
done
+ # Create destdir source files.
+ local destdir="$(pwd)"
+ mkdir -p "./$destdir"
+ for n in 1 2 3 4 5 6 7 8 9; do
+ ( exec > "./$destdir/source$n" )
+ done
+
cat > mk.conf << 'EOF'
FAIL_MSG= echo
LOCALBASE= ${.CURDIR}
-DESTDIR= # empty
CONF_FILES= source1 target1 source2 target2
CONF_FILES_PERMS= source3 target3 u3 g3 0640 \
- source4 target4 u4 g4 0640
+ /dev/null target4 u4 g4 0640
REQD_FILES= source5 target5 source6 target7
REQD_FILES_PERMS= source8 target8 u8 g8 0400 \
source9 target9 u9 g9 0400
EOF
${MAKE} _pkgtasks-files-postinstall-check \
- PKGSRCDIR="${PKGSRCDIR}" > output
+ PKGSRCDIR="${PKGSRCDIR}" DESTDIR= > output
+ if grep -cq "^" output; then
+ cat output
+ atf_fail "postinstall checks failed (no destdir)"
+ fi
+ ${MAKE} _pkgtasks-files-postinstall-check \
+ PKGSRCDIR="${PKGSRCDIR}" DESTDIR="$(pwd)" > output
if grep -cq "^" output; then
- cat output
- atf_fail "postinstall checks failed"
+ cat output
+ atf_fail "postinstall checks failed (destdir)"
fi
+
atf_pass
}
Home |
Main Index |
Thread Index |
Old Index