xbps: update to 0.52.

This commit is contained in:
Enno Boland 2018-04-30 16:22:08 +02:00
parent fb2e140513
commit 02c1e7134a
No known key found for this signature in database
GPG Key ID: D09964719BDE9971
9 changed files with 3 additions and 440 deletions

View File

@ -1,26 +0,0 @@
From 3a5c1f3a71200f45f06dace1f55faf782ece9352 Mon Sep 17 00:00:00 2001
From: Enno Boland <g@s01.de>
Date: Tue, 26 Apr 2016 13:56:10 +0200
Subject: [PATCH] lib/fetch/http.c: fix EOL at HTTP CONNECT
fixes #172.
---
lib/fetch/http.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/fetch/http.c b/lib/fetch/http.c
index a027c39..433bd11 100644
--- lib/fetch/http.c
+++ lib/fetch/http.c
@@ -733,7 +733,7 @@ http_connect(struct url *URL, struct url *purl, const char *flags, int *cached)
/* fetch_connect() has already set an error code */
return (NULL);
if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 && purl) {
- http_cmd(conn, "CONNECT %s:%d HTTP/1.1",
+ http_cmd(conn, "CONNECT %s:%d HTTP/1.1\r\n\r\n",
URL->host, URL->port);
if (http_get_reply(conn) != HTTP_OK) {
fetch_close(conn);
--
2.8.1

View File

@ -1,35 +0,0 @@
From 876f9f4a27ffd9477be8348710cb0baf387c50a0 Mon Sep 17 00:00:00 2001
From: Leah Neukirchen <leah@vuxu.org>
Date: Mon, 7 Aug 2017 16:08:15 +0200
Subject: [PATCH] xbps-fbulk: use _DEFAULT_SOURCE, required for wait3 in glibc
2.16.
Also these guards need to be defined before including anything.
---
bin/xbps-fbulk/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bin/xbps-fbulk/main.c b/bin/xbps-fbulk/main.c
index 82dc0a16..b686cfa7 100644
--- bin/xbps-fbulk/main.c
+++ bin/xbps-fbulk/main.c
@@ -47,6 +47,8 @@
* Only one attempt is made to build any given package, no matter how many
* other packages depend on it.
*/
+#define _DEFAULT_SOURCE
+#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -59,9 +61,7 @@
#include <fcntl.h>
#include <sys/file.h>
#include <sys/stat.h>
-#define _BSD_SOURCE
-# include <sys/wait.h>
-#undef _BSD_SOURCE
+#include <sys/wait.h>
#include <getopt.h>
#include <xbps.h>

View File

@ -1,31 +0,0 @@
--- lib/fetch/common.c 2016-09-14 06:03:01.225000000 +0200
+++ lib/fetch/common.c 2016-09-14 06:03:59.355000000 +0200
@@ -754,17 +754,17 @@
NID_commonName, lastpos)) != -1)
loc = lastpos;
- if (loc > -1) {
- nameentry = X509_NAME_get_entry(subject, loc);
- namedata = X509_NAME_ENTRY_get_data(nameentry);
- cnlen = ASN1_STRING_to_UTF8(&cn, namedata);
- if (ip == NULL &&
- fetch_ssl_hname_match(host, strlen(host), (const char *)cn, cnlen))
- ret = 1;
- else if (ip != NULL && fetch_ssl_ipaddr_match(ip, (const char *)cn, cnlen))
- ret = 1;
- OPENSSL_free(cn);
- }
+ if (loc > -1) {
+ nameentry = X509_NAME_get_entry(subject, loc);
+ namedata = X509_NAME_ENTRY_get_data(nameentry);
+ cnlen = ASN1_STRING_to_UTF8(&cn, namedata);
+ if (ip == NULL &&
+ fetch_ssl_hname_match(host, strlen(host), (const char *)cn, cnlen))
+ ret = 1;
+ else if (ip != NULL && fetch_ssl_ipaddr_match(ip, (const char *)cn, cnlen))
+ ret = 1;
+ OPENSSL_free(cn);
+ }
return (ret);
}

View File

