xbps: update to 0.38.

This commit is contained in:
Juan RP 2014-09-14 19:06:29 +02:00
parent ff68d4d303
commit 2cfa17320e
5 changed files with 2 additions and 284 deletions

View file

@ -1,99 +0,0 @@
From 633c20a2e622555365d649911acf5996838244a0 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Sat, 28 Jun 2014 12:01:00 +0200
Subject: [PATCH] libfetch: merge TLS SNI support from NetBSD with some other
random changes.
Close GH #41
---
NEWS | 5 +++++
lib/fetch/common.c | 26 ++++++++++++++++++++++----
lib/fetch/common.h | 2 +-
lib/fetch/http.c | 3 ++-
4 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/lib/fetch/common.c b/lib/fetch/common.c
index 8d7d3f5..5b03348 100644
--- lib/fetch/common.c
+++ lib/fetch/common.c
@@ -434,10 +434,12 @@ fetch_cache_put(conn_t *conn, int (*closecb)(conn_t *))
* Enable SSL on a connection.
*/
int
-fetch_ssl(conn_t *conn, int verbose)
+fetch_ssl(conn_t *conn, const struct url *URL, int verbose)
{
#ifdef WITH_SSL
+ int ret;
+
/* Init the SSL library and context */
if (!SSL_library_init()){
fprintf(stderr, "SSL library init failed\n");
@@ -455,9 +457,21 @@ fetch_ssl(conn_t *conn, int verbose)
fprintf(stderr, "SSL context creation failed\n");
return (-1);
}
- SSL_set_fd(conn->ssl, conn->sd);
- if (SSL_connect(conn->ssl) == -1){
- ERR_print_errors_fp(stderr);
+ SSL_set_connect_state(conn->ssl);
+ if (!SSL_set_fd(conn->ssl, conn->sd)) {
+ fprintf(stderr, "SSL_set_fd failed\n");
+ return (-1);
+ }
+#ifndef OPENSSL_NO_TLSEXT
+ if (!SSL_set_tlsext_host_name(conn->ssl, URL->host)) {
+ fprintf(stderr,
+ "TLS server name indication extension failed for host %s\n",
+ URL->host);
+ return (-1);
+ }
+#endif
+ if ((ret = SSL_connect(conn->ssl)) <= 0){
+ fprintf(stderr, "SSL_connect returned %d\n", SSL_get_error(conn->ssl, ret));
return (-1);
}
@@ -717,6 +731,10 @@ fetch_close(conn_t *conn)
{
int ret;
+#ifdef WITH_SSL
+ SSL_shutdown(conn->ssl);
+ SSL_free(conn->ssl);
+#endif
ret = close(conn->sd);
if (conn->cache_url)
fetchFreeURL(conn->cache_url);
diff --git a/lib/fetch/common.h b/lib/fetch/common.h
index 4e4408c..231fb02 100644
--- lib/fetch/common.h
+++ lib/fetch/common.h
@@ -98,7 +98,7 @@ conn_t *fetch_cache_get(const struct url *, int);
void fetch_cache_put(conn_t *, int (*)(conn_t *));
conn_t *fetch_connect(struct url *, int, int);
conn_t *fetch_reopen(int);
-int fetch_ssl(conn_t *, int);
+int fetch_ssl(conn_t *, const struct url *, int);
ssize_t fetch_read(conn_t *, char *, size_t);
int fetch_getln(conn_t *);
ssize_t fetch_write(conn_t *, const void *, size_t);
diff --git a/lib/fetch/http.c b/lib/fetch/http.c
index adc5590..122d9c1 100644
--- lib/fetch/http.c
+++ lib/fetch/http.c
@@ -740,8 +740,9 @@ http_connect(struct url *URL, struct url *purl, const char *flags, int *cached)
if ((conn = fetch_connect(URL, af, verbose)) == NULL)
/* fetch_connect() has already set an error code */
return (NULL);
+
if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 &&
- fetch_ssl(conn, verbose) == -1) {
+ fetch_ssl(conn, URL, verbose) != 0) {
fetch_close(conn);
/* grrr */
#ifdef EAUTH
--
2.0.1

View file

@ -1,30 +0,0 @@
From 7bb36ddaa25e17df3ab3b6bf3454f1e7957d444d Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Sat, 28 Jun 2014 12:12:03 +0200
Subject: [PATCH] libfetch: fetch_close: make sure conn->ssl is valid before
shutting down.
---
lib/fetch/common.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/fetch/common.c b/lib/fetch/common.c
index 5b03348..7764b27 100644
--- lib/fetch/common.c
+++ lib/fetch/common.c
@@ -732,8 +732,10 @@ fetch_close(conn_t *conn)
int ret;
#ifdef WITH_SSL
- SSL_shutdown(conn->ssl);
- SSL_free(conn->ssl);
+ if (conn->ssl) {
+ SSL_shutdown(conn->ssl);
+ SSL_free(conn->ssl);
+ }
#endif
ret = close(conn->sd);
if (conn->cache_url)
--
2.0.1

View file

@ -1,97 +0,0 @@
From 21f32a75c5d95dc2e1917c56a99aef17dc3054d6 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Tue, 1 Jul 2014 15:35:55 +0200
Subject: [PATCH] Fixed a new issue with vpkgs replacing the same vpkg they are
providing.
Added a new testcase to verify its correctness.
---
NEWS | 5 ++++
lib/transaction_sortdeps.c | 3 ++-
tests/xbps/libxbps/shell/vpkg_test.sh | 46 ++++++++++++++++++++++++++++++++---
3 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/lib/transaction_sortdeps.c b/lib/transaction_sortdeps.c
index c7114dd..05652af 100644
--- lib/transaction_sortdeps.c
+++ lib/transaction_sortdeps.c
@@ -316,7 +316,8 @@ xbps_transaction_sort(struct xbps_handle *xhp)
}
}
}
- if (!vpkg_found && (pd = pkgdep_find(pkgver)) == NULL) {
+ pd = pkgdep_find(pkgver);
+ if ((!strcmp(tract, "remove") || (!pd && !vpkg_found))) {
/*
* If package not in list, just add to the tail.
*/
diff --git a/tests/xbps/libxbps/shell/vpkg_test.sh b/tests/xbps/libxbps/shell/vpkg_test.sh
index 2b3ba95..ba311bc 100644
--- tests/xbps/libxbps/shell/vpkg_test.sh
+++ tests/xbps/libxbps/shell/vpkg_test.sh
@@ -13,13 +13,13 @@
# D should replace A only if it has "replaces" property on A. The result should be
# that D must be installed and A being as is.
-atf_test_case vpkg_noupdate
+atf_test_case vpkg00
-vpkg_noupdate_head() {
+vpkg00_head() {
atf_set "descr" "Tests for virtual pkgs: don't update vpkg"
}
-vpkg_noupdate_body() {
+vpkg00_body() {
mkdir some_repo
mkdir -p pkg_{A,B,C,D}/usr/bin
cd some_repo
@@ -42,6 +42,44 @@ vpkg_noupdate_body() {
atf_check_equal $? 0
}
+atf_test_case vpkg01
+
+vpkg01_head() {
+ atf_set "descr" "Tests for virtual pkgs: commit ebc0f27ae1c"
+}
+
+vpkg01_body() {
+ mkdir some_repo
+ mkdir -p pkg_{A,B,C,D}/usr/bin
+ mkdir -p pkg_C/usr/share/xbps/virtualpkg.d
+ echo "virtualpkg=A-1.0_1:C" > pkg_C/usr/share/xbps/virtualpkg.d/C.conf
+ cd some_repo
+ xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
+ atf_check_equal $? 0
+ xbps-create -A noarch -n B-1.0_1 -s "B pkg" --dependencies "A>=0" ../pkg_B
+ atf_check_equal $? 0
+ xbps-create -A noarch -n C-1.0_1 -s "C pkg" --provides "A-1.0_1" --replaces="A>=0" ../pkg_C
+ atf_check_equal $? 0
+ xbps-create -A noarch -n D-1.0_1 -s "D pkg" --dependencies "C>=0" ../pkg_D
+ atf_check_equal $? 0
+
+ xbps-rindex -a *.xbps
+ atf_check_equal $? 0
+ cd ..
+
+ xbps-install -C empty.conf -r root --repository=$PWD/some_repo -dy B
+ atf_check_equal $? 0
+ xbps-install -C empty.conf -r root --repository=$PWD/some_repo -dy D
+ atf_check_equal $? 0
+
+ out=$(xbps-query -C empty.conf -r root -l|awk '{print $2}'|tr -d '\n')
+ exp="B-1.0_1C-1.0_1D-1.0_1"
+ echo "out: $out"
+ echo "exp: $exp"
+ atf_check_equal $out $exp
+}
+
atf_init_test_cases() {
- atf_add_test_case vpkg_noupdate
+ atf_add_test_case vpkg00
+ atf_add_test_case vpkg01
}
--
2.0.1

View file

@ -1,51 +0,0 @@
From 5a1919e5206c589b8bf682a288a8954413647e69 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Sat, 23 Aug 2014 15:54:24 +0200
Subject: [PATCH] xbps_pkg_is_installed(): a pkg in "unpacked" state is now
accepted as installed too.
The reason is that even if the pkg was not configured, it should still be accepted
as installed. If installing packages via XBPS_TARGET_ARCH, pkgs are never configured,
so this must be taken into account.
Will be cherry-picked to 0.37 meanwhile.
---
include/xbps.h.in | 3 ++-
lib/util.c | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/xbps.h.in b/include/xbps.h.in
index 5e7fb31..90d7ef4 100644
--- include/xbps.h.in
+++ include/xbps.h.in
@@ -1635,7 +1635,8 @@ int xbps_file_hash_check(const char *file, const char *sha256);
bool xbps_verify_file_signature(struct xbps_repo *repo, const char *fname);
/**
- * Checks if a package is currently installed by matching \a pkg.
+ * Checks if a package is currently installed in pkgdb by matching \a pkg.
+ * To be installed, the pkg must be in "installed" or "unpacked" state.
*
* @param[in] xhp The pointer to an xbps_handle struct.
* @param[in] pkg Package name, version pattern or exact pkg to match.
diff --git a/lib/util.c b/lib/util.c
index d10bcee..a34b706 100644
--- lib/util.c
+++ lib/util.c
@@ -79,10 +79,10 @@ xbps_pkg_is_installed(struct xbps_handle *xhp, const char *pkg)
*/
if (xbps_pkg_state_dictionary(dict, &state) != 0)
return -1; /* error */
- if (state != XBPS_PKG_STATE_INSTALLED)
- return 0; /* not fully installed */
+ if (state == XBPS_PKG_STATE_INSTALLED || state == XBPS_PKG_STATE_UNPACKED)
+ return 1;
- return 1;
+ return 0; /* not fully installed */
}
const char *
--
2.1.0

View file

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.37
revision=6
version=0.38
revision=1
bootstrap=yes
short_desc="The XBPS package system utilities"
maintainer="Juan RP <xtraeme@gmail.com>"
@ -11,7 +11,6 @@ license="Simplified BSD"
makedepends="zlib-devel libressl-devel libarchive-devel>=3.1.2"
depends="xbps-triggers>=0.75"
conf_files="/etc/xbps/xbps.conf"
replaces="xbps>=0"
if [ -z "$CHROOT_READY" ]; then
CFLAGS+=" -idirafter ${XBPS_MASTERDIR}/usr/include"
@ -22,7 +21,6 @@ else
xbps-tests_package() {
short_desc+=" - Kyua testsuite"
replaces="xbps<0.16.3_2 xbps-tests>=0"
pkg_install() {
vmove usr/tests
}
@ -56,16 +54,13 @@ do_install() {
libxbps_package() {
short_desc+=" - runtime library"
replaces="xbps<0.16.3_2 libxbps>=0"
pkg_install() {
vmove "usr/lib/*.so.*"
}
}
libxbps-devel_package() {
short_desc+=" - runtime library (development files)"
depends="zlib-devel libarchive-devel libxbps>=${version}"
replaces="xbps-static<0.16.3_2 libxbps-devel>=0"
pkg_install() {
vmove usr/include
vmove "usr/lib/*.a"