summaryrefslogtreecommitdiff
path: root/src/policy.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2020-02-14 13:49:41 +0200
committerTimo Teräs <timo.teras@iki.fi>2020-02-14 16:49:55 +0200
commit60b87557e57ca4e23126bf8c25b1cb978e380dfd (patch)
treeca2469a61c3badb5f4054f387b7059c2bb6c5db7 /src/policy.c
parent72be8139303d55463e470ee608a27eb4af950aff (diff)
downloadapk-tools-60b87557e57ca4e23126bf8c25b1cb978e380dfd.tar.gz
apk-tools-60b87557e57ca4e23126bf8c25b1cb978e380dfd.tar.bz2
apk-tools-60b87557e57ca4e23126bf8c25b1cb978e380dfd.tar.xz
apk-tools-60b87557e57ca4e23126bf8c25b1cb978e380dfd.zip
rename all applets sources to app_*.c
Diffstat (limited to 'src/policy.c')
-rw-r--r--src/policy.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/src/policy.c b/src/policy.c
deleted file mode 100644
index dc33a0b..0000000
--- a/src/policy.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* policy.c - Alpine Package Keeper (APK)
- *
- * Copyright (C) 2013 Timo Teräs <timo.teras@iki.fi>
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation. See http://www.gnu.org/ for details.
- */
-
-#include <stdio.h>
-#include "apk_defines.h"
-#include "apk_applet.h"
-#include "apk_database.h"
-#include "apk_version.h"
-#include "apk_print.h"
-
-extern const char * const apk_installed_file;
-
-static void print_policy(struct apk_database *db, const char *match, struct apk_name *name, void *ctx)
-{
- struct apk_provider *p;
- struct apk_repository *repo;
- int i, j, num = 0;
-
- if (!name) return;
-
-/*
-zlib1g policy:
- 2.0:
- @testing http://nl.alpinelinux.org/alpine/edge/testing
- 1.7:
- @edge http://nl.alpinelinux.org/alpine/edge/main
- 1.2.3.5 (upgradeable):
- http://nl.alpinelinux.org/alpine/v2.6/main
- 1.2.3.4 (installed):
- /media/cdrom/...
- http://nl.alpinelinux.org/alpine/v2.5/main
- 1.1:
- http://nl.alpinelinux.org/alpine/v2.4/main
-*/
- foreach_array_item(p, name->providers) {
- if (p->pkg->name != name)
- continue;
- if (num++ == 0)
- printf("%s policy:\n", name->name);
- printf(" " BLOB_FMT ":\n", BLOB_PRINTF(*p->version));
- if (p->pkg->ipkg != NULL)
- printf(" %s\n", apk_installed_file);
- for (i = 0; i < db->num_repos; i++) {
- repo = &db->repos[i];
- if (!(BIT(i) & p->pkg->repos))
- continue;
- for (j = 0; j < db->num_repo_tags; j++) {
- if (db->repo_tags[j].allowed_repos & p->pkg->repos)
- printf(" "BLOB_FMT"%s%s\n",
- BLOB_PRINTF(db->repo_tags[j].tag),
- j == 0 ? "" : " ",
- repo->url);
- }
- }
- }
-}
-
-static int policy_main(void *ctx, struct apk_database *db, struct apk_string_array *args)
-{
- apk_name_foreach_matching(db, args, apk_foreach_genid(), print_policy, NULL);
- return 0;
-}
-
-static struct apk_applet apk_policy = {
- .name = "policy",
- .open_flags = APK_OPENF_READ,
- .command_groups = APK_COMMAND_GROUP_QUERY,
- .main = policy_main,
-};
-
-APK_DEFINE_APPLET(apk_policy);
-
-