2023-10-12 09:15:14 +00:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
|
|
|
# You need these packages to run this script: git tar xz curl-minimal
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# This is important for systems that have a different local but want to produce
|
2024-05-22 07:53:23 +00:00
|
|
|
# a valid changelog date.
|
2023-10-12 09:15:14 +00:00
|
|
|
LANG=en_EN
|
|
|
|
|
|
|
|
function loginfo() {
|
|
|
|
local msg=$1
|
|
|
|
>&2 echo "[INFO]" $msg
|
|
|
|
}
|
|
|
|
|
|
|
|
loginfo "Determine date in YYYYMMDD form"
|
|
|
|
llvm_snapshot_yyyymmdd=$(date +%Y%m%d)
|
|
|
|
[[ ! -z "${YYYYMMDD}" ]] && llvm_snapshot_yyyymmdd=$YYYYMMDD
|
|
|
|
|
2024-05-15 11:24:57 +00:00
|
|
|
git_revision_url=https://github.com/fedora-llvm-team/llvm-snapshots/releases/download/snapshot-version-sync/llvm-git-revision-${llvm_snapshot_yyyymmdd}.txt
|
|
|
|
loginfo "Get the revision for today from $git_revision_url"
|
|
|
|
llvm_snapshot_git_revision=$(curl -sL $git_revision_url)
|
2023-10-12 09:15:14 +00:00
|
|
|
llvm_snapshot_git_revision_short=$(echo "${llvm_snapshot_git_revision:0:14}")
|
|
|
|
|
2024-05-15 11:24:57 +00:00
|
|
|
release_url=https://github.com/fedora-llvm-team/llvm-snapshots/releases/download/snapshot-version-sync/llvm-release-${llvm_snapshot_yyyymmdd}.txt
|
|
|
|
loginfo "Get the release for today from $release_url"
|
|
|
|
llvm_snapshot_version=$(curl -sL $release_url)
|
2023-10-12 09:15:14 +00:00
|
|
|
llvm_snapshot_version_major=$(echo $llvm_snapshot_version | cut -f1 -d.)
|
|
|
|
llvm_snapshot_version_minor=$(echo $llvm_snapshot_version | cut -f2 -d.)
|
|
|
|
llvm_snapshot_version_patch=$(echo $llvm_snapshot_version | cut -f3 -d.)
|
|
|
|
llvm_snapshot_version_suffix=pre${llvm_snapshot_yyyymmdd}.g${llvm_snapshot_git_revision_short}
|
|
|
|
|
|
|
|
tempfile=$(mktemp)
|
|
|
|
cat > $tempfile <<EOF
|
|
|
|
%global maj_ver ${llvm_snapshot_version_major}
|
|
|
|
%global min_ver ${llvm_snapshot_version_minor}
|
|
|
|
%global patch_ver ${llvm_snapshot_version_patch}
|
|
|
|
%undefine rc_ver
|
|
|
|
|
|
|
|
%global llvm_snapshot_version ${llvm_snapshot_version}
|
|
|
|
%global llvm_snapshot_version_major ${llvm_snapshot_version_major}
|
|
|
|
%global llvm_snapshot_version_minor ${llvm_snapshot_version_minor}
|
|
|
|
%global llvm_snapshot_version_patch ${llvm_snapshot_version_patch}
|
|
|
|
%global llvm_snapshot_yyyymmdd ${llvm_snapshot_yyyymmdd}
|
|
|
|
%global llvm_snapshot_git_revision ${llvm_snapshot_git_revision}
|
|
|
|
%global llvm_snapshot_git_revision_short ${llvm_snapshot_git_revision_short}
|
|
|
|
%global llvm_snapshot_version_suffix ${llvm_snapshot_version_suffix}
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# One for logs
|
|
|
|
cat $tempfile >&2
|
|
|
|
|
|
|
|
# One to redirect it away
|
|
|
|
cat $tempfile
|