systeminfo: log system package versions (#11946)
This commit is contained in:
parent
73f06434a4
commit
02cda6bebf
4 changed files with 60 additions and 5 deletions
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue