Skip to content

Commit

Permalink
altabi: rename the private field arch into altabi
Browse files Browse the repository at this point in the history
This helps clarifying a thing which is sometime called legacyarch,
sometime altabi, sometime arch. Now this is always ALTABI
  • Loading branch information
bapt committed Nov 22, 2024
1 parent 326a23e commit 72cc0cd
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 38 deletions.
6 changes: 3 additions & 3 deletions libpkg/pkg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion libpkg/pkg_add.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions libpkg/pkg_attributes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2011-2012 Julien Laffaye <[email protected]>
* Copyright (c) 2013 Matthew Seaman <[email protected]>
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion libpkg/pkg_checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions libpkg/pkg_jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
11 changes: 6 additions & 5 deletions libpkg/pkg_manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
30 changes: 15 additions & 15 deletions libpkg/pkg_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) 2012-2015 Matthew Seaman <[email protected]>
* Copyright (c) 2014-2020 Baptiste Daroussin <[email protected]>
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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));
}

/*
Expand Down Expand Up @@ -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++] = '+';

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -2789,7 +2789,7 @@ read_oct_byte(xstring *buf, const char *f)
}

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

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions libpkg/pkg_solve.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion libpkg/pkgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libpkg/pkgdb_iterator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion libpkg/private/pkg.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ struct pkg {
char *old_version;
char *maintainer;
char *www;
char *arch;
char *altabi;
char *abi;
char *uid;
char *digest;
Expand Down
6 changes: 3 additions & 3 deletions libpkg/repo/binary/update.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 72cc0cd

Please sign in to comment.