changeset 2821:0c4659cd6d32

Remove ZoneDetect .bin file from repository A Debian maintainer has pointed out that Debian does not permit .bin files in the packages they create. The ZoneDetect database file, timezone21.bin has therefore been removed from the repository. New users must download the .bin file themself if they require UTC/DST time offset. This situation exists because the ZoneDetect developer has not yet put the source code for the database generator onto GitHub - when that happens, the database file will be generated by Geeqie (using the ZoneDetect sources) during the installation procedure.
author Colin Clark <colin.clark@cclark.uk>
date Mon, 20 Aug 2018 14:34:57 +0100
parents a58a176761eb
children 087b44aa5a0a
files README.md configure.in plugins/Makefile.am plugins/ZoneDetect/Makefile.am plugins/ZoneDetect/timezone21.bin src/exif-common.c web/geeqie-install-debian.sh
diffstat 7 files changed, 234 insertions(+), 189 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Sat Aug 18 11:00:35 2018 +0100
+++ b/README.md	Mon Aug 20 14:34:57 2018 +0100
@@ -231,6 +231,13 @@
         for displaying pdf files
         disable with configure option: --disable-pdf
 
+    ZoneDetect
+        For displaying timezone and UTC/DST time offset
+        Download file:
+        https://github.com/BertoldVdb/ZoneDetect/raw/master/database/timezone21.bin
+        and copy to the location of the Geeqie ancilliary files, which is usually:
+        /usr/local/lib/geeqie/
+
 ### Code hackers:
 
 If you plan on making any major changes to the code that will be offered for
--- a/configure.in	Sat Aug 18 11:00:35 2018 +0100
+++ b/configure.in	Mon Aug 20 14:34:57 2018 +0100
@@ -619,7 +619,6 @@
     plugins/ufraw/Makefile
     plugins/import/Makefile
     plugins/geocode-parameters/Makefile
-    plugins/ZoneDetect/Makefile
     geeqie.spec
 ])
 
@@ -685,4 +684,3 @@
   (or you take blue pill and the story ends :)
 
 EOF
-
--- a/plugins/Makefile.am	Sat Aug 18 11:00:35 2018 +0100
+++ b/plugins/Makefile.am	Mon Aug 20 14:34:57 2018 +0100
@@ -1,6 +1,6 @@
 #FIXME enable or disable individual plugins from configure
 
-SUBDIRS = rotate symlink ufraw import geocode-parameters ZoneDetect
+SUBDIRS = rotate symlink ufraw import geocode-parameters
 qq_desktoptemplatedir = $(appdir)
 qq_desktoptemplate_DATA = template.desktop
 
--- a/plugins/ZoneDetect/Makefile.am	Sat Aug 18 11:00:35 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-dist_gq_bin_SCRIPTS = timezone21.bin
Binary file plugins/ZoneDetect/timezone21.bin has changed
--- a/src/exif-common.c	Sat Aug 18 11:00:35 2018 +0100
+++ b/src/exif-common.c	Mon Aug 20 14:34:57 2018 +0100
@@ -724,52 +724,55 @@
 			}
 
 		zd_path = g_build_filename(GQ_BIN_DIR, TIMEZONE_DATABASE, NULL);
