File: ace_components

package info (click to toggle)
ace 8.0.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 46,932 kB
  • sloc: cpp: 341,621; perl: 31,868; sh: 1,963; python: 529; yacc: 511; xml: 330; lex: 158; lisp: 116; makefile: 85; csh: 20; ansic: 19; tcl: 5
file content (105 lines) | stat: -rwxr-xr-x 2,389 bytes parent folder | download | duplicates (5)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#! /bin/sh
#
# Encapsulates set/access of a components file, which records set of
# components that were built in a library.  Intended to be used by
# GNUmakefiles and scripts.  See ACE_wrappers/ace/GNUmakefile for an
# example.
#
usage="usage: $0 --ace | --orbsvcs | --tao \
 [--remove | --set \" <components list> \"]"

####
#### Make sure that ACE_ROOT, and TAO_ROOT are set.
####
if [ ! "$ACE_ROOT" ]; then
  echo $0': your ACE_ROOT environment variable is not set!' 1>&2
  exit -1
fi
if [ ! "$TAO_ROOT" ]; then
  TAO_ROOT=$ACE_ROOT/TAO
  export TAO_ROOT
fi

####
#### Process command line arguments.
####
if [ $# -ge 1 ]; then
  case $1 in
    --ace) components_file=$ACE_ROOT/ace/ACE_COMPONENTS.list ;;
    --orbsvcs)
      components_file=$TAO_ROOT/orbsvcs/orbsvcs/ORBSVCS_COMPONENTS.list ;;
    --tao) components_file=$TAO_ROOT/tao/TAO_COMPONENTS.list ;;
    *) echo $usage; exit -1 ;;
  esac
  shift
else
  echo $usage
  exit -1
fi

set_components=0
append_components=0
if [ $# -ge 1 ]; then
  if [ $1 = '--set' ]; then
    set_components=1
    shift
    if [ $# -eq 1 ]; then
      components=$1
      shift
    else
      echo $usage
      exit -1
    fi
  elif [ $1 = '--append' ]; then
    append_components=1
    shift
    if [ $# -eq 1 ]; then
      components=$1
      shift
    else
      echo $usage
      exit -1
    fi
  elif [ $1 = '--remove' ]; then
    rm -f $components_file
  else
    echo $usage
    exit -1
  fi
fi

if [ $set_components -eq 1 ]; then
  ####
  #### Update the components file, if it has changed since last set.
  ####
  if [ -f $components_file ]; then
    if echo "$components" | diff - $components_file > /dev/null; then
      :
    else
      echo "$components" > $components_file
    fi
  else
    echo "$components" > $components_file
  fi
elif [ $append_components -eq 1 ]; then
  ####
  #### Update the components file, if it has changed since last set.
  ####
  if [ -f $components_file ]; then
    if cat $components_file | grep "$components" > /dev/null; then
      :
    else
      (cat $components_file; echo "$components") | tr ' ' '\012' | sort -u > $components_file.$$
      mv -f $components_file.$$ $components_file
    fi
  else
    echo "$components" > $components_file
  fi
else
  ####
  #### Access the contents of the components file, if it exists.
  ####
  if [ -f $components_file ]; then
    cat $components_file
  fi
fi