xbps: update to 0.59.

This commit is contained in:
Juan RP 2020-03-03 08:59:30 +01:00
parent d1079d8331
commit cf54c2253b
5 changed files with 3 additions and 313 deletions

View File

@ -1,73 +0,0 @@
commit 5b43614e80c5a334231f28e191f709b2679e6fc7
Author: Juan RP <xtraeme@gmail.com>
Date: Mon Feb 3 09:19:54 2020 +0100
libxbps: fixed regression introduced in 0.58.
While looking for dependencies, we need to check
if xbps_rpool_get_pkg() returned a suitable match;
and then validate its result.
This fixes the update_and_install test case that
was reverted via #218.
--- lib/repo_pkgdeps.c
+++ lib/repo_pkgdeps.c
@@ -131,7 +131,6 @@ find_repo_deps(struct xbps_handle *xhp,
const char *reqpkg, *pkgver_q, *reason = NULL;
char *pkgname, *reqpkgname;
int rv = 0;
- bool foundvpkg;
if (*depth >= MAX_DEPTH)
return ELOOP;
@@ -144,8 +143,9 @@ find_repo_deps(struct xbps_handle *xhp,
assert(iter);
while ((obj = xbps_object_iterator_next(iter))) {
- foundvpkg = false;
+ bool error = false, foundvpkg = false;
reqpkg = xbps_string_cstring_nocopy(obj);
+
if (xhp->flags & XBPS_FLAG_DEBUG) {
xbps_dbg_printf(xhp, "%s", "");
for (unsigned short x = 0; x < *depth; x++) {
@@ -345,6 +345,38 @@ find_repo_deps(struct xbps_handle *xhp,
}
free(pkgname);
free(reqpkgname);
+ /*
+ * Installed package must be updated, check if dependency is
+ * satisfied.
+ */
+ if (!strcmp(reason, "update")) {
+ switch (xbps_pkgpattern_match(pkgver_q, reqpkg)) {
+ case 0: /* nomatch */
+ break;
+ case 1: /* match */
+ pkgname = xbps_pkg_name(pkgver_q);
+ assert(pkgname);
+ /*
+ * If there's an update in transaction,
+ * it's assumed version is greater.
+ * So dependency pattern matching didn't
+ * succeed... return ENODEV.
+ */
+ if (xbps_find_pkg_in_array(unsorted, pkgname, "update")) {
+ error = true;
+ rv = ENODEV;
+ }
+ free(pkgname);
+ break;
+ default:
+ error = true;
+ rv = EINVAL;
+ break;
+ }
+ if (error)
+ break;
+ }
+
/*
* If package doesn't have rundeps, pass to the next one.
*/

View File

@ -1,34 +0,0 @@
From c8d676f10e75d5bd41ff31695d7a747038f219c0 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Fri, 21 Feb 2020 23:51:28 +0100
Subject: [PATCH] xbps_find_pkg_orphans: fix for #234
Make sure "automatic" bool is initialized to false before
checking its value. This way if xbps_dictionary_get_bool()
fails, "automatic" will be set to false.
Closes #234
---
lib/package_orphans.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/package_orphans.c b/lib/package_orphans.c
index f5352a9a..f7e2d941 100644
--- lib/package_orphans.c
+++ lib/package_orphans.c
@@ -156,7 +156,6 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
xbps_dictionary_t pkgd;
const char *pkgver = NULL;
unsigned int cnt = 0, reqbycnt = 0;
- bool automatic = false;
pkgd = xbps_array_get(array, i);
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
@@ -170,6 +169,7 @@ xbps_find_pkg_orphans(struct xbps_handle *xhp, xbps_array_t orphans_user)
xbps_array_t reqby;
xbps_dictionary_t deppkgd;
const char *deppkgver = NULL;
+ bool automatic = false;
cnt = 0;
xbps_array_get_cstring_nocopy(rdeps, x, &deppkgver);

View File

@ -1,45 +0,0 @@
commit 8637269b38d9cd59fe946dc797a455e3c8009ea0
Author: Duncan Overbruck <mail@duncano.de>
Date: Fri Jan 31 16:32:38 2020 +0100
lib/transaction_revdeps.c: fix provides/replaces #218
This reverts a change that solved another issue and marks the test case
for the other issue as expected failure.
The other issue is not as important as this, as it blocks updating a lot
of systems.
diff --git lib/transaction_revdeps.c lib/transaction_revdeps.c
index 39cc6d05..73edd21c 100644
--- lib/transaction_revdeps.c
+++ lib/transaction_revdeps.c
@@ -232,6 +232,16 @@ xbps_transaction_revdeps(struct xbps_handle *xhp, xbps_array_t pkgs)
free(pkgname);
continue;
}
+ /*
+ * Installed package conflicts with package
+ * in transaction being updated, check
+ * if a new version of this conflicting package
+ * is in the transaction.
+ */
+ if (xbps_find_pkg_in_array(pkgs, pkgname, "update")) {
+ free(pkgname);
+ continue;
+ }
free(pkgname);
broken_pkg(mdeps, curpkgver, pkgver, tract);
}
diff --git tests/xbps/libxbps/shell/install_test.sh tests/xbps/libxbps/shell/install_test.sh
index c0fe9a1a..eb30ba82 100644
--- tests/xbps/libxbps/shell/install_test.sh
+++ tests/xbps/libxbps/shell/install_test.sh
@@ -598,6 +598,7 @@ atf_test_case update_and_install
update_and_install_head() {
atf_set "descr" "Tests for pkg install: update installed version and install new from other repo"
+ atf_expect_fail "fix introduced a regression"
}
update_and_install_body() {

View File

@ -1,158 +0,0 @@
--- bin/xbps-uchroot/main.c
+++ bin/xbps-uchroot/main.c
@@ -52,6 +52,7 @@
#include <ftw.h>
#include <signal.h>
#include <getopt.h>
+#include <dirent.h>
#include <xbps.h>
#include "queue.h"
@@ -109,19 +110,16 @@ die(const char *fmt, ...)
}
static int
-ftw_cb(const char *fpath, const struct stat *sb UNUSED, int type,
- struct FTW *ftwbuf UNUSED)
+ftw_cb(const char *fpath, const struct stat *sb)
{
int sverrno = 0;
- if (type == FTW_F || type == FTW_SL || type == FTW_SLN) {
- if (unlink(fpath) == -1)
- sverrno = errno;
- } else if (type == FTW_D || type == FTW_DNR || type == FTW_DP) {
+ if (S_ISDIR(sb->st_mode)) {
if (rmdir(fpath) == -1)
sverrno = errno;
} else {
- return 0;
+ if (unlink(fpath) == -1)
+ sverrno = errno;
}
if (sverrno != 0) {
fprintf(stderr, "Failed to remove %s: %s\n", fpath, strerror(sverrno));
@@ -129,20 +127,68 @@ ftw_cb(const char *fpath, const struct stat *sb UNUSED, int type,
return 0;
}
+static int
+walk_dir(const char *path,
+ int (*fn)(const char *fpath, const struct stat *sb))
+{
+ struct dirent **list;
+ struct stat sb;
+ const char *p;
+ char tmp_path[PATH_MAX] = {0};
+ int rv, i;
+
+ i = scandir(path, &list, NULL, alphasort);
+ if (i == -1) {
+ rv = -1;
+ goto out;
+ }
+ while (i--) {
+ p = list[i]->d_name;
+ if (strcmp(p, ".") == 0 || strcmp(p, "..") == 0)
+ continue;
+ if (strlen(path) + strlen(p) + 1 >= (PATH_MAX - 1)) {
+ errno = ENAMETOOLONG;
+ rv = -1;
+ break;
+ }
+ strncpy(tmp_path, path, PATH_MAX - 1);
+ strncat(tmp_path, "/", PATH_MAX - 1 - strlen(tmp_path));
+ strncat(tmp_path, p, PATH_MAX - 1 - strlen(tmp_path));
+ if (lstat(tmp_path, &sb) < 0) {
+ break;
+ }
+ if (S_ISDIR(sb.st_mode)) {
+ if (walk_dir(tmp_path, fn) < 0) {
+ rv = -1;
+ break;
+ }
+ }
+ rv = fn(tmp_path, &sb);
+ if (rv != 0) {
+ break;
+ }
+ }
+out:
+ free(list);
+ return rv;
+}
+
static void
cleanup_overlayfs(void)
{
if (tmpdir == NULL)
return;
- if (!overlayfs_on_tmpfs) {
- /* recursively remove the temporary dir */
- if (nftw(tmpdir, ftw_cb, 20, FTW_MOUNT|FTW_PHYS|FTW_DEPTH) != 0) {
- fprintf(stderr, "Failed to remove directory tree %s: %s\n",
- tmpdir, strerror(errno));
- exit(EXIT_FAILURE);
- }
+ if (overlayfs_on_tmpfs)
+ goto out;
+
+ /* recursively remove the temporary dir */
+ if (walk_dir(tmpdir, ftw_cb) != 0) {
+ fprintf(stderr, "Failed to remove directory tree %s: %s\n",
+ tmpdir, strerror(errno));
+ exit(EXIT_FAILURE);
}
+out:
rmdir(tmpdir);
}
@@ -342,17 +388,16 @@ main(int argc, char **argv)
die("failed to create tmpdir directory");
if (chown(tmpdir, ruid, rgid) == -1)
die("chown tmpdir %s", tmpdir);
+ /*
+ * Register a signal handler to clean up temporary masterdir.
+ */
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = sighandler_cleanup;
+ sigaction(SIGINT, &sa, NULL);
+ sigaction(SIGTERM, &sa, NULL);
+ sigaction(SIGQUIT, &sa, NULL);
}
- /*
- * Register a signal handler to clean up temporary masterdir.
- */
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = sighandler_cleanup;
- sigaction(SIGINT, &sa, NULL);
- sigaction(SIGTERM, &sa, NULL);
- sigaction(SIGQUIT, &sa, NULL);
-
clone_flags = (SIGCHLD|CLONE_NEWNS|CLONE_NEWIPC|CLONE_NEWUTS|CLONE_NEWPID);
container_flags = clone_flags & ~(CLONE_NEWNS|CLONE_NEWIPC|CLONE_NEWUTS|CLONE_NEWPID);
@@ -376,8 +421,6 @@ main(int argc, char **argv)
/* mount as private, systemd mounts it as shared by default */
if (mount(NULL, "/", "none", MS_PRIVATE|MS_REC, NULL) == -1)
die("Failed to mount / private");
- if (mount(NULL, "/", "none", MS_PRIVATE|MS_REMOUNT|MS_NOSUID, NULL) == -1)
- die("Failed to remount /");
/* setup our overlayfs if set */
if (overlayfs)
@@ -422,12 +465,6 @@ main(int argc, char **argv)
if (execvp(cmd, cmdargs) == -1)
die("Failed to execute command %s", cmd);
}
- /* Switch back to the gid/uid of invoking process also in the parent */
- if (setgid(rgid) == -1)
- die("setgid child");
- if (setuid(ruid) == -1)
- die("setuid child");
-
/* Wait until the child terminates */
while (waitpid(child, &child_status, 0) < 0) {
if (errno != EINTR)

View File

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.58
revision=6
version=0.59
revision=1
bootstrap=yes
build_style=configure
short_desc="XBPS package system utilities"
@ -10,7 +10,7 @@ license="BSD-2-Clause"
homepage="https://github.com/void-linux/xbps"
changelog="https://github.com/void-linux/xbps/blob/master/NEWS"
distfiles="https://github.com/void-linux/xbps/archive/${version}.tar.gz"
checksum=c9cb0823d4aa72e57b1531bc01eb17dc66d64b461b8861bc4e081465a5dff144
checksum=4d4a67b40a6cc4994c2131c786fb17407ddc9041f4f5734b8a9c5d743ede46d0
hostmakedepends="pkgconf"
checkdepends="kyua"