aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2004-11-08 15:59:49 +0000
committerJason Woodward2004-11-08 15:59:49 +0000
commit0574a14591740ca29f41db2c2973840b7f114cf5 (patch)
tree5bf2efc8b89025b63ff095844244627928347b95
parentae1f0e50160344c39b5a9aedd7b1a11f130d66c7 (diff)
downloadslapt-get-0574a14591740ca29f41db2c2973840b7f114cf5.tar.gz
updated --install target to assume package being requested is higher priority than existing installed package when there is a conflict. updated is_conflicted() to return the conflicted pkg;
-rw-r--r--ChangeLog5
-rw-r--r--src/action.c67
2 files changed, 48 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f6ad45..d47bb29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
-0.9.9d Nov 05, 2004
+0.9.9d Nov 08, 2004
+ * updated --install target to assume package being requested is higher priority
+ than existing installed package when there is a conflict
+ * updated is_conflicted() to return the conflicted pkg;
* added zlib as required to slack-required
* --install no longer recursively install deps that where excluded
* updated FAQ, updating #9 concerning dist-upgrade
diff --git a/src/action.c b/src/action.c
index 3c5ada4..7bef8e2 100644
--- a/src/action.c
+++ b/src/action.c
@@ -90,9 +90,14 @@ void pkg_action_install(const rc_config *global_config,const pkg_action_args_t *
if( installed_pkg == NULL ){
if( add_deps_to_trans(global_config,&tran,avail_pkgs,installed_pkgs,pkg) == 0 ){
- /* this way we install the most up to date pkg */
- if ( is_conflicted(&tran,avail_pkgs,installed_pkgs,pkg) == 0 )
- add_install_to_transaction(&tran,pkg);
+ pkg_info_t *conflicted_pkg = NULL;
+
+ /* if there is a conflict, we schedule the conflict for removal */
+ if ( (conflicted_pkg = is_conflicted(&tran,avail_pkgs,installed_pkgs,pkg)) != NULL ){
+ add_remove_to_transaction(&tran,conflicted_pkg);
+ }
+ add_install_to_transaction(&tran,pkg);
+
}else{
add_exclude_to_transaction(&tran,pkg);
}
@@ -106,8 +111,13 @@ void pkg_action_install(const rc_config *global_config,const pkg_action_args_t *
){
if( add_deps_to_trans(global_config,&tran,avail_pkgs,installed_pkgs,pkg) == 0 ){
- if ( is_conflicted(&tran,avail_pkgs,installed_pkgs,pkg) == 0 )
- add_upgrade_to_transaction(&tran,installed_pkg,pkg);
+ pkg_info_t *conflicted_pkg = NULL;
+
+ if ( (conflicted_pkg = is_conflicted(&tran,avail_pkgs,installed_pkgs,pkg)) != NULL ){
+ add_remove_to_transaction(&tran,conflicted_pkg);
+ }
+ add_upgrade_to_transaction(&tran,installed_pkg,pkg);
+
}else{
add_exclude_to_transaction(&tran,pkg);
}
@@ -401,15 +411,19 @@ void pkg_action_upgrade_all(const rc_config *global_config){
)
){
- if( add_deps_to_trans(global_config,&tran,avail_pkgs,installed_pkgs,update_pkg) == 0 ){
- if( is_excluded(global_config,update_pkg) == 1 ){
- add_exclude_to_transaction(&tran,update_pkg);
+ if( is_excluded(global_config,update_pkg) == 1 ){
+ add_exclude_to_transaction(&tran,update_pkg);
+ }else{
+ /* if all deps are added and there is no conflicts, add on */
+ if(
+ (add_deps_to_trans(global_config,&tran,avail_pkgs,installed_pkgs,update_pkg) == 0)
+ && ( is_conflicted(&tran,avail_pkgs,installed_pkgs,update_pkg) == NULL )
+ ){
+ add_upgrade_to_transaction(&tran,installed_pkgs->pkgs[i],update_pkg);
}else{
- if ( is_conflicted(&tran,avail_pkgs,installed_pkgs,update_pkg) == 0 )
- add_upgrade_to_transaction(&tran,installed_pkgs->pkgs[i],update_pkg);
+ /* otherwise exclude */
+ add_exclude_to_transaction(&tran,update_pkg);
}
- }else{
- add_exclude_to_transaction(&tran,update_pkg);
}
}
@@ -419,13 +433,12 @@ void pkg_action_upgrade_all(const rc_config *global_config){
}/* end for */
if( global_config->dist_upgrade == 1 ){
- struct pkg_list *matches;
+ struct pkg_list *matches = search_pkg_list(avail_pkgs,SLACK_BASE_SET_REGEX);
- matches = search_pkg_list(avail_pkgs,SLACK_BASE_SET_REGEX);
for(i = 0; i < matches->pkg_count; i++){
- pkg_info_t *installed_pkg;
- pkg_info_t *newer_avail_pkg;
- pkg_info_t *upgrade_pkg;
+ pkg_info_t *installed_pkg = NULL;
+ pkg_info_t *newer_avail_pkg = NULL;
+ pkg_info_t *upgrade_pkg = NULL;
installed_pkg = get_newest_pkg(
installed_pkgs,
@@ -448,10 +461,14 @@ void pkg_action_upgrade_all(const rc_config *global_config){
add_exclude_to_transaction(&tran,upgrade_pkg);
}else{
- if( add_deps_to_trans(global_config,&tran,avail_pkgs,installed_pkgs,upgrade_pkg) == 0 ){
- if ( is_conflicted(&tran,avail_pkgs,installed_pkgs,upgrade_pkg) == 0 )
- add_install_to_transaction(&tran,upgrade_pkg);
+ /* add install if all deps are good and it doesn't have conflicts */
+ if(
+ (add_deps_to_trans(global_config,&tran,avail_pkgs,installed_pkgs,upgrade_pkg) == 0)
+ && ( is_conflicted(&tran,avail_pkgs,installed_pkgs,upgrade_pkg) == NULL )
+ ){
+ add_install_to_transaction(&tran,upgrade_pkg);
}else{
+ /* otherwise exclude */
add_exclude_to_transaction(&tran,upgrade_pkg);
}
@@ -467,10 +484,14 @@ void pkg_action_upgrade_all(const rc_config *global_config){
if( is_excluded(global_config,upgrade_pkg) == 1 ){
add_exclude_to_transaction(&tran,upgrade_pkg);
}else{
- if( add_deps_to_trans(global_config,&tran,avail_pkgs,installed_pkgs,upgrade_pkg) == 0 ){
- if ( is_conflicted(&tran,avail_pkgs,installed_pkgs,upgrade_pkg) == 0 )
- add_upgrade_to_transaction(&tran,installed_pkg,upgrade_pkg);
+ /* if all deps are added and there is no conflicts, add on */
+ if(
+ (add_deps_to_trans(global_config,&tran,avail_pkgs,installed_pkgs,upgrade_pkg) == 0)
+ && ( is_conflicted(&tran,avail_pkgs,installed_pkgs,upgrade_pkg) == NULL )
+ ){
+ add_upgrade_to_transaction(&tran,installed_pkg,upgrade_pkg);
}else{
+ /* otherwise exclude */
add_exclude_to_transaction(&tran,upgrade_pkg);
}
}