Index: ipkg_cmd.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/ipkg_cmd.c,v retrieving revision 1.89 diff -u -r1.89 ipkg_cmd.c --- ipkg_cmd.c 29 Mar 2004 21:13:12 -0000 1.89 +++ ipkg_cmd.c 2 Apr 2004 22:43:22 -0000 @@ -51,30 +51,30 @@ static void *p_userdata = NULL; #endif -static int ipkg_update_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_upgrade_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_list_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_info_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_status_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_install_pending_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_install_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_remove_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_purge_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_flag_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_files_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_search_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_download_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_depends_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_whatdepends_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_whatdepends_recursively_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_whatsuggests_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_whatrecommends_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_whatprovides_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_whatconflicts_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_whatreplaces_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_compare_versions_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_print_architecture_cmd(ipkg_conf_t *conf, int argc, char **argv); -static int ipkg_configure_cmd(ipkg_conf_t *conf, int argc, char **argv); +static int ipkg_update_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_upgrade_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_list_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_info_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_status_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_install_pending_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_install_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_remove_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_purge_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_flag_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_files_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_search_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_download_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_depends_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_whatdepends_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_whatdepends_recursively_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_whatsuggests_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_whatrecommends_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_whatprovides_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_whatconflicts_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_whatreplaces_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_compare_versions_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_print_architecture_cmd(ipkg_conf_t *conf, int argc, const char * *argv); +static int ipkg_configure_cmd(ipkg_conf_t *conf, int argc, const char * *argv); /* XXX: CLEANUP: The usage strings should be incorporated into this array for easier maintenance */ @@ -139,7 +139,7 @@ } #ifdef IPKG_LIB -int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, const char **argv, void *userdata) +int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, const char * *argv, void *userdata) { int result; p_userdata = userdata; @@ -148,13 +148,13 @@ return result; } #else -int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, const char **argv) +int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, const char ** argv) { return (cmd->fun)(conf, argc, argv); } #endif -static int ipkg_update_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_update_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { int err; int failures; @@ -276,7 +276,7 @@ /* scan the args passed and cache the local filenames of the packages */ -int ipkg_multiple_files_scan(ipkg_conf_t *conf, int argc, char **argv) +int ipkg_multiple_files_scan(ipkg_conf_t *conf, int argc, const char **argv) { int i; int err; @@ -287,7 +287,7 @@ * For any files, install package info in database. */ for (i = 0; i < argc; i ++) { - char *filename = argv [i]; + const char *filename = argv [i]; //char *tmp = basename (tmp); //int tmplen = strlen (tmp); @@ -348,10 +348,10 @@ exit(128 + sig); } -static int ipkg_install_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_install_cmd(ipkg_conf_t *conf, int argc, const char **argv) { int i; - char *arg; + const char *arg; int err; global_conf = conf; @@ -393,7 +393,7 @@ return 0; } -static int ipkg_upgrade_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_upgrade_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { int i; pkg_t *pkg; @@ -404,7 +404,7 @@ if (argc) { for (i=0; i < argc; i++) { - char *arg = argv[i]; + const char *arg = argv[i]; err = ipkg_prepare_url_for_install(conf, arg, &arg); if (err != EINVAL && err != 0) @@ -413,7 +413,7 @@ pkg_info_preinstall_check(conf); for (i=0; i < argc; i++) { - char *arg = argv[i]; + const char *arg = argv[i]; if (conf->restrict_to_default_dest) { pkg = pkg_hash_fetch_installed_by_name_dest(&conf->pkg_hash, argv[i], @@ -456,10 +456,10 @@ return 0; } -static int ipkg_download_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_download_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { int i, err; - char *arg; + const char *arg; pkg_t *pkg; pkg_info_preinstall_check(conf); @@ -500,7 +500,7 @@ return err; } -static int ipkg_list_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_list_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { int i, err; pkg_vec_t *available; @@ -508,7 +508,7 @@ char desc_short[IPKG_LIST_DESCRIPTION_LENGTH]; char *newline; regex_t re; - char *pkg_name = NULL; + const char *pkg_name = NULL; if (argc > 0) { pkg_name = argv[0]; @@ -549,13 +549,13 @@ return 0; } -static int ipkg_info_status_cmd(ipkg_conf_t *conf, int argc, char **argv, int installed_only) +static int ipkg_info_status_cmd(ipkg_conf_t *conf, int argc, const char * *argv, int installed_only) { int i, err; pkg_vec_t *available; pkg_t *pkg; - char *pkg_name = NULL; - char **pkg_fields = NULL; + const char *pkg_name = NULL; + const char * *pkg_fields = NULL; int n_fields = 0; regex_t re; char *buff ; // = (char *)malloc(1); @@ -624,19 +624,19 @@ return 0; } -static int ipkg_info_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_info_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { return ipkg_info_status_cmd(conf, argc, argv, 0); } -static int ipkg_status_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_status_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { return ipkg_info_status_cmd(conf, argc, argv, 1); } -static int ipkg_configure_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_configure_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { - char *pkg_name = NULL; + const char *pkg_name = NULL; regex_t re; int err; @@ -656,7 +656,7 @@ return err; } -static int ipkg_install_pending_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_install_pending_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { int i, err; char *globpattern; @@ -694,7 +694,7 @@ return err; } -static int ipkg_remove_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_remove_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { int i; pkg_t *pkg; @@ -765,7 +765,7 @@ return 0; } -static int ipkg_purge_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_purge_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { int i; pkg_t *pkg; @@ -796,7 +796,7 @@ return 0; } -static int ipkg_flag_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_flag_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { int i; pkg_t *pkg; @@ -838,7 +838,7 @@ return 0; } -static int ipkg_files_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_files_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { pkg_t *pkg; str_list_t *installed_files; @@ -897,7 +897,7 @@ return 0; } -static int ipkg_depends_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_depends_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { if (argc > 0) { @@ -969,7 +969,7 @@ WHATSUGGESTS }; -static int ipkg_what_depends_conflicts_cmd(ipkg_conf_t *conf, enum what_field_type what_field_type, int recursive, int argc, char **argv) +static int ipkg_what_depends_conflicts_cmd(ipkg_conf_t *conf, enum what_field_type what_field_type, int recursive, int argc, const char * *argv) { if (argc > 0) { @@ -979,10 +979,13 @@ int changed; switch (what_field_type) { - case WHATDEPENDS: rel_str = "depends on"; break; - case WHATCONFLICTS: rel_str = "conflicts with"; break; - case WHATSUGGESTS: rel_str = "suggests"; break; - case WHATRECOMMENDS: rel_str = "recommends"; break; + case WHATDEPENDS: rel_str = "depends on"; break; + case WHATCONFLICTS: rel_str = "conflicts with"; break; + case WHATSUGGESTS: rel_str = "suggests"; break; + case WHATRECOMMENDS: rel_str = "recommends"; break; + default : + ipkg_message(conf, IPKG_NOTICE, "WHARFIELDTYPE : NYI\n"); + break; } if (conf->query_all) @@ -1081,31 +1084,31 @@ return 0; } -static int ipkg_whatdepends_recursively_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_whatdepends_recursively_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { return ipkg_what_depends_conflicts_cmd(conf, WHATDEPENDS, 1, argc, argv); } -static int ipkg_whatdepends_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_whatdepends_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { return ipkg_what_depends_conflicts_cmd(conf, WHATDEPENDS, 0, argc, argv); } -static int ipkg_whatsuggests_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_whatsuggests_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { return ipkg_what_depends_conflicts_cmd(conf, WHATSUGGESTS, 0, argc, argv); } -static int ipkg_whatrecommends_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_whatrecommends_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { return ipkg_what_depends_conflicts_cmd(conf, WHATRECOMMENDS, 0, argc, argv); } -static int ipkg_whatconflicts_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_whatconflicts_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { return ipkg_what_depends_conflicts_cmd(conf, WHATCONFLICTS, 0, argc, argv); } -static int ipkg_what_provides_replaces_cmd(ipkg_conf_t *conf, enum what_field_type what_field_type, int argc, char **argv) +static int ipkg_what_provides_replaces_cmd(ipkg_conf_t *conf, enum what_field_type what_field_type, int argc, const char * *argv) { if (argc > 0) { @@ -1150,17 +1153,17 @@ return 0; } -static int ipkg_whatprovides_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_whatprovides_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { return ipkg_what_provides_replaces_cmd(conf, WHATPROVIDES, argc, argv); } -static int ipkg_whatreplaces_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_whatreplaces_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { return ipkg_what_provides_replaces_cmd(conf, WHATREPLACES, argc, argv); } -static int ipkg_search_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_search_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { int i, err; regex_t re; @@ -1215,7 +1218,7 @@ return 0; } -static int ipkg_compare_versions_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_compare_versions_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { if (argc == 3) { /* this is a bit gross */ @@ -1237,7 +1240,7 @@ #define HOST_CPU_STR HOST_CPU_STR_(HOST_CPU_FOO) #endif -static int ipkg_print_architecture_cmd(ipkg_conf_t *conf, int argc, char **argv) +static int ipkg_print_architecture_cmd(ipkg_conf_t *conf, int argc, const char * *argv) { nv_pair_list_elt_t *l; Index: ipkg_cmd.h =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/ipkg_cmd.h,v retrieving revision 1.12 diff -u -r1.12 ipkg_cmd.h --- ipkg_cmd.h 12 Jan 2004 16:07:36 -0000 1.12 +++ ipkg_cmd.h 2 Apr 2004 22:43:22 -0000 @@ -18,7 +18,7 @@ #ifndef IPKG_CMD_H #define IPKG_CMD_H -typedef int (*ipkg_cmd_fun_t)(ipkg_conf_t *conf, int argc, const char **argv); +typedef int (*ipkg_cmd_fun_t)(ipkg_conf_t *conf, int argc, const char * *argv); struct ipkg_cmd { @@ -31,11 +31,11 @@ ipkg_cmd_t *ipkg_cmd_find(const char *name); #ifdef IPKG_LIB int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, - const char **argv, void *userdata); + const char * *argv, void *userdata); #else -int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, const char **argv); +int ipkg_cmd_exec(ipkg_cmd_t *cmd, ipkg_conf_t *conf, int argc, const char * *argv); #endif -int ipkg_multiple_files_scan (ipkg_conf_t *conf, int argc, char *argv[]); +int ipkg_multiple_files_scan (ipkg_conf_t *conf, int argc, const char *argv[]); /* install any packges with state_want == SW_INSTALL */ int ipkg_install_wanted_packages(ipkg_conf_t *conf); /* ensure that all dependences are satisfied */ Index: ipkg_conf.h =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/ipkg_conf.h,v retrieving revision 1.32 diff -u -r1.32 ipkg_conf.h --- ipkg_conf.h 19 Jan 2004 23:12:12 -0000 1.32 +++ ipkg_conf.h 2 Apr 2004 22:43:22 -0000 @@ -101,5 +101,6 @@ void ipkg_conf_deinit(ipkg_conf_t *conf); int ipkg_conf_write_status_files(ipkg_conf_t *conf); +char * root_filename_alloc( ipkg_conf_t *conf, char *filename); #endif Index: ipkg_download.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/ipkg_download.c,v retrieving revision 1.27 diff -u -r1.27 ipkg_download.c --- ipkg_download.c 10 Mar 2004 21:27:35 -0000 1.27 +++ ipkg_download.c 2 Apr 2004 22:43:22 -0000 @@ -132,7 +132,7 @@ /* * Downloads file from url, installs in package database, return package name. */ -int ipkg_prepare_url_for_install(ipkg_conf_t *conf, const char *url, char **namep) +int ipkg_prepare_url_for_install(ipkg_conf_t *conf, const char *url, const char **namep) { int err = 0; pkg_t *pkg; Index: ipkg_download.h =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/ipkg_download.h,v retrieving revision 1.6 diff -u -r1.6 ipkg_download.h --- ipkg_download.h 4 Mar 2003 14:11:15 -0000 1.6 +++ ipkg_download.h 2 Apr 2004 22:43:22 -0000 @@ -25,6 +25,6 @@ /* * Downloads file from url, installs in package database, return package name. */ -int ipkg_prepare_url_for_install(ipkg_conf_t *conf, const char *url, char **namep); +int ipkg_prepare_url_for_install(ipkg_conf_t *conf, const char *url, const char **namep); #endif Index: ipkg_install.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/ipkg_install.c,v retrieving revision 1.82 diff -u -r1.82 ipkg_install.c --- ipkg_install.c 17 Mar 2004 21:17:37 -0000 1.82 +++ ipkg_install.c 2 Apr 2004 22:43:23 -0000 @@ -133,14 +133,18 @@ char *old_version, *new_version; old = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg_name); - + new = pkg_hash_fetch_best_installation_candidate_by_name(conf, pkg_name); if (new == NULL) { return IPKG_PKG_HAS_NO_CANDIDATE; } new->state_flag |= SF_USER; - if (old) { + if (old && + ( old->state_status == SS_INSTALLED || + old->state_status == SS_UNPACKED + ) + ) { old_version = pkg_version_str_alloc(old); new_version = pkg_version_str_alloc(new); @@ -438,8 +442,9 @@ pkg_t *owner = file_hash_get_file_owner(conf, new_file); if (!new_file) ipkg_message(conf, IPKG_ERROR, "Null new_file for new_pkg=%s\n", new_pkg->name); - if (!owner || (owner == old_pkg)) + if (!owner || (owner == old_pkg)) { file_hash_set_file_owner(conf, new_file, new_pkg); + } } if (old_pkg) { str_list_t *old_list = pkg_get_installed_files(old_pkg); @@ -1091,6 +1096,20 @@ } owner = file_hash_get_file_owner(conf, filename); + + /* in some situations, the WANT flag can be set to + install but the STATUS flag is still not-installed + + then it CAN be that the owern of a file that + is know by ipkg is the SAME as the package + we are about to install + */ + + if( owner == pkg ) { + printf( "ISSAME %s %s\n", + owner->name, pkg->name); + continue; + } /* Pre-existing files are OK if owned by the pkg being upgraded. */ if (owner && old_pkg) { Index: ipkg_message.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/ipkg_message.c,v retrieving revision 1.4 diff -u -r1.4 ipkg_message.c --- ipkg_message.c 6 Nov 2003 15:37:50 -0000 1.4 +++ ipkg_message.c 2 Apr 2004 22:43:23 -0000 @@ -43,19 +43,30 @@ #include "libipkg.h" //#define ipkg_message(conf, level, fmt, arg...) ipkg_cb_message(conf, level, fmt, ## arg) +static char * Fmt_Buffer = 0; +static long Fmt_BufLen = 0; void ipkg_message (ipkg_conf_t * conf, message_level_t level, char *fmt, ...) { va_list ap; - char ts[128]; + long cl; if (ipkg_cb_message) { - va_start (ap, fmt); - vsnprintf (ts,128,fmt, ap); - va_end (ap); - ipkg_cb_message(conf,level,ts); + do { + va_start (ap, fmt); + cl = vsnprintf (Fmt_Buffer,Fmt_BufLen,fmt, ap); + va_end (ap); + if( cl < Fmt_BufLen ) { + // we had space enough + break; + } + // buffer too small + Fmt_BufLen += 128; + Fmt_Buffer = realloc( Fmt_Buffer, sizeof( char ) * Fmt_BufLen ); + } while( 1 ); + ipkg_cb_message(conf,level,Fmt_Buffer); } } #endif Index: ipkg_remove.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/ipkg_remove.c,v retrieving revision 1.39 diff -u -r1.39 ipkg_remove.c --- ipkg_remove.c 10 Mar 2004 21:27:35 -0000 1.39 +++ ipkg_remove.c 2 Apr 2004 22:43:24 -0000 @@ -185,6 +185,20 @@ if ((parent_pkg = pkg->parent) == NULL) return 0; + if( pkg->state_status == SS_NOT_INSTALLED ) { + // pending to be installed -> revert + pkg->state_want = SW_UNKNOWN; + ipkg_state_changed++; + + printf("Reverting install request for package %s to %s...\n", + pkg->name, pkg->dest->name); + fflush(stdout); + pkg->state_status = SS_NOT_INSTALLED; + if (parent_pkg) + parent_pkg->state_status = SS_NOT_INSTALLED; + return 0; + } + /* only attempt to remove dependent installed packages if * force_depends is not specified or the package is being * replaced. Index: libipkg.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/libipkg.c,v retrieving revision 1.9 diff -u -r1.9 libipkg.c --- libipkg.c 8 Mar 2004 23:48:38 -0000 1.9 +++ libipkg.c 2 Apr 2004 22:43:24 -0000 @@ -24,6 +24,7 @@ #include "args.h" #include "ipkg_conf.h" #include "ipkg_cmd.h" +#include "file_util.h" @@ -81,7 +82,7 @@ * maybe a good idea to change */ cmd = ipkg_cmd_find ("list"); if (packages) - err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &packages, userdata); + err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, (char *const*)&packages, userdata); else err = ipkg_cmd_exec (cmd, &ipkg_conf, 0, NULL, userdata); ipkg_cb_list = NULL; @@ -112,7 +113,7 @@ * maybe a good idea to change */ cmd = ipkg_cmd_find ("status"); if (packages) - err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &packages, userdata); + err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, (char *const*)&packages, userdata); else err = ipkg_cmd_exec (cmd, &ipkg_conf, 0, NULL, userdata); @@ -144,7 +145,7 @@ * maybe a good idea to change */ cmd = ipkg_cmd_find ("info"); if (packages) - err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &packages, userdata); + err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, (char *const*)&packages, userdata); else err = ipkg_cmd_exec (cmd, &ipkg_conf, 0, NULL, userdata); @@ -174,7 +175,7 @@ /* we need to do this because of static declarations, * maybe a good idea to change */ cmd = ipkg_cmd_find ("install"); - err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &name, NULL); + err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, (char *const*)&name, NULL); ipkg_conf_deinit(&ipkg_conf); return (err); @@ -205,7 +206,7 @@ else cmd = ipkg_cmd_find ("remove"); - err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &name, NULL); + err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, (char *const*)&name, NULL); ipkg_conf_deinit(&ipkg_conf); return (err); @@ -280,7 +281,7 @@ /* we need to do this because of static declarations, * maybe a good idea to change */ cmd = ipkg_cmd_find ("download"); - err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &name, NULL); + err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, (char *const*)&name, NULL); ipkg_conf_deinit(&ipkg_conf); return (err); @@ -313,7 +314,7 @@ * maybe a good idea to change */ cmd = ipkg_cmd_find ("files"); - err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &name, userdata); + err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, (char *const*)&name, userdata); ipkg_cb_list = NULL; ipkg_conf_deinit(&ipkg_conf); @@ -346,7 +347,7 @@ /* we need to do this because of static declarations, * maybe a good idea to change */ cmd = ipkg_cmd_find ("search"); - err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, &file, userdata); + err = ipkg_cmd_exec (cmd, &ipkg_conf, 1, (char *const*)&file, userdata); ipkg_cb_list = NULL; ipkg_conf_deinit(&ipkg_conf); @@ -355,7 +356,7 @@ int -ipkg_file_what(args_t *args, const char *file, const char* command) +ipkg_file_what(args_t *args, char *file, const char* command) { ipkg_cmd_t *cmd; ipkg_conf_t ipkg_conf; @@ -495,7 +496,7 @@ args_usage (NULL); } - err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - optind, (const char **) (argv + optind), NULL); + err = ipkg_cmd_exec (cmd, &ipkg_conf, argc - optind, (char **) (argv + optind), NULL); ipkg_conf_deinit (&ipkg_conf); Index: libipkg.h =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/libipkg.h,v retrieving revision 1.4 diff -u -r1.4 libipkg.h --- libipkg.h 5 Feb 2004 16:26:00 -0000 1.4 +++ libipkg.h 2 Apr 2004 22:43:24 -0000 @@ -49,7 +49,7 @@ extern int ipkg_packages_status(args_t *args, const char *packages, ipkg_status_callback cbstatus, - void *userdata); + void *userdata); extern int ipkg_packages_info(args_t *args, const char *packages, ipkg_status_callback cbstatus, @@ -61,12 +61,12 @@ extern int ipkg_packages_download(args_t *args, const char *name); extern int ipkg_package_files(args_t *args, const char *name, - ipkg_list_callback cblist, - void *userdata); + ipkg_list_callback cblist, + void *userdata); extern int ipkg_file_search(args_t *args, const char *file, - ipkg_list_callback cblist, - void *userdata); + ipkg_list_callback cblist, + void *userdata); extern int ipkg_package_whatdepends(args_t *args, const char *file); extern int ipkg_package_whatrecommends(args_t *args, const char *file); extern int ipkg_package_whatprovides(args_t *args, const char *file); Index: pkg.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/pkg.c,v retrieving revision 1.85 diff -u -r1.85 pkg.c --- pkg.c 17 Mar 2004 21:17:37 -0000 1.85 +++ pkg.c 2 Apr 2004 22:43:26 -0000 @@ -702,7 +702,7 @@ return NULL; } temp[0]='\0'; - snprintf(temp, 29, "Installed-Time: %ul\n", pkg->installed_time); + snprintf(temp, 29, "Installed-Time: %ul\n", (unsigned int)pkg->installed_time); } } break; @@ -1140,7 +1140,7 @@ if (vercmp) return vercmp; if (!a->arch_priority || !b->arch_priority) { - fprintf(stderr, "pkg_name_version_and_architecture_compare: a=%p a->arch_priority=%p b=%p b->arch_priority=%p\n", + fprintf(stderr, "pkg_name_version_and_architecture_compare: a=%p a->arch_priority=%d b=%p b->arch_priority=%d\n", a, a->arch_priority, b, b->arch_priority); return 0; } @@ -1510,7 +1510,7 @@ } } -pkg_state_flag_t pkg_state_flag_from_str(char *str) +pkg_state_flag_t pkg_state_flag_from_str(const char *str) { int i; int sf = SF_OK; @@ -1550,7 +1550,7 @@ return ""; } -pkg_state_status_t pkg_state_status_from_str(char *str) +pkg_state_status_t pkg_state_status_from_str(const char *str) { int i; Index: pkg.h =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/pkg.h,v retrieving revision 1.45 diff -u -r1.45 pkg.h --- pkg.h 17 Mar 2004 21:17:37 -0000 1.45 +++ pkg.h 2 Apr 2004 22:43:26 -0000 @@ -214,9 +214,9 @@ char *pkg_state_want_to_str(pkg_state_want_t sw); pkg_state_want_t pkg_state_want_from_str(char *str); char *pkg_state_flag_to_str(pkg_state_flag_t sf); -pkg_state_flag_t pkg_state_flag_from_str(char *str); +pkg_state_flag_t pkg_state_flag_from_str( const char *str); char *pkg_state_status_to_str(pkg_state_status_t ss); -pkg_state_status_t pkg_state_status_from_str(char *str); +pkg_state_status_t pkg_state_status_from_str(const char *str); int pkg_version_satisfied(pkg_t *it, pkg_t *ref, const char *op); Index: pkg_extract.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/pkg_extract.c,v retrieving revision 1.8 diff -u -r1.8 pkg_extract.c --- pkg_extract.c 22 Aug 2003 20:41:55 -0000 1.8 +++ pkg_extract.c 2 Apr 2004 22:43:27 -0000 @@ -87,7 +87,7 @@ int pkg_extract_data_file_names_to_file(pkg_t *pkg, const char *file_name) { - int err; + int err = 0; char *line, *data_file; FILE *file; FILE *tmp; Index: pkg_hash.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/pkg_hash.c,v retrieving revision 1.65 diff -u -r1.65 pkg_hash.c --- pkg_hash.c 17 Mar 2004 21:17:37 -0000 1.65 +++ pkg_hash.c 2 Apr 2004 22:43:27 -0000 @@ -324,26 +324,14 @@ if(!(vec = pkg_vec_fetch_by_name(hash, pkg_name))) return NULL; - for(i = 0; i < vec->len; i++) - if((vec->pkgs[i]->state_status == SS_INSTALLED || vec->pkgs[i]->state_status == SS_UNPACKED) - && vec->pkgs[i]->dest == dest) - return vec->pkgs[i]; - - return NULL; -} - -pkg_t *pkg_hash_fetch_installed_by_name(hash_table_t *hash, - const char *pkg_name) -{ - pkg_vec_t * vec; - register int i; - - if(!(vec = pkg_vec_fetch_by_name(hash, pkg_name))) - return NULL; - - for(i = 0; i < vec->len; i++) - if (vec->pkgs[i]->state_status == SS_INSTALLED || vec->pkgs[i]->state_status == SS_UNPACKED) + for(i = 0; i < vec->len; i++) { + if(( vec->pkgs[i]->state_want == SW_INSTALL || + vec->pkgs[i]->state_status == SS_INSTALLED || + vec->pkgs[i]->state_status == SS_UNPACKED) + && (dest==0 || vec->pkgs[i]->dest == dest) ) { return vec->pkgs[i]; + } + } return NULL; } Index: pkg_hash.h =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/pkg_hash.h,v retrieving revision 1.19 diff -u -r1.19 pkg_hash.h --- pkg_hash.h 10 Apr 2003 21:43:51 -0000 1.19 +++ pkg_hash.h 2 Apr 2004 22:43:27 -0000 @@ -45,11 +45,12 @@ pkg_t *pkg_hash_fetch_best_installation_candidate(ipkg_conf_t *conf, abstract_pkg_t *apkg, int (*constraint_fcn)(pkg_t *pkg, void *data), void *cdata); pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(ipkg_conf_t *conf, const char *name); -pkg_t *pkg_hash_fetch_installed_by_name(hash_table_t *hash, - const char *pkg_name); pkg_t *pkg_hash_fetch_installed_by_name_dest(hash_table_t *hash, const char *pkg_name, pkg_dest_t *dest); +#define pkg_hash_fetch_installed_by_name(hash,pkg_name) \ + pkg_hash_fetch_installed_by_name_dest(hash,pkg_name,0) + pkg_t *file_hash_get_file_owner(ipkg_conf_t *conf, const char *file_name); int file_hash_set_file_owner(ipkg_conf_t *conf, const char *file_name, pkg_t *pkg); Index: pkg_parse.c =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/pkg_parse.c,v retrieving revision 1.29 diff -u -r1.29 pkg_parse.c --- pkg_parse.c 17 Mar 2004 21:17:37 -0000 1.29 +++ pkg_parse.c 2 Apr 2004 22:43:27 -0000 @@ -102,7 +102,7 @@ } } -int parseVersion(pkg_t *pkg, char *raw) +int parseVersion(pkg_t *pkg, const char *raw) { char *colon, *eepochcolon; #ifdef USE_DEBVERSION Index: pkg_parse.h =================================================================== RCS file: /cvs/familiar/dist/ipkg/C/pkg_parse.h,v retrieving revision 1.8 diff -u -r1.8 pkg_parse.h --- pkg_parse.h 17 Mar 2004 21:17:37 -0000 1.8 +++ pkg_parse.h 2 Apr 2004 22:43:27 -0000 @@ -21,9 +21,8 @@ int isGenericFieldType(char * type, char * line); char * parseGenericFieldType(char * type, char * raw); void parseStatus(pkg_t *pkg, char * raw); -int parseVersion(pkg_t *pkg, char *raw); +int parseVersion(pkg_t *pkg, const char *raw); char ** parseDependsString(char * raw, int * depends_count); -int parseVersion(pkg_t *pkg, char *raw); void parseConffiles(pkg_t * pkg, char * raw); int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest); int pkg_valorize_other_field(pkg_t *pkg, char ***raw);