From 59a6cf4b6aff8cb8c6b4062f2b5dd9718c419779 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 25 Aug 2011 14:29:37 +0000 Subject: [PATCH] - add script to build source package Changed files: closure-compiler.spec -> 1.7 get-source.sh -> 1.1 --- closure-compiler.spec | 3 ++- get-source.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 get-source.sh diff --git a/closure-compiler.spec b/closure-compiler.spec index 8e53330..0b6ce66 100644 --- a/closure-compiler.spec +++ b/closure-compiler.spec @@ -1,5 +1,5 @@ # TODO -# - build from source +# - build from source (get-source.sh fetches it) %include /usr/lib/rpm/macros.java Summary: Closure Compiler - JavaScript compressor @@ -11,6 +11,7 @@ Group: Applications/WWW Source0: http://closure-compiler.googlecode.com/files/compiler-%{version}.tar.gz # Source0-md5: 815d453b7c51657241d11307231a4037 Source1: %{name}.sh +Source2: get-source.sh URL: http://closure-compiler.appspot.com/ BuildRequires: rpm-javaprov BuildRequires: rpmbuild(macros) >= 1.300 diff --git a/get-source.sh b/get-source.sh new file mode 100644 index 0000000..0ab1dd0 --- /dev/null +++ b/get-source.sh @@ -0,0 +1,27 @@ +#!/bin/sh +p=closure-compiler +fn=compiler +svn=http://$p.googlecode.com/svn/trunk +dl=https://code.google.com/p/$p/downloads/list?can=3 + +set -x + +html() { + if [ -z "$html" ]; then + html=$(lynx -width 1200 -dump -nolist "$dl") + fi + echo "$html" +} + +rev=$(html | perl -nne '/'$fn'-latest.tar.gz.*Build at r(\d+)/and print $1') +date=$(html | perl -ne '/'$fn'-(\d+).tar.gz.*Build at r'$rev'/and print $1') + +d=$p-$date +if [ ! -d "$d" ]; then + svn export -q $svn@$rev $p-$date +fi + +t=$d.tar.bz2 +if [ ! -f "$t" ]; then + tar -cjf $t --exclude-vcs $d +fi -- 2.44.0