Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Another try to be compatible with 1.2
Vsevolod Stakhov committed 11 years ago
commit 363ba5bdc0369266917fafcb5f98f4844e482e5b
parent 2dd9f80
2 files changed +15 -9
modified libpkg/pkg_manifest.c
@@ -1,6 +1,7 @@
/*-
 * Copyright (c) 2011-2014 Baptiste Daroussin <bapt@FreeBSD.org>
 * Copyright (c) 2011-2012 Julien Laffaye <jlaffaye@FreeBSD.org>
+
 * Copyright (c) 2013-2014 Vsevolod Stakhov <vsevolod@FreeBSD.org>
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
@@ -851,7 +852,7 @@ pkg_emit_object(struct pkg *pkg, short flags)
	struct pkg_provide	*provide  = NULL;
	struct sbuf		*tmpsbuf  = NULL;
	int i;
-
	const char *comment, *desc, *message;
+
	const char *comment, *desc, *message, *repopath;
	const char *script_types = NULL;
	lic_t licenselogic;
	int64_t pkgsize;
@@ -868,7 +869,6 @@ pkg_emit_object(struct pkg *pkg, short flags)
		PKG_MAINTAINER,
		PKG_PREFIX,
		PKG_WWW,
-
		PKG_REPOPATH,
		PKG_CKSUM,
		PKG_FLATSIZE,
		-1
@@ -877,7 +877,7 @@ pkg_emit_object(struct pkg *pkg, short flags)
	pkg_get(pkg, PKG_COMMENT, &comment, PKG_LICENSE_LOGIC, &licenselogic,
	    PKG_DESC, &desc, PKG_MESSAGE, &message, PKG_PKGSIZE, &pkgsize,
	    PKG_ANNOTATIONS, &annotations, PKG_LICENSES, &licenses,
-
	    PKG_CATEGORIES, &categories);
+
	    PKG_CATEGORIES, &categories, PKG_REPOPATH, &repopath);

	pkg_debug(4, "Emitting basic metadata");
	for (i = 0; recopies[i] != -1; i++) {
@@ -887,7 +887,18 @@ pkg_emit_object(struct pkg *pkg, short flags)
			    key, strlen(key), false);
	}
	if (comment)
-
		ucl_object_insert_key(top, ucl_object_fromstring_common(comment, 0, UCL_STRING_TRIM), "comment", 7, false);
+
		ucl_object_insert_key(top, ucl_object_fromstring_common(comment, 0,
+
			UCL_STRING_TRIM), "comment", 7, false);
+
	/*
+
	 * XXX: dirty hack to be compatible with pkg 1.2
+
	 */
+
	if (repopath) {
+
		ucl_object_insert_key(top,
+
			ucl_object_fromstring(repopath), "path", sizeof("path") - 1, false);
+
		ucl_object_insert_key(top,
+
			ucl_object_fromstring(repopath), "repopath", sizeof("repopath") - 1,
+
			false);
+
	}

	switch (licenselogic) {
	case LICENSE_SINGLE:
modified libpkg/pkg_repo_create.c
@@ -323,11 +323,6 @@ pkg_create_repo_worker(struct pkg_fts_item *start, size_t nelts,
			pkg_get(pkg, PKG_ORIGIN, &origin);

			/*
-
			 * XXX: dirty hack to be compatible with pkg 1.2
-
			 */
-
			ucl_object_insert_key(pkg->fields,
-
				ucl_object_fromstring(cur->pkg_path), "path", 0, false);
-
			/*
			 * TODO: use pkg_checksum for new manifests
			 */
			sbuf_clear(b);