Skip to content

Instantly share code, notes, and snippets.

@pierzchalski
Created March 26, 2015 05:31
Show Gist options
  • Save pierzchalski/db1f38eacd1d266bf562 to your computer and use it in GitHub Desktop.
Save pierzchalski/db1f38eacd1d266bf562 to your computer and use it in GitHub Desktop.
COMP3231 utilities
#! /bin/sh
set -e
if [ -z "$1" ]
then
echo "Usage: $0 ASSN-NUM"
echo "Fetches a copy of asst[ASSN-NUM] and puts it at"
echo "/home/\$USER/cs3231/asst[ASSN-NUM]-src".
echo "Deletes all traces of the unholy svn."
exit
fi
cd ~/cs3231
rm -rf repo
rm -rf asst$1-src
svnadmin create repo
cd /home/cs3231/assigns
svn import \
asst$1/src \
file:///home/$USER/cs3231/repo/asst$1/trunk \
-m "Initial import"
svn copy \
-m "Tag initial import" \
file:///home/$USER/cs3231/repo/asst$1/trunk \
file:///home/$USER/cs3231/repo/asst$1/initial
cd ~/cs3231
svn checkout file:///home/$USER/cs3231/repo/asst$1/trunk asst$1-src
rm -rf repo
rm -rf asst$1-src/.svn
#! /bin/sh
set -e
if [ -z "$1" ]
then
echo "Usage: $0 ASSN-NUM"
echo "produces a file 'asst[ASSN-NUM].diff containing"
echo "the differences of all files within the directory"
echo "'asst[ASSN-NUM]-src'. This script should be run"
echo "from the git root directory of the project."
echo
echo "The script looks for the first commit with commit message"
echo "matching \"Initial commit for assignment [ASSN-NUM].\","
echo "and then stores the diff from that commit to HEAD."
exit
fi
INIT_COMMIT=`git log --grep="Initial commit for assignment $1." --pretty=format:"%H"`
git diff \
--no-prefix \
--color=never \
--relative="asst$1-src" \
$INIT_COMMIT..HEAD -- asst$1-src > asst$1.diff
echo "Diff involves the following files:"
git diff --name-only $INIT_COMMIT..HEAD -- asst$1-src
#! /bin/sh
set -e
if [ -z "$1" ]
then
echo "Usage: $0 ASSN-NUM"
echo "Runs the configuration, build, depend, and install commands"
echo "for source code in '/home/\$USER/cs3231/asst[ASSN-NUM]-src'."
exit
fi
cd ~/cs3231/asst$1-src
./configure
cd ~/cs3231/asst$1-src/kern/conf
./config ASST$1
cd ../compile/ASST$1
bmake depend -j8
bmake -j8
bmake install
cd ~/cs3231/asst$1-src
bmake -j8
#! /bin/sh
set -e
if [ -z "$1" ]
then
echo "Usage: $0 ASSN-NUM"
echo "Copies an instance of the assignment source"
echo "(found at /home/cs3231/assigns/asst$1/src on the"
echo "cse machines) to /home/\$USER/cs3231/tmp,"
echo "applies the patch /home\$USER/cs3231/asst[ASSN-NUM].diff"
echo "to it, then builds and installs it."
fi
rm -rf ~/cs3231/tmp
mkdir ~/cs3231/tmp
cp -r /home/cs3231/assigns/asst$1/src ~/cs3231/tmp
cd ~/cs3231/tmp/src
patch -p0 < ~/cs3231/asst$1.diff
./configure
bmake -j8
cd kern/conf
./config ASST$1
cd ../compile/ASST$1
bmake depend -j8
bmake -j8
bmake install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment