changeset 30007:23b3627ecec3

Add support for the binaries built by the opensuse build service to the Gtk zip generation script. This isn't actually in use yet.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 21 May 2010 02:40:53 +0000
parents cbae3d450db8
children 09ca9dfb2cfe
files pidgin/Makefile.am pidgin/win32/nsis/generate_gtk_zip.sh pidgin/win32/nsis/rpm2zip.sh
diffstat 3 files changed, 76 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/Makefile.am	Fri May 21 00:44:38 2010 +0000
+++ b/pidgin/Makefile.am	Fri May 21 02:40:53 2010 +0000
@@ -22,6 +22,7 @@
 		win32/wspell.c \
 		win32/wspell.h \
 		win32/nsis/generate_gtk_zip.sh \
+		win32/nsis/rpm2zip.sh \
 		win32/nsis/pixmaps/pidgin-header.bmp \
 		win32/nsis/pixmaps/pidgin-intro.bmp \
 		win32/nsis/pixmaps/pidgin-install.ico \
--- a/pidgin/win32/nsis/generate_gtk_zip.sh	Fri May 21 00:44:38 2010 +0000
+++ b/pidgin/win32/nsis/generate_gtk_zip.sh	Fri May 21 02:40:53 2010 +0000
@@ -3,8 +3,8 @@
 
 PIDGIN_BASE=$1
 
-if [ ! -e $PIDGIN_BASE/ChangeLog.win32 ]; then
-	echo `basename $0` must must have the pidgin base dir specified as a parameter.
+if [ ! -e $PIDGIN_BASE/ChangeLog ]; then
+	echo $(basename $0) must must have the pidgin base dir specified as a parameter.
 	exit 1
 fi
 
@@ -42,11 +42,16 @@
 function download_and_extract {
 	URL=${1%%\ *}
 	NAME=${1#*\ }
-	FILE=`basename $URL`
+	FILE=$(basename $URL)
 	if [ ! -e $FILE ]; then
 		echo Downloading $NAME
 		wget $URL
 	fi
+	EXTENSION=${FILE##*.}
+	#This is an OpenSuSE build service RPM
+	if [ $EXTENSION == 'rpm' ]; then
+		FILE=$(../rpm2zip.sh $FILE)
+	fi
 	unzip -q $FILE -d $INSTALL_DIR
 	echo "$NAME" >> $CONTENTS_FILE
 }
@@ -63,9 +68,9 @@
 #Blow away translations that we don't have in Pidgin
 for LOCALE_DIR in $INSTALL_DIR/share/locale/*
 do
-	LOCALE=`basename $LOCALE_DIR`
+	LOCALE=$(basename $LOCALE_DIR)
 	if [ ! -e $PIDGIN_BASE/po/$LOCALE.po ]; then
-		echo Remove $LOCALE translation as it is missing from Pidgin
+		echo Removing $LOCALE translation as it is missing from Pidgin
 		rm -r $LOCALE_DIR
 	fi
 done
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/win32/nsis/rpm2zip.sh	Fri May 21 02:40:53 2010 +0000
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+here=`pwd`
+for F in $*; do
+    case $F in
+        mingw32-*.noarch.rpm|mingw64-*.noarch.rpm|*/mingw32-*.noarch.rpm|*/mingw64-*.noarch.rpm)
+        package=`rpm -qp $F 2>/dev/null`
+        case $package in
+            mingw32-*|mingw64-*)
+            case $package in
+                mingw32-*)
+                cpu=i686
+                bits=32
+                ;;
+                mingw64-*)
+                cpu=x86_64
+                bits=64
+                ;;
+            esac
+            origname=`rpm -qp --queryformat='%{NAME}'  $F 2>/dev/null`
+            name=$origname
+            case $name in
+                *-devel)
+                name=${name%el}
+                ;;
+            esac
+            shortpackage="$name"_`rpm -qp --queryformat='%{VERSION}-%{RELEASE}'_win${bits} $F 2>/dev/null`
+            shortpackage=${shortpackage#mingw32-}
+            shortpackage=${shortpackage#mingw64-}
+            shortname=$name
+            shortname=${shortname#mingw32-}
+            shortname=${shortname#mingw64-}
+            tmp=`mktemp -d`
+            #rpm2cpio $F | lzcat | (cd $tmp && cpio --quiet -id)
+            rpm2cpio $F |  (cd $tmp && cpio --quiet -id)
+            (
+                cd $tmp
+                zipfile="$here/$shortpackage.zip"
+                rm -f $zipfile
+                (cd usr/${cpu}-pc-mingw32/sys-root/mingw && zip -q -r -D $zipfile .)
+                if [ -d usr/share/doc/packages/$origname ] ; then
+                    mv usr/share/doc/packages/$origname usr/share/doc/packages/$shortname
+                    (cd usr && zip -q -r -D $zipfile share/doc/packages/$shortname)
+                fi
+                mkdir -p manifest
+                unzip -l $zipfile >manifest/$shortpackage.mft
+                zip -q $zipfile manifest/$shortpackage.mft
+                N=`unzip -l $zipfile | wc -l | sed -e 's/^ *\([0-9]*\).*/\1/'`
+                Nm1=`expr $N - 1`
+                unzip -l $zipfile | sed -e "1,3 d" -e "$Nm1,$N d" | awk '{print $4}' | grep -v -E '/$' >manifest/$shortpackage.mft
+                zip -q $zipfile manifest/$shortpackage.mft
+                echo $zipfile
+            )
+            rm -rf $tmp
+            ;;
+            *)
+            echo $F is not a mingw32/64 RPM package >&2
+            ;;
+        esac
+        ;;
+        *)
+        echo $F is not a mingw32/64 RPM package >&2
+        ;;
+    esac
+done