[92410] trunk/base/src/macports1.0/macports.tcl

jeremyhu at macports.org jeremyhu at macports.org
Fri Apr 27 18:07:58 PDT 2012


Revision: 92410
          https://trac.macports.org/changeset/92410
Author:   jeremyhu at macports.org
Date:     2012-04-27 18:07:58 -0700 (Fri, 27 Apr 2012)
Log Message:
-----------
Add support for syncing git overlays

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2012-04-27 22:14:42 UTC (rev 92409)
+++ trunk/base/src/macports1.0/macports.tcl	2012-04-28 01:07:58 UTC (rev 92410)
@@ -2197,6 +2197,8 @@
                 set portdir [macports::getportdir $source]
                 set svn_cmd ""
                 catch {set svn_cmd [macports::findBinary svn]}
+                set git_cmd ""
+                catch {set git_cmd [macports::findBinary git]}
                 if {$svn_cmd != "" && ([file exists $portdir/.svn] || ![catch {exec $svn_cmd info $portdir > /dev/null 2>@1}])} {
                     set svn_commandline "$svn_cmd update --non-interactive ${portdir}"
                     ui_debug $svn_commandline
@@ -2221,6 +2223,30 @@
                         incr numfailed
                         continue
                     }
+                } elseif {$git_cmd != "" && [file exists $portdir/.git]} {
+                    set git_commandline "pushd $portdir ; $git_cmd pull --rebase ; popd"
+                    ui_debug $git_commandline
+                    if {
+                        [catch {
+                            if {[getuid] == 0} {
+                                set euid [geteuid]
+                                set egid [getegid]
+                                ui_debug "changing euid/egid - current euid: $euid - current egid: $egid"
+                                setegid [name_to_gid [file attributes $portdir -group]]
+                                seteuid [name_to_uid [file attributes $portdir -owner]]
+                            }
+                            system $git_commandline
+                            if {[getuid] == 0} {
+                                seteuid $euid
+                                setegid $egid
+                            }
+                        }]
+                    } {
+                        ui_debug "$::errorInfo"
+                        ui_error "Synchronization of the local ports tree failed doing a git pull --rebase"
+                        incr numfailed
+                        continue
+                    }
                 }
                 set needs_portindex 1
             }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120427/31d75927/attachment-0001.html>


More information about the macports-changes mailing list