[137870] branches/gsoc15-portfile
chunyang at macports.org
chunyang at macports.org
Mon Jun 22 06:02:33 PDT 2015
Revision: 137870
https://trac.macports.org/changeset/137870
Author: chunyang at macports.org
Date: 2015-06-22 06:02:33 -0700 (Mon, 22 Jun 2015)
Log Message:
-----------
port-create: clean up
Modified Paths:
--------------
branches/gsoc15-portfile/port-create
Removed Paths:
-------------
branches/gsoc15-portfile/Portfile.json
branches/gsoc15-portfile/Portfile.template
branches/gsoc15-portfile/groups.json
Deleted: branches/gsoc15-portfile/Portfile.json
===================================================================
--- branches/gsoc15-portfile/Portfile.json 2015-06-22 12:59:24 UTC (rev 137869)
+++ branches/gsoc15-portfile/Portfile.json 2015-06-22 13:02:33 UTC (rev 137870)
@@ -1,26 +0,0 @@
-{
- "name": "tmux",
- "version": "2.0",
- "categories": "sysutils",
- "long_description": "tmux is a terminal multiplexer",
- "platforms": "darwin",
- "license": "BSD",
- "homepage": "https://tmux.github.io",
- "checksums": {
- "sha1": "RMD160",
- "rmd160": "SHA256"
- },
-
- "github": {
- "PortGroup": "github 1.0",
- "setup": "tmux tmux 2.0",
- "tarball_from": "releases"
- },
- "perl5": {
- "PortGroup": "perl5 1.0",
- "branches": "5.8 5.10 5.12 5.14 5.16 5.18 5.20",
- "setup": "perl-ldap 0.65"
- },
-
- "depends_lib": ["libevent", "ncurses"]
-}
Deleted: branches/gsoc15-portfile/Portfile.template
===================================================================
--- branches/gsoc15-portfile/Portfile.template 2015-06-22 12:59:24 UTC (rev 137869)
+++ branches/gsoc15-portfile/Portfile.template 2015-06-22 13:02:33 UTC (rev 137870)
@@ -1,19 +0,0 @@
-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
-# $Id$
-
-PortSystem 1.0
-
-name PortName
-version PortVersion
-categories Categories
-platforms darwin
-license License
-maintainers MaintainerHandle
-description Description
-long_description LongDescription
-homepage Homepage
-
-master_sites MasterSites
-
-checksums rmd160 RMD160 \
- sha256 SHA256
Deleted: branches/gsoc15-portfile/groups.json
===================================================================
--- branches/gsoc15-portfile/groups.json 2015-06-22 12:59:24 UTC (rev 137869)
+++ branches/gsoc15-portfile/groups.json 2015-06-22 13:02:33 UTC (rev 137870)
@@ -1,7 +0,0 @@
-{
- "github": {
- "PortGroup": "github 1.0",
- "setup": "author project version [tag_prefix]",
- "tarball_from": "releases"
- }
-}
Modified: branches/gsoc15-portfile/port-create
===================================================================
--- branches/gsoc15-portfile/port-create 2015-06-22 12:59:24 UTC (rev 137869)
+++ branches/gsoc15-portfile/port-create 2015-06-22 13:02:33 UTC (rev 137870)
@@ -1,14 +1,11 @@
#!/opt/local/libexec/macports/bin/tclsh8.5
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$
-
+#
# Create Portfile
-#
-# Workflow:
-# 1. Gather metadata
-# 2. Feed template
-# 3. Print result
+package require cmdline
+
# Get tarball filename from tarball URL
proc get_tarball_filename {url} {
set length [string length $url]
@@ -55,14 +52,10 @@
return $template
}
-proc feed_template {template metadata} {
- return $template
+proc val_or_def {val def} {
+ expr {$val ne "" ? $val : $def}
}
-set name ""
-set version ""
-
-package require cmdline
set options {
{url.arg "" "set the tarball URL of port"}
{name.arg "" "set the name of port" }
@@ -89,7 +82,7 @@
exit 2
}
-# Question: duplicate code, how to merge the following five code block?
+# Parse search on other sites options
set query $params(homebrew)
if {[expr {[string length $query] > 0}]} {
exec open "https://github.com/Homebrew/homebrew/search?l=ruby&q=$query"
@@ -132,42 +125,50 @@
exit 0
}
+# Parse -group
if {[expr {[string length $params(group)] > 0}]} {
get_group $params(group) $argv
exit 0
}
+set name "replaceme"
+set version "replaceme"
+set maintainers "replaceme"
+
+# Parse -url
if {[expr {[string length $params(url)] > 0}]} {
set tarball [get_tarball_filename $params(url)]
- set name [get_name $tarball]
- set version [get_version $tarball]
+ set name [val_or_def [get_name $tarball] $name]
+ set version [val_or_def [get_version $tarball] $version]
}
-if {[expr {[string length $params(name)] > 0}]} {
- set name $params(name)
-}
+# Parse -name and -version
+set name [val_or_def $params(name) $name]
+set version [val_or_def $params(version) $version]
-if {[expr {[string length $params(version)] > 0}]} {
- set version $params(version)
+if {[info exist env(EMAIL)]} {
+ set maintainers $env(EMAIL)
}
-set template [read_template "./Portfile.template"]
-
-if {$name ne""} {
- set template [string map "PortName $name" $template]
-}
-if {$version ne ""} {
- set template [string map "PortVersion $version" $template]
-}
-
-if {[info exist env(EMAIL)] && ![string equal $env(EMAIL) ""]} {
- set template [string map "MaintainerHandle $env(EMAIL)" $template]
-}
-
-if {[expr {[string length $params(outfile)] > 0}]} {
- set outfile [open $params(outfile) w]
- puts -nonewline $outfile $template
- close $outfile
-} else {
- puts -nonewline $template
-}
+##################
+## Print Result ##
+##################
+puts "# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4"
+puts "# \$Id\$"
+puts ""
+puts "PortSystem 1.0"
+puts ""
+puts "name ${name}"
+puts "version ${version}"
+puts "categories replaceme"
+puts "platforms darwin"
+puts "maintainers replaceme"
+puts "license replaceme"
+puts "maintainers ${maintainers}"
+puts ""
+puts "description replaceme"
+puts ""
+puts "long_description replaceme"
+puts ""
+puts "checksums rmd160 12345 \\"
+puts " sha256 6789a"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150622/24e80083/attachment.html>
More information about the macports-changes
mailing list