@ -1,74 +0,0 @@
--- lib/fetch/common.c.orig 2016-04-24 19:23:10.086252434 +0200
+++ lib/fetch/common.c 2016-04-24 19:23:38.375203346 +0200
@@ -444,6 +444,8 @@ fetch_cache_put(conn_t *conn, int (*clos
#ifdef WITH_SSL
+
+#ifndef HAVE_STRNSTR
/*
* Find the first occurrence of find in s, where the search is limited to the
* first slen characters of s.
@@ -468,6 +470,7 @@ strnstr(const char *s, const char *find,
}
return ((char *)__UNCONST(s));
}
+#endif
/*
* Convert characters A-Z to lowercase (intentionally avoid any locale
@@ -640,8 +643,10 @@ fetch_ssl_get_numeric_addrinfo(const cha
hints.ai_protocol = 0;
hints.ai_flags = AI_NUMERICHOST;
/* port is not relevant for this purpose */
- if (getaddrinfo(host, "443", &hints, &res) != 0)
+ if (getaddrinfo(host, "443", &hints, &res) != 0) {
+ free(host);
return NULL;
+ }
free(host);
return res;
}
@@ -929,8 +934,18 @@ fetch_ssl_cb_verify_crt(int verified, X5
return (verified);
}
+static pthread_once_t ssl_init_once = PTHREAD_ONCE_INIT;
+
+static void
+ssl_init(void)
+{
+ /* Init the SSL library and context */
+ SSL_load_error_strings();
+ SSL_library_init();
+}
#endif
+
/*
* Enable SSL on a connection.
*/
@@ -943,16 +958,14 @@ fetch_ssl(conn_t *conn, const struct url
X509_NAME *name;
char *str;
- /* Init the SSL library and context */
- if (!SSL_library_init()){
- fprintf(stderr, "SSL library init failed\n");
- return (-1);
- }
-
- SSL_load_error_strings();
+ (void)pthread_once(&ssl_init_once, ssl_init);
- conn->ssl_meth = SSLv23_client_method();
- conn->ssl_ctx = SSL_CTX_new(conn->ssl_meth);
+ conn->ssl_ctx = SSL_CTX_new(SSLv23_client_method());
+ if (conn->ssl_ctx == NULL) {
+ fprintf(stderr, "failed to create SSL context\n");
+ ERR_print_errors_fp(stderr);
+ return -1;
+ }
SSL_CTX_set_mode(conn->ssl_ctx, SSL_MODE_AUTO_RETRY);
fetch_ssl_setup_transport_layer(conn->ssl_ctx, verbose);

View File

@ -1,11 +0,0 @@
--- lib/pubkey2fp.c.orig 2016-04-24 19:27:07.063791995 +0200
+++ lib/pubkey2fp.c 2016-04-24 19:27:11.295783820 +0200
@@ -160,8 +160,5 @@ out:
if (pEncoding)
free(pEncoding);
- EVP_cleanup();
- ERR_free_strings();
-
return hexfpstr;
}

View File

@ -1,78 +0,0 @@
--- lib/package_alternatives.c.orig
+++ lib/package_alternatives.c
@@ -249,8 +249,8 @@ xbps_alternatives_set(struct xbps_handle *xhp, const char *pkgname,
const char *group)
{
xbps_array_t allkeys;
- xbps_dictionary_t alternatives, pkg_alternatives, pkgd;
- const char *pkgver;
+ xbps_dictionary_t alternatives, pkg_alternatives, pkgd, prevpkgd, prevpkg_alts;
+ const char *pkgver, *prevpkgname;
int rv = 0;
assert(xhp);
@@ -289,6 +289,20 @@ xbps_alternatives_set(struct xbps_handle *xhp, const char *pkgname,
if (array == NULL)
continue;
+ /* remove symlinks from previous alternative */
+ xbps_array_get_cstring_nocopy(array, 0, &prevpkgname);
+ if (prevpkgname && strcmp(pkgname, prevpkgname) != 0) {
+ if ((prevpkgd = xbps_pkgdb_get_pkg(xhp, prevpkgname)) &&
+ (prevpkg_alts = xbps_dictionary_get(prevpkgd, "alternatives")) &&
+ xbps_dictionary_count(prevpkg_alts)) {
+ rv = remove_symlinks(xhp,
+ xbps_dictionary_get(prevpkg_alts, keyname),
+ keyname);
+ if (rv != 0)
+ break;
+ }
+ }
+
/* put this alternative group at the head */
xbps_remove_string_from_array(array, pkgname);
kstr = xbps_string_create_cstring(pkgname);
--- tests/xbps/xbps-alternatives/main.sh.orig
+++ tests/xbps/xbps-alternatives/main.sh
@@ -429,6 +429,35 @@ update_pkgs_body() {
atf_check_equal $rv 0
}
+atf_test_case less_entries
+
+less_entries_pkgs_head() {
+ atf_set "descr" "xbps-alternatives: remove symlinks not provided by the new alternative"
+}
+less_entries_body() {
+ mkdir -p repo pkg_A/usr/bin pkg_B/usr/bin
+ touch pkg_A/usr/bin/A1 pkg_A/usr/bin/A2 pkg_B/usr/bin/B1
+ cd repo
+ xbps-create -A noarch -n A-1.1_1 -s "A pkg" --alternatives "1:1:/usr/bin/A1 1:2:/usr/bin/A2" ../pkg_A
+ atf_check_equal $? 0
+ xbps-create -A noarch -n B-1.1_1 -s "B pkg" --alternatives "1:1:/usr/bin/B1" ../pkg_B
+ atf_check_equal $? 0
+ xbps-rindex -d -a $PWD/*.xbps
+ atf_check_equal $? 0
+ cd ..
+
+ xbps-install -r root --repository=repo -ydv A B
+ atf_check_equal $? 0
+
+ xbps-alternatives -r root -s B
+ atf_check_equal $? 0
+
+ rv=1
+ [ -e root/usr/bin/2 ] || rv=0
+ atf_check_equal $rv 0
+}
+
+
atf_init_test_cases() {
atf_add_test_case register_one
atf_add_test_case register_one_dangling
@@ -441,4 +470,5 @@ atf_init_test_cases() {
atf_add_test_case set_pkg
atf_add_test_case set_pkg_group
atf_add_test_case update_pkgs
+ atf_add_test_case less_entries
}

View File

@ -1,169 +0,0 @@
--- lib/package_alternatives.c.orig
+++ lib/package_alternatives.c
@@ -145,99 +145,84 @@ remove_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
static int
create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
{
- unsigned int i, cnt;
+ int rv;
+ unsigned int i, n;
+ char *alternative, *tok1, *tok2, *linkpath, *target, *dir, *p;
- cnt = xbps_array_count(a);
- for (i = 0; i < cnt; i++) {
- xbps_string_t str;
- char *tgt_dup, *tgt_dir, *lnk_dup, *lnk_dir;
- char *l, *lnk, *tgt = NULL;
- const char *tgt0;
- int rv;
+ n = xbps_array_count(a);
- str = xbps_array_get(a, i);
- l = left(xbps_string_cstring_nocopy(str));
- assert(l);
- tgt0 = right(xbps_string_cstring_nocopy(str));
- assert(tgt0);
- /* always create target dir, for dangling symlinks */
- tgt_dup = strdup(tgt0);
- assert(tgt_dup);
- tgt_dir = dirname(tgt_dup);
- if (strcmp(tgt_dir, ".")) {
- tgt = xbps_xasprintf("%s%s", xhp->rootdir, tgt_dir);
- if (xbps_mkpath(tgt, 0755) != 0) {
- if (errno != EEXIST) {
- rv = errno;
- xbps_dbg_printf(xhp, "failed to create "
- "target dir '%s' for group '%s': %s\n",
- tgt, grname, strerror(errno));
- free(tgt_dup);
- free(tgt);
- free(l);
- return rv;
- }
- }
- free(tgt);
+ for (i = 0; i < n; i++) {
+ alternative = xbps_string_cstring(xbps_array_get(a, i));
+
+ if (!(tok1 = strtok(alternative, ":")) ||
+ !(tok2 = strtok(NULL, ":"))) {
+ free(alternative);
+ return -1;
}
- /* always create link dir, for dangling symlinks */
- lnk_dup = strdup(l);
- assert(lnk_dup);
- lnk_dir = dirname(lnk_dup);
- if (strcmp(lnk_dir, ".")) {
- lnk = xbps_xasprintf("%s%s", xhp->rootdir, lnk_dir);
- if (xbps_mkpath(lnk, 0755) != 0) {
- if (errno != EEXIST) {
- rv = errno;
- xbps_dbg_printf(xhp, "failed to create symlink"
- "dir '%s' for group '%s': %s\n",
- lnk, grname, strerror(errno));
- free(tgt_dup);
- free(lnk_dup);
- free(lnk);
- free(l);
- return rv;
- }
- }
- free(lnk);
+ target = strdup(tok2);
+ dir = dirname(tok2);
+
+ /* add target dir to relative links */
+ if (tok1[0] != '/')
+ linkpath = xbps_xasprintf("%s/%s/%s", xhp->rootdir, dir, tok1);
+ else
+ linkpath = xbps_xasprintf("%s/%s", xhp->rootdir, tok1);
+
+ /* create target directory, necessary for dangling symlinks */
+ dir = xbps_xasprintf("%s/%s", xhp->rootdir, dir);
+ if (strcmp(dir, ".") && xbps_mkpath(dir, 0755) && errno != EEXIST) {
+ rv = errno;
+ xbps_dbg_printf(xhp,
+ "failed to create target dir '%s' for group '%s': %s\n",
+ dir, grname, strerror(errno));
+ free(dir);
+ goto err;
}
- free(lnk_dup);
-
- if (l[0] != '/') {
- lnk = xbps_xasprintf("%s%s/%s", xhp->rootdir, tgt_dir, l);
- free(tgt_dup);
- tgt_dup = strdup(tgt0);
- assert(tgt_dup);
- tgt = strdup(basename(tgt_dup));
- free(tgt_dup);
- } else {
- free(tgt_dup);
- tgt = strdup(tgt0);
- lnk = xbps_xasprintf("%s%s", xhp->rootdir, l);
+ free(dir);
+
+ /* create link directory, necessary for dangling symlinks */
+ p = strdup(linkpath);
+ dir = dirname(p);
+ if (strcmp(dir, ".") && xbps_mkpath(dir, 0755) && errno != EEXIST) {
+ rv = errno;
+ xbps_dbg_printf(xhp,
+ "failed to create symlink dir '%s' for group '%s': %s\n",
+ dir, grname, strerror(errno));
+ free(p);
+ goto err;
}
+ free(p);
+
xbps_set_cb_state(xhp, XBPS_STATE_ALTGROUP_LINK_ADDED, 0, NULL,
- "Creating '%s' alternatives group symlink: %s -> %s", grname, l, tgt);
- unlink(lnk);
- if (tgt[0] == '/') {
- tgt_dup = relpath(lnk + strlen(xhp->rootdir), tgt);
- free(tgt);
- tgt = tgt_dup;
+ "Creating '%s' alternatives group symlink: %s -> %s",
+ grname, tok1, target);
+
+ if (target[0] == '/') {
+ p = relpath(linkpath + strlen(xhp->rootdir), target);
+ free(target);
+ target = p;
}
- if ((rv = symlink(tgt, lnk)) != 0) {
- xbps_dbg_printf(xhp, "failed to create alt symlink '%s'"
- "for group '%s': %s\n", lnk, grname,
- strerror(errno));
- free(tgt);
- free(lnk);
- free(l);
- return rv;
+
+ unlink(linkpath);
+ if ((rv = symlink(target, linkpath)) != 0) {
+ xbps_dbg_printf(xhp,
+ "failed to create alt symlink '%s' for group '%s': %s\n",
+ linkpath, grname, strerror(errno));
+ goto err;
}
- free(tgt);
- free(lnk);
- free(l);
+
+ free(alternative);
+ free(target);
+ free(linkpath);
}
return 0;
+
+err:
+ free(alternative);
+ free(target);
+ free(linkpath);
+ return rv;
}
int

View File

@ -1,11 +0,0 @@
--- bin/xbps-install/util.c.orig 2016-04-24 19:23:18.366238066 +0200
+++ bin/xbps-install/util.c 2016-04-24 19:23:29.454218826 +0200
@@ -41,7 +41,7 @@ get_maxcols(void)
{
struct winsize ws;
- if (!isatty(STDOUT_FILENO) && errno == ENOTTY) {
+ if (!isatty(STDOUT_FILENO)) {
/* not a TTY, don't use any limit */
return 0;
}

View File

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.51
revision=21
version=0.52
revision=1
bootstrap=yes
build_style=configure
short_desc="The XBPS package system utilities"
@ -9,9 +9,7 @@ maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="https://github.com/voidlinux/xbps"
license="2-clause-BSD"
distfiles="https://github.com/voidlinux/xbps/archive/$version.tar.gz"
checksum=fb97f78a2d1e78ca7fb74426bbc7edac7af36366491dbcf3b97db3aa1b20a8b7
CFLAGS="-Wno-error"
checksum=f9a584d286c28eaf5a00f2e0ea9a8124b2200d50ecb62d26adcabe51f328b551
hostmakedepends="pkg-config"
makedepends="zlib-devel libressl-devel libarchive-devel"