[Assorted-commits] SF.net SVN: assorted: [577] shell-tools/trunk/src/bash-commons/assorted. bash
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-03-03 04:30:05
|
Revision: 577 http://assorted.svn.sourceforge.net/assorted/?rev=577&view=rev Author: yangzhang Date: 2008-03-02 20:30:11 -0800 (Sun, 02 Mar 2008) Log Message: ----------- added a bunch of stuff to assorted.bash Modified Paths: -------------- shell-tools/trunk/src/bash-commons/assorted.bash Modified: shell-tools/trunk/src/bash-commons/assorted.bash =================================================================== --- shell-tools/trunk/src/bash-commons/assorted.bash 2008-03-03 04:29:50 UTC (rev 576) +++ shell-tools/trunk/src/bash-commons/assorted.bash 2008-03-03 04:30:11 UTC (rev 577) @@ -2,7 +2,7 @@ # This is a common include file for all project configuration scripts for # Assorted Projects. - +# # This takes an argument specifying the operation, which can be: # # - publish: generate the website and upload it @@ -14,15 +14,15 @@ # Required variables -: $fullname $version $license $websrcs $webfiles $rels +: $fullname $version $license $websrcs $rels -projdir="$( dirname "$0" )" +projdir="$( realpath "$( dirname "$0" )" )" cd $projdir project="$( basename "$( realpath "$projdir/.." )" )" root_site_dir="$( parent-dir named assorted )/assorted-site/trunk" || die 'could not find project root dir' -: ${clean:=false} ${nodl:=false} +: ${clean:=false} ${nodl:=false} ${webfiles:=} prof=shell-sf base_web_dir=assorted/htdocs webdir=$base_web_dir/$project @@ -30,19 +30,34 @@ package=$project-$version dllinks() { - if ! $nodl ; then + if (( "${#rels}" > 0 )) && ! $nodl ; then python -c " from sys import * -def f(): +def kinds(): for arg in argv[2:]: kind, _ = arg.split(':') + yield kind +def f(): + for kind in kinds(): if kind == 'src-tgz': - yield ( '[download src tgz $version]', + yield ( '[download $version src tgz]', 'http://assorted.googlecode.com/files/$package.tar.gz' ) + elif kind in [ 'jar', 'scala-ant', 'java-ant' ]: + yield ( '[download $version jar]', + 'http://assorted.googlecode.com/files/$package.jar' ) + elif kind == 'pypi': + # TODO this should be more robust + yield ( '[download $version egg]', + 'http://pypi.python.org/packages/2.5/p/$project/$( echo $project | sed s/-/_/g )-$version-py2.5.egg' ) + yield ( '[download $version src tgz]', + 'http://pypi.python.org/packages/source/p/$project/$package.tar.gz' ) + yield ( '[PyPI page]', + 'http://pypi.python.org/pypi/$project/' ) +tail = '|' if 'pypi' in kinds() else '| [more downloads] |' if argv[1] == 'links': - print ' | '.join( tup[0] for tup in f() ) + print ' | '.join( link for (link,url) in f() ), tail else: - print '\\n'.join( tup[0] + ': ' + tup[1] for tup in f() ) + print '\\\\\\n'.join( link + ': ' + url for (link,url) in f() ) " "$@" "${rels[@]}" fi } @@ -64,35 +79,84 @@ # Body. + if head -1 README | grep -q '^\[' ; then + cat README + else + # Make space for the subsequent injection of links. + echo + echo + echo + cat README + fi | sed " 1,1 { - s/\(\[.*\]\)/\1 | $dllinks | [more downloads] | [browse svn] | [SF project page]/ - s/^$/$dllinks | [more downloads] | [browse svn] | [SF project page]/ + s/\(\[.*\)/\1 | $dllinks [browse svn] | [home page]/ + s/^$/$dllinks [browse svn] | [home page]/ } 2,2 { a\\ $dlurls\\ [more downloads]: http://code.google.com/p/assorted/downloads/list\\ [browse svn]: http://assorted.svn.sourceforge.net/viewvc/assorted/$project/trunk/\\ -[SF project page]: http://www.sourceforge.net/projects/assorted/ +[home page]: http://assorted.sf.net/$project/\\ + } - " README + " # Footer. + local license_text license_links case $license in - gpl3 ) echo " -License -------- + gpl3 ) + license_text='the [GNU GPL3]' + license_links='[GNU GPL3]: http://www.gnu.org/licenses/gpl.html' ;; + psf ) + license_text="the [PSF License], the same as Python's license" + license_links='[PSF License]: http://www.python.org/psf/license.html' ;; + scala ) + license_text="a 3-clause BSD-style license, the same as Scala's license" + license_links="$( cat << "EOF" + Copyright (c) 2007 The Scala Commons. All rights reserved. -$fullname is released under the [GNU GPL3]. + Permission to use, copy, modify, and distribute this software in source + or binary form for any purpose with or without fee is hereby granted, + provided that the following conditions are met: -[GNU GPL3]: http://www.gnu.org/licenses/gpl.html -" ;; + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. Neither the name of the Scala Commons nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS "AS IS" AND ANY EXPRESS + OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +EOF +)" ;; * ) die "unknown license: $license" ;; esac + echo " +License +------- - echo " +$fullname is released under $license_text. + +$license_links + Contact ------- @@ -108,7 +172,8 @@ } stage() { - local gendir="$( mktemp -d )" + run-if-def pre-stage + if (( ${#webfiles} > 0 )) ; then for inp in "${webfiles[@]}" ; do if [[ "${inp%:*}" == "$inp" ]] ; then @@ -120,7 +185,7 @@ done fi - local src out + local gendir="$( mktemp -d )" src out if (( ${#websrcs} > 0 )) ; then for src in "${websrcs[@]}" ; do if [[ $src == README ]] @@ -135,6 +200,8 @@ done fi + run-if-def post-stage + echo "gendir $gendir stagedir $stagedir" } @@ -152,6 +219,13 @@ " } +exp() { + svn -q export . "$1" + if [[ "${websrcs[0]}" == README ]] + then mkreadme > "$1/README" + fi +} + # TODO: insert license header into source files (intelligently, without # displacing modelines) package() { @@ -162,14 +236,24 @@ local exportdir="$( mktemp -d )" dst=${rel%:*} src=${rel#*:} case $dst in src-tgz ) - svn -q export . $exportdir/$package + exp $exportdir/$package rm -f $exportdir/$package/publish.bash tar czf $stagedir/$package.tar.gz -C $exportdir $package ;; - #jar ) - # cd $exportdir/ - # simple-build $projdir/build - # make -s - # jar cf $package.jar -C $exportdir $package ;; + scala-ant | java-ant ) + ant -q \ + -Dscala.home=/usr/local \ + -Dbuild.dir=$exportdir/build \ + -Ddist.dir=$stagedir \ + -Dtmp.dir=$exportdir/tmp ;; + jar ) + ( + cd $exportdir/ + simple-build $projdir/src/build + make -s + cp out/$project.jar $stagedir/$package.jar + ) ;; + pypi ) + exp $stagedir/$package-py ;; * ) die "unknown dst type: $dst" ;; esac fi @@ -188,10 +272,16 @@ summary="Source tarball for $fullname $version" labels='Featured,Type-Source' file=$stagedir/$package.tar.gz ;; - jar ) - summary="JAR archive for $fullname $version" + jar | java-ant | scala-ant ) + summary="JAR for $fullname $version" labels=Featured file=$stagedir/$package.jar ;; + pypi ) + ( + cd $stagedir/$package-py + ./setup.py register sdist bdist_egg upload + ) + continue ;; * ) die "unknown dst type: $dst" ;; esac googlecode_upload -p assorted -s "$summary" -l "$labels" $file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |