Experimental package creation tool for MinGW.org
リビジョン | 124bb57b04fa0d6f7c254478fb66b1238b953191 (tree) |
---|---|
日時 | 2022-03-11 05:46:28 |
作者 | Keith Marshall <keith@user...> |
コミッター | Keith Marshall |
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.
@@ -32,10 +32,18 @@ | ||
32 | 32 | # |
33 | 33 | # ----------------------------------------------------------------------------- |
34 | 34 | # |
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" | |
39 | 47 | } |
40 | 48 | |
41 | 49 | test "${RELEASE+"set"}" = set && RELEASE_PREFIX="" || RELEASE_PREFIX="# " |
@@ -47,7 +47,7 @@ | ||
47 | 47 | opteval_verbose() { OPTION_VERBOSE=true; } |
48 | 48 | |
49 | 49 | optdefine c stdout |
50 | - opteval_stdout() { OUTPUT_STREAMING_OPTION=stdout; } | |
50 | + opteval_stdout() { write_stdout=true; } | |
51 | 51 | |
52 | 52 | optdefine option requires_argument |
53 | 53 | opteval_option() { option $optarg; } |