File: make-src-tape

package info (click to toggle)
swi-prolog 6.6.6-1~bpo70+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 82,312 kB
  • sloc: ansic: 322,250; perl: 245,822; sh: 6,651; java: 5,254; makefile: 4,423; cpp: 4,153; ruby: 1,594; yacc: 843; xml: 82; sed: 12; sql: 6
file content (150 lines) | stat: -rwxr-xr-x 3,235 bytes parent folder | download | duplicates (2)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
#
# Make the SWI-Prolog source archives by running this script. Before
# you start:
#
#	* Update VERSION
#	* Run ./newversion, which creates a GIT tag VN.N.N
#	* Run ./make-src-tape
#
# This script requires GNU-tar!

COREMODULES="bench packages/chr packages/clpqr packages/inclpr packages/jpl"
COREMODULES+=" packages/xpce packages/odbc packages/protobufs"
COREMODULES+=" packages/sgml packages/clib packages/http packages/plunit"
COREMODULES+=" packages/pldoc packages/RDF packages/semweb packages/ssl"
COREMODULES+=" packages/R packages/zlib packages/tipc packages/table"
COREMODULES+=" packages/nlp packages/cpp packages/PDT packages/utf8proc"
COREMODULES+=" packages/archive packages/swipl-win"

if [ -r modules ]; then
  SUBMODULES="`cat modules`"
else
  SUBMODULES="$COREMODULES"
fi

name=pl
namesep=-
version=`cat VERSION`
compress=gzip
me=`basename $PWD`
quiet=false
gendoc=true

TAG="V$version"

usage()
{ cat << _EOM_
Usage: $(basename $0) [option ...]
Options:
  --tag=Tag
    Create archive for the given version
  --version=Version
    Create archive for the given version
  --name=Name [default $name]
    Create archive for the given version
  --sep=Sep [default $namesep]
    Separator between name and version
  --submodule=Module
    Add an additional module (can be repeated)
  --no-doc
    Do not generate documentation archive
  --quiet
    Work silently
  --help
    Print this message
_EOM_
}

while [ x"$1" != x"" ]; do
  case "$1" in
      --tag=*)
	  TAG=`echo $1 | sed 's/--[^=]*=//'`
	  shift
	  ;;
      --submodule=*)
	  SUBMODULES+=" $(echo $1 | sed 's/--[^=]*=//')"
	  shift
	  ;;
      --name=*)
	  name=`echo $1 | sed 's/--[^=]*=//'`
	  shift
	  ;;
      --sep=*)
	  namesep=`echo $1 | sed 's/--[^=]*=//'`
	  shift
	  ;;
      --version=*)
	  version=`echo $1 | sed 's/--[^=]*=//'`
	  shift
	  ;;
      --no-doc)
	  gendoc=false
	  shift
	  ;;
      --quiet)
	  quiet=true
	  shift
	  ;;
      --help)
	  usage
	  exit 0
	  ;;
      --*)
	  usage
	  exit 1
	  ;;
      *)
  esac
done

if ! git diff --quiet; then
    echo "Fatal: directory is dirty"
    exit 1
fi

prefix=$name$namesep$version
out=$prefix.tar
extra=$name-extra-$version.tar
doc=$name-doc-$version.tar

# core SWI-Prolog snapshot from GIT
git archive --format=tar --prefix=$prefix/ "$TAG" > ../$out

#add the submodules
for sm in `git submodule status $SUBMODULES | awk '{printf "%s:%s\n", $1, $2}'`; do
    sha1=`echo $sm | awk -F: '{print $1}'`
    path=`echo $sm | awk -F: '{print $2}'`
    [ $quiet = true ] || echo -n "adding module $path at $sha1 ... "
    git --git-dir $path/.git archive --format=tar --prefix=$prefix/$path/ $sha1 > tmp.tar
    tar -Af ../$out tmp.tar
    rm tmp.tar
    [ $quiet = true ] || echo ok
done

# generated documentation files
if [ $gendoc = true ]; then
  echo $version > doc-version
  tar zcf ../$doc.gz ./doc-version `cat gen-files/doc`
fi

cd ..
ln -s $me $prefix

# Extras, also starting with $name-<version>
tar cfh $extra `sed "s@^@$prefix/@" $me/gen-files/config`
tar cfh $doc `sed "s@^@$prefix/@" $me/gen-files/doc`

# Append them (needs GNU-tar)
tar -Af $out $extra
tar -Af $out $doc

# cleanup
rm $extra
rm $doc
rm $prefix

# compress the result
rm -f $out.gz
$compress $out