Commit ff70a752 authored by Natanael Copa's avatar Natanael Copa

main/apk-tools: upgrade to 2.0_rc2

parent 7dcd416a
From 2cfca5b6ed658433419f9b581b3ba30f34c973c4 Mon Sep 17 00:00:00 2001
From: Timo Teras <timo.teras@iki.fi>
Date: Wed, 5 Aug 2009 19:10:54 +0300
Subject: [PATCH 1/7] info: fix a --exists to work if the name is non-existant
---
src/info.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/info.c b/src/info.c
index a222b8c..073dc80 100644
--- a/src/info.c
+++ b/src/info.c
@@ -94,6 +94,9 @@ static int info_exists(struct info_ctx *ctx, struct apk_database *db,
continue;
name = dep.name;
+ if (name->pkgs == NULL)
+ continue;
+
for (j = 0; j < name->pkgs->num; j++) {
pkg = name->pkgs->item[j];
if (apk_pkg_get_state(pkg) == APK_PKG_INSTALLED)
--
1.6.4
From 7419771b02e84a91a71b12869a40208fd2e8b773 Mon Sep 17 00:00:00 2001
From: Timo Teras <timo.teras@iki.fi>
Date: Thu, 6 Aug 2009 08:57:50 +0300
Subject: [PATCH 2/7] audit: fix --backup
---
src/audit.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/audit.c b/src/audit.c
index d61b321..e47f182 100644
--- a/src/audit.c
+++ b/src/audit.c
@@ -51,6 +51,9 @@ static int audit_directory(apk_hash_item item, void *ctx)
char tmp[PATH_MAX], reason;
DIR *dir;
+ if (!(dbd->flags & APK_DBDIRF_PROTECTED))
+ return 0;
+
dir = fdopendir(openat(db->root_fd, dbd->name, O_RDONLY));
if (dir == NULL)
return 0;
@@ -97,7 +100,7 @@ static int audit_directory(apk_hash_item item, void *ctx)
static int audit_backup(struct apk_database *db)
{
- return apk_hash_foreach(&db->installed.dirs, audit_directory, &db);
+ return apk_hash_foreach(&db->installed.dirs, audit_directory, db);
}
static int audit_system(struct apk_database *db)
--
1.6.4
From 6f1de8cd530f598f3f79414390d98fd8e683f2af Mon Sep 17 00:00:00 2001
From: Timo Teras <timo.teras@iki.fi>
Date: Thu, 6 Aug 2009 10:17:28 +0300
Subject: [PATCH 3/7] db: command line repositories take preference
over the ones in config file. also remove the apk_root == NULL
check as this cannot happen anymore. a valid root is always
required.
---
src/database.c | 145 +++++++++++++++++++++++++++-----------------------------
1 files changed, 70 insertions(+), 75 deletions(-)
diff --git a/src/database.c b/src/database.c
index 30e0431..834383b 100644
--- a/src/database.c
+++ b/src/database.c
@@ -895,59 +895,56 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
db->cache_dir = apk_static_cache_dir;
db->permanent = 1;
- if (root != NULL) {
- db->root = strdup(root);
- db->root_fd = openat(AT_FDCWD, db->root, O_RDONLY);
- if (db->root_fd < 0 && (flags & APK_OPENF_CREATE)) {
- mkdirat(AT_FDCWD, db->root, 0755);
- db->root_fd = openat(AT_FDCWD, root, O_RDONLY);
- }
- if (db->root_fd < 0) {
- msg = "Unable to open root";
- goto ret_errno;
- }
- if (fstat64(db->root_fd, &st) != 0 || major(st.st_dev) == 0)
- db->permanent = 0;
-
- if (fstatat64(db->root_fd, apk_linked_cache_dir, &st, 0) == 0 &&
- S_ISDIR(st.st_mode))
- db->cache_dir = apk_linked_cache_dir;
-
- if (flags & APK_OPENF_WRITE) {
+ db->root = strdup(root);
+ db->root_fd = openat(AT_FDCWD, db->root, O_RDONLY);
+ if (db->root_fd < 0 && (flags & APK_OPENF_CREATE)) {
+ mkdirat(AT_FDCWD, db->root, 0755);
+ db->root_fd = openat(AT_FDCWD, root, O_RDONLY);
+ }
+ if (db->root_fd < 0) {
+ msg = "Unable to open root";
+ goto ret_errno;
+ }
+ if (fstat64(db->root_fd, &st) != 0 || major(st.st_dev) == 0)
+ db->permanent = 0;
+
+ if (fstatat64(db->root_fd, apk_linked_cache_dir, &st, 0) == 0 &&
+ S_ISDIR(st.st_mode))
+ db->cache_dir = apk_linked_cache_dir;
+
+ if (flags & APK_OPENF_WRITE) {
+ db->lock_fd = openat(db->root_fd, "var/lib/apk/lock",
+ O_CREAT | O_RDWR, 0400);
+ if (db->lock_fd < 0 && errno == ENOENT &&
+ (flags & APK_OPENF_CREATE)) {
+ r = apk_db_create(db);
+ if (r != 0) {
+ msg = "Unable to create database";
+ goto ret_r;
+ }
db->lock_fd = openat(db->root_fd, "var/lib/apk/lock",
O_CREAT | O_RDWR, 0400);
- if (db->lock_fd < 0 && errno == ENOENT &&
- (flags & APK_OPENF_CREATE)) {
- r = apk_db_create(db);
- if (r != 0) {
- msg = "Unable to create database";
- goto ret_r;
- }
- db->lock_fd = openat(db->root_fd,
- "var/lib/apk/lock",
- O_CREAT | O_RDWR, 0400);
- }
- if (db->lock_fd < 0 ||
- flock(db->lock_fd, LOCK_EX | LOCK_NB) < 0) {
- msg = "Unable to lock database";
- if (apk_wait) {
- struct sigaction sa, old_sa;
-
- apk_message("Waiting for repository lock");
- memset(&sa, 0, sizeof sa);
- sa.sa_handler = handle_alarm;
- sa.sa_flags = SA_ONESHOT;
- sigaction(SIGALRM, &sa, &old_sa);
-
- alarm(apk_wait);
- if (flock(db->lock_fd, LOCK_EX) < 0)
- goto ret_errno;
-
- alarm(0);
- sigaction(SIGALRM, &old_sa, NULL);
- } else
+ }
+ if (db->lock_fd < 0 ||
+ flock(db->lock_fd, LOCK_EX | LOCK_NB) < 0) {
+ msg = "Unable to lock database";
+ if (apk_wait) {
+ struct sigaction sa, old_sa;
+
+ apk_message("Waiting for repository lock");
+ memset(&sa, 0, sizeof sa);
+ sa.sa_handler = handle_alarm;
+ sa.sa_flags = SA_ONESHOT;
+ sigaction(SIGALRM, &sa, &old_sa);
+
+ alarm(apk_wait);
+ if (flock(db->lock_fd, LOCK_EX) < 0)
goto ret_errno;
- }
+
+ alarm(0);
+ sigaction(SIGALRM, &old_sa, NULL);
+ } else
+ goto ret_errno;
}
}
@@ -959,33 +956,18 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
db->cachetmp_fd = openat(db->cache_fd, "tmp", O_RDONLY);
db->keys_fd = openat(db->root_fd, "etc/apk/keys", O_RDONLY);
- if (root != NULL) {
- r = apk_db_read_state(db, flags);
- if (r == -ENOENT && (flags & APK_OPENF_CREATE)) {
- r = apk_db_create(db);
- if (r != 0) {
- msg = "Unable to create database";
- goto ret_r;
- }
- r = apk_db_read_state(db, flags);
- }
+ r = apk_db_read_state(db, flags);
+ if (r == -ENOENT && (flags & APK_OPENF_CREATE)) {
+ r = apk_db_create(db);
if (r != 0) {
- msg = "Unable to read database state";
+ msg = "Unable to create database";
goto ret_r;
}
-
- if (!(flags & APK_OPENF_NO_REPOS)) {
- if (apk_repos == NULL)
- apk_repos = "etc/apk/repositories";
- blob = apk_blob_from_file(db->root_fd, apk_repos);
- if (!APK_BLOB_IS_NULL(blob)) {
- r = apk_blob_for_each_segment(
- blob, "\n",
- apk_db_add_repository, db);
- rr = r ?: rr;
- free(blob.ptr);
- }
- }
+ r = apk_db_read_state(db, flags);
+ }
+ if (r != 0) {
+ msg = "Unable to read database state";
+ goto ret_r;
}
if (!(flags & APK_OPENF_NO_REPOS)) {
@@ -993,10 +975,23 @@ int apk_db_open(struct apk_database *db, const char *root, unsigned int flags)
r = apk_db_add_repository(db, APK_BLOB_STR(repo->url));
rr = r ?: rr;
}
-
+ if (apk_repos == NULL)
+ apk_repos = "etc/apk/repositories";
+ blob = apk_blob_from_file(db->root_fd, apk_repos);
+ if (!APK_BLOB_IS_NULL(blob)) {
+ r = apk_blob_for_each_segment(
+ blob, "\n",
+ apk_db_add_repository, db);
+ rr = r ?: rr;
+ free(blob.ptr);
+ }
if (apk_flags & APK_UPDATE_CACHE)
apk_db_index_write_nr_cache(db);
}
+ if (rr != 0) {
+ r = rr;
+ goto ret_r;
+ }
return rr;
--
1.6.4
From 0b2052ed064708767358290a73d600ed55fee5b2 Mon Sep 17 00:00:00 2001
From: Timo Teras <timo.teras@iki.fi>
Date: Thu, 6 Aug 2009 11:47:44 +0300
Subject: [PATCH 4/7] state: ignore missing world dependencies with --force and --quiet
---
src/state.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/state.c b/src/state.c
index 50c1ce3..d886754 100644
--- a/src/state.c
+++ b/src/state.c
@@ -148,7 +148,7 @@ struct apk_state *apk_state_new(struct apk_database *db)
* choices */
for (i = 0; db->world != NULL && i < db->world->num; i++) {
r = apk_state_prune_dependency(state, &db->world->item[i]);
- if (r < 0) {
+ if (r < 0 && apk_verbosity && !(apk_flags & APK_FORCE)) {
apk_error("Top level dependencies for %s are "
"conflicting or unsatisfiable.",
db->world->item[i].name->name);
--
1.6.4
From 20b3c7c8b3653940f357729e9f7159e2f32c1021 Mon Sep 17 00:00:00 2001
From: Timo Teras <timo.teras@iki.fi>
Date: Thu, 6 Aug 2009 13:09:38 +0300
Subject: [PATCH 5/7] audit: do not load repositories
they are not needed, and cause errors if signing keys are not
present.
---
src/audit.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/audit.c b/src/audit.c
index e47f182..67cefac 100644
--- a/src/audit.c
+++ b/src/audit.c
@@ -19,6 +19,7 @@
#include "apk_database.h"
struct audit_ctx {
+ unsigned int open_flags;
int (*audit)(struct apk_database *db);
};
@@ -169,9 +170,11 @@ static int audit_main(void *ctx, int argc, char **argv)
if (actx->audit == NULL)
return -EINVAL;
- r = apk_db_open(&db, apk_root, APK_OPENF_READ);
+ r = apk_db_open(&db, apk_root,
+ APK_OPENF_READ | APK_OPENF_NO_SCRIPTS |
+ APK_OPENF_NO_REPOS);
if (r != 0) {
- apk_error("APK database not present");
+ apk_error("Unable to open db: %s", apk_error_str(r));
return r;
}
r = actx->audit(&db);
--
1.6.4
From fac43e2d60b550425481052e521d141730a303de Mon Sep 17 00:00:00 2001
From: Timo Teras <timo.teras@iki.fi>
Date: Thu, 6 Aug 2009 13:12:26 +0300
Subject: [PATCH 6/7] db: make missing index non-fatal
it's a warning not an error to have non-existant repository.
bad signature means tampering; but we might want to just ignore
those. this is especially important if we have http repositories
and we are bootstrapping (without network).
---
src/database.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/database.c b/src/database.c
index 834383b..f7c3ac0 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1282,7 +1282,7 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t repository)
}
if (bs == NULL) {
apk_warning("Failed to open index for %s", repo->url);
- return -1;
+ return 0;
}
r = load_index(db, bs, targz, r);
--
1.6.4
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apk-tools
pkgver=2.0_rc1
pkgrel=2
pkgver=2.0_rc2
pkgrel=0
pkgdesc="Alpine Package Keeper - package manager for alpine"
subpackages="$pkgname-static"
depends=
makedepends="zlib-dev openssl-dev pkgconfig"
source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
0001-info-fix-a-exists-to-work-if-the-name-is-non-existan.patch
0002-audit-fix-backup.patch
0003-db-command-line-repositories-take-preference.patch
0004-state-ignore-missing-world-dependencies-with-force-a.patch
0005-audit-do-not-load-repositories.patch
0006-db-make-missing-index-non-fatal.patch
"
......@@ -22,10 +16,6 @@ license=GPL-2
build() {
cd "$srcdir/$pkgname-$pkgver"
sed -i -e 's:-Werror::' Make.rules
for i in ../*.patch; do
msg "Applying $i"
patch -p1 -i $i || return 1
done
make || return 1
make static || return 1
......@@ -45,10 +35,4 @@ static() {
"$subpkgdir"/sbin/apk.static
}
md5sums="f790182792a41841e6932ae0b6737a43 apk-tools-2.0_rc1.tar.bz2
c0be62f4ca4153241f82a29ee0e5ac7d 0001-info-fix-a-exists-to-work-if-the-name-is-non-existan.patch
515b39f942d6ad6ee8f022869b5ed3ab 0002-audit-fix-backup.patch
c59e35ef85ebeed98fa04dbf32fee6e6 0003-db-command-line-repositories-take-preference.patch
3377a1bc507bb3f5218e2957d642c77c 0004-state-ignore-missing-world-dependencies-with-force-a.patch
ab2d76d6308215407dfd9f2f67c05b67 0005-audit-do-not-load-repositories.patch
5d2fcd1c6a7c5040fc189ffa7d12c1e5 0006-db-make-missing-index-non-fatal.patch"
md5sums="373aab12797f9fc9e80d5365cd794c9d apk-tools-2.0_rc2.tar.bz2"
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=cmake
pkgver=2.6.4
pkgrel=0
pkgrel=1
pkgdesc="CMake is a cross-platform open-source make system"
url="http://www.cmake.org"
license="CMake"
......@@ -21,9 +21,14 @@ parallel_opt() {
[ -n "$n" ] && echo "--parallel $n"
}
build ()
{
build ()
{
cd $startdir/src/$pkgname-$pkgver
# bug in cmake.
# http://www.mail-archive.com/cmake@cmake.org/msg09515.html
export CC="gcc"
export CXX="g++"
./bootstrap --prefix=/usr \
--mandir=/share/man \
--docdir=/share/cmake-2.6/doc \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment