[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-cocoon-dev
Subject:    Re: Script for m10n of blocks (was Re: [RT] a simple release plan)
From:       Andreas Hochsteger <e9625392 () student ! tuwien ! ac ! at>
Date:       2006-03-17 17:34:24
Message-ID: 441AF320.7010903 () student ! tuwien ! ac ! at
[Download RAW message or body]

Reinhard Poetz schrieb:
> Andreas Hochsteger wrote:
> 
>> After analyzing the old blocks in more details I found the following 
>> common directories.
>> It would be great, if you (or someone else involved in developing the 
>> new blocks) can finish the mapping below ...
> 
> ok, forget my last response. I'll change it in some points:
> 
>> WEB-INF/sitemap-additions -> ? (contains sitemap snippets in *.xconf 
>> files)
> 
>  cocoon-<block>-impl/src/main/resources/META-INF/legacy/sitemap-additions
> 
>> WEB-INF/xconf -> cocoon-<block>-impl/src/main/resources/META-INF/xconf?
> 
>  cocoon-<block>-impl/src/main/resources/META-INF/legacy/xconf
> 
>> conf -> ? (contains *.xweb, *.properties and other files)
> 
>  cocoon-<block>-impl/src/main/resources/META-INF/legacy/conf
> 
>> java -> cocoon-<block>-impl/src/main/java
> 
> ok
> 
>> samples -> cocoon-<block>-sample/src/main/resources/COB-INF
> 
> ok
> 
>> test -> cocoon-<block>-impl/src/test/java
> 
> ok
> 
> The idea is to collect all old configuration files within one directory. 
> I called it legacy - if somebody has a better name, it would be the 
> right time now to let us know ;-)
> 

Thanks, Reinhard, this really helped me very much!

Attached is a new version which uses the mappings from above.
The SVN-Commands are already added but commented-out and replaced with 
copy commands to be easier to test.

One question popped up during testing:
Is it really required to move the directories?
Isn't it better to do a 'svn cp' (which is a cheap copy anyway) and keep 
the old blocks at their old location?
This way it would be better to test and experiment since moving may 
disrupt both the cocoon-trunk and blocks repository (which is also used 
by 2.1 if I'm not mistaken).

It would be great, if somebody could try the script and give me some 
more feedback.
Only 2 variables have to be adjusted:
* blksrc: Local directory where 
https://svn.apache.org/repos/asf/cocoon/blocks is checked out
* blkdest: Local directory where 
https://svn.apache.org/repos/asf/cocoon/trunk is checked out

Usage: ./m10n-blocks.sh <blockname>...
Example: ./m10n-blocks.sh asciiart faces

The script is written using standard Unix Shell and is tested on WinXP 
using Cygwin.

Thanks,
Andreas

["m10n-blocks.sh" (text/plain)]

#!/bin/sh
# Author: Andreas Hochsteger <andreas.hochsteger@gmx.at>
# Description:
#   This script partly automates the conversion of the directory structure
#   of the "old" blocks to the "mavenized" blocks.
# Usage: m10n-blocks.sh <blockname>...

# Local directory where https://svn.apache.org/repos/asf/cocoon/blocks is checked \
out: blksrc=cocoon-blocks

# Local directory where https://svn.apache.org/repos/asf/cocoon/trunk is checked out:
blkdest=cocoon-trunk

# List of blocks (old name) to be converted - read from the command line:
blocks="$@"

# Argument: <from> <to>
function MoveDir() {
    if [ -d $1 ]; then
        echo "Moving $1 to $2 ..."
        # TODO: This is just for testing:
        cp -r $1 $2
        # TODO: Replace cp from above with svn command:
        #svn mv $1 $2
    fi
}

# Argument: <blockname>
function ConvertBlock() {
    block="$1"
    blockbase=$blkdest/cocoon-$block

    # Create initial directory structure:
    mkdir -p $blockbase/cocoon-$block-impl/src/main/resources/META-INF/legacy
    mkdir -p $blockbase/cocoon-$block-impl/src/test
    mkdir -p $blockbase/cocoon-$block-sample/src/main/resources

    # TODO: Add initial directory structure to svn:
    #svn add $blockbase

    # Move Java sources:
    MoveDir $blksrc/$block/trunk/java $blockbase/cocoon-$block-impl/src/main/java

    # Move Java test sources:
    MoveDir $blksrc/$block/trunk/test $blockbase/cocoon-$block-impl/src/test/java

    # Move xconf resources:
    MoveDir $blksrc/$block/trunk/WEB-INF/xconf \
$blockbase/cocoon-$block-impl/src/main/resources/META-INF/legacy/xconf

    # Move sitemap-additions resources:
    MoveDir $blksrc/$block/trunk/WEB-INF/sitemap-additions \
$blockbase/cocoon-$block-impl/src/main/resources/META-INF/legacy/sitemap-additions

    # Move WEB-INF resources:
    MoveDir $blksrc/$block/trunk/conf \
$blockbase/cocoon-$block-impl/src/main/resources/META-INF/legacy/conf

    # Move sample resources:
    MoveDir $blksrc/$block/trunk/samples \
$blockbase/cocoon-$block-sample/src/main/resources/COB-INF }

# Convert the blocks:
for b in $blocks; do
    echo "Converting block $block ..."
    ConvertBlock $b
    echo
done



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic