[118642] trunk/dports

devans at macports.org devans at macports.org
Sun Apr 6 10:59:47 PDT 2014


Revision: 118642
          https://trac.macports.org/changeset/118642
Author:   devans at macports.org
Date:     2014-04-06 10:59:47 -0700 (Sun, 06 Apr 2014)
Log Message:
-----------
vala: update to version 0.24.0.

Modified Paths:
--------------
    trunk/dports/gnome/gnome-common/Portfile
    trunk/dports/gnome/gnome-common/files/patch-gnome-autogen.sh.diff
    trunk/dports/gnome/gnome-icon-theme/Portfile
    trunk/dports/gnome/gnome-icon-theme-extras/Portfile
    trunk/dports/gnome/gnome-icon-theme-symbolic/Portfile
    trunk/dports/gnome/gnome-themes-standard/Portfile
    trunk/dports/gnome/gsettings-desktop-schemas/Portfile
    trunk/dports/gnome/libgtop/Portfile
    trunk/dports/gnome/planner/Portfile
    trunk/dports/graphics/OpenSceneGraph-devel/Portfile
    trunk/dports/lang/vala/Portfile
    trunk/dports/net/libquvi-scripts/Portfile

Added Paths:
-----------
    trunk/dports/gnome/gnome-icon-theme-symbolic/files/
    trunk/dports/gnome/libgtop/files/patch-sysdeps-darwin-netload.c.diff
    trunk/dports/net/libquvi-scripts/files/
    trunk/dports/net/libquvi-scripts/files/url.lua

Property Changed:
----------------
    trunk/dports/gnome/gnome-common/
    trunk/dports/gnome/gnome-icon-theme/
    trunk/dports/gnome/gnome-icon-theme-extras/
    trunk/dports/gnome/gnome-icon-theme-symbolic/
    trunk/dports/gnome/gnome-themes-standard/
    trunk/dports/lang/vala/


Property changes on: trunk/dports/gnome/gnome-common
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/mld-qt-481/dports/gnome/gnome-common:92720,92813,92891,92963,93522,93556,93699,93743,93771-93773,93806,93817-93818,93856
/users/devans/GNOME-3/stable/dports/gnome/gnome-common:118192-118641
/users/rmstonecipher/gnome/gnome-common:102363-103172

Modified: trunk/dports/gnome/gnome-common/Portfile
===================================================================
--- trunk/dports/gnome/gnome-common/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/gnome/gnome-common/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -4,7 +4,7 @@
 PortSystem      1.0
 
 name            gnome-common
-version         3.10.0
+version         3.12.0
 set branch      [join [lrange [split ${version} .] 0 1] .]
 maintainers     nomaintainer
 categories      gnome
@@ -23,8 +23,8 @@
 
 use_xz          yes
 
-checksums       rmd160  da2a76865667cb8d4665fb5ada8ec4c09bfdd386 \
-                sha256  aed69474a671e046523827f73ba5e936d57235b661db97900db7356e1e03b0a3
+checksums       rmd160  f23cb20600b9dd15da3149f9f585d2ceb69a531c \
+                sha256  18712bc2df6b2dd88a11b9f7f874096d1c0c6e7ebc9cfc0686ef963bd590e1d8
 
 patchfiles      patch-gnome-autogen.sh.diff
 

Modified: trunk/dports/gnome/gnome-common/files/patch-gnome-autogen.sh.diff
===================================================================
--- trunk/dports/gnome/gnome-common/files/patch-gnome-autogen.sh.diff	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/gnome/gnome-common/files/patch-gnome-autogen.sh.diff	2014-04-06 17:59:47 UTC (rev 118642)
@@ -1,6 +1,6 @@
---- macros2/gnome-autogen.sh.orig	2013-09-03 13:32:52.000000000 -0700
-+++ macros2/gnome-autogen.sh	2013-11-23 11:58:37.000000000 -0800
-@@ -109,7 +109,7 @@
+--- macros2/gnome-autogen.sh.orig	2014-03-24 05:16:46.000000000 -0700
++++ macros2/gnome-autogen.sh	2014-03-24 22:43:38.000000000 -0700
+@@ -110,7 +110,7 @@
      if [ "$vc_status" != 0 ]; then
  	printerr "***Error***: You must have $vc_package >= $vc_min_version installed"
  	printerr "  to build $PKG_NAME.  Download the appropriate package for"


