RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/build/ build.c files.c parsePrep.c rpmspec.h spec.c

From: Olivier Thauvin <nanardon@rpm5.org>
Date: Fri 17 Aug 2007 - 02:13:56 CEST
Message-Id: <20070817001356.BF9AA348456@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Olivier Thauvin
  Root:   /v/rpm/cvs                       Email:  nanardon@rpm5.org
  Module: rpm                              Date:   17-Aug-2007 02:13:56
  Branch: HEAD                             Handle: 2007081701135600

  Modified files:
    rpm/build               build.c files.c parsePrep.c rpmspec.h spec.c

  Log:
    - factorize source directory evaluation according RPMFILE flags

  Summary:
    Revision    Changes     Path
    2.115       +21 -10     rpm/build/build.c
    1.259       +1  -1      rpm/build/files.c
    2.88        +4  -5      rpm/build/parsePrep.c
    2.60        +8  -0      rpm/build/rpmspec.h
    2.152       +2  -3      rpm/build/spec.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/build/build.c
  ============================================================================
  $ cvs diff -u -r2.114 -r2.115 build.c
  --- rpm/build/build.c	22 Jul 2007 01:23:34 -0000	2.114
  +++ rpm/build/build.c	17 Aug 2007 00:13:56 -0000	2.115
  @@ -13,6 +13,23 @@
   /*@unchecked@*/
   static int _build_debug = 0;
   
  +/**
  + */
  +const char * getSourceDir(rpmfileAttrs attr)
  +    /*@globals rpmGlobalMacroContext @*/
  +{
  +    const char * dir = NULL;
  +
  +    if (attr & RPMFILE_SOURCE)
  +        dir = "%{_sourcedir}/";
  +    else if (attr & RPMFILE_PATCH)
  +        dir = "%{_patchdir}/";
  +    else if (attr & RPMFILE_ICON)
  +        dir = "%{_icondir}/";
  +
  +    return dir;
  +}
  +
   /*@access StringBuf @*/
   /*@access urlinfo @*/		/* XXX compared with NULL */
   /*@access FD_t @*/
  @@ -32,16 +49,10 @@
   
       for (sp = spec->sources; sp != NULL; sp = sp->next) {
   	const char *dn, *fn;
  -	if (sp->flags & RPMFILE_GHOST)
  -	    continue;
  -	if (sp->flags & RPMFILE_SOURCE)
  -	    dn = "%{_sourcedir}/";
  -	else if (sp->flags & RPMFILE_PATCH)
  -	    dn = "%{_patchdir}/";
  -	else if (sp->flags & RPMFILE_ICON)
  -	    dn = "%{_icondir}/";
  -	else
  -	    continue;
  +    if (sp->flags & RPMFILE_GHOST)
  +        continue;
  +    if (! (dn = getSourceDir(sp->flags)))
  +        continue;
   	fn = rpmGenPath(NULL, dn, sp->source);
   	rc = Unlink(fn);
   	fn = _free(fn);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/files.c
  ============================================================================
  $ cvs diff -u -r1.258 -r1.259 files.c
  --- rpm/build/files.c	22 Jul 2007 05:39:16 -0000	1.258
  +++ rpm/build/files.c	17 Aug 2007 00:13:56 -0000	1.259
  @@ -2463,7 +2463,7 @@
       for (srcPtr = spec->sources; srcPtr != NULL; srcPtr = srcPtr->next) {
         {	const char * sfn;
   	sfn = rpmGetPath( ((srcPtr->flags & RPMFILE_GHOST) ? "!" : ""),
  -		"%{_sourcedir}/", srcPtr->source, NULL);
  +		getSourceDir(srcPtr->flags), srcPtr->source, NULL);
   	appendLineStringBuf(sourceFiles, sfn);
   	sfn = _free(sfn);
         }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/parsePrep.c
  ============================================================================
  $ cvs diff -u -r2.87 -r2.88 parsePrep.c
  --- rpm/build/parsePrep.c	22 Jul 2007 01:54:12 -0000	2.87
  +++ rpm/build/parsePrep.c	17 Aug 2007 00:13:56 -0000	2.88
  @@ -216,7 +216,7 @@
       taropts = ((rpmIsVerbose() && !quietly) ? "-xvvf" : "-xf");
       /*@=internalglobs@*/
   
  -    Lurlfn = rpmGenPath(NULL, "%{_sourcedir}/", sp->source);
  +    Lurlfn = rpmGenPath(NULL, getSourceDir(sp->flags), sp->source);
   
       /* XXX On non-build parse's, file cannot be stat'd or read */
       if (!spec->force && (isCompressed(Lurlfn, &compressed) || checkOwners(Lurlfn))) {
  @@ -654,18 +654,17 @@
   /*@-branchstate@*/
       ec = 0;
       for (sp = spec->sources; sp != NULL; sp = sp->next) {
  -
  +    
  +    if (! (Lmacro = getSourceDir(sp->flags)))
  +        continue;
   	if (sp->flags & RPMFILE_SOURCE) {
   	    Rmacro = "%{?_Rsourcedir}/";
  -	    Lmacro = "%{?_sourcedir}/";
   	} else
   	if (sp->flags & RPMFILE_PATCH) {
   	    Rmacro = "%{?_Rpatchdir}/";
  -	    Lmacro = "%{?_patchdir}/";
   	} else
   	if (sp->flags & RPMFILE_ICON) {
   	    Rmacro = "%{?_Ricondir}/";
  -	    Lmacro = "%{?_icondir}/";
   	} else
   	    continue;
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/rpmspec.h
  ============================================================================
  $ cvs diff -u -r2.59 -r2.60 rpmspec.h
  --- rpm/build/rpmspec.h	16 Jul 2007 21:40:34 -0000	2.59
  +++ rpm/build/rpmspec.h	17 Aug 2007 00:13:56 -0000	2.60
  @@ -343,6 +343,14 @@
   int specSourceFlags(SpecSource source)
   	/*@modifies nothing @*/;
   
  +/** \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
  + */
  +const char * getSourceDir(rpmfileAttrs attr)
  +    /*@modifies nothing @*/;
  +
   #ifdef __cplusplus
   }
   #endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/spec.c
  ============================================================================
  $ cvs diff -u -r2.151 -r2.152 spec.c
  --- rpm/build/spec.c	24 Jul 2007 14:36:47 -0000	2.151
  +++ rpm/build/spec.c	17 Aug 2007 00:13:56 -0000	2.152
  @@ -319,25 +319,24 @@
       case RPMTAG_SOURCE:
   	flag = RPMFILE_SOURCE;
   	name = "source";
  -	mdir = "%{_sourcedir}/";
   	fieldp = spec->line + (sizeof("Source")-1);
   	break;
       case RPMTAG_PATCH:
   	flag = RPMFILE_PATCH;
   	name = "patch";
  -	mdir = "%{_patchdir}/";
   	fieldp = spec->line + (sizeof("Patch")-1);
   	break;
       case RPMTAG_ICON:
   	flag = RPMFILE_ICON;
   	name = "icon";
  -	mdir = "%{_icondir}/";
   	fieldp = NULL;
   	break;
       default:
   assert(0);
   	/*@notreached@*/ break;
       }
  +    mdir = getSourceDir(flag);
  +assert(mdir != NULL);
       /*@=branchstate@*/
   
       /* Get the number */
  @@ .
Received on Fri Aug 17 02:13:56 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.