Maintaining Databases




Next: About this document Up: FreeWAIS-sf Previous: new WWW.cf

Maintaining Databases

Here is what I use to maintain my databases. Most of the tricky stuff is handled by this Imakefile:

# Imakefile -- Imakefile to update wais databases
# Author          : Ulrich Pfeifer
# Created On      : Thu Feb 13 16:01:48 1992
# Last Modified By: Ulrich Pfeifer
# Last Modified On: Mon Aug 22 13:45:31 1994
# Update Count    : 238
# Status          : Unknown, Use with caution!

# HISTORY
# 21-Feb-1992           Ulrich Pfeifer
#    Last Modified: Tue Feb 18 11:01:45 1992 #8 (Ulrich Pfeifer)
#    Changed IRDIGEST
# 18-Feb-1992           Ulrich Pfeifer
#    Last Modified: Fri Feb 14 12:06:41 1992 #7 (Ulrich Pfeifer)
#    Added bibdb format
# 14-Feb-1992           Ulrich Pfeifer
#    Last Modified: Thu Feb 13 18:14:24 1992 #2 (Ulrich Pfeifer)
#    Added Emacs-info

#undef DEBUG
#undef CHECK_ONLY

# Commands
               LS = /bin/ls
              CMP = /bin/cmp
        WAISINDEX = /usr/local/ls6/wais/bin/waisindex -nopairs -nocat -export
             PERL = /usr/local/bin/perl
           TMPDIR = /tmp

        SERVERDIR = /usr/local/ls6/wais/wais-sources

         MAILSERV = /home/crew/mailserv
        NOSFERATU = ${MAILSERV}/Mail/NOSFERATU
             SCOG = ${MAILSERV}/Mail/SCOG


        LWAISHOME = /usr/wais
      WAISDOCSDIR = ${LWAISHOME}/wais-docs
         WAISDOCS = ${WAISDOCSDIR}/wais-docs

          PFEIFER = /home/crew/pfeifer
         SUNFLASH = $(WAISDOCSDIR)/SunFlash $(PFEIFER)/Mail-public/SunFlash
          SUGINFO = $(WAISDOCSDIR)/sug-info $(PFEIFER)/Mail-public/sug-info

      IRDIGESTSRC = ${WAISDOCSDIR}/IRLIST.abstracts
       BIBDB_HTML = ${WAISDOCSDIR}/bibdb.html
           HCIBIB = ${WAISDOCSDIR}/hcibib
             DEMO = ${WAISDOCSDIR}/demo.html
         JOURNALS = ${WAISDOCSDIR}/journals
        LIBRARIES = ${WAISDOCSDIR}/libraries.america.gz
              FAQ = /usr/local/ls6/doc/faql
          WWWHOME = /usr/WWW/pages
          FTPHOME = /local-home/ftp/pub/doc
NOSFERATU_GLOSSAY = /usr/local/ls6/src+data/src/nosferatu/glossary


#define WaisCleanTarget(database)                                       @@\
veryclean::                                                             @@\
        ${RM} Concat(database,.cat) Concat(database,.dct) \
        Concat(database,.dlm) Concat(database,.doc) \
        Concat(database,.fn) Concat(database,.hl) \
        Concat(database,.inv) Concat(database,.src) \
        Concat(database,_field_*)                                       @@\
                                                                        @@\
Concat(database,.fmt):                                                  @@\
        touch Concat(database,.fmt)
/*
 * WaisIndexProc, the working horse
 */
#ifdef CHECK_ONLY
#define WaisIndexProc(database, type, sources, options) \
        echo Database database needs reindexing ;
#else /* CHECK_ONLY */
#define WaisIndexProc(database, type, sources, options) \
        cp Concat(database,.fmt) $(TMPDIR)/Concat(database,.fmt) ; \    @@\
        $(WAISINDEX) options -t type -d $(TMPDIR)/database sources ; \  @@\
        if test -f $(TMPDIR)/Concat(database,.src) ; then \             @@\
            echo Indexing of database was successfull ; \               @@\
            $(RM) $(TMPDIR)/Concat(database,.fmt) ; \                   @@\
            mv $(TMPDIR)/database/**/* . ; \                            @@\
            if test -f manifest  ; then \                               @@\
               mv manifest  Concat(database,-MANIFEST); \               @@\
            fi ; \                                                      @@\
        else \                                                          @@\
            echo Indexing of database failed ; \                        @@\
            $(RM) $(TMPDIR)/database/**/* manifest ; \                  @@\
        fi ;
