source: rtems-release/rtems-release-sources @ 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: 7.0 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# The script collects the sources for all the tools.
34#
35. ${release_top}/rtems-release-version
36echo "RTEMS Release Sources, v${rtems_release_version}"
37
38#
39# Defaults.
40#
41. ${release_top}/rtems-release-defaults
42
43#
44# The version and revision.
45#
46if [ $# -ne 2 ]; then
47 echo "error: must be 2 arguments, the version, and release."
48 exit 1
49fi
50version=$1
51revision=$2
52
53package=rtems-source-builder
54
55release=${version}.${revision}
56prefix=${package}-${release}
57
58checksum=sha512
59
60workspace=ws-${package}
61
62#
63# Source the source packages to package (haha)
64#
65. rtems-source-packages
66
67echo "Package: ${package}"
68echo "Release: ${release}"
69
70if [ ! -e ${release} ]; then
71 mkdir ${release}
72else
73 if [ ! -d ${release} ]; then
74  echo "error: ${release} exists and is not a directory."
75  exit 1
76 fi
77fi
78
79#
80# Work in a package specific directory in the release directory.
81#
82cd ${release}
83 rm -rf ${workspace}
84 mkdir ${workspace}
85 cd ${workspace}
86
87  echo "tar ${comp_tar}xf ../${prefix}.tar.${comp_ext}"
88  tar ${comp_tar}xf ../${prefix}.tar.${comp_ext}
89
90  #
91  # Get the RSB to download the source we need to release. This is 100% of the
92  # actual sourced used.
93  #
94  cd ${prefix}
95   cd rtems
96    export_source=rtems
97    mkdir sources patches
98    #
99    # Copy in any source not present on the server. If these are not copied in
100    # the RSB does not find them.
101    #
102    for p in rtems-tools rtems
103    do
104     cp ${top}/${release}/${p}-${release}.tar.${comp_ext} sources/
105    done
106    #
107    # Fetch the source for RTEMS tools.
108    #
109    if [ ${version} -lt 5 ]; then
110     echo "../source-builder/sb-set-builder --dry-run --with-download " \
111          "--without-error-report --without-release-url " \
112          "${rtems_pkgs}"
113     ../source-builder/sb-set-builder --dry-run --with-download \
114                                      --without-error-report \
115                                      --without-release-url \
116                                      ${rtems_pkgs}
117    else
118     echo "../source-builder/sb-get-sources ${rtems_pkgs}"
119     ../source-builder/sb-get-sources ${rtems_pkgs}
120    fi
121    #
122    # Remove the top level packages because they do not have a VERSION file.
123    #
124    # These packages may or will be referencing git so remove those as well.
125    #
126    for p in rtems-tools rtems
127    do
128     rm sources/${p}-${release}.tar.${comp_ext}
129     rm -rf sources/git/${p}.git
130    done
131    #
132    # Remove the git, svn or cvs directory if empty.
133    #
134    for d in git svn cvs
135    do
136     if [ -e sources/${d} ]; then
137      find sources/${d} -type d -empty -delete
138     fi
139    done
140    #
141    # If git, svn or cvs exist the release fails.
142    #
143    if [ -d sources/git -o -d sources/svn -o -d sources/cvs ]; then
144     echo "error: ${release} contains repositories and cannot be released."
145     exit 1
146    fi
147    cd ..    # rtems
148
149   #
150   # Fetch the source for 3rd party packages tools.
151   #
152   if [ -n "${bare_pkgs}" -a "${bare_pkgs}" != "None" ]; then
153    cd bare
154     export_source="${export_source} bare"
155     mkdir sources patches
156     if [ ${version} -lt 5 ]; then
157      echo "../source-builder/sb-set-builder --dry-run --with-download " \
158           "--without-error-report --without-release-url " \
159           "${bare_pkgs}"
160      ../source-builder/sb-set-builder --dry-run --with-download \
161                                       --without-error-report \
162                                       --without-release-url \
163                                       ${bare_pkgs}
164     else
165      echo "../source-builder/sb-get-sources ${bare_pkgs}"
166      ../source-builder/sb-get-sources ${bare_pkgs}
167     fi
168     #
169     # Remove the git, svn or cvs directory if empty.
170     #
171     for d in git svn cvs
172     do
173      if [ -e sources/${d} ]; then
174       find sources/${d} -type d -empty -delete
175      fi
176     done
177     #
178     # If svn or cvs exist the release fails. Git is ok.
179     #
180     if [ -d sources/svn -o -d sources/cvs ]; then
181      echo "error: ${release} contains repositories and cannot be released."
182      exit 1
183     fi
184     #
185     # If there are git repos create packages of them as they are.
186     #
187     if [ -d sources/git ]; then
188      cd sources
189       cd git
190        for g in $(ls)
191        do
192         cd ${g}
193          hash=$(git status | grep '^HEAD detached at ' | sed 's/^HEAD detached at //')
194          prefix=$(echo ${g}-${hash} | sed 's/\./\-/')
195          echo "Packaging GIT repo: ${g} to ${prefix}"
196          git archive --format=tar --prefix=${prefix}/ ${hash} | \
197              ${comp} > ../../${prefix}.tar.${comp_ext}
198          cd ..  # ${g}
199        done
200        cd ..   # git
201       rm -rf git
202       cd ..   # source
203     fi
204     cd ..   # ${bare}
205   fi
206   #
207   # Export the sources and patches.
208   #
209   rm -rf ${top}/${release}/sources
210   mkdir ${top}/${release}/sources
211   for p in ${export_source}
212   do
213    cp ${p}/sources/* ${top}/${release}/sources/
214    cp ${p}/patches/* ${top}/${release}/sources/
215   done
216   cd ..   # ${prefix}
217  cd ..   # ${workspace}
218
219  rm -rf ${workspace}
220
221  #
222  # Copy the stamped packages from the top level release directory to the
223  # sources directory. The RSB requires all source be in the `sources`
224  # directory under the release URL.
225  #
226  for p in rtems-tools rtems
227  do
228   cp ${p}-${release}.tar.${comp_ext} sources/${p}-${release}.tar.${comp_ext}
229  done
230
231  cd sources
232   rm -f ${checksum}sum.txt
233   for f in $(ls -1)
234   do
235    if [ ! -d ${f} ]; then
236     csum=$(${checksum} -q ${f})
237     echo "${csum} ${f}" >> ${checksum}sum.txt
238    fi
239   done
240   cd ..   # sources
241  cd ..   # ${release}
242
243echo "Created: ${release}/sources/${checksum}sum.txt"
244echo "Created: ${release}/sources"
245
246exit 0
Note: See TracBrowser for help on using the repository browser.