1 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
2 | # Copyright 2015-2016 Chris Johns (chrisj@rtems.org) |
---|
3 | # All rights reserved. |
---|
4 | # |
---|
5 | # This file is part of the RTEMS Tools package in 'rtems-tools'. |
---|
6 | # |
---|
7 | # Redistribution and use in source and binary forms, with or without |
---|
8 | # modification, are permitted provided that the following conditions are met: |
---|
9 | # |
---|
10 | # 1. Redistributions of source code must retain the above copyright notice, |
---|
11 | # this list of conditions and the following disclaimer. |
---|
12 | # |
---|
13 | # 2. Redistributions in binary form must reproduce the above copyright notice, |
---|
14 | # this list of conditions and the following disclaimer in the documentation |
---|
15 | # and/or other materials provided with the distribution. |
---|
16 | # |
---|
17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
27 | # POSSIBILITY OF SUCH DAMAGE. |
---|
28 | # |
---|
29 | |
---|
30 | # |
---|
31 | # This script starts the packaging. |
---|
32 | # |
---|
33 | |
---|
34 | # |
---|
35 | # Keep the top where we start. |
---|
36 | # |
---|
37 | top=${PWD} |
---|
38 | |
---|
39 | # |
---|
40 | # The package, version and revision amd maybe a worker script. |
---|
41 | # |
---|
42 | if [ $# -lt 3 -o $# -gt 4 ]; then |
---|
43 | echo "error: must be 3 or 4 arguments, the package, version," \ |
---|
44 | "release and optionally a worker script." |
---|
45 | exit 1 |
---|
46 | fi |
---|
47 | package=$1 |
---|
48 | version=$2 |
---|
49 | revision=$3 |
---|
50 | if [ $# -eq 4 ]; then |
---|
51 | if [ ! -x ${top}/$4 ]; then |
---|
52 | echo "error: cannot find the worker: $4" |
---|
53 | exit 1 |
---|
54 | fi |
---|
55 | worker=${top}/$4 |
---|
56 | else |
---|
57 | worker= |
---|
58 | fi |
---|
59 | |
---|
60 | revision_no=$(echo ${revision} | sed -e 's/\-.*$//') |
---|
61 | release=${version}.${revision} |
---|
62 | prefix=${package}-${release} |
---|
63 | |
---|
64 | if [ -z "${rtems_git_repo}" ]; then |
---|
65 | rtems_git_repo=yes |
---|
66 | fi |
---|
67 | |
---|
68 | if [ ${rtems_git_repo} = yes ]; then |
---|
69 | git_remote=git://git.rtems.org/${package}.git |
---|
70 | git_local=${package}-release-${release}.git |
---|
71 | git_submodules_excludes="freebsd-org" |
---|
72 | fi |
---|
73 | |
---|
74 | workspace=ws-${package} |
---|
75 | |
---|
76 | checksum=sha512 |
---|
77 | |
---|
78 | echo "Package: ${package}" |
---|
79 | echo "Release: ${release}" |
---|
80 | if [ ${rtems_git_repo} = yes ]; then |
---|
81 | echo "Repo : ${git_remote}" |
---|
82 | fi |
---|
83 | |
---|
84 | if [ ! -e ${release} ]; then |
---|
85 | mkdir ${release} |
---|
86 | else |
---|
87 | if [ ! -d ${release} ]; then |
---|
88 | echo "error: ${release} exists and is not a directory." |
---|
89 | exit 1 |
---|
90 | fi |
---|
91 | fi |
---|
92 | |
---|
93 | # |
---|
94 | # Work in a package specific directory in the release directory. |
---|
95 | # |
---|
96 | cd ${release} |
---|
97 | rm -rf ${workspace} |
---|
98 | mkdir ${workspace} |
---|
99 | cd ${workspace} |
---|