• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

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

Experimental package creation tool for MinGW.org


Commit MetaInfo

Revisionab99dcb2790314d6dd9a4eb31cfc11926ca57dfe (tree)
Zeit2022-03-06 07:38:46
AutorKeith Marshall <keith@user...>
CommiterKeith Marshall

Log Message

Improve source directory identification mechanisms.

* src/modules/pkgspec.sh (initialize_abs_srcdir, abs_srcdir): New
functions; implement them to identify, and report source path name.
(pkgspec_from_srcdir): Do not require the basename from...
(PACKAGE_ABS_SRCDIR): ...this; it may not be defined, whereas...
(PACKAGE_SRCDIR): ...this is, and is sufficient.

Ändern Zusammenfassung

Diff

--- a/src/modules/pkgspec.sh
+++ b/src/modules/pkgspec.sh
@@ -9,7 +9,7 @@
99 # $Id$
1010 #
1111 # Written by Keith Marshall <keith@users.osdn.me>
12-# Copyright (C) 2011-2014, 2017, 2018, 2020, MinGW.OSDN Project
12+# Copyright (C) 2011-2014, 2017, 2018, 2020, 2022, MinGW.OSDN Project
1313 #
1414 # Permission is hereby granted, free of charge, to any person obtaining a copy
1515 # of this software and associated documentation files (the "Software"), to deal
@@ -39,9 +39,22 @@
3939 #
4040 ARCH=${ARCH-"mingw32"}
4141
42-# Provide an absolute canonical reference form for PACKAGE_SRCDIR.
42+# Determine an absolute canonical reference form for PACKAGE_SRCDIR; provide
43+# a capability to abort if inaccessible, but allow for deferred failure.
4344 #
44- PACKAGE_ABS_SRCDIR=`cd $PACKAGE_SRCDIR; pwd`
45+ abs_srcdir() { 2> /dev/null cd $PACKAGE_SRCDIR && pwd || {
46+ ${1-"true"} && die 2 "cannot access directory '$PACKAGE_SRCDIR'"
47+ }
48+ }
49+# If available, store this canonical reference in PACKAGE_ABS_SRCDIR, and
50+# redefine the evaluator function to simply reproduce the stored path.
51+#
52+ initialize_abs_srcdir() {
53+ PACKAGE_ABS_SRCDIR=`abs_srcdir ${1+"$1"}` && {
54+ abs_srcdir() { echo "$PACKAGE_ABS_SRCDIR"; }
55+ }
56+ }
57+ initialize_abs_srcdir ${fail_if_inaccessible-"false"}
4558
4659 # Ensure we have a PACKAGE name specification; if not, attempt to deduce
4760 # a suitable default from the name of the top-level source code directory.
@@ -51,7 +64,7 @@
5164 #
5265 # An optional second argument overrides the default derivation.
5366 #
54- IFS=-; set -- ${2-`basename "$PACKAGE_ABS_SRCDIR"`}; IFS=
67+ IFS=-; set -- ${2-`basename "$PACKAGE_SRCDIR"`}; IFS=
5568 value= fs=; $pkgspec_request_class "$@"
5669 }
5770 pkgspec_get_name() {