aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2003-09-29 14:57:39 +0000
committerJason Woodward2003-09-29 14:57:39 +0000
commit3e5bee05fcd6c2a1173cdb0a56b3cfda2c357f3f (patch)
tree52ac7fc6f9d38c26e7630ad8b8a5f8948d9d5c31
parent95bd87e915ec9391a056019ccf785aec70e33bc0 (diff)
downloadslapt-get-3e5bee05fcd6c2a1173cdb0a56b3cfda2c357f3f.tar.gz
more verbose runtime messages, chdir/mkdir bug fix, doc updates
-rw-r--r--ChangeLog2
-rw-r--r--FAQ7
-rw-r--r--README4
-rw-r--r--src/action.c8
-rw-r--r--src/configuration.c24
-rw-r--r--src/package.c21
-rw-r--r--src/package.h2
7 files changed, 47 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index ef40c09..e359826 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,8 @@
utilizing openssl/evp.h
* pre-download check... won't download twice if md5sum is good
* error checking updates
+ * more verbose messages during operation
+ * fixed chdir/mkdir bug in working_dir
0.9.3 Sep 24, 2003
* default make target doesn't build slack pkg
diff --git a/FAQ b/FAQ
index 11a0565..1c4eb8b 100644
--- a/FAQ
+++ b/FAQ
@@ -12,6 +12,7 @@ Frequenty Asked Questions:
9. Can I "dist-upgrade" to a newer Slackware release?
10. What about package dependencies?
11. What about multiple package sources, ala linuxpackages.net?
+12. I don't like the download spinner, how can I get more statistics?
@@ -159,3 +160,9 @@ Frequenty Asked Questions:
I am awaiting a response.
+12. I don't like the download spinner, how can I get more statistics?
+
+ If you would like more notification on downloading pkgs/files, change the
+ USE_CURL_PROGRESS macro to 1 in include/curl.h. This turns on curl's
+ internal progress meter. This requires a recompile.
+
diff --git a/README b/README
index b16ff01..7559132 100644
--- a/README
+++ b/README
@@ -90,10 +90,6 @@ Table of Contents:
specifying the webservers error message. MD5 checking has been
incorporated in order to alleviate this problem.
- If you would like more notification on downloading pkgs/files, change the
- USE_CURL_PROGRESS macro to 1 in include/curl.h. This turns on curl's
- internal progress meter.
-
If you are getting segfaults, add -g to CFLAGS in the Makefile, change the
DEBUG define in src/main.h to 1, and rebuild ( make clean && make ). Run
in gdb and let me know via email where the fault happens.
diff --git a/src/action.c b/src/action.c
index 643bfde..c2a2bc7 100644
--- a/src/action.c
+++ b/src/action.c
@@ -220,7 +220,7 @@ void pkg_action_upgrade(const rc_config *global_config,pkg_info_t *installed_pkg
cmp_result = strcmp(installed_pkg->version,update_pkg->version);
if( cmp_result < 0 ){ /* update_pkg is newer than installed_pkg */
- if( (upgrade_pkg(global_config,update_pkg)) == -1 ){
+ if( (upgrade_pkg(global_config,installed_pkg,update_pkg)) == -1 ){
fprintf(stderr,"Failed to update %s.\n",installed_pkg->name);
}
}else{
@@ -232,7 +232,7 @@ void pkg_action_upgrade(const rc_config *global_config,pkg_info_t *installed_pkg
}
}else{
if( strcmp(installed_pkg->version,available_pkg->version) < 0 ){
- if( (upgrade_pkg(global_config,available_pkg)) == -1 ){
+ if( (upgrade_pkg(global_config,installed_pkg,available_pkg)) == -1 ){
fprintf(stderr,"Failed to update %s.\n",installed_pkg->name);
}
}else{
@@ -275,7 +275,7 @@ void pkg_action_upgrade_all(const rc_config *global_config){
if( (strcmp(installed_pkgs->pkgs[iterator]->version,update_pkg->version)) < 0 ){
/* attempt to upgrade */
- if( (upgrade_pkg(global_config,update_pkg)) == -1 ){
+ if( (upgrade_pkg(global_config,installed_pkgs->pkgs[iterator],update_pkg)) == -1 ){
fprintf(stderr,"Failed to update %s.\n",installed_pkgs->pkgs[iterator]->name);
}/* end upgrade attempt */
@@ -297,7 +297,7 @@ void pkg_action_upgrade_all(const rc_config *global_config){
/* the current version of the pkg is greater than the installed version */
if( (strcmp(installed_pkgs->pkgs[iterator]->version,current_pkg->version)) < 0 ){
/* attempt to upgrade */
- if( (upgrade_pkg(global_config,current_pkg)) == -1 ){
+ if( (upgrade_pkg(global_config,installed_pkgs->pkgs[iterator],current_pkg)) == -1 ){
fprintf(
stderr,
"Failed to update %s.\n",
diff --git a/src/configuration.c b/src/configuration.c
index 7d29af8..45ad356 100644
--- a/src/configuration.c
+++ b/src/configuration.c
@@ -257,6 +257,10 @@ void create_dir_structure(const char *dir_name){
if( cwd == NULL ){
fprintf(stderr,"Failed to get cwd\n");
exit(1);
+ }else{
+#if DEBUG == 1
+ fprintf(stderr,"\tCurrent working directory: %s\n",cwd);
+#endif
}
while( position < (int) strlen(dir_name) ){
@@ -274,10 +278,18 @@ void create_dir_structure(const char *dir_name){
fprintf(stderr,"Failed to mkdir: %s\n",dir_name_buffer);
#endif
/* exit(1); */
+ }else{
+#if DEBUG == 1
+ fprintf(stderr,"\tCreated directory: %s\n",dir_name_buffer);
+#endif
}
if( (chdir(dir_name_buffer)) == -1 ){
fprintf(stderr,"Failed to chdir to %s\n",dir_name_buffer);
exit(1);
+ }else{
+#if DEBUG == 1
+ fprintf(stderr,"\tchdir into %s\n",dir_name_buffer);
+#endif
}
}/* don't create . */
@@ -303,10 +315,18 @@ void create_dir_structure(const char *dir_name){
fprintf(stderr,"Failed to mkdir: %s\n",dir_name_buffer);
#endif
/* exit(1); */
+ }else{
+#if DEBUG == 1
+ fprintf(stderr,"\tCreated directory: %s\n",dir_name_buffer);
+#endif
}
if( (chdir(dir_name_buffer)) == -1 ){
fprintf(stderr,"Failed to chdir to %s\n",dir_name_buffer);
exit(1);
+ }else{
+#if DEBUG == 1
+ fprintf(stderr,"\tchdir into %s\n",dir_name_buffer);
+#endif
}
} /* don't create . */
@@ -319,6 +339,10 @@ void create_dir_structure(const char *dir_name){
if( (chdir(cwd)) == -1 ){
fprintf(stderr,"Failed to chdir to %s\n",cwd);
exit(1);
+ }else{
+#if DEBUG == 1
+ fprintf(stderr,"\tchdir back into %s\n",cwd);
+#endif
}
free(cwd);
diff --git a/src/package.c b/src/package.c
index e6b5ff2..f440de4 100644
--- a/src/package.c
+++ b/src/package.c
@@ -427,7 +427,6 @@ struct pkg_list *get_update_pkgs(void){
int install_pkg(const rc_config *global_config,pkg_info_t *pkg){
char *pkg_file_name = NULL;
char *command = NULL;
- char *cwd = NULL;
int cmd_return = 0;
if( global_config->simulate == 1 ){
@@ -435,12 +434,12 @@ int install_pkg(const rc_config *global_config,pkg_info_t *pkg){
return 0;
}
- cwd = getcwd(NULL,0);
create_dir_structure(pkg->location);
chdir(pkg->location);
pkg_file_name = download_pkg(global_config,pkg);
if( pkg_file_name == NULL ){
+ chdir(global_config->working_dir);
return -1;
}
@@ -458,17 +457,15 @@ int install_pkg(const rc_config *global_config,pkg_info_t *pkg){
}
}
- chdir(cwd);
- free(cwd);
+ chdir(global_config->working_dir);
free(pkg_file_name);
free(command);
return cmd_return;
}
-int upgrade_pkg(const rc_config *global_config,pkg_info_t *pkg){
+int upgrade_pkg(const rc_config *global_config,pkg_info_t *installed_pkg,pkg_info_t *pkg){
char *pkg_file_name = NULL;
char *command = NULL;
- char *cwd = NULL;
char prompt_answer[10];
int cmd_return = 0;
@@ -479,17 +476,17 @@ int upgrade_pkg(const rc_config *global_config,pkg_info_t *pkg){
}
if( global_config->simulate == 1 ){
- printf("%s is to be upgraded to version %s\n",pkg->name,pkg->version);
+ printf("%s-%s is to be upgraded to version %s\n",pkg->name,installed_pkg->version,pkg->version);
return 0;
}
- cwd = getcwd(NULL,0);
create_dir_structure(pkg->location);
chdir(pkg->location);
/* download it */
pkg_file_name = download_pkg(global_config,pkg);
if( pkg_file_name == NULL ){
+ chdir(global_config->working_dir);
return -1;
}
@@ -501,21 +498,21 @@ int upgrade_pkg(const rc_config *global_config,pkg_info_t *pkg){
if( global_config->download_only == 0 ){
if( global_config->no_prompt == 0 ){
- printf("Replace %s with %s-%s? [y|n] ",pkg->name,pkg->name,pkg->version);
+ printf("Replace %s-%s with %s-%s? [y|n] ",pkg->name,installed_pkg->version,pkg->name,pkg->version);
fgets(prompt_answer,10,stdin);
if( tolower(prompt_answer[0]) != 'y' ){
+ chdir(global_config->working_dir);
return cmd_return;
}
}
- printf("Preparing to replace %s with %s-%s\n",pkg->name,pkg->name,pkg->version);
+ printf("Preparing to replace %s-%s with %s-%s\n",pkg->name,installed_pkg->version,pkg->name,pkg->version);
if( (cmd_return = system(command)) == -1 ){
printf("Failed to execute command: [%s]\n",command);
exit(1);
}
}
- chdir(cwd);
- free(cwd);
+ chdir(global_config->working_dir);
free(pkg_file_name);
free(command);
return cmd_return;
diff --git a/src/package.h b/src/package.h
index 175359a..02e2cb5 100644
--- a/src/package.h
+++ b/src/package.h
@@ -61,7 +61,7 @@ pkg_info_t *get_newest_pkg(pkg_info_t **,const char *,int);
/* install pkg */
int install_pkg(const rc_config *,pkg_info_t *);
/* upgrade pkg */
-int upgrade_pkg(const rc_config *,pkg_info_t *);
+int upgrade_pkg(const rc_config *,pkg_info_t *,pkg_info_t *);
/* remove pkg */
int remove_pkg(pkg_info_t *);
/* free memory allocated for pkg_list struct */