Opened 6 years ago

Closed 6 years ago

#10112 closed enhancement (fixed)

remove gnome-screenshot temporary build fix

Reported by: DJ Lucas Owned by: blfs-book
Priority: normal Milestone: 8.3
Component: BOOK Version: SVN
Severity: normal Keywords:
Cc:

Description

Gnome screensaver currently copies metainfo without translations until unknown itstool issue is resolved.

Change History (21)

comment:1 by DJ Lucas, 6 years ago

Summary: remove gnome-screensaver temporary build fix once itstool issues resolvedremove gnome-screenshot temporary build fix once itstool issues resolved

comment:3 by Pierre Labastie, 6 years ago

This patch has been included into the book at r19528. This was reported on the dev list. See this message and the next in thread.

in reply to:  3 comment:4 by bdubbs@…, 6 years ago

Replying to pierre.labastie:

This patch has been included into the book at r19528. This was reported on the dev list. See this message and the next in thread.

Indeed. I already have it installed. Disregard comment 2.

comment:5 by Pierre Labastie, 6 years ago

Milestone: 8.28.3

comment:6 by bdubbs@…, 6 years ago

Milestone: 8.3y-hold

comment:7 by bdubbs@…, 6 years ago

Owner: changed from blfs-book@… to blfs-book

comment:8 by Pierre Labastie, 6 years ago

Has anybody tried with recent versions of meson?

comment:9 by Bruce Dubbs, 6 years ago

Just tried without the sed/cp.

[16/16] /usr/bin/python3 /usr/bin/meson --internal msgfmthelper ../src/org.gnome.Screenshot.metainfo.xml.in src/org.gnome.Screenshot.metainfo.xml xml /tmp/gnome-screenshot/gnome-screenshot-3.26.0/src/../po
FAILED: src/org.gnome.Screenshot.metainfo.xml 
/usr/bin/python3 /usr/bin/meson --internal msgfmthelper ../src/org.gnome.Screenshot.metainfo.xml.in src/org.gnome.Screenshot.metainfo.xml xml /tmp/gnome-screenshot/gnome-screenshot-3.26.0/src/../po
msgfmt: cannot locate ITS rules for ../src/org.gnome.Screenshot.metainfo.xml.in
ninja: build stopped: subcommand failed.
Last edited 6 years ago by Bruce Dubbs (previous) (diff)

comment:10 by Pierre Labastie, 6 years ago

After some (lponger than anticipated) search, I came to the conclusion that the observed behavior has nothing to do with itstools. It is rather related to the way gettext/msgfmt makes translations for xml files. The detailed mechanism is described at https://www.gnu.org/software/gettext/manual/html_node/Preparing-ITS-Rules.html#Preparing-ITS-Rules. In our case, There is no locating rule for metainfo.xml, so the program says it does not find the ITS rules for metainfo.xml... It seems those metatinfo rules are provided by appstream or appstream-glib (those are different pacakges). So I'll try installing appstream-glib and see what happens.

comment:11 by Pierre Labastie, 6 years ago

Just copying the 2 files at https://github.com/ximion/appstream/tree/master/data/its to /usr/share/gettext/its allowed the build to pass. Those are small files, maybe we could just "cat <<EOF" them at some place in the book (maybe on gnome-screenshot page, or at a more appropriate place, on the gtk+ page, for example). Appstream-glib package brings in gcab as a dependency, and a few others which are in the book. Appstream (see the link above) OTOH has only dependencies in the book (yaml, libxml2,...).

comment:12 by Pierre Labastie, 6 years ago

Ah! Just seen that gettext installs its/loc files in /usr/share/gettext-0.19.8/its. Specially, it has appdata.{its,loc} files, which can be used for metainfo.xml files. Now according to the doc Both ITS rule files and locating rule files must be installed in the $prefix/share/gettext/its directory. So my guess is that we are missing a step in gettext installation: either link /usr/share/gettext/its to /usr/share/gettext-<version>/its, or copy files from /usr/share/gettext-<version>/its to /usr/share/gettext/its.

Thoughts?

comment:13 by Bruce Dubbs, 6 years ago

Looking at my system I have:

drwxr-xr-x 3 root root 4096 Feb 16 14:19 /usr/share/gettext-0.19.8/
drwxr-xr-x 2 root root 4096 Feb 16 14:19 /usr/share/gettext-0.19.8/its/

but

drwxr-xr-x 7 root root 4096 Feb 18 11:54 /usr/share/gettext/
-rw-r--r-- 1 root root  94012 Feb 16 14:19 /usr/share/gettext/ABOUT-NLS
-rw-r--r-- 1 root root 397912 Feb 16 14:19 /usr/share/gettext/archive.dir.tar.xz
-rwxr-xr-x 1 root root  18574 Feb 16 14:19 /usr/share/gettext/config.rpath
-rw-r--r-- 1 root root  10164 Feb 16 14:19 /usr/share/gettext/gettext.h
drwxr-xr-x 2 root root   4096 Feb 16 14:19 /usr/share/gettext/intl
drwxr-xr-x 2 root root   4096 Apr  8 12:38 /usr/share/gettext/its
-rw-r--r-- 1 root root    510 Feb 16 14:19 /usr/share/gettext/javaversion.class
-rw-r--r-- 1 root root   2487 Feb 16 14:19 /usr/share/gettext/msgunfmt.tcl
drwxr-xr-x 2 root root   4096 Feb 16 14:19 /usr/share/gettext/po
drwxr-xr-x 5 root root   4096 Feb 16 14:19 /usr/share/gettext/projects
drwxr-xr-x 2 root root   4096 Feb 16 14:19 /usr/share/gettext/styles

Both directories were installed as a part of LFS. I'm not sure why /usr/share/gettext-0.19.8 was installed. We only use --docdir=/usr/share/doc/gettext-0.19.8.1, so those ae a part of the make install. I originally isntalled glib-2.54.3 on Feb 19, and then updated on Mar 17, Mar 24, and finally to glib-2.56.1 on Apr 8,

The directory /usr/share/gettext/its was installed as a part of glib.

I suppose we could do:

ln -s ../gettext-0.19.8/its /usr/share/gettext/its

as a part of LFS.

In the gettext tarball, there is a file, PACKAGING, which does mention both directories.

I tried copying all the files:

cd /usr/share/gettext-0.19.8/its cp ../../gettext/its/* .

but gnome screenshot could not locate its ITS rules. I also tried

cd /usr/share/gettext/its cp ../../gettext-0.19.8/its/* .

but got the same result.


I checked arch and they have "makedepends=(git meson appstream-glib)" I wonder if the missing its file(s) are in appstream-glib.

comment:14 by Bruce Dubbs, 6 years ago

I got this to work! I retrieved appdata.{its,loc} from the current appstream-glib package and put them into /usr/share/gettext/its. That's all that is needed.

They are short:

$ cat appdata.loc
<?xml version="1.0"?>
<locatingRules>
  <locatingRule name="AppData" pattern="*.appdata.xml">
    <documentRule localName="component" target="appdata.its"/>
  </locatingRule>
  <locatingRule name="AppData" pattern="*.metainfo.xml">
    <documentRule localName="component" target="appdata.its"/>
  </locatingRule>
</locatingRules>

$ cat appdata.its
<?xml version="1.0"?>
<its:rules xmlns:its="http://www.w3.org/2005/11/its"
           version="2.0">
  <its:translateRule selector="/component" translate="no"/>
  <its:translateRule selector="/component/name |
                               /component/summary |
                               /component/description |
                               /component/developer_name |
                               /component/screenshots/screenshot/caption"
                     translate="yes"/>
</its:rules>

We probably can put them in the book as here documents.

comment:15 by Pierre Labastie, 6 years ago

Actually, I was wrong in comment:12. In two respects:

  • The appdata.÷{its,loc} files installed by gettext-0.19.8.1 are not enough for translating metainfo files. This is fixed upstream, but the appdata.loc file in /usr/share/gettext-0.19.8/its needs to be changed from:
    <?xml version="1.0"?>
    <locatingRules>
      <locatingRule name="AppData" pattern="*.appdata.xml">
        <documentRule localName="component" target="appdata.its"/>
      </locatingRule>
    </locatingRules>
    
    to what Bruce has put above.
  • Once this file is changed, nothing more is needed. msgfmt looks for the files in /usr/share/gettext-0.19.8/its, so it finds the appdata.{loc,its} files there.

Conclusion: we only need to add three lines to /usr/share/gettext-0.19.8/its/appdata.loc. Tricky sed, but possible...

comment:16 by Pierre Labastie, 6 years ago

The sed could be:

sed -i /AppData/N;N;p;s/\.appdata\./.metainfo./ /usr/share/gettext-0.19.8/its/appdata.loc

Or if done during gettext installation, could be done on the file in the build directory.

comment:17 by Pierre Labastie, 6 years ago

The file is gettext-tools/its/appdata.loc, in gettext build directory.

in reply to:  16 ; comment:18 by Bruce Dubbs, 6 years ago

Replying to pierre.labastie:

The sed could be:

sed -i /AppData/N;N;p;s/\.appdata\./.metainfo./ /usr/share/gettext-0.19.8/its/appdata.loc

I like it!

Or if done during gettext installation, could be done on the file in the build directory.

Right. I'll do that. Should we put a note in gnome-screenshot about the fix?

in reply to:  18 comment:19 by Pierre Labastie, 6 years ago

Replying to bdubbs:

Replying to pierre.labastie:

The sed could be:

sed -i /AppData/N;N;p;s/\.appdata\./.metainfo./ /usr/share/gettext-0.19.8/its/appdata.loc

I like it!

Or if done during gettext installation, could be done on the file in the build directory.

Right. I'll do that. Should we put a note in gnome-screenshot about the fix?

Yes. I think it is good if the development book can be built with stable LFS, which wouldn't be the case anymore. Maybe mention on the gnome-screenshot page that gettext should be reinstalled using the dev LFS book instructions before building the package (and think of removing that when releasing in August, so add this note just after &lfs82_checked;...)

comment:20 by Bruce Dubbs, 6 years ago

Milestone: y-hold8.3
Summary: remove gnome-screenshot temporary build fix once itstool issues resolvedremove gnome-screenshot temporary build fix

I fixed gettext in LFS. The only think left is to remove the extra commands in gnome-screenshot and add a note about the LFS change.

Version 0, edited 6 years ago by Bruce Dubbs (next)

comment:21 by Bruce Dubbs, 6 years ago

Resolution: fixed
Status: newclosed

Fixed at revision 20076.

Note: See TracTickets for help on using tickets.