[137287] branches/gsoc15-portfile
chunyang at macports.org
chunyang at macports.org
Mon Jun 8 03:08:22 PDT 2015
Revision: 137287
https://trac.macports.org/changeset/137287
Author: chunyang at macports.org
Date: 2015-06-08 03:08:22 -0700 (Mon, 08 Jun 2015)
Log Message:
-----------
port-create: Implement initial support for -url, -name and -version
Modified Paths:
--------------
branches/gsoc15-portfile/Makefile
branches/gsoc15-portfile/Portfile.template
branches/gsoc15-portfile/port-create.tcl
branches/gsoc15-portfile/port-create.test
Modified: branches/gsoc15-portfile/Makefile
===================================================================
--- branches/gsoc15-portfile/Makefile 2015-06-08 07:49:38 UTC (rev 137286)
+++ branches/gsoc15-portfile/Makefile 2015-06-08 10:08:22 UTC (rev 137287)
@@ -1,2 +1,8 @@
+tclsh=/opt/local/libexec/macports/bin/tclsh8.5
+
+run: port-create.tcl
+ $(tclsh) port-create.tcl -url https://www.kernel.org/pub/software/scm/git/git-2.4.2.tar.gz
+ $(tclsh) port-create.tcl -url https://www.kernel.org/pub/software/scm/git/git-2.4.2.tar.gz -name foo -version 1.0
+
test: port-create.tcl all.tcl port-create.test
- /opt/local/libexec/macports/bin/tclsh8.5 all.tcl
+ $(tclsh) all.tcl
Modified: branches/gsoc15-portfile/Portfile.template
===================================================================
--- branches/gsoc15-portfile/Portfile.template 2015-06-08 07:49:38 UTC (rev 137286)
+++ branches/gsoc15-portfile/Portfile.template 2015-06-08 10:08:22 UTC (rev 137287)
@@ -11,6 +11,6 @@
description __Description__
long_description __LongDescription__
-platforms __Platforms__
+platforms darwin
homepage __Homepage__
Modified: branches/gsoc15-portfile/port-create.tcl
===================================================================
--- branches/gsoc15-portfile/port-create.tcl 2015-06-08 07:49:38 UTC (rev 137286)
+++ branches/gsoc15-portfile/port-create.tcl 2015-06-08 10:08:22 UTC (rev 137287)
@@ -44,15 +44,35 @@
return $template
}
-proc parse_cli_argument {argv} {
+if {[string equal $argv0 port-create.tcl]} {
+ set name ""
+ set version ""
+
package require cmdline
set options {
+ {url.arg "" "set the tarball URL of port"}
{name.arg "" "set the name of port"}
{version.arg "" "set the version of port"}
}
- array set params [::cmdline::getoptions argv $options]
+ set usage ": $argv0 \[-url <url>] \[-name <name>] \[-version <version>]\noptions:"
+ array set params [::cmdline::getoptions argv $options $usage]
- set name $params(name)
- set version $params(version)
- return [list $name $version]
+ if {[expr {[string length $params(url)] > 0}]} {
+ set tarball [get_tarball_filename $params(url)]
+ set name [get_name $tarball]
+ set version [get_version $tarball]
+ }
+
+ if {[expr {[string length $params(name)] > 0}]} {
+ set name $params(name)
+ }
+
+ if {[expr {[string length $params(version)] > 0}]} {
+ set version $params(version)
+ }
+
+ set template [read_template "./Portfile.template"]
+ set template [string map "__PortName__ $name" $template]
+ set template [string map "__PortVersion__ $version" $template]
+ puts $template
}
Modified: branches/gsoc15-portfile/port-create.test
===================================================================
--- branches/gsoc15-portfile/port-create.test 2015-06-08 07:49:38 UTC (rev 137286)
+++ branches/gsoc15-portfile/port-create.test 2015-06-08 10:08:22 UTC (rev 137287)
@@ -11,8 +11,4 @@
list [get_name $tarball] [get_version $tarball]
} -result [list git 2.4.2]
-test parse_cli_argument_test {} -body {
- parse_cli_argument {-name git -version 2.4.2}
-} -result [list git 2.4.2]
-
cleanupTests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150608/1bb5c574/attachment.html>
More information about the macports-changes
mailing list