summaryrefslogtreecommitdiffstats
path: root/src/apk.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-04-14 18:48:02 +0300
committerTimo Teras <timo.teras@iki.fi>2009-04-14 18:48:02 +0300
commita23f6f4afb0f819c6c478975df41e235e8d0953a (patch)
tree41e30626def437dc13ecea54afbb2cb6765f5d37 /src/apk.c
parent7cef96c30d2f2d585aa2edd7b6ab22e9e007cddc (diff)
downloadapk-tools-a23f6f4afb0f819c6c478975df41e235e8d0953a.tar.bz2
apk-tools-a23f6f4afb0f819c6c478975df41e235e8d0953a.tar.xz
state: rework changeset calculation algorithm
Calculate changesets directly by stabilizating the package graph instead of recalculating the whole graph and then diffing (similar approach as seen in 'smart' package manager). The algorithm is not complete: defferred search space forking is missing. So you don't always get a solution on complex graphs. Benefits: - usually the search state tree is smaller (less memory used) - speed relational to changeset size, not database size (usually faster) - touch only packages related to users request (can work on partitially broken state; upgrades only necessary packages, fixes #7) Also implemented: - command prompt to confirm operation if packages are deleted or downgraded - requesting deletion of package suggests removal of all packages depending on the package being removed (you'll get list of packages that also get removed if you want package X removed) - option --simulate to see what would have been done (mainly for testing) - an untested implementation of versioned dependencies and conflicts A lot has changed, so expect new bugs too.
Diffstat (limited to 'src/apk.c')
-rw-r--r--src/apk.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/apk.c b/src/apk.c
index 8ad4200..21e4359 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -23,9 +23,8 @@
const char *apk_root;
struct apk_repository_url apk_repository_list;
-int apk_verbosity = 1, apk_progress = 0, apk_upgrade = 0;
-int apk_clean = 0, apk_force = 0;
-int apk_cwd_fd;
+int apk_verbosity = 1, apk_cwd_fd;
+unsigned int apk_flags = 0;
void apk_log(const char *prefix, const char *format, ...)
{
@@ -111,16 +110,17 @@ static struct apk_repository_url *apk_repository_new(const char *url)
return r;
}
-#define NUM_GENERIC_OPTS 8
+#define NUM_GENERIC_OPTS 9
static struct option generic_options[32] = {
{ "root", required_argument, NULL, 'p' },
{ "repository", required_argument, NULL, 'X' },
{ "quiet", no_argument, NULL, 'q' },
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' },
- { "progress", no_argument, &apk_progress, 1 },
- { "clean-protected", no_argument, &apk_clean, 1 },
- { "force", no_argument, &apk_force, 1 },
+ { "progress", no_argument, NULL, 0x101 },
+ { "clean-protected", no_argument, NULL, 0x102 },
+ { "force", no_argument, NULL, 0x103 },
+ { "simulate", no_argument, NULL, 0x104 },
};
int main(int argc, char **argv)
@@ -181,6 +181,17 @@ int main(int argc, char **argv)
break;
case 'V':
return version();
+ case 0x101:
+ apk_flags |= APK_PROGRESS;
+ break;
+ case 0x102:
+ apk_flags |= APK_CLEAN_PROTECTED;
+ break;
+ case 0x103:
+ apk_flags |= APK_FORCE;
+ break;
+ case 0x104:
+ apk_flags |= APK_SIMULATE;
break;
default:
if (applet == NULL || applet->parse == NULL)