packages: builder - add generic tempfile()
glen
glen at pld-linux.org
Sun Feb 13 18:54:15 CET 2011
Author: glen Date: Sun Feb 13 17:54:15 2011 GMT
Module: packages Tag: HEAD
---- Log message:
- add generic tempfile()
---- Files affected:
packages:
builder (1.644 -> 1.645)
---- Diffs:
================================================================
Index: packages/builder
diff -u packages/builder:1.644 packages/builder:1.645
--- packages/builder:1.644 Sun Feb 13 18:53:03 2011
+++ packages/builder Sun Feb 13 18:54:10 2011
@@ -231,7 +231,7 @@
POLDEK_CMD="$SU_SUDO /usr/bin/poldek --noask"
run_poldek() {
- RES_FILE=$(mktemp -t builder.XXXXXX || ${TMPDIR:-/tmp}/builder.$RANDOM)
+ RES_FILE=$(tempfile)
if [ -n "$LOGFILE" ]; then
LOG=`eval echo $LOGFILE`
if [ -n "$LASTLOG_FILE" ]; then
@@ -394,6 +394,11 @@
"
}
+# create tempfile. as secure as possible
+tempfile() {
+ mktemp -t builder.XXXXXX || ${TMPDIR:-/tmp}/builder.$RANDOM.$$
+}
+
# change dependency to specname
# common changes:
# - perl(Package::Name) -> perl-Package-Name
@@ -1555,7 +1560,7 @@
if [ -n "$LASTLOG_FILE" ]; then
echo "LASTLOG=$LOG" > $LASTLOG_FILE
fi
- RES_FILE=$(mktemp -t builder.XXXXXX || ${TMPDIR:-/tmp}/builder.$RANDOM)
+ RES_FILE=$(tempfile)
(time eval ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
RETVAL=`cat $RES_FILE`
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/builder?r1=1.644&r2=1.645&f=u
More information about the pld-cvs-commit
mailing list