Skip to contentSkip to conversation

man/info: fix not support xz/bz2 compression

PATCH Superseded Hongxu Jia 1 participant 7 messages Sep 25, 2014 – Oct 11, 2014

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

v4 cover man/info: fix not support xz/bz2 compression

Changed in V4:
- In info's postinst/prerm, check the existance of ${infodir}

- Remove x permission for scripts/postinst-intercepts/update_info_dir 'new file mode 100755'-->'new file mode 100644', rootfs.py use the x permission to decide whether the scripts in postinst-intercepts be invoked or not. Sounds weird, but it is the reason of Ross's build failure.

Changed in V3:
- Remove Debian-specific code
- split() the INHERIT variable

Changed in V2:
- Conditionally add 'gzip/bzip2/xz' to man/info's RDEPENDS rather than modify busybox's defconfig.

- Refer Ubuntu to add a script to postinst_intercept to run it after all packages have been installed at build time.

Test Case:

vim local.conf
..
IMAGE_INSTALL_append = " man man-doc texinfo texinfo-doc info info-doc" INHERIT += "compress_doc"
DOC_COMPRESS = "xz" or DOC_COMPRESS = "bz2"
..

bitbake core-image-minimal

runqemu qemux86

On target,
...

root@qemux86:~# man man
root@qemux86:~# info info
...

//Hongxu

The following changes since commit 8ac8eca2e3bd8c78e2b31ea974930ed0243258a3:

build-appliance-image: Update to dizzy head revision (2014-09-23 22:10:26 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-doc
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-doc

Hongxu Jia (4):
scripts/postinst-intercepts: add update_info_dir
texinfo: fix QA Error while doc compress enabled
texinfo: fix info not work
man/texinfo: conditionally add gzip/bzip2/xz to RDEPENDS

 meta/recipes-extended/man/man_1.6g.bb        | 13 +++++
 meta/recipes-extended/texinfo/texinfo_5.2.bb | 76 ++++++++++++++++++++++++++-
 scripts/postinst-intercepts/update_info_dir  | 77 ++++++++++++++++++++++++++++
 3 files changed, 165 insertions(+), 1 deletion(-)
 create mode 100644 scripts/postinst-intercepts/update_info_dir
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v4 1/4 scripts/postinst-intercepts: add update_info_dir

We need to run it after all packages have been installed. Here is details:

NAME
update_info_dir - update or create index file from all installed info files in directory

SYNOPSIS
update_info_dir [options] [directory]

DESCRIPTION
Update, or create, the index file dir of available documentation in $D/${infodir} (the default) or in given DIRECTORY. The index file info is the directory is usually presented by info browsers on startup.

OPTIONS
-h,--help
Display help and exit.

SEE ALSO
emacs(1) info(1) install-info(1)

AUTHOR
This manual page was written by Norbert Preining <[email protected]>, for the Debian GNU/Linux system (but may be used by others). This manual page was written for the Debian GNU/Linux distribution because the original script was designed for Debian packaging system.

Backport update-info-dir from ubuntu 1404, and add xz/bz2 compression support

[YOCTO #6751]

---
 scripts/postinst-intercepts/update_info_dir | 77 +++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 scripts/postinst-intercepts/update_info_dir
scripts/postinst-intercepts/update_info_dir new file +77 -0
new file mode 100644
index 0000000..5ddbc39
@@ -0,0 +1,77 @@
+#!/bin/bash
+# update-info-dir
+# create a dir file from all installed info files
+# Copyright 2009 Norbert Preining
+# GPLv2
+
+INFODIR=$D${infodir}
+
+set -e
+
+#
+# since user's environment is taken over into root account when sudo-ing
+# we don't want that one's user LANGUAGE setting changes the messages in
+# the dir file. Force it to C. See bug #536476
+LANGUAGE="C"
+LANG="C"
+
+Help ()
+{
+    echo "\
+SYNOPSIS: update-info-dir [-h,--help] [info-directory]
+
+(re-)creates the index of available documentation in info format
+(the file /usr/share/info/dir) which is usually presented by info browsers
+on startup."
+
+    exit 0
+}
+
+
+if [ "$1" = "-h" ] || [ "$1" == "--help" ]; then
+    Help
+fi
+
+if [ -n "$1" ] ; then
+  INFODIR="$1"
+fi
+
+if [ ! -d "$INFODIR" ] ; then
+  echo "Not a directory: $INFODIR."
+  exit 0
+fi
+
+if [ -r "$INFODIR/dir" ] ; then
+  rm -f "$INFODIR/dir.old"
+  cp $INFODIR/dir $INFODIR/dir.old
+fi
+
+# we have to remove the dir file not make ginstall-info being surprised
+rm -f "$INFODIR/dir"
+
+errors=0
+find "$INFODIR" -type f | while read file ; do
+  case $file in
+    */dir|*/dir.old| \
+    *-[0-9]|*-[0-9].gz|*-[0-9].xz|*-[0-9].bz2| \
+    *-[1-9][0-9]|*-[1-9][0-9].gz|*-[1-9][0-9].xz|*-[1-9][0-9].bz2| \
+    *.png)
+      # these files are ignored
+      continue
+      ;;
+    *)
+      ${STAGING_BINDIR_NATIVE}/install-info "$file" "$INFODIR/dir" || {
+        errors=$[errors+1]
+      }
+      ;;
+  esac
+done
+
+if [ $errors -gt 0 ] ; then
+  echo "Updating the index of info documentation produced $errors errors."
+  exit 1
+fi
+
+exit 0
+
+# vim:set expandtab tabstop=2: #
Signature · 1 line
1.9.1
author
#2 lore raw

