pkgsrc-Changes archive

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

CVS commit: pkgsrc/mk



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Wed Nov 23 15:31:43 UTC 2022

Modified Files:
        pkgsrc/mk: bsd.pkg.error.mk

Log Message:
mk: Minor performance improvement for error-check.

Avoid running rm/cat/mv on non-existent or zero-length files.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 pkgsrc/mk/bsd.pkg.error.mk

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

Modified files:

Index: pkgsrc/mk/bsd.pkg.error.mk
diff -u pkgsrc/mk/bsd.pkg.error.mk:1.5 pkgsrc/mk/bsd.pkg.error.mk:1.6
--- pkgsrc/mk/bsd.pkg.error.mk:1.5      Sun Sep  8 09:15:01 2019
+++ pkgsrc/mk/bsd.pkg.error.mk  Wed Nov 23 15:31:43 2022
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.error.mk,v 1.5 2019/09/08 09:15:01 rillig Exp $
+# $NetBSD: bsd.pkg.error.mk,v 1.6 2022/11/23 15:31:43 jperkin Exp $
 
 ERROR_DIR=             ${WRKDIR}/.error
 WARNING_DIR=           ${WRKDIR}/.warning
@@ -29,26 +29,32 @@ ${ERROR_DIR} ${WARNING_DIR} ${_ERROR_DON
 ###
 error-check: .USE
        ${RUN}                                                          \
-       ${RM} -f ${WARNING_DIR}/*.tmp;                                  \
        ${TEST} -d ${WARNING_DIR} || exit 0;                            \
        cd ${WARNING_DIR};                                              \
+       if [ `${ECHO} *.tmp` != '*.tmp' ]; then                         \
+               ${RM} -f *.tmp;                                         \
+       fi;                                                             \
        for file in ./*; do                                             \
                ${TEST} "$$file" != "./*" || exit 0;                    \
                break;                                                  \
        done;                                                           \
-       ${CAT} ./* | ${WARNING_CAT};                                    \
-       ${MV} -f ./* ${_WARNING_DONE_DIR}
+       if ${_NONZERO_FILESIZE_P} ./*; then                             \
+               ${CAT} ./* | ${WARNING_CAT};                            \
+               ${MV} -f ./* ${_WARNING_DONE_DIR};                      \
+       fi
 
        ${RUN}                                                          \
-       ${RM} -f ${ERROR_DIR}/*.tmp;                                    \
        ${TEST} -d ${ERROR_DIR} || exit 0;                              \
        cd ${ERROR_DIR};                                                \
+       if [ `${ECHO} *.tmp` != '*.tmp' ]; then                         \
+               ${RM} -f *.tmp;                                         \
+       fi;                                                             \
        for file in ./*; do                                             \
                ${TEST} "$$file" != "./*" || exit 0;                    \
                break;                                                  \
        done;                                                           \
-       ${CAT} * | ${ERROR_CAT};                                        \
        if ${_NONZERO_FILESIZE_P} ./*; then                             \
+               ${CAT} ./* | ${ERROR_CAT};                              \
                ${MV} -f ./* ${_ERROR_DONE_DIR};                        \
                exit 1;                                                 \
        fi



Home | Main Index | Thread Index | Old Index