Opened 19 years ago

Closed 19 years ago

Last modified 9 years ago

#6220 closed defect (fixed)

ENHANCEMENT: port upgrade checks ports multiple times

Reported by: danielluke (Daniel J. Luke) Owned by: olegb@…
Priority: Normal Milestone:
Component: base Version: 1.0
Keywords: Cc: olegb@…
Port:

Description (last modified by ryandesign (Ryan Carsten Schmidt))

port upgrade could be sped up by not attempting to walk up parts of the dependency tree where it's already been.

Patch inline (tcl hates me, so it probably needs work):

Index: darwinports1.0/darwinports.tcl
===================================================================
RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/darwinports1.0/darwinports.tcl,v
retrieving revision 1.200
diff -u -r1.200 darwinports.tcl
--- darwinports1.0/darwinports.tcl      14 Dec 2005 05:10:19 -0000      1.200
+++ darwinports1.0/darwinports.tcl      23 Dec 2005 19:53:09 -0000
@@ -1432,9 +1432,12 @@
 }
 
 # upgrade procedure
-proc darwinports::upgrade {pname dspec variationslist optionslist} {
+proc darwinports::upgrade {pname dspec variationslist optionslist {depscachename ""}} {
        array set options $optionslist
        array set variations $variationslist
+       if {![string match "" $depscachename]} {
+               upvar $depscachename depscache
+       } 
 
        # set to no-zero is epoch overrides version
        set epoch_override 0
@@ -1571,22 +1574,31 @@
                # build depends is upgraded
                if {[info exists portinfo(depends_build)]} {
                        foreach i $portinfo(depends_build) {
-                               set d [lindex [split $i :] end]
-                               upgrade $d $i $variationslist $optionslist
+                               if {![llength [array get depscache $i]]} {
+                                       set d [lindex [split $i :] end]
+                                       set depscache($i) 1
+                                       upgrade $d $i $variationslist $optionslist depscache
+                               } 
                        }
                }
                # library depends is upgraded
                if {[info exists portinfo(depends_lib)]} {
                        foreach i $portinfo(depends_lib) {
-                               set d [lindex [split $i :] end]
-                               upgrade $d $i $variationslist $optionslist
+                               if {![llength [array get depscache $i]]} {
+                                       set d [lindex [split $i :] end]
+                                       set depscache($i) 1
+                                       upgrade $d $i $variationslist $optionslist depscache
+                               } 
                        }
                }
                # runtime depends is upgraded
                if {[info exists portinfo(depends_run)]} {
                        foreach i $portinfo(depends_run) {
-                               set d [lindex [split $i :] end]
-                               upgrade $d $i $variationslist $optionslist
+                               if {![llength [array get depscache $i]]} {
+                                       set d [lindex [split $i :] end]
+                                       set depscache($i) 1
+                                       upgrade $d $i $variationslist $optionslist depscache
+                               } 
                        }
                }
        }

Attachments (1)

depscache.patch (1.6 KB) - added by danielluke (Daniel J. Luke) 19 years ago.
cache deps we've already checked when upgrading

Download all attachments as: .zip

Change History (11)

comment:1 Changed 19 years ago by blb@…

blocked: 5898

comment:2 Changed 19 years ago by yves@…

Could you provide the patch as attachement ?

copy / paste :

Bilbo:~/dp/base/src yves$ patch -p0 < ../upgrade.patch patch unexpectedly ends in middle of line patch: Only garbage was found in the patch input.

comment:3 Changed 19 years ago by danielluke (Daniel J. Luke)

(In reply to comment #1)

Could you provide the patch as attachement ?

I could if the cvs server wasn't down :(

copy / paste :

Bilbo:~/dp/base/src yves$ patch -p0 < ../upgrade.patch patch unexpectedly ends in middle of line patch: Only garbage was found in the patch input.

When I copy + paste it into a file, I can get it to apply if I do:

patch -l -p0 < patch

comment:4 Changed 19 years ago by danielluke (Daniel J. Luke)

(In reply to comment #2)

(In reply to comment #1)

Could you provide the patch as attachement ?

I could if the cvs server wasn't down :(

I found an unadulterated copy of the dp sources on another machine, so I can attach a patch for you.

Changed 19 years ago by danielluke (Daniel J. Luke)

Attachment: depscache.patch added

cache deps we've already checked when upgrading

comment:5 Changed 19 years ago by danielluke (Daniel J. Luke)

Status: newassigned

comment:6 Changed 19 years ago by olegb@…

Cc: olegb@… added

I'll try this out - looks good. I will report back in a few days at latest.

comment:7 Changed 19 years ago by danielluke (Daniel J. Luke)

(In reply to comment #5)

I'll try this out - looks good. I will report back in a few days at latest.

Cool. I would be especially interested to see if it helps significantly with upgrades where gnome is installed (I don't have gnome installed anywhere).

comment:8 Changed 19 years ago by olegb@…

Owner: changed from darwinports-bugs@… to olegb@…
Status: assignednew

My initial tests show that you patch makes upgrade -a ~ 9% faster, though it still checks if it needs to upgrading a port multiple times.

I am commiting this in about 24 hours if noone has problems with this.

I like Daniel would like to see tests from people that has a large number of ports installed - I do not.

comment:9 Changed 19 years ago by olegb@…

Resolution: fixed
Status: newclosed

Commited.

comment:10 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Note: See TracTickets for help on using tickets.