summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bindings/solv.i1
-rwxr-xr-xexamples/p5solv4
-rwxr-xr-xexamples/pysolv4
-rwxr-xr-xexamples/rbsolv4
-rw-r--r--src/transaction.c8
-rw-r--r--src/transaction.h2
6 files changed, 15 insertions, 8 deletions
diff --git a/bindings/solv.i b/bindings/solv.i
index 3756668..d4e1c97 100644
--- a/bindings/solv.i
+++ b/bindings/solv.i
@@ -2628,6 +2628,7 @@ rb_eval_string(
static const int SOLVER_TRANSACTION_SHOW_OBSOLETES = SOLVER_TRANSACTION_SHOW_OBSOLETES;
static const int SOLVER_TRANSACTION_SHOW_MULTIINSTALL = SOLVER_TRANSACTION_SHOW_MULTIINSTALL;
static const int SOLVER_TRANSACTION_CHANGE_IS_REINSTALL = SOLVER_TRANSACTION_CHANGE_IS_REINSTALL;
+ static const int SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE = SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE;
static const int SOLVER_TRANSACTION_MERGE_VENDORCHANGES = SOLVER_TRANSACTION_MERGE_VENDORCHANGES;
static const int SOLVER_TRANSACTION_MERGE_ARCHCHANGES = SOLVER_TRANSACTION_MERGE_ARCHCHANGES;
static const int SOLVER_TRANSACTION_RPM_ONLY = SOLVER_TRANSACTION_RPM_ONLY;
diff --git a/examples/p5solv b/examples/p5solv
index 178a25a..7d964ce 100755
--- a/examples/p5solv
+++ b/examples/p5solv
@@ -666,7 +666,7 @@ if ($trans->isempty()) {
}
print "\nTransaction summary:\n\n";
-for my $c ($trans->classify()) {
+for my $c ($trans->classify($solv::Transaction::SOLVER_TRANSACTION_SHOW_OBSOLETES|$solv::Transaction::SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE)) {
if ($c->{'type'} == $solv::Transaction::SOLVER_TRANSACTION_ERASE) {
print "$c->{'count'} erased packages:\n";
} elsif ($c->{'type'} == $solv::Transaction::SOLVER_TRANSACTION_INSTALL) {
@@ -703,7 +703,7 @@ while (1) {
my $yn = <STDIN>;
chomp $yn;
last if $yn eq 'y';
- exit(1) if $yn eq 'n';
+ exit(1) if $yn eq 'n' || $yn eq 'q';
}
my @newpkgs = $trans->newpackages();
diff --git a/examples/pysolv b/examples/pysolv
index ff71c42..b47b859 100755
--- a/examples/pysolv
+++ b/examples/pysolv
@@ -800,7 +800,7 @@ if trans.isempty():
print
print "Transaction summary:"
print
-for cl in trans.classify():
+for cl in trans.classify(Transaction.SOLVER_TRANSACTION_SHOW_OBSOLETES | Transaction.SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE):
if cl.type == Transaction.SOLVER_TRANSACTION_ERASE:
print "%d erased packages:" % cl.count
elif cl.type == Transaction.SOLVER_TRANSACTION_INSTALL:
@@ -834,7 +834,7 @@ while True:
sys.stdout.flush()
yn = sys.stdin.readline().strip()
if yn == 'y': break
- if yn == 'n': sys.exit(1)
+ if yn == 'n' or yn == 'q': sys.exit(1)
newpkgs = trans.newpackages()
newpkgsfp = {}
if newpkgs:
diff --git a/examples/rbsolv b/examples/rbsolv
index 33f5791..e1ca45a 100755
--- a/examples/rbsolv
+++ b/examples/rbsolv
@@ -679,7 +679,7 @@ if trans.isempty?
end
puts "\nTransaction summary:\n"
-for cl in trans.classify()
+for cl in trans.classify(Solv::Transaction::SOLVER_TRANSACTION_SHOW_OBSOLETES | Solv::Transaction::SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE)
if cl.type == Solv::Transaction::SOLVER_TRANSACTION_ERASE
puts "#{cl.count} erased packages:"
elsif cl.type == Solv::Transaction::SOLVER_TRANSACTION_INSTALL
@@ -715,7 +715,7 @@ while true:
STDOUT.flush
yn = STDIN.gets.strip
break if yn == 'y'
- abort if yn == 'n'
+ abort if yn == 'n' || yn == 'q'
end
newpkgs = trans.newpackages()
diff --git a/src/transaction.c b/src/transaction.c
index 071f156..94f0236 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -260,15 +260,19 @@ transaction_type(Transaction *trans, Id p, int mode)
if (s->repo == pool->installed && (mode & SOLVER_TRANSACTION_SHOW_ACTIVE) == 0)
{
/* erase element and we're showing the passive side */
- if ((mode & SOLVER_TRANSACTION_SHOW_OBSOLETES) == 0 && type == SOLVER_TRANSACTION_OBSOLETED)
+ if (type == SOLVER_TRANSACTION_OBSOLETED && (mode & SOLVER_TRANSACTION_SHOW_OBSOLETES) == 0)
type = SOLVER_TRANSACTION_ERASE;
+ if (type == SOLVER_TRANSACTION_OBSOLETED && (mode & SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE) != 0)
+ type = SOLVER_TRANSACTION_UPGRADED;
return type;
}
if (s->repo != pool->installed && (mode & SOLVER_TRANSACTION_SHOW_ACTIVE) != 0)
{
/* install element and we're showing the active side */
- if ((mode & SOLVER_TRANSACTION_SHOW_OBSOLETES) == 0 && type == SOLVER_TRANSACTION_OBSOLETES)
+ if (type == SOLVER_TRANSACTION_OBSOLETES && (mode & SOLVER_TRANSACTION_SHOW_OBSOLETES) == 0)
type = SOLVER_TRANSACTION_INSTALL;
+ if (type == SOLVER_TRANSACTION_OBSOLETES && (mode & SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE) != 0)
+ type = SOLVER_TRANSACTION_UPGRADE;
return type;
}
diff --git a/src/transaction.h b/src/transaction.h
index 4f9acf3..a6b0782 100644
--- a/src/transaction.h
+++ b/src/transaction.h
@@ -77,6 +77,8 @@ typedef struct _Transaction {
#define SOLVER_TRANSACTION_KEEP_PSEUDO (1 << 8)
+#define SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE (1 << 9)
+
/* extra classifications */
#define SOLVER_TRANSACTION_ARCHCHANGE 0x100
#define SOLVER_TRANSACTION_VENDORCHANGE 0x101