Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
compat32: ignore on systems without lib32 set
Baptiste Daroussin committed 1 year ago
commit e245b7afe615deae9b4e79508d733abaed177da6
parent f398b0b
5 files changed +16 -2
modified libpkg/pkg.h.in
@@ -555,6 +555,10 @@ typedef enum {
	 * The requested operation is not supported.
	 */
	EPKG_OPNOTSUPP,
+
	/**
+
	 * No compat 32 support
+
	 */
+
	EPKG_NOCOMPAT32,
} pkg_error_t;

/**
modified libpkg/pkg_jobs.c
@@ -1922,7 +1922,9 @@ pkg_jobs_solve(struct pkg_jobs *j)
		 * provide system shlibs. */
		if (!pkgdb_file_exists(j->db, "/usr/bin/uname")) {
			ret = scan_system_shlibs(&j->system_shlibs, ctx.pkg_rootdir);
-
			if (ret != EPKG_OK) {
+
			if (ret == EPKG_NOCOMPAT32) {
+
				j->ignore_compat32 = true;
+
			} else if (ret != EPKG_OK) {
				return (ret);
			}
		}
modified libpkg/pkg_solve.c
@@ -673,6 +673,8 @@ pkg_solve_process_universe_variable(struct pkg_solve_problem *problem,
		/* Shlibs */
		tll_foreach(pkg->shlibs_required, s) {
			/* Ignore 32 bit libraries */
+
			if (j->ignore_compat32 && str_ends_with(s->item, ":32"))
+
				continue;
			if (pkghash_get(j->system_shlibs, s->item) != NULL) {
				/* The shlib is provided by the system */
				continue;
modified libpkg/pkgbase.c
@@ -20,6 +20,7 @@
#include "private/event.h"
#include "private/pkg.h"
#include "private/pkgdb.h"
+
#include "private/utils.h"
#include "xmalloc.h"

struct pkgbase {
@@ -29,6 +30,7 @@ struct pkgbase {
	 * provides/requires in pkgbase
	 */
	struct pkghash *provides;
+
	bool ignore_compat32;
};

static int
@@ -115,7 +117,8 @@ pkgbase_new(struct pkgdb *db)
	struct pkgbase *pb = xcalloc(1, sizeof(*pb));

	if (!pkgdb_file_exists(db, "/usr/bin/uname"))
-
		scan_system_shlibs(&pb->system_shlibs, ctx.pkg_rootdir);
+
		if (scan_system_shlibs(&pb->system_shlibs, ctx.pkg_rootdir) == EPKG_NOCOMPAT32)
+
			pb->ignore_compat32 = true;

	return (pb);
}
@@ -133,6 +136,8 @@ pkgbase_free(struct pkgbase *pb)
bool
pkgbase_provide_shlib(struct pkgbase *pb, const char *shlib)
{
+
	if (pb->ignore_compat32 && str_ends_with(shlib, ":32"))
+
		return (true);
	return (pkghash_get(pb->system_shlibs, shlib) != NULL);
}

modified libpkg/private/pkg_jobs.h
@@ -138,6 +138,7 @@ struct pkg_jobs {
	struct job_pattern *patterns;
	bool conservative;
	bool pinning;
+
	bool ignore_compat32;
	void		*lockedpkgs;
	struct triggers triggers;
	struct pkghash *orphaned;