aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2003-10-13 22:15:18 +0000
committerJason Woodward2003-10-13 22:15:18 +0000
commit084bb4d563ee238b6a0851cf5906c1769800aad4 (patch)
treed95760d0ec9cdb626fa63b021e2b6612072fba1a
parent0f40db501d84c023f6c90e5350ec193ecaf976c4 (diff)
downloadslapt-get-084bb4d563ee238b6a0851cf5906c1769800aad4.tar.gz
added excludes to transaction, now shows packages excluded/held back
-rw-r--r--ChangeLog1
-rw-r--r--src/action.c5
-rw-r--r--src/transaction.c40
-rw-r--r--src/transaction.h2
4 files changed, 44 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1835753..d4bb175 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@
get_mirror_data_from_source.
* merged in package update data from filelist into PACKAGES.TXT format,
so single lookup returns all packages.
+ * added excludes to transaction, now shows packages excluded/held back
0.9.5e Oct 10, 2003
* added a doinst.sh script (generated from the Makefile) to help
diff --git a/src/action.c b/src/action.c
index 20adc7a..54641f7 100644
--- a/src/action.c
+++ b/src/action.c
@@ -302,6 +302,11 @@ void pkg_action_upgrade_all(const rc_config *global_config){
);
if( update_pkg != NULL ){
+ if( is_excluded(global_config,update_pkg->name) == 1 ){
+ add_exclude_to_transaction(&tran,update_pkg);
+ continue;
+ }
+
/* if the update has a newer version */
if( (cmp_pkg_versions(installed_pkgs->pkgs[iterator]->version,update_pkg->version)) < 0 ){
diff --git a/src/transaction.c b/src/transaction.c
index a4f6fcf..be2244e 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -23,14 +23,17 @@ void init_transaction(transaction *tran){
tran->install_pkgs = malloc( sizeof *tran->install_pkgs );
tran->remove_pkgs = malloc( sizeof *tran->remove_pkgs );
tran->upgrade_pkgs = malloc( sizeof *tran->upgrade_pkgs );
+ tran->exclude_pkgs = malloc( sizeof *tran->exclude_pkgs );
tran->install_pkgs->pkgs = malloc( sizeof *tran->install_pkgs->pkgs );
tran->remove_pkgs->pkgs = malloc( sizeof *tran->remove_pkgs->pkgs );
tran->upgrade_pkgs->pkgs = malloc( sizeof *tran->upgrade_pkgs->pkgs );
+ tran->exclude_pkgs->pkgs = malloc( sizeof *tran->exclude_pkgs->pkgs );
tran->install_pkgs->pkg_count = 0;
tran->remove_pkgs->pkg_count = 0;
tran->upgrade_pkgs->pkg_count = 0;
+ tran->exclude_pkgs->pkg_count = 0;
}
int handle_transaction(const rc_config *global_config, transaction *tran){
@@ -47,6 +50,16 @@ int handle_transaction(const rc_config *global_config, transaction *tran){
&& global_config->no_prompt == 0 && global_config->interactive == 0 )
){
+ /* show pkgs to exclude */
+ if( tran->exclude_pkgs->pkg_count > 0 ){
+ printf("The following packages have been EXCLUDED:\n");
+ printf(" ");
+ for(i = 0; i < tran->exclude_pkgs->pkg_count;i++){
+ printf("%s ",tran->exclude_pkgs->pkgs[i]->name);
+ }
+ printf("\n");
+ }
+
/* show pkgs to install */
if( tran->install_pkgs->pkg_count > 0 ){
printf("The following NEW packages will be installed:\n");
@@ -79,16 +92,17 @@ int handle_transaction(const rc_config *global_config, transaction *tran){
/* print the summary */
printf(
- "%d upgraded, %d newly installed, and %d to remove.\n",
+ "%d upgraded, %d newly installed, %d to remove and %d not upgraded.\n",
tran->upgrade_pkgs->pkg_count,
tran->install_pkgs->pkg_count,
- tran->remove_pkgs->pkg_count
+ tran->remove_pkgs->pkg_count,
+ tran->exclude_pkgs->pkg_count
);
/* prompt */
- printf("Do you want to continue? [Y/n] ");
+ printf("Do you want to continue? [y/N] ");
fgets(prompt_answer,10,stdin);
- if( tolower(prompt_answer[0]) == 'n' ){
+ if( tolower(prompt_answer[0]) != 'y' ){
printf("Abort.\n");
return 1;
}
@@ -145,6 +159,22 @@ void add_remove_to_transaction(transaction *tran,pkg_info_t *pkg){
}
+void add_exclude_to_transaction(transaction *tran,pkg_info_t *pkg){
+ pkg_info_t **tmp_list;
+
+ tmp_list = realloc(
+ tran->exclude_pkgs->pkgs,
+ sizeof *tran->exclude_pkgs->pkgs * ( tran->exclude_pkgs->pkg_count + 1 )
+ );
+ if( tmp_list != NULL ){
+ tran->exclude_pkgs->pkgs = tmp_list;
+
+ tran->exclude_pkgs->pkgs[tran->exclude_pkgs->pkg_count] = pkg;
+ ++tran->exclude_pkgs->pkg_count;
+ }
+
+}
+
void add_upgrade_to_transaction(
transaction *tran, pkg_info_t *installed_pkg, pkg_info_t *upgrade_pkg
){
@@ -191,10 +221,12 @@ void free_transaction(transaction *tran){
free(tran->install_pkgs->pkgs);
free(tran->remove_pkgs->pkgs);
free(tran->upgrade_pkgs->pkgs);
+ free(tran->exclude_pkgs->pkgs);
free(tran->install_pkgs);
free(tran->remove_pkgs);
free(tran->upgrade_pkgs);
+ free(tran->exclude_pkgs);
}
diff --git a/src/transaction.h b/src/transaction.h
index 502edef..5b38252 100644
--- a/src/transaction.h
+++ b/src/transaction.h
@@ -21,6 +21,7 @@ struct _transaction {
struct pkg_list *install_pkgs;
struct pkg_upgrade_list *upgrade_pkgs;
struct pkg_list *remove_pkgs;
+ struct pkg_list *exclude_pkgs;
};
typedef struct _transaction transaction;
/* */
@@ -31,5 +32,6 @@ int handle_transaction(const rc_config *,transaction *);
void add_install_to_transaction(transaction *,pkg_info_t *);
void add_remove_to_transaction(transaction *,pkg_info_t *);
void add_upgrade_to_transaction(transaction *,pkg_info_t *,pkg_info_t *);
+void add_exclude_to_transaction(transaction *,pkg_info_t *);
void free_transaction(transaction *);