Skip to content

Commit

Permalink
fix(update): better commit versioning (#944)
Browse files Browse the repository at this point in the history
  • Loading branch information
madonuko authored Feb 19, 2024
1 parent 7c12f7e commit 00622be
Show file tree
Hide file tree
Showing 31 changed files with 118 additions and 91 deletions.
3 changes: 2 additions & 1 deletion anda/apps/mpv/mpv-nightly.spec
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
%global commit 443c2487d7dd1039e297abad6398135b3c463018
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commit_date 240218
%global ver 0.37.0

Name: mpv-nightly
Version: %ver^%shortcommit
Version: %ver^%commit_date.%shortcommit
Release: 1%{?dist}

License: GPL-2.0-or-later AND LGPL-2.1-or-later
Expand Down
10 changes: 6 additions & 4 deletions anda/apps/mpv/update.rhai
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
if filters.contains("nightly") {
let o = req("https://api.github.com/repos/mpv-player/mpv/commits/HEAD").json();
rpm.global("commit", o.sha);
rpm.global("ver", gh("mpv-player/mpv"));
rpm.release();
rpm.global("commit", gh_commit("mpv-player/mpv"));
if rpm.changed() {
rpm.global("ver", gh("mpv-player/mpv"));
rpm.global("commit_date", date());
rpm.release();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
%global plug_rdnn io.elementary.switchboard.wallet

%global commit 50582fc7ee43a4b47647d04786dcf1d0eb45af36
%global commit_date 240218

Name: switchboard-plug-wallet
Summary: Switchboard Wallet Plug
Version: %(c=%commit; echo ${c:0:7})
Version: %commit_date.%(c=%commit; echo ${c:0:7})
Release: 2%?dist
License: GPL-3.0-or-later

Expand Down
7 changes: 4 additions & 3 deletions anda/desktops/elementary/switchboard-plug-wallet/update.rhai
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
let req = new_req("https://api.github.com/repos/elementary/switchboard-plug-wallet/commits/HEAD");
req.head("Authorization", `Bearer ${env("GITHUB_TOKEN")}`);
rpm.global("commit", json(req.get()).sha);
rpm.global("commit", gh_commit("elementary/switchboard-plug-wallet"));
if rpm.changed() {
rpm.global("commit_date", date());
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
%global uuid %{extension}@system76.com
%global commit 9a30c5bd49c373896410852d6477596ac4c43bd3
%global shortcommit %{lua:print(macros.commit:sub(1,7))}
%global commit_date 240218
%global ver 1.2.0

Name: terra-gnome-shell-extension-%{extension}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
if filters.contains("nightly") {
rpm.global("commit", get("https://api.github.com/repos/pop-os/shell/commits/HEAD").json().sha);
rpm.global("ver", gh("pop-os/shell"));
rpm.global("commit", gh_commit("pop-os/shell"));
if rpm.changed() {
rpm.global("ver", gh("pop-os/shell"));
rpm.release();
rpm.global("commit_date", date());
}
}
6 changes: 4 additions & 2 deletions anda/desktops/lomiri-unity/lomiri-ui-toolkit/update.rhai
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
rpm.version(get("https://gitlab.com/api/v4/projects/19057685/repository/tags").json_arr()[0].name);
rpm.global("commit", get("https://gitlab.com/api/v4/projects/19057685/repository/commits").json_arr()[0].id);
rpm.version(gitlab_tag("19057685"));
if rpm.changed() {
rpm.global("commit", gitlab_commit("19057685"));
}
6 changes: 4 additions & 2 deletions anda/desktops/lomiri-unity/lomiri-url-dispatcher/update.rhai
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
rpm.version(get("https://gitlab.com/api/v4/projects/17424894/repository/tags").json_arr()[0].name);
rpm.global("commit", get("https://gitlab.com/api/v4/projects/17424894/repository/commits").json_arr()[0].id);
rpm.version(gitlab_tag("17424894"));
if rpm.changed() {
rpm.global("commit", get("https://gitlab.com/api/v4/projects/17424894/repository/commits").json_arr()[0].id);
}
7 changes: 4 additions & 3 deletions anda/desktops/lomiri-unity/lomiri/update.rhai
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
let o = get("https://gitlab.com/api/v4/projects/25716028/repository/tags").json_arr()[0];
rpm.version(o.name);
rpm.global("commit", get("https://gitlab.com/api/v4/projects/25716028/repository/commits").json_arr()[0].id);
rpm.version(gitlab_tag("25716028"));
if rpm.changed() {
rpm.global("commit", get("https://gitlab.com/api/v4/projects/25716028/repository/commits").json_arr()[0].id);
}
17 changes: 8 additions & 9 deletions anda/games/prismlauncher-nightly/update.rhai
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
if filters.contains("nightly") {
let req = new_req("https://api.github.com/repos/PrismLauncher/PrismLauncher/commits/HEAD");
req.head("Authorization", `Bearer ${env("GITHUB_TOKEN")}`);
let sha = req.get().json().sha;
rpm.global("commit", sha);
rpm.release();
let cmake = get("https://raw.githubusercontent.com/PrismLauncher/PrismLauncher/develop/CMakeLists.txt");
let maj = find("set\\(Launcher_VERSION_MAJOR\\s+(\\d+)\\)", cmake, 1);
let min = find("set\\(Launcher_VERSION_MINOR\\s+(\\d+)\\)", cmake, 1);
rpm.version(`${maj}.${min}^%{snapshot_info}`);
rpm.global("commit", gh_commit("PrismLauncher/PrismLauncher"));
if rpm.changed() {
rpm.release();
let cmake = get("https://raw.githubusercontent.com/PrismLauncher/PrismLauncher/develop/CMakeLists.txt");
let maj = find("set\\(Launcher_VERSION_MAJOR\\s+(\\d+)\\)", cmake, 1);
let min = find("set\\(Launcher_VERSION_MINOR\\s+(\\d+)\\)", cmake, 1);
rpm.version(`${maj}.${min}^${date()}.%{snapshot_info}`);
}
}
17 changes: 8 additions & 9 deletions anda/games/prismlauncher-qt5-nightly/update.rhai
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
if filters.contains("nightly") {
let req = new_req("https://api.github.com/repos/PrismLauncher/PrismLauncher/commits/HEAD");
req.head("Authorization", `Bearer ${env("GITHUB_TOKEN")}`);
let sha = req.get().json().sha;
rpm.global("commit", sha);
rpm.release();
let cmake = get("https://raw.githubusercontent.com/PrismLauncher/PrismLauncher/develop/CMakeLists.txt");
let maj = find("set\\(Launcher_VERSION_MAJOR\\s+(\\d+)\\)", cmake, 1);
let min = find("set\\(Launcher_VERSION_MINOR\\s+(\\d+)\\)", cmake, 1);
rpm.version(`${maj}.${min}^%{snapshot_info}`);
rpm.global("commit", gh_commit("PrismLauncher/PrismLauncher"));
if rpm.changed() {
rpm.release();
let cmake = get("https://raw.githubusercontent.com/PrismLauncher/PrismLauncher/develop/CMakeLists.txt");
let maj = find("set\\(Launcher_VERSION_MAJOR\\s+(\\d+)\\)", cmake, 1);
let min = find("set\\(Launcher_VERSION_MINOR\\s+(\\d+)\\)", cmake, 1);
rpm.version(`${maj}.${min}^${date()}.%{snapshot_info}`);
}
}
5 changes: 3 additions & 2 deletions anda/langs/nim/nim-nightly/nim-nightly.spec
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
%global csrc_commit 561b417c65791cd8356b5f73620914ceff845d10
%global commit 92c8c6d5f4e5a96b71bf4eca5f6a136410f97d6e
%global ver 2.1.1
%global commit_date 240219
%global debug_package %nil

Name: nim-nighlty
Version: %ver^%commit
Release: 1%?dist
Version: %ver^%commit_date.%commit
Release: 1%{?dist}
Summary: Imperative, multi-paradigm, compiled programming language
License: MIT and BSD
URL: https://nim-lang.org
Expand Down
21 changes: 11 additions & 10 deletions anda/langs/nim/nim-nightly/update.rhai
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
if filters.contains("nightly") {
let comp = get("https://raw.githubusercontent.com/nim-lang/Nim/devel/lib/system/compilation.nim");
let maj = find("\\n\\s*NimMajor.+=\\s*(\\d+)\\n", comp, 1);
let min = find("\\n\\s*NimMinor.+=\\s*(\\d+)\\n", comp, 1);
let pat = find("\\n\\s*NimPatch.+=\\s*(\\d+)\\n", comp, 1);
let v = `${maj}.${min}.${pat}`;
rpm.global("ver", v);
let req = new_req("https://api.github.com/repos/nim-lang/Nim/commits/HEAD");
req.head("Authorization", `Bearer ${env("GITHUB_TOKEN")}`);
rpm.global("commit", req.get().json().sha);
rpm.release();
rpm.global("commit", gh_commit("nim-lang/Nim"));
if rpm.changed() {
let comp = get("https://raw.githubusercontent.com/nim-lang/Nim/devel/lib/system/compilation.nim");
let maj = find("\\n\\s*NimMajor.+=\\s*(\\d+)\\n", comp, 1);
let min = find("\\n\\s*NimMinor.+=\\s*(\\d+)\\n", comp, 1);
let pat = find("\\n\\s*NimPatch.+=\\s*(\\d+)\\n", comp, 1);
let v = `${maj}.${min}.${pat}`;
rpm.global("ver", v);
rpm.release();
rpm.global("commit_date", date());
}
}
11 changes: 6 additions & 5 deletions anda/langs/vala/vala-language-server-nightly/update.rhai
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
if filters.contains("nightly") {
let req = new_req("https://api.github.com/repos/vala-lang/vala-language-server/commits/HEAD");
req.head("Authorization", `Bearer ${env("GITHUB_TOKEN")}`);
rpm.global("commit", json(req.get()).sha);
rpm.global("verrel", gh("vala-lang/vala-language-server"));
rpm.release();
rpm.global("commit", gh_commit("vala-lang/vala-language-server"));
if rpm.changed() {
rpm.global("commit_date", date());
rpm.global("verrel", gh("vala-lang/vala-language-server"));
rpm.release();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%global commit 3b5fe941bea6ecd5c8fcb84930c40b8582eea165
%global shortcommit %(c=%{commit}; echo ${c:0:7})

%global commit_date %(date '+%Y%m%d')
%global commit_date 240218
%global snapshot_info %{commit_date}.%{shortcommit}
%global verrel 0.48.7

Expand Down
10 changes: 5 additions & 5 deletions anda/langs/vala/vala-lint-nightly/update.rhai
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if filters.contains("nightly") {
let req = new_req("https://api.github.com/repos/vala-lang/vala-lint/commits/HEAD");
req.head("Authorization", `Bearer ${env("GITHUB_TOKEN")}`);
let sha = json(req.get()).sha;
rpm.global("commit", sha);
rpm.release();
rpm.global("commit", gh_commit("vala-lang/vala-lint"));
if rpm.changed() {
rpm.global("commit_date", date());
rpm.release();
}
}
2 changes: 1 addition & 1 deletion anda/langs/vala/vala-lint-nightly/vala-lint-nightly.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%global commit 8ae2bb65fe66458263d94711ae4ddd978faece00
%global shortcommit %(c=%{commit}; echo ${c:0:7})

%global commit_date %(date '+%Y%m%d')
%global commit_date 240218
%global snapshot_info %{commit_date}.%{shortcommit}

Name: vala-lint-nightly
Expand Down
9 changes: 5 additions & 4 deletions anda/langs/vala/vala-nightly/update.rhai
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
if filters.contains("nightly") {
let req = new_req("https://gitlab.gnome.org/api/v4/projects/1551/repository/branches/main");
let sha = json(req.get()).commit.id;
rpm.global("commit", sha);
rpm.release();
rpm.global("commit", gitlab_commit("gitlab.gnome.org", "1551", "main"));
if rpm.changed() {
rpm.global("commit_date", date());
rpm.release();
}
}
2 changes: 1 addition & 1 deletion anda/langs/vala/vala-nightly/vala-nightly.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global repo https://gitlab.gnome.org/GNOME/%{real_name}.git

%global commit_date %(date '+%Y%m%d')
%global commit_date 240218
%global snapshot_info %{commit_date}.%{shortcommit}

Name: vala-nightly
Expand Down
4 changes: 3 additions & 1 deletion anda/lib/deviceinfo/update.rhai
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
let o = get("https://gitlab.com/api/v4/projects/24742019/repository/tags").json_arr()[0];
rpm.global("commit", o.commit.id);
rpm.version(o.name);
if rpm.changed() {
rpm.global("commit", o.commit.id);
}
4 changes: 3 additions & 1 deletion anda/lib/geonames/update.rhai
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
let o = get("https://gitlab.com/api/v4/projects/34230948/repository/tags").json_arr()[0];
rpm.global("commit", o.commit.id);
rpm.version(o.name);
if rpm.changed() {
rpm.global("commit", o.commit.id);
}
2 changes: 1 addition & 1 deletion anda/lib/openh264/update.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rpm.global("commit1", get("https://api.github.com/repos/mozilla/gmp-api/commits/HEAD").json().sha);
rpm.global("commit1", gh_commit("mozilla/gmp-api"));
let h264 = gh("cisco/openh264");
h264.crop(1);
rpm.global("openh264_version", h264);
Expand Down
4 changes: 2 additions & 2 deletions anda/lib/tdlib/tdlib-nightly.spec
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%global commit d0ff90bb19a235d9357f0874b0a62306e40d90b8
%global ver 1.8.25
%global commit_date 240219
Name: tdlib-nightly
Version: %ver^%commit
Version: %ver^%commit_date.%commit
Release: 1%?dist

License: BSL-1.0
URL: https://github.com/tdlib/td
Summary: Cross-platform library for building Telegram clients
Expand Down
13 changes: 6 additions & 7 deletions anda/lib/tdlib/update.rhai
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
if filters.contains("nightly") {
let ghreq = new_req("https://api.github.com/repos/tdlib/td/commits/HEAD");
ghreq.head("Authorization", `Bearer ${env("GITHUB_TOKEN")}`);
rpm.global("commit", json(ghreq.get()).sha);
let req = new_req("https://raw.githubusercontent.com/tdlib/td/master/CMakeLists.txt");
let v = find("\nproject\\(TDLib\\s+VERSION\\s+([\\d.]+)\\s+", req.get(), 1);
rpm.global("ver", v);
rpm.release();
rpm.global("commit", gh_commit("tdlib/td"));
if rpm.changed() {
let v = find("\nproject\\(TDLib\\s+VERSION\\s+([\\d.]+)\\s+", gh_rawfile("tdlib/td", "master", "CMakeLists.txt")), 1);
rpm.global("ver", v);
rpm.release();
}
}
3 changes: 3 additions & 0 deletions anda/misc/arrpc/update.rhai
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
let md = get("https://raw.githubusercontent.com/OpenAsar/arrpc/main/changelog.md");
rpm.version(find("(?m)^## v([\\d.]+)", md, 1));
if rpm.changed() {
rpm.global("commit", gh_commit("OpenAsar/arrpc"));
}
4 changes: 1 addition & 3 deletions anda/misc/click/update.rhai
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
let o = get("https://gitlab.com/api/v4/projects/25034025/repository/tags").json_arr()[0];
let f = rpm.f;
rpm.version(o.name);
// check if changed
if rpm.f != f {
if rpm.changed() {
rpm.global("commit", o.commit.id);
}
5 changes: 3 additions & 2 deletions anda/system/avstplg/avstplg.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
%global commit 7cb289b6466b662fdf9f7d7ccc9f3c08a7dc0cac
%global commit_date 240219
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global debug_package %{nil}
%define __os_install_post %{nil}

Name: avstplg
Version: %shortcommit
Version: %commit_date.%shortcommit
Release: 1%?dist

License: Apache-2.0
Expand Down Expand Up @@ -41,4 +42,4 @@ install -Dm755 avstplg/build/bin/Release/net6.0/avstplg.dll %{buildroot}/%{_libd

%changelog
* Tue Jan 2 2024 infinitebash <[email protected]>
- Initial package.
- Initial package.
11 changes: 6 additions & 5 deletions anda/system/avstplg/update.rhai
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
if filters.contains("nightly") {
let req = new_req("https://api.github.com/repos/thesofproject/avsdk/commits/HEAD");
req.head("Authorization", `Bearer ${env("GITHUB_TOKEN")}`);
rpm.global("commit", json(req.get()).sha);
rpm.release();
}
rpm.global("commit", gh_commit("thesofproject/avsdk"));
if rpm.changed() {
rpm.release();
rpm.global("commit_date", date());
}
}
3 changes: 2 additions & 1 deletion anda/system/nvidia-patch/nvidia-patch.spec
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
%global debug_package %{nil}
%global commit 564c0661a942f7163cb2cfa6cb1b14b4bcff3a30
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commit_date 240218


%global patches %{_datadir}/src/nvidia-patch
Name: nvidia-patch
Version: 0^%{shortcommit}
Version: 0^%commit_date.%{shortcommit}
Release: 1%{?dist}
Summary: NVENC and NvFBC patches for NVIDIA drivers

Expand Down
7 changes: 5 additions & 2 deletions anda/system/nvidia-patch/update.rhai
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
if filters.contains("nightly") {
rpm.global("commit", get("https://api.github.com/repos/keylase/nvidia-patch/commits/HEAD").json().sha);
rpm.release();
rpm.global("commit", gh_commit("keylase/nvidia-patch"));
if rpm.changed() {
rpm.global("commit_date", date());
rpm.release();
}
}
2 changes: 1 addition & 1 deletion anda/tools/chromium-ectool/chromium-ectool.spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ install -Dm755 build/host/util/ectool %{buildroot}%{_bindir}/ectool

%changelog
* Tue Jan 2 2024 infinitebash <[email protected]>
- Initial package.
- Initial package.

0 comments on commit 00622be

Please sign in to comment.