/pidgin/main: 51473787ff4f: Bake the sha1sums for the debug symb...

Daniel Atallah datallah at pidgin.im
Tue Oct 2 00:16:27 EDT 2012


Changeset: 51473787ff4ffd13bb0dbe9bacf6f72bbe0698c5
Author:	 Daniel Atallah <datallah at pidgin.im>
Date:	 2012-10-02 00:15 -0400
Branch:	 release-2.x.y
URL: http://hg.pidgin.im/pidgin/main/rev/51473787ff4f

Description:

Bake the sha1sums for the debug symbols and gtk runtime into the installer instead of downloading them.

 * We should know both of these values at the time we build the installer
 * This also fixes stuff so that we don't regenerate the GTK Runtime after it
   has been published
 ** The various Pidgin versions that share a GTK+ Bundle should now use exactly
    the same file instead of one that contains the same contents
 * Fixes #15277

diffstat:

 Makefile.mingw                         |  16 ++++++++--
 pidgin/win32/nsis/generate_gtk_zip.sh  |  28 ++++++++++++++++++--
 pidgin/win32/nsis/pidgin-installer.nsi |  47 ++++++++++-----------------------
 3 files changed, 52 insertions(+), 39 deletions(-)

diffs (222 lines):

diff --git a/Makefile.mingw b/Makefile.mingw
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -102,10 +102,10 @@ endif
 	cp $(WIN32_DEV_TOP)/pidgin-inst-deps-20100315/exchndl.dll $(PIDGIN_INSTALL_DIR)
 	cp $(GCC_SSP_TOP)/bin/libssp-0.dll $(PIDGIN_INSTALL_DIR)
 
-pidgin/win32/nsis/gtk-runtime-$(GTK_BUNDLE_VERSION).zip:
+pidgin/win32/nsis/gtk-runtime-$(GTK_INSTALL_VERSION).zip:
 	pidgin/win32/nsis/generate_gtk_zip.sh `pwd`
 
-generate_installer_includes: create_release_install_dir pidgin/win32/nsis/gtk-runtime-$(GTK_BUNDLE_VERSION).zip debug_symbols_zip $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/nsis_translations.desktop
+generate_installer_includes: create_release_install_dir pidgin/win32/nsis/gtk-runtime-$(GTK_INSTALL_VERSION).zip debug_symbols_zip $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/nsis_translations.desktop
 	rm -f pidgin/win32/nsis/pidgin-translations.nsh pidgin/win32/nsis/pidgin-spellcheck.nsh pidgin/win32/nsis/pidgin-spellcheck-preselect.nsh
 	find $(STRIPPED_RELEASE_DIR)/locale -maxdepth 1 -mindepth 1 \
 	 -exec basename {} ';' \
@@ -147,7 +147,12 @@ create_release_install_dir: install
 		$(STRIPPED_RELEASE_DIR)/pidgin.exe
 
 installer: generate_installer_includes
-	$(MAKENSIS) -V3 -DPIDGIN_VERSION="$(PIDGIN_VERSION)" -DPIDGIN_PRODUCT_VERSION="$(PIDGIN_PRODUCT_VERSION)" -DPIDGIN_INSTALL_DIR="$(STRIPPED_RELEASE_DIR)" -DGTK_INSTALL_VERSION="$(GTK_INSTALL_VERSION)" pidgin/win32/nsis/pidgin-installer.nsi
+	$(eval $@_DEBUG_SYMBOLS_SHA1SUM := $(shell sha1sum $(DEBUG_SYMBOLS_DIR).zip | sed -e "s/\ .*$$//"))
+	$(eval $@_GTK_SHA1SUM := $(shell sha1sum pidgin/win32/nsis/gtk-runtime-$(GTK_INSTALL_VERSION).zip | sed -e "s/\ .*$$//"))
+	$(MAKENSIS) -V3 -DPIDGIN_VERSION="$(PIDGIN_VERSION)" -DPIDGIN_PRODUCT_VERSION="$(PIDGIN_PRODUCT_VERSION)" \
+		-DPIDGIN_INSTALL_DIR="$(STRIPPED_RELEASE_DIR)" -DGTK_INSTALL_VERSION="$(GTK_INSTALL_VERSION)" \
+		-DDEBUG_SYMBOLS_SHA1SUM="$($@_DEBUG_SYMBOLS_SHA1SUM)" -DGTK_SHA1SUM="$($@_GTK_SHA1SUM)"\
+		pidgin/win32/nsis/pidgin-installer.nsi
 	$(MONO_SIGNCODE) \
 		-spc "$(SIGNCODE_SPC)" -v "$(SIGNCODE_PVK)" \
 		-a sha1 -$$ commercial \
@@ -157,7 +162,10 @@ installer: generate_installer_includes
 	mv pidgin/win32/nsis/pidgin-$(PIDGIN_VERSION).exe ./
 
 installer_offline: generate_installer_includes
