Skip to content

Instantly share code, notes, and snippets.

@ghadishayban
Created February 12, 2018 01:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghadishayban/1dbba8e77d0e8fb7b98da55e32627aee to your computer and use it in GitHub Desktop.
Save ghadishayban/1dbba8e77d0e8fb7b98da55e32627aee to your computer and use it in GitHub Desktop.
a script that vendors asm and writes itself as git commit 'transaction data'
#!/bin/bash
# author Ghadi Shayban <gshayban@gmail.com>
set -e
if [ -z ${1+x} ]
then
echo provide an asm git sha / ref
exit 1
fi
GITREF=$1
URI=https://gitlab.ow2.org/asm/asm.git
ASM_CHECKOUT=asm
CLJASM=src/jvm/clojure/asm
git clone --no-checkout $URI $ASM_CHECKOUT
pushd $ASM_CHECKOUT
git checkout $GITREF
GITREF=$(git rev-parse HEAD) # resolve refs
popd
git rm -r --ignore-unmatch $CLJASM
rsync -rt \
$ASM_CHECKOUT/asm/src/main/java/org/objectweb/asm/ \
$ASM_CHECKOUT/asm-commons/src/main/java/org/objectweb/asm/ \
$ASM_CHECKOUT/asm-tree/src/main/java/org/objectweb/asm/ \
$CLJASM \
--include '*.java' \
--include '*/' \
--exclude '*'
find $CLJASM -name '*.java' -print0 | xargs -0 sed -iBAK 's/org.objectweb.asm/clojure.asm/g'
find $CLJASM -name '*BAK' -delete
git add $CLJASM
cat - "${BASH_SOURCE[0]}" > COMMIT_MSG <<EOM
vendor asm to sha $GITREF
the following script vendors asm, asm-commons and asm-tree
in \$CLOJURE/src/main/java under the package clojure.asm
EOM
git commit -F COMMIT_MSG
rm -rf COMMIT_MSG $ASM_CHECKOUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment