• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得windowscocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Experimental package creation tool for MinGW.org


Commit MetaInfo

Revision124bb57b04fa0d6f7c254478fb66b1238b953191 (tree)
Time2022-03-11 05:46:28
AuthorKeith Marshall <keith@user...>
CommiterKeith Marshall

Log Message

Avoid accidental overwrite of pkgspec files.

* src/modules/options.sh (OUTPUT_STREAMING_OPTION): Rename as...
(write_stdout): ...this; set value to "true", when applicable.

* src/modules/mkspec.sh (write_stdout): Evaluate it.
(SPECSFILE_DIR, SPECSFILE): Identify pkgspec file as a composite of
this pair of shell variables; do NOT include any contribution from...
(RELEASE): ...this additional variable, even if it is assigned.
[! write_stdout]: Test for prior existence of pkgspec file;
abort when already present.

Change Summary

Incremental Difference

--- a/src/modules/mkspec.sh
+++ b/src/modules/mkspec.sh
@@ -32,10 +32,18 @@
3232 #
3333 # -----------------------------------------------------------------------------
3434 #
35-( test "${OUTPUT_STREAMING_OPTION+"set"}" = set || {
36- mkdir -p ${PACKAGE_SRCDIR-"."}/arch/${ARCH-"mingw32"}
37- SPECSFILE=$PACKAGE-$VERSION${RELEASE+"-$RELEASE"}${ARCH+"-$ARCH"}.pkgspec
38- exec > ${PACKAGE_SRCDIR-"."}/arch/${ARCH-"mingw32"}/$SPECSFILE
35+ local SPECSFILE SPECSFILE_DIR
36+ SPECSFILE_DIR=${PACKAGE_SRCDIR-"."}/arch/${ARCH-"mingw32"}
37+ SPECSFILE=$PACKAGE-$VERSION${ARCH+"-$ARCH"}.pkgspec
38+ ${write_stdout=false} || {
39+ test -e "$SPECSFILE_DIR/$SPECSFILE" && {
40+ error "file '$SPECSFILE' already exists"; exit 1
41+ }
42+ }
43+#
44+( $write_stdout || {
45+ mkdir -p "$SPECSFILE_DIR"
46+ exec > "$SPECSFILE_DIR/$SPECSFILE"
3947 }
4048
4149 test "${RELEASE+"set"}" = set && RELEASE_PREFIX="" || RELEASE_PREFIX="# "
--- a/src/modules/options.sh
+++ b/src/modules/options.sh
@@ -47,7 +47,7 @@
4747 opteval_verbose() { OPTION_VERBOSE=true; }
4848
4949 optdefine c stdout
50- opteval_stdout() { OUTPUT_STREAMING_OPTION=stdout; }
50+ opteval_stdout() { write_stdout=true; }
5151
5252 optdefine option requires_argument
5353 opteval_option() { option $optarg; }