aboutsummaryrefslogtreecommitdiffstats
path: root/testing/hfsprogs
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-09-23 20:12:54 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-09-23 20:24:38 +0200
commit2adeba433d4de964a51ba73fad56b32397569462 (patch)
treec470dbddc0e5bcd8800ff8d1c728d879654a4b56 /testing/hfsprogs
parentb8a78f4ff716fe4aa2cc0dd69e1a6f2e90b6d5d5 (diff)
testing/hfsprogs
Tools to create/check Apple HFS+ filesystems https://src.fedoraproject.org/rpms/hfsplus-tools About the package name: * diskdev_cmds: upstream, Gentoo, OpenSUSE * hfsprogs: Arch Linux, Debian, NixOS, VoidLinux * hfsplus-tools: Fedora diskdev_cmds is really bad name, so I choose more popular and descriptive name: hfsprogs.
Diffstat (limited to 'testing/hfsprogs')
-rw-r--r--testing/hfsprogs/APKBUILD68
-rw-r--r--testing/hfsprogs/fix-stdarg.patch122
-rw-r--r--testing/hfsprogs/musl-compat.patch136
3 files changed, 326 insertions, 0 deletions
diff --git a/testing/hfsprogs/APKBUILD b/testing/hfsprogs/APKBUILD
new file mode 100644
index 00000000000..ec9140bad77
--- /dev/null
+++ b/testing/hfsprogs/APKBUILD
@@ -0,0 +1,68 @@
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
+pkgname=hfsprogs
+_pkgname=diskdev_cmds
+pkgver=540.1_p3
+_pkgver=${pkgver/_p/.linux}
+pkgrel=0
+pkgdesc="Tools to create/check Apple HFS+ filesystems"
+# We use modified version provided by Fedora's dev, not directly from Apple.
+url="https://src.fedoraproject.org/rpms/hfsplus-tools"
+arch="all"
+license="APSL-2.0"
+makedepends="clang libbsd-dev libressl-dev linux-headers util-linux-dev"
+provides="$_pkgname=$pkgver-r$pkgrel"
+subpackages="$pkgname-doc"
+# Tarball made by Matthew Garrett (mjg59).
+# https://src.fedoraproject.org/rpms/hfsplus-tools/blob/f27/f/hfsplus-tools.spec
+source="http://cavan.codon.org.uk/~mjg59/$_pkgname/$_pkgname-$_pkgver.tar.gz
+ http://www.opensource.org/licenses/apsl-2.0.txt
+ fix-stdarg.patch
+ musl-compat.patch"
+builddir="$srcdir/$_pkgname-$_pkgver"
+
+prepare() {
+ default_prepare
+ cd "$builddir"
+
+ sed -i 's/[F|f]sck_hfs/fsck.hfsplus/g' fsck_hfs.tproj/fsck_hfs.8
+ sed -i 's/[N|n]ewfs_hfs/mkfs.hfsplus/g' newfs_hfs.tproj/newfs_hfs.8
+
+ # Remove errant execute bits.
+ find . -type f -name '*.[ch]' -exec chmod -c -x {} +
+}
+
+build() {
+ cd "$builddir"
+
+ make
+}
+
+check() {
+ cd "$builddir"
+
+ ./fsck_hfs.tproj/fsck_hfs 2>&1 | grep 'usage: fsck_hfs'
+ ./newfs_hfs.tproj/newfs_hfs 2>&1 | grep 'usage: newfs_hfs'
+}
+
+package() {
+ cd "$builddir"
+
+ install -D -m 755 fsck_hfs.tproj/fsck_hfs "$pkgdir"/usr/sbin/fsck.hfs
+ install -D -m 755 newfs_hfs.tproj/newfs_hfs "$pkgdir"/usr/sbin/mkfs.hfsplus
+ ln -s fsck.hfs "$pkgdir"/usr/sbin/fsck.hfsplus
+
+ install -D -m 644 fsck_hfs.tproj/fsck_hfs.8 \
+ "$pkgdir"/usr/share/man/man8/fsck.hfsplus.8
+ install -D -m 644 newfs_hfs.tproj/newfs_hfs.8 \
+ "$pkgdir"/usr/share/man/man8/mkfs.hfsplus.8
+ ln -s fsck.hfs.8 "$pkgdir"/usr/share/man/man8/fsck.hfs.8
+
+ install -D -m 644 "$srcdir"/apsl-2.0.txt \
+ "$pkgdir"/usr/share/licenses/$pkgname/APSL-2.0.txt
+}
+
+sha512sums="3d88fcdec4bfd32a75b6dc75899748d8585371b641be86cfdfe54ade738a0612662dd008c1506c7e216325303217d0b5f188a9c4fdccfb48b2ce50333f212d9e diskdev_cmds-540.1.linux3.tar.gz
+6217c0ae844c4f8c7ba08abf255d8bd594d487f13bc6b52c7ec19fc48fa8f8d1d1afe7a0d939220e3a2d9756aa3235d51492d5c155ac7d68971ef79e837cd0f9 apsl-2.0.txt
+cff25de690f5ecc418380e5cbda3615d38ef9583ace60be9b7696c50e46bc35a29855b216ddb4daae79ff5b40f66ffbc03f613ab0ae1935ee9df6e69caed2e0b fix-stdarg.patch
+34c73b0b57c8e8fa64abf34a9396b6dc218b1a1f06fec98fd52e77c81421cff249f4a65d5f26e692b1cb5e2424a871ecbf5b35eab5d3509506f6710406ff7577 musl-compat.patch"
diff --git a/testing/hfsprogs/fix-stdarg.patch b/testing/hfsprogs/fix-stdarg.patch
new file mode 100644
index 00000000000..ecd8fe84a48
--- /dev/null
+++ b/testing/hfsprogs/fix-stdarg.patch
@@ -0,0 +1,122 @@
+Patch-Source: https://src.fedoraproject.org/rpms/hfsplus-tools/blob/f27/f/hfsplus-tools-learn-to-stdarg.patch
+
+diff -up diskdev_cmds-540.1.linux3/fsck_hfs.tproj/utilities.c.jx diskdev_cmds-540.1.linux3/fsck_hfs.tproj/utilities.c
+--- diskdev_cmds-540.1.linux3/fsck_hfs.tproj/utilities.c.jx 2012-02-01 12:17:19.000000000 -0500
++++ diskdev_cmds-540.1.linux3/fsck_hfs.tproj/utilities.c 2014-06-18 13:44:45.125620007 -0400
+@@ -296,11 +296,8 @@ static volatile int keep_going = 1;
+ #undef printf
+
+ // prototype
+-void print_to_mem(int type, const char *fmt, const char *str, va_list ap);
+-
+-#define DO_VPRINT 1 // types for print_to_mem
+-#define DO_STR 2
+-
++void vprint_to_mem(const char *fmt, va_list ap);
++void print_to_mem(const char *fmt, ...);
+
+ static void *
+ fsck_printing_thread(void *arg)
+@@ -547,8 +544,8 @@ setup_logging(void)
+ cur_in_mem = in_mem_log;
+
+ t = time(NULL);
+- print_to_mem(DO_STR, "\n%s: ", cdevname ? cdevname : "UNKNOWN-DEV", NULL);
+- print_to_mem(DO_STR, "fsck_hfs run at %s", ctime(&t), NULL);
++ print_to_mem("\n%s: ", cdevname ? cdevname : "UNKNOWN-DEV");
++ print_to_mem("fsck_hfs run at %s", ctime(&t));
+
+ if (live_fsck && log_file) {
+ pthread_cond_init(&mem_buf_cond, NULL);
+@@ -576,26 +573,20 @@ setup_logging(void)
+
+
+ void
+-print_to_mem(int type, const char *fmt, const char *str, va_list ap)
++vprint_to_mem(const char *fmt, va_list ap)
+ {
+ int ret;
+ size_t size_remaining;
+ va_list ap_copy;
+
+- if (type == DO_VPRINT) {
+- va_copy(ap_copy, ap);
+- }
++ va_copy(ap_copy, ap);
+
+ if (live_fsck) {
+ pthread_mutex_lock(&mem_buf_lock);
+ }
+
+ size_remaining = in_mem_size - (ptrdiff_t)(cur_in_mem - in_mem_log);
+- if (type == DO_VPRINT) {
+- ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap);
+- } else {
+- ret = snprintf(cur_in_mem, size_remaining, fmt, str);
+- }
++ ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap);
+ if (ret > size_remaining) {
+ char *new_log;
+ size_t amt;
+@@ -619,11 +610,7 @@ print_to_mem(int type, const char *fmt,
+ cur_in_mem = new_log + (cur_in_mem - in_mem_log);
+ in_mem_log = new_log;
+ size_remaining = in_mem_size - (ptrdiff_t)(cur_in_mem - new_log);
+- if (type == DO_VPRINT) {
+- ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap_copy);
+- } else {
+- ret = snprintf(cur_in_mem, size_remaining, fmt, str);
+- }
++ ret = vsnprintf(cur_in_mem, size_remaining, fmt, ap_copy);
+ if (ret <= size_remaining) {
+ cur_in_mem += ret;
+ }
+@@ -636,11 +623,18 @@ print_to_mem(int type, const char *fmt,
+ pthread_mutex_unlock(&mem_buf_lock);
+ }
+ done:
+- if (type == DO_VPRINT) {
+- va_end(ap_copy);
+- }
++ va_end(ap_copy);
+ }
+
++void
++print_to_mem(const char *fmt, ...)
++{
++ va_list ap;
++
++ va_start(ap, fmt);
++ vprint_to_mem(fmt, ap);
++ va_end(ap);
++}
+
+ static int need_prefix=1;
+
+@@ -662,7 +656,7 @@ static int need_prefix=1;
+ LOG_PREFIX \
+ vfprintf(log_file, fmt, ap); \
+ } else { \
+- print_to_mem(DO_VPRINT, fmt, NULL, ap); \
++ vprint_to_mem(fmt, ap); \
+ }
+
+ #define FLOG(fmt, str) \
+@@ -670,7 +664,7 @@ static int need_prefix=1;
+ LOG_PREFIX; \
+ fprintf(log_file, fmt, str); \
+ } else { \
+- print_to_mem(DO_STR, fmt, str, NULL); \
++ print_to_mem(fmt, str); \
+ }
+
+
+@@ -800,7 +794,7 @@ vplog(const char *fmt, va_list ap)
+ LOG_PREFIX;
+ vfprintf(log_file, fmt, ap);
+ } else {
+- print_to_mem(DO_VPRINT, fmt, NULL, ap);
++ vprint_to_mem(fmt, ap);
+ }
+ }
+
diff --git a/testing/hfsprogs/musl-compat.patch b/testing/hfsprogs/musl-compat.patch
new file mode 100644
index 00000000000..345bd24d69a
--- /dev/null
+++ b/testing/hfsprogs/musl-compat.patch
@@ -0,0 +1,136 @@
+--- diskdev_cmds-540.1.linux3.orig/fsck_hfs.tproj/dfalib/Scavenger.h
++++ diskdev_cmds-540.1.linux3/fsck_hfs.tproj/dfalib/Scavenger.h
+@@ -48,7 +48,6 @@
+ #endif
+ #include <sys/errno.h>
+ #include <sys/param.h>
+-#include <sys/sysctl.h>
+ #include <sys/mount.h>
+ #include <hfs/hfs_mount.h>
+
+--- diskdev_cmds-540.1.linux3.orig/fsck_hfs.tproj/fsck_hfs.c
++++ diskdev_cmds-540.1.linux3/fsck_hfs.tproj/fsck_hfs.c
+@@ -30,7 +30,6 @@
+ #include <sys/ioctl.h>
+ #if !LINUX
+ #include <sys/disk.h>
+-#include <sys/sysctl.h>
+ #include <setjmp.h>
+ #endif
+ #include <hfs/hfs_mount.h>
+--- diskdev_cmds-540.1.linux3.orig/newfs_hfs.tproj/makehfs.c
++++ diskdev_cmds-540.1.linux3/newfs_hfs.tproj/makehfs.c
+@@ -38,7 +38,6 @@
+ #endif
+ #include <sys/errno.h>
+ #include <sys/stat.h>
+-#include <sys/sysctl.h>
+ #if !LINUX
+ #include <sys/vmmeter.h>
+ #endif
+--- a/fsck_hfs.tproj/utilities.c
++++ b/fsck_hfs.tproj/utilities.c
+@@ -70,7 +70,6 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+-#include <sys/sysctl.h>
+
+ #include "fsck_hfs.h"
+
+--- diskdev_cmds-540.1.linux3.orig/fsck_hfs.tproj/dfalib/Scavenger.h
++++ diskdev_cmds-540.1.linux3/fsck_hfs.tproj/dfalib/Scavenger.h
+@@ -46,7 +46,7 @@
+ #include <sys/kauth.h>
+ #include <sys/syslimits.h>
+ #endif
+-#include <sys/errno.h>
++#include <errno.h>
+ #include <sys/param.h>
+ #include <sys/mount.h>
+ #include <hfs/hfs_mount.h>
+--- diskdev_cmds-540.1.linux3.orig/fsck_hfs.tproj/utilities.c
++++ diskdev_cmds-540.1.linux3/fsck_hfs.tproj/utilities.c
+@@ -55,7 +55,7 @@
+ #include <stddef.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+-#include <sys/errno.h>
++#include <errno.h>
+ #if LINUX
+ #include <limits.h>
+ #include <signal.h>
+--- diskdev_cmds-540.1.linux3.orig/newfs_hfs.tproj/makehfs.c
++++ diskdev_cmds-540.1.linux3/newfs_hfs.tproj/makehfs.c
+@@ -36,7 +36,7 @@
+ #include <time.h>
+ #include "missing.h"
+ #endif
+-#include <sys/errno.h>
++#include <errno.h>
+ #include <sys/stat.h>
+ #if !LINUX
+ #include <sys/vmmeter.h>
+--- a/fsck_hfs.tproj/cache.h
++++ b/fsck_hfs.tproj/cache.h
+@@ -29,6 +29,7 @@
+ #ifndef _CACHE_H_
+ #define _CACHE_H_
+ #include <stdint.h>
++#include <sys/types.h>
+
+ /* Different values for initializing cache */
+ enum {
+--- a/newfs_hfs.tproj/makehfs.c
++++ b/newfs_hfs.tproj/makehfs.c
+@@ -41,6 +41,7 @@
+ #if !LINUX
+ #include <sys/vmmeter.h>
+ #endif
++#include <sys/cdefs.h>
+
+ #include <err.h>
+ #include <errno.h>
+--- a/newfs_hfs.tproj/newfs_hfs.c
++++ b/newfs_hfs.tproj/newfs_hfs.c
+@@ -42,6 +42,7 @@
+ #if LINUX
+ #include <time.h>
+ #endif
++#include <sys/cdefs.h>
+
+ #if !LINUX
+ #include <IOKit/storage/IOMediaBSDClient.h>
+--- a/fsck_hfs.tproj/fsck_hfs.h
++++ b/fsck_hfs.tproj/fsck_hfs.h
+@@ -22,6 +22,7 @@
+ */
+
+ #include "cache.h"
++#include <sys/cdefs.h>
+
+
+ const extern char *cdevname; /* name of device being checked */
+--- a/fsck_hfs.tproj/utilities.c
++++ b/fsck_hfs.tproj/utilities.c
+@@ -785,7 +785,7 @@
+
+ if (!live_fsck) {
+ /* copy va_list as it will be used again later */
+- __va_copy(ap_stdout, ap);
++ va_copy(ap_stdout, ap);
+ vfprintf(stdout, fmt, ap_stdout);
+ }
+
+--- a/fsck_hfs.tproj/fsck_messages.c
++++ b/fsck_hfs.tproj/fsck_messages.c
+@@ -85,7 +85,7 @@
+
+ if (c == NULL)
+ return;
+- __va_copy(ap2, ap); // Just in case we need it
++ va_copy(ap2, ap); // Just in case we need it
+ length = vsnprintf(buf, BUFSIZ, fmt, ap);
+ if (length > BUFSIZ) {
+ // We need to allocate space for it
+