pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/templates mkreadme: Rename generated files to index.html



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0e163d0a3890
branches:  trunk
changeset: 449759:0e163d0a3890
user:      nia <nia%pkgsrc.org@localhost>
date:      Mon Apr 05 10:32:38 2021 +0000

description:
mkreadme: Rename generated files to index.html

This should make web servers happier, as discusesd on tech-pkg.

diffstat:

 mk/scripts/genreadme.awk  |  57 +++++++++++++++++-----------------------------
 mk/scripts/mkreadme       |  40 ++++++++++++++++----------------
 templates/README.all      |   4 +-
 templates/README.category |   6 ++--
 templates/README.pkg      |  14 +++++-----
 templates/README.top      |   8 +++---
 6 files changed, 57 insertions(+), 72 deletions(-)

diffs (truncated from 450 to 300 lines):

diff -r 48a403459d8f -r 0e163d0a3890 mk/scripts/genreadme.awk
--- a/mk/scripts/genreadme.awk  Mon Apr 05 10:30:04 2021 +0000
+++ b/mk/scripts/genreadme.awk  Mon Apr 05 10:32:38 2021 +0000
@@ -1,5 +1,5 @@
 #!/usr/bin/awk -f
-# $NetBSD: genreadme.awk,v 1.48 2021/03/08 16:37:59 nia Exp $
+# $NetBSD: genreadme.awk,v 1.49 2021/04/05 10:32:38 nia Exp $
 #
 # Copyright (c) 2002-2021 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -44,14 +44,6 @@
 #
 BEGIN {
        do_pkg_readme=1;
-# set to 1 to use "README-new.html" as the name
-       use_readme_new=0;
-       if (use_readme_new) {
-               readme_name = "README-new.html";
-       }
-       else {
-               readme_name = "README.html";
-       }
        printf("Reading database file\n");
 }
 
