1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl xmlstarlet nix coreutils
set -euxo pipefail
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
cd $SCRIPTPATH
function update_savannah_branch() {
branch=$1
echo emacs $branch
# Get relevant data (commit id and timestamp) for the latest commit
commit_data=$(curl "https://git.savannah.gnu.org/cgit/emacs.git/atom/?h=$branch" | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v "concat(atom:id,'/',atom:updated)" -n | head -n 1)
# Extract commit sha and build a version number based on date: YYYYMMDD.0
commit_sha=$(echo $commit_data | cut -d '/' -f 1)
version_number=$(echo $commit_data | cut -d '/' -f 2 | cut -d 'T' -f 1 | sed 's/-//g').0
output_branch=$(echo $branch | sed s/"\/"/"_"/)
digest=$(nix-prefetch-url --unpack "https://git.savannah.gnu.org/cgit/emacs.git/snapshot/emacs-${commit_sha}.tar.gz")
echo "{\"type\": \"savannah\", \"repo\": \"emacs\", \"rev\": \"${commit_sha}\", \"sha256\": \"${digest}\", \"version\": \"${version_number}\"}" > emacs-$output_branch.json
}
function update_github_repo() {
owner=$1
repo=$2
branch=$3
echo $repo $branch
# Get relevant data (commit id and timestamp) for the latest commit
commit_data=$(curl "https://github.com/$owner/$repo/commits/$branch.atom" | xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v "concat(atom:id,'/',atom:updated)" -n | head -n 1)
# Extract commit sha and build a version number based on date: YYYYMMDD.0
commit_sha=$(echo $commit_data | cut -d '/' -f 2)
version_number=$(echo $commit_data | cut -d '/' -f 3 | cut -d 'T' -f 1 | sed 's/-//g').0
output_branch=$(echo $branch | sed s/"\/"/"_"/)
digest=$(nix-prefetch-url --unpack "https://github.com/$owner/$repo/archive/${commit_sha}.tar.gz")
echo "{\"type\": \"github\", \"owner\": \"${owner}\", \"repo\": \"${repo}\", \"rev\": \"${commit_sha}\", \"sha256\": \"${digest}\", \"version\": \"${version_number}\"}" > $repo-$output_branch.json
}
function update_release() {
echo emacs release
git clone --shallow-since="$(date --date='-6 month')" https://git.savannah.gnu.org/git/emacs.git emacs_git_repo
tag=$(git -C emacs_git_repo tag -l --sort=-v:refname 'emacs-[1-9]*' | head -n1)
rm -rf emacs_git_repo
digest=$(nix-prefetch-url --unpack "https://git.savannah.gnu.org/cgit/emacs.git/snapshot/emacs-${tag}.tar.gz")
version_number=$(echo $tag | cut -d '-' -f 2)
echo "{\"type\": \"savannah\", \"repo\": \"emacs\", \"rev\": \"${tag}\", \"sha256\": \"${digest}\", \"version\": \"${version_number}\"}" > emacs-unstable.json
}
update_savannah_branch master
update_savannah_branch feature/native-comp
update_savannah_branch feature/pgtk
update_github_repo flatwhatson emacs pgtk-nativecomp
update_release
nix-build --no-out-link --show-trace ./test.nix
|