mirror of
https://abf.rosa.ru/djam/glibc40.git
synced 2025-02-23 15:52:52 +00:00

glibc's upstream has git branches where important fixes are backported. Let's use them instead of applying most of commits as patches. Automate updates by script upd.sh. Deleted strange patches without propper description. glibc is a core component where we should avoid not properly audited and/or tested code. Removed all Clear Linux patches, removed patches "from Fedora" which do not exist in fc37 and current rawhide. We do not need to build glibc with clang, drop clang-related patches.
52 lines
1.7 KiB
Bash
Executable file
52 lines
1.7 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -efu
|
|
set -o pipefail
|
|
|
|
# get current commit (version)
|
|
old_commit="$(grep '^%define commit ' glibc.spec | awk '{print $NF}')"
|
|
[ -n "$old_commit" ]
|
|
# or: rpmspec --define "_sourcedir $PWD" -q --srpm --qf '%{version}' glibc.spec
|
|
version="$(grep '^Version:' glibc.spec | awk '{print $NF}')"
|
|
[ -n "$version" ]
|
|
|
|
# get latest available commit (version)
|
|
new_commit="$(git ls-remote git://sourceware.org/git/glibc.git release/2.36/master | awk '{print $1}')"
|
|
[ -n "$new_commit" ]
|
|
if [ "$old_commit" = "$new_commit" ]; then
|
|
echo "There are no updates"
|
|
fi
|
|
|
|
tmp="$(mktemp -d)"
|
|
trap 'rm -fr "$tmp"' EXIT
|
|
|
|
# download the latest version
|
|
git clone --depth=1 https://sourceware.org/git/glibc.git -b release/"$version"/master "$tmp"/glibc-"$new_commit"
|
|
if [ "$(cd "$tmp"/glibc-"$new_commit" && git rev-parse HEAD)" != "$new_commit" ]; then
|
|
echo "Repository has probably changed in the middle, rerun this script"
|
|
exit 1
|
|
fi
|
|
|
|
# pack it
|
|
XZ_OPT="-6 --threads=0 -v" tar cJf glibc-"$new_commit".tar.xz -C "$tmp" glibc-"$new_commit"
|
|
|
|
# Bump RPM release
|
|
# 3.git%{commit_short}.1 -> 4.git%{commit_short}.1
|
|
# 3.git%{commit_short}.2 -> 4.git%{commit_short}.1
|
|
old_release="$(grep '^Release:' glibc.spec | awk '{print $NF}')"
|
|
[ -n "$old_release" ]
|
|
IFS=. read -r -a release <<< "$old_release"
|
|
# increase first number
|
|
num1=$((${release[0]}+1))
|
|
# decrease last number to 1
|
|
num2=1
|
|
new_release="${num1}.${release[1]}.${num2}"
|
|
sed -i'' -E glibc.spec \
|
|
-e "s,^%define commit .+,%define commit ${new_commit}," \
|
|
-e "s,^Release:.+,Release:\t${new_release},"
|
|
sed -i'' .abf.yml -e "/glibc-${old_release}.tar.xz/d"
|
|
# upload glibc-$new_commit.tar.xz to file-store.rosalinux.ru
|
|
abf put -n
|
|
PAGER= GIT_PAGER= git diff
|
|
# copypastable commit message
|
|
echo "upd to snapshot $(echo "$new_commit" | head -c5) of v$version"
|