aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2003-10-13 21:51:41 +0000
committerJason Woodward2003-10-13 21:51:41 +0000
commit0f40db501d84c023f6c90e5350ec193ecaf976c4 (patch)
tree5ed782937b6540fb276c84a9501cfa87b3f0c0ce
parent4537dd87ae11fa6a774bc255b4e1127dc05f4898 (diff)
downloadslapt-get-0f40db501d84c023f6c90e5350ec193ecaf976c4.tar.gz
merged in package update data from filelist into PACKAGES.TXT format, so single lookup returns all packages.
-rw-r--r--ChangeLog2
-rw-r--r--src/action.c15
-rw-r--r--src/package.c27
-rw-r--r--src/package.h5
4 files changed, 39 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 19b057d..1835753 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,8 @@
* trimmed out download_pkg_list, download_file_list, download_patches_list,
and download_checksum_list. Replaced those functions with single
get_mirror_data_from_source.
+ * merged in package update data from filelist into PACKAGES.TXT format,
+ so single lookup returns all packages.
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 ad1dda8..20adc7a 100644
--- a/src/action.c
+++ b/src/action.c
@@ -34,7 +34,7 @@ void pkg_action_install(const rc_config *global_config,const char *pkg_name){
printf("Reading Package Lists... ");
installed = get_installed_pkgs();
- all = get_available_and_update_pkgs();
+ all = get_available_pkgs();
printf("Done\n");
init_transaction(&tran);
@@ -81,9 +81,12 @@ void pkg_action_list(void){
pkgs = get_available_pkgs();
for(iterator = 0; iterator < pkgs->pkg_count; iterator++ ){
- char *short_description = gen_short_pkg_description(pkgs->pkgs[iterator]);
- printf("%s - %s\n",pkgs->pkgs[iterator]->name,short_description);
- free(short_description);
+ /* this should eliminate the printing of updates */
+ if( strstr(pkgs->pkgs[iterator]->description,"no description") == NULL ){
+ char *short_description = gen_short_pkg_description(pkgs->pkgs[iterator]);
+ printf("%s - %s\n",pkgs->pkgs[iterator]->name,short_description);
+ free(short_description);
+ }
}
free_pkg_list(pkgs);
@@ -188,7 +191,7 @@ void pkg_action_show(const char *pkg_name){
available_pkgs = get_available_pkgs();
- pkg = get_newest_pkg(available_pkgs->pkgs,pkg_name,available_pkgs->pkg_count);
+ pkg = get_newest_pkg_with_description(available_pkgs->pkgs,pkg_name,available_pkgs->pkg_count);
if( pkg != NULL ){
printf("Package Name: %s\n",pkg->name);
@@ -285,7 +288,7 @@ void pkg_action_upgrade_all(const rc_config *global_config){
printf("Reading Package Lists... ");
installed_pkgs = get_installed_pkgs();
- all_pkgs = get_available_and_update_pkgs();
+ all_pkgs = get_available_pkgs();
printf("Done\n");
init_transaction(&tran);
diff --git a/src/package.c b/src/package.c
index 6bb886b..368f037 100644
--- a/src/package.c
+++ b/src/package.c
@@ -436,6 +436,29 @@ pkg_info_t *get_newest_pkg(pkg_info_t **pkgs,const char *pkg_name,int pkg_count)
return pkg;
}
+/*
+ this one is used when we want a description... mostly trying to avoid update packages..
+ we can assume the first pkg we come across will have some sort of description.
+ subsequent listed pkgs that have the same name will more than likely be duplicate
+ or updates.
+*/
+pkg_info_t *get_newest_pkg_with_description(pkg_info_t **pkgs,const char *pkg_name,int pkg_count){
+ int iterator;
+ pkg_info_t *pkg = NULL;
+ for(iterator = 0; iterator < pkg_count; iterator++ ){
+
+ /* if pkg has same name as our requested pkg */
+ if( (strcmp(pkgs[iterator]->name,pkg_name)) == 0 ){
+
+ if( pkg == NULL ){
+ pkg = pkgs[iterator];
+ }
+ }
+
+ }
+ return pkg;
+}
+
/* parse the update list */
struct pkg_list *get_update_pkgs(void){
FILE *fh;
@@ -893,6 +916,7 @@ void write_pkg_data(const char *source_url,FILE *d_file,struct pkg_list *pkgs){
fprintf(d_file,"PACKAGE DESCRIPTION:\n");
/* do we have to make up an empty description? */
if( strlen(pkgs->pkgs[i]->description) < strlen(pkgs->pkgs[i]->name) ){
+ fprintf(d_file,"%s: no description\n",pkgs->pkgs[i]->name);
fprintf(d_file,"%s: \n",pkgs->pkgs[i]->name);
fprintf(d_file,"%s: \n",pkgs->pkgs[i]->name);
fprintf(d_file,"%s: \n",pkgs->pkgs[i]->name);
@@ -903,8 +927,7 @@ void write_pkg_data(const char *source_url,FILE *d_file,struct pkg_list *pkgs){
fprintf(d_file,"%s: \n",pkgs->pkgs[i]->name);
fprintf(d_file,"%s: \n",pkgs->pkgs[i]->name);
fprintf(d_file,"%s: \n",pkgs->pkgs[i]->name);
- fprintf(d_file,"%s: \n",pkgs->pkgs[i]->name);
- fprintf(d_file,"%s: \n",pkgs->pkgs[i]->name);
+ fprintf(d_file,"%s: \n\n",pkgs->pkgs[i]->name);
}else{
fprintf(d_file,"%s\n",pkgs->pkgs[i]->description);
}
diff --git a/src/package.h b/src/package.h
index 520f815..f834580 100644
--- a/src/package.h
+++ b/src/package.h
@@ -64,11 +64,12 @@ struct pkg_list *get_available_pkgs(void);
struct pkg_list *get_installed_pkgs(void);
/* return list of update pkgs */
struct pkg_list *parse_file_list(FILE *);
-struct pkg_list *get_update_pkgs(void);
+struct pkg_list *get_update_pkgs(void); /* scheduled for removal */
/* generate a short description */
char *gen_short_pkg_description(pkg_info_t *);
/* retrieve the newest pkg from pkg_info_t list */
pkg_info_t *get_newest_pkg(pkg_info_t **,const char *,int);
+pkg_info_t *get_newest_pkg_with_description(pkg_info_t **,const char *,int);
/* install pkg */
int install_pkg(const rc_config *,pkg_info_t *);
/* upgrade pkg */
@@ -86,7 +87,7 @@ int cmp_pkg_versions(char *, char *);
/* analyze the pkg version hunk by hunk */
int break_down_pkg_version(int *,char *);
/* get available, installed, and update pkgs all in one */
-struct pkg_list *get_available_and_update_pkgs(void);
+struct pkg_list *get_available_and_update_pkgs(void); /* scheduled for removal */
/* write pkg data to disk */
void write_pkg_data(const char *,FILE *,struct pkg_list *);