mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:05:59 +01:00
hyprctl: add commit date to "hyprctl version" (#4171)
* add commit date to "hyprctl version" modified: scripts/generateVersion.sh modified: src/debug/HyprCtl.cpp modified: src/version.h.in * Nix: add date to hyprctl --------- Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
This commit is contained in:
parent
9ca0c7d814
commit
2a777cb71b
5 changed files with 16 additions and 8 deletions
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
fetchurl,
|
|
||||||
stdenv,
|
stdenv,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
|
@ -35,6 +34,7 @@
|
||||||
wrapRuntimeDeps ? true,
|
wrapRuntimeDeps ? true,
|
||||||
version ? "git",
|
version ? "git",
|
||||||
commit,
|
commit,
|
||||||
|
date,
|
||||||
# deprecated flags
|
# deprecated flags
|
||||||
enableNvidiaPatches ? false,
|
enableNvidiaPatches ? false,
|
||||||
nvidiaPatches ? false,
|
nvidiaPatches ? false,
|
||||||
|
@ -119,6 +119,7 @@ assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been remov
|
||||||
--replace "@HASH@" '${commit}' \
|
--replace "@HASH@" '${commit}' \
|
||||||
--replace "@BRANCH@" "" \
|
--replace "@BRANCH@" "" \
|
||||||
--replace "@MESSAGE@" "" \
|
--replace "@MESSAGE@" "" \
|
||||||
|
--replace "@DATE@" "${date}" \
|
||||||
--replace "@TAG@" "" \
|
--replace "@TAG@" "" \
|
||||||
--replace "@DIRTY@" '${
|
--replace "@DIRTY@" '${
|
||||||
if commit == ""
|
if commit == ""
|
||||||
|
|
|
@ -28,17 +28,20 @@ in {
|
||||||
self.overlays.wlroots-hyprland
|
self.overlays.wlroots-hyprland
|
||||||
self.overlays.udis86
|
self.overlays.udis86
|
||||||
# Hyprland packages themselves
|
# Hyprland packages themselves
|
||||||
(final: prev: {
|
(final: prev: let
|
||||||
|
date = mkDate (self.lastModifiedDate or "19700101");
|
||||||
|
in {
|
||||||
hyprland = final.callPackage ./default.nix {
|
hyprland = final.callPackage ./default.nix {
|
||||||
stdenv = final.gcc13Stdenv;
|
stdenv = final.gcc13Stdenv;
|
||||||
version = "${props.version}+date=${mkDate (self.lastModifiedDate or "19700101")}_${self.shortRev or "dirty"}";
|
version = "${props.version}+date=${date}_${self.shortRev or "dirty"}";
|
||||||
wlroots = final.wlroots-hyprland;
|
wlroots = final.wlroots-hyprland;
|
||||||
commit = self.rev or "";
|
commit = self.rev or "";
|
||||||
inherit (final) udis86 hyprland-protocols;
|
inherit (final) udis86 hyprland-protocols;
|
||||||
|
inherit date;
|
||||||
};
|
};
|
||||||
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
||||||
hyprland-debug = final.hyprland.override {debug = true;};
|
hyprland-debug = final.hyprland.override {debug = true;};
|
||||||
hyprland-legacy-renderer = final.hyprland.override { legacyRenderer = true; };
|
hyprland-legacy-renderer = final.hyprland.override {legacyRenderer = true;};
|
||||||
hyprland-nvidia =
|
hyprland-nvidia =
|
||||||
builtins.trace ''
|
builtins.trace ''
|
||||||
hyprland-nvidia was removed. Please use the hyprland package.
|
hyprland-nvidia was removed. Please use the hyprland package.
|
||||||
|
|
|
@ -4,11 +4,13 @@ cp -fr ./src/version.h.in ./src/version.h
|
||||||
HASH=$(git rev-parse HEAD)
|
HASH=$(git rev-parse HEAD)
|
||||||
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
MESSAGE=$(git show ${GIT_COMMIT_HASH} | head -n 5 | tail -n 1 | sed -e 's/#//g' -e 's/\"//g')
|
MESSAGE=$(git show ${GIT_COMMIT_HASH} | head -n 5 | tail -n 1 | sed -e 's/#//g' -e 's/\"//g')
|
||||||
|
DATE=$(git show ${GIT_COMMIT_HASH} --no-patch --format=%cd --date=local)
|
||||||
DIRTY=$(git diff-index --quiet HEAD -- || echo dirty)
|
DIRTY=$(git diff-index --quiet HEAD -- || echo dirty)
|
||||||
TAG=$(git describe --tags)
|
TAG=$(git describe --tags)
|
||||||
|
|
||||||
sed -i -e "s#@HASH@#${HASH}#" ./src/version.h
|
sed -i -e "s#@HASH@#${HASH}#" ./src/version.h
|
||||||
sed -i -e "s#@BRANCH@#${BRANCH}#" ./src/version.h
|
sed -i -e "s#@BRANCH@#${BRANCH}#" ./src/version.h
|
||||||
sed -i -e "s#@MESSAGE@#${MESSAGE}#" ./src/version.h
|
sed -i -e "s#@MESSAGE@#${MESSAGE}#" ./src/version.h
|
||||||
|
sed -i -e "s#@DATE@#${DATE}#" ./src/version.h
|
||||||
sed -i -e "s#@DIRTY@#${DIRTY}#" ./src/version.h
|
sed -i -e "s#@DIRTY@#${DIRTY}#" ./src/version.h
|
||||||
sed -i -e "s#@TAG@#${TAG}#" ./src/version.h
|
sed -i -e "s#@TAG@#${TAG}#" ./src/version.h
|
||||||
|
|
|
@ -748,7 +748,7 @@ std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
||||||
|
|
||||||
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " " + GIT_DIRTY + " (" + commitMsg +
|
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " " + GIT_DIRTY + " (" + commitMsg +
|
||||||
").\nTag: " + GIT_TAG + "\n\nflags: (if any)\n";
|
").\nDate: " + GIT_COMMIT_DATE + "\nTag: " + GIT_TAG + "\n\nflags: (if any)\n";
|
||||||
|
|
||||||
#ifdef LEGACY_RENDERER
|
#ifdef LEGACY_RENDERER
|
||||||
result += "legacyrenderer\n";
|
result += "legacyrenderer\n";
|
||||||
|
@ -771,9 +771,10 @@ std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
|
||||||
"commit": "{}",
|
"commit": "{}",
|
||||||
"dirty": {},
|
"dirty": {},
|
||||||
"commit_message": "{}",
|
"commit_message": "{}",
|
||||||
|
"commit_date": "{}",
|
||||||
"tag": "{}",
|
"tag": "{}",
|
||||||
"flags": [)#",
|
"flags": [)#",
|
||||||
GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), escapeJSONStrings(commitMsg), GIT_TAG);
|
GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), escapeJSONStrings(commitMsg), GIT_COMMIT_DATE, GIT_TAG);
|
||||||
|
|
||||||
#ifdef LEGACY_RENDERER
|
#ifdef LEGACY_RENDERER
|
||||||
result += "\"legacyrenderer\",";
|
result += "\"legacyrenderer\",";
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
#define GIT_COMMIT_HASH "@HASH@"
|
#define GIT_COMMIT_HASH "@HASH@"
|
||||||
#define GIT_BRANCH "@BRANCH@"
|
#define GIT_BRANCH "@BRANCH@"
|
||||||
#define GIT_COMMIT_MESSAGE "@MESSAGE@"
|
#define GIT_COMMIT_MESSAGE "@MESSAGE@"
|
||||||
|
#define GIT_COMMIT_DATE "@DATE@"
|
||||||
#define GIT_DIRTY "@DIRTY@"
|
#define GIT_DIRTY "@DIRTY@"
|
||||||
#define GIT_TAG "@TAG@"
|
#define GIT_TAG "@TAG@"
|
||||||
|
|
Loading…
Reference in a new issue