[pacman-dev] [PATCH] makepkg: Add UPX compression support
This patch enables the automatic compression of executable binaries using UPX when the 'upx' options is specified in makepkg.conf or the PKGBUILD. Additional arguments can be passed to UPX by specifying the UPXFLAGS variable. Original-patch-by: Bryce Gibson <bryce@gibson-consulting.com.au> Signed-off-by: Allan McRae <allan@archlinux.org> --- doc/PKGBUILD.5.txt | 3 +++ doc/makepkg.conf.5.txt | 6 +++++- etc/makepkg.conf.in | 5 +++-- scripts/makepkg.sh.in | 13 ++++++++++++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt index 24e1a12..4d76121 100644 --- a/doc/PKGBUILD.5.txt +++ b/doc/PKGBUILD.5.txt @@ -231,6 +231,9 @@ version. Appending the version yourself disables auto detection. *zipman*;; Compress man and info pages with gzip. + *upx*;; + Compress binary executable files using UPX. + *ccache*;; Allow the use of ccache during build. More useful in its negative form `!ccache` with select packages that have problems building diff --git a/doc/makepkg.conf.5.txt b/doc/makepkg.conf.5.txt index 3ce4759..48f5ef5 100644 --- a/doc/makepkg.conf.5.txt +++ b/doc/makepkg.conf.5.txt @@ -114,7 +114,7 @@ Options Specify a key to use for gpg signing instead of the default key in the keyring. Can be overridden with makepkg's `--key` option. -**OPTIONS=(**strip !docs libtool emptydirs zipman**)**:: +**OPTIONS=(**strip docs libtool emptydirs zipman purge !upx**)**:: This array contains options that affect the default packaging. They are equivalent to options that can be placed in the PKGBUILD; the defaults are shown here. All options should always be left in the array; to enable or @@ -146,6 +146,10 @@ Options Remove files specified by the `PURGE_TARGETS` variable from the package. + *upx*;; + Compress binary executable files using UPX. Additional options + can be passed to UPX by specifying the `UPXFLAGS` variable. + **INTEGRITY_CHECK=(**check1 ...**)**:: File integrity checks to use. Multiple checks may be specified; this affects both generation and checking. The current valid options are: diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 9a790fc..42ae940 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -60,7 +60,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign) # These are default values for the options=() settings ######################################################################### # -# Default: OPTIONS=(strip docs libtool emptydirs zipman purge) +# Default: OPTIONS=(strip docs libtool emptydirs zipman purge !upx) # A negated option will do the opposite of the comments below. # #-- strip: Strip symbols from binaries/libraries @@ -69,8 +69,9 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign) #-- emptydirs: Leave empty directories in packages #-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip #-- purge: Remove files specified by PURGE_TARGETS +#-- upx: Compress binary executable files using UPX # -OPTIONS=(strip docs libtool emptydirs zipman purge) +OPTIONS=(strip docs libtool emptydirs zipman purge !upx) #-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512 INTEGRITY_CHECK=(md5) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 78cd4cf..b0247bd 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -44,7 +44,7 @@ startdir="$PWD" srcdir="$startdir/src" pkgdir="$startdir/pkg" -packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge') +packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx') other_options=('ccache' 'distcc' 'buildflags' 'makeflags') splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \ 'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \ @@ -940,6 +940,17 @@ tidy_install() { msg2 "$(gettext "Removing empty directories...")" find . -depth -type d -empty -delete fi + + if [[ $(check_option upx) = "y" ]]; then + msg2 "$(gettext "Compressing binaries with %s...")" "UPX" + local binary + find . -type f -perm -u+w 2>/dev/null | while read binary ; do + if [[ $(file -bi "$binary") = *'application/x-executable'* ]]; then + upx $UPXFLAGS "$binary" &>/dev/null || + warning "$(gettext "Could not compress binary : %s")" "${binary/$pkgdir\//}" + fi + done + fi } find_libdepends() { -- 1.7.5.4
Oops... Introduced by commit d21f6ca4. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 53fa1a0..c1834a4 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -182,10 +182,6 @@ trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR -# a source entry can have two forms : -# 1) "filename::http://path/to/file" -# 2) "http://path/to/file" - enter_fakeroot() { msg "$(gettext "Entering fakeroot environment...")" @@ -196,6 +192,11 @@ enter_fakeroot() { fi } + +# a source entry can have two forms : +# 1) "filename::http://path/to/file" +# 2) "http://path/to/file" + # Return the absolute filename of a source entry # # This function accepts a source entry or the already extracted filename of a -- 1.7.5.4
These had not been touched since 2007 and had lost most of their relevance. The bug tracker is a better place for the filing of ideas. Signed-off-by: Allan McRae <allan@archlinux.org> --- @Dan: this is entirely up to you... TODO.aaron | 57 ------------------------------------ TODO.dan | 95 ------------------------------------------------------------ 2 files changed, 0 insertions(+), 152 deletions(-) delete mode 100644 TODO.aaron delete mode 100644 TODO.dan diff --git a/TODO.aaron b/TODO.aaron deleted file mode 100644 index b1f7887..0000000 --- a/TODO.aaron +++ /dev/null @@ -1,57 +0,0 @@ -== This is my custom TODO file == - -* transaction object should contain two package list (install and remove) - instead of a single list of syncpkgs - this should allow us to get rid of that - type. This also requires seperate functionality to return a list of - "replaces" packages to the front end, so the frontend can handle the QUESTION() - stuff in that case - -* libalpm -> front end communication needs a work-up. Both progress functions - can be combined into one callback, IFF we adjust it to accept a prefix string - for the progress bars, and format it at the lib side. Question functions - should also do the same - create the string at the library side, and simply - call some sort of int yes_no = ask_question("Do foo with bar?"); - -* move logging (alpm_logaction) out of the library. log files should be - written by the app, not the library. Adding a PM_LOG_* constant that - frontends can recognize and send to a file is probably a good idea. - -* clear up list allocation/deallocation - some lists need to be free'd, some - do not and there is no clear indication WHEN this should happen. - -* remove DB entries (directories) on a read error? - -* Add a pm_errstr error string, which will allow us to do things like: - pm_errno = PM_ERR_LIBARCHIVE; - pm_errstr = archive_error_string(archive); - or: - pm_errno = PM_ERR_LIBDOWNLOAD; - pm_errstr = downloadLastErrString; - This way we don't break abstraction when returning specific errors in - cases like the above. - -* pacman: A LOT of functions are way too long. There should be an upper limit of - 100-200 lines. _alpm_add_commit is around 600 lines, and is far too complex. - -* pacman: fixup doxygen documentation for public interface - -* feature for 3.1: package file hooks * - I've been planning on this one for some time. Here's a simple rundown: - in /etc/pacman.d/hooks: - Hook /usr/include/* : /usr/bin/ctags -R /usr/include/*.h -f /usr/include/systags - This will allow us to make "global hooks" to simplify a lot of repetitive - install files (scrollkeeper, depmod, etc). This also allows us to move - ldconfig out of pacman entirely. - possible: /etc/pacman.hooks/* files for hooks, so packages can add them too - -* feature for 3.1: multiple search/match types - option: MatchType regex (current way) - MatchType fnmatch (use fnmatch to match things like 'pacman -S gnome*') - MatchType plain (no matching. expect plain text). - -* feature for 3.1: revamp the autotools system. I'd LOVE to use a manual system - like wmii and friends do. It'd be real nice if we could just do away with - autotools altogether. - -**** BUGS **** -* Removal of conflicts on -A and -U (INCOMPLETE) diff --git a/TODO.dan b/TODO.dan deleted file mode 100644 index ee8f740..0000000 --- a/TODO.dan +++ /dev/null @@ -1,95 +0,0 @@ -TODO.dan -======== - -This is my personal TODO list. No guarantees if it is out of date and things no -longer apply. If you want to help out with any of it, send me an email. - -Pacman 3.1: ------------ - -Downgrade feature - allow users to see cached packages and downgrade to -(previous or any?) available options. - -Extreme similarity between some of the sync and add code...we have to be able -to abstract more away from sync actions and add actions to just 'actions' -(example: sync,c, add.c, and deptest.c all contain a switch on PM_DEP_MOD_*). -Merge update, add, and sync code when possible, so we reduce duplication. - -Review progress/transaction event subsystem. (from TODO) - -Add Doxygen comments to every function in libalpm including private functions. -Ensure functions are doing exactly their purpose and nothing more. Find -functions that perform duplicate behavior and merge them. Combine and refactor -others. Delete unnecessary functions. Stop keeping everything clustered in -little add/sync/remove parts, allow transactions to share code. - -Go through options list. Decide if namings are good, all options are still -relevant, etc. Ideas for -Re (#6273), changing meaning of -c (has two meanings, -another FS bug), etc. Remove the -A flag and possibly -D, -T, and -Y (-Y is -killed now in favor of vercmp binary) if they can be done by other actions. -Possible switch of -U --> -I (#5571). - -Review display and logging functions. There seems to be an abundance of them. -Make it extensible to use color, review what verbose/debug means. Perhaps -separate logging functionality- Pacman has its normal log, and alpm backend -keeps a very simple log file - listing only adds (including syncs) and removes. -This way a consistency list can be kept of what is currently installed and what -isn't, without all the logging junk from the front end. - -Profile the code. Find the functions that are being called a lot, and see what -can be done about it. Find out if all these calls are necessary (e.g. excessive -alpm_list_count calls), and maybe think about changing data structures to speed -operations up (e.g. a 'count' field). NOTE: already found two huge issues with -quick profiling- excessive setlocale calls, and extremely excessive strcmp -calls. - -Fix other localized issues- use non-printf when necessary. We may need to use -some wchar_t output on the progress bar as char/byte counts differ here. Sizes -of packages (e.g. 10,400.23 MB) should all be localized with correct -seperators. - -Rewrite makepkg to use terminal-safe coloring/bolding. tput utility should -allow us to do this. Make universal message functions for systemwide use, -including all pacman utilites- abs, pacman-optimize, etc. - -Bugs/FRs to smash: 6468, 6437, 6430?, 6420, 6404, 6389, 6312?, 6284, 6273?, -6255?, 6208, 5987, 5885, 5571, 4182, 3492, 2810?, 1769, 1588, 1571 - -Update doxygen comments, they may need some work. Try to document all of the -private internal functions too- it helps a ton for people just getting a -start on pacman hacking. - -Other smaller things: ---------------------- - -unsigned int vs. unsigned- determine a standard and stick with it - -FS #4185 - move where message is logged, perhaps? - -Update copyrights (2007) - -Update pacman website, and add/finish pacman coding style page - -Refine makepkg error codes. Each kind of failure could have its own code: - --package already built - --failed integ checks - --failed build - --etc. - -Revamp the downloadprog function a bit. Seems kind of messy. - ---print-uri option to sync should not require saying yes or no to up to date - -Build a replacement for this, or at least standardize its use. We shouldn't -always need to pass handle->root around, it is constant. Something like char* -buildpath(file). - /* build the new entryname relative to handle->root */ - snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname); - -Random ideas: -------------- - -Possibly split utilities/extras from pacman package - -Make .indent.pro file for GNU indent (started, but didn't finish) - -- 1.7.5.4
On Wed, Jun 22, 2011 at 3:54 AM, Allan McRae <allan@archlinux.org> wrote:
These had not been touched since 2007 and had lost most of their relevance. The bug tracker is a better place for the filing of ideas.
Signed-off-by: Allan McRae <allan@archlinux.org> ---
@Dan: this is entirely up to you... I've been meaning to do this for a while. :)
TODO.aaron | 57 ------------------------------------ TODO.dan | 95 ------------------------------------------------------------ 2 files changed, 0 insertions(+), 152 deletions(-) delete mode 100644 TODO.aaron delete mode 100644 TODO.dan
diff --git a/TODO.aaron b/TODO.aaron deleted file mode 100644 index b1f7887..0000000 --- a/TODO.aaron +++ /dev/null @@ -1,57 +0,0 @@ -== This is my custom TODO file == - -* transaction object should contain two package list (install and remove) - instead of a single list of syncpkgs - this should allow us to get rid of that - type. This also requires seperate functionality to return a list of - "replaces" packages to the front end, so the frontend can handle the QUESTION() - stuff in that case - -* libalpm -> front end communication needs a work-up. Both progress functions - can be combined into one callback, IFF we adjust it to accept a prefix string - for the progress bars, and format it at the lib side. Question functions - should also do the same - create the string at the library side, and simply - call some sort of int yes_no = ask_question("Do foo with bar?"); - -* move logging (alpm_logaction) out of the library. log files should be - written by the app, not the library. Adding a PM_LOG_* constant that - frontends can recognize and send to a file is probably a good idea. - -* clear up list allocation/deallocation - some lists need to be free'd, some - do not and there is no clear indication WHEN this should happen. - -* remove DB entries (directories) on a read error? - -* Add a pm_errstr error string, which will allow us to do things like: - pm_errno = PM_ERR_LIBARCHIVE; - pm_errstr = archive_error_string(archive); - or: - pm_errno = PM_ERR_LIBDOWNLOAD; - pm_errstr = downloadLastErrString; - This way we don't break abstraction when returning specific errors in - cases like the above. - -* pacman: A LOT of functions are way too long. There should be an upper limit of - 100-200 lines. _alpm_add_commit is around 600 lines, and is far too complex. - -* pacman: fixup doxygen documentation for public interface - -* feature for 3.1: package file hooks * - I've been planning on this one for some time. Here's a simple rundown: - in /etc/pacman.d/hooks: - Hook /usr/include/* : /usr/bin/ctags -R /usr/include/*.h -f /usr/include/systags - This will allow us to make "global hooks" to simplify a lot of repetitive - install files (scrollkeeper, depmod, etc). This also allows us to move - ldconfig out of pacman entirely. - possible: /etc/pacman.hooks/* files for hooks, so packages can add them too - -* feature for 3.1: multiple search/match types - option: MatchType regex (current way) - MatchType fnmatch (use fnmatch to match things like 'pacman -S gnome*') - MatchType plain (no matching. expect plain text). - -* feature for 3.1: revamp the autotools system. I'd LOVE to use a manual system - like wmii and friends do. It'd be real nice if we could just do away with - autotools altogether. - -**** BUGS **** -* Removal of conflicts on -A and -U (INCOMPLETE) diff --git a/TODO.dan b/TODO.dan deleted file mode 100644 index ee8f740..0000000 --- a/TODO.dan +++ /dev/null @@ -1,95 +0,0 @@ -TODO.dan -======== - -This is my personal TODO list. No guarantees if it is out of date and things no -longer apply. If you want to help out with any of it, send me an email. - -Pacman 3.1: ------------ - -Downgrade feature - allow users to see cached packages and downgrade to -(previous or any?) available options. - -Extreme similarity between some of the sync and add code...we have to be able -to abstract more away from sync actions and add actions to just 'actions' -(example: sync,c, add.c, and deptest.c all contain a switch on PM_DEP_MOD_*). -Merge update, add, and sync code when possible, so we reduce duplication. - -Review progress/transaction event subsystem. (from TODO) - -Add Doxygen comments to every function in libalpm including private functions. -Ensure functions are doing exactly their purpose and nothing more. Find -functions that perform duplicate behavior and merge them. Combine and refactor -others. Delete unnecessary functions. Stop keeping everything clustered in -little add/sync/remove parts, allow transactions to share code. - -Go through options list. Decide if namings are good, all options are still -relevant, etc. Ideas for -Re (#6273), changing meaning of -c (has two meanings, -another FS bug), etc. Remove the -A flag and possibly -D, -T, and -Y (-Y is -killed now in favor of vercmp binary) if they can be done by other actions. -Possible switch of -U --> -I (#5571). - -Review display and logging functions. There seems to be an abundance of them. -Make it extensible to use color, review what verbose/debug means. Perhaps -separate logging functionality- Pacman has its normal log, and alpm backend -keeps a very simple log file - listing only adds (including syncs) and removes. -This way a consistency list can be kept of what is currently installed and what -isn't, without all the logging junk from the front end. - -Profile the code. Find the functions that are being called a lot, and see what -can be done about it. Find out if all these calls are necessary (e.g. excessive -alpm_list_count calls), and maybe think about changing data structures to speed -operations up (e.g. a 'count' field). NOTE: already found two huge issues with -quick profiling- excessive setlocale calls, and extremely excessive strcmp -calls. - -Fix other localized issues- use non-printf when necessary. We may need to use -some wchar_t output on the progress bar as char/byte counts differ here. Sizes -of packages (e.g. 10,400.23 MB) should all be localized with correct -seperators. - -Rewrite makepkg to use terminal-safe coloring/bolding. tput utility should -allow us to do this. Make universal message functions for systemwide use, -including all pacman utilites- abs, pacman-optimize, etc. - -Bugs/FRs to smash: 6468, 6437, 6430?, 6420, 6404, 6389, 6312?, 6284, 6273?, -6255?, 6208, 5987, 5885, 5571, 4182, 3492, 2810?, 1769, 1588, 1571 - -Update doxygen comments, they may need some work. Try to document all of the -private internal functions too- it helps a ton for people just getting a -start on pacman hacking. - -Other smaller things: ---------------------- - -unsigned int vs. unsigned- determine a standard and stick with it - -FS #4185 - move where message is logged, perhaps? - -Update copyrights (2007) - -Update pacman website, and add/finish pacman coding style page - -Refine makepkg error codes. Each kind of failure could have its own code: - --package already built - --failed integ checks - --failed build - --etc. - -Revamp the downloadprog function a bit. Seems kind of messy. - ---print-uri option to sync should not require saying yes or no to up to date - -Build a replacement for this, or at least standardize its use. We shouldn't -always need to pass handle->root around, it is constant. Something like char* -buildpath(file). - /* build the new entryname relative to handle->root */ - snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname); - -Random ideas: -------------- - -Possibly split utilities/extras from pacman package - -Make .indent.pro file for GNU indent (started, but didn't finish) - -- 1.7.5.4
On Wed, Jun 22, 2011 at 10:54 AM, Allan McRae <allan@archlinux.org> wrote:
These had not been touched since 2007 and had lost most of their relevance. The bug tracker is a better place for the filing of ideas.
Agreed, but if some items are not completely obsolete and don't appear anywhere in the bug tracker, they should probably be added then.
On Sun, Jul 3, 2011 at 4:57 AM, Xavier Chantry <chantry.xavier@gmail.com> wrote:
On Wed, Jun 22, 2011 at 10:54 AM, Allan McRae <allan@archlinux.org> wrote:
These had not been touched since 2007 and had lost most of their relevance. The bug tracker is a better place for the filing of ideas.
Agreed, but if some items are not completely obsolete and don't appear anywhere in the bug tracker, they should probably be added then.
I did look through these; nothing stuck out that wasn't 1) already done, 2) obsolete, or 3) really needed anymore. -Dan
Add a function that checks for the software needed by makepkg to process a PKGBUILD with the requested options. This allows makepkg to bail early in the packaging process. Many other checks can be added to this function... Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 59 +++++++++++++++++++++++++++++++++++------------- 1 files changed, 43 insertions(+), 16 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c1834a4..4f99543 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -622,11 +622,6 @@ generate_checksums() { check_checksums() { (( ! ${#source[@]} )) && return 0 - if ! type -p openssl >/dev/null; then - error "$(gettext "Cannot find openssl.")" - exit 1 # $E_MISSING_PROGRAM - fi - local correlation=0 local integ required for integ in md5 sha1 sha256 sha384 sha512; do @@ -1213,10 +1208,6 @@ create_signature() { local ret=0 local filename="$1" msg "$(gettext "Signing package...")" - if ! type -p gpg >/dev/null; then - error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")" - exit 1 # $E_MISSING_PROGRAM - fi local SIGNWITHKEY="" if [[ -n $GPGKEY ]]; then @@ -1458,6 +1449,45 @@ check_sanity() { return $ret } +check_software() { + # check for needed software + local ret=0 + + # fakeroot - building as non-root user + if [[ $(check_buildenv fakeroot) = "y" ]] && (( EUID > 0 )); then + if ! type -p fakeroot >/dev/null; then + error "$(gettext "Cannot find the %s binary required for building as non-root user.")" "fakeroot" + ret=1 + fi + fi + + # gpg - package signing + if [[ $SIGNPKG == 'y' || (-z "$SIGNPKG" && $(check_buildenv sign) == 'y') ]]; then + if ! type -p gpg >/dev/null; then + error "$(gettext "Cannot find the %s binary required for signing packages.")" "gpg" + ret=1 + fi + fi + + # openssl - checksum operations + if (( ! SKIPINTEG )); then + if ! type -p openssl >/dev/null; then + error "$(gettext "Cannot find the %s binary required for validating sourcefile checksums.")" "openssl" + ret=1 + fi + fi + + # upx - binary compression + if [[ $(check_option upx) == 'y' ]]; then + if ! type -p upx >/dev/null; then + error "$(gettext "Cannot find the %s binary required for compressing binaries.")" "upx" + ret=1 + fi + fi + + return $ret +} + devel_check() { newpkgver="" @@ -1860,13 +1890,7 @@ if (( ! INFAKEROOT )); then error "$(gettext "The --asroot option is meant for the root user only.")" plain "$(gettext "Please rerun makepkg without the --asroot flag.")" exit 1 # $E_USER_ABORT - elif [[ $(check_buildenv fakeroot) = "y" ]] && (( EUID > 0 )); then - if ! type -p fakeroot >/dev/null; then - error "$(gettext "Fakeroot must be installed if using the 'fakeroot' option")" - plain "$(gettext "in the BUILDENV array in %s.")" "$MAKEPKG_CONF" - exit 1 - fi - elif (( EUID > 0 )); then + 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" @@ -1929,6 +1953,9 @@ fi # check the PKGBUILD for some basic requirements check_sanity || exit 1 +# check we have the software required to process the PKGBUILD +check_sofware || exit 1 + # We need to run devel_update regardless of whether we are in the fakeroot # build process so that if the user runs makepkg --forcever manually, we # 1) output the correct pkgver, and 2) use the correct filename when -- 1.7.5.4
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 idicates 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 <allan@archlinux.org> --- scripts/makepkg.sh.in | 102 ++++++++++++++++++++++++------------------------ 1 files changed, 51 insertions(+), 51 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 4f99543..7f84b53 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 @@ -926,7 +926,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 @@ -1009,7 +1009,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)" @@ -1081,7 +1081,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 } @@ -1092,7 +1092,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 @@ -1108,7 +1108,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 @@ -1296,9 +1296,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 @@ -1359,7 +1359,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 @@ -1370,7 +1370,7 @@ check_sanity() { sed -e "s/provides=/provides_list+=/" -e "s/#.*//" -e 's/\\$//') for i in ${provides_list[@]}; do if [[ $i != ${i//</} || $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 @@ -1380,7 +1380,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 @@ -1391,7 +1391,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 @@ -1422,7 +1422,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 @@ -1433,7 +1433,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 @@ -1441,7 +1441,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 @@ -1630,11 +1630,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")" @@ -1645,26 +1645,26 @@ usage() { printf "$(gettext " -p <file> 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 <file> 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 <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 <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 <list> 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 } @@ -1843,7 +1843,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 @@ -1873,7 +1873,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 @@ -1881,24 +1881,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 @@ -1927,7 +1927,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 @@ -1995,7 +1995,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 @@ -2014,7 +2014,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 @@ -2038,12 +2038,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 @@ -2054,7 +2054,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 @@ -2067,7 +2067,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 @@ -2079,7 +2079,7 @@ if (( INFAKEROOT )); then run_split_packaging fi - msg "$(gettext "Leaving fakeroot environment.")" + msg "$(gettext "Leaving %s environment.")" "fakeroot" exit 0 # $E_OK fi @@ -2090,7 +2090,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 @@ -2150,7 +2150,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 @@ -2162,9 +2162,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!")" @@ -2194,7 +2194,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" @@ -2216,7 +2216,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 -- 1.7.5.4
On Wed, Jun 22, 2011 at 3:54 AM, Allan McRae <allan@archlinux.org> wrote:
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 idicates that this "indicates" 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. This seems reasonable. Gettext pisses me off a lot here that it can't support these, almost tempted to say we could write a wrapper function but that seems overkill.
Do you want to do the message catalog split to possibly make catching these errors easier?
Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 102 ++++++++++++++++++++++++------------------------ 1 files changed, 51 insertions(+), 51 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 4f99543..7f84b53 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
@@ -926,7 +926,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
@@ -1009,7 +1009,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)" @@ -1081,7 +1081,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 }
@@ -1092,7 +1092,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
@@ -1108,7 +1108,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 @@ -1296,9 +1296,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 @@ -1359,7 +1359,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 @@ -1370,7 +1370,7 @@ check_sanity() { sed -e "s/provides=/provides_list+=/" -e "s/#.*//" -e 's/\\$//') for i in ${provides_list[@]}; do if [[ $i != ${i//</} || $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 @@ -1380,7 +1380,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 @@ -1391,7 +1391,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 @@ -1422,7 +1422,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 @@ -1433,7 +1433,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 @@ -1441,7 +1441,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 @@ -1630,11 +1630,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")" @@ -1645,26 +1645,26 @@ usage() { printf "$(gettext " -p <file> 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 <file> 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 <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 <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 <list> 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 }
@@ -1843,7 +1843,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
@@ -1873,7 +1873,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 @@ -1881,24 +1881,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 @@ -1927,7 +1927,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
@@ -1995,7 +1995,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 @@ -2014,7 +2014,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 @@ -2038,12 +2038,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 @@ -2054,7 +2054,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
@@ -2067,7 +2067,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 @@ -2079,7 +2079,7 @@ if (( INFAKEROOT )); then run_split_packaging fi
- msg "$(gettext "Leaving fakeroot environment.")" + msg "$(gettext "Leaving %s environment.")" "fakeroot" exit 0 # $E_OK fi
@@ -2090,7 +2090,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
@@ -2150,7 +2150,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 @@ -2162,9 +2162,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!")" @@ -2194,7 +2194,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" @@ -2216,7 +2216,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 -- 1.7.5.4
On 23/06/11 02:13, Dan McGee wrote:
On Wed, Jun 22, 2011 at 3:54 AM, Allan McRae<allan@archlinux.org> wrote:
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 idicates that this "indicates" 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. This seems reasonable. Gettext pisses me off a lot here that it can't support these, almost tempted to say we could write a wrapper function but that seems overkill.
Do you want to do the message catalog split to possibly make catching these errors easier?
You mean splitting makepkg (and the rest of the bash scripts) into their own translation unit? It is on my TODO list, but I have not quite figured out how to do that yet... Allan
On Thu, Jun 23, 2011 at 6:19 AM, Allan McRae <allan@archlinux.org> wrote:
On 23/06/11 02:13, Dan McGee wrote:
On Wed, Jun 22, 2011 at 3:54 AM, Allan McRae<allan@archlinux.org> wrote:
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 idicates that this
"indicates"
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.
This seems reasonable. Gettext pisses me off a lot here that it can't support these, almost tempted to say we could write a wrapper function but that seems overkill.
Do you want to do the message catalog split to possibly make catching these errors easier?
You mean splitting makepkg (and the rest of the bash scripts) into their own translation unit? It is on my TODO list, but I have not quite figured out how to do that yet...
It shouldn't be that hard. I'll give it a shot here real quick... -Dan
On Thu, Jun 23, 2011 at 9:11 PM, Dan McGee <dpmcgee@gmail.com> wrote:
On Thu, Jun 23, 2011 at 6:19 AM, Allan McRae <allan@archlinux.org> wrote:
On 23/06/11 02:13, Dan McGee wrote:
On Wed, Jun 22, 2011 at 3:54 AM, Allan McRae<allan@archlinux.org> wrote:
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 idicates that this
"indicates"
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.
This seems reasonable. Gettext pisses me off a lot here that it can't support these, almost tempted to say we could write a wrapper function but that seems overkill.
Do you want to do the message catalog split to possibly make catching these errors easier?
You mean splitting makepkg (and the rest of the bash scripts) into their own translation unit? It is on my TODO list, but I have not quite figured out how to do that yet...
It shouldn't be that hard. I'll give it a shot here real quick...
"real quick" turned out to be a bit more work to make things readable and logical, but here we go: http://code.toofishes.net/cgit/dan/pacman.git/log/?h=po-split Let me know what you think about merging this. -Dan
On 24/06/11 14:19, Dan McGee wrote:
On Thu, Jun 23, 2011 at 9:11 PM, Dan McGee<dpmcgee@gmail.com> wrote:
On Thu, Jun 23, 2011 at 6:19 AM, Allan McRae<allan@archlinux.org> wrote:
On 23/06/11 02:13, Dan McGee wrote:
On Wed, Jun 22, 2011 at 3:54 AM, Allan McRae<allan@archlinux.org> wrote:
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 idicates that this
"indicates"
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.
This seems reasonable. Gettext pisses me off a lot here that it can't support these, almost tempted to say we could write a wrapper function but that seems overkill.
Do you want to do the message catalog split to possibly make catching these errors easier?
You mean splitting makepkg (and the rest of the bash scripts) into their own translation unit? It is on my TODO list, but I have not quite figured out how to do that yet...
It shouldn't be that hard. I'll give it a shot here real quick...
"real quick" turned out to be a bit more work to make things readable and logical, but here we go: http://code.toofishes.net/cgit/dan/pacman.git/log/?h=po-split
Let me know what you think about merging this.
Looks good. Merge away. Allan
The format required for selection of packages within the group selection dialog is not entirely obvious, so provide some documentation. Fixes FS#24134. Signed-off-by: Allan McRae <allan@archlinux.org> --- I am crap at writing documentation so suggestions on how to make this clearer are more than welcome. doc/pacman.8.txt | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt index 531c992..c11439c 100644 --- a/doc/pacman.8.txt +++ b/doc/pacman.8.txt @@ -69,13 +69,19 @@ Operations interprets ">" as redirection to file.) + In addition to packages, groups can be specified as well. For example, if -gnome is a defined package group, then `pacman -S gnome` will install every -package in the gnome group, as well as the dependencies of those packages. +gnome is a defined package group, then `pacman -S gnome` will provide a +dialog allowing you to select which packages from that group you wish to +install. The package selection is specified using a space separated list of +package identifiers. Sequential packages may be selected by specifying the +first and last package identifiers separated by a hyphen (`-`). Excluding +packages is achieved by by prefixing a idetifier or range of identifers +with a carrot (`^`). + Packages that provide other packages are also handled. For example, `pacman -S foo` will first look for a foo package. If foo is not found, packages that provide the same functionality as foo will be searched for. If any package is -found, it will be installed. +found, it will be installed. A selection dialog is provided if multiple +packages providing foo are found. + You can also use `pacman -Su` to upgrade all packages that are out of date. See <<SO,Sync Options>> below. When upgrading, pacman performs version comparison -- 1.7.5.4
The format required for selection of packages within the group selection dialog is not entirely obvious, so provide some documentation.
Fixes FS#24134.
Signed-off-by: Allan McRae <allan@archlinux.org> ---
On Wed, Jun 22, 2011 at 3:54 AM, Allan McRae <allan@archlinux.org> wrote: maint-worthy, although we'll see if we do another release from there (probably not).
I am crap at writing documentation so suggestions on how to make this clearer are more than welcome.
doc/pacman.8.txt | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt index 531c992..c11439c 100644 --- a/doc/pacman.8.txt +++ b/doc/pacman.8.txt @@ -69,13 +69,19 @@ Operations interprets ">" as redirection to file.) + In addition to packages, groups can be specified as well. For example, if -gnome is a defined package group, then `pacman -S gnome` will install every -package in the gnome group, as well as the dependencies of those packages. +gnome is a defined package group, then `pacman -S gnome` will provide a +dialog allowing you to select which packages from that group you wish to
+install. The package selection is specified using a space separated list of +package identifiers. Sequential packages may be selected by specifying the "package identifiers" sounds more like names. Perhaps "numbers", or is
"provide a prompt"? I don't see it as a dialog ala ncurses/gtk. that too simplistic? Maybe just another quick sentence saying "Each package in the group is identified with a number" or something.
+first and last package identifiers separated by a hyphen (`-`). Excluding +packages is achieved by by prefixing a idetifier or range of identifers "identifier", spelling in two places here. :set spell in vim is helpful for these, as a side note. Maybe we should add a similar bit to the modelines in doc/ as I put in NEWS?
Not really what you're attempting to solve here, but now that it is documented, I'm surprised we don't treat commas or even semicolons as valid separators, the same as spaces.
+with a carrot (`^`). You probably mean "caret".
+ Packages that provide other packages are also handled. For example, `pacman -S foo` will first look for a foo package. If foo is not found, packages that provide the same functionality as foo will be searched for. If any package is -found, it will be installed. +found, it will be installed. A selection dialog is provided if multiple A selection prompt, similar to the one described fro groups, is provided if...
+packages providing foo are found. + You can also use `pacman -Su` to upgrade all packages that are out of date. See <<SO,Sync Options>> below. When upgrading, pacman performs version comparison -- 1.7.5.4
On 23/06/11 01:57, Dan McGee wrote:
The format required for selection of packages within the group selection dialog is not entirely obvious, so provide some documentation.
Fixes FS#24134.
Signed-off-by: Allan McRae<allan@archlinux.org> ---
On Wed, Jun 22, 2011 at 3:54 AM, Allan McRae<allan@archlinux.org> wrote: maint-worthy, although we'll see if we do another release from there (probably not).
I am crap at writing documentation so suggestions on how to make this clearer are more than welcome.
doc/pacman.8.txt | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt index 531c992..c11439c 100644 --- a/doc/pacman.8.txt +++ b/doc/pacman.8.txt @@ -69,13 +69,19 @@ Operations interprets ">" as redirection to file.) + In addition to packages, groups can be specified as well. For example, if -gnome is a defined package group, then `pacman -S gnome` will install every -package in the gnome group, as well as the dependencies of those packages. +gnome is a defined package group, then `pacman -S gnome` will provide a +dialog allowing you to select which packages from that group you wish to
"provide a prompt"? I don't see it as a dialog ala ncurses/gtk.
I have gone with "prompt" as that seem better.
+install. The package selection is specified using a space separated list of +package identifiers. Sequential packages may be selected by specifying the "package identifiers" sounds more like names. Perhaps "numbers", or is that too simplistic?
Maybe just another quick sentence saying "Each package in the group is identified with a number" or something.
Number sounds fine to me.
+first and last package identifiers separated by a hyphen (`-`). Excluding +packages is achieved by by prefixing a idetifier or range of identifers "identifier", spelling in two places here. :set spell in vim is helpful for these, as a side note. Maybe we should add a similar bit to the modelines in doc/ as I put in NEWS?
Not really what you're attempting to solve here, but now that it is documented, I'm surprised we don't treat commas or even semicolons as valid separators, the same as spaces.
I suppose that could be easily added. I am adding it to my TODO list as I always attempt to use comma separators.
+with a carrot (`^`). You probably mean "caret".
Reworded section: In addition to packages, groups can be specified as well. For example, if gnome is a defined package group, then `pacman -S gnome` will provide a prompt allowing you to select which packages to install from a numbered list. The package selection is specified using a space separated list of package numbers. Sequential packages may be selected by specifying the first and last package numbers separated by a hyphen (`-`). Excluding packages is achieved by prefixing a number or range of numbers with a caret (`^`).
+ Packages that provide other packages are also handled. For example, `pacman -S foo` will first look for a foo package. If foo is not found, packages that provide the same functionality as foo will be searched for. If any package is -found, it will be installed. +found, it will be installed. A selection dialog is provided if multiple A selection prompt, similar to the one described fro groups, is provided if...
Not really... I think you can only select one provider so it is a bit different to the group prompt. dialog -> prompt change has been made.
+packages providing foo are found. + You can also use `pacman -Su` to upgrade all packages that are out of date. See <<SO,Sync Options>> below. When upgrading, pacman performs version comparison -- 1.7.5.4
participants (3)
-
Allan McRae
-
Dan McGee
-
Xavier Chantry