Mercurial > octave
annotate build-aux/mk-hg-id.sh @ 30239:120e878f343f
mkdir.m: issue a warning if DIR already exists (bug #61338)
* mkdir.m: When nargout==0, check status message and report a warning if
"directory exists" message found.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 13 Oct 2021 08:05:14 -0700 |
parents | 0a5b15007766 |
children | 796f54d4ddbf |
rev | line source |
---|---|
21976 | 1 #! /bin/sh |
29357
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
2 |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 ######################################################################## |
29357
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
4 ## |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
29357
diff
changeset
|
5 ## Copyright (C) 2016-2021 The Octave Project Developers |
29357
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
6 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
7 ## See the file COPYRIGHT.md in the top-level directory of this |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
8 ## distribution or <https://octave.org/copyright/>. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
9 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
10 ## This file is part of Octave. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
11 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
12 ## Octave is free software: you can redistribute it and/or modify it |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
13 ## under the terms of the GNU General Public License as published by |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
14 ## the Free Software Foundation, either version 3 of the License, or |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
15 ## (at your option) any later version. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
16 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
17 ## Octave is distributed in the hope that it will be useful, but |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
18 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
19 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
20 ## GNU General Public License for more details. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
21 ## |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
22 ## You should have received a copy of the GNU General Public License |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
23 ## along with Octave; see the file COPYING. If not, see |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
24 ## <https://www.gnu.org/licenses/>. |
bbbe4dcc7200
use the same comment style for copyright headers in .m files and shell scripts
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
25 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
26 ######################################################################## |
21976 | 27 |
28 # Generate a header file that provides the public symbols from Octave's | |
29 # autoconf-generated config.h file. See the notes at the top of the | |
30 # generated octave-config.h file for more details. | |
31 | |
32 set -e | |
33 | |
34 if [ $# -ne 1 ] && [ $# -ne 2 ]; then | |
35 echo "usage: mk-hg-id.sh SRCDIR [--disable]" 1>&2 | |
36 exit 1 | |
37 fi | |
38 | |
39 srcdir="$1" | |
40 | |
41 hg_id=HG-ID | |
42 move_if_change="$srcdir/build-aux/move-if-change" | |
43 | |
25800
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
44 ## A user's ~/.hgrc may redefine or add default options to any hg subcommand, |
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
45 ## potentially altering its behavior and possibly its standard output. Always |
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
46 ## run hg subcommands with configuration variables set to ensure that the |
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
47 ## user's preferences do not influence the expected behavior. |
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
48 hg_safe () |
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
49 { |
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
50 cmd=$1; shift |
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
51 hg --config alias.${cmd}=${cmd} --config defaults.${cmd}= ${cmd} "$@" |
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
52 } |
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
53 |
21976 | 54 if [ $# -eq 2 ] && [ x"$2" = x--disable ]; then |
55 echo "hg-id-disabled" > ${hg_id}-t | |
56 ${move_if_change} ${hg_id}-t ${hg_id} | |
57 elif [ -d $srcdir/.hg ]; then | |
25800
7b2312def76b
build: ensure hg commands are not affected by user settings
Mike Miller <mtmiller@octave.org>
parents:
25054
diff
changeset
|
58 ( cd $srcdir && hg_safe identify --id || echo "unknown" ) > ${hg_id}-t |
21976 | 59 ${move_if_change} ${hg_id}-t ${hg_id} |
60 elif [ ! -f $srcdir/${hg_id} ]; then | |
22020
e154d23b2fd1
maint: reduce multiple mentions of the HG-ID file name and contents
Mike Miller <mtmiller@octave.org>
parents:
21976
diff
changeset
|
61 echo "WARNING: $srcdir/${hg_id} is missing!" 1>&2 |
21976 | 62 echo "unknown" > ${hg_id}-t && mv ${hg_id}-t ${hg_id} |
63 else | |
22020
e154d23b2fd1
maint: reduce multiple mentions of the HG-ID file name and contents
Mike Miller <mtmiller@octave.org>
parents:
21976
diff
changeset
|
64 echo "preserving existing ${hg_id} file" 1>&2 |
21976 | 65 if [ "x$srcdir" != "x." ] && [ -f $srcdir/${hg_id} ] && [ ! -f ${hg_id} ]; then |
66 cp ${srcdir}/${hg_id} ${hg_id} | |
67 touch -r ${srcdir}/${hg_id} ${hg_id} | |
68 fi | |
69 fi | |
70 | |
71 if [ "`cat ${hg_id}`" = "hg-id-disabled" ]; then | |
22020
e154d23b2fd1
maint: reduce multiple mentions of the HG-ID file name and contents
Mike Miller <mtmiller@octave.org>
parents:
21976
diff
changeset
|
72 echo "WARNING: ${hg_id} is 'hg-id-disabled'" 1>&2 |
21976 | 73 fi |
74 | |
75 cat ${hg_id} |