summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2025-10-06 23:20:21 +0200
committerGitHub <noreply@github.com>2025-10-06 23:20:21 +0200
commit02cda6bebf327e85c8b238961ce0514a66b92709 (patch)
tree305e7c95863c4e91e67546857be07f895d9b3252 /src
parent73f06434a43c75b3a81e31a6ed7586a14a9c7a48 (diff)
systeminfo: log system package versions (#11946)
Diffstat (limited to 'src')
-rw-r--r--src/debug/CrashReporter.cpp4
-rw-r--r--src/debug/HyprCtl.cpp21
-rw-r--r--src/helpers/MiscFunctions.cpp38
-rw-r--r--src/helpers/MiscFunctions.hpp2
4 files changed, 60 insertions, 5 deletions
diff --git a/src/debug/CrashReporter.cpp b/src/debug/CrashReporter.cpp
index f52062be..17c4ebf7 100644
--- a/src/debug/CrashReporter.cpp
+++ b/src/debug/CrashReporter.cpp
@@ -165,6 +165,10 @@ void NCrashReporter::createAndSaveCrash(int sig) {
finalCrashReport += "\n\nos-release:\n";
finalCrashReport.writeCmdOutput("cat /etc/os-release | sed 's/^/\t/'");
+ finalCrashReport += '\n';
+ finalCrashReport += getBuiltSystemLibraryNames();
+ finalCrashReport += '\n';
+
// dladdr1()/backtrace_symbols()/this entire section allocates, and hence is NOT async-signal-safe.
// Make sure that we save the current known crash report information,
// so that if we are caught in a deadlock during a call to malloc(),
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 0c34c375..116ddac9 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -1044,10 +1044,12 @@ std::string versionRequest(eHyprCtlOutputFormat format, std::string request) {
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
std::string result = std::format("Hyprland {} built from branch {} at commit {} {} ({}).\n"
"Date: {}\n"
- "Tag: {}, commits: {}\n"
- "built against:\n aquamarine {}\n hyprlang {}\n hyprutils {}\n hyprcursor {}\n hyprgraphics {}\n\n\n",
- HYPRLAND_VERSION, GIT_BRANCH, GIT_COMMIT_HASH, GIT_DIRTY, commitMsg, GIT_COMMIT_DATE, GIT_TAG, GIT_COMMITS, AQUAMARINE_VERSION,
- HYPRLANG_VERSION, HYPRUTILS_VERSION, HYPRCURSOR_VERSION, HYPRGRAPHICS_VERSION);
+ "Tag: {}, commits: {}\n",
+ HYPRLAND_VERSION, GIT_BRANCH, GIT_COMMIT_HASH, GIT_DIRTY, commitMsg, GIT_COMMIT_DATE, GIT_TAG, GIT_COMMITS);
+
+ result += "\n";
+ result += getBuiltSystemLibraryNames();
+ result += "\n";
#if (!ISDEBUG && !defined(NO_XWAYLAND))
result += "no flags were set\n";
@@ -1077,9 +1079,15 @@ std::string versionRequest(eHyprCtlOutputFormat format, std::string request) {
"buildHyprutils": "{}",
"buildHyprcursor": "{}",
"buildHyprgraphics": "{}",
+ "systemAquamarine": "{}",
+ "systemHyprlang": "{}",
+ "systemHyprutils": "{}",
+ "systemHyprcursor": "{}",
+ "systemHyprgraphics": "{}",
"flags": [)#",
GIT_BRANCH, GIT_COMMIT_HASH, HYPRLAND_VERSION, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), escapeJSONStrings(commitMsg), GIT_COMMIT_DATE, GIT_TAG,
- GIT_COMMITS, AQUAMARINE_VERSION, HYPRLANG_VERSION, HYPRUTILS_VERSION, HYPRCURSOR_VERSION, HYPRGRAPHICS_VERSION);
+ GIT_COMMITS, AQUAMARINE_VERSION, HYPRLANG_VERSION, HYPRUTILS_VERSION, HYPRCURSOR_VERSION, HYPRGRAPHICS_VERSION, getSystemLibraryVersion("aquamarine"),
+ getSystemLibraryVersion("hyprlang"), getSystemLibraryVersion("hyprutils"), getSystemLibraryVersion("hyprcursor"), getSystemLibraryVersion("hyprgraphics"));
#if ISDEBUG
result += "\"debug\",";
@@ -1122,6 +1130,9 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
result += "Node name: " + std::string{unameInfo.nodename} + "\n";
result += "Release: " + std::string{unameInfo.release} + "\n";
result += "Version: " + std::string{unameInfo.version} + "\n";
+ result += "\n";
+ result += getBuiltSystemLibraryNames();
+ result += "\n";
result += "\n\n";
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 2b6160c7..50a89622 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -929,3 +929,41 @@ std::string deviceNameToInternalString(std::string in) {
std::ranges::transform(in, in.begin(), ::tolower);
return in;
}
+
+static const std::vector<const char*> PKGCONF_PATHS = {"/usr/lib/pkgconfig", "/usr/local/lib/pkgconfig"};
+
+//
+std::string getSystemLibraryVersion(const std::string& name) {
+ for (const auto& pkgconf : PKGCONF_PATHS) {
+ std::error_code ec;
+ const std::string PATH = std::string{pkgconf} + "/" + name + ".pc";
+ if (!std::filesystem::exists(PATH, ec))
+ continue;
+
+ const auto DATA = NFsUtils::readFileAsString(PATH);
+
+ if (!DATA)
+ continue;
+
+ size_t versionAt = DATA->find("\nVersion: ");
+ size_t versionAtEnd = DATA->find("\n", versionAt + 11);
+
+ if (versionAt == std::string::npos)
+ continue;
+
+ versionAt += 10;
+
+ return DATA->substr(versionAt, versionAtEnd == std::string::npos ? std::string::npos : versionAtEnd - versionAt);
+ }
+ return "unknown";
+}
+
+std::string getBuiltSystemLibraryNames() {
+ std::string result = "Libraries:\n";
+ result += std::format("Hyprgraphics: built against {}, system has {}\n", HYPRGRAPHICS_VERSION, getSystemLibraryVersion("hyprgraphics"));
+ result += std::format("Hyprutils: built against {}, system has {}\n", HYPRUTILS_VERSION, getSystemLibraryVersion("hyprutils"));
+ result += std::format("Hyprcursor: built against {}, system has {}\n", HYPRCURSOR_VERSION, getSystemLibraryVersion("hyprcursor"));
+ result += std::format("Hyprlang: built against {}, system has {}\n", HYPRLANG_VERSION, getSystemLibraryVersion("hyprlang"));
+ result += std::format("Aquamarine: built against {}, system has {}\n", AQUAMARINE_VERSION, getSystemLibraryVersion("aquamarine"));
+ return result;
+}
diff --git a/src/helpers/MiscFunctions.hpp b/src/helpers/MiscFunctions.hpp
index 8e507b6b..d045e826 100644
--- a/src/helpers/MiscFunctions.hpp
+++ b/src/helpers/MiscFunctions.hpp
@@ -43,6 +43,8 @@ bool isNvidiaDriverVersionAtLeast(int thresho
std::expected<std::string, std::string> binaryNameForWlClient(wl_client* client);
std::expected<std::string, std::string> binaryNameForPid(pid_t pid);
std::string deviceNameToInternalString(std::string in);
+std::string getSystemLibraryVersion(const std::string& name);
+std::string getBuiltSystemLibraryNames();
template <typename... Args>
[[deprecated("use std::format instead")]] std::string getFormat(std::format_string<Args...> fmt, Args&&... args) {