mirror of
https://github.com/archlinux-jerry/pkgbuilds
synced 2024-11-25 07:20:40 +08:00
change: aur update hooks
This commit is contained in:
parent
01b74ae5df
commit
d456c63482
6 changed files with 145 additions and 188 deletions
24
.buildbot/aur.hook.d/config.sh.example
Normal file
24
.buildbot/aur.hook.d/config.sh.example
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# buildbot update hook for aur packages
|
||||||
|
|
||||||
|
PKGNAME='myAwesomePackage'
|
||||||
|
PKGBUILD='PKGBUILD'
|
||||||
|
|
||||||
|
# prepare upstream source
|
||||||
|
prepare() {
|
||||||
|
# sed -i "s/^arch=.*$/arch=('aarch64')/g" PKGBUILD
|
||||||
|
# git apply 0001.patch
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
# which files to include, overrides exclude_files below
|
||||||
|
INCLUDE_FILES=(
|
||||||
|
# 'PKGBUILD'
|
||||||
|
# '.gitignore'
|
||||||
|
)
|
||||||
|
|
||||||
|
# which files to exclude, use '*' and '.*' to exclude all
|
||||||
|
EXCLUDE_FILES=(
|
||||||
|
'.SRCINFO'
|
||||||
|
'.git'
|
||||||
|
)
|
72
.buildbot/aur.hook.d/update.sh
Executable file
72
.buildbot/aur.hook.d/update.sh
Executable file
|
@ -0,0 +1,72 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# buildbot update hook for aur packages
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
assertPkgname() {
|
||||||
|
if [[ "$(basename $(pwd))" != "$PKGNAME" ]]; then
|
||||||
|
echo "Please run this script inside the $PKGNAME dir."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## This section does essential preparations
|
||||||
|
UPDATE_DIR='buildbot.update.d'
|
||||||
|
source ${UPDATE_DIR}/config.sh
|
||||||
|
assertPkgname
|
||||||
|
git pull --ff-only
|
||||||
|
git checkout $PKGBUILD
|
||||||
|
VER=$(source $PKGBUILD; printf "%s-%s" "$pkgver" "$pkgrel")
|
||||||
|
|
||||||
|
# This section does actual jobs
|
||||||
|
newPkgVer() {
|
||||||
|
# do not print anything to stdout other than new pkgver here
|
||||||
|
|
||||||
|
ver=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${PKGNAME}"| \
|
||||||
|
python3 -c 'import json; j=json.loads(input()); print(j.get("results", [dict()])[0].get("Version", 0))')
|
||||||
|
if [[ "$ver" == "$VER" ]]; then
|
||||||
|
echo "${PKGNAME} is up to date with aur." >&2
|
||||||
|
else
|
||||||
|
echo "${PKGNAME} has new ver form aur: ${ver}" >&2
|
||||||
|
echo "$ver"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
newpkgver=$(newPkgVer)
|
||||||
|
[ -z "$newpkgver" ] && exit 0
|
||||||
|
|
||||||
|
incfiles=''
|
||||||
|
for f in "${INCLUDE_FILES[@]}"; do
|
||||||
|
incfiles="$incfiles"$'\n'"$f"
|
||||||
|
done
|
||||||
|
|
||||||
|
excfiles='{'
|
||||||
|
for f in "${EXCLUDE_FILES[@]}"; do
|
||||||
|
excfiles="${excfiles}${f},"
|
||||||
|
done
|
||||||
|
excfiles="${excfiles}}"
|
||||||
|
[[ "$excfiles" == '{}' ]] && excfiles=''
|
||||||
|
|
||||||
|
pushd "$UPDATE_DIR" >/dev/null
|
||||||
|
rm -rf "$PKGNAME"
|
||||||
|
git clone --depth 1 "https://aur.archlinux.org/${PKGNAME}.git" "$PKGNAME"
|
||||||
|
|
||||||
|
cd "$PKGNAME" && prepare
|
||||||
|
for patch in "${PATCHES[@]}"; do
|
||||||
|
git apply "../${patch}"
|
||||||
|
done
|
||||||
|
|
||||||
|
add_files=$(eval ls -1 --almost-all --ignore=${excfiles})
|
||||||
|
add_files="${add_files}"$'\n'"${incfiles}"
|
||||||
|
|
||||||
|
while read f; do
|
||||||
|
[[ -z "$f" ]] && continue
|
||||||
|
cp -av "$f" ../../
|
||||||
|
(cd ../../ && git add "$f")
|
||||||
|
done <<< "$add_files"
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
rm -rf "$PKGNAME"
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
git commit -m "autoupdate: ${PKGNAME} to ${newpkgver} from aur"
|
||||||
|
git push
|
23
scrcpy/buildbot.update.d/config.sh
Normal file
23
scrcpy/buildbot.update.d/config.sh
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# buildbot update hook for aur packages
|
||||||
|
|
||||||
|
PKGNAME='scrcpy'
|
||||||
|
PKGBUILD='PKGBUILD'
|
||||||
|
|
||||||
|
# prepare upstream source
|
||||||
|
prepare() {
|
||||||
|
sed -i "s/^arch=.*$/arch=('aarch64')/g" PKGBUILD
|
||||||
|
git apply 0001-fix-aarch64-compilation.patch
|
||||||
|
}
|
||||||
|
|
||||||
|
# which files to include, overrides exclude_files below
|
||||||
|
INCLUDE_FILES=(
|
||||||
|
# 'PKGBUILD'
|
||||||
|
# '.gitignore'
|
||||||
|
)
|
||||||
|
|
||||||
|
# which files to exclude, use '*' and '.*' to exclude all
|
||||||
|
EXCLUDE_FILES=(
|
||||||
|
'.SRCINFO'
|
||||||
|
'.git'
|
||||||
|
)
|
|
@ -1,94 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# buildbot update hook for aur packages
|
|
||||||
set -e -o pipefail
|
|
||||||
|
|
||||||
assertPkgname() {
|
|
||||||
if [[ "$(basename $(pwd))" != "$PKGNAME" ]]; then
|
|
||||||
echo "Please run this script inside the $PKGNAME dir."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
## This section does essential preparations
|
|
||||||
PKGNAME='scrcpy' && assertPkgname
|
|
||||||
PKGBUILD='PKGBUILD'
|
|
||||||
UPDATE_DIR='buildbot.update.d'
|
|
||||||
git pull --ff-only
|
|
||||||
git checkout $PKGBUILD
|
|
||||||
VER=$(source $PKGBUILD; printf "%s-%s" "$pkgver" "$pkgrel")
|
|
||||||
|
|
||||||
# apply patches to the upstream aur package
|
|
||||||
PATCHES=(
|
|
||||||
'0001-fix-aarch64-compilation.patch'
|
|
||||||
)
|
|
||||||
|
|
||||||
# prepare upstream source
|
|
||||||
prepare() {
|
|
||||||
sed -i "s/^arch=.*$/arch=('aarch64')/g" PKGBUILD
|
|
||||||
}
|
|
||||||
|
|
||||||
# which files to include, overrides exclude_files below
|
|
||||||
INCLUDE_FILES=(
|
|
||||||
# 'PKGBUILD'
|
|
||||||
# '.gitignore'
|
|
||||||
)
|
|
||||||
|
|
||||||
# which files to exclude, use '*' and '.*' to exclude all
|
|
||||||
EXCLUDE_FILES=(
|
|
||||||
'.SRCINFO'
|
|
||||||
'.git'
|
|
||||||
)
|
|
||||||
|
|
||||||
# This section does actual jobs
|
|
||||||
newPkgVer() {
|
|
||||||
# do not print anything to stdout other than new pkgver here
|
|
||||||
|
|
||||||
ver=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${PKGNAME}"| \
|
|
||||||
python3 -c 'import json; j=json.loads(input()); print(j.get("results", [dict()])[0].get("Version", 0))')
|
|
||||||
if [[ "$ver" == "$VER" ]]; then
|
|
||||||
echo "${PKGNAME} is up to date with aur." >&2
|
|
||||||
else
|
|
||||||
echo "${PKGNAME} has new ver form aur: ${ver}" >&2
|
|
||||||
echo "$ver"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
newpkgver=$(newPkgVer)
|
|
||||||
[ -z "$newpkgver" ] && exit 0
|
|
||||||
|
|
||||||
incfiles=''
|
|
||||||
for f in "${INCLUDE_FILES[@]}"; do
|
|
||||||
incfiles="$incfiles"$'\n'"$f"
|
|
||||||
done
|
|
||||||
|
|
||||||
excfiles='{'
|
|
||||||
for f in "${EXCLUDE_FILES[@]}"; do
|
|
||||||
excfiles="${excfiles}${f},"
|
|
||||||
done
|
|
||||||
excfiles="${excfiles}}"
|
|
||||||
[[ "$excfiles" == '{}' ]] && excfiles=''
|
|
||||||
|
|
||||||
pushd "$UPDATE_DIR" >/dev/null
|
|
||||||
rm -rf "$PKGNAME"
|
|
||||||
git clone --depth 1 "https://aur.archlinux.org/${PKGNAME}.git" "$PKGNAME"
|
|
||||||
|
|
||||||
cd "$PKGNAME" && prepare
|
|
||||||
for patch in "${PATCHES[@]}"; do
|
|
||||||
git apply "../${patch}"
|
|
||||||
done
|
|
||||||
|
|
||||||
add_files=$(eval ls -1 --almost-all --ignore=${excfiles})
|
|
||||||
add_files="${add_files}"$'\n'"${incfiles}"
|
|
||||||
|
|
||||||
while read f; do
|
|
||||||
[[ -z "$f" ]] && continue
|
|
||||||
cp -av "$f" ../../
|
|
||||||
(cd ../../ && git add "$f")
|
|
||||||
done <<< "$add_files"
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
rm -rf "$PKGNAME"
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
git commit -m "autoupdate: ${PKGNAME} to ${newpkgver} from aur"
|
|
||||||
git push
|
|
1
scrcpy/buildbot.update.d/update.sh
Symbolic link
1
scrcpy/buildbot.update.d/update.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../.buildbot/aur.hook.d/update.sh
|
24
yay/buildbot.update.d/config.sh
Normal file
24
yay/buildbot.update.d/config.sh
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# buildbot update hook for aur packages
|
||||||
|
|
||||||
|
PKGNAME='yay'
|
||||||
|
PKGBUILD='PKGBUILD'
|
||||||
|
|
||||||
|
# prepare upstream source
|
||||||
|
prepare() {
|
||||||
|
# sed -i "s/^arch=.*$/arch=('aarch64')/g" PKGBUILD
|
||||||
|
# git apply 0001.patch
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
# which files to include, overrides exclude_files below
|
||||||
|
INCLUDE_FILES=(
|
||||||
|
# 'PKGBUILD'
|
||||||
|
# '.gitignore'
|
||||||
|
)
|
||||||
|
|
||||||
|
# which files to exclude, use '*' and '.*' to exclude all
|
||||||
|
EXCLUDE_FILES=(
|
||||||
|
'.SRCINFO'
|
||||||
|
'.git'
|
||||||
|
)
|
|
@ -1,94 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# buildbot update hook for aur packages
|
|
||||||
set -e -o pipefail
|
|
||||||
|
|
||||||
assertPkgname() {
|
|
||||||
if [[ "$(basename $(pwd))" != "$PKGNAME" ]]; then
|
|
||||||
echo "Please run this script inside the $PKGNAME dir."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
## This section does essential preparations
|
|
||||||
PKGNAME='yay' && assertPkgname
|
|
||||||
PKGBUILD='PKGBUILD'
|
|
||||||
UPDATE_DIR='buildbot.update.d'
|
|
||||||
git pull --ff-only
|
|
||||||
git checkout $PKGBUILD
|
|
||||||
VER=$(source $PKGBUILD; printf "%s-%s" "$pkgver" "$pkgrel")
|
|
||||||
|
|
||||||
# apply patches to the upstream aur package
|
|
||||||
PATCHES=(
|
|
||||||
)
|
|
||||||
|
|
||||||
# prepare upstream source
|
|
||||||
prepare() {
|
|
||||||
# sed -i "s/^arch=.*$/arch=('aarch64')/g" PKGBUILD
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
# which files to include, overrides exclude_files below
|
|
||||||
INCLUDE_FILES=(
|
|
||||||
# 'PKGBUILD'
|
|
||||||
# '.gitignore'
|
|
||||||
)
|
|
||||||
|
|
||||||
# which files to exclude, use '*' and '.*' to exclude all
|
|
||||||
EXCLUDE_FILES=(
|
|
||||||
'.SRCINFO'
|
|
||||||
'.git'
|
|
||||||
)
|
|
||||||
|
|
||||||
# This section does actual jobs
|
|
||||||
newPkgVer() {
|
|
||||||
# do not print anything to stdout other than new pkgver here
|
|
||||||
|
|
||||||
ver=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=${PKGNAME}"| \
|
|
||||||
python3 -c 'import json; j=json.loads(input()); print(j.get("results", [dict()])[0].get("Version", 0))')
|
|
||||||
if [[ "$ver" == "$VER" ]]; then
|
|
||||||
echo "${PKGNAME} is up to date with aur." >&2
|
|
||||||
else
|
|
||||||
echo "${PKGNAME} has new ver form aur: ${ver}" >&2
|
|
||||||
echo "$ver"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
newpkgver=$(newPkgVer)
|
|
||||||
[ -z "$newpkgver" ] && exit 0
|
|
||||||
|
|
||||||
incfiles=''
|
|
||||||
for f in "${INCLUDE_FILES[@]}"; do
|
|
||||||
incfiles="$incfiles"$'\n'"$f"
|
|
||||||
done
|
|
||||||
|
|
||||||
excfiles='{'
|
|
||||||
for f in "${EXCLUDE_FILES[@]}"; do
|
|
||||||
excfiles="${excfiles}${f},"
|
|
||||||
done
|
|
||||||
excfiles="${excfiles}}"
|
|
||||||
[[ "$excfiles" == '{}' ]] && excfiles=''
|
|
||||||
|
|
||||||
pushd "$UPDATE_DIR" >/dev/null
|
|
||||||
rm -rf "$PKGNAME"
|
|
||||||
git clone --depth 1 "https://aur.archlinux.org/${PKGNAME}.git" "$PKGNAME"
|
|
||||||
|
|
||||||
cd "$PKGNAME" && prepare
|
|
||||||
for patch in "${PATCHES[@]}"; do
|
|
||||||
git apply "../${patch}"
|
|
||||||
done
|
|
||||||
|
|
||||||
add_files=$(eval ls -1 --almost-all --ignore=${excfiles})
|
|
||||||
add_files="${add_files}"$'\n'"${incfiles}"
|
|
||||||
|
|
||||||
while read f; do
|
|
||||||
[[ -z "$f" ]] && continue
|
|
||||||
cp -av "$f" ../../
|
|
||||||
(cd ../../ && git add "$f")
|
|
||||||
done <<< "$add_files"
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
rm -rf "$PKGNAME"
|
|
||||||
popd >/dev/null
|
|
||||||
|
|
||||||
git commit -m "autoupdate: ${PKGNAME} to ${newpkgver} from aur"
|
|
||||||
git push
|
|
1
yay/buildbot.update.d/update.sh
Symbolic link
1
yay/buildbot.update.d/update.sh
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../.buildbot/aur.hook.d/update.sh
|
Loading…
Reference in a new issue