<!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 "s|set prefix /opt/local|set prefix ${prefix}|" ${worksrcpath}/mpstats.tcl
</del><ins>+ reinplace "s|@PREFIX@|${prefix}|g" \
+ ${worksrcpath}/mpstats.tcl \
+ ${worksrcpath}/mpstats.plist.default
+ reinplace "s|@LABEL@|${startupitem.uniquename}|g" \
+ ${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} "DESTDIR=${destroot} ./setupstats.sh ${prefix}/bin/mpstats"
</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 && ${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 "${launchd_dir}${startupitem.plist}" "${destroot}/Library/${startupitem.location}"
+ }
</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 "s|@STATS_UUID@|[exec uuidgen]|" ${prefix}/etc/mpstats.conf
</del><ins>+ xinstall -m 644 \
+ ${prefix}/etc/mpstats.conf.default \
+ ${prefix}/etc/mpstats.conf
+
+ reinplace "s|@STATS_UUID@|[exec uuidgen]|" \
+ ${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 "Hardware UUID" | awk "/Hardware UUID/ {print \$3}" | tr -d - | bc]
+ xinstall -m 644 \
+ ${launchd_dir}${startupitem.plist}.default \
+ ${launchd_dir}${startupitem.plist}
+ reinplace "s|@WEEKDAY@|[expr $hwuuid % 7]|g" \
+ ${launchd_dir}${startupitem.plist}
+ reinplace "s|@HOUR@|[clock format [clock seconds] -format %H]|g" \
+ ${launchd_dir}${startupitem.plist}
+ reinplace "s|@MINUTE@|[clock format [clock seconds] -format %M]|g" \
+ ${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>-"To enable automatic weekly reporting of data to the stats server,\
-run:
-launchctl load -w /Library/LaunchAgents/org.macports.stats.plist"
</del><ins>+ "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."
</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>+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+        <dict>
+                <key>Label</key>
+                <string>@LABEL@</string>
+                <key>ProgramArguments</key>
+                <array>
+                        <string>@PREFIX@/libexec/mpstats</string>
+                        <string>submit</string>
+                </array>
+                <key>StartCalendarInterval</key>
+                <dict>
+                        <key>Weekday</key>
+                        <integer>@WEEKDAY@</integer>
+                        <key>Hour</key>
+                        <integer>@HOUR@</integer>
+                        <key>Minute</key>
+                        <integer>@MINUTE@</integer>
+                </dict>
+        </dict>
+</plist>
</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 >&2 "$@"
- exit 1
-}
-
-# Make sure exactly 2 arguments are provided
-[ "$#" -eq 1 ] || die "exactly one argument required"
-
-# $1 must be the path to the script launchd will execute
-SCRIPT=$1
-
-# Make sure the script argument is executable
-if [ ! -x "${DESTDIR}${SCRIPT}" ]; then
-         die "$SCRIPT is not a valid executable"
-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 "Hardware UUID"`
-
- # 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 <<-EOF > $PLIST
-                <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
- <plist version="1.0">
- <dict>
- <key>Label</key>
- <string>org.macports.stats</string>
- <key>ProgramArguments</key>
- <array>
- <string>$SCRIPT</string>
- <string>submit</string>
- </array>
- <key>StartCalendarInterval</key>
- <dict>
- <key>Weekday</key>
- <integer>$weekday</integer>
- <key>Hour</key>
- <integer>$hour</integer>
- <key>Minute</key>
- <integer>$minute</integer>
- </dict>
- </dict>
- </plist>
-        EOF
-}
-
-# Generate and install the plist
-generate_plist
</del></span></pre>
</div>
</div>
</body>
</html>