-		cd = ZDOpenDatabase(zd_path);
-		if (cd)
+		if (g_file_test(zd_path, G_FILE_TEST_EXISTS))
 			{
-			results = ZDLookup(cd, latitude, longitude, NULL);
-			zone_selected = zd_tz(results);
-			time_zone = g_strconcat("TZ=", zone_selected, NULL);
-			time_zone_org = g_strconcat("TZ=", getenv("TZ"), NULL);
-			putenv("TZ=UTC");
-			g_free(zone_selected);
+			cd = ZDOpenDatabase(zd_path);
+			if (cd)
+				{
+				results = ZDLookup(cd, latitude, longitude, NULL);
+				zone_selected = zd_tz(results);
+				time_zone = g_strconcat("TZ=", zone_selected, NULL);
+				time_zone_org = g_strconcat("TZ=", getenv("TZ"), NULL);
+				putenv("TZ=UTC");
+				g_free(zone_selected);
 
-			memset(&tm_utc, 0, sizeof(tm_utc));
-			if (text_date_time && strptime(text_date_time, "%Y:%m:%d:%H:%M:%S", &tm_utc))
-				{
-				stamp = mktime(&tm_utc);	// Convert the struct to a Unix timestamp
-				putenv(time_zone);	// Switch to destination time zone
-
-				tm_local = localtime(&stamp);
-
-				/* Convert to localtime using locale */
-				buflen = strftime(buf, sizeof(buf), "%x %X", tm_local);
-				if (buflen > 0)
+				memset(&tm_utc, 0, sizeof(tm_utc));
+				if (text_date_time && strptime(text_date_time, "%Y:%m:%d:%H:%M:%S", &tm_utc))
 					{
-					tmp = g_locale_to_utf8(buf, buflen, NULL, NULL, &error);
-					if (error)
+					stamp = mktime(&tm_utc);	// Convert the struct to a Unix timestamp
+					putenv(time_zone);	// Switch to destination time zone
+
+					tm_local = localtime(&stamp);
+
+					/* Convert to localtime using locale */
+					buflen = strftime(buf, sizeof(buf), "%x %X", tm_local);
+					if (buflen > 0)
 						{
-						log_printf("Error converting locale strftime to UTF-8: %s\n", error->message);
-						g_error_free(error);
+						tmp = g_locale_to_utf8(buf, buflen, NULL, NULL, &error);
+						if (error)
+							{
+							log_printf("Error converting locale strftime to UTF-8: %s\n", error->message);
+							g_error_free(error);
+							}
+						else
+							{
+							g_free(text_date_time);
+							text_date_time = g_strdup(tmp);
+							}
 						}
-					else
-						{
-						g_free(text_date_time);
-						text_date_time = g_strdup(tmp);
-						}
+						g_free(tmp);
 					}
-					g_free(tmp);
-				}
-			putenv(time_zone_org);
+				putenv(time_zone_org);
 
-			g_free(time_zone);
-			g_free(time_zone_org);
+				g_free(time_zone);
+				g_free(time_zone_org);
+				}
+			else
+				{
+				log_printf("Error: Init of timezone database %s failed\n", zd_path);
+				}
+			ZDCloseDatabase(cd);
 			}
-		else
-			{
-			log_printf("Error: Init of timezone database %s failed\n", zd_path);
-			}
-		ZDCloseDatabase(cd);
 		g_free(zd_path);
 		}
 
@@ -839,18 +842,21 @@
 			longitude = -longitude;
 			}
 		zd_path = g_build_filename(GQ_BIN_DIR, TIMEZONE_DATABASE, NULL);
-		cd = ZDOpenDatabase(zd_path);
-		if (cd)
+		if (g_file_test(zd_path, G_FILE_TEST_EXISTS))
 			{
-			results = ZDLookup(cd, latitude, longitude, NULL);
-			time_zone = zd_tz(results);
-			ZDFreeResults(results);
+			cd = ZDOpenDatabase(zd_path);
+			if (cd)
+				{
+				results = ZDLookup(cd, latitude, longitude, NULL);
+				time_zone = zd_tz(results);
+				ZDFreeResults(results);
+				}
+			else
+				{
+				log_printf("Error: Init of timezone database %s failed\n", zd_path);
+				}
+			ZDCloseDatabase(cd);
 			}
-		else
-			{
-			log_printf("Error: Init of timezone database %s failed\n", zd_path);
-			}
-		ZDCloseDatabase(cd);
 		g_free(zd_path);
 		}
 
--- a/web/geeqie-install-debian.sh	Sat Aug 18 11:00:35 2018 +0100
+++ b/web/geeqie-install-debian.sh	Mon Aug 20 14:34:57 2018 +0100
@@ -1,5 +1,5 @@
 #!/bin/bash
-version="2018-08-06"
+version="2018-08-20"
 description=$'
 Geeqie is an image viewer.
 This script will download, compile, and install Geeqie on Debian-based systems.
@@ -14,6 +14,7 @@
 -c --commit=ID Checkout and compile commit ID
 -t --tag=TAG Checkout and compile TAG (e.g. v1.4 or v1.3)
 -b --back=N Checkout commit -N (e.g. "-b 1" for last-but-one commit)
+-d --debug=yes Compile with debug output
 '
 
 # Essential for compiling
