[137790] branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv. tcl

ijackson at macports.org ijackson at macports.org
Fri Jun 19 12:08:55 PDT 2015


Revision: 137790
          https://trac.macports.org/changeset/137790
Author:   ijackson at macports.org
Date:     2015-06-19 12:08:55 -0700 (Fri, 19 Jun 2015)
Log Message:
-----------
Add more information related to solv using add_repodata
Add information about Summary(description),
Description(long_description) and License to the solv's
repodata. Line wrap comment. Add more debug output related
to solv's information set using $repodata set_str.

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-06-19 18:22:55 UTC (rev 137789)
+++ branches/gsoc15-dependency/base/src/macports1.0/macports_libsolv.tcl	2015-06-19 19:08:55 UTC (rev 137790)
@@ -77,6 +77,7 @@
                 set source [lindex $source 0]
                 ## Add a repo in the pool for each source as mentioned in sources.conf
                 set repo [$pool add_repo $source]
+                set repodata [$repo add_repodata]
  
                 if {[catch {set fd [open [macports::getindex $source] r]} result]} {
                     ui_warn "Can't open index file for source: $source"
@@ -86,7 +87,8 @@
                             # Create a solvable for each port processed.
                             set solvable [$repo add_solvable]
 
-                            ## Clear the portinfo contents to prevent attribute leak from previous iterations
+                            ## Clear the portinfo contents to prevent attribute leak \
+                            #  from previous iterations
                             array unset portinfo
                             set name [lindex $line 0]
                             set len  [lindex $line 1]
@@ -98,6 +100,21 @@
                             -evr "$portinfo(epoch)@$portinfo(version)-$portinfo(revision)" \
                             -arch "i386"
 
+                            ## Add extra info to repodata i.e. Summary, Description, etc to the solvables
+                            #  Valid constant fields can be found at src/knownid.h of libsolv.
+                            if {[info exists portinfo(description)]} {
+                                $repodata set_str [$solvable cget -id] $solv::SOLVABLE_SUMMARY \
+                                $portinfo(description)
+                            }
+                            if {[info exists portinfo(long_description)]} {
+                                $repodata set_str [$solvable cget -id] $solv::SOLVABLE_DESCRIPTION \
+                                $portinfo(long_description)
+                            }
+                            if {[info exists portinfo(license)]} {
+                                $repodata set_str [$solvable cget -id] $solv::SOLVABLE_LICENSE \
+                                $portinfo(license)
+                            }
+
                             ## Set portinfo of each solv object. Map it to correct solvid.
                             set portindexinfo([$solvable cget -id]) $line
                         }
@@ -105,6 +122,10 @@
                         ui_warn "It looks like your PortIndex file for $source may be corrupt."
                         throw
                     } finally {
+                        ## Internalize should be run on the repodata so that the extra info \
+                        #  is available for lookup and dataiterator functions. Do this after\
+                        #  all the solvables are added to repo as it is a costly operation.
+                        $repodata internalize
                         close $fd
                     }
                 }
@@ -162,6 +183,9 @@
         foreach s [$sel solvables] {
             ## Print information about mathed solvable on debug option.
             ui_debug "solvable = [$s __str__]"
+            ui_debug "summary = [$s lookup_str $solv::SOLVABLE_SUMMARY]"
+            ui_debug "description = [$s lookup_str $solv::SOLVABLE_DESCRIPTION]"
+            ui_debug "license = [$s lookup_str $solv::SOLVABLE_LICENSE]"
 
             lappend matches [$s cget -name]
             lappend matches $portindexinfo([$s cget -id])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150619/62e02a63/attachment.html>


More information about the macports-changes mailing list