#endif /* CHECK_ONLY */

/*
 * WaisOptionTarget - the normal case
 */
#define WaisOptionTarget(database, type, sources, options)              @@\
all:: Concat(database,.doc)                                             @@\
                                                                        @@\
Concat(database,.doc): Concat(database,.fmt) sources                    @@\
        WaisIndexProc(database, type, sources, options)                 @@\
WaisCleanTarget(database)

#define WaisTarget(database, type, sources)                             @@\
WaisOptionTarget(database, type, sources,)

/*
 * WaisDir2TargetOpt index a directory, if /bin/ls signals change
 */
#define WaisDir2Target(database, type, lsargs, sources, options)        @@\
all:: database Concat(database,.doc)                                    @@\
                                                                        @@\
database Concat(database,-MANIFEST):                                    @@\
        @echo Testing sou/**/rces of database                           @@\
        @${LS} -l lsargs | grep -v MANIFEST > manifest; \
        if ${CMP} Concat(database,-MANIFEST) manifest; \
        then \
           echo "No differences encountered"; \
           ${RM} manifest; \
        else \
           WaisIndexProc(database, type, sources, options) \
        fi;                                                             @@\
                                                                        @@\
Concat(database,.doc): Concat(database,.fmt)                            @@\
        WaisIndexProc(database, type, sources, options)                 @@\
                                                                        @@\
clean::                                                                 @@\
        ${RM}  manifest                                                 @@\
                                                                        @@\
clean::                                                                 @@\
        ${RM} Concat(database,-MANIFEST)                                @@\
                                                                        @@\
WaisCleanTarget(database)

#define WaisDirTarget(database, type, sources, options) \
        WaisDir2Target(database, type, sources, sources, options)
/*
 * The databases
 */
#ifdef DEBUG
WaisDirTarget(test,fields,TEST,-r)
WaisTarget(test1,fields,TEST)
WaisOptionTarget(test2,fields,TEST, -T HTML)
WaisDir2Target(test3,fields,TEST,TEST, -T HTML)
#else /* DEBUG */
#define WSRCPAT *.src
WaisDirTarget(directory-of-servers,server,Concat(${SERVERDIR}/,WSRCPAT),)
WaisDirTarget(journals,fields,$(JOURNALS),-r)
WaisDirTarget(nosferatu-glossary,text -T HTML,${NOSFERATU_GLOSSAY},-r)
WaisDirTarget(wais-docs,text,${WAISDOCS},-r)
WaisDirTarget(www-pages,fields,`find $(WWWHOME) -type f -name "*.html"
\
-print`, -t URL $(WWWHOME) \@@http://ls6-www.informatik.uni-dortmund.de)
WaisDirTarget(ftp-pages,fields,`find $(FTPHOME) -type f -name "*.html"
\
-print`, -t URL $(FTPHOME) \@@ftp://ls6-www.informatik.uni-dortmund.de/pub/doc)
WaisDir2Target(HCIBIB,fields, $(HCIBIB), `$(PERL) -e 'for \
(<$(HCIBIB)/*\.html.gz>) { s/.gz/\n/; print }'`, -T HTML -stop HCIBIB.stop)
WaisOptionTarget(bibdb-html,fields,${BIBDB_HTML}, -T HTML)
WaisOptionTarget(demo,fields,${DEMO}, -T HTML)
WaisOptionTarget(ls6-help,formfeed,${FAQ},-T HTML)
WaisTarget(INFO,server,${SERVERDIR}/bibdb-html.src ${SERVERDIR}/journals.src)
WaisTarget(irdigest,fields,${IRDIGESTSRC})
WaisTarget(libraries,dash,$(LIBRARIES))
WaisTarget(nosferatu,mail_or_rmail,${NOSFERATU})
WaisTarget(scog,mail_or_rmail,${SCOG})
WaisTarget(suginfo,mail_or_rmail,${SUGINFO})
WaisTarget(sunflash,mail_or_rmail,${SUNFLASH})
#endif /* DEBUG */

___________________________________________________

Ulrich Pfeifer
Thu May 25 16:37:04 MET DST 1995