<!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>[116821] users/cal/ports/macports/mpstats</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/116821">116821</a></dd>
<dt>Author</dt> <dd>cal@macports.org</dd>
<dt>Date</dt> <dd>2014-02-07 15:39:55 -0800 (Fri, 07 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>mpstats: working macports statistics submission port</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#userscalportsmacportsmpstatsPortfile">users/cal/ports/macports/mpstats/Portfile</a></li>
<li><a href="#userscalportsmacportsmpstatsfilesmpstatsconf">users/cal/ports/macports/mpstats/files/mpstats.conf</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#userscalportsmacportsmpstatsfilesmpstatsplistdefault">users/cal/ports/macports/mpstats/files/mpstats.plist.default</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#userscalportsmacportsmpstatsfilessetupstatssh">users/cal/ports/macports/mpstats/files/setupstats.sh</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="userscalportsmacportsmpstatsPortfile"></a>
<div class="modfile"><h4>Modified: users/cal/ports/macports/mpstats/Portfile (116820 => 116821)</h4>
<pre class="diff"><span>
<span class="info">--- users/cal/ports/macports/mpstats/Portfile        2014-02-07 23:39:28 UTC (rev 116820)
+++ users/cal/ports/macports/mpstats/Portfile        2014-02-07 23:39:55 UTC (rev 116821)
</span><span class="lines">@@ -8,38 +8,90 @@
</span><span class="cx"> license             BSD
</span><span class="cx"> platforms           darwin
</span><span class="cx"> supported_archs     noarch
</span><del>-maintainers         nomaintainer
</del><ins>+maintainers         cal openmaintainer
</ins><span class="cx"> description         submit statistics about your macports installation
</span><span class="cx"> long_description \
</span><del>-   This is a script and LaunchAgent which can run weekly to report \
</del><ins>+   This is a script and LaunchAgent which will run weekly to report \
</ins><span class="cx">    information about your system and installed ports to a server, which \
</span><del>-   publishes the aggregate statistics on the web.
</del><ins>+   publishes the aggregate statistics on the web. \
+   \nThis helps us to make better decisions on which configurations we should \
+   support and test more and which ports are most commonly used.
</ins><span class="cx"> 
</span><span class="cx"> homepage            http://www.macports.org/
</span><del>-master_sites        sourceforge:macports
</del><ins>+distfiles
</ins><span class="cx"> 
</span><del>-use_bzip2           yes
-checksums           rmd160 6411865c289d95f15eec870fd3aa8d1ffa7c4502 \
-                    sha256 43a7c0e5956acf96f6a3e9c913229c6decbeabb5a4e5645a829a7fca7878a7ef
</del><ins>+set launchd_dir     ${prefix}/etc/${startupitem.location}/${startupitem.uniquename}/
</ins><span class="cx"> 
</span><ins>+startupitem.create   no
+startupitem.autostart \
+                    yes
+
+extract.mkdir       yes
+extract {
+    xinstall -m 644 -W ${filespath} mpstats.tcl mpstats.plist.default ${worksrcpath}
+}
+
</ins><span class="cx"> configure {
</span><del>-    reinplace &quot;s|set prefix /opt/local|set prefix ${prefix}|&quot; ${worksrcpath}/mpstats.tcl
</del><ins>+    reinplace &quot;s|@PREFIX@|${prefix}|g&quot; \
+        ${worksrcpath}/mpstats.tcl \
+        ${worksrcpath}/mpstats.plist.default
+    reinplace &quot;s|@LABEL@|${startupitem.uniquename}|g&quot; \
+        ${worksrcpath}/mpstats.plist.default
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> build {}
</span><ins>+
</ins><span class="cx"> destroot {
</span><del>-    xinstall ${worksrcpath}/mpstats.tcl ${destroot}${prefix}/bin/mpstats
-    xinstall -m 444 ${worksrcpath}/mpstats.conf ${destroot}${prefix}/etc/mpstats.conf.default
-    system -W ${worksrcpath} &quot;DESTDIR=${destroot} ./setupstats.sh ${prefix}/bin/mpstats&quot;
</del><ins>+    xinstall -m 755 \
+        ${worksrcpath}/mpstats.tcl \
+        ${destroot}${prefix}/libexec/mpstats
+
+    xinstall -m 755 -d \
+        ${destroot}${launchd_dir}
+    xinstall -m 444 \
+        ${worksrcpath}/mpstats.plist.default \
+        ${destroot}${launchd_dir}${startupitem.plist}.default
+
+    xinstall -m 444 \
+        ${filespath}/mpstats.conf \
+        ${destroot}${prefix}/etc/mpstats.conf.default
+
+    # install the plist, if startupitem.install is set
+    if {[getuid] == 0 &amp;&amp; ${startupitem.install} ne no} {
+        xinstall -m 755 -d ${destroot}/Library/${startupitem.location}
+        # note this symlink *will* be broken at destroot time; we'll place the
+        # correct file there on activation
+        ln -sf &quot;${launchd_dir}${startupitem.plist}&quot; &quot;${destroot}/Library/${startupitem.location}&quot;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> post-activate {
</span><span class="cx">     if {![file exists ${prefix}/etc/mpstats.conf]} {
</span><del>-        copy ${prefix}/etc/mpstats.conf.default ${prefix}/etc/mpstats.conf
-        reinplace &quot;s|@STATS_UUID@|[exec uuidgen]|&quot; ${prefix}/etc/mpstats.conf
</del><ins>+        xinstall -m 644 \
+            ${prefix}/etc/mpstats.conf.default \
+            ${prefix}/etc/mpstats.conf
+
+        reinplace &quot;s|@STATS_UUID@|[exec uuidgen]|&quot; \
+            ${prefix}/etc/mpstats.conf
</ins><span class="cx">     }
</span><ins>+
+    # the result of this will usually be too large for a 64bit integer, but we don't really care
+    set hwuuid [exec system_profiler SPHardwareDataType | grep &quot;Hardware UUID&quot; | awk &quot;/Hardware UUID/ {print \$3}&quot; | tr -d - | bc]
+    xinstall -m 644 \
+        ${launchd_dir}${startupitem.plist}.default \
+        ${launchd_dir}${startupitem.plist}
+    reinplace &quot;s|@WEEKDAY@|[expr $hwuuid % 7]|g&quot; \
+        ${launchd_dir}${startupitem.plist}
+    reinplace &quot;s|@HOUR@|[clock format [clock seconds] -format %H]|g&quot; \
+        ${launchd_dir}${startupitem.plist}
+    reinplace &quot;s|@MINUTE@|[clock format [clock seconds] -format %M]|g&quot; \
+        ${launchd_dir}${startupitem.plist}
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+post-deactivate {
+    delete -force ${launchd_dir}${startupitem.plist}
+}
+
</ins><span class="cx"> notes \
</span><del>-&quot;To enable automatic weekly reporting of data to the stats server,\
-run:
-launchctl load -w /Library/LaunchAgents/org.macports.stats.plist&quot;
</del><ins>+    &quot;Installing this port automatically enables weekly reporting of data to the stats server. \
+     Uninstall or deactivate this port if you want to stop providing data to MacPorts.&quot;
</ins></span></pre></div>
<a id="userscalportsmacportsmpstatsfilesmpstatsconf"></a>
<div class="modfile"><h4>Modified: users/cal/ports/macports/mpstats/files/mpstats.conf (116820 => 116821)</h4>
<pre class="diff"><span>
<span class="info">--- users/cal/ports/macports/mpstats/files/mpstats.conf        2014-02-07 23:39:28 UTC (rev 116820)
+++ users/cal/ports/macports/mpstats/files/mpstats.conf        2014-02-07 23:39:55 UTC (rev 116821)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> # configuration for mpstats
</span><span class="cx"> 
</span><span class="cx"> # Where to submit usage data
</span><del>-stats_url       localhost
</del><ins>+stats_url       http://stats.macports.neverpanic.de/submissions
</ins><span class="cx"> 
</span><span class="cx"> # Unique identifier for usage statistics - should be of the form produced by
</span><span class="cx"> # `uuidgen`. Note that mpstats.conf.default has a placeholder value here, as
</span></span></pre></div>
<a id="userscalportsmacportsmpstatsfilesmpstatsplistdefault"></a>
<div class="addfile"><h4>Added: users/cal/ports/macports/mpstats/files/mpstats.plist.default (0 => 116821)</h4>
<pre class="diff"><span>
<span class="info">--- users/cal/ports/macports/mpstats/files/mpstats.plist.default                                (rev 0)
+++ users/cal/ports/macports/mpstats/files/mpstats.plist.default        2014-02-07 23:39:55 UTC (rev 116821)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
+&lt;plist version=&quot;1.0&quot;&gt;
+        &lt;dict&gt;
+                &lt;key&gt;Label&lt;/key&gt;
+                &lt;string&gt;@LABEL@&lt;/string&gt;
+                &lt;key&gt;ProgramArguments&lt;/key&gt;
+                &lt;array&gt;
+                        &lt;string&gt;@PREFIX@/libexec/mpstats&lt;/string&gt;
+                        &lt;string&gt;submit&lt;/string&gt;
+                &lt;/array&gt;
+                &lt;key&gt;StartCalendarInterval&lt;/key&gt;
+                &lt;dict&gt;
+                        &lt;key&gt;Weekday&lt;/key&gt;
+                        &lt;integer&gt;@WEEKDAY@&lt;/integer&gt;
+                        &lt;key&gt;Hour&lt;/key&gt;
+                        &lt;integer&gt;@HOUR@&lt;/integer&gt;
+                        &lt;key&gt;Minute&lt;/key&gt;
+                        &lt;integer&gt;@MINUTE@&lt;/integer&gt;
+                &lt;/dict&gt;
+        &lt;/dict&gt;
+&lt;/plist&gt;
</ins></span></pre></div>
<a id="userscalportsmacportsmpstatsfilessetupstatssh"></a>
<div class="delfile"><h4>Deleted: users/cal/ports/macports/mpstats/files/setupstats.sh (116820 => 116821)</h4>
<pre class="diff"><span>
<span class="info">--- users/cal/ports/macports/mpstats/files/setupstats.sh        2014-02-07 23:39:28 UTC (rev 116820)
+++ users/cal/ports/macports/mpstats/files/setupstats.sh        2014-02-07 23:39:55 UTC (rev 116821)
</span><span class="lines">@@ -1,73 +0,0 @@
</span><del>-#!/bin/sh
-
-# Where the generated plist should be written
-PLIST=${DESTDIR}/Library/LaunchAgents/org.macports.stats.plist
-
-die () {
-    echo &gt;&amp;2 &quot;$@&quot;
-    exit 1
-}
-
-# Make sure exactly 2 arguments are provided
-[ &quot;$#&quot; -eq 1 ] || die &quot;exactly one argument required&quot;
-
-# $1 must be the path to the script launchd will execute
-SCRIPT=$1
-
-# Make sure the script argument is executable
-if [ ! -x &quot;${DESTDIR}${SCRIPT}&quot; ]; then
-           die &quot;$SCRIPT is not a valid executable&quot;
-fi
-
-# Determine the day and time that launchd should run the script
-setup_times() {
-    # Get hardware uuid - Hardware UUID: UUID
-    huuid=`system_profiler SPHardwareDataType | grep &quot;Hardware UUID&quot;`
-    
-    # Strip out Hardware UUID:   
-    huuid=`echo $huuid | awk '/Hardware UUID/ {print $3;}'`
-    
-    # Strip out '-' characters
-    huuid=`echo $huuid | tr -d -`
-    
-    # Weekday is hardware uuid mod 7
-    weekday=`echo $huuid % 7 | bc`
-    
-    # Use current hours and minute
-    hour=`date '+%H'`
-    minute=`date '+%M'`
-}
-
-# Generate the launchd plist that executes 'port stats submit'
-# Outputs to the file $plist
-generate_plist() {
-    setup_times
-    mkdir -p `dirname $PLIST`
-        cat &lt;&lt;-EOF &gt; $PLIST
-                &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
-        &lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
-        &lt;plist version=&quot;1.0&quot;&gt;
-         &lt;dict&gt;
-          &lt;key&gt;Label&lt;/key&gt;
-          &lt;string&gt;org.macports.stats&lt;/string&gt;
-          &lt;key&gt;ProgramArguments&lt;/key&gt;
-          &lt;array&gt;
-             &lt;string&gt;$SCRIPT&lt;/string&gt;
-             &lt;string&gt;submit&lt;/string&gt;
-          &lt;/array&gt;
-          &lt;key&gt;StartCalendarInterval&lt;/key&gt;
-          &lt;dict&gt;
-            &lt;key&gt;Weekday&lt;/key&gt;
-            &lt;integer&gt;$weekday&lt;/integer&gt;
-            &lt;key&gt;Hour&lt;/key&gt;
-            &lt;integer&gt;$hour&lt;/integer&gt;
-            &lt;key&gt;Minute&lt;/key&gt;
-            &lt;integer&gt;$minute&lt;/integer&gt;
-          &lt;/dict&gt;
-         &lt;/dict&gt;
-        &lt;/plist&gt;
-        EOF
-}
-
-# Generate and install the plist
-generate_plist
</del></span></pre>
</div>
</div>

</body>
</html>