summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-02-04 08:26:52 +0000
committerAaron Griffin <aaron@archlinux.org>2007-02-04 08:26:52 +0000
commit63000584b6442412dbcdf1dd867e09fbde404afe (patch)
tree5ac1028f9aaf0ff5a75d9d2144a9ecc337dc2211 /src
parentb2da4b42344444dc22f1e5b01fb4cd09033adc1d (diff)
downloadpacman-63000584b6442412dbcdf1dd867e09fbde404afe.tar.xz
Implemented a crappy version of -Qu (query upgrades). This simply outputs the
packages to be upgraded in a -Su operation. Much of the code is duplicated from sync.c. TODO: move the implementation to upgrades.c, and reimplement the sync_sysupgrade function in terms of this: trans->packages = alpm_get_upgrades();
Diffstat (limited to 'src')
-rw-r--r--src/pacman/conf.h1
-rw-r--r--src/pacman/pacman.c2
-rw-r--r--src/pacman/query.c13
-rw-r--r--src/pacman/util.c4
-rw-r--r--src/pacman/util.h2
5 files changed, 18 insertions, 4 deletions
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index ddd20ffc..60e3661b 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -43,6 +43,7 @@ typedef struct __config_t {
unsigned short op_q_owns;
unsigned short op_q_search;
unsigned short op_q_changelog;
+ unsigned short op_q_upgrade;
unsigned short op_s_clean;
unsigned short op_s_dependsonly;
unsigned short op_s_downloadonly;
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index c473227c..3c1c8a75 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -372,7 +372,7 @@ static int parseargs(int argc, char *argv[])
break;
case 'u':
config->op_s_upgrade = 1;
- /* TODO config->op_q_upgrade = 1; */
+ config->op_q_upgrade = 1;
break;
case 'v': (config->verbose)++; break;
case 'w':
diff --git a/src/pacman/query.c b/src/pacman/query.c
index be7ca837..36b4af80 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -124,6 +124,19 @@ int pacman_query(alpm_list_t *targets)
}
}
+ if(config->op_q_upgrade) {
+ MSG(NL, _("Checking for package upgrades"));
+ alpm_list_t *syncpkgs;
+
+ if((syncpkgs = alpm_get_upgrades()) != NULL) {
+ display_targets(syncpkgs);
+ return(0);
+ } else {
+ MSG(NL, _("no upgrades found"));
+ return(1);
+ }
+ }
+
for(i = targets; !done; i = (i ? alpm_list_next(i) : NULL)) {
if(targets == NULL) {
done = 1;
diff --git a/src/pacman/util.c b/src/pacman/util.c
index a30ae617..ac29879f 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -263,14 +263,14 @@ void list_display(const char *title, alpm_list_t *list)
* `pkgs` should be a list of pmsyncpkg_t's,
* retrieved from a transaction object
*/
-void display_targets(alpm_list_t *pkgs)
+void display_targets(alpm_list_t *syncpkgs)
{
char *str;
alpm_list_t *i, *j;
alpm_list_t *targets = NULL, *to_remove = NULL;
unsigned long totalsize = 0, totalisize = 0, totalrsize = 0;
- for(i = pkgs; i; i = alpm_list_next(i)) {
+ for(i = syncpkgs; i; i = alpm_list_next(i)) {
pmsyncpkg_t *sync = alpm_list_getdata(i);
pmpkg_t *pkg = alpm_sync_get_package(sync);
diff --git a/src/pacman/util.h b/src/pacman/util.h
index 61bf09ee..45759310 100644
--- a/src/pacman/util.h
+++ b/src/pacman/util.h
@@ -59,7 +59,7 @@ char *strtoupper(char *str);
char *strtrim(char *str);
int reg_match(char *string, char *pattern);
void list_display(const char *title, alpm_list_t *list);
-void display_targets(alpm_list_t *pkgs);
+void display_targets(alpm_list_t *syncpkgs);
float get_update_timediff(int first_call);
void fill_progress(const int percent, const int proglen);