libopkg: mark to-be-installed non-local, non-url packages for detail parsing
authorJo-Philipp Wich <jo@mein.io>
Wed, 15 Feb 2017 22:54:13 +0000 (23:54 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 16 Feb 2017 16:02:30 +0000 (17:02 +0100)
When just a package name is passed to opkg install, we need to retrieve
information about this package from the feeds list so stage an abstract
package with the given name and flag it with SF_NEED_DETAIL.

Packages specified as local file paths or direct download URLs do not
need this special treatment as the required details can be extracted
from their embedded control files.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/opkg_download.c

index 55e71a6ebc0da384c75878b6d304f5488d63e9d2..73ff1ac711038fcc213e55064d89770f6e484ffe 100644 (file)
@@ -300,6 +300,7 @@ int opkg_prepare_url_for_install(const char *url, char **namep)
 {
        int err = 0;
        pkg_t *pkg;
+       abstract_pkg_t *ab_pkg;
 
        pkg = pkg_new();
 
@@ -333,6 +334,13 @@ int opkg_prepare_url_for_install(const char *url, char **namep)
                pkg->provided_by_hand = 1;
 
        } else {
+               ab_pkg = ensure_abstract_pkg_by_name(url);
+
+               if (!(ab_pkg->state_flag & SF_NEED_DETAIL)) {
+                       opkg_msg(DEBUG, "applying abpkg flag to %s\n", ab_pkg->name);
+                       ab_pkg->state_flag |= SF_NEED_DETAIL;
+               }
+
                pkg_deinit(pkg);
                free(pkg);
                return 0;