Release 1.25.0 -- Buddy Idle Time, RTF
[siplcs.git] / contrib / opensuse-build-service / generate_debian.sh
blobec0217a9c5be8ddfc03d3a1d49baefaad0d58026
1 #!/bin/bash
2 abort() {
3 echo "$0: $1 - Aborting"
4 exit 1
6 cleanup() {
7 rm -rf debian
8 abort "$1"
11 # Sanity checks
12 version=$(ls pidgin-sipe-*.tar.gz | sed 's/^pidgin-sipe-//;s/.tar.gz$//')
13 [ -z "${version}" ] && abort "can't find pidgin-sipe archive"
14 [ -e debian ] && abort "directory 'debian' - already exists"
16 # Copy latest source archive
17 cp pidgin-sipe-${version}.tar.gz pidgin-sipe_${version}.orig.tar.gz
19 # Extract contrib/debian directory from release
20 tar --strip-components=2 --wildcards -xvf \
21 pidgin-sipe-${version}.tar.gz \
22 "*/contrib/debian" || cleanup "tar failed"
23 [ -e debian ] || cleanup "directory 'debian' - does not exist"
25 # Strip libnss3-dev from debian/control: build setup is controlled by .dsc's
26 sed -i.ORIG -e 's/libnss3-dev, //' debian/control
27 touch -r debian/control.ORIG debian/control
28 rm debian/control.ORIG
30 # Have the contents changed?
31 if tar 2>/dev/null -df pidgin-sipe_${version}-1.debian.tar.gz; then
32 echo "contrib/debian is unchanged - not updating .debian.tar.gz."
33 else
34 # Update debian archive
35 tar cfz pidgin-sipe_${version}-1.debian.tar.gz debian || cleanup "can't create tar archive"
37 rm -rf debian
39 # Update .dsc files
40 for p in \
41 "Checksums-Sha1=sha1sum" \
42 "Checksums-Sha256=sha256sum" \
43 "Files=md5sum";
44 do \
45 label=${p%=*}; \
46 program=${p#*=}; \
47 echo "${label}:"
48 for t in \
49 pidgin-sipe_${version}.orig.tar.gz \
50 pidgin-sipe_${version}-1.debian.tar.gz; \
51 do \
52 echo " $(${program} ${t} | cut -d' ' -f1) $(wc -c ${t})"; \
53 done \
54 done >checksums.txt
55 for d in *.dsc; do cat checksums.txt >>${d}; done
56 rm checksums.txt
58 # Newer platforms have support for freerdp2 - use only default .dsc
59 cp pidgin-sipe-freerdp2.dsc pidgin-sipe.dsc
60 # All other platforms at least support for gstreamer1.0 - override those
61 for os in \
62 Debian_9.0 \
63 xUbuntu_16.04 \
64 ; do \
65 cp pidgin-sipe-gstreamer1.dsc pidgin-sipe-${os}.dsc; \
66 done
67 # All other platforms at least support telepathy - override those
68 for os in \
69 Debian_8.0 \
70 ; do \
71 cp pidgin-sipe-telepathy.dsc pidgin-sipe-${os}.dsc; \
72 done
74 # Update SHA-2 256 checksum in Arch Linux PKGBUILD
75 sed -i -e "s/@@SHA256SUM@@/$(sha256sum pidgin-sipe-${version}.tar.gz | cut -d' ' -f1)/" PKGBUILD
77 # That's all folks...
78 echo "Done."
79 osc status
80 exit 0