From 4bdb868ac8d535a3818d519b16eff7d129fe6717 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sat, 18 Jun 2011 12:40:14 +1000 Subject: makepkg: clean-up of output messages There was a lot of inconsistency in how strings that should not be translated (program names, option flags, PKGBUILD directives, etc) were handled. This patch moves them all outside the gettext invocation for consistency and to prevent accidental translation. Note that some of these may need reverted if they cause difficulties in translation due to gettext usage in bash not taking positional parameters for arguments. A quick survey of current translations indicates that this issue will be rare. Also, we should be able to catch these before a full string freeze given we are going to probably need a "developer preview" release before the next release series. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 102 +++++++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 51 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index e7483e69..e101a763 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -183,7 +183,7 @@ trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR enter_fakeroot() { - msg "$(gettext "Entering fakeroot environment...")" + msg "$(gettext "Entering %s environment...")" "fakeroot" if [[ -n $newpkgver ]]; then fakeroot -- $0 --forcever $newpkgver -F "${ARGLIST[@]}" || exit $? @@ -574,7 +574,7 @@ generate_checksums() { plain "" if ! type -p openssl >/dev/null; then - error "$(gettext "Cannot find openssl.")" + error "$(gettext "Cannot find the %s binary required for generating sourcefile checksums.")" "openssl" exit 1 # $E_MISSING_PROGRAM fi @@ -923,7 +923,7 @@ tidy_install() { fi if [[ $(check_option libtool) = "n" ]]; then - msg2 "$(gettext "Removing libtool .la files...")" + msg2 "$(gettext "Removing "%s" files...")" "libtool" find . ! -type d -name "*.la" -exec rm -f -- '{}' \; fi @@ -1006,7 +1006,7 @@ write_pkginfo() { local size="$(@DUPATH@ -sk)" size="$(( ${size%%[^0-9]*} * 1024 ))" - msg2 "$(gettext "Generating .PKGINFO file...")" + msg2 "$(gettext "Generating %s file...")" ".PKGINFO" echo "# Generated by makepkg $myver" if (( INFAKEROOT )); then echo "# using $(fakeroot -v)" @@ -1078,7 +1078,7 @@ write_pkginfo() { # warn if license array is not present or empty if [[ -z $license ]]; then warning "$(gettext "Please add a license line to your %s!")" "$BUILDSCRIPT" - plain "$(gettext "Example for GPL\'ed software: license=('GPL').")" + plain "$(gettext "Example for GPL\'ed software: %s.")" "license=('GPL')" fi } @@ -1089,7 +1089,7 @@ check_package() { local file for file in "${backup[@]}"; do if [[ ! -f $file ]]; then - warning "$(gettext "Backup entry file not in package : %s")" "$file" + warning "$(gettext "%s entry file not in package : %s")" "backup" "$file" fi done @@ -1105,7 +1105,7 @@ check_package() { create_package() { if [[ ! -d $pkgdir ]]; then - error "$(gettext "Missing pkg/ directory.")" + error "$(gettext "Missing %s directory.")" "pkg/" plain "$(gettext "Aborting...")" exit 1 # $E_MISSING_PKGDIR fi @@ -1293,9 +1293,9 @@ install_package() { (( ! INSTALL )) && return if (( ! SPLITPKG )); then - msg "$(gettext "Installing package %s with %s -U...")" "$pkgname" "$PACMAN" + msg "$(gettext "Installing package %s with %s...")" "$pkgname" "$PACMAN -U" else - msg "$(gettext "Installing %s package group with %s -U...")" "$pkgbase" "$PACMAN" + msg "$(gettext "Installing %s package group with %s...")" "$pkgbase" "$PACMAN -U" fi local fullver pkg pkglist @@ -1356,7 +1356,7 @@ check_sanity() { if (( ! IGNOREARCH )); then error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgbase" "$CARCH" plain "$(gettext "Note that many packages may need a line added to their %s")" "$BUILDSCRIPT" - plain "$(gettext "such as arch=('%s').")" "$CARCH" + plain "$(gettext "such as %s.")" "arch=('$CARCH')" ret=1 fi fi @@ -1367,7 +1367,7 @@ check_sanity() { sed -e "s/provides=/provides_list+=/" -e "s/#.*//" -e 's/\\$//') for i in ${provides_list[@]}; do if [[ $i != ${i///} ]]; then - error "$(gettext "Provides array cannot contain comparison (< or >) operators.")" + error "$(gettext "%s array cannot contain comparison (< or >) operators.")" "provides" ret=1 fi done @@ -1377,7 +1377,7 @@ check_sanity() { sed -e "s/backup=/backup_list+=/" -e "s/#.*//" -e 's/\\$//') for i in "${backup_list[@]}"; do if [[ ${i:0:1} = "/" ]]; then - error "$(gettext "Backup entry should not contain leading slash : %s")" "$i" + error "$(gettext "%s entry should not contain leading slash : %s")" "backup" "$i" ret=1 fi done @@ -1388,7 +1388,7 @@ check_sanity() { for i in "${optdepends_list[@]}"; do local pkg=${i%%:*} if [[ ! $pkg =~ ^[[:alnum:]\>\<\=\.\+\_\-]+$ ]]; then - error "$(gettext "Invalid syntax for optdepend : '%s'")" "$i" + error "$(gettext "Invalid syntax for %s : '%s'")" "optdepend" "$i" ret=1 fi done @@ -1419,7 +1419,7 @@ check_sanity() { fi done if (( ! known )); then - error "$(gettext "options array contains unknown option '%s'")" "$i" + error "$(gettext "%s array contains unknown option '%s'")" "options" "$i" valid_options=0 fi done @@ -1430,7 +1430,7 @@ check_sanity() { if (( ${#pkgname[@]} > 1 )); then for i in ${pkgname[@]}; do if ! declare -f package_${i} >/dev/null; then - error "$(gettext "missing package function for split package '%s'")" "$i" + error "$(gettext "Missing %s function for split package '%s'")" "package_$i()" "$i" ret=1 fi done @@ -1438,7 +1438,7 @@ check_sanity() { for i in ${PKGLIST[@]}; do if ! in_array $i ${pkgname[@]}; then - error "$(gettext "requested package %s is not provided in %s")" "$i" "$BUILDFILE" + error "$(gettext "Requested package %s is not provided in %s")" "$i" "$BUILDFILE" ret=1 fi done @@ -1659,11 +1659,11 @@ usage() { printf "$(gettext "Usage: %s [options]")\n" "$0" echo echo "$(gettext "Options:")" - printf "$(gettext " -A, --ignorearch Ignore incomplete arch field in %s")\n" "$BUILDSCRIPT" + printf "$(gettext " -A, --ignorearch Ignore incomplete %s field in %s")\n" "arch" "$BUILDSCRIPT" echo "$(gettext " -c, --clean Clean up work files after build")" echo "$(gettext " -C, --cleancache Clean up source files from the cache")" echo "$(gettext " -d, --nodeps Skip all dependency checks")" - echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")" + printf "$(gettext " -e, --noextract Do not extract source files (use existing %s dir)")\n" "src/" echo "$(gettext " -f, --force Overwrite existing package")" echo "$(gettext " -g, --geninteg Generate integrity checks for source files")" echo "$(gettext " -h, --help Show this help message and exit")" @@ -1674,26 +1674,26 @@ usage() { printf "$(gettext " -p Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT" echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")" echo "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")" - echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")" + printf "$(gettext " -s, --syncdeps Install missing dependencies with %s")\n" "pacman" echo "$(gettext " --allsource Generate a source-only tarball including downloaded sources")" - echo "$(gettext " --asroot Allow makepkg to run as root user")" - printf "$(gettext " --check Run the check() function in the %s")\n" "$BUILDSCRIPT" + printf "$(gettext " --asroot Allow %s to run as root user")\n" "makepkg" + printf "$(gettext " --check Run the %s function in the %s")\n" "check()" "$BUILDSCRIPT" printf "$(gettext " --config Use an alternate config file (instead of '%s')")\n" "$confdir/makepkg.conf" printf "$(gettext " --holdver Prevent automatic version bumping for development %ss")\n" "$BUILDSCRIPT" - echo "$(gettext " --key Specify a key to use for gpg signing instead of the default")" - printf "$(gettext " --nocheck Do not run the check() function in the %s")\n" "$BUILDSCRIPT" + printf "$(gettext " --key Specify a key to use for %s signing instead of the default")\n" "gpg" + printf "$(gettext " --nocheck Do not run the %s function in the %s")\n" "check()" "$BUILDSCRIPT" echo "$(gettext " --nosign Do not create a signature for the package")" echo "$(gettext " --pkg Only build listed packages from a split package")" - echo "$(gettext " --sign Sign the resulting package with gpg")" + printf "$(gettext " --sign Sign the resulting package with %s")\n" "gpg" echo "$(gettext " --skipinteg Do not fail when integrity checks are missing")" echo "$(gettext " --source Generate a source-only tarball without downloaded sources")" echo - echo "$(gettext "These options can be passed to pacman:")" + printf "$(gettext "These options can be passed to %s:")\n" "pacman" echo echo "$(gettext " --noconfirm Do not ask for confirmation when resolving dependencies")" echo "$(gettext " --noprogressbar Do not show a progress bar when downloading files")" echo - printf "$(gettext "If -p is not specified, makepkg will look for '%s'")\n" "$BUILDSCRIPT" + printf "$(gettext "If %s is not specified, %s will look for '%s'")\n" "-p" "makepkg" "$BUILDSCRIPT" echo } @@ -1872,7 +1872,7 @@ GPGKEY=${_GPGKEY:-$GPGKEY} if (( HOLDVER )) && [[ -n $FORCE_VER ]]; then # The '\\0' is here to prevent gettext from thinking --holdver is an option - error "$(gettext "\\0--holdver and --forcever cannot both be specified" )" + error "$(gettext "\\0%s and %s cannot both be specified" )" "--holdver" "--forcever" exit 1 fi @@ -1902,7 +1902,7 @@ if (( CLEANCACHE )); then else # $SRCDEST is $startdir, two possibilities error "$(gettext "Source destination must be defined in %s.")" "$MAKEPKG_CONF" - plain "$(gettext "In addition, please run makepkg -C outside of your cache directory.")" + plain "$(gettext "In addition, please run %s outside of your cache directory.")" "makepkg -C" exit 1 fi fi @@ -1910,24 +1910,24 @@ fi if (( ! INFAKEROOT )); then if (( EUID == 0 && ! ASROOT )); then # Warn those who like to live dangerously. - error "$(gettext "Running makepkg as root is a BAD idea and can cause")" + error "$(gettext "Running %s as root is a BAD idea and can cause")" "makepkg" plain "$(gettext "permanent, catastrophic damage to your system. If you")" - plain "$(gettext "wish to run as root, please use the --asroot option.")" + plain "$(gettext "wish to run as root, please use the %s option.")" "--asroot" exit 1 # $E_USER_ABORT elif (( EUID > 0 && ASROOT )); then # Warn those who try to use the --asroot option when they are not root - error "$(gettext "The --asroot option is meant for the root user only.")" - plain "$(gettext "Please rerun makepkg without the --asroot flag.")" + error "$(gettext "The %s option is meant for the root user only.")" "--asroot" + plain "$(gettext "Please rerun %s without the %s flag.")" "makepkg" "--asroot" exit 1 # $E_USER_ABORT elif (( EUID > 0 )) && [[ $(check_buildenv fakeroot) != "y" ]]; then - warning "$(gettext "Running makepkg as an unprivileged user will result in non-root")" - plain "$(gettext "ownership of the packaged files. Try using the fakeroot environment by")" - plain "$(gettext "placing 'fakeroot' in the BUILDENV array in %s.")" "$MAKEPKG_CONF" + warning "$(gettext "Running %s as an unprivileged user will result in non-root")" "makepkg" + plain "$(gettext "ownership of the packaged files. Try using the %s environment by")" "fakeroot" + plain "$(gettext "placing %s in the %s array in %s.")" "'fakeroot'" "BUILDENV" "$MAKEPKG_CONF" sleep 1 fi else if [[ -z $FAKEROOTKEY ]]; then - error "$(gettext "Do not use the '-F' option. This option is only for use by makepkg.")" + error "$(gettext "Do not use the %s option. This option is only for use by %s.")" "'-F'" "makepkg" exit 1 # TODO: error code fi fi @@ -1956,7 +1956,7 @@ if [[ ! -f $BUILDFILE ]]; then else crlftest=$(file "$BUILDFILE" | grep -F 'CRLF' || true) if [[ -n $crlftest ]]; then - error "$(gettext "%s contains CRLF characters and cannot be sourced.")" "$BUILDFILE" + error "$(gettext "%s contains %s characters and cannot be sourced.")" "$BUILDFILE" "CRLF" exit 1 fi @@ -2024,7 +2024,7 @@ fi if [[ $SIGNPKG == 'y' ]]; then if ! gpg --list-key ${GPGKEY} &>/dev/null; then if [[ ! -z $GPGKEY ]]; then - error "$(gettext "The key ${GPGKEY} does not exist in your keyring.")" + error "$(gettext "The key %s does not exist in your keyring.")" "${GPGKEY}" else error "$(gettext "There is no key in your keyring.")" fi @@ -2043,7 +2043,7 @@ if (( ! SPLITPKG )); then install_package exit $? else - error "$(gettext "A package has already been built. (use -f to overwrite)")" + error "$(gettext "A package has already been built. (use %s to overwrite)")" "-f" exit 1 fi fi @@ -2067,12 +2067,12 @@ else install_package exit $? else - error "$(gettext "The package group has already been built. (use -f to overwrite)")" + error "$(gettext "The package group has already been built. (use %s to overwrite)")" "-f" exit 1 fi fi if (( somepkgbuilt )); then - error "$(gettext "Part of the package group has already been built. (use -f to overwrite)")" + error "$(gettext "Part of the package group has already been built. (use %s to overwrite)")" "-f" exit 1 fi fi @@ -2083,7 +2083,7 @@ fi if (( INFAKEROOT )); then if (( SOURCEONLY )); then create_srcpackage - msg "$(gettext "Leaving fakeroot environment.")" + msg "$(gettext "Leaving %s environment.")" "fakeroot" exit 0 # $E_OK fi @@ -2096,7 +2096,7 @@ if (( INFAKEROOT )); then tidy_install fi else - warning "$(gettext "Repackaging without the use of a package() function is deprecated.")" + warning "$(gettext "Repackaging without the use of a %s function is deprecated.")" "package()" plain "$(gettext "File permissions may not be preserved.")" fi else @@ -2108,7 +2108,7 @@ if (( INFAKEROOT )); then run_split_packaging fi - msg "$(gettext "Leaving fakeroot environment.")" + msg "$(gettext "Leaving %s environment.")" "fakeroot" exit 0 # $E_OK fi @@ -2119,7 +2119,7 @@ msg "$(gettext "Making package: %s")" "$pkgbase $fullver ($(date))" if (( SOURCEONLY )); then if [[ -f $SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT} ]] \ && (( ! FORCE )); then - error "$(gettext "A source package has already been built. (use -f to overwrite)")" + error "$(gettext "A source package has already been built. (use %s to overwrite)")" "-f" exit 1 fi @@ -2179,7 +2179,7 @@ elif type -p "${PACMAN%% *}" >/dev/null; then exit 1 fi else - warning "$(gettext "%s was not found in PATH; skipping dependency checks.")" "${PACMAN%% *}" + warning "$(gettext "%s was not found in %s; skipping dependency checks.")" "${PACMAN%% *}" "PATH" fi # ensure we have a sane umask set @@ -2191,9 +2191,9 @@ chmod a-s "$srcdir" cd "$srcdir" if (( NOEXTRACT )); then - warning "$(gettext "Skipping source retrieval -- using existing src/ tree")" - warning "$(gettext "Skipping source integrity checks -- using existing src/ tree")" - warning "$(gettext "Skipping source extraction -- using existing src/ tree")" + warning "$(gettext "Skipping source retrieval -- using existing %s tree")" "src/" + warning "$(gettext "Skipping source integrity checks -- using existing %s tree")" "src/" + warning "$(gettext "Skipping source extraction -- using existing %s tree")" "src/" if (( NOEXTRACT )) && [[ -z $(ls "$srcdir" 2>/dev/null) ]]; then error "$(gettext "The source directory is empty, there is nothing to build!")" @@ -2223,7 +2223,7 @@ if (( NOBUILD )); then else # check for existing pkg directory; don't remove if we are repackaging if [[ -d $pkgdir ]] && (( ! REPKG || PKGFUNC || SPLITPKG )); then - msg "$(gettext "Removing existing pkg/ directory...")" + msg "$(gettext "Removing existing %s directory...")" "pkg/" rm -rf "$pkgdir" fi mkdir -p "$pkgdir" @@ -2245,7 +2245,7 @@ else if (( ! REPKG )); then tidy_install else - warning "$(gettext "Repackaging without the use of a package() function is deprecated.")" + warning "$(gettext "Repackaging without the use of a %s" function is deprecated.")" "package()" plain "$(gettext "File permissions may not be preserved.")" fi fi -- cgit v1.2.3