Documentation sugar.
authorjbj <devnull@localhost>
Mon, 24 Jan 2000 20:02:32 +0000 (20:02 +0000)
committerjbj <devnull@localhost>
Mon, 24 Jan 2000 20:02:32 +0000 (20:02 +0000)
CVS patchset: 3533
CVS date: 2000/01/24 20:02:32

22 files changed:
build/build.c
build/buildio.h
build/expression.c
build/files.c
build/misc.c
build/myftw.c
build/myftw.h
build/names.c
build/pack.c
build/parseBuildInstallClean.c
build/parseChangelog.c
build/parseDescription.c
build/parseFiles.c
build/parsePreamble.c
build/parsePrep.c
build/parseReqs.c
build/parseScript.c
build/parseSpec.c
build/reqprov.c
build/rpmbuild.h
build/rpmspec.h
build/spec.c

index 22ee3fa..a72006c 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/build.c
+ *  Top-level build dispatcher.
+ */
+
 #include "system.h"
 
 #include <rpmbuild.h>
@@ -36,6 +40,7 @@ static void doRmSource(Spec spec)
 /*
  * The _preScript string is expanded to export values to a script environment.
  */
+/** */
 int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
 {
     const char * rootURL = spec->rootURL;
@@ -230,6 +235,7 @@ fprintf(stderr, "*** delMacros\n");
     return rc;
 }
 
