xbps: update to 0.27.

This commit is contained in:
Juan RP 2013-11-29 10:29:44 +01:00
parent 9cc4f70125
commit 4d7af294e8
3 changed files with 5 additions and 199 deletions

View file

@ -1,94 +0,0 @@
From c9825feb2948476064d895043ef84ebc1a2893a3 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Sun, 17 Nov 2013 12:25:02 +0100
Subject: [PATCH] util.c: add stricter checks for pkgver conformance (v2).
There was another case where it now was failing: "fs-utils-v1.00_1".
Previous code didn't take into account that a valid version might also
contain a non digit after '-'.
Added more tests to the testsuite to verify its correctness.
---
lib/util.c | 28 ++++++++++++++++++++--------
tests/xbps/libxbps/util/main.c | 3 +++
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/lib/util.c b/lib/util.c
index c2593c3..dcea8a9 100644
--- lib/util.c
+++ lib/util.c
@@ -93,14 +93,20 @@ const char *
xbps_pkg_version(const char *pkg)
{
const char *p;
+ bool valid = false;
if ((p = strrchr(pkg, '-')) == NULL)
return NULL;
- if (!isdigit((unsigned char)p[1]))
- return NULL;
-
- if (strchr(p, '_') == NULL)
+ for (unsigned int i = 0; i < strlen(p); i++) {
+ if (p[i] == '_')
+ break;
+ if (isdigit((unsigned char)p[i]) && strchr(p, '_')) {
+ valid = true;
+ break;
+ }
+ }
+ if (!valid)
return NULL;
return p + 1; /* skip first '_' */
@@ -129,14 +135,20 @@ xbps_pkg_name(const char *pkg)
const char *p;
char *buf;
unsigned int len;
+ bool valid = false;
if ((p = strrchr(pkg, '-')) == NULL)
return NULL;
- if (!isdigit((unsigned char)p[1]))
- return NULL;
-
- if (strchr(p, '_') == NULL)
+ for (unsigned int i = 0; i < strlen(p); i++) {
+ if (p[i] == '_')
+ break;
+ if (isdigit((unsigned char)p[i]) && strchr(p, '_')) {
+ valid = true;
+ break;
+ }
+ }
+ if (!valid)
return NULL;
len = strlen(pkg) - strlen(p) + 1;
diff --git a/tests/xbps/libxbps/util/main.c b/tests/xbps/libxbps/util/main.c
index cc1cb65..5a720eb 100644
--- tests/libxbps/util/main.c
+++ tests/libxbps/util/main.c
@@ -41,6 +41,8 @@ ATF_TC_BODY(util_test, tc)
ATF_CHECK_EQ(xbps_pkg_name("font-adobe-100dpi"), NULL);
ATF_CHECK_EQ(xbps_pkg_name("font-adobe-100dpi-7.8"), NULL);
ATF_CHECK_EQ(xbps_pkg_name("python-e_dbus"), NULL);
+ ATF_CHECK_EQ(xbps_pkg_name("fs-utils-v1"), NULL);
+ ATF_CHECK_EQ(xbps_pkg_name("fs-utils-v_1"), NULL);
ATF_CHECK_EQ(xbps_pkg_version("font-adobe-100dpi"), NULL);
ATF_CHECK_EQ(xbps_pkg_version("font-adobe-100dpi-7.8"), NULL);
ATF_CHECK_EQ(xbps_pkg_version("python-e_dbus"), NULL);
@@ -52,6 +54,7 @@ ATF_TC_BODY(util_test, tc)
ATF_REQUIRE_STREQ(xbps_pkg_version("font-adobe-100dpi-7.8_2"), "7.8_2");
ATF_REQUIRE_STREQ(xbps_pkg_version("font-adobe-100dpi-1.8_blah"), "1.8_blah");
ATF_REQUIRE_STREQ(xbps_pkg_version("python-e_dbus-1_1"), "1_1");
+ ATF_REQUIRE_STREQ(xbps_pkg_version("fs-utils-v1_1"), "v1_1");
ATF_REQUIRE_STREQ(xbps_pkg_revision("systemd-43_1_0"), "0");
ATF_REQUIRE_STREQ(xbps_pkg_revision("systemd_21-43_0"), "0");
ATF_REQUIRE_STREQ(xbps_pkgpattern_name("systemd>=43"), "systemd");
--
1.8.4.1

View file

@ -1,99 +0,0 @@
From c44d7070a4152cbb8279e10fa6206557dd7d6772 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Sun, 17 Nov 2013 11:34:14 +0100
Subject: [PATCH] util.c: add stricter checks for pkgver conformance.
Make xbps_pkg_{name,version} return NULL if next character
after the last '-' character is not a digit, and if there's a digit
make sure that there exists a '_' character too.
Added more tests to the testsuite to catch this. With these changes
'python-e_dbus' is properly detected and validated.
---
lib/util.c | 14 ++++++++++++--
tests/xbps/libxbps/util/main.c | 10 +++++++++-
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/lib/util.c b/lib/util.c
index 37cae80..c2593c3 100644
--- lib/util.c
+++ lib/util.c
@@ -38,6 +38,7 @@
#include <string.h>
#include <errno.h>
#include <fnmatch.h>
+#include <ctype.h>
#include <sys/utsname.h>
#include "xbps_api_impl.h"
@@ -96,7 +97,10 @@ xbps_pkg_version(const char *pkg)
if ((p = strrchr(pkg, '-')) == NULL)
return NULL;
- if (strrchr(p, '_') == NULL)
+ if (!isdigit((unsigned char)p[1]))
+ return NULL;
+
+ if (strchr(p, '_') == NULL)
return NULL;
return p + 1; /* skip first '_' */
@@ -113,6 +117,9 @@ xbps_pkg_revision(const char *pkg)
if ((p = strrchr(pkg, '_')) == NULL)
return NULL;
+ if (!isdigit((unsigned char)p[1]))
+ return NULL;
+
return p + 1; /* skip first '_' */
}
@@ -126,7 +133,10 @@ xbps_pkg_name(const char *pkg)
if ((p = strrchr(pkg, '-')) == NULL)
return NULL;
- if (strrchr(p, '_') == NULL)
+ if (!isdigit((unsigned char)p[1]))
+ return NULL;
+
+ if (strchr(p, '_') == NULL)
return NULL;
len = strlen(pkg) - strlen(p) + 1;
diff --git a/tests/xbps/libxbps/util/main.c b/tests/xbps/libxbps/util/main.c
index 7fa85ef..cc1cb65 100644
--- tests/libxbps/util/main.c
+++ tests/libxbps/util/main.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2012 Juan Romero Pardines.
+ * Copyright (c) 2012-2013 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,14 +36,22 @@ ATF_TC_HEAD(util_test, tc)
ATF_TC_BODY(util_test, tc)
{
+ ATF_CHECK_EQ(xbps_pkg_name("font-adobe-a"), NULL);
+ ATF_CHECK_EQ(xbps_pkg_name("font-adobe-1"), NULL);
+ ATF_CHECK_EQ(xbps_pkg_name("font-adobe-100dpi"), NULL);
ATF_CHECK_EQ(xbps_pkg_name("font-adobe-100dpi-7.8"), NULL);
+ ATF_CHECK_EQ(xbps_pkg_name("python-e_dbus"), NULL);
ATF_CHECK_EQ(xbps_pkg_version("font-adobe-100dpi"), NULL);
ATF_CHECK_EQ(xbps_pkg_version("font-adobe-100dpi-7.8"), NULL);
+ ATF_CHECK_EQ(xbps_pkg_version("python-e_dbus"), NULL);
+ ATF_CHECK_EQ(xbps_pkg_version("python-e_dbus-1"), NULL);
ATF_REQUIRE_STREQ(xbps_pkg_name("font-adobe-100dpi-7.8_2"), "font-adobe-100dpi");
ATF_REQUIRE_STREQ(xbps_pkg_name("systemd-43_1"), "systemd");
ATF_REQUIRE_STREQ(xbps_pkg_name("font-adobe-100dpi-1.8_blah"), "font-adobe-100dpi");
+ ATF_REQUIRE_STREQ(xbps_pkg_name("python-e_dbus-1.0_1"), "python-e_dbus");
ATF_REQUIRE_STREQ(xbps_pkg_version("font-adobe-100dpi-7.8_2"), "7.8_2");
ATF_REQUIRE_STREQ(xbps_pkg_version("font-adobe-100dpi-1.8_blah"), "1.8_blah");
+ ATF_REQUIRE_STREQ(xbps_pkg_version("python-e_dbus-1_1"), "1_1");
ATF_REQUIRE_STREQ(xbps_pkg_revision("systemd-43_1_0"), "0");
ATF_REQUIRE_STREQ(xbps_pkg_revision("systemd_21-43_0"), "0");
ATF_REQUIRE_STREQ(xbps_pkgpattern_name("systemd>=43"), "systemd");
--
1.8.4.1

View file

@ -1,17 +1,16 @@
# Template file for 'xbps'
pkgname=xbps
version=0.26.2
revision=3
version=0.27
revision=1
bootstrap=yes
build_style=configure
configure_args="--prefix=/usr --sysconfdir=/etc --enable-static --enable-debug"
makedepends="zlib-devel openssl-devel libarchive-devel>=3.1.2 confuse-devel"
short_desc="The XBPS package system utilities"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://xtraeme.github.io/xbps"
homepage="http://www.voidlinux.eu/xbps"
license="Simplified BSD"
bootstrap=yes
if [ -z "$CHROOT_READY" ]; then
CFLAGS+=" -idirafter ${XBPS_MASTERDIR}/usr/include"
LDFLAGS+=" -L${XBPS_MASTERDIR}/usr/lib"
@ -31,7 +30,7 @@ xbps-tests_package() {
fi
do_fetch() {
git clone -b${version} git://github.com/xtraeme/xbps.git xbps-${version}
git clone -b${version} git://github.com/voidlinux/xbps.git xbps-${version}
}
libxbps_package() {