gnome-build r479 - in trunk: . po src/backends/libgbf_am src/backends/libgbf_mkfile



Author: jhs
Date: Tue Jan 22 13:22:25 2008
New Revision: 479
URL: http://svn.gnome.org/viewvc/gnome-build?rev=479&view=rev

Log:
2008-01-22  Johannes Schmid <jhs gnome org>

        * configure.in:
        * install.sh: removed (should not be in svn)
        Migrated to use po/LINGUAS

        * src/backends/libgbf_am/gbf-am-parse.in:
        * src/backends/libgbf_mkfile/gbf-mkfile-parse.in:

        Added localisation through gettext()



Added:
   trunk/po/LINGUAS
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/install-sh
   trunk/po/ChangeLog
   trunk/po/POTFILES.in
   trunk/src/backends/libgbf_am/gbf-am-parse.in
   trunk/src/backends/libgbf_mkfile/gbf-mkfile-parse.in

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Jan 22 13:22:25 2008
@@ -1,4 +1,4 @@
-AC_PREREQ(2.52)
+AAC_PREREQ(2.52)
 
 # Initialization and versioning
 AC_INIT(gnome-build, 0.2.0, http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-build)
@@ -9,7 +9,7 @@
 AM_MAINTAINER_MODE
 
 # Check for programs
-AC_PROG_INTLTOOL
+IT_PROG_INTLTOOL([0.35.0])
 AC_ISC_POSIX
 AC_PROG_CC
 AC_PROG_INSTALL
@@ -110,7 +110,6 @@
 AC_SUBST(DEPRECATED_FLAGS)
 
 # I18N stuff
-ALL_LINGUAS="am ar az be bg ca cs de dz el en_CA en_GB es eu fi fr gl he hr hu it ja ko lv mk ml ms nb ne nl oc pa pl pt pt_BR ru rw sk sl sq sr sr Latn sv tr vi uk zh_CN"
 GETTEXT_PACKAGE=gbf-1
 AC_SUBST(GETTEXT_PACKAGE)
 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])

Modified: trunk/install-sh
==============================================================================
--- trunk/install-sh	(original)
+++ trunk/install-sh	Tue Jan 22 13:22:25 2008
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2006-10-14.15
+scriptversion=2005-05-14.22
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -39,24 +39,15 @@
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
-# from scratch.
-
-nl='
-'
-IFS=" ""	$nl"
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
 
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
 
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
+# put in absolute paths if you don't have them in your path; or use env. vars.
 
 mvprog="${MVPROG-mv}"
 cpprog="${CPPROG-cp}"
@@ -67,13 +58,7 @@
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
-posix_glob=
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chmodcmd=$chmodprog
+chmodcmd="$chmodprog 0755"
 chowncmd=
 chgrpcmd=
 stripcmd=
@@ -110,7 +95,7 @@
   CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
 "
 
-while test $# -ne 0; do
+while test -n "$1"; do
   case $1 in
     -c) shift
         continue;;
@@ -126,15 +111,9 @@
 
     --help) echo "$usage"; exit $?;;
 
-    -m) mode=$2
+    -m) chmodcmd="$chmodprog $2"
         shift
         shift
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
         continue;;
 
     -o) chowncmd="$chownprog $2"
@@ -157,33 +136,25 @@
 
     --version) echo "$0 $scriptversion"; exit $?;;
 
-    --)	shift
+    *)  # When -d is used, all remaining arguments are directories to create.
+	# When -t is used, the destination is already specified.
+	test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $  
+	for arg
+	do
+          if test -n "$dstarg"; then
+	    # $@ is not empty: it contains at least $arg.
+	    set fnord "$@" "$dstarg"
+	    shift # fnord
+	  fi
+	  shift # arg
+	  dstarg=$arg
+	done
 	break;;
-
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
-
-    *)  break;;
   esac
 done
 
-if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
-  # When -d is used, all remaining arguments are directories to create.
-  # When -t is used, the destination is already specified.
-  # Otherwise, the last argument is the destination.  Remove it from $  
-  for arg
-  do
-    if test -n "$dstarg"; then
-      # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dstarg"
-      shift # fnord
-    fi
-    shift # arg
-    dstarg=$arg
-  done
-fi
-
-if test $# -eq 0; then
+if test -z "$1"; then
   if test -z "$dir_arg"; then
     echo "$0: no input file specified." >&2
     exit 1
@@ -193,33 +164,6 @@
   exit 0
 fi
 
-if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
-
-  # Set umask so as not to create temps with too-generous modes.
-  # However, 'strip' requires both read and write access to temps.
-  case $mode in
-    # Optimize common cases.
-    *644) cp_umask=133;;
-    *755) cp_umask=22;;
-
-    *[0-7])
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw='% 200'
-      fi
-      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
-    *)
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw=,u+rw
-      fi
-      cp_umask=$mode$u_plus_rw;;
-  esac
-fi
-
 for src
 do
   # Protect names starting with `-'.
@@ -229,11 +173,15 @@
 
   if test -n "$dir_arg"; then
     dst=$src
-    dstdir=$dst
-    test -d "$dstdir"
-    dstdir_status=$?
-  else
+    src=
 
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
     # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
     # might cause directories to be created, which would be especially bad
     # if $src (and thus $dsttmp) contains '*'.
@@ -260,188 +208,53 @@
 	echo "$0: $dstarg: Is a directory" >&2
 	exit 1
       fi
-      dstdir=$dst
-      dst=$dstdir/`basename "$src"`
-      dstdir_status=0
-    else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-	(dirname "$dst") 2>/dev/null ||
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	     X"$dst" : 'X\(//\)[^/]' \| \
-	     X"$dst" : 'X\(//\)$' \| \
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-	echo X"$dst" |
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)[^/].*/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\).*/{
-		   s//\1/
-		   q
-		 }
-		 s/.*/./; q'
-      `
-
-      test -d "$dstdir"
-      dstdir_status=$?
+      dst=$dst/`basename "$src"`
     fi
   fi
 
-  obsolete_mkdir_used=false
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
 
-  if test $dstdir_status != 0; then
-    case $posix_mkdir in
-      '')
-	# Create intermediate dirs using mode 755 as modified by the umask.
-	# This is like FreeBSD 'install' as of 1997-10-28.
-	umask=`umask`
-	case $stripcmd.$umask in
-	  # Optimize common cases.
-	  *[2367][2367]) mkdir_umask=$umask;;
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-	  *[0-7])
-	    mkdir_umask=`expr $umask + 22 \
-	      - $umask % 100 % 40 + $umask % 20 \
-	      - $umask % 10 % 4 + $umask % 2
-	    `;;
-	  *) mkdir_umask=$umask,go-w;;
-	esac
-
-	# With -d, create the new directory with the user-specified mode.
-	# Otherwise, rely on $mkdir_umask.
-	if test -n "$dir_arg"; then
-	  mkdir_mode=-m$mode
-	else
-	  mkdir_mode=
-	fi
-
-	posix_mkdir=false
-	case $umask in
-	  *[123567][0-7][0-7])
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-	    ;;
-	  *)
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	    if (umask $mkdir_umask &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-	    then
-	      if test -z "$dir_arg" || {
-		   # Check for POSIX incompatibilities with -m.
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writeable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/d" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
-    esac
+  # Make sure that the destination directory exists.
 
-    if
-      $posix_mkdir && (
-	umask $mkdir_umask &&
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
-      )
-    then :
-    else
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+	 '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@% g' -e 's ^%@/@'`
+    shift
+    IFS=$oIFS
 
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
-      # or it failed possibly due to a race condition.  Create the
-      # directory the slow way, step by step, checking for races as we go.
-
-      case $dstdir in
-	/*) prefix=/ ;;
-	-*) prefix=./ ;;
-	*)  prefix= ;;
-      esac
-
-      case $posix_glob in
-        '')
-	  if (set -f) 2>/dev/null; then
-	    posix_glob=true
-	  else
-	    posix_glob=false
-	  fi ;;
-      esac
-
-      oIFS=$IFS
-      IFS=/
-      $posix_glob && set -f
-      set fnord $dstdir
-      shift
-      $posix_glob && set +f
-      IFS=$oIFS
+    pathcomp=
 
-      prefixes=
-
-      for d
-      do
-	test -z "$d" && continue
-
-	prefix=$prefix$d
-	if test -d "$prefix"; then
-	  prefixes=
-	else
-	  if $posix_mkdir; then
-	    (umask=$mkdir_umask &&
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-	    # Don't fail if two instances are running concurrently.
-	    test -d "$prefix" || exit 1
-	  else
-	    case $prefix in
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-	      *) qprefix=$prefix;;
-	    esac
-	    prefixes="$prefixes '$qprefix'"
-	  fi
-	fi
-	prefix=$prefix/
-      done
-
-      if test -n "$prefixes"; then
-	# Don't fail if two instances are running concurrently.
-	(umask $mkdir_umask &&
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
-	  test -d "$dstdir" || exit 1
-	obsolete_mkdir_used=true
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+	# mkdir can fail with a `File exist' error in case several
+	# install-sh are creating the directory concurrently.  This
+	# is OK.
+	test -d "$pathcomp" || exit
       fi
-    fi
+      pathcomp=$pathcomp/
+    done
   fi
 
   if test -n "$dir_arg"; then
-    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
-    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
-      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
   else
+    dstfile=`basename "$dst"`
 
     # Make a couple of temp file names in the proper directory.
     dsttmp=$dstdir/_inst.$$_
@@ -449,9 +262,10 @@
 
     # Trap to clean up those temp files at exit.
     trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
 
     # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+    $doit $cpprog "$src" "$dsttmp" &&
 
     # and set any options; do chmod last to preserve setuid bits.
     #
@@ -462,10 +276,10 @@
     { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
       && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
       && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
 
     # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
       || {
 	   # The rename failed, perhaps because mv can't rename something else
 	   # to itself, or perhaps because mv is so ancient that it does not
@@ -477,12 +291,11 @@
 	   # reasons.  In this case, the final cleanup might fail but the new
 	   # file should still install successfully.
 	   {
-	     if test -f "$dst"; then
-	       $doit $rmcmd -f "$dst" 2>/dev/null \
-	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
-		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
+	     if test -f "$dstdir/$dstfile"; then
+	       $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+	       || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
 	       || {
-		 echo "$0: cannot unlink or rename $dst" >&2
+		 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
 		 (exit 1); exit 1
 	       }
 	     else
@@ -491,14 +304,17 @@
 	   } &&
 
 	   # Now rename the file to the real destination.
-	   $doit $mvcmd "$dsttmp" "$dst"
+	   $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
 	 }
-    } || exit 1
-
-    trap '' 0
-  fi
+    }
+  fi || { (exit 1); exit 1; }
 done
 
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
 # time-stamp-start: "scriptversion="

Added: trunk/po/LINGUAS
==============================================================================
--- (empty file)
+++ trunk/po/LINGUAS	Tue Jan 22 13:22:25 2008
@@ -0,0 +1,47 @@
+am
+ar
+az
+be
+bg
+ca
+cs
+de
+dz
+el
+en_CA
+en_GB
+es
+eu
+fi
+fr
+gl
+he
+hr
+hu
+it
+ja
+ko
+lv
+mk
+ml
+ms
+nb
+ne
+nl
+oc
+pa
+pl
+pt
+pt_BR
+ru
+rw
+sk
+sl
+sq
+sr
+sr Latn
+sv
+tr
+vi
+uk
+zh_CN

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Tue Jan 22 13:22:25 2008
@@ -6,11 +6,13 @@
 src/backends/libgbf_am/gbf-am-properties.c
 src/backends/libgbf_am/gbf-am-project.c
 src/backends/libgbf_am/gbf-am.server.in.in
+src/backends/libgbf_am/gbf-am-parse.in
 src/backends/libgbf_mkfile/gbf-mkfile-build.c
 src/backends/libgbf_mkfile/gbf-mkfile-config.c
 src/backends/libgbf_mkfile/gbf-mkfile-project.c
 src/backends/libgbf_mkfile/gbf-mkfile-properties.c
 src/backends/libgbf_mkfile/gbf-mkfile.server.in.in
+src/backends/libgbf_mkfile/gbf-mkfile-parse.in
 src/gbf/create_dialogs.glade
 src/gbf/gbf-build-info.c
 src/gbf/gbf-project-model.c

Modified: trunk/src/backends/libgbf_am/gbf-am-parse.in
==============================================================================
--- trunk/src/backends/libgbf_am/gbf-am-parse.in	(original)
+++ trunk/src/backends/libgbf_am/gbf-am-parse.in	Tue Jan 22 13:22:25 2008
@@ -16,6 +16,13 @@
 use GBF::General;
 use GBF::AmFiles;
 
+# I18n
+use Locale::gettext;
+use POSIX;
+
+setlocale(LC_MESSAGES, "");
+textdomain("@PACKAGE@");
+
 my $verbose = 0;
 my $dry_run = 0;
 
@@ -613,7 +620,7 @@
 
     # Check if it is one of the special cases
     if ($prefix eq "check" && $primary eq "LTLIBRARIES") {
-	&report_error (200, "Shared libraries cannot have the 'check' prefix");
+	&report_error (200, gettext("Shared libraries cannot have the 'check' prefix"));
 	return "";
     };
 
@@ -740,9 +747,9 @@
 		if (defined ($extra_deps)) {
 		    $new_target{config}{explicit_deps} .= $extra_deps;
 		    if ($extra_actions ne "") {
-			&report_warning (200, "Actions defined for ".
+			&report_warning (200, gettext("Actions defined for ".
 					 "\$(${canonical}_OBJECTS), " .
-					 "and this should be left to automake alone");
+					 "and this should be left to automake alone"));
 		    };
 		};
 
@@ -1112,7 +1119,7 @@
 								 "$subgroup", 
 								 $project);
 		} else {
-		    &report_warning (102, "file $makefile doesn't exist");
+		    &report_warning (102, gettext("file $makefile doesn't exist"));
 		}
 	    };
 	};
@@ -1145,8 +1152,8 @@
 
     &debug ("Using $project_dir as the project root");
     if ( ! -f "$project_dir/configure.in" && ! -f "$project_dir/configure.ac" ) {
-	&report_error (1, "Root directory doesn't look like the root of an " .
-		       "automake package");
+	&report_error (1, gettext("Root directory doesn't look like the root of an " .
+		       "automake package"));
 	return undef;
     };
 
@@ -1223,7 +1230,7 @@
 	$group = $project->{all_groups}{$group_name};
 	
 	if (!$group) { 
-	    &report_error (303, "The group $group_name doesn't exist");
+	    &report_error (303, gettext("The group $group_name doesn't exist"));
 	    next OP; 
 	}
 	&debug ("Using group $group->{name}");
@@ -1247,8 +1254,8 @@
 	    # Get the target hash from the group
 	    $target = $group->{targets}{$target};
 	    if (! defined ($target)) {
-		&report_error (304, "The target $op->{target_name} ".
-			       "doesn't exist");
+		&report_error (304, gettext("The target $op->{target_name} ".
+			       "doesn't exist"));
 		next OP;
 	    }
 	    $target_type = $target->{type};
@@ -1316,7 +1323,7 @@
 
 	# check that the group doesn't exist already
 	if (defined $group->{groups}{$group_name}) {
-	    return &report_error (305, "Group $operand already exists");
+	    return &report_error (305, gettext("Group $operand already exists"));
 	};
 
 	# create the directory and an empty Makefile.am
@@ -1324,14 +1331,14 @@
 	my $new_dir = $project->{prefix} . $local_new_dir;
 	
 	unless (-d $new_dir) {
-	    mkdir $new_dir || return &report_error (304, "Can't mkdir $new_dir");
+	    mkdir $new_dir || return &report_error (304, gettext("Can't mkdir $new_dir"));
 	};
 	unless (-f "$new_dir/Makefile.am") {
 	    if (open (NEWFILE, ">$new_dir/Makefile.am")) {
 		print NEWFILE "## File created by the gnome-build tools\n\n\n";
 		close NEWFILE;
 	    } else {
-		return &report_error (304, "Can't write $new_dir/Makefile.am");
+		return &report_error (304, gettext("Can't write $new_dir/Makefile.am"));
 	    };
 	};
 
@@ -1353,7 +1360,7 @@
 	
 	# check that the group doesn't exist already
 	if (!defined $group->{groups}{$group_name}) {
-	    return &report_error (305, "Group $operand does not exists");
+	    return &report_error (305, gettext("Group $operand does not exists"));
 	};
 	
 	# remove directory from the SUBDIRS macro in the parent group
@@ -1400,7 +1407,7 @@
     }
     else {
     
-	return &report_error (300, "Invalid operation '$op' to group_op_handler");
+	return &report_error (300, gettext("Invalid operation '$op' to group_op_handler"));
     }
     # success!
     return 0;
@@ -1463,7 +1470,7 @@
     }
     else {
     
-	return &report_error (300, "Invalid operation '$op' to group_op_handler");
+	return &report_error (300, gettext("Invalid operation '$op' to group_op_handler"));
     }
     # success!
     return 0;
@@ -1485,7 +1492,7 @@
     #  - a config hash on set_config containing any/all fields in group config
     # FIXME: handle dependencies
 
-    return &report_error (302, "Unimplemented target type writer");
+    return &report_error (302, gettext("Unimplemented target type writer"));
 }
 
 sub compiled_primary_target_writer
@@ -1517,12 +1524,12 @@
 	$prefix = $default_prefixes{$operand};
 
 	if ($target eq "") {
-	    return &report_error (301, "Invalid empty target name");
+	    return &report_error (301, gettext("Invalid empty target name"));
 	}
 
 	if (!defined $primary) {
-	    return &report_error (301, "Invalid target type '$operand' ".
-				  "to compiled_primary_target_writer");
+	    return &report_error (301, gettext("Invalid target type '$operand' ".
+				  "to compiled_primary_target_writer"));
 	}
 
 	# FIXME: verify that the target doesn't yet exist
@@ -1690,7 +1697,7 @@
 
     }
     else {
-	return &report_error (300, "Invalid operation '$op' to program_target_writer");
+	return &report_error (300, gettext("Invalid operation '$op' to program_target_writer"));
     };
 
     # Success!
@@ -1728,7 +1735,7 @@
 
 	if ($op eq "add_target") {
 		if (exists($makefile->{macros}->{EXTRA_DIST}) and $makefile->{macros}->{EXTRA_DIST}->{content} !~ m/^\s*$/) {
-			return &report_error (305, "An extra target already exists for " . $group->{prefix})
+			return &report_error (305, gettext("An extra target already exists for ") . $group->{prefix})
 		}
 	}
 	elsif ($op eq "remove_target") {
@@ -1753,7 +1760,7 @@
 		$rel_source = path_absolute_to_relative ($group->{prefix}, $operand);
 	
 		if (defined(my $original_pkg = hidden_in_another_var($makefile, "EXTRA_DIST", $rel_source))) {
-			return &report_error (305, "Could not remove file because it is part of group '$original_pkg'. Please delete it there.");
+			return &report_error (305, gettext("Could not remove file because it is part of group '$original_pkg'. Please delete it there."));
 		}
 			
 		&debug ("removing $rel_source from EXTRA_DIST");
@@ -1761,7 +1768,7 @@
 		&macro_remove_text ($makefile, "EXTRA_DIST", $rel_source);
     }
     else {
-		return &report_error (300, "Invalid operation '$op' to program_target_writer");
+		return &report_error (300, gettext("Invalid operation '$op' to program_target_writer"));
     };
 
     # Success!
@@ -1793,14 +1800,14 @@
 
 	$primary = $primaries{$operand};
 	if (!defined $primary) {
-	    return &report_error (301, "Invalid target type '$operand' ".
-				  "to simple_primary_target_writer");
+	    return &report_error (301, gettext("Invalid target type '$operand' ".
+				  "to simple_primary_target_writer"));
 	}
 
 	if ($check_primary ne $operand) {
-	    &report_warning (302, "The target type supplied in the target name ".
+	    &report_warning (302, gettext("The target type supplied in the target name ".
 			     "$target and the given target type '$operand' ".
-			     "don't match.  Will use the one provided in the name");
+			     "don't match.  Will use the one provided in the name"));
 	}
 
 	if (!&check_primary_prefix ($prefix, $primary, $group)) {
@@ -1868,7 +1875,7 @@
 	&macro_remove_text ($makefile, $var, $rel_source);
     }
     else {
-	return &report_error (300, "Invalid operation '$op' to program_target_writer");
+	return &report_error (300, gettext("Invalid operation '$op' to program_target_writer"));
     };
 
     # Success!
@@ -2172,7 +2179,7 @@
 	    close INPUT_FILE;
 	}
 	else {
-	    &report_error (4, "Can't open input file '$input_file'");
+	    &report_error (4, gettext("Can't open input file '$input_file'"));
 	    return [];
 	}
     }
@@ -2534,14 +2541,14 @@
     elsif ($_ eq "--test-scan") { $newop = "test-scan"; }
     else {
 	if ($arg) {
-	    &report_error (5, "You can't specify more than one project dir/file");
+	    &report_error (5, gettext("You can't specify more than one project dir/file"));
 	    exit 5;
 	}
 	$arg = $_;
     }
     if ($newop) {
 	if ($op) {
-	    &report_error (5, "You can't specify more than one operation");
+	    &report_error (5, gettext("You can't specify more than one operation"));
 	    exit 5;
 	}
 	$op = $newop;
@@ -2557,7 +2564,7 @@
     my $project_dir = make_absolute_path ($arg);
 
     if (!$project_dir || ! -d $project_dir || ! -e $project_dir) {
-	&report_error (2, "Project root directory doesn't exist");
+	&report_error (2, gettext("Project root directory doesn't exist"));
 	exit 2;
     };
 
@@ -2609,5 +2616,5 @@
     }
 }
 else {
-    &report_warning (0, "Nothing to do");
+    &report_warning (0, gettext("Nothing to do"));
 }

Modified: trunk/src/backends/libgbf_mkfile/gbf-mkfile-parse.in
==============================================================================
--- trunk/src/backends/libgbf_mkfile/gbf-mkfile-parse.in	(original)
+++ trunk/src/backends/libgbf_mkfile/gbf-mkfile-parse.in	Tue Jan 22 13:22:25 2008
@@ -16,6 +16,12 @@
 use GBF::General;
 use GBF::Make;
 
+# I18n
+use Locale::gettext;
+use POSIX;
+
+setlocale(LC_MESSAGES, "");
+textdomain("@PACKAGE@");
 
 my $debug = 0;
 my $verbose = 0;
@@ -428,7 +434,7 @@
 		{
 			if (exists $loopdetect{$_})
 			{
-				&report_error (200, "Loop detected in dependency graph");
+				&report_error (200, gettext("Loop detected in dependency graph"));
 				return undef;
 			}
 			$loopdetect{$_} = 1;
@@ -593,8 +599,8 @@
     &debug ("Using $project_dir as the project root");
     if ( ! -f "$project_dir/Makefile") {
 		if ( ! -f "$project_dir/makefile") {
-			&report_error (1, "Can't find $project_dir/Makefile or ".
-							"$project_dir/makefile");
+			&report_error (1, gettext("Can't find $project_dir/Makefile or ".
+							"$project_dir/makefile"));
 			return undef;
 		}
 		$mkfile_name = "makefile";
@@ -654,7 +660,7 @@
 	$group = $project->{all_groups}{$group_name};
 	
 	if (!$group) { 
-	    &report_error (303, "The group $group_name doesn't exist");
+	    &report_error (303, gettext("The group $group_name doesn't exist"));
 	    next OP; 
 	}
 	&debug ("Using group $group->{name}");
@@ -678,8 +684,8 @@
 	    # Get the target hash from the group
 	    $target = $group->{targets}{$target};
 	    if (! defined ($target)) {
-		&report_error (304, "The target $op->{target_name} ".
-			       "doesn't exist");
+		&report_error (304, gettext("The target $op->{target_name} ".
+			       "doesn't exist"));
 		next OP;
 	    }
 	    $target_type = $target->{type};
@@ -743,7 +749,7 @@
 
 	# check that the group doesn't exist already
 	if (defined $group->{groups}{$group_name}) {
-	    return &report_error (305, "Group $operand already exists");
+	    return &report_error (305, gettext("Group $operand already exists"));
 	};
 
 	# create the directory and an empty Makefile.am
@@ -751,14 +757,14 @@
 	my $new_dir = $project->{prefix} . $local_new_dir;
 	
 	unless (-d $new_dir) {
-	    mkdir $new_dir || return &report_error (304, "Can't mkdir $new_dir");
+	    mkdir $new_dir || return &report_error (304, gettext("Can't mkdir $new_dir"));
 	};
 	unless (-f "$new_dir/Makefile.am") {
 	    if (open (NEWFILE, ">$new_dir/Makefile.am")) {
 		print NEWFILE "## File created by the gnome-build tools\n\n\n";
 		close NEWFILE;
 	    } else {
-		return &report_error (304, "Can't write $new_dir/Makefile.am");
+		return &report_error (304, gettext("Can't write $new_dir/Makefile.am"));
 	    };
 	};
 
@@ -780,7 +786,7 @@
 	
 	# check that the group doesn't exist already
 	if (!defined $group->{groups}{$group_name}) {
-	    return &report_error (305, "Group $operand does not exists");
+	    return &report_error (305, gettext("Group $operand does not exists"));
 	};
 	
 	# remove directory from the SUBDIRS macro in the parent group
@@ -811,7 +817,7 @@
     }
     else {
     
-	return &report_error (300, "Invalid operation '$op' to group_op_handler");
+	return &report_error (300, gettext("Invalid operation '$op' to group_op_handler"));
     }
     # success!
     return 0;
@@ -833,7 +839,7 @@
     #  - a config hash on set_config containing any/all fields in group config
     # FIXME: handle dependencies
 
-    return &report_error (302, "Unimplemented target type writer");
+    return &report_error (302, gettext("Unimplemented target type writer"));
 }
 
 sub compiled_primary_target_writer
@@ -865,12 +871,12 @@
 	$prefix = $default_prefixes{$operand};
 
 	if ($target eq "") {
-	    return &report_error (301, "Invalid empty target name");
+	    return &report_error (301, gettext("Invalid empty target name"));
 	}
 
 	if (!defined $primary) {
-	    return &report_error (301, "Invalid target type '$operand' ".
-				  "to compiled_primary_target_writer");
+	    return &report_error (301, gettext("Invalid target type '$operand' ".
+				  "to compiled_primary_target_writer"));
 	}
 
 	# FIXME: verify that the target doesn't yet exist
@@ -992,7 +998,7 @@
 
     }
     else {
-	return &report_error (300, "Invalid operation '$op' to program_target_writer");
+	return &report_error (300, gettext("Invalid operation '$op' to program_target_writer"));
     };
 
     # Success!
@@ -1023,14 +1029,14 @@
 
 	$primary = $primaries{$operand};
 	if (!defined $primary) {
-	    return &report_error (301, "Invalid target type '$operand' ".
-				  "to simple_primary_target_writer");
+	    return &report_error (301, gettext("Invalid target type '$operand' ".
+				  "to simple_primary_target_writer"));
 	}
 
 	if ($check_primary ne $operand) {
-	    &report_warning (302, "The target type supplied in the target name ".
+	    &report_warning (302, gettext("The target type supplied in the target name ".
 			     "$target and the given target type '$operand' ".
-			     "don't match.  Will use the one provided in the name");
+			     "don't match.  Will use the one provided in the name"));
 	}
 
 	if (!&check_primary_prefix ($prefix, $primary, $group)) {
@@ -1071,7 +1077,7 @@
 
     }
     else {
-	return &report_error (300, "Invalid operation '$op' to program_target_writer");
+	return &report_error (300, gettext("Invalid operation '$op' to program_target_writer"));
     };
 
     # Success!
@@ -1362,7 +1368,7 @@
 	    close INPUT_FILE;
 	}
 	else {
-	    &report_error (4, "Can't open input file '$input_file'");
+	    &report_error (4, gettext("Can't open input file '$input_file'"));
 	    return [];
 	}
     }
@@ -1715,14 +1721,14 @@
     elsif ($_ eq "--test-scan") { $newop = "test-scan"; }
     else {
 	if ($arg) {
-	    &report_error (5, "You can't specify more than one project dir/file");
+	    &report_error (5, gettext("You can't specify more than one project dir/file"));
 	    exit 5;
 	}
 	$arg = $_;
     }
     if ($newop) {
 	if ($op) {
-	    &report_error (5, "You can't specify more than one operation");
+	    &report_error (5, gettext("You can't specify more than one operation"));
 	    exit 5;
 	}
 	$op = $newop;
@@ -1738,7 +1744,7 @@
     my $project_dir = make_absolute_path ($arg);
 
     if (!$project_dir || ! -d $project_dir || ! -e $project_dir) {
-	&report_error (2, "Project root directory doesn't exist");
+	&report_error (2, gettext("Project root directory doesn't exist"));
 	exit 2;
     };
 
@@ -1793,5 +1799,5 @@
     }
 }
 else {
-    &report_warning (0, "Nothing to do");
+    &report_warning (0, gettext("Nothing to do"));
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]