summaryrefslogtreecommitdiffstats
path: root/strip.sh
diff options
context:
space:
mode:
Diffstat (limited to 'strip.sh')
-rwxr-xr-xstrip.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/strip.sh b/strip.sh
new file mode 100755
index 0000000..272d9c1
--- /dev/null
+++ b/strip.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+NAME=$(sed -n '/^Name:/{s/.* //;s/%{.*}//;p}' *.spec)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+upstream=$PROJECT-$VERSION.tar.gz
+downstream=$PROJECT-$VERSION-strip.tar.bz2
+list1=$(mktemp)
+list2=$(mktemp)
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Short=$SHORT\n"
+
+if [ ! -f $upstream ]; then
+ wget https://github.com/$OWNER/$PROJECT/archive/$COMMIT/$upstream
+fi
+if [ ! -f $upstream ]; then
+ echo missgin upstream archive
+else
+ echo Unpacking...
+ tar tf $upstream >$list1
+ tar xf $upstream
+ echo Cleaning non-free stuff...
+ rm $PROJECT-$COMMIT/ext/phalcon/assets/filters/jsminifier.? \
+ $PROJECT-$COMMIT/ext/phalcon/assets/filters/cssminifier.? \
+ $PROJECT-$COMMIT/build/*/phalcon.zep.?
+ echo Packing...
+ tar cjf $downstream $PROJECT-$COMMIT
+ tar tf $downstream >$list2
+ echo "Diffing..."
+ diff $list1 $list2
+fi
+
+rm -f $list1 $list2 \ No newline at end of file