Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/proto/changes.sh
1808 views
1
########################################################################
2
# #
3
# This software is part of the ast package #
4
# Copyright (c) 1990-2011 AT&T Intellectual Property #
5
# and is licensed under the #
6
# Eclipse Public License, Version 1.0 #
7
# by AT&T Intellectual Property #
8
# #
9
# A copy of the License is available at #
10
# http://www.eclipse.org/org/documents/epl-v10.html #
11
# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
12
# #
13
# Information and Software Systems Research #
14
# AT&T Research #
15
# Florham Park NJ #
16
# #
17
# Glenn Fowler <[email protected]> #
18
# #
19
########################################################################
20
command=changes
21
22
case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
23
0123) ARGV0="-a $command"
24
USAGE=$'
25
[-?
26
@(#)$Id: changes (AT&T Research) 2010-01-20 $
27
]
28
'$USAGE_LICENSE$'
29
[+NAME?changes - list changed $PACKAGEROOT package source files]
30
[+DESCRIPTION?\bchanges\b lists $PACKAGEROOT relative package source
31
files that changed between \afrom-date\a between \ato-date\a. The
32
default \afrom-date\a is the modify time of \b$PACKAGEROOT/README\b.
33
The default \ato-date\a is \bnow\b. The changed files are listed by
34
\bls\b(1) with the optional \bls-option\b operands.]
35
[p:package?List source files for \apackage\a only. Multiple
36
\b--package\b options may be specified. By default source files for all
37
packages in \b$PACKAGEROOT/lib/package\b are checked.]:[package]
38
39
[ from-date [ to-date ] ] [ -- ls-option ... ]
40
41
[+SEE ALSO?\btw\b(1), \bls\b(1)]
42
'
43
;;
44
*) ARGV0=""
45
USAGE=" table ..."
46
;;
47
esac
48
49
usage()
50
{
51
OPTIND=0
52
getopts $ARGV0 "$USAGE" OPT '-?'
53
exit 2
54
}
55
56
packages=
57
while getopts $ARGV0 "$USAGE" OPT
58
do case $OPT in
59
p) if [[ $packages ]]
60
then packages="$packages|$OPTARG"
61
else packages=$OPTARG
62
fi
63
;;
64
*) usage
65
;;
66
esac
67
done
68
shift $OPTIND-1
69
70
if [[ ! $PACKAGEROOT ]]
71
then print -u2 $command: \$PACKAGEROOT: package root dir not exported
72
exit 1
73
fi
74
cd $PACKAGEROOT || exit
75
76
if [[ $packages ]]
77
then packages="@(?(*-)($packages))"
78
else packages='*'
79
fi
80
packages=$packages.pkg
81
82
if [[ ! $1 || $1 == -* ]]
83
then if [[ ! -f README ]]
84
then print -u2 $command: a date must be specified
85
exit 1
86
fi
87
from=$(date -f %K -m README)
88
else from=$1
89
shift
90
fi
91
from="&& mtime >= '$from'"
92
if [[ $1 && $1 != -* ]]
93
then to=" && mtime <= '$1'"
94
shift
95
else to=
96
fi
97
ls_options=$*
98
99
set -- $(eval print lib/package/$packages)
100
if [[ ! -f $1 ]]
101
then print -u2 $command: lib/package: no packages
102
exit 1
103
fi
104
packages=$*
105
components=
106
sep=
107
for pkg
108
do while read line
109
do if [[ $line == *:PACKAGE:* ]]
110
then set -- $line
111
while (( $# )) && [[ $1 != :PACKAGE: ]]
112
do shift
113
done
114
if (( $# ))
115
then shift
116
for p
117
do p=${p#'$(PACKAGEROOT)/'}
118
if [[ $p != *'$('* ]]
119
then components=$components$sep$p
120
sep=' '
121
fi
122
done
123
break
124
fi
125
fi
126
done < $pkg
127
done
128
if [[ ! $components ]]
129
then print -u2 $command: ${packages//' '/,}: no components
130
exit 1
131
fi
132
tw $(eval ls -d $packages src/@(lib|cmd)/@(${components//' '/'|'}) |
133
sed 's/^/-d /') \
134
-e "type != DIR$from$to" \
135
ls $ls_options
136
137