Property changes on: trunk/dports/gnome/gnome-icon-theme
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/mld-qt-481/dports/gnome/gnome-icon-theme:92720,92813,92891,92963,93522,93556,93699,93743,93771-93773,93806,93817-93818,93856
/users/devans/GNOME-3/stable/dports/gnome/gnome-icon-theme:108269-113174
/users/rmstonecipher/gnome/gnome-icon-theme:102363-103172
   + /branches/mld-qt-481/dports/gnome/gnome-icon-theme:92720,92813,92891,92963,93522,93556,93699,93743,93771-93773,93806,93817-93818,93856
/users/devans/GNOME-3/stable/dports/gnome/gnome-icon-theme:108269-118641
/users/devans/GNOME-3/unstable/dports/gnome/gnome-icon-theme:117866-118152
/users/rmstonecipher/gnome/gnome-icon-theme:102363-103172

Modified: trunk/dports/gnome/gnome-icon-theme/Portfile
===================================================================
--- trunk/dports/gnome/gnome-icon-theme/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/gnome/gnome-icon-theme/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -4,7 +4,7 @@
 PortSystem          1.0
 
 name                gnome-icon-theme
-version             3.10.0
+version             3.12.0
 set branch          [join [lrange [split ${version} .] 0 1] .]
 maintainers         nomaintainer
 categories          gnome
@@ -20,8 +20,8 @@
 
 use_xz              yes
 
-checksums           rmd160  2d7f1945a40d87b201e868d599e7ddd3b57eb251 \
-                    sha256  c65472b5846c67b97fe75200c5180faccd1347a04caa8390fc0ad23de75b36f6
+checksums           rmd160  90cde65cc4459f9fdc2b9ab480951c78465a2582 \
+                    sha256  359e720b9202d3aba8d477752c4cd11eced368182281d51ffd64c8572b4e503a
 
 depends_build       port:intltool \
                     port:pkgconfig \
@@ -30,8 +30,12 @@
     
 supported_archs     noarch
 
-# autoreconf with MacPorts patched intltool.m4
+# update m4/intltool.m4 and autoreconf
 
+post-patch {
+    copy -force ${prefix}/share/aclocal/intltool.m4 ${worksrcpath}/m4
+}
+
 use_autoreconf      yes
 autoreconf.args     -fi
 


Property changes on: trunk/dports/gnome/gnome-icon-theme-extras
___________________________________________________________________
Added: svn:mergeinfo
   + /users/devans/GNOME-3/stable/dports/gnome/gnome-icon-theme-extras:113175-118641

Modified: trunk/dports/gnome/gnome-icon-theme-extras/Portfile
===================================================================
--- trunk/dports/gnome/gnome-icon-theme-extras/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/gnome/gnome-icon-theme-extras/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -4,7 +4,7 @@
 PortSystem      1.0
 
 name            gnome-icon-theme-extras
-version         3.6.2
+version         3.12.0
 set branch      [join [lrange [split ${version} .] 0 1] .]
 maintainers     nomaintainer
 categories      gnome
@@ -20,8 +20,8 @@
 
 use_xz          yes
 
-checksums       rmd160  04edfd0998a5ba470885f84eae05d1da72f6f758 \
-                sha256  93aaaadf40c85ebc42232a4d8e45ca507754b8e1271e797bbcdaded52bd03ec7
+checksums       rmd160  90a0e1f115ebc0136d083177c4843b8fae07ce40 \
+                sha256  4eec6cea8a7b09c4ed6ebab1a3b42539b9c61a53bec4b8872e774611cc619608
 
 depends_build   port:pkgconfig \
                 port:icon-naming-utils \


Property changes on: trunk/dports/gnome/gnome-icon-theme-symbolic
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/mld-qt-481/dports/gnome/gnome-icon-theme-symbolic:92720,92813,92891,92963,93522,93556,93699,93743,93771-93773,93806,93817-93818,93856
/users/devans/GNOME-3/stable/dports/gnome/gnome-icon-theme-symbolic:108269-113174
/users/rmstonecipher/gnome/gnome-icon-theme-symbolic:102363-103172
   + /branches/mld-qt-481/dports/gnome/gnome-icon-theme-symbolic:92720,92813,92891,92963,93522,93556,93699,93743,93771-93773,93806,93817-93818,93856
/users/devans/GNOME-3/stable/dports/gnome/gnome-icon-theme-symbolic:108269-118641
/users/devans/GNOME-3/unstable/dports/gnome/gnome-icon-theme-symbolic:114069-118152
/users/rmstonecipher/gnome/gnome-icon-theme-symbolic:102363-103172

Modified: trunk/dports/gnome/gnome-icon-theme-symbolic/Portfile
===================================================================
--- trunk/dports/gnome/gnome-icon-theme-symbolic/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/gnome/gnome-icon-theme-symbolic/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -4,7 +4,7 @@
 PortSystem      1.0
 
 name            gnome-icon-theme-symbolic
-version         3.10.1
+version         3.12.0
 set branch      [join [lrange [split ${version} .] 0 1] .]
 maintainers     nomaintainer
 categories      gnome
@@ -21,11 +21,12 @@
 
 use_xz          yes
 
-checksums       rmd160  331225cb81f3c6201d27b84b96ad7781e06d0084 \
-                sha256  344e88e5f9dac3184bf012d9bac972110df2133b93d76f2ad128d4c9cbf41412
+checksums       rmd160  8df41f2d16dde4135bfb19c99fb7f0982a695cc1 \
+                sha256  851a4c9d8e8cb0000c9e5e78259ab8b8e67c5334e4250ebcc8dfdaa33520068b
 
 depends_build   port:pkgconfig \
-                port:icon-naming-utils
+                port:icon-naming-utils \
+                port:gtk3
 
 configure.env-append \
                 GTK_UPDATE_ICON_CACHE=${prefix}/bin/gtk-update-icon-cache-3.0
@@ -33,4 +34,6 @@
 supported_archs noarch
 installs_libs   no
 
+patchfiles      patch-configure.diff
+
 livecheck.type  gnome


Property changes on: trunk/dports/gnome/gnome-themes-standard
___________________________________________________________________
Added: svn:mergeinfo
   + /users/devans/GNOME-3/stable/dports/gnome/gnome-themes-standard:118155-118641
/users/devans/GNOME-3/unstable/dports/gnome/gnome-themes-standard:114069-118151

Modified: trunk/dports/gnome/gnome-themes-standard/Portfile
===================================================================
--- trunk/dports/gnome/gnome-themes-standard/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/gnome/gnome-themes-standard/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -5,8 +5,7 @@
 
 name            gnome-themes-standard
 conflicts       gnome-themes
-version         3.10.0
-revision        1
+version         3.12.0
 set branch      [join [lrange [split ${version} .] 0 1] .]
 categories      gnome
 maintainers     devans openmaintainer
@@ -24,8 +23,8 @@
 
 use_xz          yes
 
-checksums       rmd160  2b82891d7ab85581f3ae1a8abe25bde00900e071 \
-                sha256  812c6cfc534fced921dc327b436e70020d8979529284bb59d72d6f37af1f4b38
+checksums       rmd160  261021d7df4dc1745db9ded24e709362cb3a81ae \
+                sha256  a05d1b7ca872b944a69d0c0cc2369408ece32ff4355e37f8594a1b70d13c3217
 
 depends_build   port:intltool \
                 port:pkgconfig
@@ -56,4 +55,3 @@
 "
 
 livecheck.type  gnome
-livecheck.name  ${name}

Modified: trunk/dports/gnome/gsettings-desktop-schemas/Portfile
===================================================================
--- trunk/dports/gnome/gsettings-desktop-schemas/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/gnome/gsettings-desktop-schemas/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -4,8 +4,7 @@
 PortSystem      1.0
 
 name            gsettings-desktop-schemas
-version         3.10.1
-revision        1
+version         3.12.0
 license         LGPL-2.1
 set branch      [join [lrange [split ${version} .] 0 1] .]
 
@@ -23,8 +22,8 @@
 
 use_xz          yes
 
-checksums       rmd160  dc01367492261140bfb6a5fbd466cdc863b80911 \
-                sha256  452378c4960a145747ec69f8c6a874e5b7715454df3e2452d1ff1a0a82e76811
+checksums       rmd160  7434a7160871402693c03bcbc54e86c4ec01ba13 \
+                sha256  a623888a47999599abca9728156459b93634e93ac7243a86cf1fc8c2d75f478d
 
 supported_archs noarch
 

Modified: trunk/dports/gnome/libgtop/Portfile
===================================================================
--- trunk/dports/gnome/libgtop/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/gnome/libgtop/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -5,6 +5,7 @@
 
 name            libgtop
 version         2.28.5
+revision        1
 license         GPL-2
 set branch      [join [lrange [split ${version} .] 0 1] .]
 
@@ -32,7 +33,8 @@
 depends_lib     path:lib/pkgconfig/glib-2.0.pc:glib2 \
                 port:gobject-introspection
 
-patchfiles      patch-libgtop-sysdeps.m4.diff
+patchfiles      patch-libgtop-sysdeps.m4.diff \
+                patch-sysdeps-darwin-netload.c.diff
 
 # update m4/intltool.m4 and autoreconf
 
@@ -45,6 +47,7 @@
 
 configure.args  --x-includes=${prefix}/include \
                 --x-libraries=${prefix}/lib \
+                --enable-debug \
                 --enable-introspection
 
 # gobject-introspection uses g-ir-scanner, which uses $CC from env

Added: trunk/dports/gnome/libgtop/files/patch-sysdeps-darwin-netload.c.diff
===================================================================
--- trunk/dports/gnome/libgtop/files/patch-sysdeps-darwin-netload.c.diff	                        (rev 0)
+++ trunk/dports/gnome/libgtop/files/patch-sysdeps-darwin-netload.c.diff	2014-04-06 17:59:47 UTC (rev 118642)
@@ -0,0 +1,9 @@
+--- sysdeps/darwin/netload.c.orig	2014-03-20 06:26:00.000000000 -0700
++++ sysdeps/darwin/netload.c	2014-03-20 06:27:11.000000000 -0700
+@@ -161,5 +161,5 @@
+ 	buf->errors_total	= buf->errors_in + buf->errors_out;
+ 	buf->collisions		= ifm->ifm_data.ifi_collisions;
+ 	buf->flags		= _glibtop_sysdeps_netload;
+-	g_free (buf);
++	// g_free (buf);
+ }

Modified: trunk/dports/gnome/planner/Portfile
===================================================================
--- trunk/dports/gnome/planner/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/gnome/planner/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -29,7 +29,9 @@
 use_xz          yes
 
 depends_build   port:pkgconfig \
-                port:intltool
+                port:intltool \
+                port:gtk-doc
+
 depends_lib     port:gtk2 \
                 port:gconf \
                 port:libgnomeui \
@@ -37,6 +39,11 @@
                 port:rarian \
                 port:libxslt
 
+# autoreconf to reconfigure with our intltool.m4
+
+use_autoreconf  yes
+autoreconf.args -fvi
+
 configure.args  --disable-python \
                 --disable-update-mimedb \
                 --disable-eds \

Modified: trunk/dports/graphics/OpenSceneGraph-devel/Portfile
===================================================================
--- trunk/dports/graphics/OpenSceneGraph-devel/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/graphics/OpenSceneGraph-devel/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -7,7 +7,7 @@
 name                    OpenSceneGraph-devel
 conflicts               OpenSceneGraph
 set my_name             OpenSceneGraph
-version                 3.2.0
+version                 3.3.0
 platforms               darwin
 categories              graphics
 maintainers             nomaintainer
@@ -24,8 +24,8 @@
 
 use_zip                 yes
 
-checksums               rmd160  cba6679cec2a9a6639f5758239b5af5b2df5208a \
-                        sha256  ceca56e58e9ba245d5f9d0661352ddf405a7cb105341a122c5541b69c0ce032e
+checksums               rmd160  8de003e4803a7864e635171176b125703dd7c1a2 \
+                        sha256  55224da955d58705d1cf9ec46a4129f29e8f37e69f4e9430c28f978594e1a5c6
 
 patchfiles              patch-CMakeLists.txt.diff
 


Property changes on: trunk/dports/lang/vala
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/mld-qt-481/dports/lang/vala:92720,92813,92891,92963,93522,93556,93699,93743,93771-93773,93806,93817-93818,93856
/users/devans/GNOME-3/stable/dports/lang/vala:118155-118641
/users/devans/GNOME-3/unstable/dports/lang/vala:116416-118151

Modified: trunk/dports/lang/vala/Portfile
===================================================================
--- trunk/dports/lang/vala/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/lang/vala/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -4,7 +4,7 @@
 PortSystem          1.0
 
 name                vala
-version             0.22.1
+version             0.24.0
 set branch          [join [lrange [split ${version} .] 0 1] .]
 categories          lang
 maintainers         nomaintainer
@@ -23,8 +23,8 @@
 
 use_xz              yes
 
-checksums           rmd160  992ac53af83f9bbdcfbaa5a62ff39342f37929e3 \
-                    sha256  92c61b94a427f281ba2537b69135a3be23248b153268057d7195003dd6aba28c
+checksums           rmd160  dd078fe42dc502b9c700eadc2d79f4dde541fb69 \
+                    sha256  22a37c977512c19cd29c373eaaef96cb2c994795d491106f32387f3f9d1e899c
 
 depends_build       path:bin/pkg-config:pkgconfig \
                     port:libxslt

Modified: trunk/dports/net/libquvi-scripts/Portfile
===================================================================
--- trunk/dports/net/libquvi-scripts/Portfile	2014-04-06 15:42:51 UTC (rev 118641)
+++ trunk/dports/net/libquvi-scripts/Portfile	2014-04-06 17:59:47 UTC (rev 118642)
@@ -5,6 +5,7 @@
 
 name                libquvi-scripts
 version             0.9.20131130
+revision            1
 categories          net www
 license             AGPL-3
 maintainers         openmaintainer snc
@@ -31,4 +32,14 @@
 # tests require libquvi to be installed but libquvi depends on libquvi-scripts
 test.run            no
 
+# some scripts require socket.url from port lua-luasocket (#42520)
+# manually install socket/url.lua taken from that port into the common script directory 
+# since lua-luasocket is currently broken (#35858)
+
+post-destroot {
+    set common_dir ${destroot}${prefix}/share/${name}/${version}/common
+    file mkdir ${common_dir}/socket
+    copy ${filespath}/url.lua ${common_dir}/socket
+}
+
 livecheck.regex     ${name}-(\\d+(\\.\\d+)+)

