From 3e100e9de3cec5ec5e9a641e782ae47ca095233d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 13 Sep 2009 15:20:14 -0400 Subject: bichun! fixed makefiles, moved around files The wrapper is now a hybrid shell-C program. A shell script does the integrated commands, but it calls the C program (`$(libexecdir)/rvs/runcom') to launch plugins Note that right now, it does EVERYTHING BUT launch plugins. --- HACKING | 21 ++++--- Makefile.in | 34 +++++------ README | 22 +++---- rvs.sh | 164 ---------------------------------------------------- wrapper/Makefile.in | 26 +++++++-- wrapper/TODO | 4 +- wrapper/runcom.c | 50 ++++++++++++++++ wrapper/rvs.c | 47 --------------- wrapper/rvs.sh | 110 +++++++++++++++++++++++++++++++++++ 9 files changed, 225 insertions(+), 253 deletions(-) delete mode 100644 rvs.sh create mode 100644 wrapper/runcom.c delete mode 100644 wrapper/rvs.c create mode 100644 wrapper/rvs.sh diff --git a/HACKING b/HACKING index 3b8b891..a198138 100644 --- a/HACKING +++ b/HACKING @@ -1,10 +1,9 @@ #!/bin/more -////////////////////////////////////////////////////////////////////// - rvs 0.7.0 - retroactive versioning system - a versioning system that allows you to check - in commit 2 before commit 1 -////////////////////////////////////////////////////////////////////// + + Version 0.8c reimplements the wrapper in C, to allow better + cooperation betweem plugins via dependancies. This probably makes + a lot of this document out-dated, but a lot of it is still good, it + describes the workings of the plugins, and the repo structure. I know this file is long* and boring. I try to keep it preened and informative, but would rather spend my time actually hacking. If @@ -12,6 +11,14 @@ * at 200+ lines, it's longer than any rvs source file +- - -cut-here- - 8< - - - - - - - - - - - - - - - - - - - - - - - - - +////////////////////////////////////////////////////////////////////// + rvs 0.7.0 + retroactive versioning system + a versioning system that allows you to check + in commit 2 before commit 1 +////////////////////////////////////////////////////////////////////// + hacking build basics @@ -282,7 +289,7 @@ Only until rvs becomes self-hosting. If anyone needs any help, let me know, either via email, or via - Launchpad, I'll be happy to help! + Launchpad, I'll be happy to help/would love to have your help! ~ Luke Shumaker Happy Hacking! diff --git a/Makefile.in b/Makefile.in index bef0841..e72005a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -54,19 +54,18 @@ uninstall-plugins = $(addprefix uninstall-p-,$(plugins)) clean-plugins = $(addprefix clean-p-,$(plugins)) distclean-plugins = $(addprefix distclean-p-,$(plugins)) dist-plugins = $(addprefix dist-p-,$(plugins)) - +$(info $(build-plugins)) # phony targets #################################################### -all : $(rvs) $(build-plugins) -.PHONY : install uninstall clean distclean dist libexec $(build-plugins) $(rvs)\ -$(install-plugins) $(uninstall-plugins) $(clean-plugins) $(distclean-plugins) \ - install-$(rvs) uninstall-$(rvs) clean-$(rvs) distclean-$(rvs) \ -$(dist-plugins) \ - dist-$(rvs) +all : wrapper $(build-plugins) +.PHONY : install uninstall clean distclean dist libexec \ + build-wrapper install-wrapper uninstall-wrapper clean-wrapper distclean-wrapper dist-wrapper +#$(build-plugins) $(install-plugins) $(uninstall-plugins) $(clean-plugins) $(distclean-plugins) $(dist-plugins) + .SUFFIXES : # install ########################################################## -install : install-$(rvs) libexec $(install-plugins) +install : install-wrapper libexec $(install-plugins) # $(libexecdir)/rvs/* libexec : $(libexecdir)/$(rvs)/plugins @@ -81,9 +80,9 @@ uninstall : # clean ############################################################ -clean : $(clean-plugins) clean-$(rvs) +clean : $(clean-plugins) clean-wrapper -distclean : clean $(distclean-plugins) distclean-$(rvs) +distclean : clean $(distclean-plugins) distclean-wrapper $(RM) Makefile # dist ############################################################# @@ -100,14 +99,15 @@ $(d) : distclean # wrapper ########################################################## -$(rvs) : wrapper/ wrapper/Makefile; $(MAKE) -C $< -uninstall-$(rvs) : wrapper/ wrapper/Makefile; $(MAKE) -C $< uninstall -clean-$(rvs) : wrapper/ wrapper/Makefile; $(MAKE) -C $< clean -distclean-$(rvs) : wrapper/ wrapper/Makefile; $(MAKE) -C $< distclean -dist-$(rvs) : wrapper/ wrapper/Makefile; $(MAKE) -C $< dist +wrapper : build-wrapper +build-wrapper : wrapper/ wrapper/Makefile; $(MAKE) -C $< +uninstall-wrapper : wrapper/ wrapper/Makefile; $(MAKE) -C $< uninstall +clean-wrapper : wrapper/ wrapper/Makefile; $(MAKE) -C $< clean +distclean-wrapper : wrapper/ wrapper/Makefile; $(MAKE) -C $< distclean +dist-wrapper : wrapper/ wrapper/Makefile; $(MAKE) -C $< dist -install-$(rvs) : wrapper/ wrapper/Makefile $(rvs); $(MAKE) -C $< install -$(RVS) : install-$(rvs) +install-wrapper : wrapper/ wrapper/Makefile wrapper; $(MAKE) -C $< install +$(RVS) : install-wrapper # plugins ########################################################## diff --git a/README b/README index fc90d89..be5298c 100644 --- a/README +++ b/README @@ -1,6 +1,6 @@ #!/bin/more ////////////////////////////////////////////////////////////////////// - rvs 0.6.3 + rvs 0.8c r54 retroactive versioning system a versioning system that allows you to check in commit 2 before commit 1 @@ -8,10 +8,6 @@ introduction - The name is a little bit of a nod to RCS (revision control - system), and even less to CVS. I'm not particularly fond of CVS, - but recognize it's impact on the scm scene. - rvs is about being able to go back and edit *anything* that has already been committed. Yes, some other SCMs do this, but fuck things proper if someone else has a copy of the old version. @@ -25,13 +21,13 @@ introduction system requirements Pretty much any *nix system should be able to run rvs. If you - need to use a shell other than GNU bash, run ./configure with + need to use a shell other than /bin/sh, run ./configure with the --SHELL=YOUR_SHELL option. rvs is not designed for Windows, but should be able to run in bash if you have some *nix pack installed. - To my knowledge, this is the absolute requirements (all need to - be in your PATH): + To my knowledge, this is the absolute requirements (all but the + shell need to be in your PATH): * a POSIX shell (tested with dash, and GNU BASH) * cat (included in GNU Core Utils) * cp (included in GNU Core Utils) @@ -53,10 +49,8 @@ building # make install It's generally considered good practice to build in another - directory than the source directory. This is not nescessary in - rvs , all the created file are put in another directory anyway. - If you would still like to do this, it can be done in rvs-0.6.1 - and up. + directory than the source directory. If you would still like to do + this, it can be done in rvs-0.6.1 and up. Configuration @@ -69,7 +63,9 @@ building name='rvs' The name of the program. Note that unlike most variables, you should NOT call this in Makefiles - (`$(name)'), but use $(rvs) instead. + (`$(name)'), but use `$(rvs)'s instead. + CC='gcc' + The C language compiler to use. RVS='$(bindir)/$(rvs)' Where the exectuable will be. `$(rvs)' is the same as `$(name)' (see above) diff --git a/rvs.sh b/rvs.sh deleted file mode 100644 index f54f553..0000000 --- a/rvs.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!@SHELL@ -name='@name@' -ver='0.7.3' -# Copyright (C) 2009 Luke Shumaker -# -# This file is part of rvs. -# -# rvs is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2, or (at your option) any later version. -# -# rvs 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. -# -# You should have received a copy of the GNU General Public License -# along with rvs; see the file COPYING. -# If not, write to the Free Software Foundation, -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -RVS="$0" #RVS="@rvs@" -libexecdir="@libexecdir@/$name" - -_error() { - echo "$name: $1" >> /dev/stderr - exit 1 -} - -_repo() { - repo=".$name" - pwd=`pwd` - owd="$pwd" - - while [ "$pwd" != "`pwd`" ] && [ ! -e "`pwd`/$repo" ]; do - pwd=`pwd` - cd .. - done - - if [ -e "`pwd`/$repo" ]; then - echo "`pwd`/$repo" - else - _error "no $name repository found" - fi - cd "$owd" -} - -_init() { - repo=`_repo 2> /dev/null` - if [ -z "$repo" ]; then - repo=".$name" - install -d "$repo" - install -T $libexecdir/plugins $repo/plugins - while read plugin; do - echo "initializing plugin \`$plugin'" - install -d "$repo/$plugin" - export REPO=.rvs/$plugin - if [ -e "$libexecdir/$plugin/init" ]; then - "$libexecdir/$plugin/init" - fi - done < $repo/plugins - else - _error "repository already exists at \`$repo'" - fi -} - -_install() { - id=$1 - dir=${2-$id} - name=`echo $id | sed 's/-.*$//'` - if (grep "^$name-" "$libexecdir/plugins" &> /dev/null); then - # an entry for this plugin already exists, though possibly a - # different version - sed -i "s/^$name-.*$/$id/" "$libexecdir/plugins" - else - echo "$id" >> "$libexecdir/plugins" - fi - rm -rf "$libexecdir/$id" - cp -rpT "$dir" "$libexecdir/$id" -} - -_uninstall() { - id=$1 - sed -i "/^$id$/ d" "$libexecdir/plugins" - rm -rf "$libexecdir/$id" -} - -_treebranch() { - branch="$1" - for com in "$branch"; do - var="r_$com" - if [ -z "\$$var" ]; then - exec r$var="`$libexecdir/$com $param`" - var="_$com" - _treebranch "\$$var" - else - _error "plugin dependancy loop detected" - fi - done -} - -_runcom() { - com="$1" - tmp_mast="`tempfile`" - # bash optimized version - #grep -E "^$com(:.*)?$" "$libexecdir/*/plugin.conf" | sed \ - # -e 's/\#.*//' \ - # -e "s:^${libexecdir//':'/'\:'}/::" \ - # -e 's@plugin.conf\:@@' > "$tmp_mast" - # POSIX version - grep -E "^$com(:.*)?$" $libexecdir/*/plugin.conf | sed \ - -e 's/\#.*//' \ - -e "s:^`echo "$libexecdir" |sed 's@:@\\:@g'`/::" \ - -e 's@plugin.conf\:@@' > "$tmp_mast" - - # start processing------------------------------------------- - if [ "`wc -c < "$tmp_mast"`" = '0' ]; then - _error "unrecognized command \`$com'" - else - # create tree - tmp_work="`tempfile`" - lev1="`sed \ - -e "/\:/w '$tmp_work'" \ - -e '/\:/d' "$tmp_mast"`" - while read line; do - com="`echo "$line" | sed 's/\:.*$/'`" - dep="_`echo "$line" | sed 's/.*\:$/'`" - # bash optimized version - # eval $dep=\"${!dep} $com\" - # POSIX version - eval $dep=\"\$$dep $com\" - done < "$tmp_work" - rm "$tmp_work" - - # cycle through tree - _treebranch "$lev1" - fi - rm "$tmp_mast" -} - -# START OPTION HANDLING # -com=$1; -# END OPTION HANDLING # -case "$com" in - '') _error 'no command specified';; - # 'repo') _repo; exit $?;; - 'init') _init; exit $?;; - 'install') shift; _install $@; exit $?;; - 'uninstall') shift; _uninstall $@; exit $?;; - *) repo=`_repo` - if [ "$?" = '0' ]; then - shift - param="$@" - _runcom - exit $? - else - _error "cannot find an existing repository" - fi - :;; -esac - -# Copy/Paste Virus 1.3c Please copy and paste this text anywhere. Track -# its progress by searching for this MD5#f7eac285ebfe21c4587bfebb9582f90d - diff --git a/wrapper/Makefile.in b/wrapper/Makefile.in index 85f56f7..a6eef15 100644 --- a/wrapper/Makefile.in +++ b/wrapper/Makefile.in @@ -31,6 +31,7 @@ dirs = $(srcdir) $(prefix) $(exec_prefix) $(bindir) $(sbindir) $(libexecdir)/ #export srcdir prefix exec_prefix bindir sbindir libexecdir # programs ######################################################### +CC = @CC@ RVS ?= @RVS@ SHELL ?= @SHELL@ RM ?= rm @@ -43,19 +44,36 @@ INSTALL_DATA ?= $(INSTALL) -m 644 TOUCH ?= touch # This file doesn't use touch #export RVS SHELL RM CP SED INSTALL MKDIR INSTALL_PROGRAM INSTALL_DATA TOUCH +CFLAGS = -DLIBEXECDIR=\"$(libexecdir)\" -DPLUGIN_CONF=\"plugin.conf\" + # phony targets #################################################### -all : rvs -.PHONY : install uninstall clean distclean dist +all : rvs runcom +.PHONY : install uninstall clean distclean dist install-runcom .SUFFIXES : .c .o VPATH = $(srcdir)/wrapper # most everything ################################################## -install : $(RVS) -$(RVS) : rvs $(bindir) +RUNCOM = $(libexecdir)/$(rvs)/runcom +install : $(RVS) $(RUNCOM) +$(RVS) : rvs $(dir $(RVS)) + $(INSTALL_PROGRAM) $< $@ + +$(RUNCOM): runcom $(dir $(RUNCOM)) + $(INSTALL_PROGRAM) $< $@ + +b := @ +# build shell scripts +rvs : rvs.sh $(INSTALL_PROGRAM) $< $@ + $(SED) -i \ + -e 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' \ + -e 's/$bname@/$(rvs)/g' \ + -e 's/$blibexecdir@/$(subst /,\/,$(libexecdir))/g' \ + $@ uninstall : $(RM) $(RVS) + $(RM) $(libexecdir)/$(rvs)/runcom clean : diff --git a/wrapper/TODO b/wrapper/TODO index 577c252..6d1bd2a 100644 --- a/wrapper/TODO +++ b/wrapper/TODO @@ -1,6 +1,8 @@ #! /bin/more -plugin-load.h: +* add propper option handling via GNU getopt +* actually launch the plugins +* plugin-load.h: The function `load_plugins' must loop through sub-directories in the directory `libexecdir'. They way it does this is an ugly kludge, and should be rewritten. diff --git a/wrapper/runcom.c b/wrapper/runcom.c new file mode 100644 index 0000000..f581a45 --- /dev/null +++ b/wrapper/runcom.c @@ -0,0 +1,50 @@ +const char *name="rvs"; +const char *ver="0.8c"; +/* Copyright (C) 2009 Luke Shumaker + + This file is part of rvs. + + rvs is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your + option) any later version. + + rvs 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. + + You should have received a copy of the GNU General Public License + along with rvs; see the file COPYING. + If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include "rvs.h" +#include "plugins.h" +#include "plugin-load.h" +#include "plugin-find.h" +#include "plugin-depend.h" + +const char *libexecdir=LIBEXECDIR; +const char *plugin_conf=PLUGIN_CONF; + +int +main ( int argc, char *argv[] ) +{ + struct plugin *plugins=load_plugins(libexecdir,plugin_conf); + if (argc > 1) { + struct plugin_command_list *list; + list=plugin_find_commands(plugins,argv[1]); + struct plugin_command *root; + root=plugin_depend_list(list,plugins); + plugin_free_list(list); + plugin_free_command(root); + } + plugin_free_plugin(plugins); + return 0; +} + +/* Copy/Paste Virus 1.3c Please copy and paste this text anywhere. Track *\ +\* its progress by searching for this MD5#f7eac285ebfe21c4587bfebb9582f90d */ + diff --git a/wrapper/rvs.c b/wrapper/rvs.c deleted file mode 100644 index 4f2fa1b..0000000 --- a/wrapper/rvs.c +++ /dev/null @@ -1,47 +0,0 @@ -const char *name="rvs"; -const char *ver="0.8c"; -/* Copyright (C) 2009 Luke Shumaker - - This file is part of rvs. - - rvs is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your - option) any later version. - - rvs 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. - - You should have received a copy of the GNU General Public License - along with rvs; see the file COPYING. - If not, write to the Free Software Foundation, - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "rvs.h" -#include "plugins.h" -#include "plugin-load.h" -#include "plugin-find.h" -#include "plugin-depend.h" - -const char *libexecdir="./plugins"; -const char *plugin_conf="plugin.conf"; - -int -main ( int argc, char *argv[] ) -{ - struct plugin *plugins=load_plugins(libexecdir,plugin_conf); - if (argc > 1) { - struct plugin_command_list *list; - list=plugin_find_commands(plugins,argv[1]); - struct plugin_command *root; - root=plugin_depend_list(list,plugins); - plugin_free_list(list); - plugin_free_command(root); - } - plugin_free_plugin(plugins); - return 0; -} - diff --git a/wrapper/rvs.sh b/wrapper/rvs.sh new file mode 100644 index 0000000..d7fc753 --- /dev/null +++ b/wrapper/rvs.sh @@ -0,0 +1,110 @@ +#!@SHELL@ +name='@name@' +ver='0.8c' +# Copyright (C) 2009 Luke Shumaker +# +# This file is part of rvs. +# +# rvs is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2, or (at your option) any later version. +# +# rvs 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. +# +# You should have received a copy of the GNU General Public License +# along with rvs; see the file COPYING. +# If not, write to the Free Software Foundation, +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +RVS="$0" #RVS="@rvs@" +libexecdir="@libexecdir@/$name" + +_error() { + echo "$name: $1" >> /dev/stderr + exit 1 +} + +_repo() { + repo=".$name" + pwd=`pwd` + owd="$pwd" + + while [ "$pwd" != "`pwd`" ] && [ ! -e "`pwd`/$repo" ]; do + pwd=`pwd` + cd .. + done + + if [ -e "`pwd`/$repo" ]; then + echo "`pwd`/$repo" + else + _error "no $name repository found" + fi + cd "$owd" +} + +_init() { + repo=`_repo 2> /dev/null` + if [ -z "$repo" ]; then + repo=".$name" + install -d "$repo" + install -T $libexecdir/plugins $repo/plugins + while read plugin; do + echo "initializing plugin \`$plugin'" + install -d "$repo/$plugin" + export REPO=.rvs/$plugin + if [ -e "$libexecdir/$plugin/init" ]; then + "$libexecdir/$plugin/init" + fi + done < $repo/plugins + else + _error "repository already exists at \`$repo'" + fi +} + +_install() { + id=$1 + dir=${2-$id} + name=`echo $id | sed 's/-.*$//'` + if (grep "^$name-" "$libexecdir/plugins" &> /dev/null); then + # an entry for this plugin already exists, though possibly a + # different version + sed -i "s/^$name-.*$/$id/" "$libexecdir/plugins" + else + echo "$id" >> "$libexecdir/plugins" + fi + rm -rf "$libexecdir/$id" + cp -rpT "$dir" "$libexecdir/$id" +} + +_uninstall() { + id=$1 + sed -i "/^$id$/ d" "$libexecdir/plugins" + rm -rf "$libexecdir/$id" +} + +# START OPTION HANDLING # +com=$1; +# END OPTION HANDLING # +case "$com" in + '') _error 'no command specified';; + # 'repo') _repo; exit $?;; + 'init') _init; exit $?;; + 'install') shift; _install $@; exit $?;; + 'uninstall') shift; _uninstall $@; exit $?;; + *) repo=`_repo` + if [ "$?" = '0' ]; then + shift + $libexecdir/runcom $@ + exit $? + else + _error "cannot find an existing repository" + fi + :;; +esac + +# Copy/Paste Virus 1.3c Please copy and paste this text anywhere. Track +# its progress by searching for this MD5#f7eac285ebfe21c4587bfebb9582f90d + -- cgit v1.2.3