Changeset 4466
- Timestamp:
- 06/02/08 18:11:25 (5 years ago)
- Location:
- trunk/src/target/opkg/libopkg
- Files:
-
- 10 edited
-
opkg.c (modified) (5 diffs)
-
opkg_cmd.c (modified) (5 diffs)
-
opkg_error.h (modified) (1 diff)
-
opkg_install.c (modified) (15 diffs)
-
opkg_install.h (modified) (1 diff)
-
opkg_upgrade.c (modified) (1 diff)
-
pkg.c (modified) (1 diff)
-
pkg_depends.c (modified) (2 diffs)
-
pkg_hash.c (modified) (5 diffs)
-
pkg_hash.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/opkg/libopkg/opkg.c
r4465 r4466 28 28 #include "opkg_remove.h" 29 29 #include "opkg_upgrade.h" 30 #include "opkg_error.h" 30 31 31 32 #include "sprintf_alloc.h" … … 386 387 } 387 388 388 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, package_name );389 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, package_name, NULL); 389 390 if (!new) 390 391 { … … 490 491 switch (err) 491 492 { 492 case PKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;493 case PKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;494 case PKG_INSTALL_ERR_DEPENDENCIES:495 case PKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;496 case PKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;497 case PKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;498 case PKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;493 case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR; 494 case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED; 495 case OPKG_INSTALL_ERR_DEPENDENCIES: 496 case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED; 497 case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED; 498 case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR; 499 case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR; 499 500 default: return OPKG_UNKNOWN_ERROR; 500 501 } … … 626 627 switch (err) 627 628 { 628 case PKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR;629 case PKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED;630 case PKG_INSTALL_ERR_DEPENDENCIES:631 case PKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED;632 case PKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED;633 case PKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR;634 case PKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR;629 case OPKG_INSTALL_ERR_NOT_TRUSTED: return OPKG_GPG_ERROR; 630 case OPKG_INSTALL_ERR_DOWNLOAD: return OPKG_DOWNLOAD_FAILED; 631 case OPKG_INSTALL_ERR_DEPENDENCIES: 632 case OPKG_INSTALL_ERR_CONFLICTS: return OPKG_DEPENDENCIES_FAILED; 633 case OPKG_INSTALL_ERR_ALREADY_INSTALLED: return OPKG_PACKAGE_ALREADY_INSTALLED; 634 case OPKG_INSTALL_ERR_SIGNATURE: return OPKG_GPG_ERROR; 635 case OPKG_INSTALL_ERR_MD5: return OPKG_MD5_ERROR; 635 636 default: return OPKG_UNKNOWN_ERROR; 636 637 } … … 918 919 continue; 919 920 920 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name );921 new = pkg_hash_fetch_best_installation_candidate_by_name(opkg->conf, old->name, NULL); 921 922 if (new == NULL) { 922 923 /* XXX: Notice: Assuming locally install package is up to date */ -
trunk/src/target/opkg/libopkg/opkg_cmd.c
r4448 r4466 117 117 pkg_write_changed_filelists(conf); 118 118 } else { 119 opkg_message(conf, OPKG_ NOTICE, "Nothing to be done\n");119 opkg_message(conf, OPKG_DEBUG, "Nothing to be done\n"); 120 120 } 121 121 } … … 147 147 result = (cmd->fun)(conf, argc, argv); 148 148 149 if ( result != 0 ) {149 if ( result != 0 && !error_list) { 150 150 opkg_message(conf, OPKG_NOTICE, "An error ocurred, return value: %d.\n", result); 151 151 } … … 157 157 /* Here we print the errors collected and free the list */ 158 158 while (error_list != NULL) { 159 opkg_message(conf, OPKG_NOTICE, " %s",error_list->errmsg);159 opkg_message(conf, OPKG_NOTICE, " * %s", error_list->errmsg); 160 160 error_list = error_list->next; 161 161 … … 594 594 if (err == OPKG_PKG_HAS_NO_CANDIDATE) { 595 595 opkg_message(conf, OPKG_ERROR, 596 "Cannot find package %s.\n" 597 "Check the spelling or perhaps run 'opkg update'\n", 596 "Cannot find package %s.\n", 598 597 arg); 599 598 } … … 684 683 arg = argv[i]; 685 684 686 pkg = pkg_hash_fetch_best_installation_candidate_by_name(conf, arg );685 pkg = pkg_hash_fetch_best_installation_candidate_by_name(conf, arg, &err); 687 686 if (pkg == NULL) { 688 687 opkg_message(conf, OPKG_ERROR, -
trunk/src/target/opkg/libopkg/opkg_error.h
r4345 r4466 18 18 19 19 enum opkg_error { 20 OPKG_SUCCESS = 0, 21 OPKG_PKG_DEPS_UNSATISFIED, 22 OPKG_PKG_IS_ESSENTIAL, 23 OPKG_PKG_HAS_DEPENDENTS, 24 OPKG_PKG_HAS_NO_CANDIDATE 20 OPKG_ERR_UNKNOWN = -1, 21 OPKG_ERR_NONE = 0, 22 23 OPKG_PKG_DEPS_UNSATISFIED, 24 OPKG_PKG_IS_ESSENTIAL, 25 OPKG_PKG_HAS_DEPENDENTS, 26 OPKG_PKG_HAS_NO_CANDIDATE, 27 OPKG_PKG_HAS_NO_AVAILABLE_ARCH, 28 29 OPKG_INSTALL_ERR_NOT_TRUSTED, 30 OPKG_INSTALL_ERR_DOWNLOAD, 31 OPKG_INSTALL_ERR_CONFLICTS, 32 OPKG_INSTALL_ERR_ALREADY_INSTALLED, 33 OPKG_INSTALL_ERR_DEPENDENCIES, 34 OPKG_INSTALL_ERR_NO_DOWNGRADE, 35 OPKG_INSTALL_ERR_NO_SPACE, 36 OPKG_INSTALL_ERR_SIGNATURE, 37 OPKG_INSTALL_ERR_MD5, 38 OPKG_INSTALL_ERR_INTERNAL, 39 25 40 }; 26 41 typedef enum opkg_error opkg_error_t; -
trunk/src/target/opkg/libopkg/opkg_install.c
r4458 r4466 138 138 opkg_error_t opkg_install_by_name(opkg_conf_t *conf, const char *pkg_name) 139 139 { 140 int cmp ;140 int cmp, err; 141 141 pkg_t *old, *new; 142 142 char *old_version, *new_version; … … 148 148 149 149 opkg_message(conf, OPKG_DEBUG2, " Getting new from pkg_hash_fetch \n" ); 150 new = pkg_hash_fetch_best_installation_candidate_by_name(conf, pkg_name );150 new = pkg_hash_fetch_best_installation_candidate_by_name(conf, pkg_name, &err); 151 151 if ( new ) 152 152 opkg_message(conf, OPKG_DEBUG2, " New versions from pkg_hash_fetch %s \n", new->version ); … … 166 166 167 167 if (new == NULL) { 168 return OPKG_PKG_HAS_NO_CANDIDATE; 168 if (err) 169 return err; 170 else 171 return OPKG_PKG_HAS_NO_CANDIDATE; 169 172 } 170 173 … … 308 311 return 0; 309 312 } 310 313 #if 0 311 314 int name_mark_dependencies_for_installation(opkg_conf_t *conf, const char *pkg_name, pkg_vec_t *pkgs_needed) 312 315 { … … 361 364 } 362 365 363 366 #endif 364 367 365 368 int satisfy_dependencies_for(opkg_conf_t *conf, pkg_t *pkg) … … 763 766 opkg_message(conf, OPKG_ERROR, 764 767 "INTERNAL ERROR: null pkg passed to opkg_install_pkg\n"); 765 return PKG_INSTALL_ERR_INTERNAL;768 return OPKG_INSTALL_ERR_INTERNAL; 766 769 } 767 770 … … 771 774 opkg_message(conf, OPKG_ERROR, "INTERNAL ERROR: architecture %s for pkg %s is unsupported.\n", 772 775 pkg->architecture, pkg->name); 773 return PKG_INSTALL_ERR_INTERNAL;776 return OPKG_INSTALL_ERR_INTERNAL; 774 777 } 775 778 if (pkg->state_status == SS_INSTALLED && conf->force_reinstall == 0 && conf->nodeps == 0) { 776 779 err = satisfy_dependencies_for(conf, pkg); 777 if (err) { return PKG_INSTALL_ERR_DEPENDENCIES; }780 if (err) { return OPKG_INSTALL_ERR_DEPENDENCIES; } 778 781 779 782 opkg_message(conf, OPKG_NOTICE, … … 790 793 791 794 err = opkg_install_check_downgrade(conf, pkg, old_pkg, message); 792 if (err) { return PKG_INSTALL_ERR_NO_DOWNGRADE; }795 if (err) { return OPKG_INSTALL_ERR_NO_DOWNGRADE; } 793 796 794 797 pkg->state_want = SW_INSTALL; … … 800 803 /* Abhaya: conflicts check */ 801 804 err = check_conflicts_for(conf, pkg); 802 if (err) { return PKG_INSTALL_ERR_CONFLICTS; }805 if (err) { return OPKG_INSTALL_ERR_CONFLICTS; } 803 806 804 807 /* this setup is to remove the upgrade scenario in the end when … … 810 813 811 814 err = verify_pkg_installable(conf, pkg); 812 if (err) { return PKG_INSTALL_ERR_NO_SPACE; }815 if (err) { return OPKG_INSTALL_ERR_NO_SPACE; } 813 816 814 817 if (pkg->local_filename == NULL) { … … 818 821 "Failed to download %s. Perhaps you need to run 'opkg update'?\n", 819 822 pkg->name); 820 return PKG_INSTALL_ERR_DOWNLOAD;823 return OPKG_INSTALL_ERR_DOWNLOAD; 821 824 } 822 825 } … … 836 839 { 837 840 if (opkg_verify_file (conf, list_file_name, sig_file_name)) 838 return PKG_INSTALL_ERR_SIGNATURE;841 return OPKG_INSTALL_ERR_SIGNATURE; 839 842 } 840 843 … … 854 857 pkg->name); 855 858 free(file_md5); 856 return PKG_INSTALL_ERR_MD5;859 return OPKG_INSTALL_ERR_MD5; 857 860 } 858 861 free(file_md5); … … 867 870 /* That's rather strange that files don't change owner. Investigate !!!!!!*/ 868 871 err = update_file_ownership(conf, pkg, old_pkg); 869 if (err) { return PKG_INSTALL_ERR_UNKNOWN; }872 if (err) { return OPKG_ERR_UNKNOWN; } 870 873 871 874 if (conf->nodeps == 0) { 872 875 err = satisfy_dependencies_for(conf, pkg); 873 if (err) { return PKG_INSTALL_ERR_DEPENDENCIES; }876 if (err) { return OPKG_INSTALL_ERR_DEPENDENCIES; } 874 877 } 875 878 … … 1020 1023 1021 1024 pkg_vec_free (replacees); 1022 return PKG_INSTALL_ERR_UNKNOWN;1025 return OPKG_ERR_UNKNOWN; 1023 1026 } 1024 1027 opkg_set_current_state (conf, OPKG_STATE_NONE, NULL); -
trunk/src/target/opkg/libopkg/opkg_install.h
r4458 r4466 23 23 #include "opkg_error.h" 24 24 25 enum {26 PKG_INSTALL_ERR_NONE,27 PKG_INSTALL_ERR_NOT_TRUSTED,28 PKG_INSTALL_ERR_DOWNLOAD,29 PKG_INSTALL_ERR_CONFLICTS,30 PKG_INSTALL_ERR_ALREADY_INSTALLED,31 PKG_INSTALL_ERR_DEPENDENCIES,32 PKG_INSTALL_ERR_NO_DOWNGRADE,33 PKG_INSTALL_ERR_NO_SPACE,34 PKG_INSTALL_ERR_SIGNATURE,35 PKG_INSTALL_ERR_MD5,36 PKG_INSTALL_ERR_INTERNAL,37 PKG_INSTALL_ERR_UNKNOWN38 };39 40 25 opkg_error_t opkg_install_by_name(opkg_conf_t *conf, const char *pkg_name); 41 26 opkg_error_t opkg_install_multi_by_name(opkg_conf_t *conf, const char *pkg_name); -
trunk/src/target/opkg/libopkg/opkg_upgrade.c
r4443 r4466 34 34 } 35 35 36 new = pkg_hash_fetch_best_installation_candidate_by_name(conf, old->name );36 new = pkg_hash_fetch_best_installation_candidate_by_name(conf, old->name, NULL); 37 37 if (new == NULL) { 38 38 old_version = pkg_version_str_alloc(old); -
trunk/src/target/opkg/libopkg/pkg.c
r4448 r4466 1714 1714 if (!pkg->arch_priority && (pkg->state_flag || (pkg->state_want != SW_UNKNOWN))) { 1715 1715 /* clear flags and want for any uninstallable package */ 1716 opkg_message(conf, OPKG_ NOTICE, "Clearing state_want and state_flag for pkg=%s (arch_priority=%d flag=%d want=%d)\n",1716 opkg_message(conf, OPKG_DEBUG, "Clearing state_want and state_flag for pkg=%s (arch_priority=%d flag=%d want=%d)\n", 1717 1717 pkg->name, pkg->arch_priority, pkg->state_flag, pkg->state_want); 1718 1718 pkg->state_want = SW_UNKNOWN; -
trunk/src/target/opkg/libopkg/pkg_depends.c
r4445 r4466 174 174 pkg_hash_fetch_best_installation_candidate(conf, satisfying_apkg, 175 175 pkg_installed_and_constraint_satisfied, 176 dependence_to_satisfy, 1 );176 dependence_to_satisfy, 1, NULL); 177 177 /* Being that I can't test constraing in pkg_hash, I will test it here */ 178 178 if (satisfying_pkg != NULL) { … … 198 198 pkg_hash_fetch_best_installation_candidate(conf, satisfying_apkg, 199 199 pkg_constraint_satisfied, 200 dependence_to_satisfy, 1 );200 dependence_to_satisfy, 1, NULL); 201 201 /* Being that I can't test constraing in pkg_hash, I will test it here too */ 202 202 if (satisfying_pkg != NULL) { -
trunk/src/target/opkg/libopkg/pkg_hash.c
r4445 r4466 171 171 172 172 pkg_t *pkg_hash_fetch_best_installation_candidate(opkg_conf_t *conf, abstract_pkg_t *apkg, 173 int (*constraint_fcn)(pkg_t *pkg, void *cdata), void *cdata, int quiet )173 int (*constraint_fcn)(pkg_t *pkg, void *cdata), void *cdata, int quiet, int *err) 174 174 { 175 175 int i; … … 186 186 pkg_t *good_pkg_by_name = NULL; 187 187 188 if (err) 189 *err = 0; 190 188 191 if (matching_apkgs == NULL || providers == NULL || 189 192 apkg == NULL || apkg->provided_by == NULL || (apkg->provided_by->len == 0)) … … 252 255 } 253 256 } 257 258 if (vec->len > 0 && matching_pkgs->len < 1) 259 { 260 opkg_message (conf, OPKG_ERROR, " Packages found, but none available for the current " 261 "architecture\n"); 262 if (err) 263 *err = OPKG_PKG_HAS_NO_AVAILABLE_ARCH; 264 } 254 265 } 255 266 } … … 352 363 } 353 364 354 pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(opkg_conf_t *conf, const char *name )365 pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(opkg_conf_t *conf, const char *name, int *err) 355 366 { 356 367 hash_table_t *hash = &conf->pkg_hash; 357 368 abstract_pkg_t *apkg = NULL; 369 pkg_t *ret; 358 370 359 371 if (!(apkg = abstract_pkg_fetch_by_name(hash, name))) 360 372 return NULL; 361 362 return pkg_hash_fetch_best_installation_candidate(conf, apkg, pkg_name_constraint_fcn, apkg->name, 0); 373 374 ret = pkg_hash_fetch_best_installation_candidate(conf, apkg, pkg_name_constraint_fcn, apkg->name, 0, err); 375 376 return ret; 363 377 } 364 378 … … 518 532 while (dependents [i] != NULL && i < ab_pkg->provided_by->len) 519 533 printf ("\tprovided by - %s\n", dependents [i ++]->name); 520 pkg = pkg_hash_fetch_best_installation_candidate_by_name (conf, ab_pkg->name );534 pkg = pkg_hash_fetch_best_installation_candidate_by_name (conf, ab_pkg->name, NULL); 521 535 if (pkg) { 522 536 i = 0; -
trunk/src/target/opkg/libopkg/pkg_hash.h
r4357 r4466 46 46 abstract_pkg_vec_t *pkg_hash_fetch_all_installation_candidates(hash_table_t *hash, const char *name); 47 47 pkg_t *pkg_hash_fetch_best_installation_candidate(opkg_conf_t *conf, abstract_pkg_t *apkg, 48 int (*constraint_fcn)(pkg_t *pkg, void *data), void *cdata, int quiet );49 pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(opkg_conf_t *conf, const char *name );48 int (*constraint_fcn)(pkg_t *pkg, void *data), void *cdata, int quiet, int *error); 49 pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(opkg_conf_t *conf, const char *name, int *err); 50 50 pkg_t *pkg_hash_fetch_installed_by_name(hash_table_t *hash, 51 51 const char *pkg_name);
Note: See TracChangeset
for help on using the changeset viewer.
