libopkg: support passing default state flags in pkg_hash_load_feeds()
authorJo-Philipp Wich <jo@mein.io>
Thu, 16 Feb 2017 11:16:29 +0000 (12:16 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 16 Feb 2017 16:02:30 +0000 (17:02 +0100)
Add a new argument to pkg_hash_load_feeds() which allows specifying default
state flags that should be applied to all loaded packages.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/opkg.c
libopkg/pkg_hash.c
libopkg/pkg_hash.h
src/opkg-cl.c

index d8c17cd..dc11483 100644 (file)
@@ -122,7 +122,7 @@ int opkg_new()
        if (opkg_conf_load())
                goto err0;
 
-       if (pkg_hash_load_feeds())
+       if (pkg_hash_load_feeds(0))
                goto err1;
 
        if (pkg_hash_load_status_files())
index 8c31aa9..99d8958 100644 (file)
@@ -167,7 +167,7 @@ pkg_hash_add_from_file(const char *file_name,
 /*
  * Load in feed files from the cached "src" and/or "src/gz" locations.
  */
-int pkg_hash_load_feeds(void)
+int pkg_hash_load_feeds(int state_flags)
 {
        pkg_src_list_elt_t *iter;
        pkg_src_t *src, *subdist;
@@ -186,7 +186,7 @@ int pkg_hash_load_feeds(void)
                sprintf_alloc(&list_file, "%s/%s", lists_dir, src->name);
 
                if (file_exists(list_file)) {
-                       if (pkg_hash_add_from_file(list_file, src, NULL, 0, 0)) {
+                       if (pkg_hash_add_from_file(list_file, src, NULL, 0, state_flags)) {
                                free(list_file);
                                return -1;
                        }
index dcf69f5..562eeaa 100644 (file)
@@ -31,7 +31,7 @@ void pkg_hash_fetch_available(pkg_vec_t * available);
 int dist_hash_add_from_file(const char *file_name, pkg_src_t * dist);
 int pkg_hash_add_from_file(const char *file_name, pkg_src_t * src,
                           pkg_dest_t * dest, int is_status_file, int state_flags);
-int pkg_hash_load_feeds(void);
+int pkg_hash_load_feeds(int state_flags);
 int pkg_hash_load_status_files(void);
 
 void hash_insert_pkg(pkg_t * pkg, int set_status);
index e0a4b23..e2f10a1 100644 (file)
@@ -421,7 +421,7 @@ int main(int argc, char *argv[])
 
        if (!nocheckfordirorfile) {
                if (!noreadfeedsfile) {
-                       if (pkg_hash_load_feeds())
+                       if (pkg_hash_load_feeds(SF_NEED_DETAIL))
                                goto err1;
                }