[35249] trunk/base/src/port1.0

wsiegrist at apple.com wsiegrist at apple.com
Fri Mar 21 22:22:09 PDT 2008


Revision: 35249
          http://trac.macosforge.org/projects/macports/changeset/35249
Author:   wsiegrist at apple.com
Date:     2008-03-21 22:22:09 -0700 (Fri, 21 Mar 2008)

Log Message:
-----------
Add distfiles command for listing each distfile for a given port spec and the list of URLs that fetch will use. This will eventually be used for distfile mirroring.

Modified Paths:
--------------
    trunk/base/src/port1.0/Makefile
    trunk/base/src/port1.0/port.tcl

Added Paths:
-----------
    trunk/base/src/port1.0/portdistfiles.tcl

Modified: trunk/base/src/port1.0/Makefile
===================================================================
--- trunk/base/src/port1.0/Makefile	2008-03-22 04:47:08 UTC (rev 35248)
+++ trunk/base/src/port1.0/Makefile	2008-03-22 05:22:09 UTC (rev 35249)
@@ -5,7 +5,8 @@
 	portinstall.tcl portdepends.tcl portdestroot.tcl portlint.tcl \
 	portclean.tcl porttest.tcl portactivate.tcl portsubmit.tcl \
 	port_autoconf.tcl portstartupitem.tcl porttrace.tcl portlivecheck.tcl \
-	portdistcheck.tcl portmirror.tcl portload.tcl portunload.tcl
+	portdistcheck.tcl portmirror.tcl portload.tcl portunload.tcl \
+	portdistfiles.tcl
 
 SUBDIR=		resources
 

Modified: trunk/base/src/port1.0/port.tcl
===================================================================
--- trunk/base/src/port1.0/port.tcl	2008-03-22 04:47:08 UTC (rev 35248)
+++ trunk/base/src/port1.0/port.tcl	2008-03-22 05:22:09 UTC (rev 35249)
@@ -54,3 +54,5 @@
 package require portmirror 1.0
 package require portload 1.0
 package require portunload 1.0
+
+package require portdistfiles 1.0

Added: trunk/base/src/port1.0/portdistfiles.tcl
===================================================================
--- trunk/base/src/port1.0/portdistfiles.tcl	                        (rev 0)
+++ trunk/base/src/port1.0/portdistfiles.tcl	2008-03-22 05:22:09 UTC (rev 35249)
@@ -0,0 +1,79 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
+# portdistfiles.tcl
+# $Id: portdistfiles.tcl $
+#
+# Copyright (c) 2008 MacPorts Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+package provide portdistfiles 1.0
+package require portutil 1.0
+package require portfetch 1.0
+
+set org.macports.distfiles [target_new org.macports.distfiles distfiles_main]
+target_runtype ${org.macports.distfiles} always
+target_state ${org.macports.distfiles} no
+target_provides ${org.macports.distfiles} distfiles
+target_requires ${org.macports.distfiles} main
+target_prerun ${org.macports.distfiles} distfiles_start
+
+set_ui_prefix
+
+proc distfiles_start {args} {
+    global UI_PREFIX portname
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Distfiles for %s"] ${portname}]"
+}
+
+proc distfiles_main {args} {
+    global UI_PREFIX master_sites fetch_urls url_var distfile all_dist_files variations
+    
+    # from portfetch... process the sites, files and patches
+    checkfiles
+
+    foreach {url_var distfile} $fetch_urls {
+
+        ui_msg "\[$distfile\]"
+
+        # TODO: display checksum(s) of distfile       
+
+        # determine sites to download from
+        global portfetch::$url_var
+        if {![info exists $url_var]} {
+            set url_var master_sites
+			global portfetch::$url_var
+        }
+        
+        # determine URLs to download
+        foreach site [set $url_var] {
+            set file_url [portfetch::assemble_url $site $distfile]
+            ui_msg "  $file_url"
+        }
+
+        ui_msg " "
+
+    }
+}
\ No newline at end of file

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080321/93c4d905/attachment.html 


More information about the macports-changes mailing list