source: rtems-release/rtems-release-package @ db2c683

5
Last change on this file since db2c683 was db2c683, checked in by Chris Johns <chrisj@…>, on Oct 29, 2019 at 4:27:17 AM

Update to support RTEMS 5

  • Property mode set to 100755
File size: 4.5 KB
Line 
1#! /bin/sh
2#
3# RTEMS Tools Project (http://www.rtems.org/)
4# Copyright 2015,2016,2019 Chris Johns (chrisj@rtems.org)
5# All rights reserved.
6#
7# This file is part of the RTEMS Tools package in 'rtems-tools'.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions are met:
11#
12# 1. Redistributions of source code must retain the above copyright notice,
13# this list of conditions and the following disclaimer.
14#
15# 2. Redistributions in binary form must reproduce the above copyright notice,
16# this list of conditions and the following disclaimer in the documentation
17# and/or other materials provided with the distribution.
18#
19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29# POSSIBILITY OF SUCH DAMAGE.
30#
31
32#
33# This script packages a package in a tar file.
34#
35. ${release_top}/rtems-release-version
36echo "RTEMS Release Package, v${rtems_release_version}"
37
38#
39# Defaults.
40#
41. ${release_top}/rtems-release-defaults
42
43#
44# Common package start.
45#
46. ./rtems-release-package-start
47
48#
49# Work in a package specific directory in the release directory.
50#
51echo "git clone ${git_remote} ${git_local}"
52git clone ${git_remote} ${git_local}
53
54stamped_tar=${prefix}-unstamped
55
56#
57# Clone the repo and then check if there are any submodules.
58#
59# If there are submodules, exclude the ones we do not wish to package, eg the
60# whole of the FreeBSD source tree. For the ones to package get the commit
61# (treeish) for the branch we releasing and then create an archive. The
62# submodule archives are merged into the main archive once we have collected
63# them all.
64#
65#
66cd ${git_local}
67 echo "git fetch origin"
68 git fetch origin
69 # Get the remote branch. If the release branch is not found use master.
70 remote_branch=$(git branch --remote | grep ${version} | tr -d "[:space:]")
71 if [ -z "${remote_branch}" ]; then
72  remote_branch="master"
73 fi
74 git_submodules=$(git submodule | cut -w -f 2)
75 if [ -n "${git_submodules}" ]; then
76  echo "git submodules found ...."
77  git submodule init
78  for s in ${git_submodules}
79  do
80   ok=$(echo ${git_submodules_excludes} | sed -e "s/.*${s}.*/no/g")
81   if [ "${ok}" != "no" ]; then
82    echo "git submodule update ${s}"
83    git submodule update ${s}
84    treeish=$(git ls-tree ${remote_branch} ${s} | cut -w -f 3)
85    cd ${s}
86     echo "git archive --format=tar --prefix=${prefix}/${s}/ ${treeish}"
87     git archive --format=tar --prefix=${prefix}/${s}/ ${treeish} > \
88                                          ../../${stamped_tar}-${s}.tar
89     cd ..   # ${s}
90   else
91    echo "git submodule ${s} excluded"
92   fi
93  done
94 fi
95 echo "git archive --format=tar --prefix=${prefix}/ ${remote_branch}"
96 git archive --format=tar --prefix=${prefix}/ ${remote_branch} > \
97                                          ../${stamped_tar}.tar
98 cd ..   # ${git_local}
99
100if [ ! -f ${stamped_tar}.tar ]; then
101 echo "error: git archive failed, no tar file"
102 exit 1
103fi
104echo "tar xf ${stamped_tar}.tar"
105tar Jxf ${stamped_tar}.tar
106if [ -n "${git_submodules}" ]; then
107 for s in ${git_submodules}
108 do
109   ok=$(echo ${git_submodules_excludes} | sed -e "s/.*${s}.*/no/g")
110   if [ "${ok}" != "no" ]; then
111    echo "tar xf ${stamped_tar}-${s}.tar"
112    tar Jxf ${stamped_tar}-${s}.tar
113   fi
114 done
115fi
116
117cd ${prefix}
118 echo "Creating VERSION: ${release}"
119 echo "[version]" > VERSION
120 echo "release = ${release}" >> VERSION
121 cd ..   # ${prefix}
122
123#
124# Run the worker script if provided. It can perform any package
125# specific set up functions. This is done before we finally
126# package the release.
127#
128if [ -n "${worker}" ]; then
129 ${worker} ${package} ${version} ${revision} ${top}
130fi
131
132#
133# The '..' is the release directory.
134#
135echo "tar cf - ${prefix}"
136tar cf - ${prefix} | ${comp} > ../${prefix}.tar.${comp_ext}
137
138echo "Created: ${release}/${prefix}.tar.${comp_ext}"
139
140#
141# Comman package end.
142#
143. ${top}/rtems-release-package-end
144
145exit 0
Note: See TracBrowser for help on using the repository browser.