@@ -151,190 +152,190 @@
 
 install_essential()
 {
-arraylength=${#essential_array[@]}
-for (( i=0; i<${arraylength}; i=i+1 ));
-do
-	package_query ${essential_array[$i]}
-	if [ $? != 0 ]
-	then
-		package_install ${essential_array[$i]}
-	fi
-done
+	arraylength=${#essential_array[@]}
+	for (( i=0; i<${arraylength}; i=i+1 ));
+	do
+		package_query ${essential_array[$i]}
+		if [ $? != 0 ]
+		then
+			package_install ${essential_array[$i]}
+		fi
+	done
 
-if [[ $1 == "GTK3" ]]
-then
-	package_query "libgtk-3-dev"
-	if [ $? != 0 ]
+	if [[ $1 == "GTK3" ]]
 	then
-		package_install libgtk-3-dev
+		package_query "libgtk-3-dev"
+		if [ $? != 0 ]
+		then
+			package_install libgtk-3-dev
+		fi
+	else
+		package_query "libgtk2.0-dev"
+		if [ $? != 0 ]
+		then
+			package_install libgtk2.0-dev
+		fi
 	fi
-else
-	package_query "libgtk2.0-dev"
-	if [ $? != 0 ]
-	then
-		package_install libgtk2.0-dev
-	fi
-fi
 }
 
 install_options()
 {
-if [ -n "$options" ]
-then
-	OLDIFS=$IFS
-	IFS='|'
-	set $options
-	while [ $# -gt 0 ];
-	do
-		package_install $1
-		shift
-	done
-	IFS=$OLDIFS
-fi
+	if [ -n "$options" ]
+	then
+		OLDIFS=$IFS
+		IFS='|'
+		set $options
+		while [ $# -gt 0 ];
+		do
+			package_install $1
+			shift
+		done
+		IFS=$OLDIFS
+	fi
 }
 
 install_webp()
 {
-rm -rf webp-pixbuf-loader-master
-package_install libglib2.0-dev libgdk-pixbuf2.0-dev libwebp-dev python-minimal
-wget https://github.com/aruiz/webp-pixbuf-loader/archive/master.zip
-unzip master.zip
-cd webp-pixbuf-loader-master
-./waf configure
-./waf build
-sudo --askpass ./waf install
-sudo --askpass gdk-pixbuf-query-loaders --update-cache
-cd -
-rm -rf webp-pixbuf-loader-master
-rm master.zip
+	rm -rf webp-pixbuf-loader-master
+	package_install libglib2.0-dev libgdk-pixbuf2.0-dev libwebp-dev python-minimal
+	wget https://github.com/aruiz/webp-pixbuf-loader/archive/master.zip
+	unzip master.zip
+	cd webp-pixbuf-loader-master
+	./waf configure
+	./waf build
+	sudo --askpass ./waf install
+	sudo --askpass gdk-pixbuf-query-loaders --update-cache
+	cd -
+	rm -rf webp-pixbuf-loader-master
+	rm master.zip
 }
 
 install_psd()
 {
-rm -rf gdk-pixbuf-psd
-git clone https://github.com/and-rom/gdk-pixbuf-psd.git
-cd gdk-pixbuf-psd
-./autogen.sh
-make
-sudo --askpass make install
-sudo --askpass gdk-pixbuf-query-loaders --update-cache
-cd -
-rm -rf gdk-pixbuf-psd
+	rm -rf gdk-pixbuf-psd
+	git clone https://github.com/and-rom/gdk-pixbuf-psd.git
+	cd gdk-pixbuf-psd
+	./autogen.sh
+	make
+	sudo --askpass make install
+	sudo --askpass gdk-pixbuf-query-loaders --update-cache
+	cd -
+	rm -rf gdk-pixbuf-psd
 }
 
 install_xcf()
 {
-rm -rf xcf-pixbuf-loader
-package_install libbz2-dev
-git clone https://github.com/StephaneDelcroix/xcf-pixbuf-loader.git
-cd xcf-pixbuf-loader
-./autogen.sh
-make
+	rm -rf xcf-pixbuf-loader
+	package_install libbz2-dev
+	git clone https://github.com/StephaneDelcroix/xcf-pixbuf-loader.git
+	cd xcf-pixbuf-loader
+	./autogen.sh
+	make
 
-# There must be a better way...
-loader_locn=$(gdk-pixbuf-query-loaders | grep "LoaderDir" | tr -d '#[:space:]')
+	# There must be a better way...
+	loader_locn=$(gdk-pixbuf-query-loaders | grep "LoaderDir" | tr -d '#[:space:]')
 
-OLDIFS=$IFS
-IFS='='
-set $loader_locn
-OLDIFS=$IFS
+	OLDIFS=$IFS
+	IFS='='
+	set $loader_locn
+	OLDIFS=$IFS
 
-if [ -d $2 ]
-then
-	sudo --askpass cp .libs/libioxcf.so $2
-	sudo --askpass gdk-pixbuf-query-loaders --update-cache
-fi
-cd -
-rm -rf xcf-pixbuf-loader
+	if [ -d $2 ]
+	then
+		sudo --askpass cp .libs/libioxcf.so $2
+		sudo --askpass gdk-pixbuf-query-loaders --update-cache
+	fi
+	cd -
+	rm -rf xcf-pixbuf-loader
 }
 
 install_extra_loaders()
 {
-if [ -n "$extra_loaders" ]
-then
-	OLDIFS=$IFS
-	IFS='|'
-	set $extra_loaders
-	while [ $# -gt 0 ];
-	do
-		case $1 in
-		"webp" )
-			install_webp
-		;;
-		"psd" )
-			install_psd
-		;;
-		"xcf" )
-			install_xcf
-		;;
-		esac
+	if [ -n "$extra_loaders" ]
+	then
+		OLDIFS=$IFS
+		IFS='|'
+		set $extra_loaders
+		while [ $# -gt 0 ];
+		do
+			case $1 in
+			"webp" )
+				install_webp
+			;;
+			"psd" )
+				install_psd
+			;;
+			"xcf" )
+				install_xcf
+			;;
+			esac
 
-		shift
-	done
-	IFS=$OLDIFS
-fi
-return
+			shift
+		done
+		IFS=$OLDIFS
+	fi
+	return
 }
 
 uninstall()
 {
-current_dir=$(basename $PWD)
-if [[ $current_dir == "geeqie" ]]
-then
-	sudo --askpass make uninstall
-	zenity --title="Uninstall Geeqie" --width=370 --text="WARNING.\nThis will delete folder:\n\n$PWD\n\nand all sub-folders!" --question --ok-label="Cancel" --cancel-label="OK" 2>/dev/null
-
-	if [[ $? == 1 ]]
+	current_dir=$(basename $PWD)
+	if [[ $current_dir == "geeqie" ]]
 	then
-		cd ..
-		sudo --askpass rm -rf geeqie
+		sudo --askpass make uninstall
+		zenity --title="Uninstall Geeqie" --width=370 --text="WARNING.\nThis will delete folder:\n\n$PWD\n\nand all sub-folders!" --question --ok-label="Cancel" --cancel-label="OK" 2>/dev/null
+
+		if [[ $? == 1 ]]
+		then
+			cd ..
+			sudo --askpass rm -rf geeqie
+		fi
+	else
+		zenity --title="Uninstall Geeqie" --width=370 --text="This is not a geeqie installation folder!\n\n$PWD" --warning 2>/dev/null
 	fi
-else
-	zenity --title="Uninstall Geeqie" --width=370 --text="This is not a geeqie installation folder!\n\n$PWD" --warning 2>/dev/null
-fi
 
-exit_install
+	exit_install
 }
 
 package_query()
 {
-if [[ $DistroBasedOn == "debian" ]]
-then
-	res=$(dpkg-query --show --showformat='${Status}' $1 2>>$install_log)
-	if [[ "$res" == "install ok installed"* ]]
+	if [[ $DistroBasedOn == "debian" ]]
 	then
-		status=0
-	else
-		status=1
+		res=$(dpkg-query --show --showformat='${Status}' $1 2>>$install_log)
+		if [[ "$res" == "install ok installed"* ]]
+		then
+			status=0
+		else
+			status=1
+		fi
 	fi
-fi
-return $status
+	return $status
 }
 
 package_install()
 {
-if [[ $DistroBasedOn == "debian" ]]
-then
-	sudo --askpass apt-get --assume-yes install $@ >>$install_log 2>&1
-fi
+	if [[ $DistroBasedOn == "debian" ]]
+	then
+		sudo --askpass apt-get --assume-yes install $@ >>$install_log 2>&1
+	fi
 }
 
 exit_install()
 {
-rm $install_pass_script >/dev/null 2>&1
-#~ rm $install_log >/dev/null 2>&1
+	rm $install_pass_script >/dev/null 2>&1
+	#~ rm $install_log >/dev/null 2>&1
 
-if [[ -p $zen_pipe ]]
-then
-	echo "100" > $zen_pipe
-	echo "#End" > $zen_pipe
-fi
+	if [[ -p $zen_pipe ]]
+	then
+		echo "100" > $zen_pipe
+		echo "#End" > $zen_pipe
+	fi
 
-zenity --title="$title" --width=370 --text=$'Geeqie is not installed\nLog file: '$install_log --info 2>/dev/null
+	zenity --title="$title" --width=370 --text=$'Geeqie is not installed\nLog file: '$install_log --info 2>/dev/null
 
-rm $zen_pipe >/dev/null 2>&1
+	rm $zen_pipe >/dev/null 2>&1
 
-exit 1
+	exit 1
 }
 
 # Entry point
