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

5
Last change on this file since db2c683 was db2c683, checked in by Chris Johns <chrisj@…>, on 10/29/19 at 04:27:17

Update to support RTEMS 5

  • Property mode set to 100755
File size: 4.5 KB
RevLine 
[97cc04c]1#! /bin/sh
2#
3# RTEMS Tools Project (http://www.rtems.org/)
[db2c683]4# Copyright 2015,2016,2019 Chris Johns (chrisj@rtems.org)
[97cc04c]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#
[db2c683]35. ${release_top}/rtems-release-version
36echo "RTEMS Release Package, v${rtems_release_version}"
[97cc04c]37
38#
[ead5f49]39# Defaults.
[97cc04c]40#
[ead5f49]41. ${release_top}/rtems-release-defaults
[97cc04c]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
[e86b33f]54stamped_tar=${prefix}-unstamped
[97cc04c]55
[e86b33f]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#
[97cc04c]66cd ${git_local}
[f370800]67 echo "git fetch origin"
68 git fetch origin
[db2c683]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
[e86b33f]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}
[db2c683]84    treeish=$(git ls-tree ${remote_branch} ${s} | cut -w -f 3)
[e86b33f]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
[db2c683]95 echo "git archive --format=tar --prefix=${prefix}/ ${remote_branch}"
96 git archive --format=tar --prefix=${prefix}/ ${remote_branch} > \
[e86b33f]97                                          ../${stamped_tar}.tar
98 cd ..   # ${git_local}
[97cc04c]99
[e86b33f]100if [ ! -f ${stamped_tar}.tar ]; then
[97cc04c]101 echo "error: git archive failed, no tar file"
102 exit 1
103fi
[fd5559f]104echo "tar xf ${stamped_tar}.tar"
[e86b33f]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
[fd5559f]111    echo "tar xf ${stamped_tar}-${s}.tar"
[e86b33f]112    tar Jxf ${stamped_tar}-${s}.tar
113   fi
114 done
115fi
[97cc04c]116
117cd ${prefix}
[f370800]118 echo "Creating VERSION: ${release}"
119 echo "[version]" > VERSION
120 echo "release = ${release}" >> VERSION
[e86b33f]121 cd ..   # ${prefix}
[97cc04c]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}"
[bcd2dd3]136tar cf - ${prefix} | ${comp} > ../${prefix}.tar.${comp_ext}
[97cc04c]137
[bcd2dd3]138echo "Created: ${release}/${prefix}.tar.${comp_ext}"
[97cc04c]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.