Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/detection/packages/packages.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 16 additions & 1 deletion src/detection/packages/packages_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ static uint32_t getPacmanPackages(FFstrbuf* baseDir) {
uint32_t baseDirLen = baseDir->length;
ffStrbufAppendS(baseDir, "/etc/pacman.conf");

bool confFound = ffParsePropFileValues(baseDir->chars, 2, (FFpropquery[]) {
bool confFound = ffParsePropFileValues(baseDir->chars, 2, (FFpropquery[]){
{ "DBPath =", &dbPath },
{ "RootDir =", &rootDir },
});
Expand Down Expand Up @@ -648,4 +648,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);
}
}
}
}
1 change: 1 addition & 0 deletions src/modules/packages/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ typedef enum FF_A_PACKED FFPackagesFlags {
FF_PACKAGES_FLAG_MOSS_BIT = 1ULL << 32,
FF_PACKAGES_FLAG_APPIMAGE_BIT = 1ULL << 33,
FF_PACKAGES_FLAG_CARDS_BIT = 1ULL << 34,
FF_PACKAGES_FLAG_INSTALLRELEASE_BIT = 1ULL << 35,
FF_PACKAGES_FLAG_FORCE_UNSIGNED = UINT64_MAX,
} FFPackagesFlags;
static_assert(sizeof(FFPackagesFlags) == sizeof(uint64_t), "");
Expand Down
9 changes: 9 additions & 0 deletions src/modules/packages/packages.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ bool ffPrintPackages(FFPackagesOptions* options) {
} else {
FF_PRINT_PACKAGE_NAME(hpkgSystem, "hpkg")
}
FF_PRINT_PACKAGE_NAME(installrelease, "install-release")
FF_PRINT_PACKAGE(kiss)
FF_PRINT_PACKAGE(linglong)
FF_PRINT_PACKAGE(lpkg)
Expand Down Expand Up @@ -167,6 +168,7 @@ bool ffPrintPackages(FFPackagesOptions* options) {
FF_ARG(hpkgAll, "hpkg-all"),
FF_ARG(counts.hpkgSystem, "hpkg-system"),
FF_ARG(counts.hpkgUser, "hpkg-user"),
FF_ARG(counts.installrelease, "install-release"),
FF_ARG(counts.kiss, "kiss"),
FF_ARG(counts.linglong, "linglong"),
FF_ARG(counts.lpkg, "lpkg"),
Expand Down Expand Up @@ -278,6 +280,11 @@ void ffParsePackagesJsonObject(FFPackagesOptions* options, yyjson_val* module) {
;
FF_TEST_PACKAGE_NAME(HPKG)
break;
case 'I':
if (false)
;
FF_TEST_PACKAGE_NAME(INSTALLRELEASE)
break;
case 'K':
if (false)
;
Expand Down Expand Up @@ -445,6 +452,7 @@ bool ffGeneratePackagesJsonResult(FF_A_UNUSED FFPackagesOptions* options, yyjson
FF_APPEND_PACKAGE_COUNT(guixUser)
FF_APPEND_PACKAGE_COUNT(hpkgSystem)
FF_APPEND_PACKAGE_COUNT(hpkgUser)
FF_APPEND_PACKAGE_COUNT(installrelease)
FF_APPEND_PACKAGE_COUNT(kiss)
FF_APPEND_PACKAGE_COUNT(linglong)
FF_APPEND_PACKAGE_COUNT(lpkg)
Expand Down Expand Up @@ -522,6 +530,7 @@ FFModuleBaseInfo ffPackagesModuleInfo = {
{ "Total number of all hpkg packages", "hpkg-all" },
{ "Number of hpkg-system packages", "hpkg-system" },
{ "Number of hpkg-user packages", "hpkg-user" },
{ "Number of install-release packages", "install-release"},
{ "Number of kiss packages", "kiss" },
{ "Number of linglong packages", "linglong" },
{ "Number of lpkg packages", "lpkg" },
Expand Down