This file is indexed.

/usr/bin/pomigrate2 is in translate-toolkit 1.10.0-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/bin/bash
#
# Copyright 2004, 2005 Zuza Software Foundation
#
# This file is part of The Translate Toolkit.
#
# The Translate Toolkit is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# translate is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with translate; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


# pomigrate2 - migrates PO files from an old version using new POT files.


function usage() {
	echo "Usage `basename $0` [options] <product-old> <product-new> <product-templates>"
        echo
        echo "Options:"
        echo "   -F|--use-fuzzy-matching - use fuzzy algorithms when merging to attempt to match strings"
        echo "   -C|--use-compendium     - create and use a compendium built from the migrating files"
        echo "   -C|--use-compendium=some-compendium.po"
	echo "                           - use an external compendium during the migration"
        echo "   --no-wrap               - do not wrap long lines"
        echo "   --locale=lang           - set locale for newly born files"
        echo "   -q|--quiet              - suppress most output"
        echo "   -p|--pot2po             - use pot2po instead of msgmerge to migrate"
	exit 1
}

option_no_fuzzy_matching="--no-fuzzy-matching"
option_verbose="Y"

while true
do
	case $1 in
		-F|--use-fuzzy-matching)
			option_no_fuzzy_matching=""
			shift
			;;
		-C|--use-compendium)
			option_use_compendium="--compendium"
			shift
			;;
		-C=*|--use-compendium=*)
			option_use_own_compendium="$option_use_own_compendium --compendium=`echo $1 | sed 's/\-C=\|--use-compendium=//'`"
			option_pot2po_use_own_compendium="$option_pot2po_use_own_compendium --tm=`echo $1 | sed 's/\-C=\|--tm=//'`"
			shift
			;;
		--no-wrap)
			option_no_wrap="--no-wrap"
			shift
			;;
		--locale=*)
			option_locale=`echo $1 | sed 's/--locale=//'`
			shift
			;;
		--locale)
			shift
                        if [ $# -lt 1 ]; then
                            usage
                        fi
			option_locale=$1
                        shift
			;;
		-q|--quiet)
			option_verbose=""
			option_verbose_msgmerge="--quiet"
			shift
			;;
		-p|--pot2po)
			option_pot2po="pot2po"
			shift
			;;
		-*|--*)
			usage
			;;
		*)
			break
			;;
	esac
done

if [ $# -ne 3 ]; then
	usage
fi

old=$1
new=$2
templates=$3

echo "** Migrating files... **"
pots=`cd $templates; find . -name "*.pot"`
if [ "$pots" == "" ]; then
	echo "No POT templates found in: $templates"
	exit 1
fi
for pot in $pots
do
	filename=`basename $pot .pot`.po
	directory=`dirname $pot`
	mkdir -p $new/$directory
	if [ -f $old/$directory/$filename ]; then
		cp -p $old/$directory/$filename $new/$directory/$filename && [ $option_verbose ] && echo Copied $new/$directory/$filename
	else
		if [ `find $old -name "$filename" | wc -l` -ge 1 ]; then
			msgcat $option_no_wrap -o $new/$directory/$filename `find $old -name "$filename" -printf "%p "` && [ $option_verbose ] && echo Migrated $new/$directory/$filename
		else
			if [ ! $option_verbose ]; then
				msginit $option_no_wrap --locale=$option_locale --no-translator -i $templates/$pot -o $new/$directory/$filename 2>&1 | egrep -v "^Created"
			else
				msginit $option_no_wrap --locale=$option_locale --no-translator -i $templates/$pot -o $new/$directory/$filename
			fi
		fi
	fi
done

if [ "$option_use_compendium" != "" ]; then
	echo "** Creating compendium from old files... **"
	compendium=`mktemp tmp.compendium.XXXXXXXXXX`
	# Move and rename to work around inability of mktemp TEMPLATE to end on anything but X's
        mv $compendium ${compendium}.po
        compendium=${compendium}.po
	`dirname $0`/pocompendium --correct $compendium -d $old
	option_use_compendium=" --compendium=$compendium "
	option_pot2po_use_compendium=" --tm=$compendium "
fi

echo -n "** Updating files against templates"
[ $option_use_compendium ] && echo -n " using a compendium"
echo " **"
if [ ! $option_pot2po ]; then
	for po in `cd $new ; find . -name "*.po" | sort`
	do
		[ $option_verbose ] && echo -n $new/$po
		[ -f $templates/${po}t ] && msgmerge --previous $option_verbose_msgmerge $option_no_fuzzy_matching $option_no_wrap $option_use_compendium $option_use_own_compendium --backup=off --update $new/$po $templates/${po}t
	done
else
	temp_pot2po_new=`mktemp -d tmp.XXXXXXXXXX`
	temp_msgcat_new=`mktemp -d tmp.XXXXXXXXXX`
	cp -rp $new/* $temp_pot2po_new
	pot2po --errorlevel=traceback --progress=none $option_pot2po_use_compendium $option_pot2po_use_own_compendium -t $temp_pot2po_new $templates $temp_msgcat_new
	for file in `cd $temp_msgcat_new; find . -name "*.po"`
	do
		mkdir -p $new/$(dirname $file)
		msgcat -o $new/$file $temp_msgcat_new/$file 2> >(egrep -v "warning: internationali.ed messages should not contain the .* escape sequence" >&2)
	done
	rm -rf $temp_pot2po_new $temp_msgcat_new
fi

if [ "$option_use_compendium" != "" ]; then
	rm $compendium
fi