apk-tools: Add as disabled package

This commit is contained in:
Fredrik Fornwall 2018-09-11 00:46:45 +02:00
parent 3afe969da3
commit 27b1f0a6f2
7 changed files with 155 additions and 0 deletions

View File

@ -0,0 +1,16 @@
diff -u -r ../apk-tools-2.10.1/Make.rules ./Make.rules
--- ../apk-tools-2.10.1/Make.rules 2018-09-10 08:04:03.000000000 +0000
+++ ./Make.rules 2018-09-10 21:36:27.914805239 +0000
@@ -64,9 +64,9 @@
# Utilities and default flags for them.
CROSS_COMPILE ?=
-CC := $(CROSS_COMPILE)gcc
-AR := $(CROSS_COMPILE)ar
-LD := $(CROSS_COMPILE)ld
+CC ?= $(CROSS_COMPILE)gcc
+AR ?= $(CROSS_COMPILE)ar
+LD ?= $(CROSS_COMPILE)ld
INSTALL := install
INSTALLDIR := $(INSTALL) -d

View File

@ -0,0 +1,20 @@
diff -u -r ../apk-tools-2.10.1/Makefile ./Makefile
--- ../apk-tools-2.10.1/Makefile 2018-09-10 08:04:03.000000000 +0000
+++ ./Makefile 2018-09-10 21:58:19.631911343 +0000
@@ -10,11 +10,11 @@
# Default directories
DESTDIR :=
-SBINDIR := /sbin
-LIBDIR := /lib
-CONFDIR := /etc/apk
-MANDIR := /usr/share/man
-DOCDIR := /usr/share/doc/apk
+SBINDIR := @TERMUX_PREFIX@/bin
+LIBDIR := @TERMUX_PREFIX@/lib
+CONFDIR := @TERMUX_PREFIX@/etc/apk
+MANDIR := @TERMUX_PREFIX@/share/man
+DOCDIR := @TERMUX_PREFIX@/share/doc/apk
export DESTDIR SBINDIR LIBDIR CONFDIR MANDIR DOCDIR

View File

@ -0,0 +1,17 @@
TERMUX_PKG_HOMEPAGE=https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management
TERMUX_PKG_DESCRIPTION="Alpine Linux package management tools"
TERMUX_PKG_VERSION=2.10.1
TERMUX_PKG_SHA256=278854c4ee21ed4ddb7605ef09190385106c6fdfc10526e32e0108ad0f12509a
TERMUX_PKG_SRCURL=https://github.com/alpinelinux/apk-tools/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_DEPENDS="openssl"
TERMUX_PKG_BUILD_IN_SRC=yes
TERMUX_PKG_EXTRA_MAKE_ARGS="LUAAPK="
termux_step_post_make_install() {
mkdir -p $TERMUX_PREFIX/etc/apk/
echo $TERMUX_ARCH > $TERMUX_PREFIX/etc/apk/arch
mkdir -p $TERMUX_PREFIX/lib/apk/db/
echo "Needed by the apk tool." > $TERMUX_PREFIX/lib/apk/db/README
}

View File

@ -0,0 +1,12 @@
diff -u -r ../apk-tools-2.10.1/src/apk.c ./src/apk.c
--- ../apk-tools-2.10.1/src/apk.c 2018-09-10 08:04:03.000000000 +0000
+++ ./src/apk.c 2018-09-10 22:02:50.668809543 +0000
@@ -486,7 +486,7 @@
apk_flags |= APK_PROGRESS;
if (!(apk_flags & APK_SIMULATE) &&
- access("/etc/apk/interactive", F_OK) == 0)
+ access("@TERMUX_PREFIX@/etc/apk/interactive", F_OK) == 0)
apk_flags |= APK_INTERACTIVE;
}

View File

@ -0,0 +1,11 @@
diff -u -r ../apk-tools-2.10.1/src/archive.c ./src/archive.c
--- ../apk-tools-2.10.1/src/archive.c 2018-09-10 08:04:03.000000000 +0000
+++ ./src/archive.c 2018-09-10 21:48:51.234399333 +0000
@@ -20,6 +20,7 @@
#include <sysexits.h>
#include <sys/wait.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <sys/xattr.h>
#include <limits.h>
#include <stdint.h>

View File

@ -0,0 +1,29 @@
diff -u -r ../apk-tools-2.10.1/src/database.c ./src/database.c
--- ../apk-tools-2.10.1/src/database.c 2018-09-10 08:04:03.000000000 +0000
+++ ./src/database.c 2018-09-10 22:06:19.510417812 +0000
@@ -1331,7 +1331,7 @@
static int apk_db_create(struct apk_database *db)
{
int fd;
-
+#ifndef __ANDROID__
mkdirat(db->root_fd, "tmp", 01777);
mkdirat(db->root_fd, "dev", 0755);
mknodat(db->root_fd, "dev/null", S_IFCHR | 0666, makedev(1, 3));
@@ -1344,6 +1344,7 @@
mkdirat(db->root_fd, "var/cache", 0755);
mkdirat(db->root_fd, "var/cache/apk", 0755);
mkdirat(db->root_fd, "var/cache/misc", 0755);
+#endif
fd = openat(db->root_fd, apk_world_file, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC, 0644);
if (fd < 0)
@@ -1529,7 +1530,7 @@
apk_db_setup_repositories(db, dbopts->cache_dir);
db->cache_max_age = dbopts->cache_max_age ?: 4*60*60; /* 4 hours default */
- db->root = strdup(dbopts->root ?: "/");
+ db->root = strdup(dbopts->root ?: "@TERMUX_PREFIX@");
db->root_fd = openat(AT_FDCWD, db->root, O_RDONLY | O_CLOEXEC);
if (db->root_fd < 0 && (dbopts->open_flags & APK_OPENF_CREATE)) {
mkdirat(AT_FDCWD, db->root, 0755);

View File

@ -0,0 +1,50 @@
diff -u -r ../apk-tools-2.10.1/src/io.c ./src/io.c
--- ../apk-tools-2.10.1/src/io.c 2018-09-10 08:04:03.000000000 +0000
+++ ./src/io.c 2018-09-10 21:56:03.349469566 +0000
@@ -1005,6 +1005,7 @@
.delete_item = (apk_hash_delete_f) free,
};
+#ifndef __ANDROID__
static struct cache_item *resolve_cache_item(struct apk_hash *hash, apk_blob_t name)
{
struct cache_item *ci;
@@ -1025,6 +1026,7 @@
return ci;
}
+#endif
void apk_id_cache_init(struct apk_id_cache *idc, int root_fd)
{
@@ -1049,6 +1051,9 @@
uid_t apk_resolve_uid(struct apk_id_cache *idc, const char *username, uid_t default_uid)
{
+#ifdef __ANDROID__
+ return getuid();
+#else
#ifdef HAVE_FGETPWENT_R
char buf[1024];
struct passwd pwent;
@@ -1088,10 +1093,14 @@
return ci->uid;
return default_uid;
+#endif
}
uid_t apk_resolve_gid(struct apk_id_cache *idc, const char *groupname, uid_t default_gid)
{
+#ifdef __ANDROID__
+ return getgid();
+#else
#ifdef HAVE_FGETGRENT_R
char buf[1024];
struct group grent;
@@ -1131,4 +1140,5 @@
return ci->gid;
return default_gid;
+#endif
}