After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 169768 - gnome-doc-utils.make doesn't work in builddir != srcdir setup
gnome-doc-utils.make doesn't work in builddir != srcdir setup
Status: RESOLVED WONTFIX
Product: gnome-doc-utils
Classification: Deprecated
Component: build utils
CVS HEAD
Other Linux
: Normal normal
: ---
Assigned To: gnome-doc-utils maintainers
gnome-doc-utils maintainers
gnome[unmaintained]
Depends on:
Blocks: 414139
 
 
Reported: 2005-03-09 20:53 UTC by Christian Persch
Modified: 2020-03-03 18:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix for the configure problem (617 bytes, patch)
2005-03-10 12:15 UTC, Christian Persch
committed Details | Review

Description Christian Persch 2005-03-09 20:53:50 UTC
On configure:
grep: Makefile.am: No such file or directory
gnome-doc-utils.make should be added to EXTRA_DIST in Makefile.am

On make in help/:
(cd es/ && \
  `which xml2po` -p es.po ../C/epiphany.xml > epiphany.xml)
/bin/sh: line 0: cd: es/: Aucun fichier ou répertoire de ce type
Comment 1 Christian Persch 2005-03-10 12:15:31 UTC
Created attachment 38501 [details] [review]
fix for the configure problem
Comment 2 Shaun McCance 2005-04-01 00:15:51 UTC
This was applied on March 10.  Closing.
Comment 3 Christian Persch 2005-04-01 06:45:05 UTC
This bug still exists; the configure patch was only part of the problem.

With latest gnome-doc-utils, the lang directories are created in the builddir,
but the xml2po call still thinks it runs in srcdir:

if ! test -d es/; then mkdir es/; fi
if ! test -f es/es.po; then \
  (cd es/ && \
    xml2po -e ../C/epiphany.xml > es.po); \
else \
  (cd es/ && \
    xml2po -e -u es ../C/epiphany.xml); \
fi
Error: cannot open file '../C/epiphany.xml'.
Comment 4 Shaun McCance 2005-04-03 22:58:16 UTC
All right, I fixed that bit and another part that was causing a problem.  Are
there any more problems?
Comment 5 Christian Persch 2005-04-04 09:39:47 UTC
It's better now, but still doesn't work completely right. This rule:

$(_DOC_POFILES): $(_DOC_C_DOCS)
        if ! test -d $(dir $@); then mkdir $(dir $@); fi
        if test -f "$(_DOC_C_MODULE)"; then d="../"; else d="../$(srcdir)/"; fi; \
        if ! test -f $@; then \
          (cd $(dir $@) && \
            $(_xml2po) -e $(_DOC_C_DOCS_NOENT:%=$${d}%) > $(notdir $@)); \
        else \
          (cd $(dir $@) && \
            $(_xml2po) -e -u $(basename $(notdir $@))
$(_DOC_C_DOCS_NOENT:%=$${d}%)); \
        fi

will execute this commands:

if ! test -d es/; then mkdir es/; fi
if test -f "C/epiphany.xml"; then d="../"; else d="../../../help/"; fi; \
if ! test -f es/es.po; then \
  (cd es/ && \
    xml2po -e ${d}C/epiphany.xml > es.po); \
else \
  (cd es/ && \
    xml2po -e -u es ${d}C/epiphany.xml); \
fi

The test for es/es.po is wrong: the po file will exist in the srcdir, not in the
builddir. So instead of updating the po file from the .xml and the existing .po,
it is instead created from only the .xml and doesn't contain any translations.


Another problem is the generation of the translated .xml:

$(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
        if test -f "$(_DOC_C_MODULE)"; then d="../C/"; else d="../$(srcdir)/C/";
fi; \
        (cd $(dir $@) && \
          $(_xml2po) -e -p $(patsubst %/$(notdir $@),%,$@).po $${d}$(notdir $@)
> $(notdir $@))

Redirecting the output directly to epiphany.xml can cause build failure: when
something goes wrong, epiphany.xml may end up empty; and a following run of make
will now think that epiphany.xml is up-to-date and will skip the es/ directory.
Instead, it should redirect output to a temp file, and only on success move the
file to the target, like this:

$(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
        if test -f "$(_DOC_C_MODULE)"; then d="../C/"; else d="../$(srcdir)/C/";
fi; \
        (cd $(dir $@) && \
          $(_xml2po) -e -p $(patsubst %/$(notdir $@),%,$@).po $${d}$(notdir $@)
> gen-$(notdir $@) && \
          cp gen-$(notdir $@) $(notdir $@) && \
          rm -f gen-$(notdir $@)
Comment 6 Shaun McCance 2005-04-05 01:49:02 UTC
Phew, all right.  I've addressed these issues.  Modules using gdu seem to build
fine with builddir != srcdir now.  There still seem to be problems building gdu
itself in a separate builddir, but we can address those in #169324.  I consider
issues that affect other modules to be a much higher priority.

Any more issues?
Comment 7 Christian Persch 2005-04-05 10:27:18 UTC
> Any more issues?

Yes.

$(_DOC_POFILES): $(_DOC_C_DOCS)
        if ! test -d $(srcdir)/$(dir $@); then mkdir $(srcdir)/$(dir $@); fi
        if ! test -f $(srcdir)/$@; then \
          (cd $(srcdir)/$(dir $@) && \
            $(_xml2po) -e $(_DOC_C_DOCS_NOENT:%=../%) > $(notdir $@)); \
        else \
          (cd $(srcdir)/$(dir $@) && \
            $(_xml2po) -e -u $(basename $(notdir $@))
$(_DOC_C_DOCS_NOENT:%=../%)); \
        fi

will do this:

if ! test -d ../../help/es/; then mkdir ../../help/es/; fi
if ! test -f ../../help/es/es.po; then \
  (cd ../../help/es/ && \
    xml2po -e ../C/epiphany.xml > es.po); \
else \
  (cd ../../help/es/ && \
    xml2po -e -u es ../C/epiphany.xml); \
fi

so it does:
- create the es/ directory in $(srcdir) if it doesn't exist
- if $(srcdir)/es/es.po exists, put a "es" file in $(srcdir)/es; else put
"es.po" there

Touching files and adding directories in $(srcdir) is not legal; $(srcdir) might
not be writable.
Comment 8 Christian Persch 2005-04-14 12:41:37 UTC
The above problems are all resolved.

However I found two more problems:
Suppose that $(srcdir)/es/es.po is updated by the translator, so it's now newer
than $(srcdir)/C/$app.xml. Doing "make es/es.po" in $(builddir) will say "make:
`es/es.po' is up to date."; but $(builddir)/es/es.po does not even exist!

And a minor problem: This rule:
$(_DOC_LC_DOCS) : $(_DOC_C_DOCS)
        if ! test -d $(dir $@); then mkdir $(dir $@); fi
        if test -f "C/$(notdir $@)"; then d="../"; else d="../$(srcdir)/"; fi; \
        (cd $(dir $@) && \
          $(_xml2po) -e -p \
            $${d}$(dir $@)$(patsubst %/$(notdir $@),%,$@).po \
            $${d}C/$(notdir $@) > $(notdir $@).tmp && \
            cp $(notdir $@).tmp $(notdir $@) && rm -f $(notdir $@).tmp)

will use the pofile in $(srcdir)/es instead of the just created/updated one in
$(builddir)/es.
Comment 9 Shaun McCance 2005-07-15 22:30:15 UTC
This last part is tricky.  In this case, make sees the po file in the srcdir,
determines it's up-to-date, and never gives any of my code a chance to run.  To
make, the builddir and srcdir files are effectively the same thing.  Not saying
it's unsolvable.  Just that I don't know the solution.
Comment 10 André Klapper 2020-03-03 18:34:28 UTC
gnome-doc-utils has been superseded by yelp-xsl, yelp-tools, and itstool.

gnome-doc-utils will not see any further development, hence closing as WONTFIX.

See https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/255