Re: [PATCH 1/4] scripts/postinst-intercepts: add update_info_dir

Quoted 100 lines · Hongxu Jia

We need to run it after all packages have been installed. Here is details:

NAME
update_info_dir - update or create index file from all installed info files in directory

SYNOPSIS
update_info_dir [options] [directory]

DESCRIPTION
Update, or create, the index file dir of available documentation in $D/${infodir} (the default) or in given DIRECTORY. The index file info is the directory is usually presented by info browsers on startup.

OPTIONS
-h,--help
Display help and exit.

SEE ALSO
emacs(1) info(1) install-info(1)

AUTHOR
This manual page was written by Norbert Preining <[email protected]>, for the Debian GNU/Linux system (but may be used by others). This manual page was written for the Debian GNU/Linux distribution because the original script was designed for Debian packaging system.

Backport update-info-dir from ubuntu 1404, and add xz/bz2 compression support

[YOCTO #6751]

---
  scripts/postinst-intercepts/update_info_dir | 77 +++++++++++++++++++++++++++++
  1 file changed, 77 insertions(+)

create mode 100644 scripts/postinst-intercepts/update_info_dir

scripts/postinst-intercepts/update_info_dir new file +54 -0
new file mode 100644
index 0000000..5ddbc39
@@ -0,0 +1,77 @@
+#!/bin/bash
+# update-info-dir
+# create a dir file from all installed info files
+# Copyright 2009 Norbert Preining
+# GPLv2
+
+INFODIR=$D${infodir}
+
+set -e
+
+#
+# since user's environment is taken over into root account when sudo-ing
+# we don't want that one's user LANGUAGE setting changes the messages in
+# the dir file. Force it to C. See bug #536476
+LANGUAGE="C"
+LANG="C"
+
+Help ()
+{
+    echo "\
+SYNOPSIS: update-info-dir [-h,--help] [info-directory]
+
+(re-)creates the index of available documentation in info format
+(the file /usr/share/info/dir) which is usually presented by info browsers
+on startup."
+
+    exit 0
+}
+
+
+if [ "$1" = "-h" ] || [ "$1" == "--help" ]; then
+    Help
+fi
+
+if [ -n "$1" ] ; then
+  INFODIR="$1"
+fi
+
+if [ ! -d "$INFODIR" ] ; then
+  echo "Not a directory: $INFODIR."
+  exit 0
+fi
+
+if [ -r "$INFODIR/dir" ] ; then
+  rm -f "$INFODIR/dir.old"
+  cp $INFODIR/dir $INFODIR/dir.old
+fi
+
+# we have to remove the dir file not make ginstall-info being surprised
+rm -f "$INFODIR/dir"
+
+errors=0
+find "$INFODIR" -type f | while read file ; do
+  case $file in

scripts/postinst-intercepts/update_info_dir line 64

Quoted 10 lines
scripts/postinst-intercepts/update_info_dir new file +10 -0
+    */dir|*/dir.old| \
+    *-[0-9]|*-[0-9].gz|*-[0-9].xz|*-[0-9].bz2| \
+    *-[1-9][0-9]|*-[1-9][0-9].gz|*-[1-9][0-9].xz|*-[1-9][0-9].bz2| \
+    *.png)
+      # these files are ignored
+      continue
+      ;;
+    *)
+      ${STAGING_BINDIR_NATIVE}/install-info "$file" "$INFODIR/dir" || {
+        errors=$[errors+1]

It is bashism, I will improve it in V4

//Hongxu

Quoted 13 lines
scripts/postinst-intercepts/update_info_dir new file +13 -0
+      }
+      ;;
+  esac
+done
+
+if [ $errors -gt 0 ] ; then
+  echo "Updating the index of info documentation produced $errors errors."
+  exit 1
+fi
+
+exit 0
+
+# vim:set expandtab tabstop=2: #
author
#3 lore raw

Re: [PATCH 1/4] scripts/postinst-intercepts: add update_info_dir

Quoted 109 lines · Hongxu Jia
Quoted 108 lines · Hongxu Jia

We need to run it after all packages have been installed. Here is details:

NAME
update_info_dir - update or create index file from all installed info files in directory

SYNOPSIS
update_info_dir [options] [directory]

DESCRIPTION
Update, or create, the index file dir of available documentation in $D/${infodir} (the default) or in given DIRECTORY. The index file info is the directory is usually presented by info browsers on startup.

OPTIONS
-h,--help
Display help and exit.

SEE ALSO
emacs(1) info(1) install-info(1)

AUTHOR
This manual page was written by Norbert Preining <[email protected]>, for the Debian GNU/Linux system (but may be used by others). This manual page was written for the Debian GNU/Linux distribution because the original script was designed for Debian packaging system.

Backport update-info-dir from ubuntu 1404, and add xz/bz2 compression support

[YOCTO #6751]

---
  scripts/postinst-intercepts/update_info_dir | 77 
+++++++++++++++++++++++++++++
  1 file changed, 77 insertions(+)

create mode 100644 scripts/postinst-intercepts/update_info_dir

scripts/postinst-intercepts/update_info_dir new file +12 -0
new file mode 100644
index 0000000..5ddbc39
@@ -0,0 +1,77 @@
+#!/bin/bash
+# update-info-dir
+# create a dir file from all installed info files
+# Copyright 2009 Norbert Preining
+# GPLv2
+
+INFODIR=$D${infodir}
+
+set -e
+
+#
+# since user's environment is taken over into root account when 

sudo-ing
+# we don't want that one's user LANGUAGE setting changes the messages in

scripts/postinst-intercepts/update_info_dir new file +11 -0
+# the dir file. Force it to C. See bug #536476
+LANGUAGE="C"
+LANG="C"
+
+Help ()
+{
+    echo "\
+SYNOPSIS: update-info-dir [-h,--help] [info-directory]
+
+(re-)creates the index of available documentation in info format
+(the file /usr/share/info/dir) which is usually presented by info 

browsers

scripts/postinst-intercepts/update_info_dir new file +34 -0
+on startup."
+
+    exit 0
+}
+
+
+if [ "$1" = "-h" ] || [ "$1" == "--help" ]; then
+    Help
+fi
+
+if [ -n "$1" ] ; then
+  INFODIR="$1"
+fi
+
+if [ ! -d "$INFODIR" ] ; then
+  echo "Not a directory: $INFODIR."
+  exit 0
+fi
+
+if [ -r "$INFODIR/dir" ] ; then
+  rm -f "$INFODIR/dir.old"
+  cp $INFODIR/dir $INFODIR/dir.old
+fi
+
+# we have to remove the dir file not make ginstall-info being surprised
+rm -f "$INFODIR/dir"
+
+errors=0
+find "$INFODIR" -type f | while read file ; do
+  case $file in
+    */dir|*/dir.old| \
+    *-[0-9]|*-[0-9].gz|*-[0-9].xz|*-[0-9].bz2| \
+ *-[1-9][0-9]|*-[1-9][0-9].gz|*-[1-9][0-9].xz|*-[1-9][0-9].bz2| \
+    *.png)
Quoted 9 lines

scripts/postinst-intercepts/update_info_dir line 64

Quoted 6 lines
scripts/postinst-intercepts/update_info_dir new file +6 -0
+      # these files are ignored
+      continue
+      ;;
+    *)
+      ${STAGING_BINDIR_NATIVE}/install-info "$file" "$INFODIR/dir" || {
+        errors=$[errors+1]

It is bashism, I will improve it in V4

s/V4/V5/

//Hongxu

Quoted 18 lines

//Hongxu

Quoted 14 lines
scripts/postinst-intercepts/update_info_dir new file +7 -0
+      }
+      ;;
+  esac
+done
+
+if [ $errors -gt 0 ] ; then
+  echo "Updating the index of info documentation produced $errors 

errors."

scripts/postinst-intercepts/update_info_dir new file +6 -0
+  exit 1
+fi
+
+exit 0
+
+# vim:set expandtab tabstop=2: #
author
#4 lore raw

PATCH v4 2/4 texinfo: fix QA Error while doc compress enabled

In reply to Hongxu Jia

While doc compress enabled, ther is a QA issue:
...
ERROR: QA Issue: texinfo: Files/directories were installed but not shipped
/usr/share/info/info.info.bz2 /usr/share/info/info-stnd.info.bz2 [installed-vs-shipped]
...

---
 meta/recipes-extended/texinfo/texinfo_5.2.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-extended/texinfo/texinfo_5.2.bb +1 -1
index be90aba..7b5a11a 100644
@@ -51,7 +51,7 @@ do_install_append_class-native() {
 PACKAGES += "info info-doc"
 
 FILES_info = "${bindir}/info ${bindir}/infokey ${bindir}/install-info"
-FILES_info-doc = "${infodir}/info.info ${infodir}/dir ${infodir}/info-*.info \
+FILES_info-doc = "${infodir}/info.info* ${infodir}/dir ${infodir}/info-*.info* \
                   ${mandir}/man1/info.1* ${mandir}/man5/info.5* \
                   ${mandir}/man1/infokey.1* ${mandir}/man1/install-info.1*"
 
Signature · 1 line
1.9.1
author
#5 lore raw

PATCH v4 3/4 texinfo: fix info not work

In reply to Hongxu Jia

In texinfo, we didn't have info/dir entries, which caused info not work.
...

root@qemux86:~# info info
info: dir: No such file or directory
...

Refer ubuntu/debian to invoke install-info to create info/dir entries in pkg_postinst_info.

[YOCTO #6751]

---
 meta/recipes-extended/texinfo/texinfo_5.2.bb | 61 ++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
meta/recipes-extended/texinfo/texinfo_5.2.bb +61 -0
index 7b5a11a..11c11aa 100644
@@ -61,4 +61,65 @@ FILES_${PN}-doc = "${infodir}/texinfo* \
                    ${datadir}/${tex_texinfo} \
                    ${mandir}/man1 ${mandir}/man5"
 
+pkg_postinst_info () {
+if [ "x$D" != "x" ]; then
+    $INTERCEPT_DIR/postinst_intercept update_info_dir ${PKG} \
+        mlprefix=${MLPREFIX} infodir=${infodir} STAGING_BINDIR_NATIVE=${STAGING_BINDIR_NATIVE}
+else
+    if [ ! -d "${infodir}" ]; then
+        exit 0
+    fi
+
+    errors=0
+    find "${infodir}" -type f | while read file ; do
+        case $file in
+        */dir| */dir.old| \
+        *-[0-9]|*-[0-9].gz|*-[0-9].xz|*-[0-9].bz2| \
+        *-[1-9][0-9]|*-[1-9][0-9].gz|*-[1-9][0-9].xz|*-[1-9][0-9].bz2| \
+        *.png)
+            # these files are ignored
+            continue
+            ;;
+        *)
+            install-info "$file" "${infodir}/dir" || {
+                errors=$[errors+1]
+            }
+            ;;
+        esac
+    done
+    if [ $errors -gt 0 ] ; then
+        echo "Updating the index of info documentation produced $errors errors."
+        exit 1
+    fi
+fi
+}
+
+pkg_prerm_info () {
+if [ ! -d "$D${infodir}" ]; then
+    exit 0
+fi
+
+errors=0
+find "$D${infodir}" -type f | while read file ; do
+    case $file in
+    */dir|*/dir.old| \
+    *-[0-9]|*-[0-9].gz|*-[0-9].xz|*-[0-9].bz2| \
+    *-[1-9][0-9]|*-[1-9][0-9].gz|*-[1-9][0-9].xz|*-[1-9][0-9].bz2| \
+    *.png)
+        # these files are ignored
+        continue
+        ;;
+    *)
+        install-info --delete "$file" "$D${infodir}/dir" || {
+            errors=$[errors+1]
+        }
+        ;;
+    esac
+done
+
+if [ $errors -gt 0 ] ; then
+    echo "Cleaning the index of info documentation produced $errors errors."
+fi
+}
+
 BBCLASSEXTEND = "native"
