From 7523082df39e27a4b3011e36052634351a26dd97 Mon Sep 17 00:00:00 2001 From: grygoriiz Date: Thu, 12 Jun 2014 13:14:13 +0300 Subject: [PATCH] Added development helper tools for MAC OS --- tools/dev_tools/macos/bar | 9 ++++ tools/dev_tools/macos/lar | 1 + tools/dev_tools/macos/par | 2 + tools/dev_tools/macos/perdiff | 27 ++++++++++ tools/dev_tools/macos/pergit | 98 +++++++++++++++++++++++++++++++++++ 5 files changed, 137 insertions(+) create mode 100755 tools/dev_tools/macos/bar create mode 100755 tools/dev_tools/macos/lar create mode 100755 tools/dev_tools/macos/par create mode 100755 tools/dev_tools/macos/perdiff create mode 100644 tools/dev_tools/macos/pergit diff --git a/tools/dev_tools/macos/bar b/tools/dev_tools/macos/bar new file mode 100755 index 0000000000..bf133adbd7 --- /dev/null +++ b/tools/dev_tools/macos/bar @@ -0,0 +1,9 @@ +cd $AD/tracks +( + if [ "$1" != "rebuild" ] ; then + ./waf build -v + else + ./waf clean + if ./waf configure --program-name=Tracks; then ./waf build -v; fi + fi +) 2>&1 | tee $AD/buildlog.txt #"$AD/tracks-build-log.`date +%Y-%m-%d--%H.%M`.txt" diff --git a/tools/dev_tools/macos/lar b/tools/dev_tools/macos/lar new file mode 100755 index 0000000000..ef0551edc0 --- /dev/null +++ b/tools/dev_tools/macos/lar @@ -0,0 +1 @@ +$AD/tracks/gtk2_ardour/ardev $* \ No newline at end of file diff --git a/tools/dev_tools/macos/par b/tools/dev_tools/macos/par new file mode 100755 index 0000000000..8f82dc7308 --- /dev/null +++ b/tools/dev_tools/macos/par @@ -0,0 +1,2 @@ +cd $AD/tracks/tools/osx_packaging +./osx_build --public \ No newline at end of file diff --git a/tools/dev_tools/macos/perdiff b/tools/dev_tools/macos/perdiff new file mode 100755 index 0000000000..a368412b59 --- /dev/null +++ b/tools/dev_tools/macos/perdiff @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Generate a unified diff between two specified revisions in a +# Perforce repository +# + +if [ $# -lt 3 ] ; then + echo "usage: $0 DEPOT-SPEC REV1 REV2" + echo "OR : $0 DEPOT-SPEC REV1 DEPOT-SPEC REV2" + exit 1 +fi + +if [ $# -eq 3 ] ; then + depot1=$1 + depot2=$1 + rev1=$2 + rev2=$3 +elif [ $# -eq 4 ] ; then + depot1=$1 + rev1=$2 + depot2=$3 + rev2=$4 +fi + +p4 diff2 -u ${depot1}...@${rev1} ${depot2}...@${rev2} | \ + sed 's@//depot/@E:/Source/@g' | \ + sed '/^+++\|---/s@/@\\@g' diff --git a/tools/dev_tools/macos/pergit b/tools/dev_tools/macos/pergit new file mode 100644 index 0000000000..f7249a89a0 --- /dev/null +++ b/tools/dev_tools/macos/pergit @@ -0,0 +1,98 @@ +#!/bin/sh + +# Accepts two argument: the git reference (SHA-1 hash) that +# corresponds to the current state of the Perforce repository. + +# Assumption: we are in the folder where the Perforce repository is +# located and the paths that git will provided, when stripped of one +# initial folder (e.g. a/b/c/d => b/c/d) will correctly reference +# the files. + +if [ $# -lt 2 ] ; then + echo "usage: $0 SHA-1-describing-perforce /path/to/git/repo" + exit 1 +fi + +dry_run="--dry-run" + +while true ; do + case $1 in + -l|--live) dry_run= ; shift ;; + *) break ;; + esac +done + +# Now check argument list again + +if [ $# -lt 2 ] ; then + echo "usage: $0 SHA-1-describing-perforce /path/to/git/repo" + exit 1 +fi + +earliest=$1 +gitdir=$2 + +if [ ! -d $gitdir ] ; then + echo "Git repository $gitdir does not exist or is not a directory" + exit 1 +fi + +if [ ! -d $gitdir/.git ] ; then + echo "Git repository $gitdir does not appear to be a git repository (no .git folder)" + exit 1 +fi + +# +# Let the user know what is about to happen +# + +if [ x$dry_run != x ] ; then + echo "This will be a DRY RUN. No files will be modified. Press enter to continue" +else + echo "This will be a live run. Files WILL be modified. Press enter to continue" +fi +read + +# +# get a list of commits since $earliest (i.e. everything not yet present in the Perforce repo +# + +commitlist=`(cd $gitdir && git log --reverse $earliest..HEAD) | grep '^commit' | cut -d' ' -f2` + +for commit in $commitlist ; do + printf "Next revision: + + $(cd $gitdir && git log --pretty=oneline -n 1 $commit). + +Press enter to try to apply this change:" + + read + + while [ true ] ; do + if (cd $gitdir && git show $commit) | patch -p1 $dry_run ; then + echo "Completed successfully." + break; + else + echo "Git commit $commit did not apply cleanly." + printf "Type s to skip, w to wait (while you fix it) or enter to stop this merge: " + read r + case $r in + s|S) break; + ;; + w|W) printf "OK, type enter when you're ready to continue or anything else to quit: " + read rr + if [ x$rr != x ] ; then + echo "The commit that you stopped before merging was " $commit + exit 1 + fi + ;; + *) echo "When you restart, remember to use $commit as the first argument to this script." + exit 1 + ;; + esac + fi + done +done + +echo "The Perforce workspace at `pwd` is now current with the git repository at $gitdir" +exit 0