[svn] gpg-error - r251 - in trunk: . src

svn author wk cvs at cvs.gnupg.org
Wed Oct 20 17:06:17 CEST 2010


Author: wk
Date: 2010-10-20 17:06:15 +0200 (Wed, 20 Oct 2010)
New Revision: 251

Added:
   trunk/potomo
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/NEWS
   trunk/src/err-codes.h.in
   trunk/src/gpg-error.c
   trunk/src/init.c
Log:
Fix for W32CE.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-09-16 18:44:32 UTC (rev 250)
+++ trunk/ChangeLog	2010-10-20 15:06:15 UTC (rev 251)
@@ -1,3 +1,15 @@
+2010-10-20  Werner Koch  <wk at g10code.com>
+
+	* potomo: New.  Copied from GnuPG.
+	* Makefile.am (install-data-hook) [W32]: New.
+
+	* src/init.c (get_locale_dir): Strip the "bin" part.
+	* src/gpg-error.c (get_locale_dir): Ditto.
+
+2010-09-30  Werner Koch  <wk at g10code.com>
+
+	* src/err-codes.h.in: Add GPG_ERR_FULLY_CANCELED.
+
 2010-09-16  Werner Koch  <wk at g10code.com>
 
 	* src/w32-gettext.c (module_init): Do not set a constructur if not

Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am	2010-09-16 18:44:32 UTC (rev 250)
+++ trunk/Makefile.am	2010-10-20 15:06:15 UTC (rev 251)
@@ -20,7 +20,8 @@
 ACLOCAL_AMFLAGS = -I m4
 AUTOMAKE_OPTIONS = dist-bzip2
 
-EXTRA_DIST = autogen.sh config.rpath libgpg-error.spec.in COPYING COPYING.LIB
+EXTRA_DIST = autogen.sh config.rpath libgpg-error.spec.in COPYING COPYING.LIB \
+	     potomo
 
 if LANGUAGES_SOME
 lang_subdirs = lang
@@ -36,6 +37,18 @@
 	    $(top_srcdir)/libgpg-error.spec.in  > $(distdir)/libgpg-error.spec
 	@set -e; echo "$(VERSION)" > $(distdir)/VERSION
 
+if HAVE_W32_SYSTEM
+install-data-hook:
+	set -e; \
+	for i in $$($(top_srcdir)/potomo --get-linguas $(top_srcdir)/po); do \
+           $(MKDIR_P) "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES" || true; \
+           rm -f "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/libgpg-error.mo" \
+                                                 2>/dev/null || true; \
+           $(top_srcdir)/potomo $(top_srcdir)/po/$$i.po \
+              "$(DESTDIR)$(localedir)/$$i/LC_MESSAGES/libgpg-error.mo" ; \
+	done
+endif
+
 stowinstall: 
 	$(MAKE) $(AM_MAKEFLAGS) install prefix=/usr/local/stow/libgpg-error
 

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2010-09-16 18:44:32 UTC (rev 250)
+++ trunk/NEWS	2010-10-20 15:06:15 UTC (rev 251)
@@ -7,6 +7,7 @@
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  GPG_ERR_NOT_INITIALIZED       NEW.
  GPG_ERR_MISSING_ISSUER_CERT   NEW.
+ GPG_ERR_FULLY_CANCELED        NEW.
 
 
 Noteworthy changes in version 1.9 (2010-07-21)

