summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--ftp.c30
-rw-r--r--ftp.h1
-rw-r--r--po/rpm.pot28
4 files changed, 47 insertions, 14 deletions
diff --git a/CHANGES b/CHANGES
index 39e892954..850841a57 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,6 @@
2.90 -> 2.91
+ - add callbacks for installer updates while doing URL xfers.
+ - resurrect http queries/verifies.
- create rpmbzio.c to avoid implicit dependence on libbz2 for installer.
- spec files can provide /filename now
- added rpmdbOpenForTraversal()
diff --git a/ftp.c b/ftp.c
index 01a0c909d..db91daad8 100644
--- a/ftp.c
+++ b/ftp.c
@@ -29,6 +29,7 @@ extern int h_errno;
#include <arpa/inet.h>
#include <arpa/telnet.h>
+#include "rpmlib.h"
#include "rpmio.h"
#if !defined(HAVE_INET_ATON)
@@ -53,6 +54,16 @@ static int ftpDebug = 0;
static int ftpTimeoutSecs = TIMEOUT_SECS;
static int httpTimeoutSecs = TIMEOUT_SECS;
+static rpmCallbackFunction urlNotify = NULL;
+static void * urlNotifyData = NULL;
+static int urlNotifyCount = -1;
+
+void urlSetCallback(rpmCallbackFunction notify, void *notifyData, int notifyCount) {
+ urlNotify = notify;
+ urlNotifyData = notifyData;
+ urlNotifyCount = (notifyCount >= 0) ? notifyCount : 4096;
+}
+
static int checkResponse(int fd, int secs, int *ecp, char ** str) {
static char buf[BUFFER_SIZE + 1];
int bufLength = 0;
@@ -406,6 +417,12 @@ static int copyData(FD_t sfd, FD_t tfd) {
int bytesRead;
int bytesCopied = 0;
int rc;
+ int notifier = -1;
+
+ if (urlNotify) {
+ (*urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE,
+ 0, 0, NULL, urlNotifyData);
+ }
while (1) {
FD_ZERO(&emptySet);
@@ -435,11 +452,24 @@ static int copyData(FD_t sfd, FD_t tfd) {
break;
}
bytesCopied += bytesRead;
+ if (urlNotify && urlNotifyCount > 0) {
+ int n = bytesCopied/urlNotifyCount;
+ if (n != notifier) {
+ (*urlNotify) (NULL, RPMCALLBACK_INST_PROGRESS,
+ bytesCopied, 0, NULL, urlNotifyData);
+ notifier = n;
+ }
+ }
}
if (ftpDebug)
fprintf(stderr, "++ copied %d bytes: %s\n", bytesCopied, ftpStrerror(rc));
+ if (urlNotify) {
+ (*urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE,
+ bytesCopied, bytesCopied, NULL, urlNotifyData);
+ }
+
fdClose(sfd);
return rc;
}
diff --git a/ftp.h b/ftp.h
index 54eefe8cd..856adf986 100644
--- a/ftp.h
+++ b/ftp.h
@@ -16,6 +16,7 @@ const char * ftpStrerror(int ftpErrno);
#define FTPERR_NIC_ABORT_IN_PROGRESS -11
#define FTPERR_UNKNOWN -100
+void urlSetCallback(rpmCallbackFunction notify, void *notifyData, int notifyCount);
int httpOpen(urlinfo *u);
int ftpOpen(urlinfo *u);
diff --git a/po/rpm.pot b/po/rpm.pot
index 0d8fbe4f8..5013a724d 100644
--- a/po/rpm.pot
+++ b/po/rpm.pot
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-02-15 21:09-0500\n"
+"POT-Creation-Date: 1999-02-15 21:37-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -204,55 +204,55 @@ msgstr ""
msgid "rpmconvert 1.0 - converting database in /var/lib/rpm\n"
msgstr ""
-#: ../ftp.c:617
+#: ../ftp.c:647
msgid "Success"
msgstr ""
-#: ../ftp.c:620
+#: ../ftp.c:650
msgid "Bad server response"
msgstr ""
-#: ../ftp.c:623
+#: ../ftp.c:653
msgid "Server IO error"
msgstr ""
-#: ../ftp.c:626
+#: ../ftp.c:656
msgid "Server timeout"
msgstr ""
-#: ../ftp.c:629
+#: ../ftp.c:659
msgid "Unable to lookup server host address"
msgstr ""
-#: ../ftp.c:632
+#: ../ftp.c:662
msgid "Unable to lookup server host name"
msgstr ""
-#: ../ftp.c:635
+#: ../ftp.c:665
msgid "Failed to connect to server"
msgstr ""
-#: ../ftp.c:638
+#: ../ftp.c:668
msgid "Failed to establish data connection to server"
msgstr ""
-#: ../ftp.c:641
+#: ../ftp.c:671
msgid "IO error to local file"
msgstr ""
-#: ../ftp.c:644
+#: ../ftp.c:674
msgid "Error setting remote server to passive mode"
msgstr ""
-#: ../ftp.c:647
+#: ../ftp.c:677
msgid "File not found on server"
msgstr ""
-#: ../ftp.c:650
+#: ../ftp.c:680
msgid "Abort in progress"
msgstr ""
-#: ../ftp.c:654
+#: ../ftp.c:684
msgid "Unknown or unexpected error"
msgstr ""