RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   25-Jun-2016 22:37:42
  Branch: rpm-5_4                          Handle: 2016062520374101

  Modified files:           (Branch: rpm-5_4)
    rpm                     CHANGES
    rpm/build               Makefile.am rpmbuild.h rpmspec.h

  Log:
    - build: sanitize public includes (with iwyu).

  Summary:
    Revision    Changes     Path
    1.3501.2.502+1  -0      rpm/CHANGES
    2.80.2.11   +7  -0      rpm/build/Makefile.am
    2.102.4.2   +49 -198    rpm/build/rpmbuild.h
    2.87.2.4    +23 -111    rpm/build/rpmspec.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3501.2.501 -r1.3501.2.502 CHANGES
  --- rpm/CHANGES       25 Jun 2016 09:49:39 -0000      1.3501.2.501
  +++ rpm/CHANGES       25 Jun 2016 20:37:41 -0000      1.3501.2.502
  @@ -1,4 +1,5 @@
   5.4.17 -> 5.4.18:
  +    - jbj: build: sanitize public includes (with iwyu).
       - jbj: lib: sanitize public includes (with iwyu).
       - jbj: rpmdb: sanitize public includes (with iwyu).
       - jbj: rpmio: sanitize public includes (with iwyu).
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/Makefile.am
  ============================================================================
  $ cvs diff -u -r2.80.2.10 -r2.80.2.11 Makefile.am
  --- rpm/build/Makefile.am     17 Jun 2016 08:07:26 -0000      2.80.2.10
  +++ rpm/build/Makefile.am     25 Jun 2016 20:37:41 -0000      2.80.2.11
  @@ -118,6 +118,13 @@
   rpmbuild.lcd: Makefile.am ${librpmbuild_la_SOURCES} ${pkginc_HEADERS} 
${noinst_HEADERS}
        -lclint ${DEFS} ${INCLUDES} ${librpmbuild_la_SOURCES} -dump $@ 
