pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Introduce dynamic registration of info files in PLIST.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b613fa48f2e7
branches:  trunk
changeset: 465581:b613fa48f2e7
user:      seb <seb%pkgsrc.org@localhost>
date:      Fri Jan 02 12:28:05 2004 +0000

description:
Introduce dynamic registration of info files in PLIST.

For each file listed in INFO_FILES the installed files matching
${PREFIX}/${INFO_DIR}/filename(-[0-9]+)? are registered as belonging
to the package.

Also ignore the same files in print-PLIST target.

Info files should not be listed in PLIST files anymore but the awk code
snippet (_PLIST_AWK_INFO) in charge of actually dealing with info files for
the plist target will strip any it finds in them.

Now for the reason behind this...

Older makeinfo command (before pre-release version 4.5.90 or before release
version 4.6) had SPLIT_SIZE_THRESHOLD: when an info file size was
>= SPLIT_SIZE_THRESHOLD then the info file was split in chunks of
DEFAULT_SPLIT_SIZE size.

DEFAULT_SPLIT_SIZE in older versions of makeinfo was 50000 (bytes)
and SPLIT_SIZE_THRESHOLD was 70000.

So if an info file has a size < 70000 and is processed by makeinfo < 4.6
it is not split in chunks. But if it is processed by makeinfo >= 4.6
texinfo.mk to emulate older version automatically adds `--split-size=50000'
to makeinfo's command line and this time the info file is split in chunks...

This can lead to PLIST inconsistency from platform to platform or more
exactly from version to version of makeinfo.

Now we don't have to care about this problem and the info files removal
from PLIST files can happen.

diffstat:

 mk/bsd.pkg.mk |  41 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 1 deletions(-)

diffs (69 lines):

diff -r 5c9163695074 -r b613fa48f2e7 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Fri Jan 02 12:04:24 2004 +0000
+++ b/mk/bsd.pkg.mk     Fri Jan 02 12:28:05 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1332 2003/12/31 12:29:16 salo Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1333 2004/01/02 12:28:05 seb Exp $
 #
 # This file is in the public domain.
 #
@@ -4440,6 +4440,11 @@
 .if defined(INFO_DIR) && empty(INFO_DIR:Minfo)
 _PRINT_PLIST_AWK_IGNORE+=      || ($$0 ~ /^${INFO_DIR:S|/|\\/|g}\/dir$$/)
 .endif
+.if !empty(INFO_FILES)
+.  for _f_ in ${INFO_FILES}
+_PRINT_PLIST_AWK_IGNORE+=      || ($$0 ~ /^${INFO_DIR:S|/|\\/|g}\/${_f_}(-[0-9]+)?$$/)
+.  endfor
+.endif
 
 # Common (system) directories not to generate @dirrm statements for
 # Reads MTREE_FILE and generate awk statements that will
@@ -4871,6 +4876,36 @@
        sub("\\.0$$", sect);                                            \
 }
 
+# plist awk pattern-action statement to handle info files:
+# generate list of files matching ${PREFIX}/${INFO_DIR}/filename(-[0-9]+)?
+# for `filename' being each word of INFO_FILES in turn.
+# Notes:
+# - first the filenames matching ${PREFIX}/${INFO_DIR}/filename*
+# are generated with ls then they are filtered by the exact pattern.
+# - ${PREFIX}/${INFO_DIR}/filename is single quoted and single quote
+# escaped
+# XXX When all info file entries will be removed from PLIST files
+# the non-BEGIN pattern-action statements generated below will be retired.
+_PLIST_AWK_INFO=
+.if !empty(INFO_FILES)
+.  for _f_ in ${INFO_FILES}
+_PLIST_AWK_INFO+=                                                      \
+BEGIN {                                                                        \
+       cmd="${_f_}"; gsub("'\''", "\\'\''", cmd);                      \
+       sub("^", "${LS} '\''${PREFIX}/${INFO_DIR}/", cmd);              \
+       sub("$$", "'\''*", cmd);                                        \
+       while ((cmd | getline l) > 0) {                                 \
+               if (match(l, ".*/${_f_}(-[0-9]+)?$$")) {                \
+                       sub("^${PREFIX}/", "", l);                      \
+                       print l;                                        \
+               }                                                       \
+       }                                                               \
+       close(cmd);                                                     \
+}                                                                      \
+/^${INFO_DIR:S|/|\\/|g}\/${_f_}(-[0-9]+)?$$/ { next; }
+.  endfor
+.endif
+
 # _PLIST_AWK_SCRIPT hold the complete awk script for plist target.
 #
 _PLIST_AWK_SCRIPT=     '
@@ -4878,6 +4913,10 @@
 # See comments above about _PLIST_AWK_SUBST: it contains single quotes!
 # So _PLIST_AWK_SCRIPT is intended to be single quoted.
 _PLIST_AWK_SCRIPT+=    ${_PLIST_AWK_SUBST}
+# Generated entries for info files 
+.if !empty(INFO_FILES) 
+_PLIST_AWK_SCRIPT+=    ${_PLIST_AWK_INFO}
+.endif 
 # Strip the '.gz' suffixes on man entries
 _PLIST_AWK_SCRIPT+=    ${_PLIST_AWK_STRIP_MANZ}
 # Deal with MANINSTALL and man entries



Home | Main Index | Thread Index | Old Index