[23890] trunk/base
source_changes at macosforge.org
source_changes at macosforge.org
Thu Apr 12 06:21:33 PDT 2007
Revision: 23890
http://trac.macosforge.org/projects/macports/changeset/23890
Author: eridius at macports.org
Date: 2007-04-12 06:21:32 -0700 (Thu, 12 Apr 2007)
Log Message:
-----------
Add code.google.com support to livecheck.
Add googlecode support to master_sites - works just like sourceforge and macports keywords do.
Revert livecheck default behaviour back to freshmeat
Add evaluation of $name variable to the mirror list - see googlecode mirror for example
Modified Paths:
--------------
trunk/base/doc/portfile.7
trunk/base/src/port1.0/portfetch.tcl
trunk/base/src/port1.0/portlivecheck.tcl
trunk/base/src/port1.0/resources/fetch/mirror_sites.tcl
Modified: trunk/base/doc/portfile.7
===================================================================
--- trunk/base/doc/portfile.7 2007-04-12 11:55:42 UTC (rev 23889)
+++ trunk/base/doc/portfile.7 2007-04-12 13:21:32 UTC (rev 23890)
@@ -1211,6 +1211,8 @@
(uses the date_updated tag of the freshmeat XML file),
.Em sourceforge
(uses the version of the latest file release of the project),
+.Em googlecode
+(uses the version of the latest file release of the project),
.Em moddate
(uses the modification date of some URL resource),
.Em regex
@@ -1226,22 +1228,37 @@
.Em optional
.br
.Sy Default:
+.Em sourceforge
+or
+.Em googlecode
+if the master_sites is one of these, else
.Em freshmeat
-or
-.Em sourceforge
-if the master_sites is sourceforge.
.br
.Sy Values:
-.Em freshmeat sourceforge moddate regex regexm md5 none
+.Em freshmeat sourceforge googlecode moddate regex regexm md5 none
.It Ic livecheck.name
-Name of the project for live checks (used for freshmeat and sourceforge checks).
+Name of the project for live checks (used for freshmeat, sourceforge, and googlecode checks).
.br
.Sy Type:
.Em optional
.br
.Sy Default:
.Em ${name}
-or the sourceforge project name if it can be guessed by looking at the master_sites.
+or the sourceforge/freshmeat/googlecode project name if it can be guessed by looking at the master_sites.
+.It Ic livecheck.distname
+Name of the file release (used for sourceforge and googlecode checks).
+For sourceforge releases use the name of the package release.
+For googlecode releases use the name of the file download, including extension.
+Replace the version part of the name with "(.*)".
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em ${livecheck.name}
+for sourceforge projects or the first entry in
+.Em ${distfiles}
+for googlecode projects
.It Ic livecheck.version
Version of the project for live checks (used for regex-based checks).
.br
@@ -1262,8 +1279,11 @@
.Em http://freshmeat.net/projects-xml/${livecheck.name}/${livecheck.name}.xml
or
.Em http://sourceforge.net/export/rss2_projfiles.php?project=${livecheck.name}
+or
+.Em http://code.google.com/p/${livecheck.name}/downloads/list
.It Ic livecheck.regex
Regular expression to parse the resource for regex checks.
+Be sure to use a regular expression grouping around the version component.
.br
.Sy Type:
.Em optional
Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl 2007-04-12 11:55:42 UTC (rev 23889)
+++ trunk/base/src/port1.0/portfetch.tcl 2007-04-12 13:21:32 UTC (rev 23890)
@@ -165,11 +165,17 @@
# here we have the chance to take a look at tags, that possibly
# have been assigned in mirror_sites.tcl
set splitlist [split $element :]
- if {[llength $splitlist] > 1} {
- set element "[lindex $splitlist 0]:[lindex $splitlist 1]"
- set mirror_tag "[lindex $splitlist 2]"
- }
+ # every element is a URL, so we'll always have multiple elements. no need to check
+ set element "[lindex $splitlist 0]:[lindex $splitlist 1]"
+ set mirror_tag "[lindex $splitlist 2]"
+ set name_re {\$(?:name\y|\{name\})}
+ # if the URL has $name embedded, kill any mirror_tag that may have been added
+ # since a mirror_tag and $name are incompatible
+ if {[regexp $name_re $element]} {
+ set mirror_tag ""
+ }
+
if {$mirror_tag == "mirror"} {
set thesubdir ${dist_subdir}
} elseif {$subdir == "" && $mirror_tag != "nosubdir"} {
@@ -178,6 +184,11 @@
set thesubdir ${subdir}
}
+ # parse an embedded $name. if present, remove the subdir
+ if {[regsub $name_re $element $thesubdir element] > 0} {
+ set thesubdir ""
+ }
+
if {"$tag" != ""} {
eval append element "${thesubdir}:${tag}"
} else {
Modified: trunk/base/src/port1.0/portlivecheck.tcl
===================================================================
--- trunk/base/src/port1.0/portlivecheck.tcl 2007-04-12 11:55:42 UTC (rev 23889)
+++ trunk/base/src/port1.0/portlivecheck.tcl 2007-04-12 13:21:32 UTC (rev 23890)
@@ -43,7 +43,7 @@
target_requires ${com.apple.livecheck} main
# define options
-options livecheck.url livecheck.check livecheck.md5 livecheck.regex livecheck.name livecheck.version
+options livecheck.url livecheck.check livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version
# defaults
default livecheck.url {$homepage}
@@ -51,12 +51,13 @@
default livecheck.md5 ""
default livecheck.regex ""
default livecheck.name default
+default livecheck.distname default
default livecheck.version {$version}
proc livecheck_main {args} {
- global livecheck.url livecheck.check livecheck.md5 livecheck.regex livecheck.name livecheck.version
+ global livecheck.url livecheck.check livecheck.md5 livecheck.regex livecheck.name livecheck.distname livecheck.version
global homepage portname portpath workpath
- global master_sites name
+ global master_sites name distfiles
set updated 0
set updated_version "unknown"
@@ -69,14 +70,17 @@
ui_debug "Port (livecheck) version is ${livecheck.version}"
# Determine the default type depending on the mirror.
- if {${livecheck.check} == "default"} {
- if {$has_master_sites && [regexp {\y(sourceforge|freshmeat)\y(?::(\S+))?} $master_sites dummy site tag]} {
+ if {${livecheck.check} eq "default"} {
+ if {$has_master_sites && [regexp {\y(sourceforge|freshmeat|googlecode)\y(?::(\S+))?} $master_sites _ site tag]} {
if {$tag ne "" && ${livecheck.name} eq "default"} {
set livecheck.name $tag
}
set livecheck.check $site
+ } elseif {[regexp {http://code.google.com/p/([^/]+)} $homepage _ tag]} {
+ set livecheck.check "googlecode"
+ set livecheck.name $tag
} else {
- set livecheck.check none
+ set livecheck.check "freshmeat"
}
}
if {${livecheck.name} == "default"} {
@@ -84,22 +88,40 @@
}
# Perform the check depending on the type.
- if {${livecheck.check} == "freshmeat"} {
- if {![info exists homepage] || ${livecheck.url} eq ${homepage}} {
- set livecheck.url "http://freshmeat.net/projects-xml/${livecheck.name}/${livecheck.name}.xml"
+ switch ${livecheck.check} {
+ "freshmeat" {
+ if {![info exists homepage] || ${livecheck.url} eq ${homepage}} {
+ set livecheck.url "http://freshmeat.net/projects-xml/${livecheck.name}/${livecheck.name}.xml"
+ }
+ if {${livecheck.regex} eq ""} {
+ set livecheck.regex "<latest_release_version>(.*)</latest_release_version>"
+ }
+ set livecheck.check "regex"
}
- if {${livecheck.regex} == ""} {
- set livecheck.regex "<latest_release_version>(.*)</latest_release_version>"
+ "sourceforge" {
+ if {![info exists 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 "<title>${livecheck.distname} (.*) released.*</title>"
+ }
+ set livecheck.check "regex"
}
- set livecheck.check "regex"
- } elseif {${livecheck.check} == "sourceforge"} {
- if {![info exists homepage] || ${livecheck.url} eq ${homepage}} {
- set livecheck.url "http://sourceforge.net/export/rss2_projfiles.php?project=${livecheck.name}"
+ "googlecode" {
+ if {![info exists 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 ***=${livecheck.version} [file tail [lindex ${distfiles} 0]] (.*)]
+ }
+ if {${livecheck.regex} eq ""} {
+ set livecheck.regex {<a href="http://${livecheck.name}.googlecode.com/files/${livecheck.distname}"}
+ }
+ set livecheck.check "regex"
}
- if {${livecheck.regex} == ""} {
- set livecheck.regex "<title>${livecheck.name} (.*) released.*</title>"
- }
- set livecheck.check "regex"
}
switch ${livecheck.check} {
Modified: trunk/base/src/port1.0/resources/fetch/mirror_sites.tcl
===================================================================
--- trunk/base/src/port1.0/resources/fetch/mirror_sites.tcl 2007-04-12 11:55:42 UTC (rev 23889)
+++ trunk/base/src/port1.0/resources/fetch/mirror_sites.tcl 2007-04-12 13:21:32 UTC (rev 23890)
@@ -86,6 +86,10 @@
ftp://ftp.gnustep.org/pub/gnustep/
}
+set portfetch::mirror_sites::sites(googlecode) {
+ http://${name}.googlecode.com/files/
+}
+
set portfetch::mirror_sites::sites(isc) {
ftp://ftp.isc.org/isc/
ftp://gd.tuwien.ac.at/infosys/servers/isc/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070412/dde872ab/attachment.html
More information about the macports-changes
mailing list