source: rtems-release/rtems-release-sources @ 34dfc16

5
Last change on this file since 34dfc16 was 34dfc16, checked in by Chris Johns <chrisj@…>, on 04/12/17 at 01:03:01

Use the top level rtems-tools and kernel packages. These are stamped.

The rtems-release-source packages are not version stamped so are not
suitable.

Clean any empty git repos if found. Creating rtems-tools and kernel
packages creates git source which is not allowed for a release.

  • Property mode set to 100755
File size: 6.5 KB
Line 
1#! /bin/sh
2#
3# RTEMS Tools Project (http://www.rtems.org/)
4# Copyright 2015-2016 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
36echo "RTEMS Release Sources, v0.1"
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    echo "../source-builder/sb-set-builder --dry-run --with-download " \
110         "--without-error-report --without-release-url " \
111         "${rtems_pkgs}"
112    ../source-builder/sb-set-builder --dry-run --with-download \
113                                     --without-error-report \
114                                     --without-release-url \
115                                     ${rtems_pkgs}
116    #
117    # Remove the top level packages because they do not have a VERSION file.
118    #
119    # These packages may or will be referencing git so remove those as well.
120    #
121    for p in rtems-tools rtems
122    do
123     rm sources/${p}-${release}.tar.${comp_ext}
124     rm -rf sources/git/${p}.git
125    done
126    #
127    # Remove the git, svn or cvs directory if empty.
128    #
129    for d in git svn cvs
130    do
131     find sources/${d} -type d -empty -delete
132    done
133    #
134    # If git, svn or cvs exist the release fails.
135    #
136    if [ -d sources/git -o -d sources/svn -o -d sources/cvs ]; then
137     echo "error: ${release} contains repositories and cannot be released."
138     exit 1
139    fi
140    cd ..    # rtems
141
142   #
143   # Fetch the source for 3rd party packages tools.
144   #
145   if [ -n "${bare_pkgs}" -a "${bare_pkgs}" != "None" ]; then
146    cd bare
147     export_source="${export_source} bare"
148     mkdir sources patches
149     echo "../source-builder/sb-set-builder --dry-run --with-download " \
150          "--without-error-report --without-release-url " \
151          "${bare_pkgs}"
152     ../source-builder/sb-set-builder --dry-run --with-download \
153                                      --without-error-report \
154                                      --without-release-url \
155                                      ${bare_pkgs}
156     #
157     # Remove the git, svn or cvs directory if empty.
158     #
159     for d in git svn cvs
160     do
161      find sources/${d} -type d -empty -delete
162     done
163     #
164     # If svn or cvs exist the release fails. Git is ok.
165     #
166     if [ -d sources/svn -o -d sources/cvs ]; then
167      echo "error: ${release} contains repositories and cannot be released."
168      exit 1
169     fi
170     #
171     # If there are git repos create packages of them as they are.
172     #
173     if [ -d sources/git ]; then
174      cd sources
175       cd git
176        for g in $(ls)
177        do
178         cd ${g}
179          hash=$(git status | grep '^HEAD detached at ' | sed 's/^HEAD detached at //')
180          prefix=$(echo ${g}-${hash} | sed 's/\./\-/')
181          echo "Packaging GIT repo: ${g} to ${prefix}"
182          git archive --format=tar --prefix=${prefix}/ ${hash} | ${comp} > ../../${prefix}.tar.${comp_ext}
183          cd ..  # ${g}
184        done
185        cd ..   # git
186       rm -rf git
187       cd ..   # source
188     fi
189     cd ..   # ${bare}
190   fi
191   #
192   # Export the sources and patches.
193   #
194   rm -rf ${top}/${release}/sources
195   mkdir ${top}/${release}/sources
196   for p in ${export_source}
197   do
198    cp ${p}/sources/* ${top}/${release}/sources/
199    cp ${p}/patches/* ${top}/${release}/sources/
200   done
201   cd ..   # ${prefix}
202  cd ..   # ${workspace}
203
204  rm -rf ${workspace}
205
206  #
207  # Copy the stamped packages from the top level release directory to the
208  # sources directory. The RSB requires all source be in the `sources`
209  # directory under the release URL.
210  #
211  for p in rtems-tools rtems
212  do
213   cp ${p}-${release}.tar.${comp_ext} sources/${p}-${release}.tar.${comp_ext}
214  done
215
216  cd sources
217   rm -f ${checksum}sum.txt
218   for f in $(ls -1)
219   do
220    if [ ! -d ${f} ]; then
221     csum=$(${checksum} -q ${f})
222     echo "${csum} ${f}" >> ${checksum}sum.txt
223    fi
224   done
225   cd ..   # sources
226  cd ..   # ${release}
227
228echo "Created: ${release}/sources/${checksum}sum.txt"
229echo "Created: ${release}/sources"
230
231exit 0
Note: See TracBrowser for help on using the repository browser.