OBS: updates for Ubuntu 14.04
[siplcs.git] / contrib / opensuse-build-service / generate_debian.sh
blob8cc13d6c417406179007ce38d180a6a7e2ecb1f6
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 # Overwrite those .dsc's that have support for Voice & Video
59 for os in \
60 xUbuntu_11.10; \
61 do \
62 cp pidgin-sipe-VandV.dsc pidgin-sipe-${os}.dsc; \
63 done
65 # Overwrite those .dsc's that have support for telepathy
66 for os in \
67 Debian_7.0 \
68 xUbuntu_14.04 \
69 xUbuntu_13.10 \
70 xUbuntu_13.04 \
71 xUbuntu_12.10 \
72 xUbuntu_12.04; \
73 do \
74 cp pidgin-sipe-telepathy.dsc pidgin-sipe-${os}.dsc; \
75 done
77 # Update SHA-2 256 checksum in Arch Linux PKGBUILD
78 sed -i -e "s/@@SHA256SUM@@/$(sha256sum pidgin-sipe-${version}.tar.gz | cut -d' ' -f1)/" PKGBUILD
80 # That's all folks...
81 echo "Done."
82 osc status
83 exit 0