Added: trunk/dports/net/libquvi-scripts/files/url.lua
===================================================================
--- trunk/dports/net/libquvi-scripts/files/url.lua	                        (rev 0)
+++ trunk/dports/net/libquvi-scripts/files/url.lua	2014-04-06 17:59:47 UTC (rev 118642)
@@ -0,0 +1,297 @@
+-----------------------------------------------------------------------------
+-- URI parsing, composition and relative URL resolution
+-- LuaSocket toolkit.
+-- Author: Diego Nehab
+-- RCS ID: $Id: url.lua,v 1.38 2006/04/03 04:45:42 diego Exp $
+-----------------------------------------------------------------------------
+
+-----------------------------------------------------------------------------
+-- Declare module
+-----------------------------------------------------------------------------
+local string = require("string")
+local base = _G
+local table = require("table")
+module("socket.url")
+
+-----------------------------------------------------------------------------
+-- Module version
+-----------------------------------------------------------------------------
+_VERSION = "URL 1.0.1"
+
+-----------------------------------------------------------------------------
+-- Encodes a string into its escaped hexadecimal representation
+-- Input
+--   s: binary string to be encoded
+-- Returns
+--   escaped representation of string binary
+-----------------------------------------------------------------------------
+function escape(s)
+    return string.gsub(s, "([^A-Za-z0-9_])", function(c)
+        return string.format("%%%02x", string.byte(c))
+    end)
+end
+
+-----------------------------------------------------------------------------
+-- Protects a path segment, to prevent it from interfering with the
+-- url parsing.
+-- Input
+--   s: binary string to be encoded
+-- Returns
+--   escaped representation of string binary
+-----------------------------------------------------------------------------
+local function make_set(t)
+	local s = {}
+	for i,v in base.ipairs(t) do
+		s[t[i]] = 1
+	end
+	return s
+end
+
+-- these are allowed withing a path segment, along with alphanum
+-- other characters must be escaped
+local segment_set = make_set {
+    "-", "_", ".", "!", "~", "*", "'", "(",
+	")", ":", "@", "&", "=", "+", "$", ",",
+}
+
+local function protect_segment(s)
+	return string.gsub(s, "([^A-Za-z0-9_])", function (c)
+		if segment_set[c] then return c
+		else return string.format("%%%02x", string.byte(c)) end
+	end)
+end
+
+-----------------------------------------------------------------------------
+-- Encodes a string into its escaped hexadecimal representation
+-- Input
+--   s: binary string to be encoded
+-- Returns
+--   escaped representation of string binary
+-----------------------------------------------------------------------------
+function unescape(s)
+    return string.gsub(s, "%%(%x%x)", function(hex)
+        return string.char(base.tonumber(hex, 16))
+    end)
+end
+
+-----------------------------------------------------------------------------
+-- Builds a path from a base path and a relative path
+-- Input
+--   base_path
+--   relative_path
+-- Returns
+--   corresponding absolute path
+-----------------------------------------------------------------------------
+local function absolute_path(base_path, relative_path)
+    if string.sub(relative_path, 1, 1) == "/" then return relative_path end
+    local path = string.gsub(base_path, "[^/]*$", "")
+    path = path .. relative_path
+    path = string.gsub(path, "([^/]*%./)", function (s)
+        if s ~= "./" then return s else return "" end
+    end)
+    path = string.gsub(path, "/%.$", "/")
+    local reduced
+    while reduced ~= path do
+        reduced = path
+        path = string.gsub(reduced, "([^/]*/%.%./)", function (s)
+            if s ~= "../../" then return "" else return s end
+        end)
+    end
+    path = string.gsub(reduced, "([^/]*/%.%.)$", function (s)
+        if s ~= "../.." then return "" else return s end
+    end)
+    return path
+end
+
+-----------------------------------------------------------------------------
+-- Parses a url and returns a table with all its parts according to RFC 2396
+-- The following grammar describes the names given to the URL parts
+-- <url> ::= <scheme>://<authority>/<path>;<params>?<query>#<fragment>
+-- <authority> ::= <userinfo>@<host>:<port>
+-- <userinfo> ::= <user>[:<password>]
+-- <path> :: = {<segment>/}<segment>
+-- Input
+--   url: uniform resource locator of request
+--   default: table with default values for each field
+-- Returns
+--   table with the following fields, where RFC naming conventions have
+--   been preserved:
+--     scheme, authority, userinfo, user, password, host, port,
+--     path, params, query, fragment
+-- Obs:
+--   the leading '/' in {/<path>} is considered part of <path>
+-----------------------------------------------------------------------------
+function parse(url, default)
+    -- initialize default parameters
+    local parsed = {}
+    for i,v in base.pairs(default or parsed) do parsed[i] = v end
+    -- empty url is parsed to nil
+    if not url or url == "" then return nil, "invalid url" end
+    -- remove whitespace
+    -- url = string.gsub(url, "%s", "")
+    -- get fragment
+    url = string.gsub(url, "#(.*)$", function(f)
+        parsed.fragment = f
+        return ""
+    end)
+    -- get scheme
+    url = string.gsub(url, "^([%w][%w%+%-%.]*)%:",
+        function(s) parsed.scheme = s; return "" end)
+    -- get authority
+    url = string.gsub(url, "^//([^/]*)", function(n)
+        parsed.authority = n
+        return ""
+    end)
+    -- get query stringing
+    url = string.gsub(url, "%?(.*)", function(q)
+        parsed.query = q
+        return ""
+    end)
+    -- get params
+    url = string.gsub(url, "%;(.*)", function(p)
+        parsed.params = p
+        return ""
+    end)
+    -- path is whatever was left
+    if url ~= "" then parsed.path = url end
+    local authority = parsed.authority
+    if not authority then return parsed end
+    authority = string.gsub(authority,"^([^@]*)@",
+        function(u) parsed.userinfo = u; return "" end)
+    authority = string.gsub(authority, ":([^:]*)$",
+        function(p) parsed.port = p; return "" end)
+    if authority ~= "" then parsed.host = authority end
+    local userinfo = parsed.userinfo
+    if not userinfo then return parsed end
+    userinfo = string.gsub(userinfo, ":([^:]*)$",
+        function(p) parsed.password = p; return "" end)
+    parsed.user = userinfo
+    return parsed
+end
+
+-----------------------------------------------------------------------------
+-- Rebuilds a parsed URL from its components.
+-- Components are protected if any reserved or unallowed characters are found
+-- Input
+--   parsed: parsed URL, as returned by parse
+-- Returns
+--   a stringing with the corresponding URL
+-----------------------------------------------------------------------------
+function build(parsed)
+    local ppath = parse_path(parsed.path or "")
+    local url = build_path(ppath)
+    if parsed.params then url = url .. ";" .. parsed.params end
+    if parsed.query then url = url .. "?" .. parsed.query end
+	local authority = parsed.authority
+	if parsed.host then
+		authority = parsed.host
+		if parsed.port then authority = authority .. ":" .. parsed.port end
+		local userinfo = parsed.userinfo
+		if parsed.user then
+			userinfo = parsed.user
+			if parsed.password then
+				userinfo = userinfo .. ":" .. parsed.password
+			end
+		end
+		if userinfo then authority = userinfo .. "@" .. authority end
+	end
+    if authority then url = "//" .. authority .. url end
+    if parsed.scheme then url = parsed.scheme .. ":" .. url end
+    if parsed.fragment then url = url .. "#" .. parsed.fragment end
+    -- url = string.gsub(url, "%s", "")
+    return url
+end
+
+-----------------------------------------------------------------------------
+-- Builds a absolute URL from a base and a relative URL according to RFC 2396
+-- Input
+--   base_url
+--   relative_url
+-- Returns
+--   corresponding absolute url
+-----------------------------------------------------------------------------
+function absolute(base_url, relative_url)
+    if base.type(base_url) == "table" then
+        base_parsed = base_url
+        base_url = build(base_parsed)
+    else
+        base_parsed = parse(base_url)
+    end
+    local relative_parsed = parse(relative_url)
+    if not base_parsed then return relative_url
+    elseif not relative_parsed then return base_url
+    elseif relative_parsed.scheme then return relative_url
+    else
+        relative_parsed.scheme = base_parsed.scheme
+        if not relative_parsed.authority then
+            relative_parsed.authority = base_parsed.authority
+            if not relative_parsed.path then
+                relative_parsed.path = base_parsed.path
+                if not relative_parsed.params then
+                    relative_parsed.params = base_parsed.params
+                    if not relative_parsed.query then
+                        relative_parsed.query = base_parsed.query
+                    end
+                end
+            else    
+                relative_parsed.path = absolute_path(base_parsed.path or "",
+                    relative_parsed.path)
+            end
+        end
+        return build(relative_parsed)
+    end
+end
+
+-----------------------------------------------------------------------------
+-- Breaks a path into its segments, unescaping the segments
+-- Input
+--   path
+-- Returns
+--   segment: a table with one entry per segment
+-----------------------------------------------------------------------------
+function parse_path(path)
+	local parsed = {}
+	path = path or ""
+	--path = string.gsub(path, "%s", "")
+	string.gsub(path, "([^/]+)", function (s) table.insert(parsed, s) end)
+	for i = 1, table.getn(parsed) do
+		parsed[i] = unescape(parsed[i])
+	end
+	if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end
+	if string.sub(path, -1, -1) == "/" then parsed.is_directory = 1 end
+	return parsed
+end
+
+-----------------------------------------------------------------------------
+-- Builds a path component from its segments, escaping protected characters.
+-- Input
+--   parsed: path segments
+--   unsafe: if true, segments are not protected before path is built
+-- Returns
+--   path: corresponding path stringing
+-----------------------------------------------------------------------------
+function build_path(parsed, unsafe)
+	local path = ""
+	local n = table.getn(parsed)
+	if unsafe then
+		for i = 1, n-1 do
+			path = path .. parsed[i]
+			path = path .. "/"
+		end
+		if n > 0 then
+			path = path .. parsed[n]
+			if parsed.is_directory then path = path .. "/" end
+		end
+	else
+		for i = 1, n-1 do
+			path = path .. protect_segment(parsed[i])
+			path = path .. "/"
+		end
+		if n > 0 then
+			path = path .. protect_segment(parsed[n])
+			if parsed.is_directory then path = path .. "/" end
+		end
+	end
+	if parsed.is_absolute then path = "/" .. path end
+	return path
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140406/de48927d/attachment-0001.html>


More information about the macports-changes mailing list