diff options
-rw-r--r-- | HACKING | 19 | ||||
-rw-r--r-- | Makefile.orig | 9 | ||||
-rw-r--r-- | Variables | 2 | ||||
-rwxr-xr-x | configure | 6 | ||||
-rw-r--r-- | src/core/init.sh | 29 | ||||
-rw-r--r-- | src/core/plugins | 2 | ||||
-rw-r--r-- | src/core/plugins.d/repo/commit.d.sh (renamed from src/rvs-core/commit.d.sh) | 8 | ||||
-rw-r--r-- | src/core/plugins.d/repo/commit.f.sh (renamed from src/rvs-core/commit.f.sh) | 8 | ||||
-rw-r--r-- | src/core/plugins.d/repo/commit.sh (renamed from src/rvs-core/commit.sh) | 20 | ||||
-rw-r--r-- | src/core/plugins.d/repo/get.d.sh (renamed from src/rvs-core/get.d.sh) | 6 | ||||
-rw-r--r-- | src/core/plugins.d/repo/get.f.sh (renamed from src/rvs-core/get.f.sh) | 4 | ||||
-rw-r--r-- | src/core/plugins.d/repo/get.sh (renamed from src/rvs-core/get.sh) | 6 | ||||
-rw-r--r-- | src/core/plugins.d/repo/lib/stdio.sh (renamed from src/rvs-core/lib/stdio.sh) | 4 | ||||
-rw-r--r-- | src/core/plugins.d/users/mkuser.sh | 24 | ||||
-rw-r--r-- | src/core/plugins.d/users/rmuser.sh (renamed from src/rvs-core/init.sh) | 12 | ||||
-rw-r--r-- | src/core/repo.sh (renamed from src/rvs-core/repo.sh) | 9 | ||||
-rw-r--r-- | src/rvs-core/lib/rvsdb.sh | 84 | ||||
-rw-r--r-- | src/rvs.sh | 26 |
18 files changed, 124 insertions, 154 deletions
@@ -143,8 +143,6 @@ rvsdb provides several functions and variables for dealing with the rvs database: - $repo - the directory of the database (./.rvs) getid FILE returns what the id of a given file would be if it were in the database. This is used to know where to put files when @@ -168,9 +166,9 @@ the value VAL the database (.rvs/*) - - So, what are all these files doing in in the database? The scheme - is fairly simple. In the `.rvs' directory there is 1 directory, the + + So, what are all these files doing in this database? The scheme is + fairly simple. In the `.rvs' directory there is 1 directory, the `files' directory. There used to be a folder for tempfiles (0.5.8- 0.6.2), but no more (0.6.3+). If you need a tempfile, just run: FILENAME=`tempfile` @@ -198,6 +196,17 @@ To keep things modular, commit.f is the ONLY thing that should actually put files in `.rvs/files', and get.f the only thing that should get them. Everything else should call them. + + The repo and init are the ONLY things that should have `.rvs' + hardcoded into them. If the repository directory is needed, then + use `rvs repo'. Again, in the core, these should only be the .f + functions, however, it will be useful to plugins. + + Why do we have the `files' directory, why don't we just put + everything in `.rvs'? This way: + * There is a spot to put user data, when we get around to writing + it + final thoughts diff --git a/Makefile.orig b/Makefile.orig index 67ac85f..975cb06 100644 --- a/Makefile.orig +++ b/Makefile.orig @@ -1,5 +1,6 @@ +# # rvs Makefile -# +# version 0.7.0 # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -34,9 +35,9 @@ wrapper : out/rvs core : shellScripts -srcFiles = $(shell find $(sourcedir)/src/rvs-core/ -type f) +srcFiles = $(shell find $(sourcedir)/src/core/ -type f) outFiles = $(patsubst $(sourcedir)/src/%,out/%,${basename $(srcFiles)}) -libFiles = $(patsubst out/rvs-core/%,$(libdir)/%, $(outFiles) ) +libFiles = $(patsubst out/core/%,$(libdir)/%, $(outFiles) ) shellScripts : $(outFiles) # install @@ -68,7 +69,7 @@ out/% : $(sourcedir)/src/%.sh $(PRE) $(prefix)/$(bindir)/% : out/% $(INSTALL) -m 755 -o root -g root -T $< $@ -$(libdir)/% : out/rvs-core/% +$(libdir)/% : out/core/% $(INSTALL) -m 755 -o root -g root -d $(dir $@) $(INSTALL) -m 755 -o root -g root -T $< $@ @@ -1,4 +1,4 @@ -VER '0.6.3' +VER '0.7.0' SHELL '/usr/bin/env bash' prefix "$HOME" bindir 'bin' @@ -1,6 +1,6 @@ #!/bin/sh # rvs configureation script -# +# version 0.7.0 # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -60,8 +60,8 @@ n1='# overwritten. Instead, edit the file `Makefile.orig'\' sourcedir=`echo "$sourcedir" | sed 's:/:\\\\/:g'` pre=`echo "$pre" | sed 's:/:\\\\/:g'` sed -i \ --e "10 a$n0" \ --e "10 a$n1" \ +-e "11 a$n0" \ +-e "11 a$n1" \ -e "s/@@sourcedir@@/$sourcedir/" \ -e "s/@@pre@@/$pre/" \ Makefile diff --git a/src/core/init.sh b/src/core/init.sh new file mode 100644 index 0000000..dc8a750 --- /dev/null +++ b/src/core/init.sh @@ -0,0 +1,29 @@ +#!$$SHELL$$ +name='rvs init' +ver='0.7.0' +# Copyright (C) 2009 Luke Shumaker +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>. + +repo=`rvs repo` +if [ "$old" = '' ]; then + repo='.rvs' + install -d "$repo" +fi + +if diff -q $RVSDIR/plugins $repo/plugins; then + install -T $RVSDIR/plugins $repo/plugins + while read plugin; do + if [ ! -e "$repo/$plugin" ]; then + install -d "$repo/$plugin" + if [ -e "$RVSDIR/$plugin/init" ]; then + $RVSDIR/$plugin/init + fi + fi + done < $repo/plugins +fi + diff --git a/src/core/plugins b/src/core/plugins new file mode 100644 index 0000000..18b388a --- /dev/null +++ b/src/core/plugins @@ -0,0 +1,2 @@ +repo +users diff --git a/src/rvs-core/commit.d.sh b/src/core/plugins.d/repo/commit.d.sh index 7a0cc9a..5b2d3fd 100644 --- a/src/rvs-core/commit.d.sh +++ b/src/core/plugins.d/repo/commit.d.sh @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination module:rvs:commit:d name='rvs commit.d' -ver='0.6.3' -usage='[OPTIONS] DIRECTORY' +ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,14 +9,10 @@ usage='[OPTIONS] DIRECTORY' # # Originally written by Luke Shumaker <lukeshu@sbcglobal.net>. -source "$RVSDIR/lib/stdio" -source "$RVSDIR/lib/rvsdb" - # commit.d DIRNAME dir="$1" tmp=`tempfile` -loginit "$tmp" for file in $dir/*; do hash=`rvs commit "$file"` echo "$file:$hash" >> "$tmp" diff --git a/src/rvs-core/commit.f.sh b/src/core/plugins.d/repo/commit.f.sh index a9be426..915ba3c 100644 --- a/src/rvs-core/commit.f.sh +++ b/src/core/plugins.d/repo/commit.f.sh @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination module:rvs:commit:f name='rvs commit.f' -ver='0.6.3' -usage='[OPTIONS] FILE' +ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,9 +15,9 @@ source "$RVSDIR/lib/rvsdb" # commit.f FILENAME file="$1" -hash=`getid $file` +#hash=`md5sum $file | sed "s/ .*$//"` +hash=`sha1sum $file | sed "s/ .*$//"` if [ ! -f "`rvs repo`/files/$hash" ]; then - #cp "$file" "`rvs repo`/files/$hash" install -m 644 -o $USER -g $USER -T "$file" "`rvs repo`/files/$hash" fi echo "$hash" diff --git a/src/rvs-core/commit.sh b/src/core/plugins.d/repo/commit.sh index 9fb44fc..0c8cfc5 100644 --- a/src/rvs-core/commit.sh +++ b/src/core/plugins.d/repo/commit.sh @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination module:rvs:commit name='rvs commit' -ver='0.6.3' -usage='[OPTIONS] [FILE]' +ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,7 +10,6 @@ usage='[OPTIONS] [FILE]' # Originally written by Luke Shumaker <lukeshu@sbcglobal.net>. source "$RVSDIR/lib/stdio" -source "$RVSDIR/lib/rvsdb" # commit FILE if [ $# -gt 0 ]; then @@ -40,13 +37,14 @@ fi ret=`rvs "commit.$type" "$file"` tmp=`tempfile` -loginit "$tmp" -logwrite "$tmp" 'name' "$file" -logwrite "$tmp" 'hash' "$ret" -logwrite "$tmp" 'type' "$type" -logwrite "$tmp" 'author' "$user" -logwrite "$tmp" 'owner' "$owner" -logwrite "$tmp" 'owner' "$license" +cat << __EOF__ > "$tmp" +name:$file +hash:$ret +type:$type +author:$user +owner:$owner +license:$license +__EOF__ rvs commit.f "$tmp" rm "$tmp" diff --git a/src/rvs-core/get.d.sh b/src/core/plugins.d/repo/get.d.sh index a58a7c0..2443850 100644 --- a/src/rvs-core/get.d.sh +++ b/src/core/plugins.d/repo/get.d.sh @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination module:rvs:get:d name='rvs get.d' -ver='0.6.3' -usage='[OPTIONS] ID FILENAME' +ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,7 +9,7 @@ usage='[OPTIONS] ID FILENAME' # # Originally written by Luke Shumaker <lukeshu@sbcglobal.net>. -source "$RVSDIR/lib/stdio" +#source "$RVSDIR/lib/stdio" source "$RVSDIR/lib/rvsdb" # get.d ID DIRNAME diff --git a/src/rvs-core/get.f.sh b/src/core/plugins.d/repo/get.f.sh index 3c17df5..e631a1f 100644 --- a/src/rvs-core/get.f.sh +++ b/src/core/plugins.d/repo/get.f.sh @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination module:rvs:get:f name='rvs get.f' -ver='0.6.3' -usage='[OPTIONS] ID FILENAME' +ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/rvs-core/get.sh b/src/core/plugins.d/repo/get.sh index 1d3eb76..4317c40 100644 --- a/src/rvs-core/get.sh +++ b/src/core/plugins.d/repo/get.sh @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination module:rvs:get -name='rvs commit' -ver='0.6.3' -usage='[OPTIONS] ID [FILENAME]' +name='rvs get' +ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/rvs-core/lib/stdio.sh b/src/core/plugins.d/repo/lib/stdio.sh index 8facc79..e6ef31a 100644 --- a/src/rvs-core/lib/stdio.sh +++ b/src/core/plugins.d/repo/lib/stdio.sh @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination module:rvs:lib:stdio #name='rvs stdio' -#ver='0.6.2' -#usage='' +#ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/core/plugins.d/users/mkuser.sh b/src/core/plugins.d/users/mkuser.sh new file mode 100644 index 0000000..74c8a77 --- /dev/null +++ b/src/core/plugins.d/users/mkuser.sh @@ -0,0 +1,24 @@ +#!$$SHELL$$ +name='rvs mkuser' +ver='0.7.0' +# Copyright (C) 2009 Luke Shumaker +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>. + +read -p 'username: ' author +read -p 'give copyright to: ' owner +if [ "$owner" != 'Public Domain' ]; then + read -p 'use the license: ' license +else + license='' +fi +cat << __EOF__ > "`rvs repo`/users/$author" +author:$author +owner:$owner +license:$license +__EOF__ + diff --git a/src/rvs-core/init.sh b/src/core/plugins.d/users/rmuser.sh index ff650a5..82a71c5 100644 --- a/src/rvs-core/init.sh +++ b/src/core/plugins.d/users/rmuser.sh @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination rvs init -name='rvs init' -ver='0.6.3' -usage='[OPTIONS]' +name='rvs rmuser' +ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,8 +9,6 @@ usage='[OPTIONS]' # # Originally written by Luke Shumaker <lukeshu@sbcglobal.net>. -source "$RVSDIR/lib/stdio" -source "$RVSDIR/lib/rvsdb" - -mkdir -p .rvs/{,files} +uname=$1 +rm "`rvs repo`/users/$uname" diff --git a/src/rvs-core/repo.sh b/src/core/repo.sh index 1db22c9..a94ccb8 100644 --- a/src/rvs-core/repo.sh +++ b/src/core/repo.sh @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination rvs init name='rvs repo' -ver='0.6.3' -usage='[OPTIONS]' +ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,8 +9,6 @@ usage='[OPTIONS]' # # Originally written by Luke Shumaker <lukeshu@sbcglobal.net>. -source "$RVSDIR/lib/stdio" - repo='.rvs' pwd=`pwd` @@ -24,6 +20,7 @@ done if [ -e "`pwd`/$repo" ]; then echo "`pwd`/$repo" else - fatal 'no rvs repository found' + echo "$name: no rvs repository found" >> /dev/stderr + exit 1 fi diff --git a/src/rvs-core/lib/rvsdb.sh b/src/rvs-core/lib/rvsdb.sh deleted file mode 100644 index 41f0e03..0000000 --- a/src/rvs-core/lib/rvsdb.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!$$SHELL$$ -# abomination module:rvs:lib:rvsdb -#name='rvs db' -#ver='0.6.3' -logver='0.6.0' -# Copyright (C) 2009 Luke Shumaker -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>. - -source "$RVSDIR/lib/stdio" - -# getid file -getid() { - #md5sum $file | sed "s/ .*$//" - sha1sum $file | sed "s/ .*$//" -} - -# loginit LOG -loginit() { - log="$1" - echo "#!rvsdb $logver" > "$log"; -} - -# lograw LOG -lograw() { - log="$1" - sed '1s/#!rvsdb .*//' "$log" -} - -# _find LOG FIELD VAL -_find() { - log="$1" - field="$2" - val="$3" - lograw $log | \ - cut -d : -f field | \ - sed -n "/^$val$/=" | \ - tr "\n" , | \ - sed 's/,$//' -} - -# logread LOG VAR -logread() { - log="$1" - var="$2" - lograw "$log" | sed -n "s/^$var://p" - #lograw "$log" | sed -n `_find "$log" '1' "$var"`p | cut -d : -f 2- -} - -# logwrite LOG VAR VAL -logwrite() { - log="$1" - var="$2" - val="$3" - -# #lines=`_find "$log" '1' "$var"` -# #if [ "$lines" = '' ]; then -# if [ "`lograw "$log" | grep "^$var:"`" == '' ]; then -# # no exiswhereting occurances -# echo "$var:$val" >> "$log" -# else -# # found others -# # escape slashes -# var=`echo "$var" | sed 's:/:\\\\/:g'` -# val=`echo "$val" | sed 's:/:\\\\/:g'` -# sed -i "s/^$var:.*$/$var:$val/" "$log" -# #lograw "$log" | ?????? -# fi - echo "$var:$val" >> $log -} - -# logfind LOG VAL -logfind() { - log="$1" - val="$2" - # make a comma-delimeted list of the lines with our values - lines=`_find "$log" '2-' "$val"` - lograw "$log" | sed -n ${lines}p | cut -d : -f 1 -} - @@ -1,8 +1,6 @@ #!$$SHELL$$ -# abomination module:rvs name='rvs' -ver='0.6.3' -usage='COMMAND [OPTIONS]' +ver='0.7.0' # Copyright (C) 2009 Luke Shumaker # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -11,9 +9,13 @@ usage='COMMAND [OPTIONS]' # # Originally written by Luke Shumaker <lukeshu@sbcglobal.net>. -export RVSDIR='$$libdir$$' -source "$RVSDIR/lib/stdio" -#source "$RVSDIR/lib/rvsdb" +RVSDIR='$$libdir$$' +REPO=`$RVSDIR/repo` + +error() { + echo "$name: $1" >> /dev/stderr + exit 1 +} # START OPTION HANDLING # com=$1; @@ -22,8 +24,20 @@ case "$com" in '') error 'no command specified';; *) if [ -f "$RVSDIR/$com" ]; then + export RVSDIR $RVSDIR/$@ + done='yes' else + while read plugin; do + if [ -f "$RVSDIR/$plugin/$com" ]; then + export RVSDIR=$RVSDIR/$plugin + $RVSDIR/$@ + done='yes' + break + fi + done < $REPO/plugins + fi + if [ "$done" != 'yes' ]; then error "unrecognized command \`$com'" fi :;; |