summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
authorpixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2010-01-05 12:18:04 (EST)
committer pixdamix <pixdamix@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2010-01-05 12:18:04 (EST)
commitf0463978ddbcfd963819022c2da8e04ff310720c (patch)
treea4d940c6cf30d8cb88140ad81f80e2dcca1af74d /libopkg
parentb10ba43e784742fe194351270c813a4a6d722e4e (diff)
Add an option to download packages but do not install/upgrade anything
git-svn-id: http://opkg.googlecode.com/svn/trunk@512 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/opkg_conf.c1
-rw-r--r--libopkg/opkg_conf.h1
-rw-r--r--libopkg/opkg_install.c37
3 files changed, 27 insertions, 12 deletions
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 9c02cbd..bcc79ed 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -59,6 +59,7 @@ opkg_option_t options[] = {
{ "no_proxy", OPKG_OPT_TYPE_STRING, &_conf.no_proxy },
{ "test", OPKG_OPT_TYPE_BOOL, &_conf.noaction },
{ "noaction", OPKG_OPT_TYPE_BOOL, &_conf.noaction },
+ { "download_only", OPKG_OPT_TYPE_BOOL, &_conf.download_only },
{ "nodeps", OPKG_OPT_TYPE_BOOL, &_conf.nodeps },
{ "offline_root", OPKG_OPT_TYPE_STRING, &_conf.offline_root },
{ "proxy_passwd", OPKG_OPT_TYPE_STRING, &_conf.proxy_passwd },
diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
index 092686c..0925b81 100644
--- a/libopkg/opkg_conf.h
+++ b/libopkg/opkg_conf.h
@@ -79,6 +79,7 @@ struct opkg_conf
int query_all;
int verbosity;
int noaction;
+ int download_only;
char *cache;
#ifdef HAVE_SSLCURL
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index 2ee240f..5472ca2 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -453,25 +453,29 @@ opkg_install_check_downgrade(pkg_t *pkg, pkg_t *old_pkg, int message)
}
if (cmp > 0) {
- opkg_msg(NOTICE,
- "Not downgrading package %s on %s from %s to %s.\n",
- old_pkg->name, old_pkg->dest->name, old_version, new_version);
+ if(!conf->download_only)
+ opkg_msg(NOTICE,
+ "Not downgrading package %s on %s from %s to %s.\n",
+ old_pkg->name, old_pkg->dest->name, old_version, new_version);
rc = 1;
} else if (cmp < 0) {
- opkg_msg(NOTICE, "%s%s on %s from %s to %s...\n",
- message_out, pkg->name, old_pkg->dest->name, old_version, new_version);
+ if(!conf->download_only)
+ opkg_msg(NOTICE, "%s%s on %s from %s to %s...\n",
+ message_out, pkg->name, old_pkg->dest->name, old_version, new_version);
pkg->dest = old_pkg->dest;
rc = 0;
} else /* cmp == 0 */ {
if (conf->force_reinstall) {
- opkg_msg(NOTICE, "Reinstalling %s (%s) on %s...\n",
- pkg->name, new_version, old_pkg->dest->name);
+ if(!conf->download_only)
+ opkg_msg(NOTICE, "Reinstalling %s (%s) on %s...\n",
+ pkg->name, new_version, old_pkg->dest->name);
pkg->dest = old_pkg->dest;
rc = 0;
} else {
- opkg_msg(NOTICE, "%s (%s) already install on %s."
- " Not reinstalling.\n",
- pkg->name, new_version, old_pkg->dest->name);
+ if(!conf->download_only)
+ opkg_msg(NOTICE, "%s (%s) already install on %s."
+ " Not reinstalling.\n",
+ pkg->name, new_version, old_pkg->dest->name);
rc = 1;
}
}
@@ -487,8 +491,9 @@ opkg_install_check_downgrade(pkg_t *pkg, pkg_t *old_pkg, int message)
strncpy( message_out,"Installing ",strlen("Installing ") );
char *version = pkg_version_str_alloc(pkg);
- opkg_msg(NOTICE, "%s%s (%s) to %s...\n", message_out,
- pkg->name, version, pkg->dest->name);
+ if(!conf->download_only)
+ opkg_msg(NOTICE, "%s%s (%s) to %s...\n", message_out,
+ pkg->name, version, pkg->dest->name);
free(version);
return 0;
}
@@ -1329,6 +1334,14 @@ opkg_install_pkg(pkg_t *pkg, int from_upgrade)
free(file_sha256);
}
#endif
+ if(conf->download_only) {
+ if (conf->nodeps == 0) {
+ err = satisfy_dependencies_for(pkg);
+ if (err)
+ return -1;
+ }
+ return 0;
+ }
if (pkg->tmp_unpack_dir == NULL) {
if (unpack_pkg_control_files(pkg) == -1) {