2>/dev/null
   
  +.PHONY: iwyu
  +iwyu:
  +     @-for INC in $(pkginc_HEADERS); do \
  +       echo "----- $${INC}"; \
  +       iwyu $(AM_CPPFLAGS) $${INC}; \
  +     done
  +
   .PHONY:      sources
   sources:
        @echo $(librpmbuild_la_SOURCES:%=build/%)
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/rpmbuild.h
  ============================================================================
  $ cvs diff -u -r2.102.4.1 -r2.102.4.2 rpmbuild.h
  --- rpm/build/rpmbuild.h      27 Sep 2014 15:54:19 -0000      2.102.4.1
  +++ rpm/build/rpmbuild.h      25 Jun 2016 20:37:42 -0000      2.102.4.2
  @@ -6,13 +6,15 @@
    *  This is the *only* module users of librpmbuild should need to include.
    */
   
  +#include <sys/types.h>
  +#include <time.h>
   #include <rpmiotypes.h>
  -#include <rpmmacro.h>
   #include <rpmtypes.h>
   #include <rpmtag.h>
  +#include <rpmevr.h>
   
  +#include <rpmmacro.h>
   #include <rpmfi.h>
  -
   #include <rpmcli.h>
   
   #include "rpmspec.h"
  @@ -20,11 +22,8 @@
   /** \ingroup rpmbuild
    * Bit(s) to control buildSpec() operation.
    */
  -/*@-typeuse@*/
   typedef enum rpmBuildFlags_e {
  -/*@-enummemuse@*/
       RPMBUILD_NONE    = 0,
  -/*@=enummemuse@*/
       RPMBUILD_PREP    = (1 <<  0),    /*!< Execute %%prep. */
       RPMBUILD_BUILD   = (1 <<  1),    /*!< Execute %%build. */
       RPMBUILD_INSTALL = (1 <<  2),    /*!< Execute %%install. */
  @@ -40,7 +39,6 @@
       RPMBUILD_RMSPEC  = (1 << 12),    /*!< Remove spec file. */
       RPMBUILD_FETCHSOURCE= (1 << 13)  /*!< Fetch source(s) and patch(s). */
   } rpmBuildFlags;
  -/*@=typeuse@*/
   
   #define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; }
   #define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; }
  @@ -92,20 +90,16 @@
       STRIP_NOEXPAND   = (1 << 2)
   } rpmStripFlags;
   
  -/*@unchecked@*/
   extern int _rpmbuildFlags;
   
   #ifdef __cplusplus
   extern "C" {
   #endif
  -/*@-redecl@*/
   
   /** \ingroup rpmbuild
    * Destroy uid/gid caches.
    */
  -void freeNames(void)
  -     /*@globals internalState@*/
  -     /*@modifies internalState */;
  +void freeNames(void);
   
   /** \ingroup rpmbuild
    * Return cached user name from user id.
  @@ -113,9 +107,7 @@
    * @param uid                user id
    * @return           cached user name
    */
  -extern /*@observer@*/ const char * getUname(uid_t uid)
  -     /*@globals internalState @*/
  -     /*@modifies internalState @*/;
  +extern const char * getUname(uid_t uid);
   
   /** \ingroup rpmbuild
    * Return cached user name.
  @@ -123,9 +115,7 @@
    * @param uname              user name
    * @return           cached user name
    */
  -extern /*@observer@*/ const char * getUnameS(const char * uname)
  -     /*@globals internalState @*/
  -     /*@modifies internalState @*/;
  +extern const char * getUnameS(const char * uname);
   
   /** \ingroup rpmbuild
    * Return cached user id.
  @@ -133,9 +123,7 @@
    * @param uname              user name
    * @return           cached uid
    */
  -uid_t getUidS(const char * uname)
  -     /*@globals internalState @*/
  -     /*@modifies internalState @*/;
  +uid_t getUidS(const char * uname);
   
   /** \ingroup rpmbuild
    * Return cached group name from group id.
  @@ -143,9 +131,7 @@
    * @param gid                group id
    * @return           cached group name
    */
  -extern /*@observer@*/ const char * getGname(gid_t gid)
  -     /*@globals internalState @*/
  -     /*@modifies internalState @*/;
  +extern const char * getGname(gid_t gid);
   
   /** \ingroup rpmbuild
    * Return cached group name.
  @@ -153,9 +139,7 @@
    * @param gname              group name
    * @return           cached group name
    */
  -extern /*@observer@*/ const char * getGnameS(const char * gname)
  -     /*@globals internalState @*/
  -     /*@modifies internalState @*/;
  +extern const char * getGnameS(const char * gname);
   
   /** \ingroup rpmbuild
    * Return cached group id.
  @@ -163,25 +147,19 @@
    * @param gname              group name
    * @return           cached gid
    */
  -gid_t getGidS(const char * gname)
  -     /*@globals internalState @*/
  -     /*@modifies internalState @*/;
  +gid_t getGidS(const char * gname);
   
   /** \ingroup rpmbuild
    * Return build hostname.
    * @return           build hostname
    */
  -/*@observer@*/
  -extern const char * buildHost(void)
  -     /*@*/;
  +extern const char * buildHost(void);
   
   /** \ingroup rpmbuild
    * Return build time stamp.
    * @return           build time stamp
    */
  -/*@observer@*/
  -extern rpmuint32_t * getBuildTime(void)
  -     /*@*/;
  +extern rpmuint32_t * getBuildTime(void);
   
   /** \ingroup rpmbuild
    * Read next line from spec file.
  @@ -189,35 +167,26 @@
    * @param strip              truncate comments?
    * @return           0 on success, 1 on EOF, <0 on error
    */
  -int readLine(Spec spec, rpmStripFlags strip)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
  -             spec->lbufPtr,
  -             spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
  -             rpmGlobalMacroContext, fileSystem, internalState  @*/;
  +int readLine(Spec spec, rpmStripFlags strip);
   
   /** \ingroup rpmbuild
    * Stop reading from spec file, freeing resources.
    * @param spec               spec file control structure
    */
  -void closeSpec(/*@partial@*/ Spec spec)
  -     /*@globals fileSystem, internalState @*/
  -     /*@modifies spec->fileStack, fileSystem, internalState @*/;
  +void closeSpec(Spec spec);
   
   /** \ingroup rpmbuild
    * Truncate comment lines.
    * @param s          skip white space, truncate line at '#'
    */
  -void handleComments(char * s)
  -     /*@modifies s @*/;
  +void handleComments(char * s);
   
   /** \ingroup rpmbuild
    * Check line for section separator, return next parser state.
    * @param spec               spec file control structure
    * @return           next parser state
    */
  -rpmParseState isPart(Spec spec)
  -     /*@modifies spec->foo, spec->nfoo @*/;
  +rpmParseState isPart(Spec spec);
   
   /** \ingroup rpmbuild
    * Parse a number.
  @@ -225,8 +194,7 @@
    * @retval res               pointer to int
    * @return           0 on success, 1 on failure
    */
  -int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/rpmuint32_t * 
res)
  -     /*@modifies *res @*/;
  +int parseNum(const char * line, rpmuint32_t * res);
   
   /** \ingroup rpmbuild
    * Add changelog entry to header.
  @@ -237,8 +205,7 @@
    * @param text               description of change
    */
   void addChangelogEntry(Header h, time_t time, const char * name,
  -             const char * text)
  -     /*@modifies h @*/;
  +             const char * text);
   
   /** \ingroup rpmbuild
    * Parse %%build/%%install/%%clean section(s) of a spec file.
  @@ -246,53 +213,28 @@
    * @param parsePart  current rpmParseState
    * @return           >= 0 next rpmParseState, < 0 on error
    */
  -int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->build, spec->install, spec->check, spec->clean,
  -             spec->macros, spec->foo, spec->nfoo, spec->lbufPtr,
  -             spec->fileStack, spec->readStack, spec->line, spec->lineNum,
  -             spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +int parseBuildInstallClean(Spec spec, rpmParseState parsePart);
   
   /** \ingroup rpmbuild
    * Parse %%changelog section of a spec file.
    * @param spec               spec file control structure
    * @return           >= 0 next rpmParseState, < 0 on error
    */
  -int parseChangelog(Spec spec)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
  -             spec->foo, spec->nfoo, spec->lbufPtr,
  -             spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
  -             spec->packages->header,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +int parseChangelog(Spec spec);
   
   /** \ingroup rpmbuild
    * Parse %%description section of a spec file.
    * @param spec               spec file control structure
    * @return           >= 0 next rpmParseState, < 0 on error
    */
  -int parseDescription(Spec spec)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->packages,
  -             spec->foo, spec->nfoo, spec->lbufPtr,
  -             spec->fileStack, spec->readStack, spec->line, spec->lineNum,
  -             spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
  -             spec->st,
  -             rpmGlobalMacroContext, fileSystem, internalState  @*/;
  +int parseDescription(Spec spec);
   
   /** \ingroup rpmbuild
    * Parse %%files section of a spec file.
    * @param spec               spec file control structure
    * @return           >= 0 next rpmParseState, < 0 on error
    */
  -int parseFiles(Spec spec)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->packages,
  -             spec->foo, spec->nfoo, spec->lbufPtr,
  -             spec->fileStack, spec->readStack, spec->line, spec->lineNum,
  -             spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +int parseFiles(Spec spec);
   
   /** \ingroup rpmbuild
    * Parse tags from preamble of a spec file.
  @@ -300,18 +242,7 @@
    * @param initialPackage initialPackage
    * @return           >= 0 next rpmParseState, < 0 on error
    */
  -int parsePreamble(Spec spec, int initialPackage)
  -     /*@globals rpmGlobalMacroContext, h_errno,
  -             fileSystem, internalState @*/
  -     /*@modifies spec->packages,
  -             spec->foo, spec->nfoo, spec->lbufPtr,
  -             spec->fileStack, spec->readStack, spec->line, spec->lineNum,
  -             spec->buildSubdir,
  -             spec->macros, spec->st,
  -             spec->sources, spec->numSources, spec->noSource,
  -             spec->sourceHeader, spec->BANames, spec->BACount,
  -             spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +int parsePreamble(Spec spec, int initialPackage);
   
   /** \ingroup rpmbuild
    * Parse %%prep section of a spec file.
  @@ -319,14 +250,7 @@
    * @param verify     verify existence of sources/patches?
    * @return           >= 0 next rpmParseState, < 0 on error
    */
  -int parsePrep(Spec spec, int verify)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->prep, spec->buildSubdir, spec->macros,
  -             spec->foo, spec->nfoo, spec->lbufPtr,
  -             spec->fileStack, spec->readStack, spec->line, spec->lineNum,
  -             spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
  -             spec->packages->header,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +int parsePrep(Spec spec, int verify);
   
   /** \ingroup rpmbuild
    * Parse dependency relations from spec file and/or autogenerated output 
buffer.
  @@ -339,9 +263,7 @@
    * @return           RPMRC_OK on success
    */
   rpmRC parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN,
  -             rpmuint32_t index, rpmsenseFlags tagflags)
  -     /*@globals internalState @*/
  -     /*@modifies internalState @*/;
  +             rpmuint32_t index, rpmsenseFlags tagflags);
   
   /** \ingroup rpmbuild
    * Parse %%pre et al scriptlets from a spec file.
  @@ -349,13 +271,7 @@
    * @param parsePart  current rpmParseState
    * @return           >= 0 next rpmParseState, < 0 on error
    */
  -int parseScript(Spec spec, int parsePart)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->packages,
  -             spec->foo, spec->nfoo, spec->lbufPtr,
  -             spec->fileStack, spec->readStack, spec->line, spec->lineNum,
  -             spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
  -             rpmGlobalMacroContext, fileSystem, internalState  @*/;
  +int parseScript(Spec spec, int parsePart);
   
   /** \ingroup rpmbuild
    * Evaluate boolean expression.
  @@ -363,9 +279,7 @@
    * @param expr               expression to parse
    * @return           value
    */
  -int parseExpressionBoolean(Spec spec, const char * expr)
  -     /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
  -     /*@modifies rpmGlobalMacroContext, internalState @*/;
  +int parseExpressionBoolean(Spec spec, const char * expr);
   
   /** \ingroup rpmbuild
    * Evaluate string expression.
  @@ -373,10 +287,7 @@
    * @param expr               expression to parse
    * @return           value
    */
  -/*@unused@*/ /*@null@*/
  -char * parseExpressionString(Spec spec, const char * expr)
  -     /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
  -     /*@modifies rpmGlobalMacroContext, internalState @*/;
  +char * parseExpressionString(Spec spec, const char * expr);
   
   /** \ingroup rpmbuild
    * Run a build script, assembled from spec file scriptlet section.
  @@ -388,12 +299,7 @@
    * @param test               don't execute scripts or package if testing
    * @return           RPMRC_OK on success, RPMRC_FAIL on failure
    */
  -rpmRC doScript(Spec spec, int what, /*@null@*/ const char * name,
  -             /*@null@*/ rpmiob iob, int test)
  -     /*@globals rpmGlobalMacroContext, h_errno,
  -             fileSystem, internalState @*/
  -     /*@modifies spec->macros,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +rpmRC doScript(Spec spec, int what, const char * name, rpmiob iob, int test);
   
   /** \ingroup rpmbuild
    * Find sub-package control structure by name.
  @@ -403,21 +309,14 @@
    * @retval pkg               package control structure
    * @return           RPMRC_OK on success
    */
  -rpmRC lookupPackage(Spec spec, /*@null@*/ const char * name, int flag,
  -             /*@out@*/ Package * pkg)
  -     /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
  -     /*@modifies spec->packages, *pkg, rpmGlobalMacroContext,
  -             internalState @*/;
  +rpmRC lookupPackage(Spec spec, const char * name, int flag, Package * pkg);
   
   /** \ingroup rpmbuild
    * Destroy all packages associated with spec file.
    * @param packages   package control structure chain
    * @return           NULL
    */
  -/*@null@*/
  -Package freePackages(/*@only@*/ /*@null@*/ Package packages)
  -     /*@globals fileSystem @*/
  -     /*@modifies packages, fileSystem @*/;
  +Package freePackages(Package packages);
   
   /** \ingroup rpmbuild
    * Destroy a package control structure.
  @@ -425,10 +324,7 @@
    * @param pkg                package control structure
    * @return           NULL on last dereference
    */
  -/*@null@*/
  -Package freePackage(/*@killref@*/ /*@null@*/ Package pkg)
  -     /*@globals fileSystem @*/
  -     /*@modifies pkg, fileSystem @*/;
  +Package freePackage(Package pkg);
   #define      freePackage(_pkg)       \
       ((Package)rpmioFreePoolItem((rpmioItem)(_pkg), __FUNCTION__, __FILE__, 
__LINE__))
   
  @@ -437,9 +333,7 @@
    * @param spec               spec file control structure
    * @return           package control structure
    */
  -/*@only@*/
  -Package newPackage(Spec spec)
  -     /*@modifies spec->packages, spec->packages->next @*/;
  +Package newPackage(Spec spec);
   
   /** \ingroup rpmbuild
    * Add dependency to header, filtering duplicates.
  @@ -452,11 +346,9 @@
    * @param index              (0 always)
    * @return           0 always
    */
  -int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN,
  +int addReqProv(Spec spec, Header h, rpmTag tagN,
                const char * N, const char * EVR, rpmsenseFlags Flags,
  -             rpmuint32_t index)
  -     /*@globals internalState @*/
  -     /*@modifies h, internalState @*/;
  +             rpmuint32_t index);
   
   /**
    * Append files (if any) to scriptlet tags.
  @@ -464,19 +356,14 @@
    * @param pkg                package control structure
    * @return           RPMRC_OK on success
    */
  -rpmRC processScriptFiles(Spec spec, Package pkg)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies pkg->header, rpmGlobalMacroContext,
  -             fileSystem, internalState @*/;
  +rpmRC processScriptFiles(Spec spec, Package pkg);
   
   /**
    * Retrofit an explicit Provides: N = E:V-R dependency into package headers.
    * Up to rpm 3.0.4, packages implicitly provided their own 
name-version-release.
    * @param h             header
    */
  -void providePackageNVR(Header h)
  -     /*@globals internalState @*/
  -     /*@modifies h, internalState @*/;
  +void providePackageNVR(Header h);
   
   /** \ingroup rpmbuild
    * Add rpmlib feature dependency.
  @@ -485,9 +372,7 @@
    * @param featureEVR rpm feature epoch/version/release
    * @return           0 always
    */
  -int rpmlibNeedsFeature(Header h, const char * feature, const char * 
featureEVR)
  -     /*@globals internalState @*/
  -     /*@modifies h, internalState @*/;
  +int rpmlibNeedsFeature(Header h, const char * feature, const char * 
featureEVR);
   
   /** \ingroup rpmbuild
    * Post-build processing for binary package(s).
  @@ -496,12 +381,7 @@
    * @param test               don't execute scripts or package if testing
    * @return           RPMRC_OK on success
    */
  -rpmRC processBinaryFiles(Spec spec, int installSpecialDoc, int test)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->macros, *spec->packages,
  -             spec->packages->fi, spec->packages->fileList,
  -             spec->packages->specialDoc, spec->packages->header,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +rpmRC processBinaryFiles(Spec spec, int installSpecialDoc, int test);
   
   /** \ingroup rpmbuild
    * Create and initialize header for source package.
  @@ -509,24 +389,14 @@
    * @retval *sfp              srpm file list (may be NULL)
    * @return           0 always
    */
  -int initSourceHeader(Spec spec, /*@null@*/ rpmiob *sfp)
  -     /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
  -     /*@modifies spec->sourceHeader, spec->sourceHdrInit,
  -             spec->BANames, *sfp,
  -             spec->packages->header,
  -             rpmGlobalMacroContext, internalState @*/;
  +int initSourceHeader(Spec spec, rpmiob *sfp);
   
   /** \ingroup rpmbuild
    * Post-build processing for source package.
    * @param spec               spec file control structure
    * @return           0 on success
    */
  -int processSourceFiles(Spec spec)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->sourceHeader, spec->sourceCpioList,
  -             spec->BANames, spec->sourceHdrInit,
  -             spec->packages->header,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +int processSourceFiles(Spec spec);
   
   /** \ingroup rpmbuild
    * Parse spec file into spec control structure.
  @@ -542,13 +412,11 @@
    * @return           0 on success
    */
   int parseSpec(rpmts ts, const char * specFile,
  -             /*@null@*/ const char * rootURL,
  +             const char * rootURL,
                int recursing,
  -             /*@null@*/ const char * passPhrase,
  -             /*@null@*/ const char * cookie,
  -             int anyarch, int force, int verify)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
  +             const char * passPhrase,
  +             const char * cookie,
  +             int anyarch, int force, int verify);
   
   /** \ingroup rpmbuild
    * Build stages state machine driver.
  @@ -558,39 +426,22 @@
    * @param test               don't execute scripts or package if testing
    * @return           RPMRC_OK on success
    */
  -rpmRC buildSpec(rpmts ts, Spec spec, int what, int test)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie,
  -             spec->sourceRpmName, spec->sourcePkgId, spec->sourceHdrInit,
  -             spec->macros, spec->BASpecs,
  -             spec->BANames, *spec->packages,
  -             spec->packages->fi, spec->packages->fileList,
  -             spec->packages->specialDoc, spec->packages->header,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +rpmRC buildSpec(rpmts ts, Spec spec, int what, int test);
   
   /** \ingroup rpmbuild
    * Generate binary package(s).
    * @param spec               spec file control structure
    * @return           rpmRC on success
    */
  -rpmRC packageBinaries(Spec spec)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->packages->header, spec->packages->fi,
  -             spec->sourceRpmName, spec->cookie, spec->sourcePkgId,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +rpmRC packageBinaries(Spec spec);
   
   /** \ingroup rpmbuild
    * Generate source package.
    * @param spec               spec file control structure
    * @return           RPMRC_OK on success
    */
  -rpmRC packageSources(Spec spec)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList,
  -             spec->sourceRpmName, spec->sourcePkgId, spec->packages->header,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +rpmRC packageSources(Spec spec);
   
  -/*@=redecl@*/
   #ifdef __cplusplus
   }
   #endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/rpmspec.h
  ============================================================================
  $ cvs diff -u -r2.87.2.3 -r2.87.2.4 rpmspec.h
  --- rpm/build/rpmspec.h       29 Sep 2014 18:34:23 -0000      2.87.2.3
  +++ rpm/build/rpmspec.h       25 Jun 2016 20:37:42 -0000      2.87.2.4
  @@ -6,13 +6,21 @@
    *  The Spec and Package data structures used during build.
    */
   
  +#include <stdio.h>
  +#include <rpmdefs.h>
  +#include <rpmiotypes.h>
  +#include <rpmmacro.h>
  +#include <rpmio.h>
  +#include <rpmtag.h>
  +#include <rpmtypes.h>
  +
   #include <rpmevr.h>
   #include <rpmfi.h>   /* XXX rpmfi typedef */
   #include <rpmcli.h>  /* XXX QVA_t typedef */
   
   /** \ingroup rpmbuild
    */
  -typedef /*@abstract@*/ /*@refcounted@*/ struct Package_s * Package;
  +typedef struct Package_s * Package;
   
   /** \ingroup rpmbuild
    */
  @@ -22,13 +30,9 @@
    */
   struct TriggerFileEntry {
       int index;
  -/*@only@*/
       char * fileName;
  -/*@only@*/
       char * script;
  -/*@only@*/
       char * prog;
  -/*@owned@*/
       struct TriggerFileEntry * next;
   };
   
  @@ -37,38 +41,28 @@
   /** \ingroup rpmbuild
    */
   struct Source {
  -/*@owned@*/
       const char * fullSource;
  -/*@dependent@*/ /*@relnull@*/
       const char * source;     /* Pointer into fullSource */
       int flags;
       rpmuint32_t num;
  -/*@owned@*/
       struct Source * next;
   };
   
   /** \ingroup rpmbuild
    */
  -/*@-typeuse@*/
   typedef struct ReadLevelEntry {
       int reading;
  -/*@dependent@*/
       struct ReadLevelEntry * next;
   } RLE_t;
  -/*@=typeuse@*/
   
   /** \ingroup rpmbuild
    */
   typedef struct OpenFileInfo {
  -/*@only@*/
       const char * fileName;
  -/*@relnull@*/
       FD_t fd;
       int lineNum;
       char readBuf[BUFSIZ];
  -/*@dependent@*/
       char * readPtr;
  -/*@owned@*/
       struct OpenFileInfo * next;
   } OFI_t;
   
  @@ -78,16 +72,13 @@
       int t_tag;
       int t_startx;
       int t_nlines;
  -/*@only@*/
       const char * t_lang;
  -/*@only@*/
       const char * t_msgid;
   } * spectag;
   
   /** \ingroup rpmbuild
    */
   typedef struct spectags_s {
  -/*@owned@*/
       spectag st_t;
       int st_nalloc;
       int st_ntags;
  @@ -96,7 +87,6 @@
   /** \ingroup rpmbuild
    */
   typedef struct speclines_s {
  -/*@only@*/
       char **sl_lines;
       int sl_nalloc;
       int sl_nlines;
  @@ -107,38 +97,25 @@
    */
   struct Spec_s {
       struct rpmioItem_s _item;        /*!< usage mutex and pool identifier. */
  -/*@only@*/
       const char * specFile;   /*!< Name of the spec file. */
  -/*@only@*/
       const char * buildSubdir;
  -/*@only@*/
       const char * rootURL;
   
  -/*@owned@*/ /*@null@*/
       speclines sl;
  -/*@owned@*/ /*@null@*/
       spectags st;
   
  -/*@owned@*/
       struct OpenFileInfo * fileStack;
  -/*@owned@*/
       char *lbuf;
       size_t lbuf_len;
  -/*@dependent@*/
       char *lbufPtr;
       char nextpeekc;
  -/*@dependent@*/
       char * nextline;
  -/*@dependent@*/
       char * line;
       int lineNum;
   
  -/*@owned@*/
       struct ReadLevelEntry * readStack;
   
  -/*@owned@*/ /*@null@*/
       Spec * BASpecs;
  -/*@only@*/ /*@null@*/
       const char ** BANames;
       int BACount;
       int recursing;           /*!< parse is recursive? */
  @@ -147,28 +124,20 @@
       int force;
       int anyarch;
   
  -/*@null@*/
       char * passPhrase;
       int timeCheck;
  -/*@null@*/
       const char * cookie;
   
  -/*@owned@*/
       struct Source * sources;
       int numSources;
       int noSource;
   
  -/*@only@*/
       const char * sourceRpmName;
  -/*@only@*/
       unsigned char * sourcePkgId;
  -/*@refcounted@*/
       Header sourceHeader;
  -/*@refcounted@*/
       rpmfi fi;
       int sourceHdrInit;
   
  -/*@dependent@*/ /*@null@*/
       MacroContext macros;
   
       rpmRC (*_parseRCPOT) (Spec spec, Package pkg, const char *field, rpmTag 
tagN,
  @@ -177,28 +146,18 @@
       rpmuint32_t sstates[RPMSCRIPT_MAX];              /*!< scriptlet states. 
*/
       rpmuint32_t smetrics[RPMSCRIPT_MAX];     /*!< scriptlet time metrics. */
   
  -/*@only@*/
       rpmiob prep;             /*!< %prep scriptlet. */
  -/*@only@*/
       rpmiob build;            /*!< %build scriptlet. */
  -/*@only@*/
       rpmiob install;          /*!< %install scriptlet. */
  -/*@only@*/
       rpmiob check;            /*!< %check scriptlet. */
  -/*@only@*/
       rpmiob clean;            /*!< %clean scriptlet. */
   
       size_t nfoo;
  -/*@only@*/ /*@relnull@*/
       tagStore_t foo;
   
       void * dig;                      /*!< Auto-signing keypair. */
   
       Package packages;                /*!< Package list. */
  -#if defined(__LCLINT__)
  -/*@refs@*/
  -    int nrefs;                       /*!< (unused) keep splint happy */
  -#endif
   };
   
   /** \ingroup rpmbuild
  @@ -206,50 +165,31 @@
    */
   struct Package_s {
       struct rpmioItem_s _item;        /*!< usage mutex and pool identifier. */
  -/*@refcounted@*/
       Header header;
  -/*@refcounted@*/
       rpmds ds;                        /*!< Requires: N = EVR */
  -/*@refcounted@*/
       rpmfi fi;
   
       int autoReq;
       int autoProv;
       int noarch;
   
  -/*@only@*/
       const char * preInFile;  /*!< %pre scriptlet. */
  -/*@only@*/
       const char * postInFile; /*!< %post scriptlet. */
  -/*@only@*/
       const char * preUnFile;  /*!< %preun scriptlet. */
  -/*@only@*/
       const char * postUnFile; /*!< %postun scriptlet. */
  -/*@only@*/
       const char * preTransFile;       /*!< %pretrans scriptlet. */
  -/*@only@*/
       const char * postTransFile;      /*!< %posttrans scriptlet. */
  -/*@only@*/
       const char * verifyFile; /*!< %verifyscript scriptlet. */
  -/*@only@*/
       const char * sanityCheckFile;/*!< %sanitycheck scriptlet. */
   
  -/*@only@*/
       rpmiob specialDoc;
   
  -/*@only@*/
       struct TriggerFileEntry * triggerFiles;
   
  -/*@only@*/
       const char * fileFile;
  -/*@only@*/
       rpmiob fileList;         /* If NULL, package will not be written */
   
       Package next;
  -#if defined(__LCLINT__)
  -/*@refs@*/
  -    int nrefs;                       /*!< (unused) keep splint happy */
  -#endif
   };
   
   #ifdef __cplusplus
  @@ -262,10 +202,7 @@
    * @param spec               spec file control structure
    * @return           NULL on last dereference
    */
  -/*@null@*/
  -Spec freeSpec(/*@killref@*/ /*@null@*/ Spec spec)
  -     /*@globals fileSystem, internalState @*/
  -     /*@modifies spec, fileSystem, internalState @*/;
  +Spec freeSpec(Spec spec);
   #define      freeSpec(_spec) \
       ((Spec)rpmioFreePoolItem((rpmioItem)(_spec), __FUNCTION__, __FILE__, 
__LINE__))
   
  @@ -273,10 +210,7 @@
    * Create and initialize Spec structure.
    * @return spec              spec file control structure
    */
  -/*@only@*/
  -Spec newSpec(void)
  -     /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
  -     /*@modifies rpmGlobalMacroContext, internalState @*/;
  +Spec newSpec(void);
   
   /** \ingroup rpmbuild
    * Function to query spec file(s).
  @@ -285,16 +219,11 @@
    * @param arg                query argument
    * @return           0 on success, else no. of failures
    */
  -int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg)
  -     /*@globals rpmCLIMacroContext,
  -             rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies ts, qva, rpmCLIMacroContext, rpmGlobalMacroContext,
  -             fileSystem, internalState @*/;
  +int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg);
   
   /** \ingroup rpmbuild
    */
  -struct OpenFileInfo * newOpenFileInfo(void)
  -     /*@*/;
  +struct OpenFileInfo * newOpenFileInfo(void);
   
   /** \ingroup rpmbuild
    * stashSt.
  @@ -304,9 +233,7 @@
    * @param lang               locale
    * @return           ptr to saved entry
    */
  -spectag stashSt(Spec spec, Header h, rpmTag tag, const char * lang)
  -     /*@globals internalState @*/
  -     /*@modifies spec->st, internalState @*/;
  +spectag stashSt(Spec spec, Header h, rpmTag tag, const char * lang);
   
   /** \ingroup rpmbuild
    * addSource.
  @@ -316,11 +243,7 @@
    * @param tag                tag
    * @return           0 on success
    */
  -int addSource(Spec spec, Package pkg, const char * field, rpmTag tag)
  -     /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
  -     /*@modifies spec->sources, spec->numSources,
  -             spec->st, spec->macros,
  -             rpmGlobalMacroContext, fileSystem, internalState @*/;
  +int addSource(Spec spec, Package pkg, const char * field, rpmTag tag);
   
   /** \ingroup rpmbuild
    * parseNoSource.
  @@ -329,8 +252,7 @@
    * @param tag                tag
    * @return           0 on success
    */
  -int parseNoSource(Spec spec, const char * field, rpmTag tag)
  -     /*@*/;
  +int parseNoSource(Spec spec, const char * field, rpmTag tag);
   
   /** \ingroup rpmbuild
    * Return the count of source set in specfile
  @@ -338,8 +260,7 @@
    * @return  the count of source
    */
   int SpecSourceCount(Spec spec)
  -     RPM_GNUC_PURE
  -     /*@*/;
  +     RPM_GNUC_PURE;
   
   /** \ingroup rpmbuild
    * Return a source control structure
  @@ -348,28 +269,23 @@
    * @return          a SpecSource structure, NULL if not found
    */
   SpecSource getSource(Spec spec, int num)
  -     RPM_GNUC_PURE
  -     /*@*/;
  +     RPM_GNUC_PURE;
   
   /** \ingroup rpmbuild
    * Return a ptr to the source file name
    * @param source    SpecSource control structure
    * @return          ptr to filename
    */
  -/*@exposed@*/
   const char * specSourceName(SpecSource source)
  -     RPM_GNUC_PURE
  -     /*@*/;
  +     RPM_GNUC_PURE;
   
   /** \ingroup rpmbuild
    * Return a ptr to the full url of the source
    * @param source    SpecSource control structure
    * @return          ptr to url
    */
  -/*@exposed@*/
   const char * specFullSourceName(SpecSource source)
  -     RPM_GNUC_PURE
  -     /*@*/;
  +     RPM_GNUC_PURE;
   
   /** \ingroup rpmbuild
    * Return the spec or source patch number
  @@ -377,8 +293,7 @@
    * @return          the number of the source
    */
   int specSourceNum(SpecSource source)
  -     RPM_GNUC_PURE
  -     /*@*/;
  +     RPM_GNUC_PURE;
   
   /** \ingroup rpmbuild
    * Return flags set for the source
  @@ -386,22 +301,19 @@
    * @return          flags
    */
   int specSourceFlags(SpecSource source)
  -     RPM_GNUC_PURE
  -     /*@*/;
  +     RPM_GNUC_PURE;
   
   /** \ingroup rpmbuild
    * Return the macro directory location from source file flags
    * @param attr      rpmfileAttrs from source
    * @return          string containings macros about location, NULL on failure
    */
  -/*@null@*/
   #if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
   const char * getSourceDir(rpmfileAttrs attr, const char *filename)
   #else
   const char * getSourceDir(rpmfileAttrs attr)
   #endif
  -     RPM_GNUC_CONST
  -     /*@*/;
  +     RPM_GNUC_CONST;
   
   #ifdef __cplusplus
   }
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to