@@ -459,93 +459,93 @@ static uint32_t getPacmanPackages(FFstrbuf* baseDir) {
459459}
460460
461461static void getPackageCounts (FFstrbuf * baseDir , FFPackagesResult * packageCounts , FFPackagesOptions * options ) {
462- if (! (options -> disabled & FF_PACKAGES_FLAG_APK_BIT )) {
462+ if (FF_PACKAGES_IS_ENABLED (options , APK )) {
463463 packageCounts -> apk += getNumStrings (baseDir , "/lib/apk/db/installed" , "C:Q" , "apk" );
464464 }
465- if (! (options -> disabled & FF_PACKAGES_FLAG_DPKG_BIT )) {
465+ if (FF_PACKAGES_IS_ENABLED (options , DPKG )) {
466466 packageCounts -> dpkg += getNumStrings (baseDir , "/var/lib/dpkg/status" , "Status: install ok installed" , "dpkg" );
467467 }
468- if (! (options -> disabled & FF_PACKAGES_FLAG_LPKG_BIT )) {
468+ if (FF_PACKAGES_IS_ENABLED (options , LPKG )) {
469469 packageCounts -> lpkg += getNumStrings (baseDir , "/opt/Loc-OS-LPKG/installed-lpkg/Listinstalled-lpkg.list" , "\n" , "lpkg" );
470470 }
471- if (! (options -> disabled & FF_PACKAGES_FLAG_EMERGE_BIT )) {
471+ if (FF_PACKAGES_IS_ENABLED (options , EMERGE )) {
472472 packageCounts -> emerge += countFilesRecursive (baseDir , "/var/db/pkg" , "SIZE" );
473473 }
474- if (! (options -> disabled & FF_PACKAGES_FLAG_EOPKG_BIT )) {
474+ if (FF_PACKAGES_IS_ENABLED (options , EOPKG )) {
475475 packageCounts -> eopkg += getNumElements (baseDir , "/var/lib/eopkg/package" , true);
476476 }
477- if (! (options -> disabled & FF_PACKAGES_FLAG_FLATPAK_BIT )) {
477+ if (FF_PACKAGES_IS_ENABLED (options , FLATPAK )) {
478478 packageCounts -> flatpakSystem += getFlatpakPackages (baseDir , "/var/lib" );
479479 }
480- if (! (options -> disabled & FF_PACKAGES_FLAG_KISS_BIT )) {
480+ if (FF_PACKAGES_IS_ENABLED (options , KISS )) {
481481 packageCounts -> kiss += getNumElements (baseDir , "/var/db/kiss/installed" , true);
482482 }
483- if (! (options -> disabled & FF_PACKAGES_FLAG_NIX_BIT )) {
483+ if (FF_PACKAGES_IS_ENABLED (options , NIX )) {
484484 packageCounts -> nixDefault += ffPackagesGetNix (baseDir , "/nix/var/nix/profiles/default" );
485485 packageCounts -> nixSystem += ffPackagesGetNix (baseDir , "/run/current-system" );
486486 }
487- if (! (options -> disabled & FF_PACKAGES_FLAG_PACMAN_BIT )) {
487+ if (FF_PACKAGES_IS_ENABLED (options , PACMAN )) {
488488 packageCounts -> pacman += getPacmanPackages (baseDir );
489489 }
490- if (! (options -> disabled & FF_PACKAGES_FLAG_LPKGBUILD_BIT )) {
490+ if (FF_PACKAGES_IS_ENABLED (options , LPKGBUILD )) {
491491 packageCounts -> lpkgbuild += getNumElements (baseDir , "/opt/Loc-OS-LPKG/lpkgbuild/remove" , false);
492492 }
493- if (! (options -> disabled & FF_PACKAGES_FLAG_PKGTOOL_BIT )) {
493+ if (FF_PACKAGES_IS_ENABLED (options , PKGTOOL )) {
494494 packageCounts -> pkgtool += getNumElements (baseDir , "/var/log/packages" , false);
495495 }
496- if (! (options -> disabled & FF_PACKAGES_FLAG_RPM_BIT )) {
496+ if (FF_PACKAGES_IS_ENABLED (options , RPM )) {
497497 // `Sigmd5` is the only table that doesn't contain the virtual `gpg-pubkey` package
498498 packageCounts -> rpm += getSQLite3Int (baseDir , "/var/lib/rpm/rpmdb.sqlite" , "SELECT count(*) FROM Sigmd5" , "rpm" );
499499 }
500- if (! (options -> disabled & FF_PACKAGES_FLAG_SNAP_BIT )) {
500+ if (FF_PACKAGES_IS_ENABLED (options , SNAP )) {
501501 packageCounts -> snap += getSnap (baseDir );
502502 }
503- if (! (options -> disabled & FF_PACKAGES_FLAG_XBPS_BIT )) {
503+ if (FF_PACKAGES_IS_ENABLED (options , XBPS )) {
504504 packageCounts -> xbps += getXBPS (baseDir , "/var/db/xbps" );
505505 }
506- if (! (options -> disabled & FF_PACKAGES_FLAG_BREW_BIT )) {
506+ if (FF_PACKAGES_IS_ENABLED (options , BREW )) {
507507 packageCounts -> brewCask += getNumElements (baseDir , "/home/linuxbrew/.linuxbrew/Caskroom" , true);
508508 packageCounts -> brew += getNumElements (baseDir , "/home/linuxbrew/.linuxbrew/Cellar" , true);
509509 }
510- if (! (options -> disabled & FF_PACKAGES_FLAG_PALUDIS_BIT )) {
510+ if (FF_PACKAGES_IS_ENABLED (options , PALUDIS )) {
511511 packageCounts -> paludis += countFilesRecursive (baseDir , "/var/db/paludis/repositories" , "environment.bz2" );
512512 }
513- if (! (options -> disabled & FF_PACKAGES_FLAG_OPKG_BIT )) {
513+ if (FF_PACKAGES_IS_ENABLED (options , OPKG )) {
514514 packageCounts -> opkg += getNumStrings (baseDir , "/usr/lib/opkg/status" , "Package:" , "opkg" ); // openwrt
515515 }
516- if (! (options -> disabled & FF_PACKAGES_FLAG_AM_BIT )) {
516+ if (FF_PACKAGES_IS_ENABLED (options , AM )) {
517517 packageCounts -> amSystem = getAMSystem (baseDir );
518518 }
519- if (! (options -> disabled & FF_PACKAGES_FLAG_SORCERY_BIT )) {
519+ if (FF_PACKAGES_IS_ENABLED (options , SORCERY )) {
520520 packageCounts -> sorcery += getNumStrings (baseDir , "/var/state/sorcery/packages" , ":installed:" , "sorcery" );
521521 }
522- if (! (options -> disabled & FF_PACKAGES_FLAG_GUIX_BIT )) {
522+ if (FF_PACKAGES_IS_ENABLED (options , GUIX )) {
523523 packageCounts -> guixSystem += getGuixPackages (baseDir , "/run/current-system/profile" );
524524 }
525- if (! (options -> disabled & FF_PACKAGES_FLAG_LINGLONG_BIT )) {
525+ if (FF_PACKAGES_IS_ENABLED (options , LINGLONG )) {
526526 packageCounts -> linglong += getNumElements (baseDir , "/var/lib/linglong/layers" , true);
527527 }
528- if (! (options -> disabled & FF_PACKAGES_FLAG_PACSTALL_BIT )) {
528+ if (FF_PACKAGES_IS_ENABLED (options , PACSTALL )) {
529529 packageCounts -> pacstall += getNumElements (baseDir , "/var/lib/pacstall/metadata" , false);
530530 }
531- if (! (options -> disabled & FF_PACKAGES_FLAG_PISI_BIT )) {
531+ if (FF_PACKAGES_IS_ENABLED (options , PISI )) {
532532 packageCounts -> pisi += getNumElements (baseDir , "/var/lib/pisi/package" , true);
533533 }
534- if (! (options -> disabled & FF_PACKAGES_FLAG_PKGSRC_BIT )) {
534+ if (FF_PACKAGES_IS_ENABLED (options , PKGSRC )) {
535535 packageCounts -> pkgsrc += getNumElements (baseDir , "/usr/pkg/pkgdb" , DT_DIR );
536536 }
537- if (! (options -> disabled & FF_PACKAGES_FLAG_MOSS_BIT )) {
537+ if (FF_PACKAGES_IS_ENABLED (options , MOSS )) {
538538 packageCounts -> moss += getSQLite3Int (baseDir , "/.moss/db/state" , "SELECT COUNT(*) FROM state_selections WHERE state_id = (SELECT MAX(id) FROM state)" , "moss" );
539539 }
540- if (! (options -> disabled & FF_PACKAGES_FLAG_CARDS_BIT )) {
540+ if (FF_PACKAGES_IS_ENABLED (options , CARDS )) {
541541 packageCounts -> cards += getNumElements (baseDir , "/var/lib/pkg/DB" , true);
542542 }
543543}
544544
545545static void getPackageCountsRegular (FFstrbuf * baseDir , FFPackagesResult * packageCounts , FFPackagesOptions * options ) {
546546 getPackageCounts (baseDir , packageCounts , options );
547547
548- if (! (options -> disabled & FF_PACKAGES_FLAG_PACMAN_BIT )) {
548+ if (FF_PACKAGES_IS_ENABLED (options , PACMAN )) {
549549 uint32_t baseDirLength = baseDir -> length ;
550550 ffStrbufAppendS (baseDir , FASTFETCH_TARGET_DIR_ETC "/pacman-mirrors.conf" );
551551 if (ffParsePropFile (baseDir -> chars , "Branch =" , & packageCounts -> pacmanBranch ) && packageCounts -> pacmanBranch .length == 0 ) {
@@ -600,13 +600,13 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
600600// This is needed on openSUSE, which seems to use a proprietary database file
601601// This method doesn't work on bedrock, so we do it here.
602602#ifdef FF_HAVE_RPM
603- if (! (options -> disabled & FF_PACKAGES_FLAG_RPM_BIT ) && result -> rpm == 0 ) {
603+ if (FF_PACKAGES_IS_ENABLED (options , RPM ) && result -> rpm == 0 ) {
604604 result -> rpm = getRpmFromLibrpm ();
605605 }
606606#endif
607607
608608 ffStrbufSet (& baseDir , & instance .state .platform .homeDir );
609- if (! (options -> disabled & FF_PACKAGES_FLAG_NIX_BIT )) {
609+ if (FF_PACKAGES_IS_ENABLED (options , NIX )) {
610610 // Count packages from $HOME/.nix-profile
611611 result -> nixUser += ffPackagesGetNix (& baseDir , ".nix-profile" );
612612
@@ -627,24 +627,24 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
627627 result -> nixUser += ffPackagesGetNix (& userPkgsDir , instance .state .platform .userName .chars );
628628 }
629629
630- if (! (options -> disabled & FF_PACKAGES_FLAG_GUIX_BIT )) {
630+ if (FF_PACKAGES_IS_ENABLED (options , GUIX )) {
631631 result -> guixUser += getGuixPackages (& baseDir , ".guix-profile" );
632632 result -> guixHome += getGuixPackages (& baseDir , ".guix-home/profile" );
633633 }
634634
635- if (! (options -> disabled & FF_PACKAGES_FLAG_FLATPAK_BIT )) {
635+ if (FF_PACKAGES_IS_ENABLED (options , FLATPAK )) {
636636 result -> flatpakUser = getFlatpakPackages (& baseDir , "/.local/share" );
637637 }
638638
639- if (! (options -> disabled & FF_PACKAGES_FLAG_AM_BIT )) {
639+ if (FF_PACKAGES_IS_ENABLED (options , AM )) {
640640 result -> amUser = getAMUser ();
641641 }
642642
643- if (! (options -> disabled & FF_PACKAGES_FLAG_SOAR_BIT )) {
643+ if (FF_PACKAGES_IS_ENABLED (options , SOAR )) {
644644 result -> soar += getSQLite3Int (& baseDir , ".local/share/soar/db/soar.db" , "SELECT COUNT(DISTINCT pkg_id || pkg_name) FROM packages WHERE is_installed = true" , "soar" );
645645 }
646646
647- if (! (options -> disabled & FF_PACKAGES_FLAG_APPIMAGE_BIT )) {
647+ if (FF_PACKAGES_IS_ENABLED (options , APPIMAGE )) {
648648 result -> appimage += getNumElementsBySuffix (& baseDir , "/AppImages" , ".appimage" );
649649 result -> appimage += getNumElementsBySuffix (& baseDir , "/Applications" , ".appimage" );
650650 }
0 commit comments