release-windows-packages 3.58 KB
Newer Older
1
2
3
4
5
6
#!/bin/sh
#
# unpack windows rpm's from opensuse download server, upload files to kde.org and file a related release ticket
#
# Author: Ralf Habacker <ralf.habacker@freenet.de>
#
7
8
9
10
# requirements:
#
#  osc       - opensuse command line client
#
11
12
13
14
15
16
17
18
19
20
21
22
23
# syntax: release-windows-packages <mode>
#
# where mode is:
#
# clean      - clean working area
# fetch      - fetch file lists from opensuse download server
# download   - download rpm packages
# unpack     - unpack rpm files
# repack     - repackage source tar ball to 7z
# upload     - upload files to ftp:/upload.kde.org
# ticket     - file a tar ball move request
# all        - performs all above mentioned steps
#
24
ARCH=openSUSE_42.2
25
VERSION=2.20.80
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
BASEURL64=http://download.opensuse.org/repositories/windows:/mingw:/win64/${ARCH}
BASEURL32=http://download.opensuse.org/repositories/windows:/mingw:/win32/${ARCH}

PHABURL=https://phabricator.kde.org
apitoken=cli-uxo23l4q5qrzoyscbz5kp4zcngqp
options='projectPHIDs[]=PHID-PROJ-3qa4tomwgrmcmp4ym2ow'

if ! test -d "work"; then
    mkdir work
fi

case $1 in
clean)
        rm -rf work/*
        ;;

download)
43
44
45
46
47
48
49
        cd work
        rm -rf binaries
        osc getbinaries windows\:mingw:\win32 mingw32-umbrello-installer $ARCH x86_64
        osc getbinaries windows\:mingw:\win64 mingw64-umbrello-installer $ARCH x86_64
        osc getbinaries windows\:mingw:\win32 mingw32-umbrello $ARCH x86_64 --sources
        # we only need once source package
        #osc getbinaries windows\:mingw:\win64 mingw64-umbrello openSUSE_13.2 x86_64 --sources
50
51
52
        ;;

unpack)
53
54
55
56
57
58
        cd work
        files=$(find binaries -name *installer* -o -name *portable* -o -name *src* | grep "$VERSION")
        if test -d tmp; then
                rm -rf tmp
        fi
        mkdir -p tmp
59
        for i in $(echo $files); do
60
                (cd tmp; rpm2cpio ../$i | cpio -idmv)
61
62
        done
        # move binary packages
63
64
65
66
        rm -rf out
        mkdir -p out
        find tmp/ -name '*.exe' -exec mv {} out \;
        find tmp/ -name '*.7z' -exec mv {} out \;
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
103
104
105
106
107
108
109
110
        ;;

repack)
        # repackage source package
        srcfile=$(find work/tmp -name '*.xz')
        outfile=$(basename $srcfile | sed 's,\.tar\.xz,\.7z,g')
        (mkdir -p work/srctmp; cd work/srctmp; tar -xJf ../../$srcfile; 7za a ../out/$outfile *; cd ..; rm -rf srctmp)
        # create sha256sums
        (cd work/out; sha256sum  *.7z *.exe > umbrello.sha256sum)
        ;;

upload)
        # upload
        for i in $(find work/out -name '*.7z' -o -name '*.exe'); do
                curl -T $i  ftp://upload.kde.org/incoming/
        done
        ;;

ticket)
        description="Please move the umbrello related files which has been uploaded to upload.kde.org/incoming to download mirror 'stable/umbrello/$VERSION' location and please update the symbolic link 'stable/umbrello/latest' to 'stable/umbrello/$VERSION'"
        sums=$(cat work/out/umbrello.sha256sum | sort -n | gawk 'BEGIN { print "dir   shasum                                                            file"}  $2 ~ /i686/ { print "win32 " $0 } $2 ~ /x86_64/ { print "win64 " $0 } $2 ~ /umbrello-[0-9]/ { print "src   " $0 }')
        description=$(echo -e "$description\n\n$sums")
        curl $PHABURL/api/maniphest.createtask \
        -d api.token=$apitoken \
        -d "title=tarball move request for stable/umbrello/$VERSION" \
        -d "description=$description" \
        -d "$options"
        ;;
all)
        $0 clean
        $0 download
        $0 unpack
        $0 repack
        $0 upload
        $0 ticket
        ;;

*)
        echo "Make sure to setup VERSION inside $0 and run"
        echo "$0 all"
        ;;
esac

exit 0