Added: trunk/potomo
===================================================================
--- trunk/potomo	                        (rev 0)
+++ trunk/potomo	2010-10-20 15:06:15 UTC (rev 251)
@@ -0,0 +1,64 @@
+#!/bin/sh
+# potomo - Convert a .po file to an utf-8 encoded .mo file.
+# Copyright 2008 g10 Code GmbH
+# Copyright 2010 Free Software Foundation, Inc.
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This script is used to create the mo files for applications using
+# the simple gettext implementation provided by libgpg-error.  That
+# gettext can only cope with utf-8 encoded mo files; thus we make this
+# sure while creating the mo.  A conversion is not done if the source
+# file does not exist or if it is not newer than the mo file.
+
+if [ "$1" = "--get-linguas" -a $# -eq 2 ]; then
+   if [ ! -f "$2/LINGUAS" ]; then
+       echo "potomo: directory '$2' has no LINGUAS file" >&2
+       exit 1
+   fi
+   echo $(sed -e "/^#/d" -e "s/#.*//" "$2"/LINGUAS)
+   exit 0
+fi
+
+if [ $# -ne 2 ]; then
+  echo "usage: potomo INFILE.PO OUTFILE.MO" >&2
+  echo "       potomo --get-linguas DIR"    >&2
+  exit 1
+fi
+infile="$1"
+outfile="$2"
+
+if [ ! -f "$infile" ]; then
+  echo "potomo: '$infile' not found - ignored" 2>&1
+  exit 0
+fi
+
+if [ "$outfile" -nt "$infile" ]; then
+  echo "potomo: '$outfile' is newer than source - keeping" 2>&1
+  exit 0
+fi
+  
+# Note that we could use the newer msgconv.  However this tool was not
+# widely available back in 2008.
+
+fromset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' \
+         "$infile"`
+
+case "$fromset" in 
+    utf8|utf-8|UTF8|UTF-8) 
+        echo "potomo: '$infile' keeping $fromset" >&2 
+        msgfmt --output-file="$outfile" "$infile"
+        ;;   
+    *)
+        echo "potomo: '$infile' converting from $fromset to utf-8" >&2
+        iconv --silent --from-code=$fromset --to-code=utf-8 < "$infile" |\
+            sed "/^\"Content-Type:/ s/charset=[a-zA-Z0-9_-]*/charset=utf-8/"|\
+            msgfmt --output-file="$outfile" -
+        ;;
+esac


Property changes on: trunk/potomo
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/src/err-codes.h.in
===================================================================
--- trunk/src/err-codes.h.in	2010-09-16 18:44:32 UTC (rev 250)
+++ trunk/src/err-codes.h.in	2010-10-20 15:06:15 UTC (rev 251)
@@ -215,8 +215,9 @@
 183	GPG_ERR_LIMIT_REACHED		Limit reached
 184	GPG_ERR_NOT_INITIALIZED		Not initialized
 185	GPG_ERR_MISSING_ISSUER_CERT	Missing issuer certificate
-# 186 to 198 are free to be used.
+# 186 to 197 are free to be used.
 
+198	GPG_ERR_FULLY_CANCELED		Operation fully cancelled
 199	GPG_ERR_UNFINISHED		Operation not yet finished
 200	GPG_ERR_BUFFER_TOO_SHORT	Buffer too short
 

Modified: trunk/src/gpg-error.c
===================================================================
--- trunk/src/gpg-error.c	2010-09-16 18:44:32 UTC (rev 250)
+++ trunk/src/gpg-error.c	2010-10-20 15:06:15 UTC (rev 251)
@@ -131,6 +131,12 @@
               p = strrchr (result, '\\');
               if (p)
                 *p = 0;
+              /* If we are installed below "bin" strip that part and
+                 use the top directory instead.  */
+              p = strrchr (result, '\\');
+              if (p && !strcmp (p+1, "bin"))
+                *p = 0;
+              /* Append the static part.  */
               strcat (result, SLDIR);
             }
         }

Modified: trunk/src/init.c
===================================================================
--- trunk/src/init.c	2010-09-16 18:44:32 UTC (rev 250)
+++ trunk/src/init.c	2010-10-20 15:06:15 UTC (rev 251)
@@ -235,6 +235,27 @@
               p = strrchr (result, '\\');
               if (p)
                 *p = 0;
+              /* If we are installed below "bin" strip that part and
+                 use the top directory instead.
+
+                 Background: Under Windows we don't install GnuPG
+                 below bin/ but in the top directory with only share/,
+                 lib/, and etc/ below it.  One of the reasons is to
+                 keep the the length of the filenames at bay so not to
+                 increase the limited length of the PATH envvar.
+                 Another and more important reason, however, is that
+                 the very first GPG versions on W32 were installed
+                 into a flat directory structure and for best
+                 compatibility with these versions we didn't changed
+                 that later.  For WindowsCE we can right away install
+                 it under bin, though.  The hack with detection of the
+                 bin directory part allows us to eventually migrate to
+                 such a directory layout under plain Windows without
+                 the need to change libgpg-error.  */
+              p = strrchr (result, '\\');
+              if (p && !strcmp (p+1, "bin"))
+                *p = 0;
+              /* Append the static part.  */
               strcat (result, SLDIR);
             }
         }





More information about the Gnupg-commits mailing list