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 d8c17cdf87bd099adaa1e10c5cd528d14059de12..dc1148386ba18e63c80a531dd843e0d92cd6cd02 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 8c31aa99f0f8a26ac248c4d7ddb8e7324fcce62b..99d8958da16bfeb692afbf626b5672e4fe99a8ec 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 dcf69f5ebcb4c8f3a10dcde806b527fb76ab7fcc..562eeaa60750007a166321ce1c01202866fa5ee7 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 e0a4b2363316af7b01a7a735600524c2166d87b8..e2f10a11852eca066996f9b0416b96e59354d9a6 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;
                }