• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

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

Experimental package creation tool for MinGW.org


Commit MetaInfo

修訂31e1a0101520daf5f8b8e66345a2121745337a3b (tree)
時間2022-03-07 21:51:44
作者Keith Marshall <keith@user...>
CommiterKeith Marshall

Log Message

Verify accessibility of git and hg root directories.

* src/plugins/git.sh src/plugins/hg.sh (initialize_abs_srcdir): Use it
to verify that the nominated package source directory actually exists;
abort if it doesn't, when it is required to do so.

Change Summary

差異

--- a/src/plugins/git.sh
+++ b/src/plugins/git.sh
@@ -10,7 +10,7 @@
1010 # $Id$
1111 #
1212 # Written by Keith Marshall <keith@users.osdn.me>
13-# Copyright (C) 2019, MinGW.OSDN Project
13+# Copyright (C) 2019, 2022, MinGW.OSDN Project
1414 #
1515 # Permission is hereby granted, free of charge, to any person obtaining a copy
1616 # of this software and associated documentation files (the "Software"), to deal
@@ -57,6 +57,7 @@
5757 #
5858 defn_add_hook initialize plugin git_plugin_initialize
5959 git_plugin_initialize() {
60+ initialize_abs_srcdir || exit
6061 phase "initialize local git repository"
6162 ( cd $PACKAGE_SRCDIR
6263 git init --quiet
@@ -105,6 +106,7 @@
105106 defn_set_hook stage_srcdist plugin git_plugin_stage_srcdist
106107 git_plugin_stage_srcdist() {
107108 step "check source tree integrity"
109+ initialize_abs_srcdir || exit
108110 #
109111 # The "mingw-pkg distribute" action is not allowed to proceed, if
110112 # the source code repository is contaminated by untracked files, or
--- a/src/plugins/hg.sh
+++ b/src/plugins/hg.sh
@@ -10,7 +10,7 @@
1010 # $Id$
1111 #
1212 # Written by Keith Marshall <keith@users.osdn.me>
13-# Copyright (C) 2011-2013, 2016-2019, MinGW.OSDN Project
13+# Copyright (C) 2011-2013, 2016-2019, 2020, 2022, MinGW.OSDN Project
1414 #
1515 # Permission is hereby granted, free of charge, to any person obtaining a copy
1616 # of this software and associated documentation files (the "Software"), to deal
@@ -36,19 +36,20 @@
3636 STAGED_PKGROOT=${STAGED_PKGROOT-"`pwd`"}
3737
3838 # When running hg, on behalf of this plug-in, we may need to ensure that
39-# it is run in the top source directory; invoking it as $HG_CMD guarantees
39+# it is run in the top source directory; invoking it as HG_CMD guarantees
4040 # that this requirement is satisfied.
4141 #
42- HG_CMD='eval hg --cwd "$PACKAGE_ABS_SRCDIR"'
42+ HG_CMD() { hg --cwd "`abs_srcdir`" "$@"; }
4343
4444 # The hg_plugin_initialize function hooks into the "mingw-pkg initialize"
4545 # action, to set up the requisite hg repository whence any distributable
4646 # package images will be constructed. Note that this runs a sequence of
4747 # hg commands within a sub-shell; changing the working directory for this
48-# sub-shell obviates the need to use $HG_CMD.
48+# sub-shell obviates the need to use HG_CMD.
4949 #
5050 defn_add_hook initialize plugin hg_plugin_initialize
5151 hg_plugin_initialize() {
52+ initialize_abs_srcdir || exit
5253 phase "initialize local mercurial repository"
5354 ( cd $PACKAGE_SRCDIR
5455 hg init
@@ -78,7 +79,7 @@
7879 #
7980 action_load_package_specs() { hg_plugin_load_package_specs; }
8081 hg_plugin_load_package_specs() { action_prepare_package_specs
81- test -f $PACKAGE_SRCDIR/arch/${ARCH="`$HG_CMD branch 2> /dev/null \
82+ test -f $PACKAGE_SRCDIR/arch/${ARCH="`HG_CMD branch 2> /dev/null \
8283 || echo $ARCH_DEFAULT`"}/$PACKAGE-$VERSION-$ARCH.pkgspec && \
8384 . $PACKAGE_SRCDIR/arch/$ARCH/$PACKAGE-$VERSION-$ARCH.pkgspec
8485 }
@@ -90,8 +91,9 @@
9091 # any applied patches, which must be managed by MQ.
9192 #
9293 defn_set_hook stage_srcdist plugin hg_plugin_stage_srcdist
93- hg_plugin_stage_srcdist() { local HG_ROOT=`$HG_CMD root`
94+ hg_plugin_stage_srcdist() {
9495 step "check source tree integrity"
96+ initialize_abs_srcdir && local HG_ROOT=`HG_CMD root` || exit
9597 #
9698 # The "mingw-pkg distribute" action is not allowed to proceed, if
9799 # the source code repository is contaminated by untracked files, or
@@ -101,11 +103,11 @@
101103 show_status() {
102104 warning "$1"; printf >&2 '%s\n\n' "$warning_colour$2$unbold"
103105 }
104- untracked="`$HG_CMD status | grep '^?'`" && {
106+ untracked="`HG_CMD status | grep '^?'`" && {
105107 show_status "untracked files in source tree..." "$untracked"
106108 ${ignore_untracked_files-false} || EXIT_CODE=1
107109 }
108- uncommitted="`$HG_CMD status | grep '^[AMR!]'`" && {
110+ uncommitted="`HG_CMD status | grep '^[AMR!]'`" && {
109111 show_status "locally modified files in source tree..." "$uncommitted"
110112 EXIT_CODE=1
111113 }