intltool confused by separate build-dir

Bug #1117944 reported by zbyszek on 2013-02-07
64
This bug affects 10 people
Affects Status Importance Assigned to Milestone
intltool
Undecided
Unassigned
intltool (Ubuntu)
High
Unassigned

Bug Description

systemd uses 'intltool-update -m' from intltoolize in its 'make check'.
$(top_srcdir)/po/POTFILES.skip contains the name of a generated file (src/core/org.freedesktop.systemd1.policy.in), which will be generated as $(top_builddir)/src/core/org.freedesktop.systemd1.policy.in. If $(builddir)==$(srcdir) than everything works fine. When they are different, there's no way to instruct intltool-update to skip the file. Since the name of the build directory is not known and can be arbitrary, there should be a way to instruct intltool-update to ignore files relative to the $(top_builddir), or something like that. One option would be to turn the file list into a list of globs (**/src/core/org.freedesktop.systemd1.policy.in would work perfectly in our case).

Reproduced with intltool bzr master.

This issue gains importance due to the following change in automake 1.15:

The make distcheck target has been changed to use $(distdir)/_build/sub as its working directory. Code making assumption on the value of srcdir and top_srcdir during make distcheck will fail.

When testing with automake 1.15, you may end up seeing that the files generated during compilation into builddir are not ignored from intltool-update -m even if they are listed in POTFILES.skip, e.g.:

make[2]: Entering directory '/home/aleksander/Development/foss/ModemManager/ModemManager-1.5.0/_build/sub/po'
INTLTOOL_EXTRACT="/usr/bin/intltool-extract" XGETTEXT="/usr/bin/xgettext" srcdir=../../../po /usr/bin/intltool-update --gettext-package ModemManager --pot
rm -f missing notexist
srcdir=../../../po /usr/bin/intltool-update -m
The following files contain translations and are currently not in use. Please
consider adding these to the POTFILES.in file, located in the po/ directory.

sub/data/org.freedesktop.ModemManager1.policy.in

If some of these files are left out on purpose then please add them to
POTFILES.skip instead of POTFILES.in. A file 'missing' containing this list
of left out files has been written in the current directory.
Please report to <email address hidden>
if [ -r missing -o -r notexist ]; then \
  exit 1; \
fi
Makefile:150: recipe for target 'check' failed
make[2]: *** [check] Error 1
make[2]: Leaving directory '/home/aleksander/Development/foss/ModemManager/ModemManager-1.5.0/_build/sub/po'
Makefile:511: recipe for target 'check-recursive' failed
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory '/home/aleksander/Development/foss/ModemManager/ModemManager-1.5.0/_build/sub'
Makefile:716: recipe for target 'distcheck' failed
make: *** [distcheck] Error 1

The issue comes because intltool lists files within srcdir; and if builddir != srcdir, the files to ignore will be inside a subdirectory. The following patch makes an additional try to remove more ignored files, only when builddir is inside srcdir, by generating a path on top of builddir for each file to be generated. Horrible perl, so can very likely get improved in a better way... (but works for me for now) :/

Wait, previous patch is wrong, as intltool already hardcodes the removal of the "_build" prefix.

A quick and dirty solution (until next automake update) is likely to just add the new target prefix hardcoded, as done with "_build":

    foreach (@buf_allfiles_sorted)
    {
        my $dummy = $_;
        my $srcdir = $SRCDIR;

        $srcdir =~ s#^../##;
        $dummy =~ s#^$srcdir/../##;
        $dummy =~ s#^$srcdir/##;
        $dummy =~ s#_build/##;
++ $dummy =~ s#_build/sub/##;

The patch will try to guess which is the subdir of srcdir in which builddir was set (e.g. when doing make distcheck). If there is such subdir (i.e. if builddir is within subdir) we'll filter out the subdir prefix of all files.

Before, make distcheck was handled just by removing the "_build" hardcoded prefix, now it's guessed in runtime (so should also apply when not doing distcheck and doing a normal srcdir != buiddir build).

dobey (dobey) on 2015-02-03
Changed in intltool:
assignee: nobody → Rodney Dawes (dobey)
Carlos Garnacho (carlosg) wrote :

Any progress here? AFAICT this still happens, and quite a few projects just sticked sub/... files to POTFILES.skip, which is not too ideal.

fujiwara (takao-fujiwara) wrote :

I also hope the 'sub' dir issue is fixed asap.

I'm fine to add just '$dummy =~ s#_build/sub/##;' in FindLeftoutFiles().

Vlad Orlov (monsta) wrote :

Last update in the intltool code repo was on 2015-03-09. A year ago. Guess it's unmaintained upstream. Funny that upstream is right here on LP as well...

tags: added: wily xenial
Vlad Orlov (monsta) on 2016-03-16
tags: added: patch
dino99 (9d9) on 2016-03-16
Changed in intltool:
assignee: Rodney Dawes (dobey) → nobody

The attachment "Patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

Vlad Orlov (monsta) on 2016-03-19
Changed in intltool:
status: New → Confirmed
Changed in intltool (Ubuntu):
status: New → Confirmed
Changed in intltool (Ubuntu):
importance: Undecided → High
Vlad Orlov (monsta) wrote :

Any progress on this for Xenial?

Vlad Orlov (monsta) on 2017-01-19
tags: added: yakkety zesty

"WTF broke my distcheck!", then apply it to N projects using intltool, sum the amount of hours wasted by everyone applying workarounds in their own projects...

I have to admit this is very very sad.

A bug like this one, affecting every project using intltool, with one suggested patch even, still open 2 years later. Of course this is no longer critical because *every* project using intltool ended up patching their own POTFILES.skip... how very sad.

Let's see each other again here when automake updates again the default builddir during dist.

Vlad Orlov (monsta) wrote :

By some coincidence, I just sent Aleksander's patch to Debian...

Vlad Orlov (monsta) wrote :

Ok, here's the debdiff made from Aleksander's patch. Maybe we'll be more lucky with Ubuntu Sponsors Team...

tags: added: artful
removed: wily yakkety
Vlad Orlov (monsta) wrote :

Well, intltool is still needed for various projects which didn't migrate to gettext yet.

Yeah I know, it's just not my problem any more. Everyone should migrate, gettext is at least maintained.

Vlad Orlov (monsta) wrote :
Vlad Orlov (monsta) wrote :
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers