[BACK]Return to generate_targets CVS log [TXT][DIR] Up to [Development] / failsafe / FailSafe-books

File: [Development] / failsafe / FailSafe-books / generate_targets (download)

Revision 1.4, Wed Nov 29 22:55:47 2000 UTC (16 years, 10 months ago) by vasa
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines

Commenting out the LANG variable being set until it's use is known
in connection with the .auto files being generated. If the variable is
being correctly set then need to modify the Makefile.

#!/usr/bin/perl

# Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like.  Any license provided herein, whether implied or
# otherwise, applies only to this software file.  Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
#
# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
# Mountain View, CA 94043, or:
#
# http://www.sgi.com 
#
# For further information regarding this notice, see: 
#
# http://oss.sgi.com/projects/GenInfo/NoticeExplan

# Script to make doc target lists (*.auto files) which are
# ref'd in the spec.  Make sure there are rpm entries for
# online and print for every lang in the spec file, or the
# targets won't get picked up.
#
# Basic process is...
# - open the Makefile and make lists of the books in various formats,
#   as well as grabbing some other basic info about the product, etc
# - loop through the book list for each format and spit out book targets
#   into appropriately named .auto files; naming conventions are...
#   - html_targets<$LANG>.auto
#   - print_targets<$LANG>.auto
#   - $LANG = "" for English

$fhs_doc_dir = "usr/share/doc";

open (MAKEFILE, "Makefile");
while (<MAKEFILE>) {

  if (s/^HTML_SUBDIRS\s*=\s*//) { $FORMAT_LIST{html} = $_; }

  if (s/^PDF_SUBDIRS\s*=\s*//) { $FORMAT_LIST{pdf} = $_; }

  if (s/^PS_SUBDIRS\s*=\s*//) { $FORMAT_LIST{ps} = $_; }

  if (s/^SGML_SUBDIRS\s*=\s*//) { $FORMAT_LIST{sgml} = $_; }

  if (s/^RPM_ROOT\s*=\s*([^\s]*)\s*$/$1/) {
    $RPM_ROOT = $1;
    $SPEC_NAME = "$RPM_ROOT.spec";
  }

  if (s/^PROD_NAME\s*=\s*([^\s]*)\s*$/$1/) { $PROD_NAME = $1; }

}
close (Makefile);

# Nuke existing .auto files before starting, since we're appending
system ("rm -f *.auto");

foreach $FORMAT (keys(%FORMAT_LIST)) {
  foreach $BOOK (split (/\s+/, $FORMAT_LIST{$FORMAT})) {

#    ($LANG = $BOOK) =~ s/.*-\d\d\d//;
    if ("$FORMAT" eq "html") { 
	$MEDIA = "html";
    } elsif ("$FORMAT" eq "sgml") {
	$MEDIA = "sgml";
    } else { 
	$MEDIA = "print"; 
    }
    $TARGFILE = "${MEDIA}_targets${LANG}.auto";
    open (TARGFILE,">>$TARGFILE");

    foreach $DIR (`find $fhs_doc_dir/$PROD_NAME/$BOOK/$FORMAT -type d -print`) {
      print TARGFILE "%attr(0755,root,root) %dir /$DIR"; }

    foreach $FILE (`find $fhs_doc_dir/$PROD_NAME/$BOOK/$FORMAT -type f -print`) {
      print TARGFILE "%attr(0644,root,root) /$FILE"; }

    close(TARGFILE);

  }
}

print "targets generated!\n";