Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Merge remote-tracking branch 'upstream/master'
Marin Atanasov Nikolov committed 14 years ago
commit 0c21ced34149f5d95cf4d560d4f65dbc12697a80
parent e828fff
6 files changed +30 -7
modified libpkg/pkg_add.c
@@ -1,3 +1,5 @@
+
#include <sys/utsname.h>
+

#include <archive.h>
#include <archive_entry.h>
#include <assert.h>
@@ -86,6 +88,7 @@ pkg_add(struct pkgdb *db, const char *path)
	struct pkg *p = NULL;
	struct pkg *pkg = NULL;
	struct pkg_dep *dep = NULL;
+
	struct utsname u;
	bool extract = true;
	char dpath[MAXPATHLEN];
	const char *basedir;
@@ -108,6 +111,26 @@ pkg_add(struct pkgdb *db, const char *path)
		goto cleanup;
	}

+
	if (uname(&u) != 0) {
+
		EMIT_ERRNO("uname", "");
+
		retcode = EPKG_FATAL;
+
		goto cleanup;
+
	}
+

+
	/*
+
	 * Check the architecture
+
	 */
+
	if (strcmp(u.machine, pkg_get(pkg, PKG_ARCH)) != 0) {
+
		EMIT_PKG_ERROR("wrong architecture: %s instead of %s",
+
					   pkg_get(pkg, PKG_ARCH), u.machine);
+
		retcode = EPKG_FATAL;
+
		goto cleanup;
+
	}
+

+
	/*
+
	 * TODO: check the os version
+
	 */
+

	/*
	 * Check if the package is already installed
	 */
modified libpkg/scripts.c
@@ -4,15 +4,15 @@
#include "pkg_private.h"

int
-
pkg_script_run(struct pkg *pkg, pkg_script_t type)
+
pkg_script_run(struct pkg * const pkg, pkg_script_t type)
{
	struct pkg_script *script = NULL;
	pkg_script_t stype;
-
	struct sbuf *script_cmd = sbuf_new_auto();
+
	struct sbuf * const script_cmd = sbuf_new_auto();
	size_t i;

	struct {
-
		const char *arg;
+
		const char * const arg;
		const pkg_script_t b;
		const pkg_script_t a;
	} const map[] = {
modified pkg/add.c
@@ -14,7 +14,7 @@
#include "add.h"

static int
-
is_url(const char *pattern)
+
is_url(const char * const pattern)
{
	if (strncmp(pattern, "http://", 7) == 0 ||
		strncmp(pattern, "https://", 8) == 0 ||
modified pkg/create.c
@@ -20,7 +20,7 @@ usage_create(void)
}

static int
-
pkg_create_matches(int argc, char **argv, match_t match, pkg_formats fmt, const char *outdir, const char *rootdir)
+
pkg_create_matches(int argc, char **argv, match_t match, pkg_formats fmt, const char * const outdir, const char * const rootdir)
{
	int i, ret = EPKG_OK, retcode = EPKG_OK;
	struct pkgdb *db = NULL;
modified pkg/info.c
@@ -21,7 +21,7 @@ enum sign {
};

static int
-
print_info(struct pkg *pkg, unsigned int opt)
+
print_info(struct pkg * const pkg, unsigned int opt)
{
	struct pkg_dep *dep = NULL;
	struct pkg_file *file = NULL;
modified pkg/register.c
@@ -15,7 +15,7 @@

#include "register.h"

-
static const char *scripts[] = {
+
static const char * const scripts[] = {
	"+INSTALL",
	"+PRE_INSTALL",
	"+POST_INSTALL",