Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] alternative grimoire layout

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: "Mathieu L." <lejatorn AT smgl.homelinux.net>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] alternative grimoire layout
  • Date: Wed, 6 Apr 2005 08:42:11 +0200

This seems to me the saner way of doing it evoqued so far, except that
I'm still not convinced using the developper name as a scheme (even in
p4) is a good thing.

Cheers,
Mathieu.

On Tue, Apr 05, 2005 at 07:56:21PM -0700, Andrew wrote:
> I decided to put my money where my mouth is and write some 'proof of
> concept' scripts for the proposed in-repository/grimoire building
> layout change.
>
> Theres one to re-arrange the grimoire based on 'maintainer' in the format
> specified below, and another to revert it back again. There another script
> to re-assemble the grimoire back to its usual form.
>
>
> My in-repository layout is as follows:
>
> grimoire_name/developer AT sourcemage.org/...
> spell1/...
> DETAILS
> section
> spell2/...
> DETAILS
> BUILD
> section
> grimoire_name/sections/section1/...
> FUNCTIONS
> grimoire_name/sections/section2/...
> SECTION2_DETAILS
> MAINTAINER
>
> grimoire_name/...
> FUNCTIONS
> ChangeLog
> libaccount
>
> Basically, spells are moved to a directory based on the developer,
> theres a special developer named 'unmaintained' as a catchall for
> spells with no maintainer. Each spell has a magic file in it called
> 'section' this contains a single line with the name of the section the
> spell belongs to in the on-disk layout.
>
> Theres a 'sections' dir which contains subdirectories, one for each
> 'real' section, in that directory are all the files for that section.
>
> I assume that there are no developers named 'sections' and 'unmaintained'
> in this example, and that there wont be any collisions between grimoire
> level libraries and developer names.
>
> The attached 'adjust_grimoire' script takes two parameters, a grimoire
> to start with, and a target directory, it guesses the maintainer and
> sets up the above structure. The maintainer guessing basically sucks but
> works well enough for this proof of concept. The finished product would
> arrange the grimoire inplace, run p4 integ commands, and the user would
> specify what sections/spells they maintain along with their name in
> some format.
>
> The attached 'build_grimoire' script is the inverse of adjust_grimoire,
> it takes the above format and turns it back into the grimoire layout we
> are familar with (it also removes the 'section' file). A better script
> could make use of symlinks for quick updates and space savings.
>
> Ive run
> adjust_grimoire devel newdevel
> build_grimoire newdevel builtdevel
>
> then
> diff -Naur devel builtdevel
>
> The only difference that diff finds is pixieplus missing from the
> kde-apps section (the spell is currently duplicated in both kde and
> kde-apps sections in the devel grimoire).
>
> Enjoy
>
> -Andrew
>
> --
> __________________________________________________________________________
> |Andrew D. Stitt | astitt at sourcemage.org |
> |irc: afrayedknot | afrayedknot at t.armory.com |
> |aim: thefrayedknot or iteratorplusplus | acedit at armory.com |
> |Sorcery Team Lead | ftp://t.armory.com/ |
> --------------------------------------------------------------------------

> function get_maintainer() {
> local dir=$1
> local spell_maintainer=$(grep MAINTAINER= $dir/DETAILS|head -n 1)
> local maintainer
> if [[ $spell_maintainer ]] ; then
> maintainer=$(parse_maintainer "$spell_maintainer")
> elif ! test -f $dir/../MAINTAINER ; then
> echo unmaintained
> return
> elif grep -q OPEN $dir/../MAINTAINER; then
> echo unmaintained
> return
> else
> maintainer=$(parse_maintainer "$(grep @ $dir/../MAINTAINER|head -n1)")
> fi
> [[ $maintainer ]] && echo $maintainer || echo unmaintained
> }
>
> function parse_maintainer() {
> echo $1|sed 's/MAINTAINER=//'|awk -F' ' '{print $NF}'|sed 's/[<>\"\"]//g'
> }
>
> start=$1
> end=$2
> find $start -maxdepth 2 -mindepth 2 -type d|while read spell; do
> echo $spell
> maintainer=$(get_maintainer $spell)
> mkdir -p $end/$maintainer
> cp -Rp $spell $end/$maintainer/
> echo $(basename $(dirname $spell)) > $end/$maintainer/$(basename
> $spell)/section
> done
>
> find $start -maxdepth 2 -mindepth 2 -type f|while read section_file; do
> echo $section_file
> section=$(basename $(dirname $section_file))
> mkdir -p $end/sections/$section
> cp -v $section_file $end/sections/$section
> done
>
> find $start -maxdepth 1 -mindepth 1 -type f|while read grimoire_file; do
> cp -v $grimoire_file $end/
> done

> function build_devs_spells() {
> local dev_dir=$1
> local section
> for spell in $dev_dir/* ; do
> test -d $spell || continue
> section=$(<$spell/section)
> mkdir -p $build_tree/$section
> cp -R $spell $build_tree/$section/
> rm $build_tree/$section/$(basename $spell)/section
> done
> }
>
> function setup_sections() {
> if test -d $source_tree/sections; then
> for section_dir in $source_tree/sections/*; do
> section=$(basename $section_dir)
> if test -d $build_tree/$section ; then
> # if the dir exists and its non-empty copy the files in the dir over
> if [[ $(ls $section_dir/) ]] ; then
> cp $section_dir/* $build_tree/$section/
> fi
> else
> # unused section, should be removed
> echo "WARNING: no spells in $section"
> fi
> done
> fi
> }
>
> function cp() {
> echo cp $@
> /bin/cp $@ || exit 1
> }
>
> source_tree=$1
> build_tree=$2
> mkdir $build_tree
> for thing in $source_tree/*; do
> if ! test -d $thing; then
> # copy all files into tree
> cp $thing $build_tree
> elif [[ $(basename $thing) == "sections" ]] ; then
> # section dir is built last
> continue
> else
> build_devs_spells $thing
> fi
> done
> setup_sections
>
>




> _______________________________________________
> SM-Discuss mailing list
> SM-Discuss AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/sm-discuss


--
We are Microsoft. Linux is irrelevant.
Openness is futile. Prepare to be assimilated.
--




Archive powered by MHonArc 2.6.24.

Top of Page