summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-01-19 23:59:28 +0000
committerjbj <devnull@localhost>1999-01-19 23:59:28 +0000
commit459dc6ef3eb334df673c514b67c1e343942b9a1c (patch)
tree97ff5e50d14132bf8055b67d1345394875e9902f
parent903b747e028caf47d1b0f19d546b11a5c5732f00 (diff)
downloadlibrpm-tizen-459dc6ef3eb334df673c514b67c1e343942b9a1c.tar.gz
librpm-tizen-459dc6ef3eb334df673c514b67c1e343942b9a1c.tar.bz2
librpm-tizen-459dc6ef3eb334df673c514b67c1e343942b9a1c.zip
create rpmbzio.c to avoid implicit dependence on libbz2 for installer.
CVS patchset: 2727 CVS date: 1999/01/19 23:59:28
-rw-r--r--CHANGES1
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/Makefile.in10
-rw-r--r--lib/rpmbzio.c68
4 files changed, 75 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index b481e5725..4ab54b8e6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,5 @@
2.90 -> 2.91
+ - create rpmbzio.c to avoid implicit dependence on libbz2 for installer.
2.5.x -> 2.90
- added --excludepath
diff --git a/lib/Makefile.am b/lib/Makefile.am
index bdc1a775c..6c8394dfb 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -18,7 +18,7 @@ librpm_a_SOURCES = \
formats.c fs.c header.c install.c \
lookup.c macro.c md5.c md5sum.c \
messages.c misc.c oldheader.c package.c query.c \
- rebuilddb.c rpmdb.c rpmerr.c rpmio.c rpmlead.c \
+ rebuilddb.c rpmdb.c rpmerr.c rpmio.c rpmbzio.c rpmlead.c \
rpmrc.c signature.c stringbuf.c tagtable.c \
tread.c uninstall.c verify.c transaction.c problems.c hash.c fprint.c
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 1a8d9b969..6cad45ec9 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -120,7 +120,7 @@ noinst_HEADERS = cpio.h depends.h falloc.h install.h md5.h oldheader.h oldrpm
lib_LIBRARIES = librpm.a
-librpm_a_SOURCES = cpio.c dbindex.c depends.c falloc.c formats.c fs.c header.c install.c lookup.c macro.c md5.c md5sum.c messages.c misc.c oldheader.c package.c query.c rebuilddb.c rpmdb.c rpmerr.c rpmio.c rpmlead.c rpmrc.c signature.c stringbuf.c tagtable.c tread.c uninstall.c verify.c transaction.c problems.c hash.c fprint.c
+librpm_a_SOURCES = cpio.c dbindex.c depends.c falloc.c formats.c fs.c header.c install.c lookup.c macro.c md5.c md5sum.c messages.c misc.c oldheader.c package.c query.c rebuilddb.c rpmdb.c rpmerr.c rpmio.c rpmbzio.c rpmlead.c rpmrc.c signature.c stringbuf.c tagtable.c tread.c uninstall.c verify.c transaction.c problems.c hash.c fprint.c
CPP = gcc -E
@@ -159,7 +159,7 @@ librpm_a_LIBADD =
librpm_a_OBJECTS = cpio.o dbindex.o depends.o falloc.o formats.o fs.o \
header.o install.o lookup.o macro.o md5.o md5sum.o messages.o misc.o \
oldheader.o package.o query.o rebuilddb.o rpmdb.o rpmerr.o rpmio.o \
-rpmlead.o rpmrc.o signature.o stringbuf.o tagtable.o tread.o \
+rpmbzio.o rpmlead.o rpmrc.o signature.o stringbuf.o tagtable.o tread.o \
uninstall.o verify.o transaction.o problems.o hash.o fprint.o
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -178,9 +178,9 @@ DEP_FILES = .deps/cpio.P .deps/dbindex.P .deps/depends.P .deps/falloc.P \
.deps/formats.P .deps/fprint.P .deps/fs.P .deps/hash.P .deps/header.P \
.deps/install.P .deps/lookup.P .deps/macro.P .deps/md5.P .deps/md5sum.P \
.deps/messages.P .deps/misc.P .deps/oldheader.P .deps/package.P \
-.deps/problems.P .deps/query.P .deps/rebuilddb.P .deps/rpmdb.P \
-.deps/rpmerr.P .deps/rpmio.P .deps/rpmlead.P .deps/rpmrc.P \
-.deps/signature.P .deps/stringbuf.P .deps/tagtable.P \
+.deps/problems.P .deps/query.P .deps/rebuilddb.P .deps/rpmbzio.P \
+.deps/rpmdb.P .deps/rpmerr.P .deps/rpmio.P .deps/rpmlead.P \
+.deps/rpmrc.P .deps/signature.P .deps/stringbuf.P .deps/tagtable.P \
.deps/transaction.P .deps/tread.P .deps/uninstall.P .deps/verify.P
SOURCES = $(librpm_a_SOURCES)
OBJECTS = $(librpm_a_OBJECTS)
diff --git a/lib/rpmbzio.c b/lib/rpmbzio.c
new file mode 100644
index 000000000..60c4d04ba
--- /dev/null
+++ b/lib/rpmbzio.c
@@ -0,0 +1,68 @@
+#include "system.h"
+
+#include "rpmlib.h"
+
+#include "rpmio.h"
+
+/* =============================================================== */
+/* Support for BZIP2 library.
+ */
+#ifdef HAVE_BZLIB_H
+
+#include <bzlib.h>
+
+BZFILE * bzdFileno(FD_t fd) {
+ return (fd != NULL ? ((BZFILE *)fd->fd_bzd) : NULL);
+}
+
+/*@null@*/ FD_t bzdOpen(const char *pathname, const char *mode) {
+ FD_t fd;
+ BZFILE *bzfile;;
+ if ((bzfile = bzopen(pathname, mode)) == NULL)
+ return NULL;
+ fd = fdNew();
+ fd->fd_bzd = bzfile;
+ return fd;
+}
+
+/*@shared@*/ FD_t bzdFdopen(FD_t fd, const char *mode) {
+ BZFILE *bzfile = bzdopen(fdFileno(fd), mode);
+ if (bzfile != NULL) {
+ fd->fd_fd = -1;
+ fd->fd_bzd = bzfile;
+ return fd;
+ }
+ return NULL;
+}
+
+ssize_t bzdRead(FD_t fd, void * buf, size_t count) {
+ return bzread(bzdFileno(fd), buf, count);
+}
+
+ssize_t bzdWrite(FD_t fd, const void * buf, size_t count) {
+ return bzwrite(bzdFileno(fd), (void *)buf, count);
+}
+
+int bzdFlush(FD_t fd) {
+ return bzflush(bzdFileno(fd));
+}
+
+char * bzdStrerror(FD_t fd) {
+ int bzerr;
+ return (char *)bzerror(bzdFileno(fd), &bzerr);
+}
+
+int bzdClose(/*@only@*/ FD_t fd) {
+ BZFILE *bzfile;
+
+ if (fd != NULL && (bzfile = bzdFileno(fd)) != NULL) {
+ fd->fd_fd = -1;
+ fd->fd_bzd = NULL;
+ fd->fd_gzd = NULL;
+ free(fd);
+ bzclose(bzfile);
+ return 0;
+ }
+ return -2;
+}
+#endif /* HAVE_BZLIB_H */