Fix up intltool leaving .intltool-merge-cache.lock file behind (!103)

On Ubuntu 22.04 LTS make distcheck fails like this:
    $ make distcheck
    ...
    ERROR: files left in build directory after distclean:
    ./po/.intltool-merge-cache.lock
    make[1]: *** [Makefile:920: distcleancheck] Error 1
    make[1]: Leaving directory '/builds/GNOME/gparted/gparted-1.4.0-git/_build/sub'
    make: *** [Makefile:849: distcheck] Error 1

This was picked up by the GitLab ubuntu_test CI job after the Ubuntu
22.04 LTS release and the official Ubuntu docker image labelled latest
was updated to match, circa April 2022.  This is a known issue with
intltool >= 0.51.0-5.1 [1][2][3], first included in Ubuntu 22.04 LTS.

The pending proposed fix is to also delete the left behind
.intltool-merge-cache.lock along with the associated cache file itself
in the intltool provided Makefile.in.in [4].

Applying a fix to the GitLab ubuntu_test CI job does nothing for fixing
it for us maintainers on our distributions.  po/Makefile.in.in is not
part of the GParted git repository, instead it is copied from
/usr/share/intltool/Makefile.in.in by ./autogen.sh -> gnome-autogen.sh
-> intltoolize --force --copy --automake.  Add a configure check which
patches po/Makefile.in.in as needed.  This will fix it for those
building from git, and be a harmless check for those building from a tar
release.  Configure output line looks like:
    checking whether po/Makefile.in.in deletes intltool cache lock file... fixed

[1] Ubuntu bug 1712194 - Error when running make distcheck
    https://bugs.launchpad.net/intltool/+bug/1712194
[2] Debian bug #991623 - intltool: make distcheck broken
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=991623
[3] Arch Linux bug FS#67098 - [intltool] latest patch for race condition
    breaks some builds
    https://bugs.archlinux.org/task/67098
[4] Remove cache lock file in mostlyclean
    https://code.launchpad.net/~danbnicholson/intltool/intltool/+merge/406321

Closes !103 - Fix make distcheck failure found in GitLab CI job
              unbuntu_test
This commit is contained in:
Mike Fleetwood 2022-05-29 20:12:16 +01:00 committed by Curtis Gedak
parent 4b1c9badbc
commit 0bd636a34b
1 changed files with 18 additions and 0 deletions

View File

@ -16,6 +16,8 @@ AC_PROG_CXX
AC_PROG_CC
AC_PROG_LIBTOOL
AC_PROG_AWK
AC_PROG_FGREP
AC_PROG_SED
dnl Check for pkg-config early to avoid splitting message when first used.
PKG_CHECK_EXISTS
@ -57,6 +59,22 @@ AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [description])
AM_GLIB_GNU_GETTEXT
IT_PROG_INTLTOOL([0.36.0])
dnl Check for and fix missing delete of intltool cache lock file. Only
dnl needed with intltool >= 0.51.0-5.1, but just always fix as that is
dnl simpler and safe.
AC_MSG_CHECKING([whether po/Makefile.in.in deletes intltool cache lock file])
file='po/Makefile.in.in'
if $FGREP -q '.intltool-merge-cache.lock' "$file"; then
AC_MSG_RESULT([yes])
else
$SED -i '/rm -f .intltool-merge-cache/s/$/ .intltool-merge-cache.lock/' "$file"
if $FGREP -q '.intltool-merge-cache.lock' "$file"; then
AC_MSG_RESULT([fixed])
else
AC_MSG_RESULT([no])
fi
fi
dnl======================
dnl checks for libs