@@ -365,7 +366,7 @@
 fi
 
 # Parse the comand line
-OPTS=$(getopt -o vhc:t:b: --long version,help,commit:,tag:,back: -- "$@")
+OPTS=$(getopt -o vhc:t:b:d: --long version,help,commit:,tag:,back:,debug: -- "$@")
 eval set -- "$OPTS"
 
 while true;
@@ -394,6 +395,11 @@
 		shift;
 		shift
 		;;
+	-d | --debug )
+		DEBUG="$2"
+		shift;
+		shift
+		;;
 	* ) break
 		;;
 	esac
@@ -674,15 +680,21 @@
 		exit
 	fi
 fi
+if [[ "$DEBUG" == "yes" ]]
+then
+	debug_opt=""
+else
+	debug_opt="--disable-debug-log"
+fi
 
 echo "40" > $zen_pipe
 echo "#Creating configuration files..." > $zen_pipe
 
 if [[ $gtk_version == "GTK3"* ]]
 then
-	./autogen.sh >>$install_log 2>&1
+	./autogen.sh "$debug_opt" >>$install_log 2>&1
 else
-	./autogen.sh --disable-gtk3 >>$install_log 2>&1
+	./autogen.sh "$debug_opt" --disable-gtk3 >>$install_log 2>&1
 fi
 
 echo "60" > $zen_pipe
@@ -692,17 +704,40 @@
 export CXXFLAGS=$CXXFLAGS" -Wno-deprecated-declarations"
 make -j >>$install_log 2>&1
 
+if [[ $? != 0 ]]
+then
+	zenity --title="$title" --width=370 --height=400 --error --text=$'Compile error' 2>/dev/null
+	exit_install
+	exit
+fi
+
 echo "90 " > $zen_pipe
 echo "#Installing Geeqie..." > $zen_pipe
 
 sudo --askpass make install >>$install_log 2>&1
 
+# This is a temporary fix until the ZoneDetect project releases its source code
+zonedetect_message="ZoneDetect database not loaded"
+if [[ -d "/usr/local/lib/geeqie" ]]
+then
+	if [[ ! -f "/usr/local/lib/geeqie/timezone21.bin" ]]
+	then
+		sudo --askpass wget --directory-prefix=/usr/local/lib/geeqie/ https://github.com/BertoldVdb/ZoneDetect/raw/master/database/timezone21.bin >>$install_log 2>&1
+		if [[ $? == 0 ]]
+		then
+			zonedetect_message=""
+		fi
+	else
+		zonedetect_message=""
+	fi
+fi
+
 rm $install_pass_script
 mv -f $install_log install.log;
 
 echo "100 " > $zen_pipe
 rm $zen_pipe
 
-(for i in $(seq 0 4 100); do echo "$i"; sleep 0.1; done) | zenity --progress --title="$title" --width=370 --text="Geeqie installation complete...\n" --auto-close 2>/dev/null
+(for i in $(seq 0 4 100); do echo "$i"; sleep 0.1; done) | zenity --progress --title="$title" --width=370 --text="Geeqie installation complete...\n$zonedetect_message" --auto-close --percentage=0 2>/dev/null
 
 exit