xbps icon indicating copy to clipboard operation
xbps copied to clipboard

[RFC] abi support

Open ericonr opened this issue 4 years ago • 6 comments

ericonr avatar Sep 07 '20 19:09 ericonr

Interesting would this work with the musl update, once appropriate changes are added to xbps-install?

fosslinux avatar Nov 04 '20 00:11 fosslinux

Interesting would this work with the musl update, once appropriate changes are added to xbps-install?

It's an idea for a possible solution to the musl update.

ericonr avatar Nov 04 '20 01:11 ericonr

@ericonr Would love to help making this happen, what Is missing here ? It looks feature complete this pr ...

motorto avatar Jul 17 '22 15:07 motorto

@motorto we need to implement the xbps-install side where, upon receiving a package with a greater ABI field, we force update the entire system in one go.

ericonr avatar Jul 17 '22 18:07 ericonr

probably not good, but here is my currently work on it I just don't know how can I get the repo abi version.

And I am not sure if its the repo abi version that increases or the package that increases: if (abi_repo < abi_package) or if(abi_package < abi_repo)

Here is the diff
diff --git a/bin/xbps-install/transaction.c b/bin/xbps-install/transaction.c
index d747c760..aa1f7793 100644
--- a/bin/xbps-install/transaction.c
+++ b/bin/xbps-install/transaction.c
@@ -292,6 +292,8 @@ install_new_pkg(struct xbps_handle *xhp, const char *pkg, bool force)
 		fprintf(stderr, "Package `%s' contains invalid dependencies, exiting.\n", pkg);
 	else if (rv == EBUSY)
 		fprintf(stderr, "The 'xbps' package must be updated, please run `xbps-install -u xbps`\n");
+	else if (rv == 2) // TODO: FIND GOOD VALUE HERE
+		fprintf(stderr, "ABI changed, please run `xbps-install -Su` to do a full system upgrade\n");
 	else if (rv != 0) {
 		fprintf(stderr, "Unexpected error: %s\n", strerror(rv));
 		rv = -1;
diff --git a/lib/transaction_ops.c b/lib/transaction_ops.c
index 5c0deda4..ba7907d4 100644
--- a/lib/transaction_ops.c
+++ b/lib/transaction_ops.c
@@ -1,4 +1,4 @@
-/*-
+/*
  * Copyright (c) 2009-2020 Juan Romero Pardines.
  * All rights reserved.
  *
@@ -347,8 +347,10 @@ xbps_transaction_update_packages(struct xbps_handle *xhp)
 int
 xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkg, bool force)
 {
+	const char *t_abi = NULL;
+	xbps_dictionary_t pkg_pkgdb = NULL;
 	xbps_array_t rdeps;
-	int rv;
+	int abi_repo, abi_pkg, rv;
 
 	rv = xbps_autoupdate(xhp);
 	xbps_dbg_printf(xhp, "%s: xbps_autoupdate %d\n", __func__, rv);
@@ -366,6 +368,19 @@ xbps_transaction_update_pkg(struct xbps_handle *xhp, const char *pkg, bool force
 		break;
 	}
 
+	/* check abi version */
+	xbps_dictionary_get_cstring_nocopy(xhp->pkgdb,"abi", &t_abi);
+	abi_repo=atoi(t_abi);
+
+	pkg_pkgdb = xbps_pkgdb_get_pkg(xhp, pkg);
+	xbps_dictionary_get_cstring_nocopy(pkg_pkgdb,"abi", &t_abi);
+
+	abi_pkg=atoi(t_abi);
+
+	if (abi_repo < abi_pkg) {
+		return 2;
+	}
+
 	/* update its reverse dependencies */
 	rdeps = xbps_pkgdb_get_pkg_revdeps(xhp, pkg);
 	if (xhp->flags & XBPS_FLAG_DOWNLOAD_ONLY) {

motorto avatar Jul 18 '22 16:07 motorto

I'm pretty new to this whole stuff, but I want to contribute.

How can I help and what should I read to understand the bigger picture?

dataCobra avatar Aug 10 '22 18:08 dataCobra