<!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>[15479] CalendarServer/trunk/support</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="http://trac.calendarserver.org//changeset/15479">15479</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2016-03-18 17:26:34 -0700 (Fri, 18 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Git based submission and dependency-caching scripts</pre>

<h3>Added Paths</h3>
<ul>
<li><a href="#CalendarServertrunksupport_cache_deps_git">CalendarServer/trunk/support/_cache_deps_git</a></li>
<li><a href="#CalendarServertrunksupportsubmit_git">CalendarServer/trunk/support/submit_git</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunksupport_cache_deps_git"></a>
<div class="addfile"><h4>Added: CalendarServer/trunk/support/_cache_deps_git (0 => 15479)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/support/_cache_deps_git                                (rev 0)
+++ CalendarServer/trunk/support/_cache_deps_git        2016-03-19 00:26:34 UTC (rev 15479)
</span><span class="lines">@@ -0,0 +1,149 @@
</span><ins>+#!/bin/sh
+# -*- sh-basic-offset: 2 -*-
+
+##
+# Copyright (c) 2005-2016 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+set -e
+set -u
+
+wd=&quot;$(cd &quot;$(dirname &quot;$0&quot;)/..&quot; &amp;&amp; pwd)&quot;;
+
+. &quot;${wd}/bin/_build.sh&quot;;
+
+init_build;
+
+export PATH=&quot;/Applications/Server.app/Contents/ServerRoot/usr/bin:${PATH}&quot;;
+
+requirements=&quot;${wd}/requirements-osx.txt&quot;;
+extra_features=&quot;OpenDirectory,Postgres&quot;;
+
+
+#
+# Download virtualenv and friends so that B&amp;I has that core toolchain.
+#
+
+mkdir -p &quot;${wd}/.develop/tools&quot;;
+
+for pkg in             \
+    setuptools-18.5    \
+    pip-7.1.2          \
+    virtualenv-13.1.2  \
+; do
+       name=&quot;${pkg%-*}&quot;;
+    version=&quot;${pkg#*-}&quot;;
+     first=&quot;$(echo &quot;${name}&quot; | sed 's|^\(.\).*$|\1|')&quot;;
+       url=&quot;https://pypi.python.org/packages/source/${first}/${name}/${pkg}.tar.gz&quot;;
+
+    ruler &quot;Downloading ${pkg}&quot;;
+
+    curl -L -o &quot;${wd}/.develop/tools/${pkg}.tgz&quot; &quot;${url}&quot;;
+done;
+
+
+#
+# Build cffi because xattr needs it at setup time.
+#
+
+if ! find_header ffi.h; then
+  c_glue_include=&quot;${dev_roots}/c_glue/include&quot;;
+  mkdir -p &quot;${c_glue_include}&quot;;
+  echo &quot;#include &lt;ffi/ffi.h&gt;&quot; &gt; &quot;${c_glue_include}/ffi.h&quot;
+  export C_INCLUDE_PATH=&quot;${c_glue_include}:${C_INCLUDE_PATH:-}&quot;;
+fi;
+
+
+#
+# Download dependencies
+#
+
+ve_tmp=&quot;$(mktemp -d -t CalendarServer_ve_tools)&quot;;
+
+# Bootstrap virtualenv and friends so we can use them in this script (not sent to B&amp;I).
+py_ve_tools=&quot;${ve_tmp}/ve_tools&quot;;
+export PYTHONPATH=&quot;${py_ve_tools}/lib:${wd}:${PYTHONPATH:-}&quot;;
+bootstrap_virtualenv;
+
+reqs_to_use=&quot;${ve_tmp}/requirements-osx.txt&quot;;
+
+# Copy over each requirements file we need and edit a few to remove stuff we don't need
+sed -e '/requirements-dev.txt/d' &lt; &quot;${wd}/requirements-osx.txt&quot; &gt; &quot;${ve_tmp}/requirements-osx.txt&quot;;
+sed -e '/python-ldap/d' &lt; &quot;${wd}/requirements-cs.txt&quot; &gt; &quot;${ve_tmp}/requirements-cs.txt&quot;;
+echo &quot;xattr==0.7.5&quot; &gt;&gt; &quot;${ve_tmp}/requirements-cs.txt&quot;;
+cp &quot;${wd}/requirements-twisted-osx.txt&quot; &quot;${ve_tmp}/&quot;;
+
+ruler &quot;Downloading Python requirements for .[${extra_features}]&quot;;
+echo &quot;&quot;;
+pip_download                       \
+  --allow-unverified cx-Oracle     \
+  --no-deps                        \
+  --requirement=&quot;${reqs_to_use}&quot;  \
+  ;
+
+rm -rf &quot;${ve_tmp}&quot;;
+
+
+#
+# Check out CalDAVTester
+#
+
+url=&quot;$(grep egg=CalDAVTester &quot;${wd}/requirements-dev.txt&quot; | sed 's|^.*git+\([^@#]*\).*$|\1|')&quot;;
+rev=&quot;$(grep egg=CalDAVTester &quot;${wd}/requirements-dev.txt&quot; | sed 's|^.*git+[^@#]*@\([0-9a-z]*\).*$|\1|')&quot;;
+
+git clone &quot;${url}&quot; &quot;${wd}/CalDAVTester&quot;;
+rm -rf &quot;${wd}/CalDAVTester/.git&quot;;
+# FIXME: checkout rev
+tar -C &quot;${wd}&quot; -cvzf &quot;${wd}/CalDAVTester.tgz&quot; CalDAVTester;
+rm -r CalDAVTester;
+
+
+
+#
+# Remove .exe files from archives
+#
+
+for archive in $(find &quot;${wd}/.develop&quot; -type f -name '*.tgz' -or -name '*.tar.gz'); do
+  if tar -tvzf &quot;${archive}&quot; &quot;*.exe&quot; &gt; /dev/null 2&gt;&amp;1; then
+    ruler &quot;Removing binaries from ${archive}&quot;;
+    tmp=&quot;$(mktemp -t ccsXXXXX)&quot;;
+    gzcat &quot;${archive}&quot; | gnutar --delete --wildcards -vf - &quot;*.exe&quot; &gt; &quot;${tmp}&quot;;
+    gzip -c &quot;${tmp}&quot; &gt; &quot;${archive}&quot;;
+    rm &quot;${tmp}&quot;;
+  fi;
+done;
+
+
+
+#
+# Remove .eggs files from archives
+#
+
+for archive in $(find &quot;${wd}/.develop&quot; -type f -name '*.zip'); do
+  if unzip -qql &quot;${archive}&quot; &quot;*/.eggs/&quot; &gt; /dev/null 2&gt;&amp;1; then
+    ruler &quot;Removing eggs from ${archive}&quot;;
+    zip -qd &quot;${archive}&quot; &quot;*/.eggs/*&quot;;
+  fi;
+done;
+
+
+
+#
+# Remove src
+#
+ruler &quot;Removing eggs from ${archive}&quot;;
+rm -rf &quot;${wd}/src&quot;
+
+ruler &quot;&quot;;
</ins><span class="cx">Property changes on: CalendarServer/trunk/support/_cache_deps_git
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="CalendarServertrunksupportsubmit_git"></a>
<div class="addfile"><h4>Added: CalendarServer/trunk/support/submit_git (0 => 15479)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/support/submit_git                                (rev 0)
+++ CalendarServer/trunk/support/submit_git        2016-03-19 00:26:34 UTC (rev 15479)
</span><span class="lines">@@ -0,0 +1,221 @@
</span><ins>+#!/bin/sh
+
+##
+# Copyright (c) 2005-2016 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+##
+# Submit project to B&amp;I (Apple internal build)
+##
+
+set -e
+set -u
+
+
+ wd=&quot;$(cd &quot;$(dirname &quot;$0&quot;)&quot; &amp;&amp; pwd)&quot;;
+src=&quot;$(cd &quot;${wd}/..&quot; &amp;&amp; pwd)&quot;;
+
+unset CALENDARSERVER_BUILD_DEPS;
+
+project=&quot;CalendarServer&quot;;
+uri=&quot;https://github.com/macosforge/ccs-calendarserver-copy.git&quot;;
+
+##
+# Command line
+##
+
+  build=false;
+install=false;
+package=false;
+
+    build_no_verify_source=false;
+              tag_to_build=&quot;&quot;;
+           project_version=&quot;&quot;;
+
+usage ()
+{
+  program=&quot;$(basename &quot;$0&quot;)&quot;;
+
+  if [ &quot;${1-}&quot; != &quot;-&quot; ]; then echo &quot;$@&quot;; echo; fi;
+
+  echo &quot;Usage: ${program} release [release ...]&quot;;
+  echo &quot;       ${program} release -b[ipn]&quot;;
+  echo &quot;&quot;;
+  echo &quot;Options:&quot;;
+  echo &quot;        -b Run buildit&quot;;
+  echo &quot;        -i Install resulting build on this system&quot;;
+  echo &quot;        -p Create a package with the resulting build&quot;;
+  echo &quot;        -n skip buildit source verification&quot;;
+  echo &quot;  -t which tag to submit&quot;;
+  echo &quot;  -v project version (defaults to -t value)&quot;;
+
+  if [ &quot;${1-}&quot; == &quot;-&quot; ]; then return 0; fi;
+  exit 64;
+}
+
+while getopts 'hbipnt:v:' option; do
+  case &quot;$option&quot; in
+    '?') usage; ;;
+    'h') usage -; exit 0; ;;
+    'b')                      build=true; ;;
+    'i')                    install=true; ;;
+    'p')                    package=true; ;;
+    'n')            build_no_verify_source=true; ;;
+    't')        tag_to_build=&quot;${OPTARG}&quot;; ;;
+    'v')     project_version=&quot;${OPTARG}&quot;; ;;
+  esac;
+done;
+shift $((${OPTIND} - 1));
+
+if [ &quot;${tag_to_build}&quot; != &quot;&quot; ]; then
+  if [ &quot;${project_version}&quot; == &quot;&quot; ]; then
+    project_version=&quot;${tag_to_build}&quot;;
+  fi;
+fi;
+
+
+if ! &quot;${build}&quot;; then
+  # Submitting, not just building
+  if &quot;${install}&quot;; then usage &quot;-i flag requires -b&quot;; fi;
+  if &quot;${package}&quot;; then usage &quot;-p flag requires -b&quot;; fi;
+  if &quot;${build_no_verify_source}&quot;; then usage &quot;-n flag requires -b&quot;; fi;
+  if [ &quot;${project_version}&quot; == &quot;&quot; ]; then usage &quot;project_version required if submitting&quot;; fi;
+else
+  # Not submitting, just building
+  if [ &quot;${project_version}&quot; == &quot;&quot; ]; then
+    project_version=&quot;${project}-untagged&quot;;
+  fi;
+fi;
+
+if [ $# == 0 ]; then usage &quot;No releases specified&quot;; fi;
+releases=&quot;$@&quot;; shift $#;
+
+if [ $# != 0 ]; then usage &quot;Unrecognized arguments:&quot; &quot;$@&quot;; fi;
+
+##
+# Do the Right Thing
+##
+
+#
+# Do submission
+#
+
+tmp=&quot;$(mktemp -d -t CalendarServer_build)&quot;;
+wc=&quot;${tmp}/${project_version}&quot;;
+
+echo &quot;${tag_to_build}&quot;;
+
+if [ &quot;${tag_to_build}&quot; != &quot;&quot; ]; then
+  # Clone and checkout tag
+  git clone &quot;${uri}&quot; &quot;${wc}&quot;;
+  cd &quot;${wc}&quot;;
+  git checkout &quot;${tag_to_build}&quot;;
+else
+  # Copy from local directory
+  echo &quot;&quot;;
+  echo &quot;Copying ${src}...&quot;;
+  # Only copy files that are under revision control
+  git_files=&quot;$(mktemp -t git_files_XXXX)&quot;;
+  cd &quot;${src}&quot;;
+  git ls-tree --name-only -r HEAD &gt; &quot;${git_files}&quot;;
+  rsync -av                      \
+    --files-from=&quot;${git_files}&quot;  \
+    &quot;${src}/&quot; &quot;${wc}&quot;            \
+    ;
+  rm &quot;${git_files}&quot;;
+fi;
+
+cd &quot;${wc}&quot;;
+
+echo &quot;&quot;
+echo &quot;Tweaking for B&amp;I...&quot;;
+ln -s support/Apple.make &quot;${wc}/Makefile&quot;;
+
+cat - &gt;&gt; &quot;${wc}/SubmissionInfo.xml&quot; &lt;&lt;EOF
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;submission&gt;
+ &lt;project&gt;${project}&lt;/project&gt;
+ &lt;version&gt;${project_version}&lt;/version&gt;
+ &lt;source&gt;
+  &lt;git&gt;
+   &lt;repository&gt;${uri}&lt;/repository&gt;
+   &lt;tag&gt;${tag_to_build}&lt;/tag&gt;
+   &lt;date&gt;$(date -u)&lt;/date&gt;
+  &lt;/git&gt;
+ &lt;/source&gt;
+&lt;/submission&gt;
+EOF
+
+echo &quot;${tag_to_build}&quot; &gt; &quot;${wc}/gitversion.txt&quot;;
+
+echo &quot;&quot;;
+echo &quot;Preparing sources for ${project_version}...&quot;;
+&quot;${wc}/support/_cache_deps_git&quot;;
+
+# Clean up after _cache_deps
+find &quot;${wc}/.develop&quot; -depth 1 ! '(' -name pip_downloads -o -name tools ')' -print | {
+  while read filename; do
+    echo &quot;Cruft in .develop: ${filename}&quot;;
+    # exit 1;
+  done;
+}
+
+if &quot;${build}&quot;; then
+  echo &quot;&quot;;
+  echo &quot;Building ${project_version}...&quot;;
+
+  if &quot;${package}&quot;; then
+    package_tmp=&quot;${tmp}/pkg&quot;;
+    install -d &quot;${package_tmp}&quot;;
+    merge_flags=&quot;-merge ${package_tmp}&quot;;
+  elif &quot;${install}&quot;; then
+    merge_flags=&quot;-merge /&quot;;
+  else
+    merge_flags=&quot;&quot;;
+  fi;
+
+  release_flags=&quot;&quot;;
+  for release in &quot;${releases}&quot;; do
+    release_flags=&quot;${release_flags} -update Prevailing${release}&quot;;
+  done;
+
+  if &quot;${build_no_verify_source}&quot;; then
+    verify_flags=&quot; -noverifysource&quot;;
+  else
+    verify_flags=&quot;&quot;;
+  fi;
+
+  sudo ~rc/bin/buildit &quot;${wc}&quot; \
+    $(file /System/Library/Frameworks/Python.framework/Versions/Current/Python | sed -n -e 's|^.*(for architecture \([^)][^)]*\).*$|-arch \1|p' | sed 's|ppc7400|ppc|') \
+    ${merge_flags}${release_flags}${verify_flags};
+
+  if &quot;${package}&quot;; then
+    package_file=&quot;${src}/${project_version}.tgz&quot;;
+    echo &quot;Creating package: ${package_file}...&quot;;
+    tar -C &quot;${package_tmp}&quot; -cvzf &quot;${package_file}&quot; .;
+    sudo rm -rf &quot;${package_tmp}&quot;;
+    if &quot;${install}&quot;; then
+      echo &quot;Installing package: ${package_file}&quot;;
+      tar -C / -xvzf &quot;${package_file}&quot;;
+    fi;
+  fi;
+else
+  echo &quot;&quot;;
+  echo &quot;Submitting sources for ${project_version}...&quot;;
+  rm -rf &quot;${wc}/.dependencies&quot;;
+  ~rc/bin/submitproject &quot;${wc}&quot; ${releases};
+fi;
+
+sudo rm -rf &quot;${tmp}&quot;;
</ins><span class="cx">Property changes on: CalendarServer/trunk/support/submit_git
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
</div>

</body>
</html>