diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2019-05-01 08:59:16 -0500 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2019-05-01 18:56:43 +0300 |
commit | 84941a5967c099e29c172fe1c8f5741dc2bef159 (patch) | |
tree | 3fc8fab67c7f3e52bbf337c394038b21f7416bc5 | |
parent | 44daf808737f85ff462905269c7a1e66d52e2fff (diff) | |
download | apk-tools-84941a5967c099e29c172fe1c8f5741dc2bef159.tar.gz apk-tools-84941a5967c099e29c172fe1c8f5741dc2bef159.tar.bz2 apk-tools-84941a5967c099e29c172fe1c8f5741dc2bef159.tar.xz apk-tools-84941a5967c099e29c172fe1c8f5741dc2bef159.zip |
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.
-rw-r--r-- | src/list.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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)) |