<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[148469] trunk/dports/net/libproxy</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/148469">148469</a></dd>
<dt>Author</dt> <dd>jeremyhu@macports.org</dd>
<dt>Date</dt> <dd>2016-05-09 23:35:49 -0700 (Mon, 09 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>libproxy: Fix build failures on systems without C++11 (#51309)</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportsnetlibproxyPortfile">trunk/dports/net/libproxy/Portfile</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkdportsnetlibproxyfilespatchlibproxymodulesconfig_kdecppdiff">trunk/dports/net/libproxy/files/patch-libproxy-modules-config_kde.cpp.diff</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportsnetlibproxyPortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/net/libproxy/Portfile (148468 => 148469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/net/libproxy/Portfile        2016-05-10 05:48:48 UTC (rev 148468)
+++ trunk/dports/net/libproxy/Portfile        2016-05-10 06:35:49 UTC (rev 148469)
</span><span class="lines">@@ -10,6 +10,7 @@
</span><span class="cx"> github.setup        libproxy libproxy 0.4.13
</span><span class="cx"> name                libproxy
</span><span class="cx"> epoch               1
</span><ins>+revision            2
</ins><span class="cx"> categories          net
</span><span class="cx"> maintainers         devans openmaintainer
</span><span class="cx"> platforms           darwin
</span><span class="lines">@@ -28,7 +29,8 @@
</span><span class="cx"> 
</span><span class="cx"> patchfiles          patch-libproxy-cmake.diff \
</span><span class="cx">                     patch-libproxy-test-CMakeLists.txt.diff \
</span><del>-                    patch-bindings-perl-src-CMakeLists.txt.diff
</del><ins>+                    patch-bindings-perl-src-CMakeLists.txt.diff \
+                    patch-libproxy-modules-config_kde.cpp.diff
</ins><span class="cx"> 
</span><span class="cx"> depends_build-append \
</span><span class="cx">                     port:pkgconfig
</span></span></pre></div>
<a id="trunkdportsnetlibproxyfilespatchlibproxymodulesconfig_kdecppdiff"></a>
<div class="addfile"><h4>Added: trunk/dports/net/libproxy/files/patch-libproxy-modules-config_kde.cpp.diff (0 => 148469)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/net/libproxy/files/patch-libproxy-modules-config_kde.cpp.diff                                (rev 0)
+++ trunk/dports/net/libproxy/files/patch-libproxy-modules-config_kde.cpp.diff        2016-05-10 06:35:49 UTC (rev 148469)
</span><span class="lines">@@ -0,0 +1,170 @@
</span><ins>+From f557862be9de724eac1ec37e711221feb28fc4d7 Mon Sep 17 00:00:00 2001
+From: Jeremy Huddleston Sequoia &lt;jeremyhu@apple.com&gt;
+Date: Mon, 9 May 2016 23:29:51 -0700
+Subject: [PATCH] Revert &quot;config_kde: Add a basic cache and invalidation&quot;
+
+https://github.com/libproxy/libproxy/issues/29
+https://trac.macports.org/ticket/51309
+
+This reverts commit 28620c7aeb3d1b54c83caf84778df8e095490820.
+---
+ libproxy/modules/config_kde.cpp | 98 +++++------------------------------------
+ 1 file changed, 10 insertions(+), 88 deletions(-)
+
+diff --git libproxy/modules/config_kde.cpp libproxy/modules/config_kde.cpp
+index 515aaac..2211487 100644
+--- libproxy/modules/config_kde.cpp
++++ libproxy/modules/config_kde.cpp
+@@ -18,13 +18,9 @@
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+  ******************************************************************************/

+-#include &lt;sys/stat.h&gt;
+-#include &lt;unistd.h&gt;
+-
+ #include &lt;algorithm&gt;
+ #include &lt;cstdlib&gt;
+ #include &lt;cstdio&gt;
+-#include &lt;sstream&gt;

+ #include &quot;../extension_config.hpp&quot;
+ using namespace libproxy;
+@@ -32,18 +28,11 @@ using namespace libproxy;
+ class kde_config_extension : public config_extension {
+ public:
+     kde_config_extension()
+-        : cache_time(0)
+     {
+         try {
+             // Try the KF5 one first
+             command = &quot;kreadconfig5&quot;;
+-            command_output(&quot;kreadconfig5 --key nonexistant&quot;);
+-
+-            try {
+-                parse_dir_list(command_output(&quot;qtpaths --paths GenericConfigLocation&quot;));
+-            }
+-            catch(...) {}
+-
++            kde_config_val(&quot;proxyType&quot;, &quot;-1&quot;);
+             return; // Worked
+         }
+         catch(...) {}
+@@ -51,13 +40,7 @@ public:
+         try {
+             // The KDE4 one next
+             command = &quot;kreadconfig&quot;;
+-            command_output(command);
+-
+-            try {
+-                parse_dir_list(command_output(&quot;kde4-config --path config&quot;));
+-            }
+-            catch(...) {}
+-
++            kde_config_val(&quot;proxyType&quot;, &quot;-1&quot;);
+             return; // Worked
+         }
+         catch(...) {}
+@@ -134,7 +117,11 @@ public:
+         }

+ private:
+-    string command_output(const string &amp;cmdline) throw (runtime_error) {
++    // Neither key nor def must contain '
++    string kde_config_val(const string &amp;key, const string &amp;def) throw (runtime_error) {
++        string cmdline =
++                command + &quot; --file kioslaverc --group 'Proxy Settings' --key '&quot; + key + &quot;' --default '&quot; + def + &quot;'&quot;;
++
+         FILE *pipe = popen(cmdline.c_str(), &quot;r&quot;);
+         if (!pipe)
+             throw runtime_error(&quot;Unable to run command&quot;);
+@@ -142,84 +129,19 @@ private:
+         char buffer[128];
+         string result = &quot;&quot;;
+         while (!feof(pipe)) {
+-            if (fgets(buffer, 128, pipe) != NULL)
+-                result += buffer; // TODO: If this throws bad_alloc, pipe is leaked
++         if (fgets(buffer, 128, pipe) != NULL)
++             result += buffer; // TODO: If this throws bad_alloc, pipe is leaked
+         }

+-        if(pclose(pipe) != 0)
+-            throw runtime_error(&quot;Command failed&quot;);
++        pclose(pipe);

+         // Trim newlines and whitespace at end
+         result.erase(result.begin() + (result.find_last_not_of(&quot; \n\t&quot;)+1), result.end());
+-
+         return result;
+     }

+-    // Neither key nor def must contain '
+-    string kde_config_val(const string &amp;key, const string &amp;def) throw (runtime_error) {
+-        if (cache_needs_refresh())
+-            cache.clear();
+-        else
+-            try {
+-                // Already in cache?
+-                return cache.at(key);
+-            } catch(...) {} // Not in cache
+-
+-        string result = command_output(
+-                command + &quot; --file kioslaverc --group 'Proxy Settings' --key '&quot; + key + &quot;' --default '&quot; + def + &quot;'&quot;);
+-
+-        // Add result to cache
+-        cache[key] = result;
+-
+-        return result;
+-    }
+-
+-    // Used for cache invalidation
+-    struct configfile {
+-        string path;
+-        time_t mtime; // 0 means it doesn't exist
+-    };
+-
+-    // Parses output of qtpaths/kde4-config to fill config_locs
+-    void parse_dir_list(const string &amp;dirs) {
+-        string config_path;
+-        stringstream config_paths_stream(dirs);
+-
+-        // Try each of the listed folders, seperated by ':'
+-        while (getline(config_paths_stream, config_path, ':')) {
+-            configfile config_loc; config_loc.path = config_path + &quot;/kioslaverc&quot;;
+-            config_locs.push_back(config_loc);
+-        }
+-    }
+-
+-    // If any of the locations in config_locs changed (different mtime),
+-    // update config_locs and return true.
+-    bool cache_needs_refresh() {
+-        // Play safe here, if we can't determine the location,
+-        // don't cache at all.
+-        bool needs_refresh = config_locs.empty();
+-        struct stat config_info;
+-
+-        for (unsigned int i = 0; i &lt; config_locs.size(); ++i) {
+-            configfile &amp;config = config_locs[i];
+-            time_t current_mtime = stat(config.path.c_str(), &amp;config_info) == 0 ? config_info.st_mtime : 0;
+-            if (config.mtime != current_mtime) {
+-                config.mtime = current_mtime;
+-                needs_refresh = true;
+-            }
+-        }
+-
+-        return needs_refresh;
+-    }
+-
+     // Whether to use kreadconfig or kreadconfig5
+     string command;
+-    // When the cache was flushed last
+-    time_t cache_time;
+-    // Cache for config values
+-    map&lt;string, string&gt; cache;
+-    // State of the config files at the time of the last cache flush
+-    vector&lt;configfile&gt; config_locs;
+ };

+ MM_MODULE_INIT_EZ(kde_config_extension, getenv(&quot;KDE_FULL_SESSION&quot;), NULL, NULL);
+-- 
+2.8.2
+
</ins></span></pre>
</div>
</div>

</body>
</html>