summaryrefslogtreecommitdiffstats
path: root/contrib/mingw/upload.sh
blob: d2ffeca3040a067336e6bea377d758d191f85dd4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#! /bin/sh

# RTEMS Installers and Source Upload script.
#
# This script copies the executable and source to the RTEMS FTP server. It is for
# use on the RTEMS build server.
#

echo $0 $*

source=$(dirname $0)
top=$(pwd)

terminate()
{
  echo "error: $*" >&2
  exit 1
}

check()
{
  if [ $? -ne 0 ]; then
    terminate
  fi
}

. $source/version

ftpbase=none
prefix=none

while [ $# -gt 0 ];
do
  case $1 in
    -b)
      shift
      tool_build=$1
      ;;
    -d)
      set -x
      ;;
    -f)
      shift
      ftpbase=$1
      ;;
    -p)
      shift
      prefix=$1
      ;;
    -v)
      shift
      version=$1
      ;;
    --help)
      echo "$0 -d -b <build> -f <ftpbase> -p <prefix> -v <version>"
      exit 2
      ;;
    *)
      terminate "error: invalid option (try --help): $1"
      ;;
  esac
  shift
done

if [ $ftpbase = none ]; then
  terminate "no ftpbase set"
fi

if [ $prefix = none ]; then
  terminate "no prefix set"
fi

exebase=${prefix}/${version}/packages/mingw32/exe
srcbase=${prefix}/${version}/packages/mingw32/SRPMS

mkdir -p ${ftpbase}/${version}/build-${tool_build}/source
check "creating: ${ftpbase}/${version}/build-${tool_build}/source"

exes=$(find $exebase -name \*-${tool_build}.exe)
for e in $exes
do
  echo "cp $e ${ftpbase}/${version}/build-${tool_build}/."
  cp $e ${ftpbase}/${version}/build-${tool_build}/.
  check "coping installer: $e"
done

cd ${ftpbase}/${version}/build-${tool_build}/source
check "change directory: ${ftpbase}/${version}/build-${tool_build}/source"

for s in ${srcbase}/*.rpm
do
  echo "rpm2cpio $s | cpio --extract --quiet"
  rpm2cpio $s | cpio --extract --quiet
  check "RPM to CPIO and CPIO Copy-In failed"
done

rm -f *.spec
check "deleting spec files"

cd $top

exit 0