From: Jo-Philipp Wich Date: Thu, 16 Feb 2017 11:16:29 +0000 (+0100) Subject: libopkg: support passing default state flags in pkg_hash_load_feeds() X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4283ab3c37ebe4deb670dd049857b020c8794552;p=oweals%2Fopkg-lede.git libopkg: support passing default state flags in pkg_hash_load_feeds() 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 --- diff --git a/libopkg/opkg.c b/libopkg/opkg.c index d8c17cd..dc11483 100644 --- a/libopkg/opkg.c +++ b/libopkg/opkg.c @@ -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()) diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c index 8c31aa9..99d8958 100644 --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c @@ -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; } diff --git a/libopkg/pkg_hash.h b/libopkg/pkg_hash.h index dcf69f5..562eeaa 100644 --- a/libopkg/pkg_hash.h +++ b/libopkg/pkg_hash.h @@ -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); diff --git a/src/opkg-cl.c b/src/opkg-cl.c index e0a4b23..e2f10a1 100644 --- a/src/opkg-cl.c +++ b/src/opkg-cl.c @@ -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; }