Skip to content

Commit

Permalink
Switch to using mirror emacs-mirror/emacs on github
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Carroll Otsuka authored and djgoku committed Jan 23, 2025
1 parent 3e60946 commit c82797d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions repos/emacs/update
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ function update_savannah_branch() {
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 | sed 's/^urn:sha1://')
commit_data=$(curl "https://github.com/emacs-mirror/emacs/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 | sed 's/^tag:github.com,2008:Grit::Commit\///')

# 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
digest=$(nix-prefetch-url --unpack "https://github.com/emacs-mirror/emacs/archive/${commit_sha}.tar.gz")
echo "{\"type\": \"github\", \"owner\": \"emacs-mirror\", \"repo\": \"emacs\", \"rev\": \"${commit_sha}\", \"sha256\": \"${digest}\", \"version\": \"${version_number}\"}" > emacs-$output_branch.json
}

function update_github_repo() {
Expand All @@ -42,17 +42,16 @@ function update_github_repo() {
function update_release() {
echo emacs release

tag=$(git ls-remote --tags --refs --sort=-v:refname https://git.savannah.gnu.org/git/emacs.git 'emacs-[1-9]*' | grep -Eo 'emacs-.*' | grep -v '\-rc' | head -n1)
tag=$(git ls-remote --tags --refs --sort=-v:refname https://github.com/emacs-mirror/emacs.git 'emacs-[1-9]*' | grep -Eo 'emacs-.*' | grep -v '\-rc' | head -n1)

digest=$(nix-prefetch-url --unpack "https://git.savannah.gnu.org/cgit/emacs.git/snapshot/${tag}.tar.gz")
digest=$(nix-prefetch-url --unpack "https://github.com/emacs-mirror/emacs/archive/refs/tags/${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
echo "{\"type\": \"github\", \"owner\": \"emacs-mirror\", \"repo\": \"emacs\", \"rev\": \"${tag}\", \"sha256\": \"${digest}\", \"version\": \"${version_number}\"}" > emacs-unstable.json
}

# https://github.com/nix-community/emacs-overlay/issues/460
# update_savannah_branch master
# update_release
update_savannah_branch master
update_release
update_github_repo emacs-lsp emacs json-rpc lsp
update_github_repo commercial-emacs commercial-emacs master commercial-emacs

Expand Down

0 comments on commit c82797d

Please sign in to comment.