From 6708603fc4cbab82fedddaf8033e1edde7e7fe8e Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Tue, 23 Nov 2021 23:54:12 +0100 Subject: [PATCH] community/git-lfs2: new aport See !27376 Co-Authored-By: Simon Frankenberger --- community/git-lfs2/APKBUILD | 75 +++++++ community/git-lfs2/git-lfs2.post-install | 3 + community/git-lfs2/git-lfs2.pre-deinstall | 3 + .../git-lfs2/makefile-extra_go_flags.patch | 24 +++ .../patch-env-compare-git-grep-prefix.patch | 203 ++++++++++++++++++ 5 files changed, 308 insertions(+) create mode 100644 community/git-lfs2/APKBUILD create mode 100644 community/git-lfs2/git-lfs2.post-install create mode 100644 community/git-lfs2/git-lfs2.pre-deinstall create mode 100644 community/git-lfs2/makefile-extra_go_flags.patch create mode 100644 community/git-lfs2/patch-env-compare-git-grep-prefix.patch diff --git a/community/git-lfs2/APKBUILD b/community/git-lfs2/APKBUILD new file mode 100644 index 00000000000..368d370623c --- /dev/null +++ b/community/git-lfs2/APKBUILD @@ -0,0 +1,75 @@ +# Contributor: Jakub Jirutka +# Maintainer: Jakub Jirutka +pkgname=git-lfs2 +_projname=git-lfs +pkgver=2.13.3 +pkgrel=0 +pkgdesc="Git extension for versioning large files (version 2.x)" +url="https://git-lfs.github.io/" +arch="all" +license="MIT" +depends="git !git-lfs" +makedepends="go ronn" +checkdepends="bash coreutils git-daemon perl-utils" +install="$pkgname.post-install $pkgname.pre-deinstall" +subpackages="$pkgname-doc" +source="https://github.com/git-lfs/git-lfs/archive/v$pkgver/$_projname-$pkgver.tar.gz + makefile-extra_go_flags.patch + patch-env-compare-git-grep-prefix.patch + " +builddir="$srcdir/$_projname-$pkgver" + +[ "$CARCH" = "x86" ] && options="!check" # tests broken on x86 + +# secfixes: +# 0: +# - CVE-2020-27955 (only affect windows) + +# -tags netcgo - use system's DNS resolver by default. Go's built-in DNS +# resolver is buggy; it resolved localhost to totally wrong IP +# address on ARM builders and so caused test failures. +_goflags="-v -tags netcgo" + + +build() { + make \ + EXTRA_GO_FLAGS="$_goflags" \ + GIT_LFS_SHA="v$pkgver" \ + VERSION="v$pkgver" + make man +} + +check() { + make integration EXTRA_GO_FLAGS="$_goflags" +} + +package() { + local docdir="$pkgdir/usr/share/doc/git-lfs" + local mandir="$pkgdir/usr/share/man" + + install -Dm755 bin/git-lfs "$pkgdir"/usr/bin/git-lfs + + mkdir -p "$mandir"/man1 "$mandir"/man5 + install -m 644 man/*.1 "$mandir"/man1/ + install -m 644 man/*.5 "$mandir"/man5/ + + mkdir -p "$docdir" + cp -r docs/*.md docs/api "$docdir"/ + rm -r "$docdir"/api/schemas +} + +doc() { + default_doc + depends="!git-lfs-doc" +} + +cleanup_srcdir() { + go clean -modcache + default_cleanup_srcdir +} + +sha512sums=" +2c9e10e4f2fdb5d6bae8994db5879f50596109f3057e7369a9edca3c13c3f4d77e268e3903a0abca60cf8e342ff54bc4920c01a530f8eb400e3a0cc11a171f74 git-lfs-2.13.3.tar.gz +2d793da75b37324936407948fdb634ff4c510c4dd4d3575c2459b81a0a6eb8f2464f5066ae99e88d5bf69e357fd60354b9d9d53e062cb6ba709f5f3a39858466 makefile-extra_go_flags.patch +335ee5ef04247f8420051c75d04a59d1ebbd0cad9ec1da25ae07b5940d419c15b154f946f3c3e1fa9978201bb730f2401c5f7f606377c114fc224b8be5027d6c patch-env-compare-git-grep-prefix.patch +" diff --git a/community/git-lfs2/git-lfs2.post-install b/community/git-lfs2/git-lfs2.post-install new file mode 100644 index 00000000000..cc9a36578e3 --- /dev/null +++ b/community/git-lfs2/git-lfs2.post-install @@ -0,0 +1,3 @@ +#!/bin/sh + +git-lfs install --skip-repo --system diff --git a/community/git-lfs2/git-lfs2.pre-deinstall b/community/git-lfs2/git-lfs2.pre-deinstall new file mode 100644 index 00000000000..9f8ad1b3e44 --- /dev/null +++ b/community/git-lfs2/git-lfs2.pre-deinstall @@ -0,0 +1,3 @@ +#!/bin/sh + +git-lfs uninstall --system diff --git a/community/git-lfs2/makefile-extra_go_flags.patch b/community/git-lfs2/makefile-extra_go_flags.patch new file mode 100644 index 00000000000..c1437db65b0 --- /dev/null +++ b/community/git-lfs2/makefile-extra_go_flags.patch @@ -0,0 +1,24 @@ +--- a/Makefile ++++ b/Makefile +@@ -136,7 +136,7 @@ + # It uses BUILD_MAIN as defined above to specify the entrypoint for building Git + # LFS. + BUILD = GOOS=$(1) GOARCH=$(2) \ +- $(GO) build \ ++ $(GO) build $(EXTRA_GO_FLAGS) \ + -ldflags="$(LD_FLAGS)" \ + -gcflags="$(GC_FLAGS)" \ + -asmflags="$(ASM_FLAGS)" \ + +--- a/t/Makefile ++++ b/t/Makefile +@@ -45,7 +45,7 @@ + $(RM) $(TEST_CMDS) + + ../bin/%$X : cmd/%.go +- go build -o $@ $^ ++ go build $(EXTRA_GO_FLAGS) -o $@ $^ + + ../bin/git-lfs-test-server-api$X : $(TEST_API_SRCS) +- go build -o $@ $^ ++ go build $(EXTRA_GO_FLAGS) -o $@ $^ diff --git a/community/git-lfs2/patch-env-compare-git-grep-prefix.patch b/community/git-lfs2/patch-env-compare-git-grep-prefix.patch new file mode 100644 index 00000000000..ebfe0306f66 --- /dev/null +++ b/community/git-lfs2/patch-env-compare-git-grep-prefix.patch @@ -0,0 +1,203 @@ +Patch-Source: https://github.com/git-lfs/git-lfs/pull/4678 +--- old/t/t-env.sh ++++ new/t/t-env.sh +@@ -26,7 +26,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + + expected=$(printf '%s + %s +@@ -79,7 +79,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + expected=$(printf '%s + %s + +@@ -138,7 +138,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + expected=$(printf '%s + %s + +@@ -196,7 +196,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + + expected=$(printf '%s + %s +@@ -255,7 +255,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + expected=$(printf '%s + %s + +@@ -316,7 +316,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + expected=$(printf '%s + %s + +@@ -377,7 +377,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + expected=$(printf '%s + %s + +@@ -447,7 +447,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + expected=$(printf '%s + %s + +@@ -504,7 +504,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars="$(GIT_DIR=$gitDir GIT_WORK_TREE=$workTree env | grep "^GIT" | sort)" ++ envVars="$(GIT_DIR=$gitDir GIT_WORK_TREE=$workTree env | grep "^GIT_" | sort)" + expected=$(printf '%s + %s + +@@ -553,7 +553,7 @@ + | grep -v "^GIT_EXEC_PATH=") + contains_same_elements "$expected" "$actual4" + +- envVars="$(GIT_DIR=$gitDir GIT_WORK_TREE=a/b env | grep "^GIT" | sort)" ++ envVars="$(GIT_DIR=$gitDir GIT_WORK_TREE=a/b env | grep "^GIT_" | sort)" + + # `a/b` is an invalid relative path from where we are now and results in an + # error, so resulting output will have many fields blank or invalid +@@ -594,7 +594,7 @@ + contains_same_elements "$expected5" "$actual5" + + cd $TRASHDIR/$reponame/a/b +- envVars="$(GIT_DIR=$gitDir env | grep "^GIT" | sort)" ++ envVars="$(GIT_DIR=$gitDir env | grep "^GIT_" | sort)" + expected7=$(printf '%s + %s + +@@ -627,7 +627,7 @@ + contains_same_elements "$expected7" "$actual7" + + cd $TRASHDIR/$reponame/a +- envVars="$(GIT_WORK_TREE=$workTree env | grep "^GIT" | sort)" ++ envVars="$(GIT_WORK_TREE=$workTree env | grep "^GIT_" | sort)" + expected8=$(printf '%s + %s + +@@ -674,7 +674,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + + expected=$(printf "%s\n%s\n + LocalWorkingDir= +@@ -744,7 +744,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + + localwd=$(canonical_path "$TRASHDIR/$reponame") + localgit=$(canonical_path "$TRASHDIR/$reponame/.git") +@@ -752,7 +752,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + + expectedenabled=$(printf '%s + %s +@@ -819,7 +819,7 @@ + contains_same_elements "$expecteddisabled" "$actual" + + # now enable via env var +- envVarsEnabled=$(printf "%s" "$(GIT_LFS_SKIP_DOWNLOAD_ERRORS=1 env | grep "^GIT")") ++ envVarsEnabled=$(printf "%s" "$(GIT_LFS_SKIP_DOWNLOAD_ERRORS=1 env | grep "^GIT_")") + expectedenabled2=$(printf '%s + %s + +@@ -873,7 +873,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + + localwd=$(canonical_path "$TRASHDIR/$reponame") + localgit=$(canonical_path "$TRASHDIR/$reponame/.git") +@@ -881,7 +881,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + + expectedenabled=$(printf '%s + %s +@@ -940,7 +940,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + expected=$(printf '%s + %s + +@@ -1005,7 +1005,7 @@ + lfsstorage=$(canonical_path "$TRASHDIR/$reponame/.git/lfs") + localmedia=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/objects") + tempdir=$(canonical_path "$TRASHDIR/$reponame/.git/lfs/tmp") +- envVars=$(printf "%s" "$(env | grep "^GIT")") ++ envVars=$(printf "%s" "$(env | grep "^GIT_")") + expected=$(printf '%s + %s + +--- old/t/t-worktree.sh ++++ new/t/t-worktree.sh +@@ -49,7 +49,7 @@ + AccessUpload=none + DownloadTransfers=basic,lfs-standalone-file + UploadTransfers=basic,lfs-standalone-file +-$(escape_path "$(env | grep "^GIT")") ++$(escape_path "$(env | grep "^GIT_")") + %s + " "$(git lfs version)" "$(git version)" "$envInitConfig") + actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=") +@@ -85,7 +85,7 @@ + AccessUpload=none + DownloadTransfers=basic,lfs-standalone-file + UploadTransfers=basic,lfs-standalone-file +-$(escape_path "$(env | grep "^GIT")") ++$(escape_path "$(env | grep "^GIT_")") + %s + " "$(git lfs version)" "$(git version)" "$envInitConfig") + actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")