[139023] branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv. tcl
ijackson at macports.org
ijackson at macports.org
Wed Jul 29 12:01:18 PDT 2015
Revision: 139023
https://trac.macports.org/changeset/139023
Author: ijackson at macports.org
Date: 2015-07-29 12:01:18 -0700 (Wed, 29 Jul 2015)
Log Message:
-----------
Set obsoletes information of the solv.
If A replaced_by B, then B obsoletes A. This is achieved
by mapping $solvables to the portnames that have replaced_by
field in PortIndex. By iterating over this list, we set
A's $portinfo(replaced_by) i.e., B's solv with obsoletes value of $A.
Also keep a check if $portinfo(replaced_by) port exists or not.
Modified Paths:
--------------
branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl
Modified: branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl
===================================================================
--- branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl 2015-07-29 12:59:23 UTC (rev 139022)
+++ branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl 2015-07-29 19:01:18 UTC (rev 139023)
@@ -82,8 +82,13 @@
lappend fields "depends_lib" $solv::SOLVABLE_REQUIRES [list]
lappend fields "depends_run" $solv::SOLVABLE_REQUIRES [list]
lappend fields "conflicts" $solv::SOLVABLE_CONFLICTS [list]
- lappend fields "replaced_by" $solv::SOLVABLE_OBSOLETES [list]
+ ## Variable for replace_by to set obsoletes of solv.
+ variable replaced_by
+
+ ## Variable to map portname to its solv
+ variable solvs
+
## Check if libsolv cache (pool) is already created or not.
if {![info exists pool]} {
global macports::sources
@@ -170,14 +175,39 @@
}
}
+ ## Set up map from port to its solvable if replaced_by another package.
+ if {[info exists portinfo(replaced_by)]} {
+ set replaced_by($name) $solvable
+ }
+
## Set SOLVABLE_PROVIDES for the solv so that the package can be found during depcalc.
set provides [$pool rel2id [$solvable cget -nameid] [$solvable cget -evrid] $solv::REL_EQ 1]
$solvable add_deparray $solv::SOLVABLE_PROVIDES $provides
## Set portinfo of each solv object. Map it to correct solvid.
set portindexinfo([$solvable cget -id]) $line
+
+ ## Set solv's to its portname
+ set solvs($name) $solvable
}
+ ## Set obsoletes by reading the replaced_by contents.
+ ## Obsoletes: A replaced_by B means B obsoletes A.
+ if {[array exists replaced_by] && [array size replaced_by] > 0} {
+ foreach name [array names replaced_by] {
+ array set portinfo $portindexinfo([$replaced_by($name) cget -id])
+ set A $name
+ set B $portinfo(replaced_by)
+ ## Check if the replaced_by port actually exists or not.
+ if {![info exists solvs($B)]} {
+ ui_msg "No port with the name $B exists. Skipping adding obsoletes for $A."
+ } else {
+ $solvs($B) add_deparray $solv::SOLVABLE_OBSOLETES [$pool str2id $A 1]
+ }
+ array unset -nocomplain portinfo
+ }
+ }
+
} catch * {
ui_warn "It looks like your PortIndex file for $source may be corrupt."
throw
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150729/115c53df/attachment.html>
More information about the macports-changes
mailing list