+/** */
 int buildSpec(Spec spec, int what, int test)
 {
     int x, rc;
index 536ca6d..46769b6 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef        _H_BUILDIO_
 #define        _H_BUILDIO_
 
-/* XXX this information will move elsewhere eventually */
+/** \file build/buildio.h
+ *  XXX this information will move elsewhere eventually
+ */
 
 #include "cpio.h"
 
index 58514cc..883bf66 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/expression.c
+ *  Simple logical expression parser.
+ */
+
 /*
  * Simple Expression Parser
  * Copyright (C) 1998 Tom Dyas <tdyas@eden.rutgers.edu>
@@ -300,7 +304,6 @@ static int rdToken(ParseState state)
   return 0;
 }
 
-
 static Value doLogical(ParseState state);
 
 static Value doPrimary(ParseState state)
@@ -618,6 +621,7 @@ static Value doLogical(ParseState state)
   return v1;
 }
 
+/** */
 int parseExpressionBoolean(Spec spec, char *expr)
 {
   struct _parseState state;
@@ -665,6 +669,7 @@ int parseExpressionBoolean(Spec spec, char *expr)
   return result;
 }
 
+/** */
 char * parseExpressionString(Spec spec, char *expr)
 {
   struct _parseState state;
index a876077..828c211 100644 (file)
@@ -1,3 +1,8 @@
+/** \file build/files.c
+ *  The post-build, pre-packaging file tree walk to assemble the package
+ *  manifest.
+ */
+
 #include "system.h"
 
 static int _debug = 0;
@@ -207,6 +212,7 @@ typedef struct VFA {
        int     flag;
 } VFA_t;
 
+/** */
 VFA_t verifyAttrs[] = {
        { "md5",        RPMVERIFY_MD5 },
        { "size",       RPMVERIFY_FILESIZE },
@@ -592,6 +598,7 @@ static int parseForRegexLang(const char *fileName, /*@out@*/char **lang)
     return 0;
 }
 
+/** */
 VFA_t virtualFileAttributes[] = {
        { "%dir",       0 },    /* XXX why not RPMFILE_DIR? */
        { "%doc",       RPMFILE_DOC },
@@ -1326,6 +1333,7 @@ static int processPackageFiles(Spec spec, Package pkg,
     return fl.processingFailed;
 }
 
+/** */
 void initSourceHeader(Spec spec)
 {
     HeaderIterator hi;
@@ -1384,6 +1392,7 @@ void initSourceHeader(Spec spec)
     }
 }
 
+/** */
 int processSourceFiles(Spec spec)
 {
     struct Source *srcPtr;
@@ -1657,6 +1666,7 @@ typedef struct {
     int xor;
 } DepMsg_t;
 
+/** */
 DepMsg_t depMsgs[] = {
   { "Provides",                { "%{__find_provides}", NULL, NULL, NULL },
        RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_PROVIDEFLAGS,
@@ -1860,6 +1870,7 @@ static void printDeps(Header h)
     FREE(versions);
 }
 
+/** */
 int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
 {
     Package pkg;
index f7de2e3..267ab95 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "rpmbuild.h"
 
+/** */
 int parseNum(const char *line, int *res)
 {
     char *s1;
index 0271bbf..fa590bd 100644 (file)
@@ -163,6 +163,7 @@ myftw_dir (DIR **dirs, int level, int descriptors,
 /* Call a function on every element in a directory tree.  */
 
 
+/** */
 int myftw (const char *dir,
           int descriptors,
           myftwFunc func,
index eb0f39d..f4011f6 100644 (file)
@@ -1,8 +1,10 @@
-/* myftw.h -- ftw() using lstat() instead of stat() */
-
 #ifndef _H_MYFTW_
 #define _H_MYFTW_
 
+/** \file build/myftw.h
+ * Portable ftw(3) using lstat() instead of stat().
+ */
+
 #include <sys/stat.h>
 
 /* The FLAG argument to the user function passed to ftw.  */
@@ -17,10 +19,7 @@ extern "C" {
 
 typedef int (*myftwFunc) (void *fl, const char *name, struct stat *statp);
 
-int myftw (const char *dir,
-          int descriptors,
-          myftwFunc func,
-          void *fl);
+int myftw (const char *dir, int descriptors, myftwFunc func, void *fl);
 
 #ifdef __cplusplus
 }
index 60ef5b6..6b55866 100644 (file)
@@ -1,4 +1,7 @@
-/* names.c -- user/group name/id cache (plus hostname and buildtime) */
+/** \file build/names.c
+ * Simple user/group name/id cache (plus hostname and buildtime)
+ */
+
 
 #include "system.h"
 
@@ -12,6 +15,7 @@ static gid_t gids[1024];
 /*@owned@*/ /*@null@*/ static const char *gnames[1024];
 static int gid_used = 0;
     
+/** */
 void freeNames(void)
 {
     int x;
@@ -25,6 +29,7 @@ void freeNames(void)
  * getUname() takes a uid, gets the username, and creates an entry in the
  * table to hold a string containing the user name.
  */
+/** */
 const char *getUname(uid_t uid)
 {
     struct passwd *pw;
@@ -57,6 +62,7 @@ const char *getUname(uid_t uid)
  * getUnameS() takes a username, gets the uid, and creates an entry in the
  * table to hold a string containing the user name.
  */
+/** */
 const char *getUnameS(const char *uname)
 {
     struct passwd *pw;
@@ -90,6 +96,7 @@ const char *getUnameS(const char *uname)
  * getGname() takes a gid, gets the group name, and creates an entry in the
  * table to hold a string containing the group name.
  */
+/** */
 const char *getGname(gid_t gid)
 {
     struct group *gr;
@@ -122,6 +129,7 @@ const char *getGname(gid_t gid)
  * getGnameS() takes a group name, gets the gid, and creates an entry in the
  * table to hold a string containing the group name.
  */
+/** */
 const char *getGnameS(const char *gname)
 {
     struct group *gr;
@@ -151,6 +159,7 @@ const char *getGnameS(const char *gname)
     return gnames[x];
 }
 
+/** */
 time_t *const getBuildTime(void)
 {
     static time_t buildTime = 0;
@@ -162,6 +171,7 @@ time_t *const getBuildTime(void)
     return &buildTime;
 }
 
+/** */
 const char *const buildHost(void)
 {
     static char hostname[1024];
index 8f06c9f..420129f 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/pack.c
+ *  Assemble components of an RPM package.
+ */
+
 #include "system.h"
 
 #include "rpmbuild.h"
@@ -9,14 +13,6 @@
 
 #define RPM_MAJOR_NUMBER 3
 
-static int processScriptFiles(Spec spec, Package pkg);
-static StringBuf addFileToTagAux(Spec spec, const char *file, StringBuf sb);
-static int addFileToTag(Spec spec, char *file, Header h, int tag);
-static int addFileToArrayTag(Spec spec, char *file, Header h, int tag);
-
-static int cpio_doio(FD_t fdo, CSA_t *csa, const char * fmode);
-static int cpio_copy(FD_t fdo, CSA_t *csa);
-
 extern int _noDirTokens;
 
 static inline int genSourceRpmName(Spec spec)
@@ -34,213 +30,257 @@ static inline int genSourceRpmName(Spec spec)
     return 0;
 }
 
-int packageSources(Spec spec)
+static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmodeMacro)
 {
-    CSA_t csabuf, *csa = &csabuf;
+    FD_t cfd;
     int rc;
+    const char *failedFile = NULL;
+    const char *fmode = rpmExpand(fmodeMacro, NULL);
 
-    /* Add some cruft */
-    headerAddEntry(spec->sourceHeader, RPMTAG_RPMVERSION,
-                  RPM_STRING_TYPE, VERSION, 1);
-    headerAddEntry(spec->sourceHeader, RPMTAG_BUILDHOST,
-                  RPM_STRING_TYPE, buildHost(), 1);
-    headerAddEntry(spec->sourceHeader, RPMTAG_BUILDTIME,
-                  RPM_INT32_TYPE, getBuildTime(), 1);
-
-    {  int capability = 0;
-       headerAddEntry(spec->sourceHeader, RPMTAG_CAPABILITY, RPM_INT32_TYPE,
-                       &capability, 1);
+    if (!(fmode && fmode[0] == 'w'))
+       fmode = xstrdup("w9.gzdio");
+    (void) Fflush(fdo);
+    cfd = Fdopen(fdDup(Fileno(fdo)), fmode);
+    rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
+                         &csa->cpioArchiveSize, &failedFile);
+    if (rc) {
+       rpmError(RPMERR_CPIO, _("create archive failed on file %s: %s"),
+               failedFile, cpioStrerror(rc));
+      rc = 1;
     }
 
-    genSourceRpmName(spec);
-
-    FREE(spec->cookie);
-    
-    /* XXX this should be %_srpmdir */
-    {  const char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL);
-
-       memset(csa, 0, sizeof(*csa));
-       csa->cpioArchiveSize = 0;
-       csa->cpioFdIn = fdNew("init (packageSources)");
-       csa->cpioList = spec->sourceCpioList;
-       csa->cpioCount = spec->sourceCpioCount;
+    Fclose(cfd);
+    if (failedFile)
+       xfree(failedFile);
+    xfree(fmode);
 
-       rc = writeRPM(spec->sourceHeader, fn, RPMLEAD_SOURCE,
-               csa, spec->passPhrase, &(spec->cookie));
-       csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageSources)");
-       xfree(fn);
-    }
     return rc;
 }
 
-static int_32 copyTags[] = {
-    RPMTAG_CHANGELOGTIME,
-    RPMTAG_CHANGELOGNAME,
-    RPMTAG_CHANGELOGTEXT,
-    0
-};
-
-int packageBinaries(Spec spec)
+static int cpio_copy(FD_t fdo, CSA_t *csa)
 {
-    CSA_t csabuf, *csa = &csabuf;
-    int rc;
-    const char *errorString;
-    char *name;
-    Package pkg;
-
-    for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
-       const char *fn;
-
-       if (pkg->fileList == NULL)
-           continue;
+    char buf[BUFSIZ];
+    size_t nb;
 
-       if ((rc = processScriptFiles(spec, pkg)))
-           return rc;
-       
-       if (spec->cookie) {
-           headerAddEntry(pkg->header, RPMTAG_COOKIE,
-                          RPM_STRING_TYPE, spec->cookie, 1);
+    while((nb = Fread(buf, sizeof(buf[0]), sizeof(buf), csa->cpioFdIn)) > 0) {
+       if (Fwrite(buf, sizeof(buf[0]), nb, fdo) != nb) {
+           rpmError(RPMERR_CPIO, _("cpio_copy write failed: %s"),
+                       Fstrerror(fdo));
+           return 1;
        }
-
-       /* Copy changelog from src rpm */
-       headerCopyTags(spec->packages->header, pkg->header, copyTags);
-       
-       headerAddEntry(pkg->header, RPMTAG_RPMVERSION,
-                      RPM_STRING_TYPE, VERSION, 1);
-       headerAddEntry(pkg->header, RPMTAG_BUILDHOST,
-                      RPM_STRING_TYPE, buildHost(), 1);
-       headerAddEntry(pkg->header, RPMTAG_BUILDTIME,
-                      RPM_INT32_TYPE, getBuildTime(), 1);
-
-    {  int capability = 0;
-       headerAddEntry(pkg->header, RPMTAG_CAPABILITY, RPM_INT32_TYPE,
-                       &capability, 1);
+       csa->cpioArchiveSize += nb;
     }
-
-       genSourceRpmName(spec);
-       headerAddEntry(pkg->header, RPMTAG_SOURCERPM, RPM_STRING_TYPE,
-                      spec->sourceRpmName, 1);
-       
-       {   const char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
-           char *binRpm, *binDir;
-           binRpm = headerSprintf(pkg->header, binFormat, rpmTagTable,
-                              rpmHeaderFormats, &errorString);
-           xfree(binFormat);
-           if (binRpm == NULL) {
-               headerGetEntry(pkg->header, RPMTAG_NAME, NULL,
-                          (void **)&name, NULL);
-               rpmError(RPMERR_BADFILENAME, _("Could not generate output "
-                    "filename for package %s: %s\n"), name, errorString);
-               return RPMERR_BADFILENAME;
-           }
-           fn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
-           if ((binDir = strchr(binRpm, '/')) != NULL) {
-               struct stat st;
-               const char *dn;
-               *binDir = '\0';
-               dn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
-               if (Stat(dn, &st) < 0) {
-                   switch(errno) {
-                   case  ENOENT:
-                       if (Mkdir(dn, 0755) == 0)
-                           break;
-                       /*@fallthrough@*/
-                   default:
-                       rpmError(RPMERR_BADFILENAME,_("cannot create %s: %s\n"),
-                           dn, strerror(errno));
-                       break;
-                   }
-               }
-               xfree(dn);
-           }
-           xfree(binRpm);
-       }
-
-       memset(csa, 0, sizeof(*csa));
-       csa->cpioArchiveSize = 0;
-       csa->cpioFdIn = fdNew("init (packageBinaries)");
-       csa->cpioList = pkg->cpioList;
-       csa->cpioCount = pkg->cpioCount;
-
-       rc = writeRPM(pkg->header, fn, RPMLEAD_BINARY,
-                   csa, spec->passPhrase, NULL);
-       csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageBinaries)");
-       xfree(fn);
-       if (rc)
-           return rc;
+    if (Ferror(csa->cpioFdIn)) {
+       rpmError(RPMERR_CPIO, _("cpio_copy read failed: %s"),
+               Fstrerror(csa->cpioFdIn));
+       return 1;
     }
-    
     return 0;
 }
 
-int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sigs,
-           CSA_t *csa)
+static StringBuf addFileToTagAux(Spec spec, const char *file, StringBuf sb)
 {
-    FD_t fdi;
-    Spec spec;
-    int rc;
+    char buf[BUFSIZ];
+    const char *fn = buf;
+    FD_t fd;
 
-    if (fileName != NULL) {
-       fdi = Fopen(fileName, "r.ufdio");
-       if (fdi == NULL || Ferror(fdi)) {
-           rpmError(RPMERR_BADMAGIC, _("readRPM: open %s: %s\n"), fileName,
-               Fstrerror(fdi));
-           return RPMERR_BADMAGIC;
-       }
-    } else {
-       fdi = fdDup(STDIN_FILENO);
-    }
+    /* XXX use rpmGenPath(rootdir, "%{_buildir}/%{_buildsubdir}/", file) */
+    fn = rpmGetPath("%{_builddir}/", spec->buildSubdir, "/", file, NULL);
 
-    /* Get copy of lead */
-    if ((rc = Fread(lead, sizeof(char), sizeof(*lead), fdi)) != sizeof(*lead)) {
-       rpmError(RPMERR_BADMAGIC, _("readRPM: read %s: %s\n"), fileName,
-           Fstrerror(fdi));
-       return RPMERR_BADMAGIC;
+    fd = Fopen(fn, "r.ufdio");
+    if (fn != buf) xfree(fn);
+    if (fd == NULL || Ferror(fd)) {
+       freeStringBuf(sb);
+       return NULL;
+    }
+    while (fgets(buf, sizeof(buf), (FILE *)fdGetFp(fd))) {
+       /* XXX display fn in error msg */
+       if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
+           rpmError(RPMERR_BADSPEC, _("line: %s"), buf);
+           return NULL;
+       }
+       appendStringBuf(sb, buf);
     }
+    Fclose(fd);
 
-    (void)Fseek(fdi, 0, SEEK_SET);     /* XXX FIXME: EPIPE */
+    return sb;
+}
 
-    /* Reallocate build data structures */
-    spec = newSpec();
-    spec->packages = newPackage(spec);
+static int addFileToTag(Spec spec, char *file, Header h, int tag)
+{
+    StringBuf sb;
+    char *s;
 
-    /* XXX the header just allocated will be allocated again */
-    if (spec->packages->header != NULL) {
-       headerFree(spec->packages->header);
-       spec->packages->header = NULL;
+    sb = newStringBuf();
+    if (headerGetEntry(h, tag, NULL, (void **)&s, NULL)) {
+       appendLineStringBuf(sb, s);
+       headerRemoveEntry(h, tag);
     }
 
-   /* Read the rpm lead and header */
-    rc = rpmReadPackageInfo(fdi, sigs, &spec->packages->header);
-    switch (rc) {
-    case 1:
-       rpmError(RPMERR_BADMAGIC, _("readRPM: %s is not an RPM package\n"),
-           fileName);
-       return RPMERR_BADMAGIC;
-    case 0:
-       break;
-    default:
-       rpmError(RPMERR_BADMAGIC, _("readRPM: reading header from %s\n"), fileName);
-       return RPMERR_BADMAGIC;
-       /*@notreached@*/ break;
+    if ((sb = addFileToTagAux(spec, file, sb)) == NULL) {
+       return 1;
     }
+    
+    headerAddEntry(h, tag, RPM_STRING_TYPE, getStringBuf(sb), 1);
 
-    if (specp)
-       *specp = spec;
+    freeStringBuf(sb);
+    return 0;
+}
 
-    if (csa) {
-       csa->cpioFdIn = fdi;
-    } else {
-       Fclose(fdi);
+static int addFileToArrayTag(Spec spec, char *file, Header h, int tag)
+{
+    StringBuf sb;
+    char *s;
+
+    sb = newStringBuf();
+    if ((sb = addFileToTagAux(spec, file, sb)) == NULL) {
+       return 1;
     }
 
+    s = getStringBuf(sb);
+    headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, &s, 1);
+
+    freeStringBuf(sb);
     return 0;
 }
 
-int writeRPM(Header h, const char *fileName, int type,
-                   CSA_t *csa, char *passPhrase, char **cookie)
+static int processScriptFiles(Spec spec, Package pkg)
 {
-    FD_t fd, ifd;
+    struct TriggerFileEntry *p;
+    
+    if (pkg->preInFile) {
+       if (addFileToTag(spec, pkg->preInFile, pkg->header, RPMTAG_PREIN)) {
+           rpmError(RPMERR_BADFILENAME,
+                    _("Could not open PreIn file: %s"), pkg->preInFile);
+           return RPMERR_BADFILENAME;
+       }
+    }
+    if (pkg->preUnFile) {
+       if (addFileToTag(spec, pkg->preUnFile, pkg->header, RPMTAG_PREUN)) {
+           rpmError(RPMERR_BADFILENAME,
+                    _("Could not open PreUn file: %s"), pkg->preUnFile);
+           return RPMERR_BADFILENAME;
+       }
+    }
+    if (pkg->postInFile) {
+       if (addFileToTag(spec, pkg->postInFile, pkg->header, RPMTAG_POSTIN)) {
+           rpmError(RPMERR_BADFILENAME,
+                    _("Could not open PostIn file: %s"), pkg->postInFile);
+           return RPMERR_BADFILENAME;
+       }
+    }
+    if (pkg->postUnFile) {
+       if (addFileToTag(spec, pkg->postUnFile, pkg->header, RPMTAG_POSTUN)) {
+           rpmError(RPMERR_BADFILENAME,
+                    _("Could not open PostUn file: %s"), pkg->postUnFile);
+           return RPMERR_BADFILENAME;
+       }
+    }
+    if (pkg->verifyFile) {
+       if (addFileToTag(spec, pkg->verifyFile, pkg->header,
+                        RPMTAG_VERIFYSCRIPT)) {
+           rpmError(RPMERR_BADFILENAME,
+                    _("Could not open VerifyScript file: %s"), pkg->verifyFile);
+           return RPMERR_BADFILENAME;
+       }
+    }
+
+    for (p = pkg->triggerFiles; p != NULL; p = p->next) {
+       headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTPROG,
+                              RPM_STRING_ARRAY_TYPE, &(p->prog), 1);
+       if (p->script) {
+           headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
+                                  RPM_STRING_ARRAY_TYPE, &(p->script), 1);
+       } else if (p->fileName) {
+           if (addFileToArrayTag(spec, p->fileName, pkg->header,
+                                 RPMTAG_TRIGGERSCRIPTS)) {
+               rpmError(RPMERR_BADFILENAME,
+                        _("Could not open Trigger script file: %s"),
+                        p->fileName);
+               return RPMERR_BADFILENAME;
+           }
+       } else {
+           /* This is dumb.  When the header supports NULL string */
+           /* this will go away.                                  */
+           char *bull = "";
+           headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
+                                  RPM_STRING_ARRAY_TYPE, &bull, 1);
+       }
+    }
+
+    return 0;
+}
+
+/** */
+int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sigs,
+           CSA_t *csa)
+{
+    FD_t fdi;
+    Spec spec;
+    int rc;
+
+    if (fileName != NULL) {
+       fdi = Fopen(fileName, "r.ufdio");
+       if (fdi == NULL || Ferror(fdi)) {
+           rpmError(RPMERR_BADMAGIC, _("readRPM: open %s: %s\n"), fileName,
+               Fstrerror(fdi));
+           return RPMERR_BADMAGIC;
+       }
+    } else {
+       fdi = fdDup(STDIN_FILENO);
+    }
+
+    /* Get copy of lead */
+    if ((rc = Fread(lead, sizeof(char), sizeof(*lead), fdi)) != sizeof(*lead)) {
+       rpmError(RPMERR_BADMAGIC, _("readRPM: read %s: %s\n"), fileName,
+           Fstrerror(fdi));
+       return RPMERR_BADMAGIC;
+    }
+
+    (void)Fseek(fdi, 0, SEEK_SET);     /* XXX FIXME: EPIPE */
+
+    /* Reallocate build data structures */
+    spec = newSpec();
+    spec->packages = newPackage(spec);
+
+    /* XXX the header just allocated will be allocated again */
+    if (spec->packages->header != NULL) {
+       headerFree(spec->packages->header);
+       spec->packages->header = NULL;
+    }
+
+   /* Read the rpm lead and header */
+    rc = rpmReadPackageInfo(fdi, sigs, &spec->packages->header);
+    switch (rc) {
+    case 1:
+       rpmError(RPMERR_BADMAGIC, _("readRPM: %s is not an RPM package\n"),
+           fileName);
+       return RPMERR_BADMAGIC;
+    case 0:
+       break;
+    default:
+       rpmError(RPMERR_BADMAGIC, _("readRPM: reading header from %s\n"), fileName);
+       return RPMERR_BADMAGIC;
+       /*@notreached@*/ break;
+    }
+
+    if (specp)
+       *specp = spec;
+
+    if (csa) {
+       csa->cpioFdIn = fdi;
+    } else {
+       Fclose(fdi);
+    }
+
+    return 0;
+}
+
+/** */
+int writeRPM(Header h, const char *fileName, int type,
+                   CSA_t *csa, char *passPhrase, char **cookie)
+{
+    FD_t fd, ifd;
     int rc, count, sigtype;
     int archnum, osnum;
     const char *sigtarget;
@@ -416,183 +456,143 @@ int writeRPM(Header h, const char *fileName, int type,
     return 0;
 }
 
-static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmodeMacro)
+static int_32 copyTags[] = {
+    RPMTAG_CHANGELOGTIME,
+    RPMTAG_CHANGELOGNAME,
+    RPMTAG_CHANGELOGTEXT,
+    0
+};
+
+/** */
+int packageBinaries(Spec spec)
 {
-    FD_t cfd;
+    CSA_t csabuf, *csa = &csabuf;
     int rc;
-    const char *failedFile = NULL;
-    const char *fmode = rpmExpand(fmodeMacro, NULL);
-
-    if (!(fmode && fmode[0] == 'w'))
-       fmode = xstrdup("w9.gzdio");
-    (void) Fflush(fdo);
-    cfd = Fdopen(fdDup(Fileno(fdo)), fmode);
-    rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
-                         &csa->cpioArchiveSize, &failedFile);
-    if (rc) {
-       rpmError(RPMERR_CPIO, _("create archive failed on file %s: %s"),
-               failedFile, cpioStrerror(rc));
-      rc = 1;
-    }
-
-    Fclose(cfd);
-    if (failedFile)
-       xfree(failedFile);
-    xfree(fmode);
+    const char *errorString;
+    char *name;
+    Package pkg;
 
-    return rc;
-}
+    for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
+       const char *fn;
 
-static int cpio_copy(FD_t fdo, CSA_t *csa)
-{
-    char buf[BUFSIZ];
-    size_t nb;
+       if (pkg->fileList == NULL)
+           continue;
 
-    while((nb = Fread(buf, sizeof(buf[0]), sizeof(buf), csa->cpioFdIn)) > 0) {
-       if (Fwrite(buf, sizeof(buf[0]), nb, fdo) != nb) {
-           rpmError(RPMERR_CPIO, _("cpio_copy write failed: %s"),
-                       Fstrerror(fdo));
-           return 1;
+       if ((rc = processScriptFiles(spec, pkg)))
+           return rc;
+       
+       if (spec->cookie) {
+           headerAddEntry(pkg->header, RPMTAG_COOKIE,
+                          RPM_STRING_TYPE, spec->cookie, 1);
        }
-       csa->cpioArchiveSize += nb;
-    }
-    if (Ferror(csa->cpioFdIn)) {
-       rpmError(RPMERR_CPIO, _("cpio_copy read failed: %s"),
-               Fstrerror(csa->cpioFdIn));
-       return 1;
-    }
-    return 0;
-}
 
-static StringBuf addFileToTagAux(Spec spec, const char *file, StringBuf sb)
-{
-    char buf[BUFSIZ];
-    const char *fn = buf;
-    FD_t fd;
-
-    /* XXX use rpmGenPath(rootdir, "%{_buildir}/%{_buildsubdir}/", file) */
-    fn = rpmGetPath("%{_builddir}/", spec->buildSubdir, "/", file, NULL);
+       /* Copy changelog from src rpm */
+       headerCopyTags(spec->packages->header, pkg->header, copyTags);
+       
+       headerAddEntry(pkg->header, RPMTAG_RPMVERSION,
+                      RPM_STRING_TYPE, VERSION, 1);
+       headerAddEntry(pkg->header, RPMTAG_BUILDHOST,
+                      RPM_STRING_TYPE, buildHost(), 1);
+       headerAddEntry(pkg->header, RPMTAG_BUILDTIME,
+                      RPM_INT32_TYPE, getBuildTime(), 1);
 
-    fd = Fopen(fn, "r.ufdio");
-    if (fn != buf) xfree(fn);
-    if (fd == NULL || Ferror(fd)) {
-       freeStringBuf(sb);
-       return NULL;
-    }
-    while (fgets(buf, sizeof(buf), (FILE *)fdGetFp(fd))) {
-       /* XXX display fn in error msg */
-       if (expandMacros(spec, spec->macros, buf, sizeof(buf))) {
-           rpmError(RPMERR_BADSPEC, _("line: %s"), buf);
-           return NULL;
-       }
-       appendStringBuf(sb, buf);
+    {  int capability = 0;
+       headerAddEntry(pkg->header, RPMTAG_CAPABILITY, RPM_INT32_TYPE,
+                       &capability, 1);
     }
-    Fclose(fd);
 
-    return sb;
-}
-
-static int addFileToTag(Spec spec, char *file, Header h, int tag)
-{
-    StringBuf sb;
-    char *s;
+       genSourceRpmName(spec);
+       headerAddEntry(pkg->header, RPMTAG_SOURCERPM, RPM_STRING_TYPE,
+                      spec->sourceRpmName, 1);
+       
+       {   const char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
+           char *binRpm, *binDir;
+           binRpm = headerSprintf(pkg->header, binFormat, rpmTagTable,
+                              rpmHeaderFormats, &errorString);
+           xfree(binFormat);
+           if (binRpm == NULL) {
+               headerGetEntry(pkg->header, RPMTAG_NAME, NULL,
+                          (void **)&name, NULL);
+               rpmError(RPMERR_BADFILENAME, _("Could not generate output "
+                    "filename for package %s: %s\n"), name, errorString);
+               return RPMERR_BADFILENAME;
+           }
+           fn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
+           if ((binDir = strchr(binRpm, '/')) != NULL) {
+               struct stat st;
+               const char *dn;
+               *binDir = '\0';
+               dn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
+               if (Stat(dn, &st) < 0) {
+                   switch(errno) {
+                   case  ENOENT:
+                       if (Mkdir(dn, 0755) == 0)
+                           break;
+                       /*@fallthrough@*/
+                   default:
+                       rpmError(RPMERR_BADFILENAME,_("cannot create %s: %s\n"),
+                           dn, strerror(errno));
+                       break;
+                   }
+               }
+               xfree(dn);
+           }
+           xfree(binRpm);
+       }
 
-    sb = newStringBuf();
-    if (headerGetEntry(h, tag, NULL, (void **)&s, NULL)) {
-       appendLineStringBuf(sb, s);
-       headerRemoveEntry(h, tag);
-    }
+       memset(csa, 0, sizeof(*csa));
+       csa->cpioArchiveSize = 0;
+       csa->cpioFdIn = fdNew("init (packageBinaries)");
+       csa->cpioList = pkg->cpioList;
+       csa->cpioCount = pkg->cpioCount;
 
-    if ((sb = addFileToTagAux(spec, file, sb)) == NULL) {
-       return 1;
+       rc = writeRPM(pkg->header, fn, RPMLEAD_BINARY,
+                   csa, spec->passPhrase, NULL);
+       csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageBinaries)");
+       xfree(fn);
+       if (rc)
+           return rc;
     }
     
-    headerAddEntry(h, tag, RPM_STRING_TYPE, getStringBuf(sb), 1);
-
-    freeStringBuf(sb);
     return 0;
 }
 
-static int addFileToArrayTag(Spec spec, char *file, Header h, int tag)
+/** */
+int packageSources(Spec spec)
 {
-    StringBuf sb;
-    char *s;
+    CSA_t csabuf, *csa = &csabuf;
+    int rc;
 
-    sb = newStringBuf();
-    if ((sb = addFileToTagAux(spec, file, sb)) == NULL) {
-       return 1;
-    }
+    /* Add some cruft */
+    headerAddEntry(spec->sourceHeader, RPMTAG_RPMVERSION,
+                  RPM_STRING_TYPE, VERSION, 1);
+    headerAddEntry(spec->sourceHeader, RPMTAG_BUILDHOST,
+                  RPM_STRING_TYPE, buildHost(), 1);
+    headerAddEntry(spec->sourceHeader, RPMTAG_BUILDTIME,
+                  RPM_INT32_TYPE, getBuildTime(), 1);
 
-    s = getStringBuf(sb);
-    headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, &s, 1);
+    {  int capability = 0;
+       headerAddEntry(spec->sourceHeader, RPMTAG_CAPABILITY, RPM_INT32_TYPE,
+                       &capability, 1);
+    }
 
-    freeStringBuf(sb);
-    return 0;
-}
+    genSourceRpmName(spec);
 
-static int processScriptFiles(Spec spec, Package pkg)
-{
-    struct TriggerFileEntry *p;
+    FREE(spec->cookie);
     
-    if (pkg->preInFile) {
-       if (addFileToTag(spec, pkg->preInFile, pkg->header, RPMTAG_PREIN)) {
-           rpmError(RPMERR_BADFILENAME,
-                    _("Could not open PreIn file: %s"), pkg->preInFile);
-           return RPMERR_BADFILENAME;
-       }
-    }
-    if (pkg->preUnFile) {
-       if (addFileToTag(spec, pkg->preUnFile, pkg->header, RPMTAG_PREUN)) {
-           rpmError(RPMERR_BADFILENAME,
-                    _("Could not open PreUn file: %s"), pkg->preUnFile);
-           return RPMERR_BADFILENAME;
-       }
-    }
-    if (pkg->postInFile) {
-       if (addFileToTag(spec, pkg->postInFile, pkg->header, RPMTAG_POSTIN)) {
-           rpmError(RPMERR_BADFILENAME,
-                    _("Could not open PostIn file: %s"), pkg->postInFile);
-           return RPMERR_BADFILENAME;
-       }
-    }
-    if (pkg->postUnFile) {
-       if (addFileToTag(spec, pkg->postUnFile, pkg->header, RPMTAG_POSTUN)) {
-           rpmError(RPMERR_BADFILENAME,
-                    _("Could not open PostUn file: %s"), pkg->postUnFile);
-           return RPMERR_BADFILENAME;
-       }
-    }
-    if (pkg->verifyFile) {
-       if (addFileToTag(spec, pkg->verifyFile, pkg->header,
-                        RPMTAG_VERIFYSCRIPT)) {
-           rpmError(RPMERR_BADFILENAME,
-                    _("Could not open VerifyScript file: %s"), pkg->verifyFile);
-           return RPMERR_BADFILENAME;
-       }
-    }
+    /* XXX this should be %_srpmdir */
+    {  const char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL);
 
-    for (p = pkg->triggerFiles; p != NULL; p = p->next) {
-       headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTPROG,
-                              RPM_STRING_ARRAY_TYPE, &(p->prog), 1);
-       if (p->script) {
-           headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
-                                  RPM_STRING_ARRAY_TYPE, &(p->script), 1);
-       } else if (p->fileName) {
-           if (addFileToArrayTag(spec, p->fileName, pkg->header,
-                                 RPMTAG_TRIGGERSCRIPTS)) {
-               rpmError(RPMERR_BADFILENAME,
-                        _("Could not open Trigger script file: %s"),
-                        p->fileName);
-               return RPMERR_BADFILENAME;
-           }
-       } else {
-           /* This is dumb.  When the header supports NULL string */
-           /* this will go away.                                  */
-           char *bull = "";
-           headerAddOrAppendEntry(pkg->header, RPMTAG_TRIGGERSCRIPTS,
-                                  RPM_STRING_ARRAY_TYPE, &bull, 1);
-       }
-    }
+       memset(csa, 0, sizeof(*csa));
+       csa->cpioArchiveSize = 0;
+       csa->cpioFdIn = fdNew("init (packageSources)");
+       csa->cpioList = spec->sourceCpioList;
+       csa->cpioCount = spec->sourceCpioCount;
 
-    return 0;
+       rc = writeRPM(spec->sourceHeader, fn, RPMLEAD_SOURCE,
+               csa, spec->passPhrase, &(spec->cookie));
+       csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageSources)");
+       xfree(fn);
+    }
+    return rc;
 }
index 2b181be..0f2259b 100644 (file)
@@ -1,7 +1,11 @@
+/** \file build/parseBuildInstallClean.c
+ *  Parse %build/%install/%clean section from spec file.
+ */
 #include "system.h"
 
 #include "rpmbuild.h"
 
+/** */
 int parseBuildInstallClean(Spec spec, int parsePart)
 {
     int nextPart, rc;
index 43ed49e..086d591 100644 (file)
@@ -1,7 +1,12 @@
+/** \file build/parseChangelog.c
+ *  Parse %changelog section from spec file.
+ */
+
 #include "system.h"
 
 #include "rpmbuild.h"
 
+/** */
 void addChangelogEntry(Header h, time_t time, const char *name, const char *text)
 {
     int_32 mytime = time;      /* XXX convert to header representation */
@@ -178,6 +183,7 @@ static int addChangelog(Header h, StringBuf sb)
     return 0;
 }
 
+/** */
 int parseChangelog(Spec spec)
 {
     int nextPart, res, rc;
index c336ab3..d380491 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/parseDescription.c
+ *  Parse %description section from spec file.
+ */
+
 #include "system.h"
 
 #include "rpmbuild.h"
@@ -14,6 +18,7 @@ extern int noLang;            /* XXX FIXME: pass as arg */
        { 0, 0, 0, 0, 0,        NULL, NULL}
     };
 
+/** */
 int parseDescription(Spec spec)
 {
     int nextPart;
index 87b1892..3497df9 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/parseFiles.c
+ *  Parse %files section from spec file.
+ */
+
 #include "system.h"
 
 #include "rpmbuild.h"
@@ -11,6 +15,7 @@
        { 0, 0, 0, 0, 0,        NULL, NULL}
     };
 
+/** */
 int parseFiles(Spec spec)
 {
     int nextPart;
index 33001d9..98bd790 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/parsePreamble.c
+ *  Parse tags in global section from spec file.
+ */
+
 #include "system.h"
 
 static int _debug = 0;
@@ -285,6 +289,7 @@ exit:
     return rc;
 }
 
+/** */
 struct spectag *
 stashSt(Spec spec, Header h, int tag, const char *lang)
 {
@@ -669,6 +674,7 @@ static int findPreambleTag(Spec spec, /*@out@*/int *tag, /*@out@*/char **macro,
     return 0;
 }
 
+/** */
 int parsePreamble(Spec spec, int initialPackage)
 {
     int nextPart;
index 1c044d0..bd2fbd6 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/parsePrep.c
+ *  Parse %prep section from spec file.
+ */
+
 #include "system.h"
 
 #include <rpmbuild.h>
@@ -442,6 +446,7 @@ static int doPatchMacro(Spec spec, char *line)
     return 0;
 }
 
+/** */
 int parsePrep(Spec spec)
 {
     int nextPart, res, rc;
index 36522ba..c1f6e25 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/parseReqs.c
+ *  Parse dependency tag from spec file or from auto-dependency generator.
+ */
+
 #include "system.h"
 
 #include "rpmbuild.h"
@@ -23,6 +27,7 @@ static struct ReqComp {
 #define        SKIPWHITE(_x)   {while(*(_x) && (isspace(*_x) || *(_x) == ',')) (_x)++;}
 #define        SKIPNONWHITE(_x){while(*(_x) &&!(isspace(*_x) || *(_x) == ',')) (_x)++;}
 
+/** */
 int parseRCPOT(Spec spec, Package pkg, const char *field, int tag, int index)
 {
     const char *r, *re, *v, *ve;
index 111aa4b..c6883c6 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/parseScript.c
+ *  Parse install-time script section from spec file.
+ */
+
 #include "system.h"
 
 #include "rpmbuild.h"
@@ -51,6 +55,7 @@ static int addTriggerIndex(Package pkg, const char *file, const char *script, co
 /* We then pass the remaining arguments to parseRCPOT, along with   */
 /* an index we just determined.                                     */
 
+/** */
 int parseScript(Spec spec, int parsePart)
 {
     /* There are a few options to scripts: */
index 2697e00..49abde9 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/parseSpec.c
+ *  Top level dispatcher for spec file parsing.
+ */
+
 #include "system.h"
 
 static int _debug = 0;
@@ -36,6 +40,7 @@ static inline void initParts(struct PartRec *p)
        p->len = strlen(p->token);
 }
 
+/** */
 int isPart(char *line)
 {
     char c;
@@ -86,6 +91,7 @@ static int matchTok(const char *token, const char *line)
     return rc;
 }
 
+/** */
 void handleComments(char *s)
 {
     SKIPSPACE(s);
@@ -160,6 +166,7 @@ static int copyNextLine(Spec spec, OFI_t *ofi, int strip)
 /*         1 - EOF     */
 /*        <0 - error   */
 
+/** */
 int readLine(Spec spec, int strip)
 {
     const char *arch;
@@ -317,6 +324,7 @@ retry:
     return 0;
 }
 
+/** */
 void closeSpec(Spec spec)
 {
     OFI_t *ofi;
@@ -332,6 +340,7 @@ void closeSpec(Spec spec)
 
 int noLang = 0;                /* XXX FIXME: pass as arg */
 
+/** */
 int parseSpec(Spec *specp, const char *specFile, const char *rootURL,
                const char *buildRootURL, int inBuildArch, const char *passPhrase,
                char *cookie, int anyarch, int force)
index fd655f5..989a2f3 100644 (file)
@@ -1,9 +1,12 @@
-/* reqprov.c -- require/provide handling */
+/** \file build/reqprov.c
+ *  Add dependency tags to package header(s).
+ */
 
 #include "system.h"
 
 #include "rpmbuild.h"
 
+/** */
 int addReqProv(/*@unused@*/ Spec spec, Header h,
               int flag, const char *name, const char *version, int index)
 {
index 8d574d2..b81e92d 100644 (file)
@@ -1,7 +1,10 @@
 #ifndef        _H_RPMBUILD_
 #define        _H_RPMBUILD_
 
-/* This is the *only* module users of librpmbuild should need to include */
+/** \file build/rpmbuild.h
+ *  This is the *only* module users of librpmbuild should need to include.
+ */
+
 #include "rpmlib.h"
 
 /* and it shouldn't need these :-( */
index bc8b7e0..2c82f34 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef _H_SPEC_
 #define _H_SPEC_
 
+/** \file build/rpmspec.h
+ *  The Spec and Package data structures used during build.
+ */
+
 typedef struct SpecStruct *Spec;
 #include "rpmmacro.h"
 
@@ -14,12 +18,15 @@ struct ReqProvTrigger {
 };
 #endif
 
+/** */
 struct TriggerFileEntry {
+/*@{*/
     int index;
     /*@only@*/ char *fileName;
     /*@only@*/ char *script;
     /*@only@*/ char *prog;
     /*@owned@*/ struct TriggerFileEntry *next;
+/*@}*/
 };
 
 #define RPMBUILD_ISSOURCE     1
@@ -29,51 +36,69 @@ struct TriggerFileEntry {
 
 #define RPMBUILD_DEFAULT_LANG "C"
 
+/** */
 struct Source {
+/*@{*/
     /*@owned@*/ char *fullSource;
     /*@dependent@*/ char *source;     /* Pointer into fullSource */
     int flags;
     int num;
     /*@owned@*/ struct Source *next;
+/*@}*/
 };
 
+/** */
 typedef struct ReadLevelEntry {
+/*@{*/
     int reading;
     /*@dependent@*/ struct ReadLevelEntry *next;
+/*@}*/
 } RLE_t;
 
+/** */
 typedef struct OpenFileInfo {
+/*@{*/
     /*@only@*/ char *fileName;
     FD_t fd;
     int lineNum;
     char readBuf[BUFSIZ];
     /*@dependent@*/ char *readPtr;
     /*@owned@*/ struct OpenFileInfo *next;
+/*@}*/
 } OFI_t;
 
+/** */
 struct spectag {
+/*@{*/
     int t_tag;
     int t_startx;
     int t_nlines;
     /*@only@*/ const char *t_lang;
     /*@only@*/ const char *t_msgid;
+/*@}*/
 };
 
-
+/** */
 struct spectags {
+/*@{*/
     /*@owned@*/ struct spectag *st_t;
     int st_nalloc;
     int st_ntags;
+/*@}*/
 };
 
+/** */
 struct speclines {
+/*@{*/
     /*@only@*/ char **sl_lines;
     int sl_nalloc;
     int sl_nlines;
+/*@}*/
 };
 
-/*! The structure used to store values parsed from a spec file. */
+/** The structure used to store values parsed from a spec file. */
 struct SpecStruct {
+/*@{*/
     /*@only@*/ const char *specFile;   /*!< Name of the spec file. */
     /*@only@*/ const char *sourceRpmName;
 
@@ -123,10 +148,12 @@ struct SpecStruct {
     /*@only@*/ StringBuf clean;                /*!< %clean scriptlet. */
 
     /*@owned@*/ struct PackageStruct *packages;        /*!< Package list. */
+/*@}*/
 };
 
-/*! The structure used to store values for a package. */
+/** The structure used to store values for a package. */
 struct PackageStruct {
+/*@{*/
     /*@refcounted@*/ Header header;
 
     int cpioCount;
@@ -156,8 +183,10 @@ struct PackageStruct {
     /*@only@*/ StringBuf fileList; /* If NULL, package will not be written */
 
     /*@dependent@*/ struct PackageStruct *next;
+/*@}*/
 };
 
+/** */
 typedef struct PackageStruct *Package;
 
 #ifdef __cplusplus
index 5462512..760d4a2 100644 (file)
@@ -1,3 +1,7 @@
+/** \file build/spec.c
+ * Handle spec data structure.
+ */
+
 #include "system.h"
 
 #include "rpmbuild.h"
@@ -49,6 +53,7 @@ static inline void freeSources(/*@only@*/ struct Source *s)
     }
 }
 
+/** */
 int lookupPackage(Spec spec, const char *name, int flag, /*@out@*/Package *pkg)
 {
     const char *pname;
@@ -89,6 +94,7 @@ int lookupPackage(Spec spec, const char *name, int flag, /*@out@*/Package *pkg)
     return ((p == NULL) ? 1 : 0);
 }
 
+/** */
 Package newPackage(Spec spec)
 {
     Package p;
@@ -137,6 +143,7 @@ Package newPackage(Spec spec)
     return p;
 }
 
+/** */
 void freePackage(/*@only@*/ Package p)
 {
     if (p == NULL)
@@ -162,6 +169,7 @@ void freePackage(/*@only@*/ Package p)
     free(p);
 }
 
+/** */
 void freePackages(Spec spec)
 {
     Package p;
@@ -208,6 +216,7 @@ static char *getFullSource(Spec spec, int num, int flag)
 }
 #endif /* UNUSED */
 
+/** */
 int parseNoSource(Spec spec, const char *field, int tag)
 {
     const char *f, *fe;
@@ -252,6 +261,7 @@ int parseNoSource(Spec spec, const char *field, int tag)
     return 0;
 }
 
+/** */
 int addSource(Spec spec, Package pkg, const char *field, int tag)
 {
     struct Source *p;
@@ -391,6 +401,7 @@ static inline void freeSt(/*@only@*/struct spectags *st)
     free(st);
 }
 
+/** */
 Spec newSpec(void)
 {
     Spec spec;
@@ -451,6 +462,7 @@ Spec newSpec(void)
     return spec;
 }
 
+/** */
 void freeSpec(/*@only@*/ Spec spec)
 {
     struct OpenFileInfo *ofi;
@@ -514,6 +526,7 @@ void freeSpec(/*@only@*/ Spec spec)
     free(spec);
 }
 
+/** */
 /*@only@*/ struct OpenFileInfo * newOpenFileInfo(void)
 {
     struct OpenFileInfo *ofi;