-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathechodeps
executable file
·76 lines (64 loc) · 2.34 KB
/
echodeps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
#+
# Name:
# echodeps
# Purpose:
# Report the packages that a package directly depends on, given
# the package ".properties" file.
# Description:
# Extracts the packages that a package depends on by looking in
# a given ".properties" file for a jar.class.path property.
# This property contains a list of the jar files that a package
# depends on and consequently is also an enumeration of the
# packages that a package depends on.
#
# The format of property files means a jar.class.path will
# probably look something like:
#
# jar.class.path=bsh-1.2b7.jar splat_colt.jar jdom.jar jhall.jar \
# splat_help.jar jsci_core.jar jsci_wavelet.jar \
# ../astgui/astgui.jar ../ndx/ndx.jar ../hdx/hdx.jar ../array/array.jar \
# ../tamfits/tamfits.jar ../jniast/jniast.jar \
# ../soapserver/soapserver.jar ../fits/fits.jar ../hds/hds.jar \
# ../treeview/treeview.jar ../pal/pal.jar ../diva/diva.jar
#
# So this script does the job of joining the continuation parts,
# extracting the jar.class.path property and then reporting the
# package part of each jar file (the xxx part of ../xxx/some.jar).
#
# Note this must be run from the "source" directory.
# Type of Module:
# Shell script.
# Copyright:
# Copyright (C) 2003 Central Laboratory of the Research Councils
# Authors:
# PWD: P.W. Draper (Starlink, Durham University)
# {enter_new_authors_here}
# History:
# 30-SEP-2003 (PWD):
# Original version.
# {enter_further_changes_here}
# Bugs:
# {note_any_bugs_here}
#-
if test "$1" = ""; then
echo "Usage: ./scripts/echodeps <.properties file>"
exit
fi
# Get sed to join continuation lines (ending in a \) and then extract
# the line starting "jar.class.path=". Strip off any
# .jar extensions (needed for ant which is ../ant.jar). Spaces in
# that line are then replaced by a newline so that each word becomes
# a line. All lines containing "../" are then resolved by grep (lines
# that do not start with "../" are local jar files). Finally awk uses
# '/' to separate the lines into words of which the second should be
# the package name!
cat $1 | \
sed -n \
-e :a \
-e '/\\$/N; s/\\\n//; ta' \
-e "/jar\.class\.path=/ s/jar\.class\.path=//gp" | \
sed -e 's/\.jar//g' | \
tr " " "\n" | \
grep '\.\./' | \
awk -F '/' '{print $2}'