Signature · 1 line
1.9.1
author
#6 lore raw

PATCH v4 4/4 man/texinfo: conditionally add gzip/bzip2/xz to RDEPENDS

In reply to Hongxu Jia

Conditionally add 'xz/bz2/gzip' to info/man's RDEPENDS according to DOC_COMPRESS.

[YOCTO #6750]
[YOCTO #6751]

---
 meta/recipes-extended/man/man_1.6g.bb        | 13 +++++++++++++
 meta/recipes-extended/texinfo/texinfo_5.2.bb | 13 +++++++++++++
 2 files changed, 26 insertions(+)
meta/recipes-extended/man/man_1.6g.bb +13 -0
index a66e01c..03fffd6 100644
@@ -9,6 +9,19 @@ PR = "r1"
 
 DEPENDS = "groff less"
 
+def compress_pkg(d):
+    if "compress_doc" in (d.getVar("INHERIT", True) or "").split():
+         compress = d.getVar("DOC_COMPRESS", True)
+         if compress == "gz":
+             return "gzip"
+         elif compress == "bz2":
+             return "bzip2"
+         elif compress == "xz":
+             return "xz"
+    return ""
+
+RDEPENDS_${PN} += "${@compress_pkg(d)}"
+
 SRC_URI = "http://primates.ximian.com/~flucifredi/${BPN}/${BPN}-${PV}.tar.gz \
            file://man-1.5k-confpath.patch;striplevel=0 \
            file://man-1.5h1-make.patch \
meta/recipes-extended/texinfo/texinfo_5.2.bb +13 -0
index 11c11aa..b9a7f8b 100644
@@ -9,6 +9,19 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 PROVIDES_append_class-native = " texinfo-replacement-native"
 
+def compress_pkg(d):
+    if "compress_doc" in (d.getVar("INHERIT", True) or "").split():
+         compress = d.getVar("DOC_COMPRESS", True)
+         if compress == "gz":
+             return "gzip"
+         elif compress == "bz2":
+             return "bzip2"
+         elif compress == "xz":
+             return "xz"
+    return ""
+
+RDEPENDS_info += "${@compress_pkg(d)}"
+
 DEPENDS = "zlib ncurses texinfo-replacement-native"
 DEPENDS_class-native = "zlib-native ncurses-native"
 
Signature · 1 line
1.9.1