OBS: switch to default pidgin-sipe.dsc
[siplcs.git] / contrib / opensuse-build-service / generate_debian.sh
blobb5fb5c2858f256161fc39b5ea7f4ce9b0de78ae5
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 # All current platforms currently support telepathy - use only default .dsc
59 cp pidgin-sipe-telepathy.dsc pidgin-sipe.dsc
60 # Overwrite those .dsc's that have support for telepathy
61 #for os in \
62 # Debian_x.y \
63 # xUbuntu_xx.yy; \
64 #do \
65 # cp pidgin-sipe-telepathy.dsc pidgin-sipe-${os}.dsc; \
66 #done
68 # Update SHA-2 256 checksum in Arch Linux PKGBUILD
69 sed -i -e "s/@@SHA256SUM@@/$(sha256sum pidgin-sipe-${version}.tar.gz | cut -d' ' -f1)/" PKGBUILD
71 # That's all folks...
72 echo "Done."
73 osc status
74 exit 0