From d382b052139e821a8a95a0b3727700befcadab96 Mon Sep 17 00:00:00 2001
From: imilh
Date: Wed, 13 Jun 2012 13:50:16 +0000
Subject: [PATCH] various misc patches submitted by Jeremy Reed
---
Makefile.in | 4 +++-
external/automatic.c | 2 ++
external/decompress.c | 2 ++
external/defs.h | 2 ++
external/dewey.c | 2 ++
external/fexec.c | 2 ++
external/global.c | 2 ++
external/lib.h | 6 ++----
external/opattern.c | 2 ++
external/pkgdb.c | 2 ++
external/var.c | 2 ++
fsops.c | 3 ++-
htdocs/index.html | 11 ++++++++++-
main.c | 4 ++--
pkgin.1 | 10 +++++++++-
repositories.conf | 8 ++++++--
summary.c | 7 ++++---
tools.c | 6 +++---
tools.h | 6 ++----
19 files changed, 61 insertions(+), 22 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 0816201..8c1ec89 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.in,v 1.19 2012/05/30 09:27:12 imilh Exp $
+# $Id: Makefile.in,v 1.20 2012/06/13 13:50:16 imilh Exp $
PROG= pkgin
VERSION= @PACKAGE_VERSION@
@@ -79,6 +79,8 @@ CPPFLAGS+= -D_LARGEFILE_SOURCE -D_LARGE_FILES
CPPFLAGS+= -DCHECK_MACHINE_ARCH=\"${MACHINE_ARCH}\"
CPPFLAGS+= -Iexternal -I. -I${LOCALBASE}/include
+LDFLAGS+= @LDFLAGS@
+
LDADD+= -L${LOCALBASE}/lib @RPATH@,${LOCALBASE}/lib \
-lbz2 -lz -larchive @LIBS@
LDADD+= -lsqlite3
diff --git a/external/automatic.c b/external/automatic.c
index 10cbf78..73576f4 100644
--- a/external/automatic.c
+++ b/external/automatic.c
@@ -35,7 +35,9 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_SYS_CDEFS_H
#include
#endif
diff --git a/external/decompress.c b/external/decompress.c
index 634c1e4..57d4e57 100644
--- a/external/decompress.c
+++ b/external/decompress.c
@@ -31,7 +31,9 @@
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_SYS_CDEFS_H
#include
diff --git a/external/defs.h b/external/defs.h
index 318582a..d0d5a01 100644
--- a/external/defs.h
+++ b/external/defs.h
@@ -36,7 +36,9 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_ERR_H
#include
#endif
diff --git a/external/dewey.c b/external/dewey.c
index ca3c814..10117e4 100644
--- a/external/dewey.c
+++ b/external/dewey.c
@@ -31,7 +31,9 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_CTYPE_H
#include
diff --git a/external/fexec.c b/external/fexec.c
index d613a82..4caa585 100644
--- a/external/fexec.c
+++ b/external/fexec.c
@@ -31,7 +31,9 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_SYS_CDEFS_H
#include
#endif
diff --git a/external/global.c b/external/global.c
index ad45b18..2e7fbfb 100644
--- a/external/global.c
+++ b/external/global.c
@@ -3,7 +3,9 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_SYS_CDEFS_H
#include
#endif
diff --git a/external/lib.h b/external/lib.h
index 406dfbb..c9db5b4 100644
--- a/external/lib.h
+++ b/external/lib.h
@@ -28,7 +28,9 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_SYS_PARAM_H
#include
#endif
@@ -69,10 +71,6 @@
#include "path.h"
-#ifndef __UNCONST
-#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
-#endif
-
/* Macros */
#define SUCCESS (0)
#define FAIL (-1)
diff --git a/external/opattern.c b/external/opattern.c
index e9dc84e..852fb97 100644
--- a/external/opattern.c
+++ b/external/opattern.c
@@ -3,7 +3,9 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_SYS_CDEFS_H
#include
#endif
diff --git a/external/pkgdb.c b/external/pkgdb.c
index e073056..a687555 100644
--- a/external/pkgdb.c
+++ b/external/pkgdb.c
@@ -3,7 +3,9 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_SYS_CDEFS_H
#include
#endif
diff --git a/external/var.c b/external/var.c
index e6c0918..0d895a2 100644
--- a/external/var.c
+++ b/external/var.c
@@ -35,7 +35,9 @@
#if HAVE_CONFIG_H
#include "config.h"
#endif
+#if HAVE_NBCOMPAT_H
#include
+#endif
#if HAVE_SYS_CDEFS_H
#include
#endif
diff --git a/fsops.c b/fsops.c
index 927cbd0..7750186 100644
--- a/fsops.c
+++ b/fsops.c
@@ -1,4 +1,4 @@
-/* $Id: fsops.c,v 1.2 2012/04/15 11:48:56 imilh Exp $ */
+/* $Id: fsops.c,v 1.3 2012/06/13 13:50:17 imilh Exp $ */
/*
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
#include "pkgin.h"
#include
+#include
#define FILE_OFFSET_BITS 64 /* needed for large filesystems on sunos */
diff --git a/htdocs/index.html b/htdocs/index.html
index 20a8f3d..1aaef5c 100644
--- a/htdocs/index.html
+++ b/htdocs/index.html
@@ -49,8 +49,17 @@ Disclaimer
Prerequisites
- pkgin is developed using the C language. It uses sqlite3
as a package database backend, in order to provide good speed on older architectures. SQLite is included in pkgin's source tree so you don't have to install it by yourself, it will simply be built along with pkgin.
+ pkgin is developed using the C language. It uses sqlite3
as a package database backend, in order to provide good speed on older architectures.
+ If you wish to build pkgin from sources, the following dependencies must be met
+
+ databases/sqlite3
+ pkgtools/libnbcompat
(yes, even for NetBSD)
+ net/libfetch
+ archivers/libarchive
+
+Since NetBSD 6.0, all of those are provided as part of the base system, except for libnbcompat
.
+
Pkgin
is available via CVS, pkgsrc-wip and is available in pkgsrc as pkgtools/pkgin
.
diff --git a/main.c b/main.c
index d6a0eac..fa2223d 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.29 2012/05/28 10:56:27 imilh Exp $ */
+/* $Id: main.c,v 1.30 2012/06/13 13:50:17 imilh Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@ main(int argc, char *argv[])
argv += optind;
if (argc < 1) {
- fprintf(stderr, MSG_MISSING_CMD);
+ fprintf(stderr, "%s\n", MSG_MISSING_CMD);
usage();
/* NOTREACHED */
}
diff --git a/pkgin.1 b/pkgin.1
index 72627cf..5e8653e 100644
--- a/pkgin.1
+++ b/pkgin.1
@@ -195,9 +195,17 @@ space separated repositories in order to override
.Sh FILES
.Bl -tag -width Ds -compact
.It /usr/pkg/etc/pkgin/repositories.conf
-This file contains a list of repositories that
+This file contains a list of repository URIs that
.Nm
will use.
+It may contain macros
+.Va $arch
+to define the machine hardware platform
+and
+.Va $osrelease
+to define the release version for the operating system
+(as reported by
+.Xr uname 3 ) .
.El
.Sh EXAMPLES
.Pp
diff --git a/repositories.conf b/repositories.conf
index 9f2932c..c7a4d90 100644
--- a/repositories.conf
+++ b/repositories.conf
@@ -1,13 +1,17 @@
-# $Id: repositories.conf,v 1.2 2011/09/16 10:17:42 imilh Exp $
+# $Id: repositories.conf,v 1.3 2012/06/13 13:50:17 imilh Exp $
#
# Pkgin repositories list
#
-# Simply add repositories one below the other
+# Simply add repositories URIs one below the other
#
# WARNING: order matters, duplicates will not be added, if two
# repositories hold the same package, it will be fetched from
# the first one listed in this file.
#
+# This file format supports the following macros:
+# $arch to define the machine hardware platform
+# $osrelease to define the release version for the operating system
+#
# Remote ftp repository
#
# ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/$arch/5.1/All
diff --git a/summary.c b/summary.c
index 3e2d5bb..10be503 100644
--- a/summary.c
+++ b/summary.c
@@ -1,4 +1,4 @@
-/* $Id: summary.c,v 1.31 2012/05/28 12:25:14 imilh Exp $ */
+/* $Id: summary.c,v 1.32 2012/06/13 13:50:17 imilh Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2012 The NetBSD Foundation, Inc.
@@ -395,6 +395,7 @@ update_col(struct Summary sum, int pkgid, char *line)
}
}
+/* default version for (rare and buggy) packages with a version */
#define NOVERSION "-0.0"
static void
@@ -577,8 +578,9 @@ update_localdb(char **pkgkeep)
*/
if ((nokeeplisthead =
rec_pkglist(NOKEEP_LOCAL_PKGS)) != NULL) {
- SLIST_FOREACH(pkglist, nokeeplisthead, next)
+ SLIST_FOREACH(pkglist, nokeeplisthead, next) {
mark_as_automatic_installed(pkglist->full, 1);
+ }
free_pkglist(&nokeeplisthead, LIST);
}
@@ -658,7 +660,6 @@ update_remotedb(void)
cleaned = 1;
}
-
printf(MSG_PROCESSING_REMOTE_SUMMARY, *prepos);
/* delete remote* associated to this repository */
diff --git a/tools.c b/tools.c
index 572c7bb..d0998cb 100644
--- a/tools.c
+++ b/tools.c
@@ -1,4 +1,4 @@
-/* $Id: tools.c,v 1.3 2011/10/06 15:13:49 imilh Exp $ */
+/* $Id: tools.c,v 1.4 2012/06/13 13:50:17 imilh Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -191,7 +191,7 @@ exec_list(const char *cmd, const char *match)
return(res);
}
-T_Bool
+uint8_t
is_listed(const char **list, const char *item)
{
for (; *list != NULL; list++)
@@ -273,7 +273,7 @@ strreplace(char *str, const char *from, const char *to)
fromlen = strlen(from);
tolen = strlen(to);
- for (i = 0, p = str; *p != 0;) {
+ for (i = 0, p = str; *p != '\0';) {
if (strncmp(p, from, fromlen) == 0) {
strncat(buf, to, tolen);
p += fromlen;
diff --git a/tools.h b/tools.h
index b9eeb6c..24de6dc 100644
--- a/tools.h
+++ b/tools.h
@@ -1,4 +1,4 @@
-/* $Id: tools.h,v 1.3 2011/10/06 15:13:49 imilh Exp $ */
+/* $Id: tools.h,v 1.4 2012/06/13 13:50:17 imilh Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -189,8 +189,6 @@
dst = pdst; \
} while (/* CONSTCOND */ 0)
-typedef uint8_t T_Bool;
-
#ifndef SLIST_FOREACH_MUTABLE /* from DragonFlyBSD */
#define SLIST_FOREACH_MUTABLE(var, head, field, tvar) \
for ((var) = SLIST_FIRST((head)); \
@@ -206,7 +204,7 @@ extern int min(int, int);
extern int max(int, int);
extern int listlen(const char **);
extern char **exec_list(const char *, const char *);
-extern T_Bool is_listed(const char **, const char *);
+extern uint8_t is_listed(const char **, const char *);
extern void do_log(const char *, const char *, ...);
extern void trunc_str(char *, char, int);
extern char *safe_snprintf(int, const char *, ...);