Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
macos: bring back support for macos
Baptiste Daroussin committed 4 months ago
commit 4fb4382640dd171587d3897ecb5ce61d4b45b53f
parent 84e11ef
5 files changed +29 -18
modified .github/workflows/build.yaml
@@ -31,19 +31,21 @@ jobs:
      matrix:
        build-os:
          - ubuntu-24.04
-
          # - macos-15
+
          - macos-latest
        sanitize:
          - []
          - ["asan", "lsan"]
          - ["ubsan", "tsan"]
        include:
-
          # - build-os: macos-15
-
          #   compiler: clang-19
-
          #   pkgs:
-
          #     # - pkgconf comes preinstalled on the GitHub runner
-
          #     - libarchive
-
          #     - llvm@19
-
          #   llvm-bindir: /opt/homebrew/opt/llvm@19/bin
+
          - build-os: macos-latest
+
            compiler: clang-19
+
            pkgs:
+
              # - pkgconf comes preinstalled on the GitHub runner
+
              - libarchive
+
              - llvm@19
+
              - kyua
+
              - atf
+
            llvm-bindir: /opt/homebrew/opt/llvm@19/bin
          - build-os: ubuntu-24.04
            compiler: clang-18
            pkgs:
@@ -84,15 +86,9 @@ jobs:
          brew update --quiet || true

          # temporarily use unstable atf to benefit from fix for std::vector
-
          brew install --HEAD atf
-
          
-
          brew install ${{ join(matrix.pkgs, ' ') }}
+
          # brew install --HEAD atf

-
          # kyua was kicked out of brew due to lack of activity
-
          # we patch away the disabled line and install the last built binary version
-
          curl https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/k/kyua.rb |
-
            sed 's/^[[:space:]]*disable.*$//'  > kyua.rb
-
          brew install --formula ./kyua.rb
+
          brew install ${{ join(matrix.pkgs, ' ') }}

          # We make sure pkg-config picks up brew's libarchive instead of pointing to system libarchive
          echo PKG_CONFIG_PATH=$(brew --prefix libarchive)/lib/pkgconfig >> "${GITHUB_ENV}"
modified libpkg/pkgdb.c
@@ -1587,6 +1587,7 @@ run_prstmt(sql_prstmt_index s, const sql_arg_t *args, size_t nargs)
			sqlite3_bind_int64(stmt, bind_index, args[i].v.i64);
			break;
		default:
+
			pkg_emit_error("unexpected type: %d\n", args[i].type);
			return (SQLITE_MISUSE);
		}
	}
@@ -1759,6 +1760,7 @@ pkgdb_register_pkg(struct pkgdb *db, struct pkg *pkg, int forced,
		if (ret == SQLITE_DONE)
			continue;
		if (ret != SQLITE_CONSTRAINT) {
+
			pkg_emit_error("error: %d", ret);
			ERROR_STMT_SQLITE(s, STMT(FILES));
			goto cleanup;
		}
modified libpkg/private/pkg.h
@@ -51,6 +51,12 @@
#define	roundup2(x, y)	(((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#endif

+
#if defined(__APPLE__)
+
#define st_mtim st_mtimespec
+
#define st_atim st_atimespec
+
#define st_ctim st_ctimespec
+
#endif
+

#if ARCHIVE_VERSION_NUMBER < 3000002
#define archive_write_add_filter_xz(a) archive_write_set_compression_xz(a)
#define archive_write_add_filter_bzip2(a) archive_write_set_compression_bzip2(a)
@@ -633,7 +639,14 @@ static inline sql_arg_t make_int64_arg(int64_t i) {
    return (a);
}

+
#if defined(__APPLE__) || defined(__MACH__)
+
  #define IF_HAVE__DARWIN_TIME_T() __darwin_time_t: (sql_arg_t(*)(int64_t))(make_int64_arg),
+
#else
+
  #define IF_HAVE__DARWIN_TIME_T()
+
#endif
+

#define SQL_ARG(x) _Generic((x), \
+
        IF_HAVE__DARWIN_TIME_T() \
        const char *: make_text_arg, \
        char *:       make_text_arg, \
        int64_t:      make_int64_arg, \
modified tests/frontend/check.sh
@@ -45,7 +45,7 @@ __EOF__
	chmod -h 0644 ${TMPDIR}/target/${TMPDIR}/a
	touch -hr ./a ${TMPDIR}/target/${TMPDIR}/a
	# linux mangles perms on symlinks
-
	if [ "${OS}" = "FreeBSD" ]; then
+
	if [ "${OS}" = "FreeBSD" -o ${OS} = "Darwin" ]; then
	    atf_check -s exit:1 -e match:"\[symlink\]" -e not-match:"\[perm\]" -e not-match:"\[mtime\]" pkg -r target check -mq
	else
	    atf_check -s exit:1 -e match:"\[symlink\]" -e match:"\[perm\]" -e not-match:"\[mtime\]" pkg -r target check -mq
modified tests/frontend/test_environment.sh.in
@@ -50,7 +50,7 @@ atf_require() {


q_mtime() {
-
    if [ "${OS}" = "FreeBSD" ]; then
+
    if [ "${OS}" = "FreeBSD" -o "${OS}" = "Darwin" ]; then
	stat -f "%m" "$1"
    else
	stat -c "%Y" "$1"