@@ -147,7 +139,7 @@
 /^htmlname / {
 #
 # read lines like:
-# htmlname /usr/pkgsrc/archivers/arc <a href=../../archivers/arc/README.html>arc-5.21e</A>
+# htmlname /usr/pkgsrc/archivers/arc <a href=../../archivers/arc/index.html>arc-5.21e</A>
 #
 #    dir=fulldir2pkgdir($2);
        dir = $2;
@@ -155,10 +147,7 @@
        for (i = 4; i <= NF; i++){
                htmlname = htmlname " " $i;
        }
-       # If we are using a name other than README.html, change it
-       # here.  This avoids having to process a huge line later which
-       # makes lesser awks puke.
-       gsub(/README.html/, readme_name, htmlname);
+       gsub(/README.html/, "index.html", htmlname);
        dir2htmlname[dir] = htmlname;
        if (debug) printf("added dir2htmlname[%s]=%s\n", dir, htmlname);
        next;
@@ -202,7 +191,7 @@
 }
 
 END {
-       readme = TMPDIR "/" readme_name;
+       readme = TMPDIR "/index.html";
 
        printf("Making sure binary package cache file is up to date...\n");
        if ( quiet == "yes" ){
@@ -250,7 +239,7 @@
                depends[SINGLEPKG] = "yes";
        }
 
-       printf("Generating README.html files\n");
+       printf("Generating index.html files\n");
        pkgcnt = 0;
        if (do_pkg_readme) {
                templatefile = PKGSRCDIR "/templates/README.pkg";
@@ -258,7 +247,7 @@
                for (toppkg in depends){
                        pkgcnt++;
                        pkgdir = PKGSRCDIR "/" toppkg;
-                       readmenew=pkgdir  "/" readme_name;
+                       readmenew=pkgdir  "/index.html";
 
                        if (debug) printf("Creating %s for %s\n",
                                          readme, readmenew);
@@ -380,9 +369,9 @@
        templatefile = PKGSRCDIR "/templates/README.category";
        fatal_check_file(templatefile);
 
-# string with URLs for all categories (used by the top README.html)
+# string with URLs for all categories (used by the top index.html)
        allcat = "";
-# string with URLs for all pkgs (used by the top README-all.html)
+# string with URLs for all pkgs (used by the top index-all.html)
        tot_numpkg = 0;
        top_make = PKGSRCDIR"/Makefile";
        while((getline < top_make) > 0){
@@ -390,7 +379,7 @@
                        category = $0;
                        gsub(/^[ \t]*SUBDIR.*=[ \t]*/, "", category);
                        catdir = PKGSRCDIR"/"category;
-                       readmenew = catdir"/"readme_name;
+                       readmenew = catdir"/index.html";
                        if (quiet != "yes") {
                                printf("Category = %s\n", category);
                        }
@@ -412,16 +401,15 @@
                                                 pkgdir2name[dir],
                                                 comment[dir]);
                                        }
-                                       pkgs = sprintf("%s<dt><a href=\"%s/%s\">%s</a></dt><dd>%s</dd>\n",
+                                       pkgs = sprintf("%s<dt><a href=\"%s/index.html\">%s</a></dt><dd>%s</dd>\n",
                                            pkgs,
-                                           pkg, readme_name,
+                                           pkg,
                                            pkgdir2name[dir],
                                            comment[dir]);
                                        # Prefix with the package name in a comment for sorting.
-                                       allpkg[tot_numpkg] = sprintf("<!-- %s --><dt><a href=\"%s/%s/%s\">%s</a></dt><dd>%s</dd>\n",
+                                       allpkg[tot_numpkg] = sprintf("<!-- %s --><dt><a href=\"%s/%s/index.html\">%s</a></dt><dd>%s</dd>\n",
                                                                      pkgdir2name[dir],
                                                                      category, pkg,
-                                                                     readme_name,
                                                                      pkgdir2name[dir],
                                                                      comment[dir]);
 # we need slightly fewer escapes here since we are not gsub()-ing
@@ -446,8 +434,8 @@
                        copy_readme(readmenew, readme);
 
                        gsub(/href=\"/, "href=\""category"/", pkgs);
-                       allcat = sprintf("%s<dt><a href=\"%s/%s\">%s</a></dt><dd>%s</dd>\n",
-                                        allcat, category, readme_name,
+                       allcat = sprintf("%s<dt><a href=\"%s/index.html\">%s</a></dt><dd>%s</dd>\n",
+                                        allcat, category,
                                         category, descr);
                        close(cat_make);
                }
@@ -457,13 +445,12 @@
        printf("Generating toplevel readmes:\n");
        templatefile = PKGSRCDIR "/templates/README.top";
        fatal_check_file(templatefile);
-       readmenew = PKGSRCDIR "/"readme_name;
+       readmenew = PKGSRCDIR "/index.html"
        printf("\t%s\n", readmenew);
        print "" > readme;
        while((getline < templatefile) > 0){
                gsub(/%%DESCR%%/, "");
                gsub(/%%SUBDIR%%/, allcat);
-               gsub(/README.html/, readme_name);
                print >> readme;
        }
        close(readme);
@@ -472,7 +459,7 @@
 
        templatefile = PKGSRCDIR "/templates/README.all";
        fatal_check_file(templatefile);
-       readmenew = PKGSRCDIR "/README-all.html";
+       readmenew = PKGSRCDIR "/index-all.html";
        printf("\t%s\n", readmenew);
 # sort the pkgs
        sfile = TMPDIR"/unsorted";
@@ -496,7 +483,6 @@
                } else {
                        gsub(/%%DESCR%%/, "", line);
                        gsub(/%%NPKGS%%/, tot_numpkg, line);
-                       gsub(/README.html/, readme_name, line);
                        print line >> readme;
                }
        }
@@ -522,10 +508,9 @@
                         dpkgs[i],
                         pat2dir[dpkgs[i]]);
                }
-               htmldeps = sprintf("%s<a href=\"../../%s/%s\">%s</a>\n",
+               htmldeps = sprintf("%s<a href=\"../../%s/index.html\">%s</a>\n",
                                 htmldeps,
                                 pat2dir[dpkgs[i]],
-                                readme_name,
                                 pat2dir[dpkgs[i]]);
                i = i + 1;
        }
@@ -617,8 +602,8 @@
        }
 }
 
-# 'new' is the newly created README.html file
-# 'old' is the existing (possibly not present) README.html file
+# 'new' is the newly created index.html file
+# 'old' is the existing (possibly not present) index.html file
 #
 #  This function copies over the 'new' file if the 'old' one does
 #  not exist or if they are different.  In addition, the 'new' one
