[108433] users/ryandesign/scripts/portmylivecheck

ryandesign at macports.org ryandesign at macports.org
Tue Jul 23 06:23:24 PDT 2013


Revision: 108433
          https://trac.macports.org/changeset/108433
Author:   ryandesign at macports.org
Date:     2013-07-23 06:23:24 -0700 (Tue, 23 Jul 2013)
Log Message:
-----------
portmylivecheck: open the Makefile for writing just once, instead of once for every line

Modified Paths:
--------------
    users/ryandesign/scripts/portmylivecheck

Modified: users/ryandesign/scripts/portmylivecheck
===================================================================
--- users/ryandesign/scripts/portmylivecheck	2013-07-23 13:14:27 UTC (rev 108432)
+++ users/ryandesign/scripts/portmylivecheck	2013-07-23 13:23:24 UTC (rev 108433)
@@ -8,8 +8,6 @@
 HANDLE=ryandesign
 JOBS="$(sysctl -n hw.ncpu)"
 
-TMPFILE="$(mktemp "${TMPDIR:=/tmp}/portmylivecheck.XXXXXXXXXX")"
-
 PORTS=$(port echo '(' \
 'maintainer:(\s|^)'$HANDLE'(\s|$)' or \
 'maintainer:(\s|^)'$HANDLE'@macports.org(\s|$)' or \
@@ -17,16 +15,23 @@
 | sed -E 's/ +//g' \
 | tr '\n' ' ')
 
-echo "all: $PORTS" > "$TMPFILE"
-echo >> "$TMPFILE"
-echo ".PHONY: $PORTS" >> "$TMPFILE"
+MAKEFILE="$(mktemp "${TMPDIR:=/tmp}/portmylivecheck.XXXXXXXXXX")"
+MAKEFILE_FD=3
 
+eval exec "$MAKEFILE_FD>$MAKEFILE"
+
+echo "all: $PORTS" >&$MAKEFILE_FD
+echo >&$MAKEFILE_FD
+echo ".PHONY: $PORTS" >&$MAKEFILE_FD
+
 for PORT in $PORTS; do
-    echo >> "$TMPFILE"
-    echo "$PORT:" >> "$TMPFILE"
-    echo $'\t'"port livecheck $PORT" >> "$TMPFILE"
+    echo >&$MAKEFILE_FD
+    echo "$PORT:" >&$MAKEFILE_FD
+    echo $'\t'"port livecheck $PORT" >&$MAKEFILE_FD
 done
 
-make -f "$TMPFILE" -j $JOBS -s || exit $?
+eval exec "$MAKEFILE_FD>&-"
 
-rm -f "$TMPFILE"
+make -f "$MAKEFILE" -j "$JOBS" -s || exit $?
+
+rm -f "$MAKEFILE"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130723/e365d73a/attachment-0001.html>


More information about the macports-changes mailing list