Packages (Linux): add install-release package count support (#2342)

* feat: add install-release package count support

* Apply suggestion from @codacy-production[bot]

Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>

* Fix formatting of ffParsePropFileValues call

---------

Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>
This commit is contained in:
Jess
2026-06-22 02:23:21 -03:00
committed by GitHub
parent 61968ca95c
commit d8be61411e
4 changed files with 26 additions and 0 deletions
+1
View File
@@ -22,6 +22,7 @@ typedef struct FFPackagesResult {
uint32_t guixUser;
uint32_t hpkgSystem;
uint32_t hpkgUser;
uint32_t installrelease;
uint32_t kiss;
uint32_t linglong;
uint32_t lpkg;
+15
View File
@@ -676,4 +676,19 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
result->appimage += getNumElementsBySuffix(&baseDir, "/AppImages", ".appimage");
result->appimage += getNumElementsBySuffix(&baseDir, "/Applications", ".appimage");
}
if (!(options->disabled & FF_PACKAGES_FLAG_INSTALLRELEASE_BIT)) {
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateCopy(&baseDir);
ffStrbufAppendS(&path, ".config/install_release/state.json");
if (ffPathExists(path.chars, FF_PATHTYPE_FILE)) {
yyjson_doc* doc = yyjson_read_file(path.chars, YYJSON_READ_NOFLAG, NULL, NULL);
if (doc != NULL) {
yyjson_val* root = yyjson_doc_get_root(doc);
if (yyjson_is_obj(root)) {
result->installrelease = (uint32_t) yyjson_obj_size(root);
}
yyjson_doc_free(doc);
}
}
}
}