@@ -626,7 +611,7 @@
 
 function copy_readme(old, new, cmd, rc) {
 
-#      if the README.html file does not exist at all then copy over
+#      if the index.html file does not exist at all then copy over
 #      the one we created
 
        cmd = "if [ ! -f "old" ]; then cp " new " " old " ; fi";
@@ -638,7 +623,7 @@
                printf("**** ------- ****\n") > "/dev/stderr";
        }
 
-#      Compare the existing README.html file to the one we created.  If they are
+#      Compare the existing index.html file to the one we created.  If they are
 #      not the same, then copy over the one we created
 
        cmd = sprintf("%s -s %s %s ; if test $? -ne 0 ; then mv -f %s %s ; fi",
diff -r 48a403459d8f -r 0e163d0a3890 mk/scripts/mkreadme
--- a/mk/scripts/mkreadme       Mon Apr 05 10:30:04 2021 +0000
+++ b/mk/scripts/mkreadme       Mon Apr 05 10:32:38 2021 +0000
@@ -1,7 +1,7 @@
 #!/bin/sh
-# $NetBSD: mkreadme,v 1.32 2021/02/19 17:49:06 nia Exp $
+# $NetBSD: mkreadme,v 1.33 2021/04/05 10:32:38 nia Exp $
 #
-# Script for README.html generation
+# Script for index.html generation
 #
 # Copyright (c) 2002, 2005 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -50,7 +50,7 @@
 BMAKE=${BMAKE:-${makeprog}}
 
 usage(){
-    echo "$prog - Generates README.html files for a pkgsrc tree"
+    echo "$prog - Generates index.html files for a pkgsrc tree"
     echo "Usage:      $prog [-c|--cdrom] [-C|--prune] [-d|--debug] [-f|--ftp] "
     echo "                  [-q|--quiet] "
     echo "                  [-p|--pkgsrc directory] "
@@ -64,14 +64,14 @@
     echo " "
     echo "The options supported by $prog are: "
     echo " "
-    echo "  -C|--prune          Prune unused README.html files which may exist in"
+    echo "  -C|--prune          Prune unused index.html files which may exist in"
     echo "                      pkg directories which have been removed from CVS."
     echo " "
-    echo "  -c|--cdrom          Generates CD-ROM README.html files"
+    echo "  -c|--cdrom          Generates CD-ROM index.html files"
     echo " "
     echo "  -d|--debug          Enables (extremely verbose) debug output"
     echo " "
-    echo "  -f|--ftp            Generates FTP README.html files"
+    echo "  -f|--ftp            Generates FTP index.html files"
     echo " "
     echo "  -h|--help           Displays this help message"
     echo " "
@@ -136,13 +136,13 @@
     case "$1"
     in
 
-    # We're generating README.html's for a CD-ROM
+    # We're generating index.html's for a CD-ROM
     -c|--cdrom)
        ftp_readme=no
        shift
        ;;
 
-    # Prune old README.html files from pkgs which no longer exist
+    # Prune old index.html files from pkgs which no longer exist
     -C|--prune)
        prune=yes
        shift
@@ -154,7 +154,7 @@
        shift
        ;;
 
-    # We're generating README.html's for a CD-ROM
+    # We're generating index.html's for a CD-ROM
     -f|--ftp)
        ftp_readme=yes
        shift
@@ -249,7 +249,7 @@
 export DATABASEFILE
 BINPKGFILE=$TMPDIR/binpkglist
 
-echo "Starting README.html generation: `date`"
+echo "Starting index.html generation: `date`"
 
 ######################################################################
 #
@@ -303,7 +303,7 @@
 
 ######################################################################
 #
-#  Decide on FTP vs CDROM README.html files
+#  Decide on FTP vs CDROM index.html files
 #
 ######################################################################
 
@@ -409,12 +409,12 @@
 
 ######################################################################
 #
-#  Generate the package and category README.html files
+#  Generate the package and category index.html files
 #
 ######################################################################
 
 echo " "
-echo "Generating package README.html files"
+echo "Generating package indexx.html files"
 echo " "
 if [ "x$DEBUG" = "xyes" ]; then
     debug=1;
@@ -449,26 +449,26 @@
        ${DATABASEFILE}
 
 if [ $? != 0 ]; then



Home | Main Index | Thread Index | Old Index