RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/build/ parsePrep.c

From: Ralf S. Engelschall <rse@rpm5.org>
Date: Sun 23 Dec 2007 - 20:36:49 CET
Message-Id: <20071223193649.083AE34845B@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Ralf S. Engelschall
  Root:   /v/rpm/cvs                       Email:  rse@rpm5.org
  Module: rpm                              Date:   23-Dec-2007 20:36:49
  Branch: HEAD                             Handle: 2007122319364800

  Modified files:
    rpm                     CHANGES
    rpm/build               parsePrep.c

  Log:
    Refactor the "download missing source files" code in order to allow
    one to more easily add additional downloading strategies. There is no
    semantic change except that the downloading of missing source files from
    remote location is now only attempted if %{_Rxxxx} is really defined
    (else one sees surprising download URLs like "/foo-1.2.3.tar.gz",
    followed by an obviously resulting download error).
    
    Additionally, now output "Fetching(SourceX): <url>" to clearly indicate
    that something is fetched remotely, similar to the "Executing(%foo)"
    outputs we already know very well.

  Summary:
    Revision    Changes     Path
    1.2009      +2  -0      rpm/CHANGES
    2.108       +25 -15     rpm/build/parsePrep.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2008 -r1.2009 CHANGES
  --- rpm/CHANGES	23 Dec 2007 01:56:39 -0000	1.2008
  +++ rpm/CHANGES	23 Dec 2007 19:36:48 -0000	1.2009
  @@ -1,4 +1,6 @@
   5.0b3 -> 5.0b4:
  +    - rse: output "Fetching(SourceX): <url>" to clearly indicate that something is fetched remotely
  +    - rse: try to download missing source files from remote location only if %{_Rxxxx} is really defined
       - jbj: permit rpm -q --qf '%{track}\n' --specsrpm foo.spec queries.
       - jbj: fix: supply additional indentation for forced array[1] with --yaml.
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/parsePrep.c
  ============================================================================
  $ cvs diff -u -r2.107 -r2.108 parsePrep.c
  --- rpm/build/parsePrep.c	18 Dec 2007 19:40:52 -0000	2.107
  +++ rpm/build/parsePrep.c	23 Dec 2007 19:36:48 -0000	2.108
  @@ -652,6 +652,7 @@
       struct stat st;
       rpmRC rpmrc;
       int ec, rc;
  +    char *cp;
   
       /* XXX insure that %{_sourcedir} exists */
       rpmrc = RPMRC_OK;
  @@ -724,21 +725,30 @@
   	    goto bottom;
   	}
   
  -	Rurlfn = rpmGenPath(NULL, Rmacro, sp->source);
  -	if (Rurlfn == NULL || Rurlfn[0] == '\0' || !strcmp(Rurlfn, "/") || !strcmp(Lurlfn, Rurlfn)) {
  -	    rpmlog(RPMLOG_ERR, _("file %s missing: %s\n"),
  -		Lurlfn, strerror(errno));
  -	    ec++;
  -	    goto bottom;
  -	}
  -
  -	rc = urlGetFile(Rurlfn, Lurlfn);
  -	if (rc != 0) {
  -	    rpmlog(RPMLOG_ERR, _("Fetching %s failed: %s\n"),
  -		Rurlfn, ftpStrerror(rc));
  -	    ec++;
  -	    goto bottom;
  -	}
  +        /* try to fetch via macro-controlled remote locations */
  +        cp = rpmExpand(Rmacro, NULL);
  +        if (cp != NULL && strcmp(cp, "/") != 0) {
  +            cp = _free(cp);
  +            Rurlfn = rpmGenPath(NULL, Rmacro, sp->source);
  +            if (!(Rurlfn == NULL || Rurlfn[0] == '\0' || !strcmp(Rurlfn, "/") || !strcmp(Lurlfn, Rurlfn))) {
  +                rpmlog(RPMLOG_NOTICE, _("Fetching(%s%d): %s\n"),
  +                       (sp->flags & RPMFILE_SOURCE) ? "Source" : "Patch", sp->num, Rurlfn);
  +                rc = urlGetFile(Rurlfn, Lurlfn);
  +                if (rc == 0)
  +                    goto bottom;
  +                else {
  +                    rpmlog(RPMLOG_ERR, _("Fetching %s%d failed: %s\n"),
  +                           (sp->flags & RPMFILE_SOURCE) ? "Source" : "Patch", sp->num, ftpStrerror(rc));
  +                    ec++;
  +                }
  +            }
  +        }
  +        cp = _free(cp);
  +
  +        rpmlog(RPMLOG_ERR, _("Missing %s%d: %s: %s\n"),
  +            ((sp->flags & RPMFILE_SOURCE) ? "Source" : "Patch"),
  +            sp->num, sp->source, strerror(ENOENT));
  +        ec++;
   
   bottom:
   	Lurlfn = _free(Lurlfn);
  @@ .
Received on Sun Dec 23 20:36:49 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.