annotate pidgin/win32/nsis/rpm2zip.sh @ 30848:77ac5f4584bd

I'm pretty sure this is a logical operation, not bitwise.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 14 Aug 2010 05:53:42 +0000
parents 23b3627ecec3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30427
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
1 #!/bin/sh
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
2
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
3 here=`pwd`
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
4 for F in $*; do
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
5 case $F in
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
6 mingw32-*.noarch.rpm|mingw64-*.noarch.rpm|*/mingw32-*.noarch.rpm|*/mingw64-*.noarch.rpm)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
7 package=`rpm -qp $F 2>/dev/null`
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
8 case $package in
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
9 mingw32-*|mingw64-*)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
10 case $package in
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
11 mingw32-*)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
12 cpu=i686
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
13 bits=32
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
14 ;;
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
15 mingw64-*)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
16 cpu=x86_64
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
17 bits=64
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
18 ;;
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
19 esac
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
20 origname=`rpm -qp --queryformat='%{NAME}' $F 2>/dev/null`
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
21 name=$origname
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
22 case $name in
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
23 *-devel)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
24 name=${name%el}
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
25 ;;
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
26 esac
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
27 shortpackage="$name"_`rpm -qp --queryformat='%{VERSION}-%{RELEASE}'_win${bits} $F 2>/dev/null`
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
28 shortpackage=${shortpackage#mingw32-}
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
29 shortpackage=${shortpackage#mingw64-}
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
30 shortname=$name
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
31 shortname=${shortname#mingw32-}
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
32 shortname=${shortname#mingw64-}
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
33 tmp=`mktemp -d`
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
34 #rpm2cpio $F | lzcat | (cd $tmp && cpio --quiet -id)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
35 rpm2cpio $F | (cd $tmp && cpio --quiet -id)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
36 (
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
37 cd $tmp
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
38 zipfile="$here/$shortpackage.zip"
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
39 rm -f $zipfile
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
40 (cd usr/${cpu}-pc-mingw32/sys-root/mingw && zip -q -r -D $zipfile .)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
41 if [ -d usr/share/doc/packages/$origname ] ; then
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
42 mv usr/share/doc/packages/$origname usr/share/doc/packages/$shortname
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
43 (cd usr && zip -q -r -D $zipfile share/doc/packages/$shortname)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
44 fi
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
45 mkdir -p manifest
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
46 unzip -l $zipfile >manifest/$shortpackage.mft
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
47 zip -q $zipfile manifest/$shortpackage.mft
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
48 N=`unzip -l $zipfile | wc -l | sed -e 's/^ *\([0-9]*\).*/\1/'`
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
49 Nm1=`expr $N - 1`
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
50 unzip -l $zipfile | sed -e "1,3 d" -e "$Nm1,$N d" | awk '{print $4}' | grep -v -E '/$' >manifest/$shortpackage.mft
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
51 zip -q $zipfile manifest/$shortpackage.mft
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
52 echo $zipfile
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
53 )
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
54 rm -rf $tmp
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
55 ;;
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
56 *)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
57 echo $F is not a mingw32/64 RPM package >&2
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
58 ;;
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
59 esac
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
60 ;;
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
61 *)
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
62 echo $F is not a mingw32/64 RPM package >&2
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
63 ;;
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
64 esac
23b3627ecec3 Add support for the binaries built by the opensuse build service to the
Daniel Atallah <daniel.atallah@gmail.com>
parents:
diff changeset
65 done