r4085 - trunk/src/target/opkg/libopkg
thomas at sita.openmoko.org
thomas at sita.openmoko.org
Mon Feb 18 13:05:34 CET 2008
Author: thomas
Date: 2008-02-18 13:05:32 +0100 (Mon, 18 Feb 2008)
New Revision: 4085
Modified:
trunk/src/target/opkg/libopkg/args.c
trunk/src/target/opkg/libopkg/args.h
trunk/src/target/opkg/libopkg/libopkg.h
trunk/src/target/opkg/libopkg/opkg_conf.c
trunk/src/target/opkg/libopkg/opkg_conf.h
trunk/src/target/opkg/libopkg/opkg_remove.c
Log:
opkg: add autoremove command line option
Modified: trunk/src/target/opkg/libopkg/args.c
===================================================================
--- trunk/src/target/opkg/libopkg/args.c 2008-02-18 09:42:28 UTC (rev 4084)
+++ trunk/src/target/opkg/libopkg/args.c 2008-02-18 12:05:32 UTC (rev 4085)
@@ -42,7 +42,8 @@
ARGS_OPT_NODEPS,
ARGS_OPT_VERBOSE_WGET,
ARGS_OPT_VERBOSITY,
- ARGS_OPT_MULTIPLE_PROVIDERS
+ ARGS_OPT_MULTIPLE_PROVIDERS,
+ ARGS_OPT_AUTOREMOVE
};
int args_init(args_t *args)
@@ -67,6 +68,7 @@
args->force_reinstall = ARGS_DEFAULT_FORCE_REINSTALL;
args->force_removal_of_dependent_packages = ARGS_DEFAULT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES;
args->force_removal_of_essential_packages = ARGS_DEFAULT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES;
+ args->autoremove = ARGS_DEFAULT_AUTOREMOVE;
args->noaction = ARGS_DEFAULT_NOACTION;
args->nodeps = ARGS_DEFAULT_NODEPS;
args->verbose_wget = ARGS_DEFAULT_VERBOSE_WGET;
@@ -94,6 +96,7 @@
int parse_err = 0;
static struct option long_options[] = {
{"query-all", 0, 0, 'A'},
+ {"autoremove", 0, 0, ARGS_OPT_AUTOREMOVE},
{"conf-file", 1, 0, 'f'},
{"conf", 1, 0, 'f'},
{"dest", 1, 0, 'd'},
@@ -169,6 +172,9 @@
else
args->verbosity += 1;
break;
+ case ARGS_OPT_AUTOREMOVE:
+ args->autoremove = 1;
+ break;
case ARGS_OPT_FORCE_DEFAULTS:
args->force_defaults = 1;
break;
@@ -299,6 +305,7 @@
fprintf(stderr, "\t-nodeps Do not follow dependences\n");
fprintf(stderr, "\t-force-removal-of-dependent-packages\n");
fprintf(stderr, "\t-recursive Allow opkg to remove package and all that depend on it.\n");
+ fprintf(stderr, "\t-autoremove Allow opkg to remove packages that where installed automatically to satisfy dependencies.\n");
fprintf(stderr, "\t-test No action -- test only\n");
fprintf(stderr, "\t-t Specify tmp-dir.\n");
fprintf(stderr, "\t--tmp-dir Specify tmp-dir.\n");
Modified: trunk/src/target/opkg/libopkg/args.h
===================================================================
--- trunk/src/target/opkg/libopkg/args.h 2008-02-18 09:42:28 UTC (rev 4084)
+++ trunk/src/target/opkg/libopkg/args.h 2008-02-18 12:05:32 UTC (rev 4085)
@@ -39,6 +39,7 @@
int verbosity;
int nocheckfordirorfile;
int noreadfeedsfile;
+ int autoremove;
char *offline_root;
char *offline_root_pre_script_cmd;
char *offline_root_post_script_cmd;
@@ -63,6 +64,7 @@
#define ARGS_DEFAULT_NODEPS 0
#define ARGS_DEFAULT_VERBOSE_WGET 0
#define ARGS_DEFAULT_VERBOSITY 1
+#define ARGS_DEFAULT_AUTOREMOVE 0
int args_init(args_t *args);
void args_deinit(args_t *args);
Modified: trunk/src/target/opkg/libopkg/libopkg.h
===================================================================
--- trunk/src/target/opkg/libopkg/libopkg.h 2008-02-18 09:42:28 UTC (rev 4084)
+++ trunk/src/target/opkg/libopkg/libopkg.h 2008-02-18 12:05:32 UTC (rev 4085)
@@ -39,6 +39,7 @@
typedef char* (*opkg_response_callback)(char *question);
typedef void (*opkg_download_progress_callback)(int percent, char *url);
typedef void (*opkg_state_changed_callback)(opkg_state_t state, const char *data);
+typedef void (*opkg_progress_callback)(int complete, int total, void *userdata);
extern int opkg_op(int argc, char *argv[]); /* opkglib.c */
extern int opkg_init (opkg_message_callback mcall,
Modified: trunk/src/target/opkg/libopkg/opkg_conf.c
===================================================================
--- trunk/src/target/opkg/libopkg/opkg_conf.c 2008-02-18 09:42:28 UTC (rev 4084)
+++ trunk/src/target/opkg/libopkg/opkg_conf.c 2008-02-18 12:05:32 UTC (rev 4085)
@@ -231,6 +231,9 @@
right now it is ridiculous. Maybe opkg_conf_t should just save
a pointer to args_t (which could then not be freed), rather
than duplicating every field here? */
+ if (args->autoremove) {
+ conf->autoremove = 1;
+ }
if (args->force_depends) {
conf->force_depends = 1;
}
Modified: trunk/src/target/opkg/libopkg/opkg_conf.h
===================================================================
--- trunk/src/target/opkg/libopkg/opkg_conf.h 2008-02-18 09:42:28 UTC (rev 4084)
+++ trunk/src/target/opkg/libopkg/opkg_conf.h 2008-02-18 12:05:32 UTC (rev 4085)
@@ -54,6 +54,7 @@
const char *pending_dir;
/* options */
+ int autoremove;
int force_depends;
int force_defaults;
int force_overwrite;
Modified: trunk/src/target/opkg/libopkg/opkg_remove.c
===================================================================
--- trunk/src/target/opkg/libopkg/opkg_remove.c 2008-02-18 09:42:28 UTC (rev 4084)
+++ trunk/src/target/opkg/libopkg/opkg_remove.c 2008-02-18 12:05:32 UTC (rev 4085)
@@ -169,7 +169,10 @@
*/
int err;
abstract_pkg_t *parent_pkg = NULL;
-
+
+ if (conf->autoremove)
+ printf ("autoremove is enabled, but not yet implemented\n");
+
if (pkg->essential && !message) {
if (conf->force_removal_of_essential_packages) {
fprintf(stderr, "WARNING: Removing essential package %s under your coercion.\n"
More information about the commitlog
mailing list