Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Initial adoption of OS X compatibility shims.
Landon Fuller committed 11 years ago
commit 753c3af794cf487eda8f13fdb704fc5a25a8eed9
parent 45cf3f3
15 files changed +60 -11
modified libpkg/backup.c
@@ -35,6 +35,8 @@
#include "private/pkg.h"
#include "private/pkgdb.h"

+
#include <bsd_compat.h>
+

/* Number of pages to copy per call to sqlite3_backup_step()
   Default page size is 1024 bytes on Unix */
#define NPAGES	4
@@ -129,8 +131,8 @@ pkgdb_dump(struct pkgdb *db, const char *dest)
		}

		/* Could we create the Sqlite DB file? */
-
		if (eaccess(dirname(dest), W_OK)) {
-
			pkg_emit_error("eaccess(%s) -- %s", dirname(dest),
+
		if (eaccess(bsd_dirname(dest), W_OK)) {
+
			pkg_emit_error("eaccess(%s) -- %s", bsd_dirname(dest),
			    strerror(errno));
			return (EPKG_FATAL);
		}
modified libpkg/fetch.c
@@ -29,6 +29,7 @@
#include <sys/param.h>
#include <sys/wait.h>
#include <sys/socket.h>
+
#include <sys/time.h>

#include <ctype.h>
#include <fcntl.h>
@@ -40,6 +41,8 @@
#include <paths.h>
#include <poll.h>

+
#include <bsd_compat.h>
+

#include "pkg.h"
#include "private/event.h"
#include "private/pkg.h"
@@ -174,7 +177,7 @@ ssh_read(void *data, char *buf, int len)
		timeout.tv_sec += fetchTimeout;
	}

-
	deltams = INFTIM;
+
	deltams = -1;
	memset(&pfd, 0, sizeof pfd);
	pfd.fd = repo->sshio.in;
	pfd.events = POLLIN | POLLERR;
modified libpkg/pkg_delete.c
@@ -35,6 +35,8 @@
#include <stdlib.h>
#include <fcntl.h>

+
#include <bsd_compat.h>
+

#include "pkg.h"
#include "private/event.h"
#include "private/pkg.h"
modified libpkg/pkg_elf.c
@@ -59,6 +59,8 @@
#include <libelf.h>
#endif

+
#include <bsd_compat.h>
+

#include "pkg.h"
#include "private/pkg.h"
#include "private/event.h"
@@ -377,7 +379,7 @@ analyse_elf(struct pkg *pkg, const char *fpath,
			continue;
		
		shlib_list_from_rpath(elf_strptr(e, sh_link, dyn->d_un.d_val),
-
				      dirname(fpath));
+
				      bsd_dirname(fpath));
		break;
	}
	if (!is_shlib) {
@@ -387,7 +389,7 @@ analyse_elf(struct pkg *pkg, const char *fpath,
		 */
		if (elfhdr.e_type == ET_DYN) {
			is_shlib = true;
-
			pkg_addshlib_provided(pkg, basename(fpath));
+
			pkg_addshlib_provided(pkg, bsd_basename(fpath));
		}
	}

modified libpkg/pkg_jobs.c
@@ -28,6 +28,10 @@
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+
#ifdef HAVE_CONFIG_H
+
#include "pkg_config.h"
+
#endif
+

#include <sys/param.h>
#include <sys/mount.h>
#include <sys/types.h>
@@ -36,13 +40,17 @@
#include <archive_entry.h>
#include <assert.h>
#include <errno.h>
+
#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
+
#endif
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <ctype.h>

+
#include <bsd_compat.h>
+

#include "utarray.h"

#include "pkg.h"
modified libpkg/pkg_jobs_universe.c
@@ -21,12 +21,18 @@
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+
#ifdef HAVE_CONFIG_H
+
#include "pkg_config.h"
+
#endif
+

#include <sys/param.h>
#include <sys/types.h>

#include <assert.h>
#include <errno.h>
+
#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
+
#endif
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
modified libpkg/pkgdb.c
@@ -32,6 +32,10 @@
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+
#ifdef HAVE_CONFIG_H
+
#include "pkg_config.h"
+
#endif
+

#include <sys/param.h>
#include <sys/mount.h>

@@ -39,7 +43,9 @@
#include <errno.h>
#include <regex.h>
#include <grp.h>
+
#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
+
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
modified libpkg/pkgdb_iterator.c
@@ -32,11 +32,17 @@
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+
#ifdef HAVE_CONFIG_H
+
#include "pkg_config.h"
+
#endif
+

#include <assert.h>
#include <errno.h>
#include <regex.h>
#include <grp.h>
+
#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
+
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
@@ -46,6 +52,8 @@

#include <sqlite3.h>

+
#include <bsd_compat.h>
+

#include "pkg.h"
#include "private/event.h"
#include "private/pkg.h"
modified libpkg/pkgdb_query.c
@@ -32,11 +32,17 @@
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

+
#ifdef HAVE_CONFIG_H
+
#include "pkg_config.h"
+
#endif
+

#include <assert.h>
#include <errno.h>
#include <regex.h>
#include <grp.h>
+
#ifdef HAVE_LIBUTIL_H
#include <libutil.h>
+
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
modified libpkg/repo/binary/Makefile.am
@@ -1,4 +1,5 @@
pkg_common_cflags=	-I$(top_srcdir)/libpkg -I$(top_builddir)/libpkg \
+
			-I$(top_srcdir)/compat \
			-I$(top_srcdir)/external/libsbuf \
			@LDNS_CFLAGS@ \
			-I$(top_srcdir)/external/expat/lib \
modified libpkg/repo/binary/binary_private.h
@@ -539,7 +539,7 @@ typedef enum _sql_prstmt_index {
	ANNOTATE1,
	ANNOTATE2,
	EXISTS,
-
	VERSION,
+
	REPO_VERSION,
	DELETE,
	FTS_APPEND,
	PRSTMT_LAST,
modified libpkg/repo/binary/common.c
@@ -121,7 +121,7 @@ static sql_prstmt sql_prepared_statements[PRSTMT_LAST] = {
		" (SELECT annotation_id FROM annotation WHERE annotation=?3))",
		"ITT",
	},
-
	[VERSION] = {
+
	[REPO_VERSION] = {
		NULL,
		"SELECT version FROM packages WHERE origin=?1",
		"T",
modified libpkg/repo/binary/init.c
@@ -37,6 +37,8 @@

#include <sqlite3.h>

+
#include <bsd_compat.h>
+

#include "pkg.h"
#include "private/event.h"
#include "private/pkg.h"
@@ -50,7 +52,7 @@ sqlite_file_exists(sqlite3_context *ctx, int argc, sqlite3_value **argv)
{
	char	 fpath[MAXPATHLEN];
	sqlite3	*db = sqlite3_context_db_handle(ctx);
-
	char	*path = dirname(sqlite3_db_filename(db, "main"));
+
	char	*path = bsd_dirname(sqlite3_db_filename(db, "main"));
	char	 cksum[SHA256_DIGEST_LENGTH * 2 +1];

	if (argc != 2) {
modified libpkg/repo/binary/update.c
@@ -27,6 +27,7 @@
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/mman.h>
+
#include <sys/time.h>

#define _WITH_GETLINE
#include <stdio.h>
@@ -89,11 +90,11 @@ pkg_repo_binary_delete_conflicting(const char *origin, const char *version,
	int ret = EPKG_FATAL;
	const char *oversion;

-
	if (pkg_repo_binary_run_prstatement(VERSION, origin) != SQLITE_ROW) {
+
	if (pkg_repo_binary_run_prstatement(REPO_VERSION, origin) != SQLITE_ROW) {
		ret = EPKG_FATAL;
		goto cleanup;
	}
-
	oversion = sqlite3_column_text(pkg_repo_binary_stmt_prstatement(VERSION), 0);
+
	oversion = sqlite3_column_text(pkg_repo_binary_stmt_prstatement(REPO_VERSION), 0);
	if (!forced) {
		switch(pkg_version_cmp(oversion, version)) {
		case -1:
@@ -125,7 +126,7 @@ pkg_repo_binary_delete_conflicting(const char *origin, const char *version,
	}

cleanup:
-
	sqlite3_reset(pkg_repo_binary_stmt_prstatement(VERSION));
+
	sqlite3_reset(pkg_repo_binary_stmt_prstatement(REPO_VERSION));

	return (ret);
}
modified libpkg/ssh.c
@@ -43,6 +43,8 @@
#include <unistd.h>
#include <fcntl.h>

+
#include <bsd_compat.h>
+

#include "pkg.h"
#include "private/event.h"