Turn back old urlgetfile implementation and enable it by default

This commit is contained in:
Denis Silakov 2013-10-04 11:15:34 +04:00
parent 6f3f4364a4
commit 44dea9a28e
2 changed files with 141 additions and 0 deletions

View file

@ -0,0 +1,136 @@
diff -Naur rpm-5.4.10.orig/macros/mandriva rpm-5.4.10/macros/mandriva
--- rpm-5.4.10.orig/macros/mandriva 2013-09-17 17:34:34.805808860 +0400
+++ rpm-5.4.10/macros/mandriva 2013-10-03 17:06:36.947155301 +0400
@@ -32,6 +32,8 @@
# mdvbz#64914
%_rpmgio .ufdio
+%__urlgetfile(url, dest) wget %1 -O %2
+
# This will die as soon as remaining usage has been phased out...
%mkrel(c:) %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel}
%manbo_mkrel() %mkrel
diff -Naur rpm-5.4.10.orig/macros/mandriva.in rpm-5.4.10/macros/mandriva.in
--- rpm-5.4.10.orig/macros/mandriva.in 2013-09-17 17:34:34.805808860 +0400
+++ rpm-5.4.10/macros/mandriva.in 2013-10-03 17:33:15.669303875 +0400
@@ -32,6 +32,8 @@
# mdvbz#64914
%_rpmgio .ufdio
+%__urlgetfile(url, dest) wget %1 -O %2
+
# This will die as soon as remaining usage has been phased out...
%mkrel(c:) %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel}
%manbo_mkrel() %mkrel
diff -Naur rpm-5.4.10.orig/rpmio/rpmio.c rpm-5.4.10/rpmio/rpmio.c
--- rpm-5.4.10.orig/rpmio/rpmio.c 2013-09-17 17:34:34.808808860 +0400
+++ rpm-5.4.10/rpmio/rpmio.c 2013-10-03 18:01:27.604461112 +0400
@@ -2836,21 +2836,27 @@
int flags = 0;
FD_t fd = NULL;
- if (path == NULL || _fmode == NULL)
+ if (path == NULL || _fmode == NULL) {
+ fprintf(stderr, "==> FAILED Fopen\n");
goto exit;
+ }
/*@-globs -mods@*/
fmode = rpmExpand(_fmode, NULL);
/*@=globs =mods@*/
-if (_rpmio_debug)
+/*if (_rpmio_debug)*/
fprintf(stderr, "==> Fopen(%s, %s)\n", path, fmode);
stdio[0] = '\0';
cvtfmode(fmode, stdio, sizeof(stdio), other, sizeof(other), &end, &flags);
- if (stdio[0] == '\0')
+ if (stdio[0] == '\0') {
+ fprintf(stderr, "==> FAILED2 Fopen\n");
goto exit;
+ }
+
if (end == NULL || !strcmp(end, "fdio")) {
+ fprintf(stderr, "==> PROC2 Fopen\n");
fd = fdOpen(path, flags, perms);
if (fdFileno(fd) < 0) {
if (fd) (void) fdClose(fd);
@@ -2858,6 +2864,7 @@
goto exit;
}
} else {
+ fprintf(stderr, "==> PROC1 Fopen\n");
FILE *fp;
int fdno;
int isHTTP = 0;
@@ -2894,12 +2901,15 @@
&& ((fdno = fdGetFdno(fd)) >= 0 || fd->req != NULL))
{
/*@+voidabstract@*/
+ fprintf(stderr, "==> PROC3 Fopen\n");
fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
/*@=voidabstract@*/
goto exit;
}
}
+ fprintf(stderr, "==> PROC4 Fopen\n");
+
if (fd)
fd = Fdopen(fd, fmode);
exit:
diff -Naur rpm-5.4.10.orig/rpmio/url.c rpm-5.4.10/rpmio/url.c
--- rpm-5.4.10.orig/rpmio/url.c 2013-09-17 17:34:34.827808860 +0400
+++ rpm-5.4.10/rpmio/url.c 2013-10-03 17:49:34.590394849 +0400
@@ -3,6 +3,7 @@
*/
#include "system.h"
+#include "stdio.h"
#include <netinet/in.h>
@@ -446,6 +447,7 @@
/*@-observertrans@*/
if (pathp)
*pathp = path;
+
/*@=observertrans@*/
return ut;
}
@@ -602,6 +604,7 @@
const char * sfuPath = NULL;
int urlType = urlPath(url, &sfuPath);
char *result;
+ char *cmd;
if (*sfuPath == '\0')
return FTPERR_UNKNOWN;
@@ -616,17 +619,17 @@
return FTPERR_UNKNOWN;
/*@-globs -mods@*/ /* Avoid including <rpmmacro.h> everywhere for now */
- if (rpmExpandNumeric("%{?__urlgetfile:1}%{!?__urlgetfile:0}")) {
- result = rpmExpand("%{__urlgetfile ", url, " ", dest, "}", NULL);
- if (result != NULL && strcmp(result, "OK") == 0)
- rc = 0;
- else {
- rpmlog(RPMLOG_DEBUG, D_("failed to fetch URL %s via external command\n"), url);
- rc = FTPERR_UNKNOWN;
+ cmd = rpmExpand("%{?__urlgetfile:%{__urlgetfile ", url, " ", dest, "}}", NULL);
+ if (cmd != NULL && cmd[0] != '\0') {
+ rc = system(cmd);
+ if ((rc >> 8) != 0) {
+ rpmlog(RPMLOG_DEBUG, D_("failed to fetch URL %s via external command: %s: %s\n"), url, Fstrerror(sfd));
+ rc = FTPERR_UNKNOWN;
}
- result = _free(result);
- goto exit;
+ cmd = _free(cmd);
+ goto exit;
}
+
/*@=globs =mods@*/
sfd = Fopen(url, "r.ufdio");

View file

@ -404,6 +404,10 @@ Patch503: rpm-5.4.9-specspo.patch
Patch504: rpm-5.4.10-postpone_subpackage_build_failures.patch
# Turn back old implementation of __urlgetfile handling,
# the new one doesn't work in ROSA atm
Patch505: rpm-5.4.10-turn-back-urlgetfile.patch
BuildRequires: autoconf >= 2.57
BuildRequires: bzip2-devel
BuildRequires: automake >= 1.8
@ -787,6 +791,7 @@ This package contains the RPM API documentation generated in HTML format.
%patch502 -p1 -b .package_name~
%patch503 -p1 -b .specspo~
%patch504 -p1 -b .postpone_errors~
%patch505 -p1 -b .urlgetfile~
#required by P55, P80, P81, P94..
./autogen.sh