xbps: update to 0.22.

This commit is contained in:
Juan RP 2013-03-23 08:31:16 +01:00
parent 18e59025b5
commit fe732a4229
7 changed files with 4 additions and 278 deletions

View File

@ -1,30 +0,0 @@
From b5d141e28c5387834f8a57cf0d7eb1fc89697ca4 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 13 Mar 2013 22:08:13 +0100
Subject: [PATCH] When checking for obsolete files ignore unexistent files.
---
NEWS | 7 ++++++-
lib/package_find_obsoletes.c | 6 ++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/package_find_obsoletes.c b/lib/package_find_obsoletes.c
index 874b137..51d6ddb 100644
--- lib/package_find_obsoletes.c
+++ lib/package_find_obsoletes.c
@@ -104,8 +104,10 @@ xbps_find_pkg_obsoletes(struct xbps_handle *xhp,
for (i = 0; i < prop_array_count(instfiles); i++) {
found = false;
obj = prop_array_get(instfiles, i);
- assert(prop_object_type(obj) == PROP_TYPE_DICTIONARY);
-
+ if (prop_object_type(obj) != PROP_TYPE_DICTIONARY) {
+ /* ignore unexistent files */
+ continue;
+ }
oldstr = prop_dictionary_get(obj, "file");
if (oldstr == NULL)
continue;
--
1.8.1.3

View File

@ -1,27 +0,0 @@
From dd9cf9737b7d47ba3e3ab90a49dfca340f2a8cdf Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Wed, 13 Mar 2013 23:15:42 +0100
Subject: [PATCH] xbps-query: fix segfault when listing unexistent package
files.
---
NEWS | 2 ++
bin/xbps-query/show-info-files.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/bin/xbps-query/show-info-files.c b/bin/xbps-query/show-info-files.c
index de5db5c..046eb37 100644
--- bin/xbps-query/show-info-files.c
+++ bin/xbps-query/show-info-files.c
@@ -223,6 +223,8 @@ show_pkg_files(prop_dictionary_t filesd)
for (x = 0; x < prop_array_count(array); x++) {
obj = prop_array_get(array, x);
+ if (prop_object_type(obj) != PROP_TYPE_DICTIONARY)
+ continue;
prop_dictionary_get_cstring_nocopy(obj, "file", &file);
printf("%s", file);
if (prop_dictionary_get_cstring_nocopy(obj,
--
1.8.1.3

View File

@ -1,32 +0,0 @@
From 7491c0e5847b5b4ccca5369442ae394e34ed6cb1 Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Fri, 15 Mar 2013 09:31:15 +0100
Subject: [PATCH] xbps-create: set root:root if e[gu]id == st.st_e[gu]id in
package files.
The rational is that packages should have proper perms to be installed
globally in a system as root, and fakeroot is useless when generating
packages with xbps-create when it's statically build.
---
NEWS | 4 ++++
bin/xbps-create/main.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c
index 913f63b..fad76fd 100644
--- bin/xbps-create/main.c
+++ bin/xbps-create/main.c
@@ -431,6 +431,10 @@ process_entry_file(struct archive *ar,
archive_entry_set_pathname(entry, xe->file);
archive_entry_copy_stat(entry, &st);
archive_entry_copy_sourcepath(entry, p);
+ if (st.st_uid == geteuid())
+ archive_entry_set_uname(entry, "root");
+ if (st.st_gid == getegid())
+ archive_entry_set_gname(entry, "root");
if (S_ISLNK(st.st_mode)) {
len = readlink(p, buf, sizeof(buf));
--
1.8.1.3

View File

@ -1,29 +0,0 @@
From a6c26f6c12c9abb8789e4ed01c188f83221e985b Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Fri, 15 Mar 2013 13:14:57 +0100
Subject: [PATCH 1/2] xbps-create: also set st_{uid,gid} to 0:0 in archived
files.
---
bin/xbps-create/main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/bin/xbps-create/main.c b/bin/xbps-create/main.c
index fad76fd..22e0e34 100644
--- bin/xbps-create/main.c
+++ bin/xbps-create/main.c
@@ -429,6 +429,11 @@ process_entry_file(struct archive *ar,
entry = archive_entry_new();
assert(entry);
archive_entry_set_pathname(entry, xe->file);
+ if (st.st_uid == geteuid())
+ st.st_uid = 0;
+ if (st.st_gid == getegid())
+ st.st_gid = 0;
+
archive_entry_copy_stat(entry, &st);
archive_entry_copy_sourcepath(entry, p);
if (st.st_uid == geteuid())
--
1.8.1.3

View File

@ -1,131 +0,0 @@
From 57bb7baf5ec91fcae69ed413e400760950ce492e Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Fri, 15 Mar 2013 13:18:30 +0100
Subject: [PATCH 2/2] unpack: use archive_entry_{filetype,uid,gid,mode} rather
than stored struct stat.
---
include/xbps_api.h.in | 2 +-
lib/package_unpack.c | 30 ++++++++++++++++--------------
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/include/xbps_api.h.in b/include/xbps_api.h.in
index 3fb9ecd..60df23a 100644
--- include/xbps_api.h.in
+++ include/xbps_api.h.in
@@ -48,7 +48,7 @@
*/
#define XBPS_PKGINDEX_VERSION "1.7"
-#define XBPS_API_VERSION "20130310"
+#define XBPS_API_VERSION "20130315"
#ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET"
diff --git a/lib/package_unpack.c b/lib/package_unpack.c
index 7fd3b5c..fd19250 100644
--- lib/package_unpack.c
+++ lib/package_unpack.c
@@ -91,7 +91,6 @@ unpack_archive(struct xbps_handle *xhp,
prop_object_t obj;
prop_data_t data;
void *instbuf = NULL, *rembuf = NULL;
- const struct stat *entry_statp;
struct stat st;
struct xbps_unpack_cb_data xucd;
struct archive_entry *entry;
@@ -99,7 +98,7 @@ unpack_archive(struct xbps_handle *xhp,
ssize_t entry_size;
const char *file, *entry_pname, *transact, *tgtlnk;
char *pkgname, *dname, *buf, *buf2, *p, *p2;
- int ar_rv, rv, flags;
+ int ar_rv, rv, entry_type, flags;
bool preserve, update, conf_file, file_exists, skip_obsoletes;
bool softreplace, skip_extract, force;
uid_t euid;
@@ -152,6 +151,7 @@ unpack_archive(struct xbps_handle *xhp,
/*
* Process the archive files.
*/
+ flags = set_extract_flags(euid);
for (;;) {
ar_rv = archive_read_next_header(ar, &entry);
if (ar_rv == ARCHIVE_EOF || ar_rv == ARCHIVE_FATAL)
@@ -159,14 +159,13 @@ unpack_archive(struct xbps_handle *xhp,
else if (ar_rv == ARCHIVE_RETRY)
continue;
- entry_statp = archive_entry_stat(entry);
entry_pname = archive_entry_pathname(entry);
entry_size = archive_entry_size(entry);
- flags = set_extract_flags(euid);
+ entry_type = archive_entry_filetype(entry);
/*
* Ignore directories from archive.
*/
- if (S_ISDIR(entry_statp->st_mode)) {
+ if (entry_type == AE_IFDIR) {
archive_read_data_skip(ar);
continue;
}
@@ -291,7 +290,7 @@ unpack_archive(struct xbps_handle *xhp,
if (lstat(entry_pname, &st) == 0)
file_exists = true;
- if (!force && S_ISREG(entry_statp->st_mode)) {
+ if (!force && (entry_type == AE_IFREG)) {
buf = strchr(entry_pname, '.') + 1;
assert(buf != NULL);
if (file_exists) {
@@ -343,7 +342,7 @@ unpack_archive(struct xbps_handle *xhp,
}
}
}
- } else if (!force && S_ISLNK(entry_statp->st_mode)) {
+ } else if (!force && (entry_type == AE_IFLNK)) {
/*
* Check if current link from binpkg hasn't been
* modified, otherwise extract new link.
@@ -386,9 +385,9 @@ unpack_archive(struct xbps_handle *xhp,
* in binpkg and apply perms if true.
*/
if (!force && file_exists && skip_extract &&
- (entry_statp->st_mode != st.st_mode)) {
+ (archive_entry_mode(entry) != st.st_mode)) {
if (chmod(entry_pname,
- entry_statp->st_mode) != 0) {
+ archive_entry_mode(entry)) != 0) {
xbps_dbg_printf(xhp,
"%s: failed "
"to set perms %s to %s: %s\n",
@@ -407,19 +406,22 @@ unpack_archive(struct xbps_handle *xhp,
* and change permissions if true.
*/
if ((!force && file_exists && skip_extract && (euid == 0)) &&
- (((entry_statp->st_uid != st.st_uid)) ||
- ((entry_statp->st_gid != st.st_gid)))) {
+ (((archive_entry_uid(entry) != st.st_uid)) ||
+ ((archive_entry_gid(entry) != st.st_gid)))) {
if (chown(entry_pname,
- entry_statp->st_uid, entry_statp->st_gid) != 0) {
+ archive_entry_uid(entry),
+ archive_entry_gid(entry)) != 0) {
xbps_dbg_printf(xhp,
"%s: failed "
"to set uid/gid to %u:%u (%s)\n",
- pkgver, entry_statp->st_uid, entry_statp->st_gid,
+ pkgver, archive_entry_uid(entry),
+ archive_entry_gid(entry),
strerror(errno));
} else {
xbps_dbg_printf(xhp, "%s: entry %s changed "
"uid/gid to %u:%u.\n", pkgver, entry_pname,
- entry_statp->st_uid, entry_statp->st_gid);
+ archive_entry_uid(entry),
+ archive_entry_gid(entry));
}
}
--
1.8.1.3

View File

@ -1,25 +0,0 @@
From 8d6f3b5029b889e2865fc8ace4a2eacb56e5962a Mon Sep 17 00:00:00 2001
From: Juan RP <xtraeme@gmail.com>
Date: Sun, 17 Mar 2013 17:13:07 +0100
Subject: [PATCH] unpack: use lchown(2) to set proper uid/gid to symlinks.
---
lib/package_unpack.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/package_unpack.c b/lib/package_unpack.c
index fd19250..bf37690 100644
--- lib/package_unpack.c
+++ lib/package_unpack.c
@@ -408,7 +408,7 @@ unpack_archive(struct xbps_handle *xhp,
if ((!force && file_exists && skip_extract && (euid == 0)) &&
(((archive_entry_uid(entry) != st.st_uid)) ||
((archive_entry_gid(entry) != st.st_gid)))) {
- if (chown(entry_pname,
+ if (lchown(entry_pname,
archive_entry_uid(entry),
archive_entry_gid(entry)) != 0) {
xbps_dbg_printf(xhp,
--
1.8.1.3

View File

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.21
revision=6
version=0.22
revision=1
build_style=configure
configure_args="--prefix=/ --exec-prefix=/usr --sbindir=/usr/sbin
--enable-static --enable-debug --enable-tests"
@ -16,9 +16,9 @@ maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://code.google.com/p/xbps"
license="Simplified BSD"
distfiles="http://xbps.googlecode.com/files/xbps-$version.tar.gz"
checksum=eeacf20277479975f113198e97e031e8a9960bf567c7ab1fd227a4c6f5ddeae9
checksum=717cd34e0ee42215e23d32e00098d64493488a247b631384fa233f12e647f6ca
if [ -n "$XBPS_CROSS_TRIPLET" ]; then
if [ "$XBPS_CROSS_BUILD" ]; then
makedepends="which pkg-config"
crossmakedepends="proplib-devel>=0.6.2 openssl-devel libfetch-devel
libarchive-devel>=3.1.2 confuse-devel atf-devel"