Blame makesrc.sh

22c2c6
#!/bin/bash
22c2c6
22c2c6
NAME=$(basename $PWD)
22c2c6
OWNER=$(sed   -n '/^%global gh_owner/{s/.* //;p}'   $NAME.spec)
22c2c6
PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
22c2c6
VERSION=$(sed -n '/^Version:/{s/.* //;p}'           $NAME.spec)
22c2c6
COMMIT=$(sed  -n '/^%global gh_commit/{s/.* //;p}'  $NAME.spec)
22c2c6
SHORT=${COMMIT:0:7}
22c2c6
22c2c6
echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
22c2c6
22c2c6
echo "Cloning..."
22c2c6
rm -rf $PROJECT-$COMMIT
22c2c6
git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
22c2c6
22c2c6
echo "Getting commit..."
22c2c6
pushd $PROJECT-$COMMIT
22c2c6
git checkout $COMMIT
22c2c6
cp composer.json ../composer.json
22c2c6
popd
22c2c6
22c2c6
echo "Archiving..."
22c2c6
tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT
22c2c6
22c2c6
echo "Cleaning..."
22c2c6
rm -rf $PROJECT-$COMMIT
22c2c6
22c2c6
echo "Done."