summaryrefslogtreecommitdiffstats
path: root/makesrc.sh
diff options
context:
space:
mode:
Diffstat (limited to 'makesrc.sh')
-rwxr-xr-xmakesrc.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..2382ade
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+function archive() {
+ SHORT=${COMMIT:0:7}
+
+ if [ -f $NAME-$VERSION-$SHORT.tgz ]
+ then
+ echo Skip $NAME
+ else
+ echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION ($COMMIT)\n"
+ echo "Cloning..."
+ rm -rf $PROJECT-$COMMIT
+ git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+ echo "Getting commit..."
+ pushd $PROJECT-$COMMIT
+ if git checkout $COMMIT; then
+ cp composer.json ../${1:-composer.json}
+ else
+ exit 1
+ fi
+ popd
+
+ echo "Archiving..."
+ tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
+
+ echo "Cleaning..."
+ rm -rf $PROJECT-$COMMIT
+ fi
+}
+
+NAME=$(basename $PWD)
+SPEC=$NAME.spec
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $SPEC)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $SPEC)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $SPEC)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $SPEC)
+archive
+
+for i in test apc apcu blackhole dba ext-mongodb filesystem memcache memcached memory mongodb redis session wincache xcache zend-server
+do
+ j=${i/-/_}
+ NAME=php-laminas-cache-storage-adapter-$i
+ COMMIT=$(sed -n "/^%global gh_${j}_commit/{s/.* //;p}" $SPEC)
+ VERSION=$(sed -n "/^%global gh_${j}_version/{s/.* //;p}" $SPEC)
+ PROJECT=laminas-cache-storage-adapter-$i
+ archive composer-$i.json
+done
+
+echo "Done."