Debian Codegraph @

extras/pack.pullrequest.bash

raw
1 #!/bin/bash -ex
2
3 # pack.*.bash - Bash script to help packaging avr core releases.
4 # Copyright (c) 2015 Arduino LLC. All right reserved.
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
20 PR_NUMBER=$1
21 BUILD_NUMBER=$2
22 VERSION=`grep version= platform.txt | sed 's/version=//g'`
23
24 PWD=`pwd`
25 FOLDERNAME=`basename $PWD`
26 THIS_SCRIPT_NAME=`basename $0`
27 FILENAME=package_avr-b${BUILD_NUMBER}.tar.bz2
28
29 rm -f $FILENAME
30
31 # Change name in platform.txt
32 sed -i "s/name=.*/name=SAMD Pull request #${PR_NUMBER} (Build ${BUILD_NUMBER})/" platform.txt
33
34 cd ..
35 tar --transform "s|$FOLDERNAME|avr-PR${PR_NUMBER}_b${BUILD_NUMBER}|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf $FILENAME $FOLDERNAME
36 cd -
37
38 mv ../$FILENAME .
39
40 CHKSUM=`sha256sum $FILENAME | awk '{ print $1 }'`
41 SIZE=`wc -c $FILENAME | awk '{ print $1 }'`
42
43 cat extras/package_index.json.PR.template |
44 sed s/%%PR_NUMBER%%/${PR_NUMBER}/ |
45 sed s/%%BUILD_NUMBER%%/${BUILD_NUMBER}/ |
46 sed s/%%VERSION%%/${VERSION}-build-${BUILD_NUMBER}/ |
47 sed s/%%FILENAME%%/${FILENAME}/ |
48 sed s/%%CHECKSUM%%/${CHKSUM}/ |
49 sed s/%%SIZE%%/${SIZE}/ > package_avr-b${BUILD_NUMBER}_index.json
50