Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
altabi: rename the private field arch into altabi
Baptiste Daroussin committed 1 year ago
commit 72cc0cdb3118d6367f1e2b7284830370a73f1767
parent 326a23e
12 files changed +39 -38
modified libpkg/pkg.c
@@ -56,7 +56,7 @@ pkg_free(struct pkg *pkg)
	free(pkg->version);
	free(pkg->maintainer);
	free(pkg->www);
-
	free(pkg->arch);
+
	free(pkg->altabi);
	free(pkg->abi);
	free(pkg->uid);
	free(pkg->digest);
@@ -252,8 +252,8 @@ pkg_set_s(struct pkg *pkg, pkg_attr attr, const char *str)
		}
		break;
	case PKG_ATTR_ARCH:
-
		free(pkg->arch);
-
		pkg->arch = xstrdup(str);
+
		free(pkg->altabi);
+
		pkg->altabi = xstrdup(str);
		break;
	case PKG_ATTR_ABI:
		free(pkg->abi);
modified libpkg/pkg_add.c
@@ -1145,7 +1145,7 @@ pkg_add_check_pkg_archive(struct pkgdb *db, struct pkg *pkg,
	struct pkg	*pkg_inst = NULL;
	bool	fromstdin;

-
	arch = pkg->abi != NULL ? pkg->abi : pkg->arch;
+
	arch = pkg->abi != NULL ? pkg->abi : pkg->altabi;

	if (!is_valid_abi(arch, true) && (flags & PKG_ADD_FORCE) == 0) {
		return (EPKG_FATAL);
modified libpkg/pkg_attributes.c
@@ -3,7 +3,7 @@
 * Copyright (c) 2011-2012 Julien Laffaye <jlaffaye@FreeBSD.org>
 * Copyright (c) 2013 Matthew Seaman <matthew@FreeBSD.org>
 * All rights reserved.
-
 * 
+
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
@@ -13,7 +13,7 @@
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
-
 * 
+
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -244,7 +244,7 @@ pkg_get_element(struct pkg *p, pkg_attr a)
		e->type = PKG_STR;
		break;
	case PKG_ATTR_ARCH:
-
		e->string = p->arch;
+
		e->string = p->altabi;
		e->type = PKG_STR;
		break;
	case PKG_ATTR_VERSION:
modified libpkg/pkg_checksum.c
@@ -205,7 +205,7 @@ pkg_checksum_generate(struct pkg *pkg, char *dest, size_t destlen,
	if (inc_version && !is_group)
		tll_push_back(entries, pkg_kv_new("version", pkg->version));
	if (!is_group)
-
		tll_push_back(entries, pkg_kv_new("arch", pkg->arch));
+
		tll_push_back(entries, pkg_kv_new("arch", pkg->altabi));

	while (pkg_options(pkg, &option) == EPKG_OK) {
		tll_push_back(entries, pkg_kv_new(option->key, option->value));
modified libpkg/pkg_jobs.c
@@ -1081,10 +1081,10 @@ pkg_jobs_need_upgrade(struct pkg *rp, struct pkg *lp)
		return (true);

	/* Compare archs */
-
	if (!STREQ(lp->arch, rp->arch)) {
+
	if (!STREQ(lp->altabi, rp->altabi)) {
		free(rp->reason);
		xasprintf(&rp->reason, "ABI changed: '%s' -> '%s'",
-
		    lp->arch, rp->arch);
+
		    lp->altabi, rp->altabi);
		assert(rp->reason != NULL);
		return (true);
	}
modified libpkg/pkg_manifest.c
@@ -101,7 +101,7 @@ static struct pkg_manifest_key {
	{ "abi",                 offsetof(struct pkg, abi),
			TYPE_SHIFT(UCL_STRING), pkg_string},

-
	{ "arch",                offsetof(struct pkg, arch),
+
	{ "arch",                offsetof(struct pkg, altabi),
			TYPE_SHIFT(UCL_STRING), pkg_string},

	{ "categories",          MANIFEST_CATEGORIES,
@@ -947,10 +947,10 @@ pkg_emit_object(struct pkg *pkg, short flags)
	ucl_object_t *map, *seq, *submap;
	ucl_object_t *top = ucl_object_typed_new(UCL_OBJECT);

-
	if (pkg->abi == NULL && pkg->arch != NULL)
-
		pkg->abi = xstrdup(pkg->arch);
+
	if (pkg->abi == NULL && pkg->altabi != NULL)
+
		pkg->abi = xstrdup(pkg->altabi);
	pkg_arch_to_legacy(pkg->abi, legacyarch, BUFSIZ);
-
	pkg->arch = xstrdup(legacyarch);
+
	pkg->altabi = xstrdup(legacyarch);
	dbg(4, "Emitting basic metadata");
	MANIFEST_EXPORT_FIELD(top, pkg, name, string);
	MANIFEST_EXPORT_FIELD(top, pkg, origin, string);
@@ -959,7 +959,8 @@ pkg_emit_object(struct pkg *pkg, short flags)
	MANIFEST_EXPORT_FIELD(top, pkg, maintainer, string);
	MANIFEST_EXPORT_FIELD(top, pkg, www, string);
	MANIFEST_EXPORT_FIELD(top, pkg, abi, string);
-
	MANIFEST_EXPORT_FIELD(top, pkg, arch, string);
+
	/* We need to keep altabi named arch in the manifest */
+
	ucl_object_insert_key(top, ucl_object_fromstring(pkg->altabi), "arch", 0, false);
	MANIFEST_EXPORT_FIELD(top, pkg, prefix, string);
	MANIFEST_EXPORT_FIELD(top, pkg, sum, string);
	MANIFEST_EXPORT_FIELD(top, pkg, flatsize, int);
modified libpkg/pkg_printf.c
@@ -2,7 +2,7 @@
 * Copyright (c) 2012-2015 Matthew Seaman <matthew@FreeBSD.org>
 * Copyright (c) 2014-2020 Baptiste Daroussin <bapt@FreeBSD.org>
 * All rights reserved.
-
 * 
+
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
@@ -12,7 +12,7 @@
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
-
 * 
+
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -68,7 +68,7 @@
 * Dp pkg_dir      Directory permissions
 * Dt pkg_dir      Try flag (@dirrmtry in plist)
 * Du pkg_dir      User owner of directory
-
 * 
+
 *
 * E
 *
 * F  pkg          List of files
@@ -77,7 +77,7 @@
 * Fn pkg_file     File path name
 * Fp pkg_file     File permissions
 * Fs pkg_file     File SHA256 checksum
-
 * Fu pkg_file     User owner of file 
+
 * Fu pkg_file     User owner of file
 *
 * G  pkg          List of groups
 * Gn pkg_group    Group name
@@ -852,7 +852,7 @@ static const struct pkg_printf_fmt fmt[] = {
 * %A -- Annotations.  Free-form tag+value text that can be added to
 * packages.  Optionally accepts per-field format in %{ %| %} Default
 * %{%An: %Av\n%|%}
-
 */  
+
 */
xstring *
format_annotations(xstring *buf, const void *data, struct percent_esc *p)
{
@@ -1342,7 +1342,7 @@ format_repo_ident(xstring *buf, const void *data, struct percent_esc *p)
 * %O -- Options. list of {option,value} tuples. Optionally accepts
 * following per-field format in %{ %| %}, where %On is replaced by the
 * option name and %Ov by the value.  Default %{%On %Ov\n%|%}
-
 */ 
+
 */
xstring *
format_options(xstring *buf, const void *data, struct percent_esc *p)
{
@@ -1424,7 +1424,7 @@ format_altabi(xstring *buf, const void *data, struct percent_esc *p)
{
	const struct pkg	*pkg = data;

-
	return (string_val(buf, pkg->arch, p));
+
	return (string_val(buf, pkg->altabi, p));
}

/*
@@ -2073,7 +2073,7 @@ gen_format(char *buf, size_t buflen, unsigned flags, const char *tail)

	if (buflen - bp < tlen + 2)
		return (NULL);
-
	
+

	if (flags & PP_EXPLICIT_PLUS)
		buf[bp++] = '+';

@@ -2533,9 +2533,9 @@ format_trailer(const char *f, struct percent_esc *p)
				fputc(*f2, p->sep_fmt->fp);
				fflush(p->sep_fmt->fp);
			}
-
			
+

		}
-
		
+

		if (done) {
			f = f1;
		} else {
@@ -2789,7 +2789,7 @@ read_oct_byte(xstring *buf, const char *f)
		}

		f++;
-
	} 
+
	}
done:
	fputc(val, buf->fp);

@@ -2863,7 +2863,7 @@ process_escape(xstring *buf, const char *f)

const char *
process_format_trailer(xstring *buf, struct percent_esc *p,
-
		       const char *f, const struct pkg *pkg, 
+
		       const char *f, const struct pkg *pkg,
		       const void *data, int count, unsigned context)
{
	const char		*fstart;
@@ -3037,7 +3037,7 @@ pkg_vdprintf(int fd, const char * restrict format, va_list ap)
	fflush(buf->fp);
	if (buf && strlen(buf->buf) > 0) {
		count = dprintf(fd, "%s", buf->buf);
-
	} else 
+
	} else
		count = -1;
	if (buf)
		xstring_free(buf);
@@ -3103,7 +3103,7 @@ pkg_vsnprintf(char * restrict str, size_t size, const char * restrict format,
 * Allocate a string buffer ret sufficiently big to contain formatted
 * data data from pkg as indicated by the format code format
 * @param ret location of pointer to be set to point to buffer containing
-
 * result 
+
 * result
 * @param ... Varargs list of struct pkg etc. supplying the data
 * @param format String with embedded %-escapes indicating what to output
 * @return count of the number of characters printed
@@ -3125,7 +3125,7 @@ pkg_asprintf(char **ret, const char * restrict format, ...)
 * Allocate a string buffer ret sufficiently big to contain formatted
 * data data from pkg as indicated by the format code format
 * @param ret location of pointer to be set to point to buffer containing
-
 * result 
+
 * result
 * @param ap Varargs list of struct pkg etc. supplying the data
 * @param format String with embedded %-escapes indicating what to output
 * @return count of the number of characters printed
modified libpkg/pkg_solve.c
@@ -300,10 +300,10 @@ pkg_solve_handle_provide (struct pkg_solve_problem *problem,
		if (pr->is_shlib) {
			libfound = stringlist_contains(&pkg->shlibs_provided, pr->provide);
			/* Skip incompatible ABI as well */
-
			if (libfound && !STREQ(pkg->arch, orig->arch)) {
+
			if (libfound && !STREQ(pkg->altabi, orig->altabi)) {
				dbg(2, "require %s: package %s-%s(%c) provides wrong ABI %s, "
					"wanted %s", pr->provide, pkg->name, pkg->version,
-
					pkg->type == PKG_INSTALLED ? 'l' : 'r', pkg->arch, orig->arch);
+
					pkg->type == PKG_INSTALLED ? 'l' : 'r', pkg->altabi, orig->altabi);
				continue;
			}
		}
modified libpkg/pkgdb.c
@@ -1662,7 +1662,7 @@ pkgdb_register_pkg(struct pkgdb *db, struct pkg *pkg, int forced,
		return (EPKG_FATAL);

	/* Prefer new ABI over old one */
-
	arch = pkg->abi != NULL ? pkg->abi : pkg->arch;
+
	arch = pkg->abi != NULL ? pkg->abi : pkg->altabi;

	/*
	 * Insert package record
modified libpkg/pkgdb_iterator.c
@@ -976,7 +976,7 @@ populate_pkg(sqlite3_stmt *stmt, struct pkg *pkg) {
	}

	pkg_arch_to_legacy(pkg->abi, legacyarch, BUFSIZ);
-
	pkg->arch = xstrdup(legacyarch);
+
	pkg->altabi = xstrdup(legacyarch);
}

static struct load_on_flag {
modified libpkg/private/pkg.h
@@ -211,7 +211,7 @@ struct pkg {
	char			*old_version;
	char			*maintainer;
	char			*www;
-
	char			*arch;
+
	char			*altabi;
	char			*abi;
	char			*uid;
	char			*digest;
modified libpkg/repo/binary/update.c
@@ -141,7 +141,7 @@ pkg_repo_binary_add_pkg(struct pkg *pkg, sqlite3 *sqlite, bool forced)
	const char		*arch;
	int64_t			 package_id;

-
	arch = pkg->abi != NULL ? pkg->abi : pkg->arch;
+
	arch = pkg->abi != NULL ? pkg->abi : pkg->altabi;

try_again:
	if ((ret = pkg_repo_binary_run_prstatement(PKG,
@@ -380,7 +380,7 @@ pkg_repo_binary_add_from_ucl(sqlite3 *sqlite, ucl_object_t *o, struct pkg_repo *

	if (pkg->digest == NULL || !pkg_checksum_is_valid(pkg->digest, strlen(pkg->digest)))
		pkg_checksum_calculate(pkg, NULL, false, true, false);
-
	abi = pkg->abi != NULL ? pkg->abi : pkg->arch;
+
	abi = pkg->abi != NULL ? pkg->abi : pkg->altabi;
	if (abi == NULL || !is_valid_abi(abi, true)) {
		rc = EPKG_FATAL;
		pkg_emit_error("repository %s contains packages with wrong ABI: %s",
@@ -425,7 +425,7 @@ pkg_repo_binary_add_from_manifest(const char *buf, sqlite3 *sqlite, size_t len,

	if (pkg->digest == NULL || !pkg_checksum_is_valid(pkg->digest, strlen(pkg->digest)))
		pkg_checksum_calculate(pkg, NULL, false, true, false);
-
	abi = pkg->abi != NULL ? pkg->abi : pkg->arch;
+
	abi = pkg->abi != NULL ? pkg->abi : pkg->altabi;
	if (abi == NULL || !is_valid_abi(abi, true)) {
		rc = EPKG_FATAL;
		pkg_emit_error("repository %s contains packages with wrong ABI: %s",