* [PR PATCH] ci: update actions/checkout to v3
@ 2022-09-16 4:20 classabbyamp
2022-09-16 4:21 ` [PR PATCH] [Updated] " classabbyamp
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 4:20 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 800 bytes --]
There is a new pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages ci/safe-dir
https://github.com/void-linux/void-packages/pull/39310
ci: update actions/checkout to v3
`actions/checkout@v3` adds a configuration option to set the checkout dir as a safe directory, a security feature added in git 2.35.2
```yaml
# Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: ''
```
This is set to true by default so we shouldn't need to specify it.
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
A patch file from https://github.com/void-linux/void-packages/pull/39310.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci/safe-dir-39310.patch --]
[-- Type: text/x-diff, Size: 3184 bytes --]
From cf75a46f330b7bb44a86537962052c2bf4f6ade4 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:14:21 -0400
Subject: [PATCH 1/3] .github/workflows/build.yaml: update actions/checkout
---
.github/workflows/build.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce995e2d9c79..a41a647da757 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -26,7 +26,7 @@ jobs:
LICENSE_LIST: common/travis/license.lst
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- run: common/travis/fetch_upstream.sh
@@ -73,7 +73,7 @@ jobs:
# Upgrade again (in case there was a xbps update)
xbps-install -yu
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- name: Create hostrepo and prepare masterdir
From 4fac459c7153f7196dbfddcac6f95bbfe4ae0614 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:14:45 -0400
Subject: [PATCH 2/3] .github/workflows/cycles.yml: update actions/checkout
manually setting safe.directory is no longer necessary
---
.github/workflows/cycles.yml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 3f85ac6fa74a..d7ab9e0d3390 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -23,7 +23,7 @@ jobs:
xbps-install -yu
# Install script dependencies
xbps-install -y python3-networkx github-cli
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Create hostrepo and prepare masterdir
@@ -38,8 +38,6 @@ jobs:
elif command -v git >/dev/null 2>&1; then
GIT_CMD=$(command -v git)
fi
- # required by git 2.35.2+
- $GIT_CMD config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From e6840d8050bd93d93824ec66d20847372a3bd8b0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:15:51 -0400
Subject: [PATCH 3/3] common/travis/fetch_upstream.sh: remove unnecessary git
config
no longer needed with actions/checkout@v3
---
common/travis/fetch_upstream.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index 049cfd69e54d..45315563e0b1 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -8,8 +8,5 @@ elif command -v git >/dev/null 2>&1; then
GIT_CMD=$(command -v git)
fi
-# required by git 2.35.2+
-$GIT_CMD config --global --add safe.directory "$PWD"
-
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
$GIT_CMD fetch --depth 200 https://github.com/void-linux/void-packages.git master
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] ci: update actions/checkout to v3
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
@ 2022-09-16 4:21 ` classabbyamp
2022-09-16 5:03 ` classabbyamp
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 4:21 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages ci/safe-dir
https://github.com/void-linux/void-packages/pull/39310
ci: update actions/checkout to v3
`actions/checkout@v3` adds a configuration option to set the checkout dir as a safe directory, a security feature added in git 2.35.2
```yaml
# Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: ''
```
This is set to true by default so we shouldn't need to specify it.
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
A patch file from https://github.com/void-linux/void-packages/pull/39310.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci/safe-dir-39310.patch --]
[-- Type: text/x-diff, Size: 3837 bytes --]
From cf75a46f330b7bb44a86537962052c2bf4f6ade4 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:14:21 -0400
Subject: [PATCH 1/4] .github/workflows/build.yaml: update actions/checkout
---
.github/workflows/build.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce995e2d9c79..a41a647da757 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -26,7 +26,7 @@ jobs:
LICENSE_LIST: common/travis/license.lst
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- run: common/travis/fetch_upstream.sh
@@ -73,7 +73,7 @@ jobs:
# Upgrade again (in case there was a xbps update)
xbps-install -yu
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- name: Create hostrepo and prepare masterdir
From 4fac459c7153f7196dbfddcac6f95bbfe4ae0614 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:14:45 -0400
Subject: [PATCH 2/4] .github/workflows/cycles.yml: update actions/checkout
manually setting safe.directory is no longer necessary
---
.github/workflows/cycles.yml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 3f85ac6fa74a..d7ab9e0d3390 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -23,7 +23,7 @@ jobs:
xbps-install -yu
# Install script dependencies
xbps-install -y python3-networkx github-cli
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Create hostrepo and prepare masterdir
@@ -38,8 +38,6 @@ jobs:
elif command -v git >/dev/null 2>&1; then
GIT_CMD=$(command -v git)
fi
- # required by git 2.35.2+
- $GIT_CMD config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From e6840d8050bd93d93824ec66d20847372a3bd8b0 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:15:51 -0400
Subject: [PATCH 3/4] common/travis/fetch_upstream.sh: remove unnecessary git
config
no longer needed with actions/checkout@v3
---
common/travis/fetch_upstream.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index 049cfd69e54d..45315563e0b1 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -8,8 +8,5 @@ elif command -v git >/dev/null 2>&1; then
GIT_CMD=$(command -v git)
fi
-# required by git 2.35.2+
-$GIT_CMD config --global --add safe.directory "$PWD"
-
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
$GIT_CMD fetch --depth 200 https://github.com/void-linux/void-packages.git master
From f44808c9d6425558859d2c5d3d98b498c8977dea Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:21:07 -0400
Subject: [PATCH 4/4] TMP chezmoi: test
---
srcpkgs/chezmoi/template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/srcpkgs/chezmoi/template b/srcpkgs/chezmoi/template
index 13505278dbaa..b333e8945f7e 100644
--- a/srcpkgs/chezmoi/template
+++ b/srcpkgs/chezmoi/template
@@ -1,7 +1,7 @@
# Template file for 'chezmoi'
pkgname=chezmoi
version=2.22.1
-revision=1
+revision=2
build_style=go
go_import_path="github.com/twpayne/chezmoi/v2"
go_build_tags="noembeddocs noupgrade"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] ci: update actions/checkout to v3
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
2022-09-16 4:21 ` [PR PATCH] [Updated] " classabbyamp
@ 2022-09-16 5:03 ` classabbyamp
2022-09-16 5:10 ` [PR PATCH] [Updated] ci: update actions/checkout to v3, simplify git finding logic classabbyamp
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 5:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages ci/safe-dir
https://github.com/void-linux/void-packages/pull/39310
ci: update actions/checkout to v3
`actions/checkout@v3` adds a configuration option to set the checkout dir as a safe directory, a security feature added in git 2.35.2
```yaml
# Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: ''
```
This is set to true by default so we shouldn't need to specify it.
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
A patch file from https://github.com/void-linux/void-packages/pull/39310.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci/safe-dir-39310.patch --]
[-- Type: text/x-diff, Size: 11489 bytes --]
From ab4a651d04f2356764955d195441ec174c6ee95a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:55:07 -0400
Subject: [PATCH 1/5] .github/workflows: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
.github/workflows/build.yaml | 4 ++--
.github/workflows/cycles.yml | 9 +++------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce995e2d9c79..95f1cd88e338 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
XLINT: '1'
LICENSE_LIST: common/travis/license.lst
@@ -44,7 +44,7 @@ jobs:
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-${{ matrix.config.bootstrap }}'
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
ARCH: '${{ matrix.config.arch }}'
BOOTSTRAP: '${{ matrix.config.bootstrap }}'
TEST: '${{ matrix.config.test }}'
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 3f85ac6fa74a..1c7ba22b354a 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -11,6 +11,8 @@ jobs:
issues: write
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-x86_64-musl'
+ env:
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
steps:
- name: Prepare container
run: |
@@ -33,13 +35,8 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
- elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
- fi
# required by git 2.35.2+
- $GIT_CMD config --global --add safe.directory "$PWD"
+ git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From f8b09f40122bf0e9722926e7b82a6d845b547a4b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:59:15 -0400
Subject: [PATCH 2/5] common: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
common/scripts/lint-commits | 11 +++++------
common/scripts/lint-version-change | 11 +++--------
common/travis/changed_templates.sh | 12 +++---------
common/travis/fetch_upstream.sh | 10 ++--------
4 files changed, 13 insertions(+), 31 deletions(-)
diff --git a/common/scripts/lint-commits b/common/scripts/lint-commits
index 7207ed81d5aa..88e6b1f959ae 100755
--- a/common/scripts/lint-commits
+++ b/common/scripts/lint-commits
@@ -5,18 +5,17 @@ die() {
exit 1
}
-GIT_CMD=$(command -v chroot-git 2>/dev/null) ||
-GIT_CMD=$(command -v git 2>/dev/null) ||
+command -v git 2>/dev/null 2>&1 ||
die "neither chroot-git nor git could be found!"
rev_parse() {
if [ -n "$1" ]; then
- "$GIT_CMD" rev-parse --verify "$1"
+ git rev-parse --verify "$1"
else
shift
while test "$#" != 0
do
- "$GIT_CMD" rev-parse --verify "$1" 2>/dev/null && return
+ git rev-parse --verify "$1" 2>/dev/null && return
shift
done
return 1
@@ -27,9 +26,9 @@ base=$(rev_parse "$1" FETCH_HEAD ORIG_HEAD) || die "base commit not found"
tip=$(rev_parse "$2" HEAD) || die "tip commit not found"
status=0
-for cmt in $("$GIT_CMD" rev-list --abbrev-commit $base..$tip)
+for cmt in $(git rev-list --abbrev-commit $base..$tip)
do
- "$GIT_CMD" cat-file commit "$cmt" |
+ git cat-file commit "$cmt" |
awk -vC="$cmt" '
# skip header
/^$/ && !msg { msg = 1; next }
diff --git a/common/scripts/lint-version-change b/common/scripts/lint-version-change
index 5e9687799384..1dc0072f67ea 100755
--- a/common/scripts/lint-version-change
+++ b/common/scripts/lint-version-change
@@ -13,20 +13,15 @@ if ! [ "$base_rev" ]; then
die "usage: $0 TEMPLATE BASE-REVISION [TIP-REVISION]"
fi
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-else
+command -v git 2>/dev/null 2>&1 ||
die "neither chroot-git nor git could be found"
-fi
scan() {
rx="$1" msg="$2"
template_path=$template
if [ "$tip_rev" ]; then
template_path="${tip_rev}:${template}"
- maybe_git="$GIT_CMD"
+ maybe_git="git"
revspec="[^:]*:"
fi
$maybe_git grep -P -Hn -e "$rx" "$template_path" |
@@ -37,7 +32,7 @@ scan() {
show_template() {
rev="$1"
if [ "$rev" ]; then
- $GIT_CMD cat-file blob "${rev}:${template}" 2>/dev/null
+ git cat-file blob "${rev}:${template}" 2>/dev/null
else
cat "${template}" 2>/dev/null
fi
diff --git a/common/travis/changed_templates.sh b/common/travis/changed_templates.sh
index 686436ce4327..68323ab8c470 100755
--- a/common/travis/changed_templates.sh
+++ b/common/travis/changed_templates.sh
@@ -2,19 +2,13 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
-tip="$($GIT_CMD rev-list -1 --parents HEAD)"
+tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
*" "*" "*) tip="${tip##* }" ;;
*) tip="${tip%% *}" ;;
esac
-base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
+base="$(git merge-base FETCH_HEAD "$tip")" || {
echo "Your branches is based on too old copy."
echo "Please rebase to newest copy."
exit 1
@@ -23,7 +17,7 @@ base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
echo "$base $tip" >/tmp/revisions
/bin/echo -e '\x1b[32mChanged packages:\x1b[0m'
-$GIT_CMD diff-tree -r --no-renames --name-only --diff-filter=AM \
+git diff-tree -r --no-renames --name-only --diff-filter=AM \
"$base" "$tip" \
-- 'srcpkgs/*/template' |
cut -d/ -f 2 |
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index 049cfd69e54d..e5ec5979493b 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,14 +2,8 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
# required by git 2.35.2+
-$GIT_CMD config --global --add safe.directory "$PWD"
+git config --global --add safe.directory "$PWD"
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
-$GIT_CMD fetch --depth 200 https://github.com/void-linux/void-packages.git master
+git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From a3265dcfd1f6db3cf262f27d7cb0be189c4bce04 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:01:25 -0400
Subject: [PATCH 3/5] .github/workflows: update actions/checkout to v3
this removes the need for manually setting `safe.directory`
in the git config because the action sets it for us by default
---
.github/workflows/build.yaml | 4 ++--
.github/workflows/cycles.yml | 4 +---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 95f1cd88e338..b258d31b3bbe 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -26,7 +26,7 @@ jobs:
LICENSE_LIST: common/travis/license.lst
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- run: common/travis/fetch_upstream.sh
@@ -73,7 +73,7 @@ jobs:
# Upgrade again (in case there was a xbps update)
xbps-install -yu
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- name: Create hostrepo and prepare masterdir
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 1c7ba22b354a..0b86986c03fa 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -25,7 +25,7 @@ jobs:
xbps-install -yu
# Install script dependencies
xbps-install -y python3-networkx github-cli
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Create hostrepo and prepare masterdir
@@ -35,8 +35,6 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- # required by git 2.35.2+
- git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From 5ab5f060c2d9ffac690d6895e32e443d4c7585ff Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:02:32 -0400
Subject: [PATCH 4/5] common/travis/fetch_upstream.sh: remove manual git config
safe.directory
no longer necessary with actions/checkout@v3
---
common/travis/fetch_upstream.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index e5ec5979493b..f03aee6a0d4c 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,8 +2,5 @@
#
# changed_templates.sh
-# required by git 2.35.2+
-git config --global --add safe.directory "$PWD"
-
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From d5dfb02786295405be6b4739cbcd7feaf69e85ec Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:03:20 -0400
Subject: [PATCH 5/5] chezmoi: TEMP TEST
---
srcpkgs/chezmoi/template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/srcpkgs/chezmoi/template b/srcpkgs/chezmoi/template
index 13505278dbaa..b333e8945f7e 100644
--- a/srcpkgs/chezmoi/template
+++ b/srcpkgs/chezmoi/template
@@ -1,7 +1,7 @@
# Template file for 'chezmoi'
pkgname=chezmoi
version=2.22.1
-revision=1
+revision=2
build_style=go
go_import_path="github.com/twpayne/chezmoi/v2"
go_build_tags="noembeddocs noupgrade"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] ci: update actions/checkout to v3, simplify git finding logic
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
2022-09-16 4:21 ` [PR PATCH] [Updated] " classabbyamp
2022-09-16 5:03 ` classabbyamp
@ 2022-09-16 5:10 ` classabbyamp
2022-09-16 5:15 ` classabbyamp
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 5:10 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 833 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages ci/safe-dir
https://github.com/void-linux/void-packages/pull/39310
ci: update actions/checkout to v3, simplify git finding logic
`actions/checkout@v3` adds a configuration option to set the checkout dir as a safe directory, a security feature added in git 2.35.2
```yaml
# Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: ''
```
This is set to true by default so we shouldn't need to specify it.
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
A patch file from https://github.com/void-linux/void-packages/pull/39310.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci/safe-dir-39310.patch --]
[-- Type: text/x-diff, Size: 11660 bytes --]
From ab4a651d04f2356764955d195441ec174c6ee95a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:55:07 -0400
Subject: [PATCH 1/5] .github/workflows: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
.github/workflows/build.yaml | 4 ++--
.github/workflows/cycles.yml | 9 +++------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce995e2d9c79..95f1cd88e338 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
XLINT: '1'
LICENSE_LIST: common/travis/license.lst
@@ -44,7 +44,7 @@ jobs:
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-${{ matrix.config.bootstrap }}'
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
ARCH: '${{ matrix.config.arch }}'
BOOTSTRAP: '${{ matrix.config.bootstrap }}'
TEST: '${{ matrix.config.test }}'
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 3f85ac6fa74a..1c7ba22b354a 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -11,6 +11,8 @@ jobs:
issues: write
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-x86_64-musl'
+ env:
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
steps:
- name: Prepare container
run: |
@@ -33,13 +35,8 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
- elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
- fi
# required by git 2.35.2+
- $GIT_CMD config --global --add safe.directory "$PWD"
+ git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From f8b09f40122bf0e9722926e7b82a6d845b547a4b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:59:15 -0400
Subject: [PATCH 2/5] common: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
common/scripts/lint-commits | 11 +++++------
common/scripts/lint-version-change | 11 +++--------
common/travis/changed_templates.sh | 12 +++---------
common/travis/fetch_upstream.sh | 10 ++--------
4 files changed, 13 insertions(+), 31 deletions(-)
diff --git a/common/scripts/lint-commits b/common/scripts/lint-commits
index 7207ed81d5aa..88e6b1f959ae 100755
--- a/common/scripts/lint-commits
+++ b/common/scripts/lint-commits
@@ -5,18 +5,17 @@ die() {
exit 1
}
-GIT_CMD=$(command -v chroot-git 2>/dev/null) ||
-GIT_CMD=$(command -v git 2>/dev/null) ||
+command -v git 2>/dev/null 2>&1 ||
die "neither chroot-git nor git could be found!"
rev_parse() {
if [ -n "$1" ]; then
- "$GIT_CMD" rev-parse --verify "$1"
+ git rev-parse --verify "$1"
else
shift
while test "$#" != 0
do
- "$GIT_CMD" rev-parse --verify "$1" 2>/dev/null && return
+ git rev-parse --verify "$1" 2>/dev/null && return
shift
done
return 1
@@ -27,9 +26,9 @@ base=$(rev_parse "$1" FETCH_HEAD ORIG_HEAD) || die "base commit not found"
tip=$(rev_parse "$2" HEAD) || die "tip commit not found"
status=0
-for cmt in $("$GIT_CMD" rev-list --abbrev-commit $base..$tip)
+for cmt in $(git rev-list --abbrev-commit $base..$tip)
do
- "$GIT_CMD" cat-file commit "$cmt" |
+ git cat-file commit "$cmt" |
awk -vC="$cmt" '
# skip header
/^$/ && !msg { msg = 1; next }
diff --git a/common/scripts/lint-version-change b/common/scripts/lint-version-change
index 5e9687799384..1dc0072f67ea 100755
--- a/common/scripts/lint-version-change
+++ b/common/scripts/lint-version-change
@@ -13,20 +13,15 @@ if ! [ "$base_rev" ]; then
die "usage: $0 TEMPLATE BASE-REVISION [TIP-REVISION]"
fi
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-else
+command -v git 2>/dev/null 2>&1 ||
die "neither chroot-git nor git could be found"
-fi
scan() {
rx="$1" msg="$2"
template_path=$template
if [ "$tip_rev" ]; then
template_path="${tip_rev}:${template}"
- maybe_git="$GIT_CMD"
+ maybe_git="git"
revspec="[^:]*:"
fi
$maybe_git grep -P -Hn -e "$rx" "$template_path" |
@@ -37,7 +32,7 @@ scan() {
show_template() {
rev="$1"
if [ "$rev" ]; then
- $GIT_CMD cat-file blob "${rev}:${template}" 2>/dev/null
+ git cat-file blob "${rev}:${template}" 2>/dev/null
else
cat "${template}" 2>/dev/null
fi
diff --git a/common/travis/changed_templates.sh b/common/travis/changed_templates.sh
index 686436ce4327..68323ab8c470 100755
--- a/common/travis/changed_templates.sh
+++ b/common/travis/changed_templates.sh
@@ -2,19 +2,13 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
-tip="$($GIT_CMD rev-list -1 --parents HEAD)"
+tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
*" "*" "*) tip="${tip##* }" ;;
*) tip="${tip%% *}" ;;
esac
-base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
+base="$(git merge-base FETCH_HEAD "$tip")" || {
echo "Your branches is based on too old copy."
echo "Please rebase to newest copy."
exit 1
@@ -23,7 +17,7 @@ base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
echo "$base $tip" >/tmp/revisions
/bin/echo -e '\x1b[32mChanged packages:\x1b[0m'
-$GIT_CMD diff-tree -r --no-renames --name-only --diff-filter=AM \
+git diff-tree -r --no-renames --name-only --diff-filter=AM \
"$base" "$tip" \
-- 'srcpkgs/*/template' |
cut -d/ -f 2 |
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index 049cfd69e54d..e5ec5979493b 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,14 +2,8 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
# required by git 2.35.2+
-$GIT_CMD config --global --add safe.directory "$PWD"
+git config --global --add safe.directory "$PWD"
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
-$GIT_CMD fetch --depth 200 https://github.com/void-linux/void-packages.git master
+git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From f4213187d874ace7c2715269716ae2064362612b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:01:25 -0400
Subject: [PATCH 3/5] .github/workflows: update actions/checkout to v3
this removes the need for manually setting `safe.directory`
in the git config because the action sets it for us by default
---
.github/workflows/build.yaml | 6 ++++--
.github/workflows/cycles.yml | 5 ++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 95f1cd88e338..6be582f6e920 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -26,7 +26,8 @@ jobs:
LICENSE_LIST: common/travis/license.lst
steps:
- - uses: actions/checkout@v1
+ - run: echo '#!/bin/sh' > /tmp/bin/git-submodule
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- run: common/travis/fetch_upstream.sh
@@ -73,7 +74,8 @@ jobs:
# Upgrade again (in case there was a xbps update)
xbps-install -yu
- - uses: actions/checkout@v1
+ - run: echo '#!/bin/sh' > /tmp/bin/git-submodule
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- name: Create hostrepo and prepare masterdir
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 1c7ba22b354a..2ddca7ecaff3 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -25,7 +25,8 @@ jobs:
xbps-install -yu
# Install script dependencies
xbps-install -y python3-networkx github-cli
- - uses: actions/checkout@v1
+ - run: echo '#!/bin/sh' > /tmp/bin/git-submodule
+ - uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Create hostrepo and prepare masterdir
@@ -35,8 +36,6 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- # required by git 2.35.2+
- git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From c1853ae323ea17cd6c1579a9fecfa18827767790 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:02:32 -0400
Subject: [PATCH 4/5] common/travis/fetch_upstream.sh: remove manual git config
safe.directory
no longer necessary with actions/checkout@v3
---
common/travis/fetch_upstream.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index e5ec5979493b..f03aee6a0d4c 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,8 +2,5 @@
#
# changed_templates.sh
-# required by git 2.35.2+
-git config --global --add safe.directory "$PWD"
-
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From 0e7ec1b1f9b1a55bcb5baef03a084fc7a2018c24 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:03:20 -0400
Subject: [PATCH 5/5] chezmoi: TEMP TEST
---
srcpkgs/chezmoi/template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/srcpkgs/chezmoi/template b/srcpkgs/chezmoi/template
index 13505278dbaa..b333e8945f7e 100644
--- a/srcpkgs/chezmoi/template
+++ b/srcpkgs/chezmoi/template
@@ -1,7 +1,7 @@
# Template file for 'chezmoi'
pkgname=chezmoi
version=2.22.1
-revision=1
+revision=2
build_style=go
go_import_path="github.com/twpayne/chezmoi/v2"
go_build_tags="noembeddocs noupgrade"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] ci: update actions/checkout to v3, simplify git finding logic
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
` (2 preceding siblings ...)
2022-09-16 5:10 ` [PR PATCH] [Updated] ci: update actions/checkout to v3, simplify git finding logic classabbyamp
@ 2022-09-16 5:15 ` classabbyamp
2022-09-16 5:38 ` classabbyamp
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 5:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 833 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages ci/safe-dir
https://github.com/void-linux/void-packages/pull/39310
ci: update actions/checkout to v3, simplify git finding logic
`actions/checkout@v3` adds a configuration option to set the checkout dir as a safe directory, a security feature added in git 2.35.2
```yaml
# Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: ''
```
This is set to true by default so we shouldn't need to specify it.
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
A patch file from https://github.com/void-linux/void-packages/pull/39310.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci/safe-dir-39310.patch --]
[-- Type: text/x-diff, Size: 11759 bytes --]
From ab4a651d04f2356764955d195441ec174c6ee95a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:55:07 -0400
Subject: [PATCH 1/5] .github/workflows: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
.github/workflows/build.yaml | 4 ++--
.github/workflows/cycles.yml | 9 +++------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce995e2d9c79..95f1cd88e338 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
XLINT: '1'
LICENSE_LIST: common/travis/license.lst
@@ -44,7 +44,7 @@ jobs:
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-${{ matrix.config.bootstrap }}'
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
ARCH: '${{ matrix.config.arch }}'
BOOTSTRAP: '${{ matrix.config.bootstrap }}'
TEST: '${{ matrix.config.test }}'
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 3f85ac6fa74a..1c7ba22b354a 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -11,6 +11,8 @@ jobs:
issues: write
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-x86_64-musl'
+ env:
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
steps:
- name: Prepare container
run: |
@@ -33,13 +35,8 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
- elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
- fi
# required by git 2.35.2+
- $GIT_CMD config --global --add safe.directory "$PWD"
+ git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From f8b09f40122bf0e9722926e7b82a6d845b547a4b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:59:15 -0400
Subject: [PATCH 2/5] common: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
common/scripts/lint-commits | 11 +++++------
common/scripts/lint-version-change | 11 +++--------
common/travis/changed_templates.sh | 12 +++---------
common/travis/fetch_upstream.sh | 10 ++--------
4 files changed, 13 insertions(+), 31 deletions(-)
diff --git a/common/scripts/lint-commits b/common/scripts/lint-commits
index 7207ed81d5aa..88e6b1f959ae 100755
--- a/common/scripts/lint-commits
+++ b/common/scripts/lint-commits
@@ -5,18 +5,17 @@ die() {
exit 1
}
-GIT_CMD=$(command -v chroot-git 2>/dev/null) ||
-GIT_CMD=$(command -v git 2>/dev/null) ||
+command -v git 2>/dev/null 2>&1 ||
die "neither chroot-git nor git could be found!"
rev_parse() {
if [ -n "$1" ]; then
- "$GIT_CMD" rev-parse --verify "$1"
+ git rev-parse --verify "$1"
else
shift
while test "$#" != 0
do
- "$GIT_CMD" rev-parse --verify "$1" 2>/dev/null && return
+ git rev-parse --verify "$1" 2>/dev/null && return
shift
done
return 1
@@ -27,9 +26,9 @@ base=$(rev_parse "$1" FETCH_HEAD ORIG_HEAD) || die "base commit not found"
tip=$(rev_parse "$2" HEAD) || die "tip commit not found"
status=0
-for cmt in $("$GIT_CMD" rev-list --abbrev-commit $base..$tip)
+for cmt in $(git rev-list --abbrev-commit $base..$tip)
do
- "$GIT_CMD" cat-file commit "$cmt" |
+ git cat-file commit "$cmt" |
awk -vC="$cmt" '
# skip header
/^$/ && !msg { msg = 1; next }
diff --git a/common/scripts/lint-version-change b/common/scripts/lint-version-change
index 5e9687799384..1dc0072f67ea 100755
--- a/common/scripts/lint-version-change
+++ b/common/scripts/lint-version-change
@@ -13,20 +13,15 @@ if ! [ "$base_rev" ]; then
die "usage: $0 TEMPLATE BASE-REVISION [TIP-REVISION]"
fi
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-else
+command -v git 2>/dev/null 2>&1 ||
die "neither chroot-git nor git could be found"
-fi
scan() {
rx="$1" msg="$2"
template_path=$template
if [ "$tip_rev" ]; then
template_path="${tip_rev}:${template}"
- maybe_git="$GIT_CMD"
+ maybe_git="git"
revspec="[^:]*:"
fi
$maybe_git grep -P -Hn -e "$rx" "$template_path" |
@@ -37,7 +32,7 @@ scan() {
show_template() {
rev="$1"
if [ "$rev" ]; then
- $GIT_CMD cat-file blob "${rev}:${template}" 2>/dev/null
+ git cat-file blob "${rev}:${template}" 2>/dev/null
else
cat "${template}" 2>/dev/null
fi
diff --git a/common/travis/changed_templates.sh b/common/travis/changed_templates.sh
index 686436ce4327..68323ab8c470 100755
--- a/common/travis/changed_templates.sh
+++ b/common/travis/changed_templates.sh
@@ -2,19 +2,13 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
-tip="$($GIT_CMD rev-list -1 --parents HEAD)"
+tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
*" "*" "*) tip="${tip##* }" ;;
*) tip="${tip%% *}" ;;
esac
-base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
+base="$(git merge-base FETCH_HEAD "$tip")" || {
echo "Your branches is based on too old copy."
echo "Please rebase to newest copy."
exit 1
@@ -23,7 +17,7 @@ base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
echo "$base $tip" >/tmp/revisions
/bin/echo -e '\x1b[32mChanged packages:\x1b[0m'
-$GIT_CMD diff-tree -r --no-renames --name-only --diff-filter=AM \
+git diff-tree -r --no-renames --name-only --diff-filter=AM \
"$base" "$tip" \
-- 'srcpkgs/*/template' |
cut -d/ -f 2 |
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index 049cfd69e54d..e5ec5979493b 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,14 +2,8 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
# required by git 2.35.2+
-$GIT_CMD config --global --add safe.directory "$PWD"
+git config --global --add safe.directory "$PWD"
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
-$GIT_CMD fetch --depth 200 https://github.com/void-linux/void-packages.git master
+git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From 6d91b31d003e977c2954a548443c050d07a11020 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:01:25 -0400
Subject: [PATCH 3/5] .github/workflows: update actions/checkout to v3
this removes the need for manually setting `safe.directory`
in the git config because the action sets it for us by default
---
.github/workflows/build.yaml | 6 ++++--
.github/workflows/cycles.yml | 5 ++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 95f1cd88e338..ae75bea55937 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -26,7 +26,8 @@ jobs:
LICENSE_LIST: common/travis/license.lst
steps:
- - uses: actions/checkout@v1
+ - run: mkdir -p /usr/local/bin && echo '#!/bin/sh' > /usr/local/bin/git-submodule
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- run: common/travis/fetch_upstream.sh
@@ -73,7 +74,8 @@ jobs:
# Upgrade again (in case there was a xbps update)
xbps-install -yu
- - uses: actions/checkout@v1
+ - run: mkdir -p /usr/local/bin && echo '#!/bin/sh' > /usr/local/bin/git-submodule
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- name: Create hostrepo and prepare masterdir
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 1c7ba22b354a..c51c30b9eae6 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -25,7 +25,8 @@ jobs:
xbps-install -yu
# Install script dependencies
xbps-install -y python3-networkx github-cli
- - uses: actions/checkout@v1
+ - run: mkdir -p /usr/local/bin && echo '#!/bin/sh' > /usr/local/bin/git-submodule
+ - uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Create hostrepo and prepare masterdir
@@ -35,8 +36,6 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- # required by git 2.35.2+
- git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From 39ff192004fa41b2e6b8bf85ad0112315fbb1557 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:02:32 -0400
Subject: [PATCH 4/5] common/travis/fetch_upstream.sh: remove manual git config
safe.directory
no longer necessary with actions/checkout@v3
---
common/travis/fetch_upstream.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index e5ec5979493b..f03aee6a0d4c 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,8 +2,5 @@
#
# changed_templates.sh
-# required by git 2.35.2+
-git config --global --add safe.directory "$PWD"
-
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From 13929beb6039d9b1897de20c9ab3e1aa8913faed Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:03:20 -0400
Subject: [PATCH 5/5] chezmoi: TEMP TEST
---
srcpkgs/chezmoi/template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/srcpkgs/chezmoi/template b/srcpkgs/chezmoi/template
index 13505278dbaa..b333e8945f7e 100644
--- a/srcpkgs/chezmoi/template
+++ b/srcpkgs/chezmoi/template
@@ -1,7 +1,7 @@
# Template file for 'chezmoi'
pkgname=chezmoi
version=2.22.1
-revision=1
+revision=2
build_style=go
go_import_path="github.com/twpayne/chezmoi/v2"
go_build_tags="noembeddocs noupgrade"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] ci: update actions/checkout to v3, simplify git finding logic
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
` (3 preceding siblings ...)
2022-09-16 5:15 ` classabbyamp
@ 2022-09-16 5:38 ` classabbyamp
2022-09-16 5:40 ` classabbyamp
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 5:38 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 833 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages ci/safe-dir
https://github.com/void-linux/void-packages/pull/39310
ci: update actions/checkout to v3, simplify git finding logic
`actions/checkout@v3` adds a configuration option to set the checkout dir as a safe directory, a security feature added in git 2.35.2
```yaml
# Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: ''
```
This is set to true by default so we shouldn't need to specify it.
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
A patch file from https://github.com/void-linux/void-packages/pull/39310.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci/safe-dir-39310.patch --]
[-- Type: text/x-diff, Size: 11759 bytes --]
From ab4a651d04f2356764955d195441ec174c6ee95a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:55:07 -0400
Subject: [PATCH 1/5] .github/workflows: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
.github/workflows/build.yaml | 4 ++--
.github/workflows/cycles.yml | 9 +++------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce995e2d9c79..95f1cd88e338 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
XLINT: '1'
LICENSE_LIST: common/travis/license.lst
@@ -44,7 +44,7 @@ jobs:
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-${{ matrix.config.bootstrap }}'
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
ARCH: '${{ matrix.config.arch }}'
BOOTSTRAP: '${{ matrix.config.bootstrap }}'
TEST: '${{ matrix.config.test }}'
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 3f85ac6fa74a..1c7ba22b354a 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -11,6 +11,8 @@ jobs:
issues: write
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-x86_64-musl'
+ env:
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
steps:
- name: Prepare container
run: |
@@ -33,13 +35,8 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
- elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
- fi
# required by git 2.35.2+
- $GIT_CMD config --global --add safe.directory "$PWD"
+ git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From 0066929a8899d0b206b2ce58b9f2cfdc31533f83 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:59:15 -0400
Subject: [PATCH 2/5] common: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
common/scripts/lint-commits | 11 +++++------
common/scripts/lint-version-change | 11 +++--------
common/travis/changed_templates.sh | 12 +++---------
common/travis/fetch_upstream.sh | 10 ++--------
4 files changed, 13 insertions(+), 31 deletions(-)
diff --git a/common/scripts/lint-commits b/common/scripts/lint-commits
index 7207ed81d5aa..5f465667cf8e 100755
--- a/common/scripts/lint-commits
+++ b/common/scripts/lint-commits
@@ -5,18 +5,17 @@ die() {
exit 1
}
-GIT_CMD=$(command -v chroot-git 2>/dev/null) ||
-GIT_CMD=$(command -v git 2>/dev/null) ||
+command -v git >/dev/null ||
die "neither chroot-git nor git could be found!"
rev_parse() {
if [ -n "$1" ]; then
- "$GIT_CMD" rev-parse --verify "$1"
+ git rev-parse --verify "$1"
else
shift
while test "$#" != 0
do
- "$GIT_CMD" rev-parse --verify "$1" 2>/dev/null && return
+ git rev-parse --verify "$1" 2>/dev/null && return
shift
done
return 1
@@ -27,9 +26,9 @@ base=$(rev_parse "$1" FETCH_HEAD ORIG_HEAD) || die "base commit not found"
tip=$(rev_parse "$2" HEAD) || die "tip commit not found"
status=0
-for cmt in $("$GIT_CMD" rev-list --abbrev-commit $base..$tip)
+for cmt in $(git rev-list --abbrev-commit $base..$tip)
do
- "$GIT_CMD" cat-file commit "$cmt" |
+ git cat-file commit "$cmt" |
awk -vC="$cmt" '
# skip header
/^$/ && !msg { msg = 1; next }
diff --git a/common/scripts/lint-version-change b/common/scripts/lint-version-change
index 5e9687799384..157daf681019 100755
--- a/common/scripts/lint-version-change
+++ b/common/scripts/lint-version-change
@@ -13,20 +13,15 @@ if ! [ "$base_rev" ]; then
die "usage: $0 TEMPLATE BASE-REVISION [TIP-REVISION]"
fi
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-else
+command -v git >/dev/null ||
die "neither chroot-git nor git could be found"
-fi
scan() {
rx="$1" msg="$2"
template_path=$template
if [ "$tip_rev" ]; then
template_path="${tip_rev}:${template}"
- maybe_git="$GIT_CMD"
+ maybe_git="git"
revspec="[^:]*:"
fi
$maybe_git grep -P -Hn -e "$rx" "$template_path" |
@@ -37,7 +32,7 @@ scan() {
show_template() {
rev="$1"
if [ "$rev" ]; then
- $GIT_CMD cat-file blob "${rev}:${template}" 2>/dev/null
+ git cat-file blob "${rev}:${template}" 2>/dev/null
else
cat "${template}" 2>/dev/null
fi
diff --git a/common/travis/changed_templates.sh b/common/travis/changed_templates.sh
index 686436ce4327..68323ab8c470 100755
--- a/common/travis/changed_templates.sh
+++ b/common/travis/changed_templates.sh
@@ -2,19 +2,13 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
-tip="$($GIT_CMD rev-list -1 --parents HEAD)"
+tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
*" "*" "*) tip="${tip##* }" ;;
*) tip="${tip%% *}" ;;
esac
-base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
+base="$(git merge-base FETCH_HEAD "$tip")" || {
echo "Your branches is based on too old copy."
echo "Please rebase to newest copy."
exit 1
@@ -23,7 +17,7 @@ base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
echo "$base $tip" >/tmp/revisions
/bin/echo -e '\x1b[32mChanged packages:\x1b[0m'
-$GIT_CMD diff-tree -r --no-renames --name-only --diff-filter=AM \
+git diff-tree -r --no-renames --name-only --diff-filter=AM \
"$base" "$tip" \
-- 'srcpkgs/*/template' |
cut -d/ -f 2 |
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index 049cfd69e54d..e5ec5979493b 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,14 +2,8 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
# required by git 2.35.2+
-$GIT_CMD config --global --add safe.directory "$PWD"
+git config --global --add safe.directory "$PWD"
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
-$GIT_CMD fetch --depth 200 https://github.com/void-linux/void-packages.git master
+git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From 553f61b0da9081066b40c132d27ef8b7d60222ea Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:01:25 -0400
Subject: [PATCH 3/5] .github/workflows: update actions/checkout to v3
this removes the need for manually setting `safe.directory`
in the git config because the action sets it for us by default
---
.github/workflows/build.yaml | 6 ++++--
.github/workflows/cycles.yml | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 95f1cd88e338..967d30dd733c 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -26,7 +26,7 @@ jobs:
LICENSE_LIST: common/travis/license.lst
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- run: common/travis/fetch_upstream.sh
@@ -73,7 +73,9 @@ jobs:
# Upgrade again (in case there was a xbps update)
xbps-install -yu
- - uses: actions/checkout@v1
+ # workaround until https://github.com/actions/checkout/pull/833 is merged
+ - run: git config --global alias.submodule '!true'
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- name: Create hostrepo and prepare masterdir
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 1c7ba22b354a..e1f2894890aa 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -25,7 +25,9 @@ jobs:
xbps-install -yu
# Install script dependencies
xbps-install -y python3-networkx github-cli
- - uses: actions/checkout@v1
+ # workaround until https://github.com/actions/checkout/pull/833 is merged
+ - run: git config --global alias.submodule '!true'
+ - uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Create hostrepo and prepare masterdir
@@ -35,8 +37,6 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- # required by git 2.35.2+
- git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From 9e32e328221496e43b5b15133e353d3a7e561083 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:02:32 -0400
Subject: [PATCH 4/5] common/travis/fetch_upstream.sh: remove manual git config
safe.directory
no longer necessary with actions/checkout@v3
---
common/travis/fetch_upstream.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index e5ec5979493b..f03aee6a0d4c 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,8 +2,5 @@
#
# changed_templates.sh
-# required by git 2.35.2+
-git config --global --add safe.directory "$PWD"
-
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From 153acf34bb81fe072ce8161910c617a88f52212d Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:03:20 -0400
Subject: [PATCH 5/5] chezmoi: TEMP TEST
---
srcpkgs/chezmoi/template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/srcpkgs/chezmoi/template b/srcpkgs/chezmoi/template
index 13505278dbaa..b333e8945f7e 100644
--- a/srcpkgs/chezmoi/template
+++ b/srcpkgs/chezmoi/template
@@ -1,7 +1,7 @@
# Template file for 'chezmoi'
pkgname=chezmoi
version=2.22.1
-revision=1
+revision=2
build_style=go
go_import_path="github.com/twpayne/chezmoi/v2"
go_build_tags="noembeddocs noupgrade"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] ci: update actions/checkout to v3, simplify git finding logic
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
` (4 preceding siblings ...)
2022-09-16 5:38 ` classabbyamp
@ 2022-09-16 5:40 ` classabbyamp
2022-09-16 5:43 ` classabbyamp
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 5:40 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 833 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages ci/safe-dir
https://github.com/void-linux/void-packages/pull/39310
ci: update actions/checkout to v3, simplify git finding logic
`actions/checkout@v3` adds a configuration option to set the checkout dir as a safe directory, a security feature added in git 2.35.2
```yaml
# Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: ''
```
This is set to true by default so we shouldn't need to specify it.
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
A patch file from https://github.com/void-linux/void-packages/pull/39310.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci/safe-dir-39310.patch --]
[-- Type: text/x-diff, Size: 11786 bytes --]
From ab4a651d04f2356764955d195441ec174c6ee95a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:55:07 -0400
Subject: [PATCH 1/5] .github/workflows: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
.github/workflows/build.yaml | 4 ++--
.github/workflows/cycles.yml | 9 +++------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce995e2d9c79..95f1cd88e338 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
XLINT: '1'
LICENSE_LIST: common/travis/license.lst
@@ -44,7 +44,7 @@ jobs:
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-${{ matrix.config.bootstrap }}'
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
ARCH: '${{ matrix.config.arch }}'
BOOTSTRAP: '${{ matrix.config.bootstrap }}'
TEST: '${{ matrix.config.test }}'
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 3f85ac6fa74a..1c7ba22b354a 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -11,6 +11,8 @@ jobs:
issues: write
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-x86_64-musl'
+ env:
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
steps:
- name: Prepare container
run: |
@@ -33,13 +35,8 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
- elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
- fi
# required by git 2.35.2+
- $GIT_CMD config --global --add safe.directory "$PWD"
+ git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From 748782ad9fef32266c41864881d86b5e777ca6d9 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:59:15 -0400
Subject: [PATCH 2/5] common: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
common/scripts/lint-commits | 11 +++++------
common/scripts/lint-version-change | 11 +++--------
common/travis/changed_templates.sh | 12 +++---------
common/travis/fetch_upstream.sh | 11 +++--------
4 files changed, 14 insertions(+), 31 deletions(-)
diff --git a/common/scripts/lint-commits b/common/scripts/lint-commits
index 7207ed81d5aa..5f465667cf8e 100755
--- a/common/scripts/lint-commits
+++ b/common/scripts/lint-commits
@@ -5,18 +5,17 @@ die() {
exit 1
}
-GIT_CMD=$(command -v chroot-git 2>/dev/null) ||
-GIT_CMD=$(command -v git 2>/dev/null) ||
+command -v git >/dev/null ||
die "neither chroot-git nor git could be found!"
rev_parse() {
if [ -n "$1" ]; then
- "$GIT_CMD" rev-parse --verify "$1"
+ git rev-parse --verify "$1"
else
shift
while test "$#" != 0
do
- "$GIT_CMD" rev-parse --verify "$1" 2>/dev/null && return
+ git rev-parse --verify "$1" 2>/dev/null && return
shift
done
return 1
@@ -27,9 +26,9 @@ base=$(rev_parse "$1" FETCH_HEAD ORIG_HEAD) || die "base commit not found"
tip=$(rev_parse "$2" HEAD) || die "tip commit not found"
status=0
-for cmt in $("$GIT_CMD" rev-list --abbrev-commit $base..$tip)
+for cmt in $(git rev-list --abbrev-commit $base..$tip)
do
- "$GIT_CMD" cat-file commit "$cmt" |
+ git cat-file commit "$cmt" |
awk -vC="$cmt" '
# skip header
/^$/ && !msg { msg = 1; next }
diff --git a/common/scripts/lint-version-change b/common/scripts/lint-version-change
index 5e9687799384..157daf681019 100755
--- a/common/scripts/lint-version-change
+++ b/common/scripts/lint-version-change
@@ -13,20 +13,15 @@ if ! [ "$base_rev" ]; then
die "usage: $0 TEMPLATE BASE-REVISION [TIP-REVISION]"
fi
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-else
+command -v git >/dev/null ||
die "neither chroot-git nor git could be found"
-fi
scan() {
rx="$1" msg="$2"
template_path=$template
if [ "$tip_rev" ]; then
template_path="${tip_rev}:${template}"
- maybe_git="$GIT_CMD"
+ maybe_git="git"
revspec="[^:]*:"
fi
$maybe_git grep -P -Hn -e "$rx" "$template_path" |
@@ -37,7 +32,7 @@ scan() {
show_template() {
rev="$1"
if [ "$rev" ]; then
- $GIT_CMD cat-file blob "${rev}:${template}" 2>/dev/null
+ git cat-file blob "${rev}:${template}" 2>/dev/null
else
cat "${template}" 2>/dev/null
fi
diff --git a/common/travis/changed_templates.sh b/common/travis/changed_templates.sh
index 686436ce4327..68323ab8c470 100755
--- a/common/travis/changed_templates.sh
+++ b/common/travis/changed_templates.sh
@@ -2,19 +2,13 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
-tip="$($GIT_CMD rev-list -1 --parents HEAD)"
+tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
*" "*" "*) tip="${tip##* }" ;;
*) tip="${tip%% *}" ;;
esac
-base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
+base="$(git merge-base FETCH_HEAD "$tip")" || {
echo "Your branches is based on too old copy."
echo "Please rebase to newest copy."
exit 1
@@ -23,7 +17,7 @@ base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
echo "$base $tip" >/tmp/revisions
/bin/echo -e '\x1b[32mChanged packages:\x1b[0m'
-$GIT_CMD diff-tree -r --no-renames --name-only --diff-filter=AM \
+git diff-tree -r --no-renames --name-only --diff-filter=AM \
"$base" "$tip" \
-- 'srcpkgs/*/template' |
cut -d/ -f 2 |
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index 049cfd69e54d..c0c3da74a016 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,14 +2,9 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
# required by git 2.35.2+
-$GIT_CMD config --global --add safe.directory "$PWD"
+git config --global --add safe.directory "$PWD"
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
-$GIT_CMD fetch --depth 200 https://github.com/void-linux/void-packages.git master
+echo $(pwd)
+git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From 48bca4d4f72f863a29b4b2c0055b54f865c8e26c Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:01:25 -0400
Subject: [PATCH 3/5] .github/workflows: update actions/checkout to v3
this removes the need for manually setting `safe.directory`
in the git config because the action sets it for us by default
---
.github/workflows/build.yaml | 6 ++++--
.github/workflows/cycles.yml | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 95f1cd88e338..967d30dd733c 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -26,7 +26,7 @@ jobs:
LICENSE_LIST: common/travis/license.lst
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- run: common/travis/fetch_upstream.sh
@@ -73,7 +73,9 @@ jobs:
# Upgrade again (in case there was a xbps update)
xbps-install -yu
- - uses: actions/checkout@v1
+ # workaround until https://github.com/actions/checkout/pull/833 is merged
+ - run: git config --global alias.submodule '!true'
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- name: Create hostrepo and prepare masterdir
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 1c7ba22b354a..e1f2894890aa 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -25,7 +25,9 @@ jobs:
xbps-install -yu
# Install script dependencies
xbps-install -y python3-networkx github-cli
- - uses: actions/checkout@v1
+ # workaround until https://github.com/actions/checkout/pull/833 is merged
+ - run: git config --global alias.submodule '!true'
+ - uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Create hostrepo and prepare masterdir
@@ -35,8 +37,6 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- # required by git 2.35.2+
- git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From a29bdaadca0553cceb4b72eb37c5d60d62621021 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:02:32 -0400
Subject: [PATCH 4/5] common/travis/fetch_upstream.sh: remove manual git config
safe.directory
no longer necessary with actions/checkout@v3
---
common/travis/fetch_upstream.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index c0c3da74a016..f108852370ed 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,9 +2,6 @@
#
# changed_templates.sh
-# required by git 2.35.2+
-git config --global --add safe.directory "$PWD"
-
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
echo $(pwd)
git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From 1d016ac40f71177350cef1c3772c8322ca8f036b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:03:20 -0400
Subject: [PATCH 5/5] chezmoi: TEMP TEST
---
srcpkgs/chezmoi/template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/srcpkgs/chezmoi/template b/srcpkgs/chezmoi/template
index 13505278dbaa..b333e8945f7e 100644
--- a/srcpkgs/chezmoi/template
+++ b/srcpkgs/chezmoi/template
@@ -1,7 +1,7 @@
# Template file for 'chezmoi'
pkgname=chezmoi
version=2.22.1
-revision=1
+revision=2
build_style=go
go_import_path="github.com/twpayne/chezmoi/v2"
go_build_tags="noembeddocs noupgrade"
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Updated] ci: update actions/checkout to v3, simplify git finding logic
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
` (5 preceding siblings ...)
2022-09-16 5:40 ` classabbyamp
@ 2022-09-16 5:43 ` classabbyamp
2022-09-16 6:02 ` [PR PATCH] [Closed]: " classabbyamp
2022-09-16 6:02 ` classabbyamp
8 siblings, 0 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 5:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 833 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages ci/safe-dir
https://github.com/void-linux/void-packages/pull/39310
ci: update actions/checkout to v3, simplify git finding logic
`actions/checkout@v3` adds a configuration option to set the checkout dir as a safe directory, a security feature added in git 2.35.2
```yaml
# Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: ''
```
This is set to true by default so we shouldn't need to specify it.
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
A patch file from https://github.com/void-linux/void-packages/pull/39310.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ci/safe-dir-39310.patch --]
[-- Type: text/x-diff, Size: 12440 bytes --]
From ab4a651d04f2356764955d195441ec174c6ee95a Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:55:07 -0400
Subject: [PATCH 1/6] .github/workflows: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
.github/workflows/build.yaml | 4 ++--
.github/workflows/cycles.yml | 9 +++------
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index ce995e2d9c79..95f1cd88e338 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
XLINT: '1'
LICENSE_LIST: common/travis/license.lst
@@ -44,7 +44,7 @@ jobs:
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-${{ matrix.config.bootstrap }}'
env:
- PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
ARCH: '${{ matrix.config.arch }}'
BOOTSTRAP: '${{ matrix.config.bootstrap }}'
TEST: '${{ matrix.config.test }}'
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 3f85ac6fa74a..1c7ba22b354a 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -11,6 +11,8 @@ jobs:
issues: write
container:
image: 'ghcr.io/void-linux/xbps-src-masterdir:20220527RC01-x86_64-musl'
+ env:
+ PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
steps:
- name: Prepare container
run: |
@@ -33,13 +35,8 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
- elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
- fi
# required by git 2.35.2+
- $GIT_CMD config --global --add safe.directory "$PWD"
+ git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From 748782ad9fef32266c41864881d86b5e777ca6d9 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 00:59:15 -0400
Subject: [PATCH 2/6] common: simplify logic to find git
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From chroot-git 2.33.1, we always have an executable named git
for other build infrastructure and lints.
Let's remove the shenanigans to find which git to be used, prepend the
path to chroot-git's git into $PATH, and let's the shell call the
correct git for us instead.
Co-authored-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
---
common/scripts/lint-commits | 11 +++++------
common/scripts/lint-version-change | 11 +++--------
common/travis/changed_templates.sh | 12 +++---------
common/travis/fetch_upstream.sh | 11 +++--------
4 files changed, 14 insertions(+), 31 deletions(-)
diff --git a/common/scripts/lint-commits b/common/scripts/lint-commits
index 7207ed81d5aa..5f465667cf8e 100755
--- a/common/scripts/lint-commits
+++ b/common/scripts/lint-commits
@@ -5,18 +5,17 @@ die() {
exit 1
}
-GIT_CMD=$(command -v chroot-git 2>/dev/null) ||
-GIT_CMD=$(command -v git 2>/dev/null) ||
+command -v git >/dev/null ||
die "neither chroot-git nor git could be found!"
rev_parse() {
if [ -n "$1" ]; then
- "$GIT_CMD" rev-parse --verify "$1"
+ git rev-parse --verify "$1"
else
shift
while test "$#" != 0
do
- "$GIT_CMD" rev-parse --verify "$1" 2>/dev/null && return
+ git rev-parse --verify "$1" 2>/dev/null && return
shift
done
return 1
@@ -27,9 +26,9 @@ base=$(rev_parse "$1" FETCH_HEAD ORIG_HEAD) || die "base commit not found"
tip=$(rev_parse "$2" HEAD) || die "tip commit not found"
status=0
-for cmt in $("$GIT_CMD" rev-list --abbrev-commit $base..$tip)
+for cmt in $(git rev-list --abbrev-commit $base..$tip)
do
- "$GIT_CMD" cat-file commit "$cmt" |
+ git cat-file commit "$cmt" |
awk -vC="$cmt" '
# skip header
/^$/ && !msg { msg = 1; next }
diff --git a/common/scripts/lint-version-change b/common/scripts/lint-version-change
index 5e9687799384..157daf681019 100755
--- a/common/scripts/lint-version-change
+++ b/common/scripts/lint-version-change
@@ -13,20 +13,15 @@ if ! [ "$base_rev" ]; then
die "usage: $0 TEMPLATE BASE-REVISION [TIP-REVISION]"
fi
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-else
+command -v git >/dev/null ||
die "neither chroot-git nor git could be found"
-fi
scan() {
rx="$1" msg="$2"
template_path=$template
if [ "$tip_rev" ]; then
template_path="${tip_rev}:${template}"
- maybe_git="$GIT_CMD"
+ maybe_git="git"
revspec="[^:]*:"
fi
$maybe_git grep -P -Hn -e "$rx" "$template_path" |
@@ -37,7 +32,7 @@ scan() {
show_template() {
rev="$1"
if [ "$rev" ]; then
- $GIT_CMD cat-file blob "${rev}:${template}" 2>/dev/null
+ git cat-file blob "${rev}:${template}" 2>/dev/null
else
cat "${template}" 2>/dev/null
fi
diff --git a/common/travis/changed_templates.sh b/common/travis/changed_templates.sh
index 686436ce4327..68323ab8c470 100755
--- a/common/travis/changed_templates.sh
+++ b/common/travis/changed_templates.sh
@@ -2,19 +2,13 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
-tip="$($GIT_CMD rev-list -1 --parents HEAD)"
+tip="$(git rev-list -1 --parents HEAD)"
case "$tip" in
*" "*" "*) tip="${tip##* }" ;;
*) tip="${tip%% *}" ;;
esac
-base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
+base="$(git merge-base FETCH_HEAD "$tip")" || {
echo "Your branches is based on too old copy."
echo "Please rebase to newest copy."
exit 1
@@ -23,7 +17,7 @@ base="$($GIT_CMD merge-base FETCH_HEAD "$tip")" || {
echo "$base $tip" >/tmp/revisions
/bin/echo -e '\x1b[32mChanged packages:\x1b[0m'
-$GIT_CMD diff-tree -r --no-renames --name-only --diff-filter=AM \
+git diff-tree -r --no-renames --name-only --diff-filter=AM \
"$base" "$tip" \
-- 'srcpkgs/*/template' |
cut -d/ -f 2 |
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index 049cfd69e54d..c0c3da74a016 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,14 +2,9 @@
#
# changed_templates.sh
-if command -v chroot-git >/dev/null 2>&1; then
- GIT_CMD=$(command -v chroot-git)
-elif command -v git >/dev/null 2>&1; then
- GIT_CMD=$(command -v git)
-fi
-
# required by git 2.35.2+
-$GIT_CMD config --global --add safe.directory "$PWD"
+git config --global --add safe.directory "$PWD"
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
-$GIT_CMD fetch --depth 200 https://github.com/void-linux/void-packages.git master
+echo $(pwd)
+git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From 48bca4d4f72f863a29b4b2c0055b54f865c8e26c Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:01:25 -0400
Subject: [PATCH 3/6] .github/workflows: update actions/checkout to v3
this removes the need for manually setting `safe.directory`
in the git config because the action sets it for us by default
---
.github/workflows/build.yaml | 6 ++++--
.github/workflows/cycles.yml | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 95f1cd88e338..967d30dd733c 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -26,7 +26,7 @@ jobs:
LICENSE_LIST: common/travis/license.lst
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- run: common/travis/fetch_upstream.sh
@@ -73,7 +73,9 @@ jobs:
# Upgrade again (in case there was a xbps update)
xbps-install -yu
- - uses: actions/checkout@v1
+ # workaround until https://github.com/actions/checkout/pull/833 is merged
+ - run: git config --global alias.submodule '!true'
+ - uses: actions/checkout@v3
with:
fetch-depth: 200
- name: Create hostrepo and prepare masterdir
diff --git a/.github/workflows/cycles.yml b/.github/workflows/cycles.yml
index 1c7ba22b354a..e1f2894890aa 100644
--- a/.github/workflows/cycles.yml
+++ b/.github/workflows/cycles.yml
@@ -25,7 +25,9 @@ jobs:
xbps-install -yu
# Install script dependencies
xbps-install -y python3-networkx github-cli
- - uses: actions/checkout@v1
+ # workaround until https://github.com/actions/checkout/pull/833 is merged
+ - run: git config --global alias.submodule '!true'
+ - uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Create hostrepo and prepare masterdir
@@ -35,8 +37,6 @@ jobs:
common/travis/prepare.sh
- name: Find cycles and open issues
run: |
- # required by git 2.35.2+
- git config --global --add safe.directory "$PWD"
common/scripts/xbps-cycles.py | tee cycles
grep 'Cycle:' cycles | while read -r line; do
if gh issue list -R "$GITHUB_REPOSITORY" -S "$line" | grep .; then
From a29bdaadca0553cceb4b72eb37c5d60d62621021 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:02:32 -0400
Subject: [PATCH 4/6] common/travis/fetch_upstream.sh: remove manual git config
safe.directory
no longer necessary with actions/checkout@v3
---
common/travis/fetch_upstream.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index c0c3da74a016..f108852370ed 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -2,9 +2,6 @@
#
# changed_templates.sh
-# required by git 2.35.2+
-git config --global --add safe.directory "$PWD"
-
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
echo $(pwd)
git fetch --depth 200 https://github.com/void-linux/void-packages.git master
From 1d016ac40f71177350cef1c3772c8322ca8f036b Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:03:20 -0400
Subject: [PATCH 5/6] chezmoi: TEMP TEST
---
srcpkgs/chezmoi/template | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/srcpkgs/chezmoi/template b/srcpkgs/chezmoi/template
index 13505278dbaa..b333e8945f7e 100644
--- a/srcpkgs/chezmoi/template
+++ b/srcpkgs/chezmoi/template
@@ -1,7 +1,7 @@
# Template file for 'chezmoi'
pkgname=chezmoi
version=2.22.1
-revision=1
+revision=2
build_style=go
go_import_path="github.com/twpayne/chezmoi/v2"
go_build_tags="noembeddocs noupgrade"
From 8196fa0a0bfdc583d40f19f17ae902cc959b2621 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Fri, 16 Sep 2022 01:43:36 -0400
Subject: [PATCH 6/6] asdfjsadf
---
common/travis/fetch_upstream.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/common/travis/fetch_upstream.sh b/common/travis/fetch_upstream.sh
index f108852370ed..3060460a4b94 100755
--- a/common/travis/fetch_upstream.sh
+++ b/common/travis/fetch_upstream.sh
@@ -4,4 +4,6 @@
/bin/echo -e '\x1b[32mFetching upstream...\x1b[0m'
echo $(pwd)
+echo $HOME
+cat $HOME/.gitconfig
git fetch --depth 200 https://github.com/void-linux/void-packages.git master
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ci: update actions/checkout to v3, simplify git finding logic
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
` (7 preceding siblings ...)
2022-09-16 6:02 ` [PR PATCH] [Closed]: " classabbyamp
@ 2022-09-16 6:02 ` classabbyamp
8 siblings, 0 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 6:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 219 bytes --]
New comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/39310#issuecomment-1248951687
Comment:
wayyyy too many issues with v3 right now, no point in making this change
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PR PATCH] [Closed]: ci: update actions/checkout to v3, simplify git finding logic
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
` (6 preceding siblings ...)
2022-09-16 5:43 ` classabbyamp
@ 2022-09-16 6:02 ` classabbyamp
2022-09-16 6:02 ` classabbyamp
8 siblings, 0 replies; 10+ messages in thread
From: classabbyamp @ 2022-09-16 6:02 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 663 bytes --]
There's a closed pull request on the void-packages repository
ci: update actions/checkout to v3, simplify git finding logic
https://github.com/void-linux/void-packages/pull/39310
Description:
`actions/checkout@v3` adds a configuration option to set the checkout dir as a safe directory, a security feature added in git 2.35.2
```yaml
# Add repository path as safe.directory for Git global config by running `git
# config --global --add safe.directory <path>`
# Default: true
set-safe-directory: ''
```
This is set to true by default so we shouldn't need to specify it.
#### Testing the changes
- I tested the changes in this PR: **YES**|**briefly**|**NO**
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-09-16 6:02 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 4:20 [PR PATCH] ci: update actions/checkout to v3 classabbyamp
2022-09-16 4:21 ` [PR PATCH] [Updated] " classabbyamp
2022-09-16 5:03 ` classabbyamp
2022-09-16 5:10 ` [PR PATCH] [Updated] ci: update actions/checkout to v3, simplify git finding logic classabbyamp
2022-09-16 5:15 ` classabbyamp
2022-09-16 5:38 ` classabbyamp
2022-09-16 5:40 ` classabbyamp
2022-09-16 5:43 ` classabbyamp
2022-09-16 6:02 ` [PR PATCH] [Closed]: " classabbyamp
2022-09-16 6:02 ` classabbyamp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).