Commit 84941a59 authored by A. Wilcox's avatar A. Wilcox Committed by Timo Teräs

list: Detect orphaned packages correctly

BIT(1) corresponds with decimal 2, which is the first available repository.

Before this fix, `apk list -O` would list every package installed from the
first available repository, which is the 'system' repository on most Adélie
Linux computers.

After this fix, `apk list -O` correctly lists only the packages which are
no longer available.
parent 44daf808
......@@ -61,7 +61,7 @@ static int is_orphaned(const struct apk_name *name)
/* repo 1 is always installed-db, so if other bits are set it means the package is available somewhere
* (either cache or in a proper repo)
*/
return (repos & ~BIT(1)) == 0;
return (repos & ~BIT(APK_REPOSITORY_CACHED)) == 0;
}
/* returns the currently installed package if there is a newer package that satisfies `name` */
......@@ -144,7 +144,7 @@ static void filter_package(const struct apk_package *pkg, const struct list_ctx
if (ctx->orphaned && !is_orphaned(pkg->name))
return;
if (ctx->available && pkg->repos == BIT(1))
if (ctx->available && pkg->repos == BIT(APK_REPOSITORY_CACHED))
return;
if (ctx->upgradable && !is_upgradable(pkg->name, pkg))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment