File: create_package

package info (click to toggle)
kim-api 2.0~beta2.gita734d1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,944 kB
  • sloc: cpp: 22,447; f90: 13,218; ansic: 3,865; sh: 1,960; makefile: 298
file content (120 lines) | stat: -rwxr-xr-x 3,456 bytes parent folder | download
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
#!/bin/sh

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the Common Development
# and Distribution License Version 1.0 (the "License").
#
# You can obtain a copy of the license at
# http://www.opensource.org/licenses/CDDL-1.0.  See the License for the
# specific language governing permissions and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each file and
# include the License file in a prominent location with the name LICENSE.CDDL.
# If applicable, add the following below this CDDL HEADER, with the fields
# enclosed by brackets "[]" replaced with your own identifying information:
#
# Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
#
# CDDL HEADER END
#

#
# Copyright (c) 2013--2018, Regents of the University of Minnesota.
# All rights reserved.
#
# Contributors:
#    Ryan S. Elliott
#

# check for errors

if test $# -lt 4; then
  printf "usage: %s packagename major minor patch [prerelease]\n" $0
  exit
fi

# DO IT

cd "`git rev-parse --show-toplevel`"

packagename=$1
major=$2
minor=$3
patch=$4
versionstring=v${major}.${minor}.${patch}
if test $# -ge 5; then
  prerelease=$5
  prerelease_w_space=" ${prerelease}"
  versionstring=${versionstring}-${prerelease}
else
  prerelease=""
  prerelease_w_space=""
fi
fullpackagename=${packagename}-${versionstring}

# check for more errors

if test -e "${fullpackagename}"; then
  printf "File '${fullpackagename}' exits! exiting...\n"
  exit
fi

if test $major -ne `grep VERSION_MAJOR Makefile.Version | sed -e 's/VERSION_MAJOR[[:space:]]*=[[:space:]]*//'`; then
  printf "Major version mismatch with Makefile.Version\n";
  printf "exiting...\n";
  exit
fi
if test $minor -ne `grep VERSION_MINOR Makefile.Version | sed -e 's/VERSION_MINOR[[:space:]]*=[[:space:]]*//'`; then
  printf "Minor version mismatch with Makefile.Version\n";
  printf "exiting...\n";
  exit
fi
if test $patch -ne `grep VERSION_PATCH Makefile.Version | sed -e 's/VERSION_PATCH[[:space:]]*=[[:space:]]*//'`; then
  printf "Patch version mismatch with Makefile.Version\n";
  printf "exiting...\n";
  exit
fi

git clone . $fullpackagename

cd $fullpackagename

versionfile=${packagename}.release.info
printf "This package ($fullpackagename) created from commit\n"                           >  $versionfile
printf "\n"                                                                              >> $versionfile
git rev-parse HEAD                                                                       >> $versionfile
printf "\n"                                                                              >> $versionfile
printf "of the kim-api git repository\n"                                                 >> $versionfile
printf "By `git config user.name` (`git config user.email`) on `date`.\n"                >> $versionfile

rm -rf '.git'

ed Makefile.Version <<EOF
,s/^VERSION_PRERELEASE.*/VERSION_PRERELEASE =${prerelease_w_space}/
,s/^VERSION_BUILD_METADATA.*/VERSION_BUILD_METADATA = \$(KIM_COMPILERSUITE).\$(KIM_SYSTEMLINKER).\$(KIM_SYSTEMARCH).\$(KIM_LINK)/
w
EOF

rm -f '.travis.yml'
rm -rf script
rm -f `find . -name ".gitignore"`

for fl in `grep -l -r "kim-api\.git repository" *`; do
   ed $fl <<EOF
,s/kim-api\.git repository/$fullpackagename package/g
w
EOF
done

cd ./documentation

make pdf
rm -rf "./latex"

cd ../..

tar cJvf $fullpackagename.txz $fullpackagename

rm -rf "$fullpackagename"