-	$(MAKENSIS) -V3 -DPIDGIN_VERSION="$(PIDGIN_VERSION)" -DPIDGIN_PRODUCT_VERSION="$(PIDGIN_PRODUCT_VERSION)" -DOFFLINE_INSTALLER -DPIDGIN_INSTALL_DIR="$(STRIPPED_RELEASE_DIR)" -DGTK_INSTALL_VERSION="$(GTK_INSTALL_VERSION)" pidgin/win32/nsis/pidgin-installer.nsi
+	$(MAKENSIS) -V3 -DPIDGIN_VERSION="$(PIDGIN_VERSION)" -DPIDGIN_PRODUCT_VERSION="$(PIDGIN_PRODUCT_VERSION)" \
+		-DPIDGIN_INSTALL_DIR="$(STRIPPED_RELEASE_DIR)" -DGTK_INSTALL_VERSION="$(GTK_INSTALL_VERSION)" \
+		-DOFFLINE_INSTALLER \
+		pidgin/win32/nsis/pidgin-installer.nsi
 	$(MONO_SIGNCODE) \
 		-spc "$(SIGNCODE_SPC)" -v "$(SIGNCODE_PVK)" \
 		-a sha1 -$$ commercial \
diff --git a/pidgin/win32/nsis/generate_gtk_zip.sh b/pidgin/win32/nsis/generate_gtk_zip.sh
--- a/pidgin/win32/nsis/generate_gtk_zip.sh
+++ b/pidgin/win32/nsis/generate_gtk_zip.sh
@@ -12,9 +12,32 @@ STAGE_DIR=`readlink -f $PIDGIN_BASE/pidg
 #Subdirectory of $STAGE_DIR
 INSTALL_DIR=Gtk
 CONTENTS_FILE=$INSTALL_DIR/CONTENTS
+PIDGIN_VERSION=$( < $PIDGIN_BASE/VERSION )
 
 #This needs to be changed every time there is any sort of change.
 BUNDLE_VERSION=2.16.6.1
+BUNDLE_SHA1SUM=5e16b7efb11943e8c80bc390f6c38df904fd36ed
+ZIP_FILE="$PIDGIN_BASE/pidgin/win32/nsis/gtk-runtime-$BUNDLE_VERSION.zip"
+
+#Download the existing file (so that we distribute the exact same file for all releases with the same bundle version)
+FILE="$ZIP_FILE"
+if [ ! -e "$FILE" ]; then
+	wget "https://pidgin.im/win32/download_redir.php?version=$PIDGIN_VERSION&gtk_version=$BUNDLE_VERSION&dl_pkg=gtk" -O "$FILE"
+fi
+CHECK_SHA1SUM=`sha1sum $FILE`
+CHECK_SHA1SUM=${CHECK_SHA1SUM%%\ *}
+if [ "$CHECK_SHA1SUM" != "$BUNDLE_SHA1SUM" ]; then
+	echo "sha1sum ($CHECK_SHA1SUM) for $FILE doesn't match expected value of $BUNDLE_SHA1SUM"
+	# Allow "devel" versions to build their own bundles if the download doesn't succeed
+	if [[ "$PIDGIN_VERSION" == *"devel" ]]; then
+		echo "Continuing GTK+ Bundle creation for development version of Pidgin"
+	else
+		exit 1
+	fi
+else
+	exit 0
+fi
+
 
 ATK="http://ftp.gnome.org/pub/gnome/binaries/win32/atk/1.32/atk_1.32.0-2_win32.zip ATK 1.32.0-2 sha1sum:3c31c9d6b19af840e2bd8ccbfef4072a6548dc4e"
 #Cairo 1.10.2 has a bug that can be seen when selecting text
@@ -106,9 +129,8 @@ do
 done
 
 #Generate zip file to be included in installer
-ZIPFILE=../gtk-runtime-$BUNDLE_VERSION.zip
-rm -f $ZIPFILE
-zip -9 -r $ZIPFILE Gtk
+rm -f $ZIP_FILE
+zip -9 -r $ZIP_FILE Gtk
 
 exit 0
 
diff --git a/pidgin/win32/nsis/pidgin-installer.nsi b/pidgin/win32/nsis/pidgin-installer.nsi
--- a/pidgin/win32/nsis/pidgin-installer.nsi
+++ b/pidgin/win32/nsis/pidgin-installer.nsi
@@ -255,27 +255,22 @@ Section $(GTKSECTIONTITLE) SecGtk
 !else
 
   ; We need to download the GTK+ runtime
-  StrCpy $R3 "${DOWNLOADER_URL}&gtk_version=${GTK_INSTALL_VERSION}&dl_pkg=gtk"
   retry:
-  StrCpy $R2 "$R3" ;$R2 is the current URL for error messages
+  StrCpy $R2 "${DOWNLOADER_URL}&gtk_version=${GTK_INSTALL_VERSION}&dl_pkg=gtk"
   DetailPrint "Downloading GTK+ Runtime ... ($R2)"
   NSISdl::download /TIMEOUT=10000 $R2 $R1
   Pop $R0
   ;StrCmp $R0 "cancel" done
   StrCmp $R0 "success" 0 prompt_retry
 
-  retry_shasum:
-  StrCpy $R2 "$R3_sha1sum"
-  Push "$R2" ; URL
+  Push "${GTK_SHA1SUM}"
   Push "$R1" ; Filename
   Call CheckSHA1Sum
   Pop $R0
 
   StrCmp "$R0" "0" extract
-  StrCmp "$R0" "1" +3 ; Prompt to Retry Just the shasum download
     prompt_retry:
     MessageBox MB_RETRYCANCEL "$(PIDGINGTKDOWNLOADERROR)" /SD IDCANCEL IDRETRY retry IDCANCEL done
-    MessageBox MB_RETRYCANCEL "$(PIDGINGTKDOWNLOADERROR)" /SD IDCANCEL IDRETRY retry_shasum IDCANCEL done
 
   extract:
 !endif
@@ -289,7 +284,9 @@ Section $(GTKSECTIONTITLE) SecGtk
   StrCmp $R0 "success" +2
     DetailPrint "$R0" ;print error message to log
 
+!ifndef OFFLINE_INSTALLER
   done:
+!endif
 SectionEnd ; end of GTK+ section
 
 ;--------------------------------
@@ -453,27 +450,22 @@ Section /o $(DEBUGSYMBOLSSECTIONTITLE) S
 !else
 
   ; We need to download the debug symbols
-  StrCpy $R3 "${DOWNLOADER_URL}&dl_pkg=dbgsym"
   retry:
-  StrCpy $R2 "$R3"
+  StrCpy $R2 "${DOWNLOADER_URL}&dl_pkg=dbgsym"
   DetailPrint "Downloading Debug Symbols... ($R2)"
   NSISdl::download /TIMEOUT=10000 $R2 $R1
   Pop $R0
   StrCmp $R0 "cancel" done
   StrCmp $R0 "success" 0 prompt_retry
 
-  retry_shasum:
-  StrCpy $R2 "$R3_sha1sum"
-  Push "$R2" ; URL
+  Push "${DEBUG_SYMBOLS_SHA1SUM}"
   Push "$R1" ; Filename
   Call CheckSHA1Sum
   Pop $R0
 
   StrCmp "$R0" "0" extract
-  StrCmp "$R0" "1" +3 ; Prompt to Retry Just the shasum download
     prompt_retry:
     MessageBox MB_RETRYCANCEL "$(PIDGINDEBUGSYMBOLSERROR)" /SD IDCANCEL IDRETRY retry IDCANCEL done
-    MessageBox MB_RETRYCANCEL "$(PIDGINDEBUGSYMBOLSERROR)" /SD IDCANCEL IDRETRY retry_shasum IDCANCEL done
 
   extract:
 !endif
@@ -484,7 +476,9 @@ Section /o $(DEBUGSYMBOLSSECTIONTITLE) S
   StrCmp $R0 "success" +2
     DetailPrint "$R0" ;print error message to log
 
+!ifndef OFFLINE_INSTALLER
   done:
+!endif
 SectionEnd
 
 ;--------------------------------
@@ -1309,27 +1303,16 @@ Function InstallDict
 FunctionEnd
 
 !ifndef OFFLINE_INSTALLER
-; Input Stack: Filename, URL
-; Output Return Code: 0=Match; 1=sha1sum DL error; 2=FileSum error; 3=Mismatch
+; Input Stack: Filename, SHA1sum
+; Output Return Code: 0=Match; 1=FileSum error; 2=Mismatch
 Function CheckSHA1Sum
   Push $R0
   Exch
   Pop $R0 ;Filename
+  Push $R2
+  Exch 2
+  Pop $R2 ;SHA1sum
   Push $R1
-  Exch 2
-  Pop $R1 ;URL
-  Push $R2
-
-  DetailPrint "Downloading checksum file... ($R1)"
-  NSISdl::download /TIMEOUT=10000 "$R1" "$R0.sha1sum"
-  Pop $R1
-  StrCmp $R1 "success" +3
-    IntOp $R1 0 + 1
-    Goto done
-
-  FileOpen $R1 "$R0.sha1sum" r
-  FileRead $R1 $R2 40
-  FileClose $R1
 
   SHA1Plugin::FileSum "$R0"
   Pop $R1
@@ -1337,13 +1320,13 @@ Function CheckSHA1Sum
 
   StrCmp "$R1" "0" +4
     DetailPrint "SHA1Sum calculation error: $R0"
-    IntOp $R1 0 + 2
+    IntOp $R1 0 + 1
     Goto done
 
   ; Compare the SHA1Sums
   StrCmp $R2 $R0 +4
     DetailPrint "SHA1Sum mismatch... Expected $R2; got $R0"
-    IntOp $R1 0 + 3
+    IntOp $R1 0 + 2
     Goto done
 
   IntOp $R1 0 + 0



More information about the Commits mailing list