[51069] trunk
perry at macports.org
perry at macports.org
Sun May 17 00:59:04 PDT 2009
Revision: 51069
http://trac.macports.org/changeset/51069
Author: perry at macports.org
Date: 2009-05-17 00:59:01 -0700 (Sun, 17 May 2009)
Log Message:
-----------
Push livecheck defaults into dports/_resources/port1.0 (Addresses #18889).
Modified Paths:
--------------
trunk/base/src/port1.0/portlivecheck.tcl
Added Paths:
-----------
trunk/dports/_resources/port1.0/livecheck/
trunk/dports/_resources/port1.0/livecheck/fallback.tcl
trunk/dports/_resources/port1.0/livecheck/freshmeat.tcl
trunk/dports/_resources/port1.0/livecheck/gnome.tcl
trunk/dports/_resources/port1.0/livecheck/gnu.tcl
trunk/dports/_resources/port1.0/livecheck/googlecode.tcl
trunk/dports/_resources/port1.0/livecheck/sourceforge.tcl
Modified: trunk/base/src/port1.0/portlivecheck.tcl
===================================================================
--- trunk/base/src/port1.0/portlivecheck.tcl 2009-05-17 06:53:42 UTC (rev 51068)
+++ trunk/base/src/port1.0/portlivecheck.tcl 2009-05-17 07:59:01 UTC (rev 51069)
@@ -74,41 +74,6 @@
ui_debug "Portfile modification date is [clock format $port_moddate]"
ui_debug "Port (livecheck) version is ${livecheck.version}"
- # Determine the default type depending on the mirror.
- if {${livecheck.check} eq "default"} {
- if {$has_master_sites} {
- foreach {master_site} ${master_sites} {
- if {[regexp {^(sourceforge|freshmeat|googlecode|gnu)(?::([^:]+))?} ${master_site} _ site subdir]} {
- if {${subdir} ne "" && ${livecheck.name} eq "default"} {
- set livecheck.name ${subdir}
- }
- set livecheck.check ${site}
-
- break
- }
- }
- }
- if {${livecheck.check} eq "default"} {
- set livecheck.check "freshmeat"
- }
- if {$has_homepage} {
- if {[regexp {^http://code.google.com/p/([^/]+)} $homepage _ tag]} {
- if {${livecheck.name} eq "default"} {
- set livecheck.name $tag
- }
- set livecheck.check "googlecode"
- } elseif {[regexp {^http://www.gnu.org/software/([^/]+)} $homepage _ tag]} {
- if {${livecheck.name} eq "default"} {
- set livecheck.name $tag
- }
- set livecheck.check "gnu"
- }
- }
- }
- if {${livecheck.name} eq "default"} {
- set livecheck.name $name
- }
-
# Copied over from portfetch in parts
set fetch_options {}
if {[string length ${fetch.user}] || [string length ${fetch.password}]} {
@@ -122,52 +87,46 @@
lappend fetch_options "--ignore-ssl-cert"
}
- # Perform the check depending on the type.
- switch ${livecheck.check} {
- "freshmeat" {
- if {!$has_homepage || ${livecheck.url} eq ${homepage}} {
- set livecheck.url "http://freshmeat.net/projects/${livecheck.name}/releases.atom"
+ # Check _resources/port1.0/livecheck for available types.
+ set types_dir [getdefaultportresourcepath "port1.0/livecheck"]
+ if {[catch {set available_types [glob -directory $types_dir -tails -types f *.tcl]} result]} {
+ return -code 1 "No available types were found. Check '$types_dir'."
+ }
+
+ # Convert available_types from a list of files (e.g., { freshmeat.tcl
+ # gnu.tcl ... }) into a string in the format "type|type|..." (e.g.,
+ # "freshmeat|gnu|...").
+ set available_types [regsub -all {\.tcl} [join $available_types |] {}]
+
+ if {${livecheck.check} eq "default"} {
+ # Determine the default type from the mirror.
+ if {$has_master_sites} {
+ foreach {master_site} ${master_sites} {
+ if {[regexp "^($available_types)(?::(\[^:\]+))?" ${master_site} _ site subdir]} {
+ if {${subdir} ne "" && ${livecheck.name} eq "default"} {
+ set livecheck.name ${subdir}
+ }
+ set livecheck.check ${site}
+
+ break
+ }
}
- if {${livecheck.regex} eq ""} {
- set livecheck.regex [list "(?i)<title>${livecheck.name} (.*)</title>"]
- }
- set livecheck.check "regex"
}
- "sourceforge" {
- if {!$has_homepage || ${livecheck.url} eq ${homepage}} {
- set livecheck.url "http://sourceforge.net/export/rss2_projfiles.php?project=${livecheck.name}"
- }
- if {${livecheck.distname} eq "default"} {
- set livecheck.distname ${livecheck.name}
- }
- if {${livecheck.regex} eq ""} {
- set livecheck.regex [list "<title>[quotemeta ${livecheck.distname}] (.*) released.*</title>"]
- }
- set livecheck.check "regex"
+ # If the default type cannot be determined from the mirror, use the
+ # fallback type (which is a symlink to one of the available types).
+ if {${livecheck.check} eq "default"} {
+ set livecheck.check "fallback"
}
- "googlecode" {
- if {!$has_homepage || ${livecheck.url} eq ${homepage}} {
- set livecheck.url "http://code.google.com/p/${livecheck.name}/downloads/list"
- }
- if {${livecheck.distname} eq "default"} {
- set livecheck.distname [regsub ***=[quotemeta ${livecheck.version}] [quotemeta [file tail [lindex ${distfiles} 0]]] (.*)]
- }
- if {${livecheck.regex} eq ""} {
- set livecheck.regex [list "<a href=\"http://[quotemeta ${livecheck.name}].googlecode.com/files/${livecheck.distname}\""]
- }
- set livecheck.check "regex"
+ # If livecheck.name is still "default", set it to $name.
+ if {${livecheck.name} eq "default"} {
+ set livecheck.name $name
}
- "gnu" {
- if {!$has_homepage || ${livecheck.url} eq ${homepage}} {
- set livecheck.url "http://ftp.gnu.org/gnu/${livecheck.name}/?C=M&O=D"
- }
- if {${livecheck.distname} eq "default"} {
- set livecheck.distname ${livecheck.name}
- }
- if {${livecheck.regex} eq ""} {
- set livecheck.regex [list "[quotemeta ${livecheck.distname}]-(\\d+(?:\\.\\d+)*)"]
- }
- set livecheck.check "regex"
+
+ # Load the defaults from _resources/port1.0/livecheck/${livecheck.check}.tcl.
+ set defaults_file "$types_dir/${livecheck.check}.tcl"
+ ui_debug "Loading the defaults from '$defaults_file'"
+ if {[catch {source $defaults_file} result]} {
+ return -code 1 "The defaults could not be loaded from '$defaults_file'."
}
}
Added: trunk/dports/_resources/port1.0/livecheck/fallback.tcl
===================================================================
--- trunk/dports/_resources/port1.0/livecheck/fallback.tcl (rev 0)
+++ trunk/dports/_resources/port1.0/livecheck/fallback.tcl 2009-05-17 07:59:01 UTC (rev 51069)
@@ -0,0 +1 @@
+link freshmeat.tcl
\ No newline at end of file
Property changes on: trunk/dports/_resources/port1.0/livecheck/fallback.tcl
___________________________________________________________________
Added: svn:special
+ *
Added: trunk/dports/_resources/port1.0/livecheck/freshmeat.tcl
===================================================================
--- trunk/dports/_resources/port1.0/livecheck/freshmeat.tcl (rev 0)
+++ trunk/dports/_resources/port1.0/livecheck/freshmeat.tcl 2009-05-17 07:59:01 UTC (rev 51069)
@@ -0,0 +1,11 @@
+# $Id$
+#
+# This file contains the defaults for freshmeat.
+
+if {!$has_homepage || ${livecheck.url} eq ${homepage}} {
+ set livecheck.url "http://freshmeat.net/projects/${livecheck.name}/releases.atom"
+}
+if {${livecheck.regex} eq ""} {
+ set livecheck.regex [list "(?i)<title>${livecheck.name} (.*)</title>"]
+}
+set livecheck.check "regex"
Property changes on: trunk/dports/_resources/port1.0/livecheck/freshmeat.tcl
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/dports/_resources/port1.0/livecheck/gnome.tcl
===================================================================
--- trunk/dports/_resources/port1.0/livecheck/gnome.tcl (rev 0)
+++ trunk/dports/_resources/port1.0/livecheck/gnome.tcl 2009-05-17 07:59:01 UTC (rev 51069)
@@ -0,0 +1,11 @@
+# $Id$
+#
+# This file contains the defaults for gnome.
+
+if {!$has_homepage || ${livecheck.url} eq ${homepage}} {
+ set livecheck.url "http://ftp.gnome.org/pub/gnome/${livecheck.name}"
+}
+if {${livecheck.regex} eq ""} {
+ set livecheck.regex [list "\"LATEST-IS-(.*)\""]
+}
+set livecheck.check "regex"
Property changes on: trunk/dports/_resources/port1.0/livecheck/gnome.tcl
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/dports/_resources/port1.0/livecheck/gnu.tcl
===================================================================
--- trunk/dports/_resources/port1.0/livecheck/gnu.tcl (rev 0)
+++ trunk/dports/_resources/port1.0/livecheck/gnu.tcl 2009-05-17 07:59:01 UTC (rev 51069)
@@ -0,0 +1,18 @@
+# $Id$
+#
+# This file contains the defaults for gnu.
+
+if {$has_homepage && [regexp {^http://www.gnu.org/software/([^/]+)} $homepage _ tag] &&
+ ${livecheck.name} eq "default"} {
+ set livecheck.name $tag
+}
+if {!$has_homepage || ${livecheck.url} eq ${homepage}} {
+ set livecheck.url "http://ftp.gnu.org/gnu/${livecheck.name}/?C=M&O=D"
+}
+if {${livecheck.distname} eq "default"} {
+ set livecheck.distname ${livecheck.name}
+}
+if {${livecheck.regex} eq ""} {
+ set livecheck.regex [list "[quotemeta ${livecheck.distname}]-(\\d+(?:\\.\\d+)*)"]
+}
+set livecheck.check "regex"
Property changes on: trunk/dports/_resources/port1.0/livecheck/gnu.tcl
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/dports/_resources/port1.0/livecheck/googlecode.tcl
===================================================================
--- trunk/dports/_resources/port1.0/livecheck/googlecode.tcl (rev 0)
+++ trunk/dports/_resources/port1.0/livecheck/googlecode.tcl 2009-05-17 07:59:01 UTC (rev 51069)
@@ -0,0 +1,18 @@
+# $Id$
+#
+# This file contains the defaults for googlecode.
+
+if {$has_homepage && [regexp {^http://code.google.com/p/([^/]+)} $homepage _ tag]
+ && ${livecheck.name} eq "default"} {
+ set livecheck.name $tag
+}
+if {!$has_homepage || ${livecheck.url} eq ${homepage}} {
+ set livecheck.url "http://code.google.com/p/${livecheck.name}/downloads/list"
+}
+if {${livecheck.distname} eq "default"} {
+ set livecheck.distname [regsub ***=[quotemeta ${livecheck.version}] [quotemeta [file tail [lindex ${distfiles} 0]]] (.*)]
+}
+if {${livecheck.regex} eq ""} {
+ set livecheck.regex [list "<a href=\"http://[quotemeta ${livecheck.name}].googlecode.com/files/${livecheck.distname}\""]
+}
+set livecheck.check "regex"
Property changes on: trunk/dports/_resources/port1.0/livecheck/googlecode.tcl
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/dports/_resources/port1.0/livecheck/sourceforge.tcl
===================================================================
--- trunk/dports/_resources/port1.0/livecheck/sourceforge.tcl (rev 0)
+++ trunk/dports/_resources/port1.0/livecheck/sourceforge.tcl 2009-05-17 07:59:01 UTC (rev 51069)
@@ -0,0 +1,14 @@
+# $Id$
+#
+# This file contains the defaults for sourceforge.
+
+if {!$has_homepage || ${livecheck.url} eq ${homepage}} {
+ set livecheck.url "http://sourceforge.net/export/rss2_projfiles.php?project=${livecheck.name}"
+}
+if {${livecheck.distname} eq "default"} {
+ set livecheck.distname ${livecheck.name}
+}
+if {${livecheck.regex} eq ""} {
+ set livecheck.regex [list "(?i)<title>[quotemeta ${livecheck.distname}] (.*) released.*</title>"]
+}
+set livecheck.check "regex"
Property changes on: trunk/dports/_resources/port1.0/livecheck/sourceforge.tcl
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090517/4907b5e4/attachment.html>
More information about the macports-changes
mailing list