-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Restore vendor script, new script for step-by-step vendoring
- Loading branch information
Showing
5 changed files
with
94 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/bash | ||
# https://unix.stackexchange.com/a/654932/19205 | ||
# Using bash for -o pipefail | ||
|
||
set -e | ||
set -x | ||
set -o pipefail | ||
|
||
cd `dirname $0` | ||
|
||
if [ -z "$1" ]; then | ||
upstream_basedir=../duckdb | ||
else | ||
upstream_basedir="$1" | ||
fi | ||
|
||
upstream_dir=.git/duckdb | ||
|
||
if [ "$upstream_basedir" != ".git/duckdb" ]; then | ||
git clone "$upstream_basedir" "$upstream_dir" | ||
fi | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "Error: working directory not clean" | ||
exit 1 | ||
fi | ||
|
||
if [ -n "$(git -C "$upstream_dir" status --porcelain)" ]; then | ||
echo "Warning: working directory $upstream_dir not clean" | ||
fi | ||
|
||
original=$(git -C "$upstream_dir" rev-parse --verify HEAD) | ||
|
||
base=$(git log -n 3 --format="%s" -- src/duckdb | tee /dev/stderr | sed -nr '/^.*duckdb.duckdb@([0-9a-f]+)$/{s//\1/;p;}' | head -n 1) | ||
|
||
message= | ||
|
||
for commit in $(git -C "$upstream_dir" log --first-parent --reverse --format="%H" ${base}..HEAD); do | ||
echo "Importing commit $commit" | ||
|
||
git -C "$upstream_dir" checkout "$commit" | ||
|
||
rm -rf src/duckdb | ||
|
||
echo "R: configure" | ||
DUCKDB_PATH="$upstream_dir" python3 rconfigure.py | ||
|
||
# Always vendor tags | ||
if [ $(git -C "$upstream_dir" describe --tags | grep -c -- -) -eq 0 ]; then | ||
message="chore: Update vendored sources (tag $(git -C "$upstream_dir" describe --tags)) to duckdb/duckdb@$commit" | ||
changed=1 | ||
break | ||
fi | ||
|
||
if [ $(git status --porcelain -- src/duckdb | wc -l) -gt 1 ]; then | ||
message="chore: Update vendored sources to duckdb/duckdb@$commit" | ||
break | ||
fi | ||
done | ||
|
||
if [ "$message" = "" ]; then | ||
echo "No changes." | ||
git checkout -- src/duckdb | ||
rm -rf "$upstream_dir" | ||
exit 0 | ||
fi | ||
|
||
git add . | ||
|
||
( | ||
echo "$message" | ||
echo | ||
git -C "$upstream_dir" log --first-parent --format="%s" ${base}..${commit} | tee /dev/stderr | sed -r 's%(#[0-9]+)%duckdb/duckdb\1%g' | ||
) | git commit --file /dev/stdin | ||
|
||
rm -rf "$upstream_dir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,45 @@ | ||
#!/bin/bash | ||
# https://unix.stackexchange.com/a/654932/19205 | ||
# Using bash for -o pipefail | ||
#!/bin/sh | ||
|
||
set -e | ||
set -x | ||
set -o pipefail | ||
|
||
cd `dirname $0` | ||
|
||
if [ -z "$1" ]; then | ||
upstream_basedir=../duckdb | ||
duckdir=../duckdb | ||
else | ||
upstream_basedir="$1" | ||
fi | ||
|
||
upstream_dir=.git/duckdb | ||
|
||
if [ "$upstream_basedir" != ".git/duckdb" ]; then | ||
git clone "$upstream_basedir" "$upstream_dir" | ||
duckdir="$1" | ||
fi | ||
|
||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "Error: working directory not clean" | ||
exit 1 | ||
fi | ||
|
||
if [ -n "$(git -C "$upstream_dir" status --porcelain)" ]; then | ||
echo "Warning: working directory $upstream_dir not clean" | ||
if [ -n "$(git -C "$duckdir" status --porcelain)" ]; then | ||
echo "Warning: working directory $duckdir not clean" | ||
fi | ||
|
||
original=$(git -C "$upstream_dir" rev-parse --verify HEAD) | ||
|
||
base=$(git log -n 3 --format="%s" -- src/duckdb | tee /dev/stderr | sed -nr '/^.*duckdb.duckdb@([0-9a-f]+)$/{s//\1/;p;}' | head -n 1) | ||
|
||
message= | ||
commit=$(git -C "$duckdir" rev-parse HEAD) | ||
echo "Importing commit $commit" | ||
|
||
for commit in $(git -C "$upstream_dir" log --first-parent --reverse --format="%H" ${base}..HEAD); do | ||
echo "Importing commit $commit" | ||
base=$(git log -n 1 --format="%s" -- src/duckdb | sed 's#^.*duckdb/duckdb@##') | ||
|
||
git -C "$upstream_dir" checkout "$commit" | ||
rm -rf src/duckdb | ||
|
||
rm -rf src/duckdb | ||
echo "R: configure" | ||
python3 rconfigure.py | ||
|
||
echo "R: configure" | ||
DUCKDB_PATH="$upstream_dir" python3 rconfigure.py | ||
|
||
# Always vendor tags | ||
if [ $(git -C "$upstream_dir" describe --tags | grep -c -- -) -eq 0 ]; then | ||
message="chore: Update vendored sources (tag $(git -C "$upstream_dir" describe --tags)) to duckdb/duckdb@$commit" | ||
changed=1 | ||
break | ||
fi | ||
|
||
if [ $(git status --porcelain -- src/duckdb | wc -l) -gt 1 ]; then | ||
message="chore: Update vendored sources to duckdb/duckdb@$commit" | ||
break | ||
fi | ||
done | ||
|
||
if [ "$message" = "" ]; then | ||
if [ $(git status --porcelain -- src/duckdb | wc -l) -le 1 ]; then | ||
echo "No changes." | ||
git checkout -- src/duckdb | ||
rm -rf "$upstream_dir" | ||
exit 0 | ||
fi | ||
|
||
git add . | ||
|
||
( | ||
echo "$message" | ||
echo "chore: Update vendored sources to duckdb/duckdb@$commit" | ||
echo | ||
git -C "$upstream_dir" log --first-parent --format="%s" ${base}..${commit} | tee /dev/stderr | sed -r 's%(#[0-9]+)%duckdb/duckdb\1%g' | ||
git -C "$duckdir" log --first-parent --format="%s" ${base}..${commit} | sed -r 's%(#[0-9]+)%duckdb/duckdb\1%g' | ||
) | git commit --file /dev/stdin | ||
|
||
rm -rf "$upstream_dir" |