Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Now first trivial (shells/dash) installation works with garbage but works with FORCE_REGISTER and PKG_CMD=/usr/sbin/pkg
Baptiste Daroussin committed 15 years ago
commit 2eef485b34ca45f969bacc402d506f3311c32db7
parent 571b16dedf7998946efc483cfd6db57253729fe9
2 files changed +18 -5
modified libpkg/pkg_ports.c
@@ -5,11 +5,12 @@
#include <err.h>
#include <string.h>
#include <stdio.h>
+
#include <stdlib.h>

int
ports_parse_plist(struct pkg *pkg, char *plist, const char *prefix)
{
-
	char *plist_p, *buf, *p;
+
	char *plist_p, *buf, *p, *plist_buf;
	int nbel, i;
	size_t next;
	char sha256[65];
@@ -22,15 +23,19 @@ ports_parse_plist(struct pkg *pkg, char *plist, const char *prefix)
	if (plist == NULL)
		return (-1);

+
	if (file_to_buffer(plist, &plist_buf) <= 0)
+
		return (-1);
+

	if (prefix == NULL)
		prefix = "/usr/local";

-
	nbel = split_chr(plist, '\n');
+
	nbel = split_chr(plist_buf, '\n');

-
	next = strlen(plist);
-
	plist_p = plist;
+
	next = strlen(plist_buf);
+
	plist_p = plist_buf;

	for (i = 0; i <= nbel; i++) {
+
		printf("===>%s\n", plist_p);
		if (plist_p[0] == '@') {
			if (STARTS_WITH(plist_p, "@cwd ")) {
				buf = plist_p;
@@ -55,7 +60,6 @@ ports_parse_plist(struct pkg *pkg, char *plist, const char *prefix)
			if (p)
				pkg_addfile(pkg, path, p);
			else {
-
				warn("%s \n", path);
				ret--;
			}
		}
@@ -63,6 +67,9 @@ ports_parse_plist(struct pkg *pkg, char *plist, const char *prefix)
		plist_p += next + 1;
		next = strlen(plist_p);
	}
+

+
	free(plist_buf);
+

	return (ret);
}

@@ -77,6 +84,9 @@ ports_parse_depends(struct pkg *pkg, char *depends)
	if (depends == NULL)
		return (-1);

+
	if (depends[0] == '\0')
+
		return (0);
+

	nbel = split_chr(depends, '\n');

	buf = NULL;
modified libpkg/pkgdb.c
@@ -520,6 +520,7 @@ pkgdb_register_pkg(struct pkgdb *db, struct pkg *pkg)

	deps = pkg_deps(pkg);

+
	if (deps != NULL)
	for (i = 0; deps[i] != NULL; i++) {
		sqlite3_bind_text(stmt_dep, 1, pkg_origin(deps[i]), -1, SQLITE_STATIC);
		sqlite3_bind_text(stmt_dep, 2, pkg_name(deps[i]), -1, SQLITE_STATIC);
@@ -532,6 +533,7 @@ pkgdb_register_pkg(struct pkgdb *db, struct pkg *pkg)
	}

	conflicts = pkg_conflicts(pkg);
+
	if (conflicts != NULL)
	for (i = 0; conflicts[i] != NULL; i++) {
		sqlite3_bind_text(stmt_conflicts, 1, pkg_conflict_glob(conflicts[i]), -1, SQLITE_STATIC);
		sqlite3_bind_text(stmt_conflicts, 2, pkg_origin(pkg), -1, SQLITE_STATIC);
@@ -539,6 +541,7 @@ pkgdb_register_pkg(struct pkgdb *db, struct pkg *pkg)


	files = pkg_files(pkg);
+
	if (files != NULL)
	for (i = 0; files[i] != NULL; i++) {
		sqlite3_bind_text(stmt_file, 1, pkg_file_path(files[i]), -1, SQLITE_STATIC);
		sqlite3_bind_text(stmt_file, 2, pkg_file_sha256(files[i]), -1, SQLITE_STATIC);