git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] i18n: add infrastructure for translating Git with gettext

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 18, 2011, 12:29 UTC
Message-ID
<CACBZZX4hE=tSYRW3GJndvi3pr0B=Qyk+XT4qvMzC=jtAGhgXZg@mail.gmail.com>
In-Reply-To
<7v39dmmj8k.fsf@alter.siamese.dyndns.org>
On Fri, Nov 18, 2011 at 00:17, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Just an extremely minor issue, but a few things seem to seep through the
> "make V=''" build:
>
>    SUBDIR perl
> /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E><.../share/locale>" <Git/I18N.pm >blib/lib/Git/I18N.pm
> /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E><.../share/locale>" <Git.pm >blib/lib/Git.pm
> Manifying blib/man3/Git::I18N.3pm
> Manifying blib/man3/Git.3pm
>    SUBDIR git_remote_helpers

That behavior hasn't changed with this patch, we just print out more stuff now. Without the patch with V='':

        SUBDIR perl
    cp Git.pm blib/lib/Git.pm
    Manifying blib/man3/Git.3pm
And with it:
        SUBDIR perl
    /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></home/avar/share/locale>"
<Git/I18N.pm >blib/lib/Git/I18N.pm
    /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></home/avar/share/locale>"
<Git.pm >blib/lib/Git.pm
    Manifying blib/man3/Git::I18N.3pm
    Manifying blib/man3/Git.3pm
So the change is:
 * We now have 2 files instead of 1
 * We have a filtering command instead of just a "cp".
The reason this happens is that we have this in the perl.mak:
    PM_FILTER = $(PERL) -pe "s<\Q++LOCALEDIR++\E></home/avar/share/locale>"
And we then later call:
    pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
        $(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e
'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', q[$(PM_FILTER)],
'\''$(PERM_DIR)'\'')' -- \
          Git/I18N.pm $(INST_LIBDIR)/Git/I18N.pm \
          Git.pm $(INST_LIBDIR)/Git.pm
        $(NOECHO) $(TOUCH) pm_to_blib
Which in ExtUtils::Install calls pm_to_blib, which is defined like this:
    sub pm_to_blib {
        my($fromto,$autodir,$pm_filter) = @_;
        _mkpath($autodir,0,0755);
        while(my($from, $to) = each %$fromto) {
            if( -f $to && -s $from == -s $to && -M $to < -M $from ) {
                print "Skip $to (unchanged)\n";
                next;
            }
            # When a pm_filter is defined, we need to pre-process the
source first
            # to determine whether it has changed or not.  Therefore,
only perform
            # the comparison check when there's no filter to be ran.
            #    -- RAM, 03/01/2001
            my $need_filtering = defined $pm_filter && length $pm_filter &&
                                 $from =~ /\.pm$/;
            if (!$need_filtering && 0 == compare($from,$to)) {
                print "Skip $to (unchanged)\n";
                next;
            }
            if (-f $to){
                # we wont try hard here. its too likely to mess things up.
                forceunlink($to);
            } else {
                _mkpath(dirname($to),0,0755);
            }
            if ($need_filtering) {
                run_filter($pm_filter, $from, $to);
                print "$pm_filter <$from >$to\n";
            } else {
                _copy( $from, $to );
                print "cp $from $to\n";
            }

I.e. there's no way to stop it from printing what it copies / filters. We could quiet it with some Perl or Makefile hack, but let's try to address that outside of this series.

Previous: Junio C Hamano
Message 6 of 6 in “i18n back from the dead”
  1. i18n back from the deadÆvar Arnfjörð Bjarmason, Nov 11, 2011
  2. i18n: add infrastructure for translating Git with gettextÆvar Arnfjörð Bjarmason, Nov 11, 2011
  3. Jakub NarebskiNov 11, 2011
  4. Ævar Arnfjörð BjarmasonNov 11, 2011
  5. Junio C HamanoNov 17, 2011
  6. Ævar Arnfjörð BjarmasonNov 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.