Changeset 4849
- Timestamp:
- 12/05/08 04:37:48 (5 years ago)
- Location:
- trunk/src/target/opkg/libopkg
- Files:
-
- 6 edited
-
args.c (modified) (1 diff)
-
opkg.c (modified) (1 diff)
-
opkg_cmd.c (modified) (3 diffs)
-
opkg_upgrade.c (modified) (1 diff)
-
opkg_upgrade.h (modified) (1 diff)
-
pkg_vec.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/opkg/libopkg/args.c
r4818 r4849 268 268 printf("\tlist List available packages and descriptions\n"); 269 269 printf("\tlist_installed List all and only the installed packages and description \n"); 270 printf("\tlist_upgradable List all the installed and upgradable packages\n"); 270 271 printf("\tfiles <pkg> List all files belonging to <pkg>\n"); 271 272 printf("\tsearch <file|regexp> Search for a package providing <file>\n"); -
trunk/src/target/opkg/libopkg/opkg.c
r4838 r4849 930 930 opkg_list_upgradable_packages (opkg_t *opkg, opkg_package_callback_t callback, void *user_data) 931 931 { 932 pkg_vec_t *all; 933 int i; 934 935 opkg_assert (opkg); 936 opkg_assert (callback); 937 938 /* ensure all data is valid */ 939 pkg_info_preinstall_check (opkg->conf); 940 941 all = pkg_vec_alloc (); 942 pkg_hash_fetch_available (&opkg->conf->pkg_hash, all); 943 for (i = 0; i < all->len; i++) 944 { 945 pkg_t *old, *new; 946 int cmp; 947 opkg_package_t *package; 948 949 old = all->pkgs[i]; 950 951 if (old->state_status != SS_INSTALLED) 952 continue; 953 954 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name, NULL); 955 if (new == NULL) { 956 /* XXX: Notice: Assuming locally install package is up to date */ 957 continue; 958 } 959 960 cmp = pkg_compare_versions(old, new); 961 962 if (cmp < 0) 963 { 964 package = old_pkg_to_new (new); 965 callback (opkg, package, user_data); 966 opkg_package_free (package); 967 } 968 } 969 970 pkg_vec_free (all); 971 972 return 0; 932 pkg_vec_t *all; 933 int i; 934 935 opkg_assert (opkg); 936 opkg_assert (callback); 937 938 /* ensure all data is valid */ 939 pkg_info_preinstall_check (opkg->conf); 940 941 all = opkg_upgrade_all_list_get (opkg->conf); 942 for (i = 0; i < all->len; i++) 943 { 944 pkg_t *old, *new; 945 opkg_package_t *package; 946 947 old = all->pkgs[i]; 948 949 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name, NULL); 950 951 package = old_pkg_to_new (new); 952 callback (opkg, package, user_data); 953 opkg_package_free (package); 954 } 955 956 pkg_vec_free (all); 957 958 return 0; 973 959 } 974 960 -
trunk/src/target/opkg/libopkg/opkg_cmd.c
r4844 r4849 56 56 static int opkg_install_cmd(opkg_conf_t *conf, int argc, char **argv); 57 57 static int opkg_list_installed_cmd(opkg_conf_t *conf, int argc, char **argv); 58 static int opkg_list_upgradable_cmd(opkg_conf_t *conf, int argc, char **argv); 58 59 static int opkg_remove_cmd(opkg_conf_t *conf, int argc, char **argv); 59 60 static int opkg_purge_cmd(opkg_conf_t *conf, int argc, char **argv); … … 82 83 {"list", 0, (opkg_cmd_fun_t)opkg_list_cmd}, 83 84 {"list_installed", 0, (opkg_cmd_fun_t)opkg_list_installed_cmd}, 85 {"list_upgradable", 0, (opkg_cmd_fun_t)opkg_list_upgradable_cmd}, 84 86 {"info", 0, (opkg_cmd_fun_t)opkg_info_cmd}, 85 87 {"flag", 1, (opkg_cmd_fun_t)opkg_flag_cmd}, … … 781 783 782 784 return 0; 785 } 786 787 static int opkg_list_upgradable_cmd(opkg_conf_t *conf, int argc, char **argv) 788 { 789 pkg_vec_t *all = opkg_upgrade_all_list_get(conf); 790 pkg_t *_old_pkg, *_new_pkg; 791 char *old_v, *new_v; 792 int i; 793 for (i=0;i<all->len;i++) { 794 _old_pkg = all->pkgs[i]; 795 _new_pkg = pkg_hash_fetch_best_installation_candidate_by_name(conf, _old_pkg->name, NULL); 796 old_v = pkg_version_str_alloc(_old_pkg); 797 new_v = pkg_version_str_alloc(_new_pkg); 798 if (opkg_cb_list) 799 opkg_cb_list(_old_pkg->name, new_v, old_v, _old_pkg->state_status, p_userdata); 800 free(old_v); 801 free(new_v); 802 } 803 pkg_vec_free(all); 804 return 0; 783 805 } 784 806 -
trunk/src/target/opkg/libopkg/opkg_upgrade.c
r4847 r4849 78 78 return opkg_install_pkg(conf, new,1); 79 79 } 80 81 82 83 pkg_vec_t *opkg_upgrade_all_list_get(opkg_conf_t *conf) { 84 pkg_vec_t *all, *ans; 85 int i; 86 87 /* ensure all data is valid */ 88 pkg_info_preinstall_check (conf); 89 90 all = pkg_vec_alloc (); 91 ans = pkg_vec_alloc (); 92 pkg_hash_fetch_all_installed (&conf->pkg_hash, all); 93 for (i = 0; i < all->len; i++) 94 { 95 pkg_t *old, *new; 96 int cmp; 97 98 old = all->pkgs[i]; 99 new = pkg_hash_fetch_best_installation_candidate_by_name(conf, old->name, NULL); 100 101 if (new == NULL) 102 continue; 103 104 cmp = pkg_compare_versions(old, new); 105 106 if ( cmp < 0 ) 107 pkg_vec_insert(ans, old); 108 } 109 pkg_vec_free (all); 110 return ans; 111 } -
trunk/src/target/opkg/libopkg/opkg_upgrade.h
r4357 r4849 15 15 16 16 int opkg_upgrade_pkg(opkg_conf_t *conf, pkg_t *old); 17 pkg_vec_t *opkg_upgrade_all_list_get(opkg_conf_t *conf); -
trunk/src/target/opkg/libopkg/pkg_vec.h
r4357 r4849 43 43 void marry_two_packages(pkg_t * newpkg, pkg_t * oldpkg); 44 44 45 void pkg_vec_add(pkg_vec_t *vec, pkg_t *pkg);46 45 /* pkg_vec_insert_merge: might munge pkg. 47 46 * returns the pkg that is in the pkg graph */
Note: See TracChangeset
for help on using the changeset viewer.
