summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2005-02-06 18:27:25 +0000
committerJason Woodward2005-02-06 18:27:25 +0000
commit01e76778ec62a5b77b4b23b23a71c4ecaa8fc219 (patch)
tree1759861eadece09915ef9355f8c184ea447b18d2 /src
parentfaf3bf4d64e7685444334dac247e93b7812ad1be (diff)
downloadslapt-get-01e76778ec62a5b77b4b23b23a71c4ecaa8fc219.tar.gz
simplified add_deps_to_trans()
Diffstat (limited to 'src')
-rw-r--r--src/transaction.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/src/transaction.c b/src/transaction.c
index c7c4c4f..4428014 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -579,40 +579,24 @@ int add_deps_to_trans(const rc_config *global_config, transaction_t *tran, struc
/* loop through the deps */
for(c = 0; c < deps->pkg_count;c++){
+ pkg_info_t *dep_installed;
+ pkg_info_t *conflicted_pkg = NULL;
- /* only check if it is not already present in trans */
- if( search_transaction(tran,deps->pkgs[c]->name) == 0 ){
+ /*
+ * the dep wouldn't get this far if it where excluded,
+ * so we don't check for that here
+ */
- pkg_info_t *dep_installed;
-
- /*
- * the dep wouldn't get this far if it where excluded,
- * so we don't check for that here
- */
-
- if( (dep_installed = get_newest_pkg(installed_pkgs,deps->pkgs[c]->name)) == NULL ){
- pkg_info_t *conflicted_pkg = NULL;
-
- if ( (conflicted_pkg = is_conflicted(tran,avail_pkgs,installed_pkgs,deps->pkgs[c])) != NULL ){
- add_remove_to_transaction(tran,conflicted_pkg);
- }
- add_install_to_transaction(tran,deps->pkgs[c]);
-
- }else{
-
- /* add only if its a valid upgrade */
- if(cmp_pkg_versions(dep_installed->version,deps->pkgs[c]->version) < 0 ){
- pkg_info_t *conflicted_pkg = NULL;
-
- if ( (conflicted_pkg = is_conflicted(tran,avail_pkgs,installed_pkgs,deps->pkgs[c])) != NULL ){
- add_remove_to_transaction(tran,conflicted_pkg);
- }
- add_upgrade_to_transaction(tran,dep_installed,deps->pkgs[c]);
-
- }
-
- }
+ if ( (conflicted_pkg = is_conflicted(tran,avail_pkgs,installed_pkgs,deps->pkgs[c])) != NULL ){
+ add_remove_to_transaction(tran,conflicted_pkg);
+ }
+ if( (dep_installed = get_newest_pkg(installed_pkgs,deps->pkgs[c]->name)) == NULL ){
+ add_install_to_transaction(tran,deps->pkgs[c]);
+ }else{
+ /* add only if its a valid upgrade */
+ if(cmp_pkg_versions(dep_installed->version,deps->pkgs[c]->version) < 0 )
+ add_upgrade_to_transaction(tran,dep_installed,deps->pkgs[c]);
}
}