From 504d11ded8c1e9a0757332f2a10ed7d86dd5fc70 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Jul 2015 23:22:00 -0600 Subject: A whole bunch of stuff --- .gitignore | 1 + Makefile | 15 ++-- common.bottom.mk | 116 +++++++++++++++------------ common.each.mk | 18 +++-- common.once.mk | 7 +- common.top.mk | 22 +++--- modules/.gitignore | 5 ++ modules/Makefile | 24 ++++++ modules/comments/Makefile | 1 + modules/comments/Makefile.inc.mk | 2 + modules/comments/Module.mk | 2 + modules/comments/comment.sh | 26 ++++++ modules/comments/commit.sh | 24 ++++++ modules/comments/print.sh | 28 +++++++ modules/comments/showcomment.sh | 27 +++++++ modules/date.author/Makefile | 1 + modules/date.author/Makefile.inc.mk | 2 + modules/date.author/Module.mk | 2 + modules/date.author/commit.sh | 28 +++++++ modules/files/Makefile | 1 + modules/files/Makefile.inc.mk | 8 ++ modules/files/Module.mk | 0 modules/files/_stdio.sh | 74 +++++++++++++++++ modules/files/blob-gethash.sh | 26 ++++++ modules/files/blob-gettype.sh | 26 ++++++ modules/files/commit.d.sh | 42 ++++++++++ modules/files/commit.f.sh | 32 ++++++++ modules/files/commit.sh | 27 +++++++ modules/files/file-gettype.sh | 39 +++++++++ modules/files/get.d.sh | 46 +++++++++++ modules/files/get.f.sh | 29 +++++++ modules/files/get.sh | 32 ++++++++ modules/files/ls.sh | 50 ++++++++++++ modules/files/print.sh | 39 +++++++++ modules/files/tree.sh | 40 ++++++++++ modules/module.mk | 35 ++++++++ modules/tags/Makefile | 1 + modules/tags/Makefile.inc.mk | 2 + modules/tags/Module.mk | 2 + modules/tags/commit.sh | 24 ++++++ modules/tags/get-tag.sh | 25 ++++++ modules/tags/print.sh | 30 +++++++ modules/tags/tag-id.sh | 33 ++++++++ modules/tags/tag.sh | 28 +++++++ modules/tree/Makefile | 1 + modules/tree/Makefile.inc.mk | 2 + modules/tree/Module.mk | 3 + modules/tree/addparent.d.sh | 44 +++++++++++ modules/tree/addparent.f.sh | 27 +++++++ modules/tree/addparent.sh | 35 ++++++++ modules/tree/commit.sh | 27 +++++++ modules/tree/delparent.f.sh | 34 ++++++++ modules/tree/getchildren.sh | 28 +++++++ modules/tree/getparents.sh | 27 +++++++ modules/tree/print.sh | 27 +++++++ plugins/comments/bin/comment.sh | 26 ------ plugins/comments/bin/commit.sh | 24 ------ plugins/comments/bin/print.sh | 28 ------- plugins/comments/bin/showcomment.sh | 27 ------- plugins/comments/dep | 2 - plugins/comments/info.mk.in | 3 - plugins/date.author/bin/commit.sh | 28 ------- plugins/date.author/dep | 2 - plugins/date.author/info.mk.in | 3 - plugins/files/bin/blob-gethash.sh | 26 ------ plugins/files/bin/blob-gettype.sh | 26 ------ plugins/files/bin/commit.d.sh | 42 ---------- plugins/files/bin/commit.f.sh | 32 -------- plugins/files/bin/commit.sh | 27 ------- plugins/files/bin/file-gettype.sh | 39 --------- plugins/files/bin/get.d.sh | 46 ----------- plugins/files/bin/get.f.sh | 29 ------- plugins/files/bin/get.sh | 32 -------- plugins/files/bin/ls.sh | 50 ------------ plugins/files/bin/print.sh | 39 --------- plugins/files/bin/tree.sh | 40 ---------- plugins/files/dep | 0 plugins/files/etc/3-d.sh | 3 - plugins/files/etc/5-f.sh | 3 - plugins/files/info.mk.in | 3 - plugins/files/lib/stdio.sh | 74 ----------------- plugins/main.mk.in | 56 ------------- plugins/plugin.mk.in | 90 --------------------- plugins/tags/bin/commit.sh | 24 ------ plugins/tags/bin/get-tag.sh | 25 ------ plugins/tags/bin/print.sh | 30 ------- plugins/tags/bin/tag-id.sh | 33 -------- plugins/tags/bin/tag.sh | 28 ------- plugins/tags/dep | 2 - plugins/tags/info.mk.in | 3 - plugins/tree/bin/addparent.d.sh | 44 ----------- plugins/tree/bin/addparent.f.sh | 27 ------- plugins/tree/bin/addparent.sh | 35 -------- plugins/tree/bin/commit.sh | 27 ------- plugins/tree/bin/delparent.f.sh | 34 -------- plugins/tree/bin/getchildren.sh | 28 ------- plugins/tree/bin/getparents.sh | 27 ------- plugins/tree/bin/print.sh | 27 ------- plugins/tree/dep | 3 - plugins/tree/info.mk.in | 3 - wrapper/.gitignore | 3 +- wrapper/Makefile | 17 ++-- wrapper/inner.sh | 145 --------------------------------- wrapper/inner.sh.m4 | 154 ++++++++++++++++++++++++++++++++++++ wrapper/runcmd.mk | 15 ++++ 105 files changed, 1403 insertions(+), 1428 deletions(-) create mode 100644 modules/.gitignore create mode 100644 modules/Makefile create mode 120000 modules/comments/Makefile create mode 100644 modules/comments/Makefile.inc.mk create mode 100644 modules/comments/Module.mk create mode 100644 modules/comments/comment.sh create mode 100644 modules/comments/commit.sh create mode 100644 modules/comments/print.sh create mode 100644 modules/comments/showcomment.sh create mode 120000 modules/date.author/Makefile create mode 100644 modules/date.author/Makefile.inc.mk create mode 100644 modules/date.author/Module.mk create mode 100644 modules/date.author/commit.sh create mode 120000 modules/files/Makefile create mode 100644 modules/files/Makefile.inc.mk create mode 100644 modules/files/Module.mk create mode 100644 modules/files/_stdio.sh create mode 100644 modules/files/blob-gethash.sh create mode 100644 modules/files/blob-gettype.sh create mode 100644 modules/files/commit.d.sh create mode 100644 modules/files/commit.f.sh create mode 100644 modules/files/commit.sh create mode 100644 modules/files/file-gettype.sh create mode 100644 modules/files/get.d.sh create mode 100644 modules/files/get.f.sh create mode 100644 modules/files/get.sh create mode 100644 modules/files/ls.sh create mode 100644 modules/files/print.sh create mode 100644 modules/files/tree.sh create mode 100644 modules/module.mk create mode 120000 modules/tags/Makefile create mode 100644 modules/tags/Makefile.inc.mk create mode 100644 modules/tags/Module.mk create mode 100644 modules/tags/commit.sh create mode 100644 modules/tags/get-tag.sh create mode 100644 modules/tags/print.sh create mode 100644 modules/tags/tag-id.sh create mode 100644 modules/tags/tag.sh create mode 120000 modules/tree/Makefile create mode 100644 modules/tree/Makefile.inc.mk create mode 100644 modules/tree/Module.mk create mode 100644 modules/tree/addparent.d.sh create mode 100644 modules/tree/addparent.f.sh create mode 100644 modules/tree/addparent.sh create mode 100644 modules/tree/commit.sh create mode 100644 modules/tree/delparent.f.sh create mode 100644 modules/tree/getchildren.sh create mode 100644 modules/tree/getparents.sh create mode 100644 modules/tree/print.sh delete mode 100644 plugins/comments/bin/comment.sh delete mode 100644 plugins/comments/bin/commit.sh delete mode 100644 plugins/comments/bin/print.sh delete mode 100644 plugins/comments/bin/showcomment.sh delete mode 100644 plugins/comments/dep delete mode 100644 plugins/comments/info.mk.in delete mode 100644 plugins/date.author/bin/commit.sh delete mode 100644 plugins/date.author/dep delete mode 100644 plugins/date.author/info.mk.in delete mode 100644 plugins/files/bin/blob-gethash.sh delete mode 100644 plugins/files/bin/blob-gettype.sh delete mode 100644 plugins/files/bin/commit.d.sh delete mode 100644 plugins/files/bin/commit.f.sh delete mode 100644 plugins/files/bin/commit.sh delete mode 100644 plugins/files/bin/file-gettype.sh delete mode 100644 plugins/files/bin/get.d.sh delete mode 100644 plugins/files/bin/get.f.sh delete mode 100644 plugins/files/bin/get.sh delete mode 100644 plugins/files/bin/ls.sh delete mode 100644 plugins/files/bin/print.sh delete mode 100644 plugins/files/bin/tree.sh delete mode 100644 plugins/files/dep delete mode 100644 plugins/files/etc/3-d.sh delete mode 100644 plugins/files/etc/5-f.sh delete mode 100644 plugins/files/info.mk.in delete mode 100644 plugins/files/lib/stdio.sh delete mode 100644 plugins/main.mk.in delete mode 100644 plugins/plugin.mk.in delete mode 100644 plugins/tags/bin/commit.sh delete mode 100644 plugins/tags/bin/get-tag.sh delete mode 100644 plugins/tags/bin/print.sh delete mode 100644 plugins/tags/bin/tag-id.sh delete mode 100644 plugins/tags/bin/tag.sh delete mode 100644 plugins/tags/dep delete mode 100644 plugins/tags/info.mk.in delete mode 100644 plugins/tree/bin/addparent.d.sh delete mode 100644 plugins/tree/bin/addparent.f.sh delete mode 100644 plugins/tree/bin/addparent.sh delete mode 100644 plugins/tree/bin/commit.sh delete mode 100644 plugins/tree/bin/delparent.f.sh delete mode 100644 plugins/tree/bin/getchildren.sh delete mode 100644 plugins/tree/bin/getparents.sh delete mode 100644 plugins/tree/bin/print.sh delete mode 100644 plugins/tree/dep delete mode 100644 plugins/tree/info.mk.in delete mode 100644 wrapper/inner.sh create mode 100644 wrapper/inner.sh.m4 create mode 100644 wrapper/runcmd.mk diff --git a/.gitignore b/.gitignore index 3fab36d..c455e80 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .*.mk /*.tar.* /*-[0-9]*/ +tmp.* diff --git a/Makefile b/Makefile index 57993c8..479eb88 100644 --- a/Makefile +++ b/Makefile @@ -17,18 +17,19 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/config.mk include $(topsrcdir)/common.top.mk -#subdirs = wrapper plugins -subdirs = wrapper +subdirs = wrapper modules src_files = Makefile -src_files += common.top.mk common.bottom.mk config.mk configure +src_files += common.top.mk common.bottom.mk +src_files += common.each.mk common.once.mk +src_files += config.mk configure src_files += COPYING HACKING README -obj_files = config.sh config.h +out_files = config.sh config.h -config_vars = $(shell $(SED) -n 's/^\s*\([a-z][^ !?:=]*\).*=.*/\1/p' $(topobjdir)/config.mk) PACKAGE VERSION DESTDIR -$(objdir)/config.sh: $(objdir)/config.mk +config_vars = $(shell $(SED) -n 's/^\s*\([a-z][^ !?:=]*\).*=.*/\1/p' $(topoutdir)/config.mk) PACKAGE VERSION DESTDIR +$(outdir)/config.sh: $(outdir)/config.mk $(PRINTF) '%s=%s\n' $(foreach v,$(config_vars),$v $($v)) | LC_ALL=C $(SORT) > $@ -$(objdir)/config.h: $(objdir)/config.sh +$(outdir)/config.h: $(outdir)/config.sh . $(abspath $<) && $(PRINTF) '#define %s "%s"\n' $(foreach v,$(config_vars),$v '$($v)') PACKAGE_UPPER $${PACKAGE^^} | LC_ALL=C $(SORT) > $@ include $(topsrcdir)/common.bottom.mk diff --git a/common.bottom.mk b/common.bottom.mk index 2d56297..4a5833c 100644 --- a/common.bottom.mk +++ b/common.bottom.mk @@ -19,98 +19,116 @@ include $(topsrcdir)/common.each.mk # Aggregate variables # Add some more defaults to the *_files variables -clean_files += $(obj_files) -conf_files += Makefile $(topobjdir)/config.mk +clean_files += $(out_files) +conf_files += Makefile $(topoutdir)/config.mk # Now namespace the *_files variables -$(module)_src_files := $(addprefix $(srcdir)/,$(src_files)) -$(module)_obj_files := $(addprefix $(objdir)/,$(obj_files)) -$(module)_sys_files := $(addprefix $(DESTDIR)/,$(sys_files)) -$(module)_clean_files := $(addprefix $(objdir)/,$(clean_files)) -$(module)_slow_files := $(addprefix $(objdir)/,$(slow_files)) -$(module)_conf_files := $(addprefix $(objdir)/,$(conf_files)) -$(module)_dist_files := $(addprefix $(srcdir)/,$(dist_files)) +define _am_add_to_module +_am_$(module)_src_files = $(addprefix $(srcdir)/,$(src_files)) +_am_$(module)_out_files = $(addprefix $(outdir)/,$(out_files)) +_am_$(module)_sys_files = $(addprefix $(DESTDIR),$(sys_files)) +_am_$(module)_clean_files = $(addprefix $(outdir)/,$(clean_files)) +_am_$(module)_slow_files = $(addprefix $(outdir)/,$(slow_files)) +_am_$(module)_conf_files = $(addprefix $(outdir)/,$(conf_files)) +_am_$(module)_dist_files = $(addprefix $(srcdir)/,$(dist_files)) +endef +$(eval $(_am_add_to_module)) # And add them to the $(parent)_*_files variables (if applicable) +define _am_add_to_parent +_am_%(parent)_src_files += $(_am_%(module)_src_files) +_am_%(parent)_out_files += $(_am_%(module)_out_files) +_am_%(parent)_sys_files += $(_am_%(module)_sys_files) +_am_%(parent)_clean_files += $(_am_%(module)_clean_files) +_am_%(parent)_slow_files += $(_am_%(module)_slow_files) +_am_%(parent)_conf_files += $(_am_%(module)_conf_files) +_am_%(parent)_dist_files += $(_am_%(module)_dist_files) +endef ifneq ($(parent),) -$(parent)_src_files := $($(parent)_src_files) $($(module)_src_files) -$(parent)_obj_files := $($(parent)_obj_files) $($(module)_obj_files) -$(parent)_sys_files := $($(parent)_sys_files) $($(module)_sys_files) -$(parent)_clean_files := $($(parent)_clean_files) $($(module)_clean_files) -$(parent)_slow_files := $($(parent)_slow_files) $($(module)_slow_files) -$(parent)_conf_files := $($(parent)_conf_files) $($(module)_conf_files) -$(parent)_dist_files := $($(parent)_dist_files) $($(module)_dist_files) +$(eval $(subst %(parent),$(parent),$(subst %(module),$(module),$(value _am_add_to_parent)))) endif modules := $(modules) $(module) +# Do some per-module magic + +_am_phony = build install uninstall mostlyclean clean distclean maintainer-clean check + +.PHONY: $(addsuffix -%(module),$(_am_phony)) + +$(addsuffix -$(module),uninstall mostlyclean clean distclean maintainer-clean) :: + $(RM) -- $(sort $(_am_$@)) + $(RMDIRS) $(sort $(dir $(_am_$@))) 2>/dev/null || $(TRUE) + + # Include Makefiles from other directories -define _nl +define _am_nl endef -define _include_makefile +define _am_include_makefile ifeq ($(filter $(abspath $1),$(included_makefiles)),) -include $(if $(call _is_subdir,.,$1),$(call _relto,.,$1),$(topobjdir)/$(call _relto,$(topobjdir),$1)) +include $(if $(call _am_is_subdir,.,$1),$(call _am_relto,.,$1),$(topoutdir)/$(call _am_relto,$(topoutdir),$1)) endif endef $(eval \ - _COMMON_MK_NOONCE = n$(_nl)\ - $(foreach dir,$(subdirs),parent=$(module)$(_nl)$(call _include_makefile,$(objdir)/$(dir)/Makefile)$(_nl))\ - parent=dep$(_nl)\ - $(call _include_makefile,$(topobjdir)/$(dir)/Makefile)$(_nl)\ - _COMMON_MK_NOONCE = $(_COMMON_MK_NOONCE)) + _am_NO_ONCE = y$(_am_nl)\ + $(foreach dir,$(subdirs),parent=$(module)$(_am_nl)$(call _am_include_makefile,$(outdir)/$(dir)/Makefile)$(_am_nl))\ + parent=dep$(_am_nl)\ + $(call _am_include_makefile,$(topoutdir)/$(dir)/Makefile)$(_am_nl)\ + _am_NO_ONCE = $(_am_NO_ONCE)) # This only gets evaluated once, after all of the other Makefiles are read -ifeq ($(_COMMON_MK_NOONCE),) +ifeq ($(_am_NO_ONCE),) # Empty module-level variables -objdir = /bogus +outdir = /bogus srcdir = /bogus subdirs = depdirs = src_files = -obj_files = +out_files = sys_files = clean_files = slow_files = conf_files = dist_files = -# Declare phony targets -.phony = build install uninstall mostlyclean clean distclean maintainer-clean check -define module_rules -.PHONY: $(addsuffix -%(module),$(.phony)) +ifeq ($(abspath .),$(abspath $(topoutdir))) +_am_all_clean_files += $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz +$(addsuffix -all,mostlyclean clean distclean maintainer-clean) :: + $(RM) -r -- $(topoutdir)/$(PACKAGE)-$(VERSION) +endif + +define _am_module_rules # Constructive phony targets -build-%(module): $(%(module)_obj_files) -install-%(module): $(%(module)_sys_files) +build-%(module): $(_am_%(module)_out_files) +install-%(module): $(_am_%(module)_sys_files) # Destructive phony targets -_%(module)_uninstall = $(%(module)_sys_files)) -_%(module)_mostlyclean = $(filter-out $(%(module)_slow_files) $(%(module)_conf_files) $(%(module)_dist_files),$(%(module)_clean_files)) -_%(module)_clean = $(filter-out $(%(module)_conf_files) $(%(module)_dist_files),$(%(module)_clean_files)) -_%(module)_distclean = $(filter-out $(%(module)_dist_files),$(%(module)_clean_files)) -_%(module)_maintainer-clean = $(%(module)_clean_files) -uninstall-%(module) mostlyclean-%(module) clean-%(module) distclean-%(module) maintainer-clean-%(module): %-%(module): - $(RM) -- $(sort $(_%(module)_$*)) - $(RMDIRS) $(sort $(dir $(_%(module)_$*))) 2>/dev/null || $(TRUE) +_am_uninstall-%(module) = $(_am_%(module)_sys_files)) +_am_mostlyclean-%(module) = $(filter-out $(_am_%(module)_slow_files) $(_am_%(module)_conf_files) $(_am_%(module)_dist_files),$(_am_%(module)_clean_files)) +_am_clean-%(module) = $(filter-out $(_am_%(module)_conf_files) $(_am_%(module)_dist_files),$(_am_%(module)_clean_files)) +_am_distclean-%(module) = $(filter-out $(_am_%(module)_dist_files),$(_am_%(module)_clean_files)) +_am_maintainer-clean-%(module) = $(_am_%(module)_clean_files) endef -$(foreach module,$(modules),$(eval $(subst %(module),$(module),$(value module_rules)))) +$(foreach module,$(modules),$(eval $(subst %(module),$(module),$(value _am_module_rules)))) # Alias each bare phony target to itself with the `-all` suffix -$(foreach t,$(.phony),$(eval $t: $t-all)) +$(foreach t,$(_am_phony),$(eval $t: $t-all)) # Add the `dist` target .PHONY: dist -dist: $(topobjdir)/$(PACKAGE)-$(VERSION).tar.gz -$(topobjdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topobjdir)/$(PACKAGE)-$(VERSION) +dist: $(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz +$(topoutdir)/$(PACKAGE)-$(VERSION).tar.gz: $(topoutdir)/$(PACKAGE)-$(VERSION) $(TAR) czf $@ -C $(. +dirs := $(dirs) + clean_files += .*.mk *.o ifneq ($(AUTODEPS),) --include $(wildcard $(objdir)/.*.mk) +-include $(wildcard $(outdir)/.*.mk) endif -$(objdir)/% : $(srcdir)/%.sh - $(M4) -P $(M4FLAGS) $< | $(INSTALL_PROGRAM) /dev/stdin $@ +$(outdir)/% : $(srcdir)/%.m4 + $(M4) -P $(M4FLAGS) $< > $@ + +$(outdir)/% : $(srcdir)/%.sh + $(INSTALL_PROGRAM) $< $@ +$(outdir)/% : $(outdir)/%.sh + $(INSTALL_PROGRAM) $< $@ -$(objdir)/%.o : $(srcdir)/%.c $(topobjdir)/config.mk +$(outdir)/%.o : $(srcdir)/%.c $(topoutdir)/config.mk $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< -$(objdir)/%: $(objdir)/%.o + +$(outdir)/% : $(outdir)/%.o $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) diff --git a/common.once.mk b/common.once.mk index 0603822..38a8df1 100644 --- a/common.once.mk +++ b/common.once.mk @@ -24,8 +24,9 @@ ifneq ($(AUTODEPS),) CFLAGS += -MD -MF $(patsubst $(@D)/%.o,$(@D)/.%.mk,$@) -MP endif -CPPFLAGS += -I$(topobjdir) -M4FLAGS += -I$(topobjdir) +CPPFLAGS += -I$(topoutdir) +M4FLAGS += -I$(topoutdir) -# Should be on by default +MAKEFLAGS += -rR +.SECONDARY: .DELETE_ON_ERROR: diff --git a/common.top.mk b/common.top.mk index a83abb6..9a2fa0a 100644 --- a/common.top.mk +++ b/common.top.mk @@ -14,32 +14,32 @@ # along with this program. If not, see . # Both of these have the argument order "parent,child" -_noslash = $(patsubst %/,%,$1) -_relto = $(call _noslash,$(patsubst $(abspath $1)/%,%,$(abspath $2)/)) -_is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/) +_am_noslash = $(patsubst %/,%,$1) +_am_relto = $(call _am_noslash,$(patsubst $(abspath $1)/%,%,$(abspath $2)/)) +_am_is_subdir = $(filter $(abspath $1)/%,$(abspath $2)/) ## Declare the standard targets all: build .PHONY: all -## Set topobjdir, objdir, and srcdir (assumes that topsrcdir is already set) -ifeq ($(topobjdir),) -topobjdir := $(call _noslash,$(dir $(lastword $(filter %/config.mk config.mk,$(MAKEFILE_LIST))))) +## Set topoutdir, outdir, and srcdir (assumes that topsrcdir is already set) +ifeq ($(topoutdir),) +topoutdir := $(call _am_noslash,$(dir $(lastword $(filter %/config.mk config.mk,$(MAKEFILE_LIST))))) endif - objdir := $(call _noslash,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) - srcdir := $(firstword $(call _relto,., $(topsrcdir)/$(call _relto,$(topobjdir),$(objdir)) ) .) + outdir := $(call _am_noslash,$(dir $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) + srcdir := $(firstword $(call _am_relto,., $(topsrcdir)/$(call _am_relto,$(topoutdir),$(outdir)) ) .) -included_makefiles := $(included_makefiles) $(abspath $(objdir)/Makefile) +included_makefiles := $(included_makefiles) $(abspath $(outdir)/Makefile) ## Set module name -module := $(subst /,_,$(if $(call _is_subdir,.,$(objdir)),$(firstword $(call _relto,.,$(objdir)) all),dep-$(firstword $(call _relto,$(topobjdir),$(objdir)) top))) +module := $(subst /,_,$(if $(call _am_is_subdir,.,$(outdir)),$(firstword $(call _am_relto,.,$(outdir)) all),dep-$(firstword $(call _am_relto,$(topoutdir),$(outdir)) top))) ## Empty variables for use by the module subdirs = depdirs = src_files = -obj_files = +out_files = sys_files = clean_files = diff --git a/modules/.gitignore b/modules/.gitignore new file mode 100644 index 0000000..3c197bc --- /dev/null +++ b/modules/.gitignore @@ -0,0 +1,5 @@ +*/* +!*/Makefile +!*/.gitignore +!*/*.mk +!*/*.sh diff --git a/modules/Makefile b/modules/Makefile new file mode 100644 index 0000000..9830a8e --- /dev/null +++ b/modules/Makefile @@ -0,0 +1,24 @@ +#!/usr/bin/make -f +# Copyright (C) 2015 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +include $(dir $(lastword $(MAKEFILE_LIST)))/../config.mk +include $(topsrcdir)/common.top.mk + +dirs += $(DESTDIR)$(pkglibexecdir)/modules +src_files += Makefile module.mk +subdirs = comments date.author files tags tree + +include $(topsrcdir)/common.bottom.mk diff --git a/modules/comments/Makefile b/modules/comments/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/comments/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/comments/Makefile.inc.mk b/modules/comments/Makefile.inc.mk new file mode 100644 index 0000000..6816836 --- /dev/null +++ b/modules/comments/Makefile.inc.mk @@ -0,0 +1,2 @@ +src_files += comment.sh commit.sh print.sh showcomment.sh +out_files += comment commit print showcomment diff --git a/modules/comments/Module.mk b/modules/comments/Module.mk new file mode 100644 index 0000000..a5bbb81 --- /dev/null +++ b/modules/comments/Module.mk @@ -0,0 +1,2 @@ +commit/comments :: commit/files + diff --git a/modules/comments/comment.sh b/modules/comments/comment.sh new file mode 100644 index 0000000..0be99e5 --- /dev/null +++ b/modules/comments/comment.sh @@ -0,0 +1,26 @@ +#!/bin/sh +name='comment' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name ID" +id="${1?"$usage"}" + +file="$REPO/@ID@/$id" +mkdir -p "`dirname "$file"`" +editor "$file" >> /dev/stderr + diff --git a/modules/comments/commit.sh b/modules/comments/commit.sh new file mode 100644 index 0000000..d13d754 --- /dev/null +++ b/modules/comments/commit.sh @@ -0,0 +1,24 @@ +#!/bin/sh +name='rvs @ID@ commit' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +if [ "$RVS_LEVEL" = '0' ]; then + id=`cat "$TMPDIR/commit/files"` + "$RVS" comment "$id" +fi + diff --git a/modules/comments/print.sh b/modules/comments/print.sh new file mode 100644 index 0000000..b04a9cc --- /dev/null +++ b/modules/comments/print.sh @@ -0,0 +1,28 @@ +#!/bin/sh +name='print' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +file="$REPO/@ID@/$id" +if [ -e "$file" ]; then + echo "Comment:" + sed 's/\(.*\)/ > \1/' "$file" +fi + diff --git a/modules/comments/showcomment.sh b/modules/comments/showcomment.sh new file mode 100644 index 0000000..efbc00a --- /dev/null +++ b/modules/comments/showcomment.sh @@ -0,0 +1,27 @@ +#!/bin/sh +name='showcomment' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +file="$REPO/@ID@/$id" +if [ -e "$file" ]; then + cat "$file" +fi + diff --git a/modules/date.author/Makefile b/modules/date.author/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/date.author/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/date.author/Makefile.inc.mk b/modules/date.author/Makefile.inc.mk new file mode 100644 index 0000000..c6b27a2 --- /dev/null +++ b/modules/date.author/Makefile.inc.mk @@ -0,0 +1,2 @@ +src_files += commit.sh +out_files += commit diff --git a/modules/date.author/Module.mk b/modules/date.author/Module.mk new file mode 100644 index 0000000..3284d55 --- /dev/null +++ b/modules/date.author/Module.mk @@ -0,0 +1,2 @@ +commit/date.author :: commit/files + diff --git a/modules/date.author/commit.sh b/modules/date.author/commit.sh new file mode 100644 index 0000000..c05f77b --- /dev/null +++ b/modules/date.author/commit.sh @@ -0,0 +1,28 @@ +#!/bin/sh +name='rvs @ID@ commit' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +if [ "$RVS_LEVEL" = '0' ]; then + id=`cat "$TMPDIR/commit/files"` + time=`date +%s` + file="$REPO/@ID@/$time" + if [ -n "$wch" ]; then + "$RVS" addparent "$id" "$wch" + fi +fi + diff --git a/modules/files/Makefile b/modules/files/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/files/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/files/Makefile.inc.mk b/modules/files/Makefile.inc.mk new file mode 100644 index 0000000..99c739e --- /dev/null +++ b/modules/files/Makefile.inc.mk @@ -0,0 +1,8 @@ +src_files += blob-gethash.sh blob-gettype.sh commit.d.sh commit.f.sh commit.sh file-gettype.sh get.d.sh get.f.sh get.sh ls.sh print.sh tree.sh +out_files += blob-gethash blob-gettype commit.d commit.f commit file-gettype get.d get.f get ls print tree + +src_files += _stdio.sh +sys_files += $(pkglibexecdir)/modules/$(name)/_stdio.sh + +$(DESTDIR)$(pkglibexecdir)/modules/$(name)/_stdio.sh: $(srcdir)/_stdio.sh | $(DESTDIR)$(pkglibexecdir)/modules/$(name) + $(INSTALL_DATA) $< $@ diff --git a/modules/files/Module.mk b/modules/files/Module.mk new file mode 100644 index 0000000..e69de29 diff --git a/modules/files/_stdio.sh b/modules/files/_stdio.sh new file mode 100644 index 0000000..974e98e --- /dev/null +++ b/modules/files/_stdio.sh @@ -0,0 +1,74 @@ +#!/bin/sh +#name='stdio' +#ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +verbose() { + if [ "$volume" == '-v' ]; then + echo $@ >> /dev/stderr + fi +} + +out() { + if [ "$volume" != '-q' ]; then + echo $@ >> /dev/stderr + fi +} + +warn () { + echo "$name: $1" >> /dev/stderr +} + +fatal () { + warn "$1" + exit 1 +} + +error() { + warn "$1" + cat << __error__ >> /dev/stderr +Usage: $RVS $name $usage + +Try \`$RVS help $name' for more options. +__error__ + exit 1 +} + +getvar() { + if [ -z "$1" ]; then + error + else + echo $1 + fi +} + +version() { + echo "$name $ver" + if [ "$volume" != '-q' ]; then + cat << __disclaimer__ +$name is copyright (C) 2009-2010 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 . +__disclaimer__ + fi + exit 0 +} + diff --git a/modules/files/blob-gethash.sh b/modules/files/blob-gethash.sh new file mode 100644 index 0000000..74defbc --- /dev/null +++ b/modules/files/blob-gethash.sh @@ -0,0 +1,26 @@ +#!/bin/sh +name='blob-gethash' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="ID" +id="`getvar "$1"`" + +echo $id | sed 's/.*://' + diff --git a/modules/files/blob-gettype.sh b/modules/files/blob-gettype.sh new file mode 100644 index 0000000..da3ee2a --- /dev/null +++ b/modules/files/blob-gettype.sh @@ -0,0 +1,26 @@ +#!/bin/sh +name='blob-gettype' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="ID" +id="`getvar "$1"`" + +echo $id | sed 's/:.*//' + diff --git a/modules/files/commit.d.sh b/modules/files/commit.d.sh new file mode 100644 index 0000000..d7e48f9 --- /dev/null +++ b/modules/files/commit.d.sh @@ -0,0 +1,42 @@ +#!/bin/sh +name='commit.d' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="DIRNAME" +dir="`getvar "$1"`" + +tmp=`mktemp` +t=' '; + +cd "$dir" +for file in *; do + p="`stat "$file" -c'%a' `" # permissions + o="`stat "$file" -c'%u (%U)'`" # owner + g="`stat "$file" -c'%g (%G)'`" # group + i="`"$RVS" commit "$file"`" # ID + n="$file" # name + + # %p %o %g %i %n + echo "$p$t$o$t$g$t$i$t$n" >> "$tmp" +done + +"$RVS" commit.f "$tmp" d +rm "$tmp" + diff --git a/modules/files/commit.f.sh b/modules/files/commit.f.sh new file mode 100644 index 0000000..e0df1b2 --- /dev/null +++ b/modules/files/commit.f.sh @@ -0,0 +1,32 @@ +#!/bin/sh +name='commit.f' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="FILENAME [TYPE]" +file="`getvar "$1"`" +prefix="${2-f}" + +hash=`sha1sum $file | sed "s/ .*$//"` +if [ ! -f "$REPO/@ID@/$hash" ]; then + mkdir -p "$REPO/@ID@/" + install -m 644 -o $USER -g $USER -T "$file" "$REPO/@ID@/$hash" +fi +echo "$prefix:$hash" + diff --git a/modules/files/commit.sh b/modules/files/commit.sh new file mode 100644 index 0000000..0bb8233 --- /dev/null +++ b/modules/files/commit.sh @@ -0,0 +1,27 @@ +#!/bin/sh +name='commit' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="[FILE]" +file=${1-.} # take arg1 as the file, default to the current directory + +type=`"$RVS" file-gettype "$file"` +"$RVS" "commit.$type" "$file" + diff --git a/modules/files/file-gettype.sh b/modules/files/file-gettype.sh new file mode 100644 index 0000000..2a1e0ca --- /dev/null +++ b/modules/files/file-gettype.sh @@ -0,0 +1,39 @@ +#!/bin/sh +name='file-gettype' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="FILE" +file="`getvar "$1"`" + +if [ ! -e "$file" ]; then + fatal "file \`$file' does not exist"; +else + type='' + for check in "$ETCDIR/@ID@/"*; do + type=`"$check" "$file"` + if [ -n "$type" ]; then break; fi + done + if [ -n "$type" ]; then + echo "$type" + else + fatal "cannot handle file type of \`$file'" + fi +fi + diff --git a/modules/files/get.d.sh b/modules/files/get.d.sh new file mode 100644 index 0000000..646e29d --- /dev/null +++ b/modules/files/get.d.sh @@ -0,0 +1,46 @@ +#!/bin/sh +name='get.d' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="DIRNAME ID" +dir="`getvar "$1"`" + id="`getvar "$2"`" + +tmp=`mktemp` +"$RVS" get.f "$tmp" "$id" + +#install -d "$dir" +mkdir -p "$dir" + +cd "$dir" +rm -rf ./* +while read line; do + p="`echo "$line" | cut -f1`" # permissions + o="`echo "$line" | cut -f2`" # owner + g="`echo "$line" | cut -f3`" # group + i="`echo "$line" | cut -f4`" # ID + n="`echo "$line" | cut -f5-`" # name + "$RVS" get "$n" "$i" + chmod "$p" "$n" + #chown "$o:$g" "$n" +done < "$tmp" + +rm "$tmp" + diff --git a/modules/files/get.f.sh b/modules/files/get.f.sh new file mode 100644 index 0000000..e3d5edc --- /dev/null +++ b/modules/files/get.f.sh @@ -0,0 +1,29 @@ +#!/bin/sh +name='get.f' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="FILENAME ID" +name="`getvar "$1"`" + id="`getvar "$2"`" + +hash="`"$RVS" blob-gethash "$id"`" + +install -T "$REPO/@ID@/$hash" "$name" + diff --git a/modules/files/get.sh b/modules/files/get.sh new file mode 100644 index 0000000..639ac57 --- /dev/null +++ b/modules/files/get.sh @@ -0,0 +1,32 @@ +#!/bin/sh +name='get' +ver=0.9 +# Copyright (C) 2009-2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="FILENAME ID" +name="`getvar "$1"`" + id="`getvar "$2"`" + +file="$REPO/@ID@/$id" + +type="`"$RVS" blob-gettype "$id"`" +#hash="`"$RVS" blob-gethash "$id"`" + +"$RVS" "get.$type" "$name" "$id" + diff --git a/modules/files/ls.sh b/modules/files/ls.sh new file mode 100644 index 0000000..9e586eb --- /dev/null +++ b/modules/files/ls.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +name='ls' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="DIR_ID [FORMAT]" +id="`getvar "$1"`" +form="${2-%p\t%o\t%g\t%n\t%i}" + +# %p - permissions +# %o - owner +# %g - group +# %i - blob id +# %n - name +# \t - a tab char + +tmp="`mktemp`" +"$RVS" get.f "$tmp" "$id" + +while read line; do + p="`echo "$line" | cut -f1`" + o="`echo "$line" | cut -f2`" + g="`echo "$line" | cut -f3`" + i="`echo "$line" | cut -f4`" + n="`echo "$line" | cut -f5-`" + echo "$form" | sed \ + -e 's:\\t:\t:g' \ + -e "s:%p:${p/:/\\:}:g" \ + -e "s:%o:${o/:/\\:}:g" \ + -e "s:%g:${g/:/\\:}:g" \ + -e "s:%i:${i/:/\\:}:g" \ + -e "s:%n:${n/:/\\:}:g" +done < "$tmp" + diff --git a/modules/files/print.sh b/modules/files/print.sh new file mode 100644 index 0000000..3657d2f --- /dev/null +++ b/modules/files/print.sh @@ -0,0 +1,39 @@ +#!/bin/sh +name='print' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage='ID' +id="`getvar "$1"`" + +hash="`"$RVS" blob-gethash "$id"`" +file="$REPO/@ID@/$hash" + +if [ -e "$file" ]; then + t="`"$RVS" blob-gettype "$id"`" + type='' + case "$t" in + f) type='regular file';; + d) type='directory';; + esac + echo "File Type: $t ($type)" +else + fatal "no object with ID \`$id'" +fi + diff --git a/modules/files/tree.sh b/modules/files/tree.sh new file mode 100644 index 0000000..6164d94 --- /dev/null +++ b/modules/files/tree.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +name='tree' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +. "$LIBDIR/@ID@/stdio" + +usage="DIR_ID [NAME] [PREFIX] [LAST]" +id="`getvar "$1"`" +name="${2-.}" +pref="$3" +last="$4" + +echo "$pref $name $id" +pref=' | ' +"$RVS" ls "$id" '%i\t%n' | while read line; do + i="`echo "$line" | cut -f1`" + n="`echo "$line" | cut -f2-`" + t="`"$RVS" blob-gettype "$i"`" + if [ "$t" = 'd' ] + "$RVS" tree "$i" "$n" "$pref" + else + echo "$pref $n $i" + fi +done + diff --git a/modules/module.mk b/modules/module.mk new file mode 100644 index 0000000..c6e577d --- /dev/null +++ b/modules/module.mk @@ -0,0 +1,35 @@ +#!/usr/bin/make -f +# Copyright (C) 2009, 2015 Luke Shumaker +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk +include $(topsrcdir)/common.top.mk + +name := $(lastword $(subst /, ,$(srcdir))) +include $(srcdir)/Makefile.inc.mk + +dirs += $(DESTDIR)$(pkglibexecdir)/modules/$(name) +src_files += Makefile Makefile.inc.mk Module.mk +sys_files += $(pkglibexecdir)/modules/$(name).mk +sys_files += $(addprefix $(pkglibexecdir)/modules/$(name)/,$(out_files)) + +$(DESTDIR)$(pkglibexecdir)/modules/$(name).mk: $(srcdir)/Module.mk | $(DESTDIR)$(pkglibexecdir)/modules + $(INSTALL_DATA) $< $@ +$(DESTDIR)$(pkglibexecdir)/modules/$(name)/%: $(srcdir)/% | $(DESTDIR)$(pkglibexecdir)/modules/$(name) + $(INSTALL_PROGRAM) $< $@ +$(DESTDIR)$(pkglibexecdir)/modules/$(name)/%: $(outdir)/% | $(DESTDIR)$(pkglibexecdir)/modules/$(name) + $(INSTALL_PROGRAM) $< $@ + +include $(topsrcdir)/common.bottom.mk diff --git a/modules/tags/Makefile b/modules/tags/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/tags/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/tags/Makefile.inc.mk b/modules/tags/Makefile.inc.mk new file mode 100644 index 0000000..8d687a5 --- /dev/null +++ b/modules/tags/Makefile.inc.mk @@ -0,0 +1,2 @@ +src_files += commit.sh get-tag.sh print.sh tag-id.sh tag.sh +out_files += commit get-tag print tag-id tag diff --git a/modules/tags/Module.mk b/modules/tags/Module.mk new file mode 100644 index 0000000..fd9e5f7 --- /dev/null +++ b/modules/tags/Module.mk @@ -0,0 +1,2 @@ +commit/tags :: commit/files + diff --git a/modules/tags/commit.sh b/modules/tags/commit.sh new file mode 100644 index 0000000..9282a11 --- /dev/null +++ b/modules/tags/commit.sh @@ -0,0 +1,24 @@ +#!/bin/sh +name='rvs @ID@ commit' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +if [ "$RVS_LEVEL" = '0' ]; then + id=`cat "$TMPDIR/commit/files"` + "$RVS" tag "$id" wch +fi + diff --git a/modules/tags/get-tag.sh b/modules/tags/get-tag.sh new file mode 100644 index 0000000..fa7895b --- /dev/null +++ b/modules/tags/get-tag.sh @@ -0,0 +1,25 @@ +#!/bin/sh +name='rvs @ID@ get-tag' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS get-tag FILENAME TAG" +name="${1?"$usage"}" + tag="${2?"$usage"}" + +"$RVS" get "$name" "`"$RVS" tag-id "$tag"`" + diff --git a/modules/tags/print.sh b/modules/tags/print.sh new file mode 100644 index 0000000..b7bc1c5 --- /dev/null +++ b/modules/tags/print.sh @@ -0,0 +1,30 @@ +#!/bin/sh +name='print' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +dir="$REPO/@ID@" +if [ -d "$dir" ]; then + cd "$dir" + echo "Tags:" + grep -rFxl "$id" ./ | sed 's/^\.\/\(.*\)/ \1/' +fi + + diff --git a/modules/tags/tag-id.sh b/modules/tags/tag-id.sh new file mode 100644 index 0000000..ef95f69 --- /dev/null +++ b/modules/tags/tag-id.sh @@ -0,0 +1,33 @@ +#!/bin/sh +name='tag-id' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name TAG" +tag="${1?"$usage"}" + +file="$REPO/@ID@/$tag" + +if [ -f "$file" ]; then + cat "$REPO/@ID@/$tag" +else + echo "$0: cannot find tag \`$tag'" >> /dev/stderr + exit 1 +fi + + + diff --git a/modules/tags/tag.sh b/modules/tags/tag.sh new file mode 100644 index 0000000..bc3f546 --- /dev/null +++ b/modules/tags/tag.sh @@ -0,0 +1,28 @@ +#!/bin/sh +name='rvs @ID@ tag' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +# tag ID TAG +usage="usage: $RVS tag ID TAG" + ID="${1?"$usage"}" +tag="${2?"$usage"}" + +file="$REPO/@ID@/$tag" +mkdir -p "`dirname "$file"`" +echo "$ID" > "$file" + diff --git a/modules/tree/Makefile b/modules/tree/Makefile new file mode 120000 index 0000000..fa7273c --- /dev/null +++ b/modules/tree/Makefile @@ -0,0 +1 @@ +../module.mk \ No newline at end of file diff --git a/modules/tree/Makefile.inc.mk b/modules/tree/Makefile.inc.mk new file mode 100644 index 0000000..82c0b58 --- /dev/null +++ b/modules/tree/Makefile.inc.mk @@ -0,0 +1,2 @@ +src_files += addparent.d.sh addparent.f.sh addparent.sh commit.sh delparent.f.sh getchildren.sh getparents.sh print.sh +out_files += addparent.d addparent.f addparent commit delparent.f getchildren getparents print diff --git a/modules/tree/Module.mk b/modules/tree/Module.mk new file mode 100644 index 0000000..2485770 --- /dev/null +++ b/modules/tree/Module.mk @@ -0,0 +1,3 @@ +commit/tags :: commit/tree +commit/tree :: commit/files + diff --git a/modules/tree/addparent.d.sh b/modules/tree/addparent.d.sh new file mode 100644 index 0000000..db43dd2 --- /dev/null +++ b/modules/tree/addparent.d.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +name='addparent.d' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +tc="`mktemp`" +tp="`mktemp`" + +"$RVS" ls "$child" '%i\t%n' > "$tc" +"$RVS" ls "$parent" '%i\t%n' > "$tp" + +while read line; do + name="`echo "$line" | cut -f2-`" + nID="`echo "$line" | cut -f1`" + oID="`sed -n "s:^\([a-z]\:[0-9a-f]*\)\t${name/:/\\:}$:\1:p" "$tp"`" + + if [ -n "$oID" ]; then + nT="`"$RVS" blob-gettype "$nID"`" + oT="`"$RVS" blob-gettype "$oID"`" + if [ "$nT" = "$oT" ]; then + "$RVS" addparent "$nID" "$oID" + fi + fi +done < "$tc" + +"$RVS" addparent.f "$child" "$parent" diff --git a/modules/tree/addparent.f.sh b/modules/tree/addparent.f.sh new file mode 100644 index 0000000..61b4f92 --- /dev/null +++ b/modules/tree/addparent.f.sh @@ -0,0 +1,27 @@ +#!/bin/sh +name='addparent.f' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +file="$REPO/tree/$child/$parent" +mkdir -p "`dirname "$file"`" +echo "$parent" > "$file" + diff --git a/modules/tree/addparent.sh b/modules/tree/addparent.sh new file mode 100644 index 0000000..6759bcb --- /dev/null +++ b/modules/tree/addparent.sh @@ -0,0 +1,35 @@ +#!/bin/sh +name='addparent' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +if [ ! "$child" = "$parent" ]; then + ct="`"$RVS" blob-gettype "$child"`" + pt="`"$RVS" blob-gettype "$parent"`" + + if [ "$ct" = "$pt" ]; then + "$RVS" "addparent.$ct" "$child" "$parent" + else + echo "$0: CHILD and PARENT must be the same type">>/dev/stderr + exit 1 + fi +fi + diff --git a/modules/tree/commit.sh b/modules/tree/commit.sh new file mode 100644 index 0000000..89b1bf6 --- /dev/null +++ b/modules/tree/commit.sh @@ -0,0 +1,27 @@ +#!/bin/sh +name='rvs @ID@ commit' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +if [ "$RVS_LEVEL" = '0' ]; then + id=`cat "$TMPDIR/commit/files"` + wch="`"$RVS" tag-id wch 2>/dev/null`" + if [ -n "$wch" ]; then + "$RVS" addparent "$id" "$wch" + fi +fi + diff --git a/modules/tree/delparent.f.sh b/modules/tree/delparent.f.sh new file mode 100644 index 0000000..e53df9b --- /dev/null +++ b/modules/tree/delparent.f.sh @@ -0,0 +1,34 @@ +#!/bin/sh +name='delparent.f' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="usage: $RVS $name CHILD PARENT" + child=${1?"$usage"} +parent=${2?"$usage"} + +file="$REPO/tree/$child/$parent" +rm "$file" +if [ -z "$(ls "`dirname "$file"`")" ]; then + rmdir "`dirname "$file"`" +fi + + dir="$REPO/tree/$child" +if [ -z "$(ls "`dirname "$dir"`")" ]; then + rmdir "`dirname "$dir"`" +fi + diff --git a/modules/tree/getchildren.sh b/modules/tree/getchildren.sh new file mode 100644 index 0000000..952522c --- /dev/null +++ b/modules/tree/getchildren.sh @@ -0,0 +1,28 @@ +#!/bin/sh +name='getchildren' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +dir="$REPO/@ID@/" +if [ -d "$dir" ]; then + grep -rFxh "$id" "$dir" +fi + + diff --git a/modules/tree/getparents.sh b/modules/tree/getparents.sh new file mode 100644 index 0000000..6e3edbd --- /dev/null +++ b/modules/tree/getparents.sh @@ -0,0 +1,27 @@ +#!/bin/sh +name='getparents' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +dir="$REPO/@ID@/$id" +if [ -d "$dir" ]; then + cat "$dir"/* +fi + diff --git a/modules/tree/print.sh b/modules/tree/print.sh new file mode 100644 index 0000000..0ebf8fd --- /dev/null +++ b/modules/tree/print.sh @@ -0,0 +1,27 @@ +#!/bin/sh +name='print' +ver=0.1 +# Copyright (C) 2010 Luke Shumaker +# +# This program 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 of the +# License, or (at your option) any later version. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. +# If not, see . + +usage="Usage: $RVS $name ID" +id="${1?"$usage"}" + +echo "Parents:" +"$RVS" getparents "$id" | sed 's/\(.*\)/ \1/' +echo "Children:" +"$RVS" getchildren "$id" | sed 's/\(.*\)/ \1/' + diff --git a/plugins/comments/bin/comment.sh b/plugins/comments/bin/comment.sh deleted file mode 100644 index 0be99e5..0000000 --- a/plugins/comments/bin/comment.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -name='comment' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="usage: $RVS $name ID" -id="${1?"$usage"}" - -file="$REPO/@ID@/$id" -mkdir -p "`dirname "$file"`" -editor "$file" >> /dev/stderr - diff --git a/plugins/comments/bin/commit.sh b/plugins/comments/bin/commit.sh deleted file mode 100644 index d13d754..0000000 --- a/plugins/comments/bin/commit.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -name='rvs @ID@ commit' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -if [ "$RVS_LEVEL" = '0' ]; then - id=`cat "$TMPDIR/commit/files"` - "$RVS" comment "$id" -fi - diff --git a/plugins/comments/bin/print.sh b/plugins/comments/bin/print.sh deleted file mode 100644 index b04a9cc..0000000 --- a/plugins/comments/bin/print.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -name='print' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="Usage: $RVS $name ID" -id="${1?"$usage"}" - -file="$REPO/@ID@/$id" -if [ -e "$file" ]; then - echo "Comment:" - sed 's/\(.*\)/ > \1/' "$file" -fi - diff --git a/plugins/comments/bin/showcomment.sh b/plugins/comments/bin/showcomment.sh deleted file mode 100644 index efbc00a..0000000 --- a/plugins/comments/bin/showcomment.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -name='showcomment' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="Usage: $RVS $name ID" -id="${1?"$usage"}" - -file="$REPO/@ID@/$id" -if [ -e "$file" ]; then - cat "$file" -fi - diff --git a/plugins/comments/dep b/plugins/comments/dep deleted file mode 100644 index a5bbb81..0000000 --- a/plugins/comments/dep +++ /dev/null @@ -1,2 +0,0 @@ -commit/comments :: commit/files - diff --git a/plugins/comments/info.mk.in b/plugins/comments/info.mk.in deleted file mode 100644 index ad2539d..0000000 --- a/plugins/comments/info.mk.in +++ /dev/null @@ -1,3 +0,0 @@ -name = comments -ver = 0.1 - diff --git a/plugins/date.author/bin/commit.sh b/plugins/date.author/bin/commit.sh deleted file mode 100644 index c05f77b..0000000 --- a/plugins/date.author/bin/commit.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -name='rvs @ID@ commit' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -if [ "$RVS_LEVEL" = '0' ]; then - id=`cat "$TMPDIR/commit/files"` - time=`date +%s` - file="$REPO/@ID@/$time" - if [ -n "$wch" ]; then - "$RVS" addparent "$id" "$wch" - fi -fi - diff --git a/plugins/date.author/dep b/plugins/date.author/dep deleted file mode 100644 index 3284d55..0000000 --- a/plugins/date.author/dep +++ /dev/null @@ -1,2 +0,0 @@ -commit/date.author :: commit/files - diff --git a/plugins/date.author/info.mk.in b/plugins/date.author/info.mk.in deleted file mode 100644 index 852203d..0000000 --- a/plugins/date.author/info.mk.in +++ /dev/null @@ -1,3 +0,0 @@ -name = date.author -ver = 0.9 - diff --git a/plugins/files/bin/blob-gethash.sh b/plugins/files/bin/blob-gethash.sh deleted file mode 100644 index 74defbc..0000000 --- a/plugins/files/bin/blob-gethash.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -name='blob-gethash' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="ID" -id="`getvar "$1"`" - -echo $id | sed 's/.*://' - diff --git a/plugins/files/bin/blob-gettype.sh b/plugins/files/bin/blob-gettype.sh deleted file mode 100644 index da3ee2a..0000000 --- a/plugins/files/bin/blob-gettype.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -name='blob-gettype' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="ID" -id="`getvar "$1"`" - -echo $id | sed 's/:.*//' - diff --git a/plugins/files/bin/commit.d.sh b/plugins/files/bin/commit.d.sh deleted file mode 100644 index d7e48f9..0000000 --- a/plugins/files/bin/commit.d.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -name='commit.d' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="DIRNAME" -dir="`getvar "$1"`" - -tmp=`mktemp` -t=' '; - -cd "$dir" -for file in *; do - p="`stat "$file" -c'%a' `" # permissions - o="`stat "$file" -c'%u (%U)'`" # owner - g="`stat "$file" -c'%g (%G)'`" # group - i="`"$RVS" commit "$file"`" # ID - n="$file" # name - - # %p %o %g %i %n - echo "$p$t$o$t$g$t$i$t$n" >> "$tmp" -done - -"$RVS" commit.f "$tmp" d -rm "$tmp" - diff --git a/plugins/files/bin/commit.f.sh b/plugins/files/bin/commit.f.sh deleted file mode 100644 index e0df1b2..0000000 --- a/plugins/files/bin/commit.f.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -name='commit.f' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="FILENAME [TYPE]" -file="`getvar "$1"`" -prefix="${2-f}" - -hash=`sha1sum $file | sed "s/ .*$//"` -if [ ! -f "$REPO/@ID@/$hash" ]; then - mkdir -p "$REPO/@ID@/" - install -m 644 -o $USER -g $USER -T "$file" "$REPO/@ID@/$hash" -fi -echo "$prefix:$hash" - diff --git a/plugins/files/bin/commit.sh b/plugins/files/bin/commit.sh deleted file mode 100644 index 0bb8233..0000000 --- a/plugins/files/bin/commit.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -name='commit' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="[FILE]" -file=${1-.} # take arg1 as the file, default to the current directory - -type=`"$RVS" file-gettype "$file"` -"$RVS" "commit.$type" "$file" - diff --git a/plugins/files/bin/file-gettype.sh b/plugins/files/bin/file-gettype.sh deleted file mode 100644 index 2a1e0ca..0000000 --- a/plugins/files/bin/file-gettype.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -name='file-gettype' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="FILE" -file="`getvar "$1"`" - -if [ ! -e "$file" ]; then - fatal "file \`$file' does not exist"; -else - type='' - for check in "$ETCDIR/@ID@/"*; do - type=`"$check" "$file"` - if [ -n "$type" ]; then break; fi - done - if [ -n "$type" ]; then - echo "$type" - else - fatal "cannot handle file type of \`$file'" - fi -fi - diff --git a/plugins/files/bin/get.d.sh b/plugins/files/bin/get.d.sh deleted file mode 100644 index 646e29d..0000000 --- a/plugins/files/bin/get.d.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -name='get.d' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="DIRNAME ID" -dir="`getvar "$1"`" - id="`getvar "$2"`" - -tmp=`mktemp` -"$RVS" get.f "$tmp" "$id" - -#install -d "$dir" -mkdir -p "$dir" - -cd "$dir" -rm -rf ./* -while read line; do - p="`echo "$line" | cut -f1`" # permissions - o="`echo "$line" | cut -f2`" # owner - g="`echo "$line" | cut -f3`" # group - i="`echo "$line" | cut -f4`" # ID - n="`echo "$line" | cut -f5-`" # name - "$RVS" get "$n" "$i" - chmod "$p" "$n" - #chown "$o:$g" "$n" -done < "$tmp" - -rm "$tmp" - diff --git a/plugins/files/bin/get.f.sh b/plugins/files/bin/get.f.sh deleted file mode 100644 index e3d5edc..0000000 --- a/plugins/files/bin/get.f.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -name='get.f' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="FILENAME ID" -name="`getvar "$1"`" - id="`getvar "$2"`" - -hash="`"$RVS" blob-gethash "$id"`" - -install -T "$REPO/@ID@/$hash" "$name" - diff --git a/plugins/files/bin/get.sh b/plugins/files/bin/get.sh deleted file mode 100644 index 639ac57..0000000 --- a/plugins/files/bin/get.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -name='get' -ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="FILENAME ID" -name="`getvar "$1"`" - id="`getvar "$2"`" - -file="$REPO/@ID@/$id" - -type="`"$RVS" blob-gettype "$id"`" -#hash="`"$RVS" blob-gethash "$id"`" - -"$RVS" "get.$type" "$name" "$id" - diff --git a/plugins/files/bin/ls.sh b/plugins/files/bin/ls.sh deleted file mode 100644 index 9e586eb..0000000 --- a/plugins/files/bin/ls.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash -name='ls' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="DIR_ID [FORMAT]" -id="`getvar "$1"`" -form="${2-%p\t%o\t%g\t%n\t%i}" - -# %p - permissions -# %o - owner -# %g - group -# %i - blob id -# %n - name -# \t - a tab char - -tmp="`mktemp`" -"$RVS" get.f "$tmp" "$id" - -while read line; do - p="`echo "$line" | cut -f1`" - o="`echo "$line" | cut -f2`" - g="`echo "$line" | cut -f3`" - i="`echo "$line" | cut -f4`" - n="`echo "$line" | cut -f5-`" - echo "$form" | sed \ - -e 's:\\t:\t:g' \ - -e "s:%p:${p/:/\\:}:g" \ - -e "s:%o:${o/:/\\:}:g" \ - -e "s:%g:${g/:/\\:}:g" \ - -e "s:%i:${i/:/\\:}:g" \ - -e "s:%n:${n/:/\\:}:g" -done < "$tmp" - diff --git a/plugins/files/bin/print.sh b/plugins/files/bin/print.sh deleted file mode 100644 index 3657d2f..0000000 --- a/plugins/files/bin/print.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -name='print' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage='ID' -id="`getvar "$1"`" - -hash="`"$RVS" blob-gethash "$id"`" -file="$REPO/@ID@/$hash" - -if [ -e "$file" ]; then - t="`"$RVS" blob-gettype "$id"`" - type='' - case "$t" in - f) type='regular file';; - d) type='directory';; - esac - echo "File Type: $t ($type)" -else - fatal "no object with ID \`$id'" -fi - diff --git a/plugins/files/bin/tree.sh b/plugins/files/bin/tree.sh deleted file mode 100644 index 6164d94..0000000 --- a/plugins/files/bin/tree.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash -name='tree' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -. "$LIBDIR/@ID@/stdio" - -usage="DIR_ID [NAME] [PREFIX] [LAST]" -id="`getvar "$1"`" -name="${2-.}" -pref="$3" -last="$4" - -echo "$pref $name $id" -pref=' | ' -"$RVS" ls "$id" '%i\t%n' | while read line; do - i="`echo "$line" | cut -f1`" - n="`echo "$line" | cut -f2-`" - t="`"$RVS" blob-gettype "$i"`" - if [ "$t" = 'd' ] - "$RVS" tree "$i" "$n" "$pref" - else - echo "$pref $n $i" - fi -done - diff --git a/plugins/files/dep b/plugins/files/dep deleted file mode 100644 index e69de29..0000000 diff --git a/plugins/files/etc/3-d.sh b/plugins/files/etc/3-d.sh deleted file mode 100644 index f169cae..0000000 --- a/plugins/files/etc/3-d.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -if [ -d "$1" ]; then echo 'd'; fi - diff --git a/plugins/files/etc/5-f.sh b/plugins/files/etc/5-f.sh deleted file mode 100644 index 0506894..0000000 --- a/plugins/files/etc/5-f.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -if [ -f "$1" ]; then echo 'f'; fi - diff --git a/plugins/files/info.mk.in b/plugins/files/info.mk.in deleted file mode 100644 index 78a0580..0000000 --- a/plugins/files/info.mk.in +++ /dev/null @@ -1,3 +0,0 @@ -name = files -ver = 0.9 - diff --git a/plugins/files/lib/stdio.sh b/plugins/files/lib/stdio.sh deleted file mode 100644 index 974e98e..0000000 --- a/plugins/files/lib/stdio.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -#name='stdio' -#ver=0.9 -# Copyright (C) 2009-2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -verbose() { - if [ "$volume" == '-v' ]; then - echo $@ >> /dev/stderr - fi -} - -out() { - if [ "$volume" != '-q' ]; then - echo $@ >> /dev/stderr - fi -} - -warn () { - echo "$name: $1" >> /dev/stderr -} - -fatal () { - warn "$1" - exit 1 -} - -error() { - warn "$1" - cat << __error__ >> /dev/stderr -Usage: $RVS $name $usage - -Try \`$RVS help $name' for more options. -__error__ - exit 1 -} - -getvar() { - if [ -z "$1" ]; then - error - else - echo $1 - fi -} - -version() { - echo "$name $ver" - if [ "$volume" != '-q' ]; then - cat << __disclaimer__ -$name is copyright (C) 2009-2010 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 . -__disclaimer__ - fi - exit 0 -} - diff --git a/plugins/main.mk.in b/plugins/main.mk.in deleted file mode 100644 index 774e4ac..0000000 --- a/plugins/main.mk.in +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/make -f -#name=rvs plugins -#version='1.0' -# Copyright (C) 2009 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -sysconfdir = @sysconfdir@ -BINDIR = @BINDIR@ -TMPDIR = @TMPDIR@ -LIBDIR = @LIBDIR@ -ETCDIR = @ETCDIR@ -dirs += $(sysconfdir) $(BINDIR) $(TMPDIR) $(LIBDIR) $(ETCDIR) - -mods = files tags -mods-build = $(addprefix build-,$(mods)) -mods-install = $(addprefix install-,$(mods)) -mods-uninstall = $(addprefix uninstall-,$(mods)) -mods-clean = $(addprefix clean-,$(mods)) -mods-distclean = $(addprefix distclean-,$(mods)) - -.PHONY : all -all : build - -.PHONY : build install clean distclean -# $(mods-build) $(mods-install) $(mods-clean) $(mods-distclean) -build : $(mods-build) -install : $(mods-install) -uninstall : $(mods-uninstall) -clean : $(mods-clean) -distclean : $(mods-distclean) - $(RM) Makefile *.mk - -.SECONDARY: - -%/main.mk : plugin.mk %/; cp $< $@ - -complete-% : %/ %/main.mk; : -build-% : %/ complete-% %/main.mk; $(MAKE) -C $< -install-% : %/ complete-% %/main.mk; $(MAKE) -C $< install -uninstall-% : %/ complete-% %/main.mk; $(MAKE) -C $< uninstall -clean-% : %/ complete-% %/main.mk; -$(MAKE) -C $< clean -distclean-% : %/ complete-% %/main.mk; $(MAKE) -C $< distclean - diff --git a/plugins/plugin.mk.in b/plugins/plugin.mk.in deleted file mode 100644 index d631e4e..0000000 --- a/plugins/plugin.mk.in +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/make -f -#name=rvs plugin Makefile -#ver=0.9 -include info.mk # this contains the actuall name/version for the plugin -# Copyright (C) 2009 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -sysconfdir = @sysconfdir@ -BINDIR = @BINDIR@ -TMPDIR = @TMPDIR@ -LIBDIR = @LIBDIR@ -ETCDIR = @ETCDIR@ -DEPDIR = @DEPDIR@ -dirs += $(sysconfdir) $(BINDIR) $(TMPDIR) $(LIBDIR) $(ETCDIR) $(DEPDIR) - -rvs = @rvs@ -RVS = @RVS@ - -id = $(name) - -# phony targets #################################################### -all : $(name) -.PHONY : $(name) install uninstall clean distclean -.SUFFIXES : - -# build ############################################################ -srcFiles = $(filter-out %/Makefile.in,$(shell find $(srcdir)/ -type f)) - -shSrcFiles = $(filter %.sh,$(srcFiles)) -shOutFiles = $(patsubst $(srcdir)/%,%,$(basename $(shSrcFiles))) - -outFiles = $(shOutFiles) -outBin = $(addprefix $(BINDIR)/$(name)/,$(notdir $(filter bin/%,$(outFiles)))) -outEtc = $(addprefix $(ETCDIR)/$(name)/,$(notdir $(filter etc/%,$(outFiles)))) -outLib = $(addprefix $(LIBDIR)/$(name)/,$(notdir $(filter lib/%,$(outFiles)))) - -$(name) : $(myoutdir) $(shOutFiles) - -# (un)install ###################################################### - -install : $(outBin) $(outEtc) $(outLib) - -$(outBin) : $(BINDIR)/$(name)/% : bin/% - $(MKDIR) $(dir $@) - $(INSTALL_PROGRAM) $< $@ - -$(outEtc) : $(ETCDIR)/$(name)/% : etc/% - $(MKDIR) $(dir $@) - $(INSTALL_PROGRAM) $< $@ - -$(outLib) : $(LIBDIR)/$(name)/% : lib/% - $(MKDIR) $(dir $@) - $(INSTALL_DATA) $< $@ - -uninstall : $(addprefix un,$(outBin)) - $(RM) -r $(ETCDIR)/$(name) - $(RM) -r $(LIBDIR)/$(name) - -# clean ############################################################ - -clean : - -distclean : clean - find ./ -name Makefile -exec $(RM) '{}' \; - find ./ -name '*.mk' -exec $(RM) '{}' \; - -# implicit rules ################################################### - -b := @ -# build shell scripts -$(shOutFiles) : % : %.sh - $(INSTALL_PROGRAM) $< $@ - $(SED) -i \ - -e 's/$bSHELL@/$(subst /,\/,$(SHELL))/g' \ - -e 's/$bID@/$(subst /,\/,$(id))/g' \ - $@ - diff --git a/plugins/tags/bin/commit.sh b/plugins/tags/bin/commit.sh deleted file mode 100644 index 9282a11..0000000 --- a/plugins/tags/bin/commit.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -name='rvs @ID@ commit' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -if [ "$RVS_LEVEL" = '0' ]; then - id=`cat "$TMPDIR/commit/files"` - "$RVS" tag "$id" wch -fi - diff --git a/plugins/tags/bin/get-tag.sh b/plugins/tags/bin/get-tag.sh deleted file mode 100644 index fa7895b..0000000 --- a/plugins/tags/bin/get-tag.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -name='rvs @ID@ get-tag' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="usage: $RVS get-tag FILENAME TAG" -name="${1?"$usage"}" - tag="${2?"$usage"}" - -"$RVS" get "$name" "`"$RVS" tag-id "$tag"`" - diff --git a/plugins/tags/bin/print.sh b/plugins/tags/bin/print.sh deleted file mode 100644 index b7bc1c5..0000000 --- a/plugins/tags/bin/print.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -name='print' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="Usage: $RVS $name ID" -id="${1?"$usage"}" - -dir="$REPO/@ID@" -if [ -d "$dir" ]; then - cd "$dir" - echo "Tags:" - grep -rFxl "$id" ./ | sed 's/^\.\/\(.*\)/ \1/' -fi - - diff --git a/plugins/tags/bin/tag-id.sh b/plugins/tags/bin/tag-id.sh deleted file mode 100644 index ef95f69..0000000 --- a/plugins/tags/bin/tag-id.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -name='tag-id' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="usage: $RVS $name TAG" -tag="${1?"$usage"}" - -file="$REPO/@ID@/$tag" - -if [ -f "$file" ]; then - cat "$REPO/@ID@/$tag" -else - echo "$0: cannot find tag \`$tag'" >> /dev/stderr - exit 1 -fi - - - diff --git a/plugins/tags/bin/tag.sh b/plugins/tags/bin/tag.sh deleted file mode 100644 index bc3f546..0000000 --- a/plugins/tags/bin/tag.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -name='rvs @ID@ tag' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -# tag ID TAG -usage="usage: $RVS tag ID TAG" - ID="${1?"$usage"}" -tag="${2?"$usage"}" - -file="$REPO/@ID@/$tag" -mkdir -p "`dirname "$file"`" -echo "$ID" > "$file" - diff --git a/plugins/tags/dep b/plugins/tags/dep deleted file mode 100644 index fd9e5f7..0000000 --- a/plugins/tags/dep +++ /dev/null @@ -1,2 +0,0 @@ -commit/tags :: commit/files - diff --git a/plugins/tags/info.mk.in b/plugins/tags/info.mk.in deleted file mode 100644 index 3f08f99..0000000 --- a/plugins/tags/info.mk.in +++ /dev/null @@ -1,3 +0,0 @@ -name = tags -ver = 0.1 - diff --git a/plugins/tree/bin/addparent.d.sh b/plugins/tree/bin/addparent.d.sh deleted file mode 100644 index db43dd2..0000000 --- a/plugins/tree/bin/addparent.d.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash -name='addparent.d' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="usage: $RVS $name CHILD PARENT" - child=${1?"$usage"} -parent=${2?"$usage"} - -tc="`mktemp`" -tp="`mktemp`" - -"$RVS" ls "$child" '%i\t%n' > "$tc" -"$RVS" ls "$parent" '%i\t%n' > "$tp" - -while read line; do - name="`echo "$line" | cut -f2-`" - nID="`echo "$line" | cut -f1`" - oID="`sed -n "s:^\([a-z]\:[0-9a-f]*\)\t${name/:/\\:}$:\1:p" "$tp"`" - - if [ -n "$oID" ]; then - nT="`"$RVS" blob-gettype "$nID"`" - oT="`"$RVS" blob-gettype "$oID"`" - if [ "$nT" = "$oT" ]; then - "$RVS" addparent "$nID" "$oID" - fi - fi -done < "$tc" - -"$RVS" addparent.f "$child" "$parent" diff --git a/plugins/tree/bin/addparent.f.sh b/plugins/tree/bin/addparent.f.sh deleted file mode 100644 index 61b4f92..0000000 --- a/plugins/tree/bin/addparent.f.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -name='addparent.f' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="usage: $RVS $name CHILD PARENT" - child=${1?"$usage"} -parent=${2?"$usage"} - -file="$REPO/tree/$child/$parent" -mkdir -p "`dirname "$file"`" -echo "$parent" > "$file" - diff --git a/plugins/tree/bin/addparent.sh b/plugins/tree/bin/addparent.sh deleted file mode 100644 index 6759bcb..0000000 --- a/plugins/tree/bin/addparent.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -name='addparent' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="usage: $RVS $name CHILD PARENT" - child=${1?"$usage"} -parent=${2?"$usage"} - -if [ ! "$child" = "$parent" ]; then - ct="`"$RVS" blob-gettype "$child"`" - pt="`"$RVS" blob-gettype "$parent"`" - - if [ "$ct" = "$pt" ]; then - "$RVS" "addparent.$ct" "$child" "$parent" - else - echo "$0: CHILD and PARENT must be the same type">>/dev/stderr - exit 1 - fi -fi - diff --git a/plugins/tree/bin/commit.sh b/plugins/tree/bin/commit.sh deleted file mode 100644 index 89b1bf6..0000000 --- a/plugins/tree/bin/commit.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -name='rvs @ID@ commit' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -if [ "$RVS_LEVEL" = '0' ]; then - id=`cat "$TMPDIR/commit/files"` - wch="`"$RVS" tag-id wch 2>/dev/null`" - if [ -n "$wch" ]; then - "$RVS" addparent "$id" "$wch" - fi -fi - diff --git a/plugins/tree/bin/delparent.f.sh b/plugins/tree/bin/delparent.f.sh deleted file mode 100644 index e53df9b..0000000 --- a/plugins/tree/bin/delparent.f.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -name='delparent.f' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="usage: $RVS $name CHILD PARENT" - child=${1?"$usage"} -parent=${2?"$usage"} - -file="$REPO/tree/$child/$parent" -rm "$file" -if [ -z "$(ls "`dirname "$file"`")" ]; then - rmdir "`dirname "$file"`" -fi - - dir="$REPO/tree/$child" -if [ -z "$(ls "`dirname "$dir"`")" ]; then - rmdir "`dirname "$dir"`" -fi - diff --git a/plugins/tree/bin/getchildren.sh b/plugins/tree/bin/getchildren.sh deleted file mode 100644 index 952522c..0000000 --- a/plugins/tree/bin/getchildren.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -name='getchildren' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="Usage: $RVS $name ID" -id="${1?"$usage"}" - -dir="$REPO/@ID@/" -if [ -d "$dir" ]; then - grep -rFxh "$id" "$dir" -fi - - diff --git a/plugins/tree/bin/getparents.sh b/plugins/tree/bin/getparents.sh deleted file mode 100644 index 6e3edbd..0000000 --- a/plugins/tree/bin/getparents.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -name='getparents' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="Usage: $RVS $name ID" -id="${1?"$usage"}" - -dir="$REPO/@ID@/$id" -if [ -d "$dir" ]; then - cat "$dir"/* -fi - diff --git a/plugins/tree/bin/print.sh b/plugins/tree/bin/print.sh deleted file mode 100644 index 0ebf8fd..0000000 --- a/plugins/tree/bin/print.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -name='print' -ver=0.1 -# Copyright (C) 2010 Luke Shumaker -# -# This program 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 of the -# License, or (at your option) any later version. -# -# 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. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. -# If not, see . - -usage="Usage: $RVS $name ID" -id="${1?"$usage"}" - -echo "Parents:" -"$RVS" getparents "$id" | sed 's/\(.*\)/ \1/' -echo "Children:" -"$RVS" getchildren "$id" | sed 's/\(.*\)/ \1/' - diff --git a/plugins/tree/dep b/plugins/tree/dep deleted file mode 100644 index 2485770..0000000 --- a/plugins/tree/dep +++ /dev/null @@ -1,3 +0,0 @@ -commit/tags :: commit/tree -commit/tree :: commit/files - diff --git a/plugins/tree/info.mk.in b/plugins/tree/info.mk.in deleted file mode 100644 index b947f3d..0000000 --- a/plugins/tree/info.mk.in +++ /dev/null @@ -1,3 +0,0 @@ -name = tree -ver = 0.1 - diff --git a/wrapper/.gitignore b/wrapper/.gitignore index 6141a28..0c3c90a 100644 --- a/wrapper/.gitignore +++ b/wrapper/.gitignore @@ -1,2 +1,3 @@ /outer -/inner \ No newline at end of file +/inner +/inner.sh diff --git a/wrapper/Makefile b/wrapper/Makefile index f316cc0..54047d2 100644 --- a/wrapper/Makefile +++ b/wrapper/Makefile @@ -17,16 +17,19 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../config.mk include $(topsrcdir)/common.top.mk -src_files += Makefile outer.c inner.sh -obj_files += outer inner -install_files += $(bindir)/$(PACKAGE) $(pkglibexecdir)/$(PACKAGE) +src_files += Makefile outer.c inner.sh.m4 runcmd.mk +out_files += outer inner +clean_files += inner.sh +sys_files += $(bindir)/$(PACKAGE) $(pkglibexecdir)/$(PACKAGE) $(pkglibexecdir)/runcmd.mk -$(objdir)/outer.o: $(topobjdir)/config.h -$(objdir)/inner: $(topobjdir)/config.sh +$(outdir)/outer.o: $(topoutdir)/config.h +$(outdir)/inner: $(topoutdir)/config.sh -$(DESTDIR)$(bindir)/$(PACKAGE) : $(objdir)/outer | $(DESTDIR)$(bindir) +$(DESTDIR)$(bindir)/$(PACKAGE) : $(outdir)/outer | $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) $< $@ -$(DESTDIR)$(pkglibexecdir)/$(PACKAGE) : $(objdir)/inner | $(DESTDIR)$(bindir) +$(DESTDIR)$(pkglibexecdir)/$(PACKAGE) : $(outdir)/inner | $(DESTDIR)$(pkglibexecdir) + $(INSTALL_PROGRAM) $< $@ +$(DESTDIR)$(pkglibexecdir)/runcmd.mk : $(srcdir)/runcmd.mk | $(DESTDIR)$(pkglibexecdir) $(INSTALL_PROGRAM) $< $@ include $(topsrcdir)/common.bottom.mk diff --git a/wrapper/inner.sh b/wrapper/inner.sh deleted file mode 100644 index b1dc718..0000000 --- a/wrapper/inner.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/env bash -# rvs inner.sh - The main RVS program -# Copyright (C) 2009-2010, 2015 Luke Shumaker -# -# This file is part of rvs. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -set -u - -m4_include(config.sh) - -declare -r varname_REPO="${PACKAGE^^}_REPO" -declare -r varname_EXEC_PATH="${PACKAGE^^}_EXEC_PATH" - -declare -r program_name="$1"; shift - - - -_() { - if type gettext &>/dev/null; then - TEXTDOMAINDIR=$localedir gettext "$pkgtextdomain" "$1"; - else - echo "$1"; - fi -} - -sighandler_exit() { - local signal=$1; shift - echo - error 0 "$@" - trap -- "$signal" - kill -"$signal" "$$" -} - -install_sighandlers() { - set -E - for signal in TERM HUP QUIT; do - trap "signalhandler_exit $signal '%s signal cought. Exiting...'" $signal - done - trap 'signalhandler_exit INT "Aborted by user. Exiting..."' INT - trap 'kill -USR1 "$$"' ERR -} - -# Like GLibC's error(3), but call gettext on the format string -error() { - >&2 printf "%s: $(_ "$2")\n" "$RVS" "${@:3}" - [[ $1 -eq 0 ]] || exit $1 -} - -_runcmd() { - [[ $# -ge 1 ]] || error 1 'Usage: %s []' "$program_name" - local cmd=$1 - - local exec_path="${!varname_EXEC_PATH:-$pkglibexecdir}" - - if [ ! -e "$exec_path/$cmd" ] || [ "$cmd" = "${PACKAGE}" ]; then - error 127 '%s: Not a %s command' "$cmd" "$PACKAGE" - else - trap '[ -z "${TMPDIR:-}" ] || rm -rf -- "$TMPDIR"' EXIT - export TMPDIR="$(mktemp -dt "${PACKAGE}.XXXXXXXXXX")" - - repo="$(_repo)" - export "$varname_REPO=$repo" - - set -o pipefail - - if [ -f "$exec_path/$cmd" ]; then - "$exec_path/$cmd" "$@" | tee -- "$TMPDIR/$cmd" - elif [ -d "$exec_path/$cmd" ]; then - mkdir -p -- "$TMPDIR/$cmd" - local file - for file in "$exec_path/$command"/*; do - "$file" "$@" | tee -- "$TMPDIR/$command/${file##*/}" || - error 127 'Aborting: error encountered while running: %s' "$file" - done - else - error 127 '%s: Could not execute' "$exec_path/$cmd" - fi - fi -} - -_repo() { - [[ $# -ne 0 ]] || error 1 'Usage: %s repo' "$program_name" - if [ -z "${!varname_REPO:-}" ]; then # we aren't getting a value from then env - local repo=".${PACKAGE,,}" - - # [------can ascend-----] && ! [-not found repo--] - while [ "$PWD" != "$OLDPWD" ] && ! [ -d "$PWD/$repo" ]; do - cd .. - done - - if [ -d "$PWD/$repo" ]; then - # we found a repository - printf '%s\n' "$PWD/$repo" - else - # we didn't find a repository - error 128 "No %s repository found" "$PACKAGE" - fi - else - printf '%s\n' "${!varname_REPO}" - fi -} - -_init() { - [[ $# -gt 1 ]] || error 1 'Usage: %s init [directory]' "$program_name" - local dir="${1:-$PWD}" - mkdir -p -- "$dir" - cd "$dir" - repo="$(_repo 2> /dev/null)" || true - if [ -n "${repo:-}" ]; then - _error 129 "Repository already exists at \`%s'" "$repo" - fi - export "$varname_REPO=$PWD/.${PACKAGE,,}" - mkdir "${!varname_REPO}" - _runcmd init "$dir" -} - -main() { - install_sighandlers - [[ $# -ge 1 ]] || error 'No command specified';; - export "${PACKAGE^^}=$program_name" - - local cmd=$1; shift - case "$cmd" in - repo) _repo "$@";; - init) _init "$@";; - *) _runcmd "$cmd" "$@";; - esac -} - -main "$@" - -# 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/inner.sh.m4 b/wrapper/inner.sh.m4 new file mode 100644 index 0000000..8444bd6 --- /dev/null +++ b/wrapper/inner.sh.m4 @@ -0,0 +1,154 @@ +#!/usr/bin/env bash +# rvs inner.sh - The main RVS program +# Copyright (C) 2009-2010, 2015 Luke Shumaker +# +# This file is part of rvs. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +set -u + +m4_include(config.sh) + +declare -r varname_REPO="${PACKAGE^^}_REPO" +declare -r varname_EXEC_PATH="${PACKAGE^^}_EXEC_PATH" + +declare -r program_name="$1"; shift + + + +_() { + if type gettext &>/dev/null; then + TEXTDOMAINDIR=$localedir gettext "$pkgtextdomain" "$1"; + else + echo "$1"; + fi +} + +sighandler_exit() { + local signal=$1; shift + echo + error 0 "$@" + trap -- "$signal" + kill -"$signal" "$$" +} + +install_sighandlers() { + set -E + for signal in TERM HUP QUIT; do + trap "signalhandler_exit $signal '%s signal cought. Exiting...'" $signal + done + trap 'signalhandler_exit INT "Aborted by user. Exiting..."' INT + trap 'kill -USR1 "$$"' ERR +} + +# Like GLibC's error(3), but call gettext on the format string +error() { + >&2 printf "%s: $(_ "$2")\n" "$program_name" "${@:3}" + [[ $1 -eq 0 ]] || exit $1 +} + +errusage() { + >&2 printf "$(_ "$2")\n" "$program_name" "${@:3}" + [[ $1 -eq 0 ]] || exit $1 +} + +_runcmd() { + [[ $# -ge 1 ]] || errusage 1 'Usage: %q []' + local cmd=$1; shift + local args_str='' + [[ $# -eq 0 ]] || printf -v args_str '%q ' "$@" + + local exec_path="${!varname_EXEC_PATH:-$pkglibexecdir}" + + shopt -s nullglob + local files=("${exec_path}"/modules/*/"$cmd") + if [[ ${#files[@]} -eq 0 ]]; then + error 127 '%s: Not a %s command' "$cmd" "$PACKAGE" + fi + files=("${files[@]#"${exec_path/modules/}"}") + + local output_dir + trap '[ -z "${output_dir:-}" ] || rm -rf -- "$TMPDIR"' EXIT + output_dir="$(mktemp -dt "${PACKAGE}.XXXXXXXXXX")" + + local repo + repo="$(_repo)" + export "${varname_REPO}=${repo}" + + local cwd + printf -v cwd '%q' "$PWD" + + make -j1 \ + -f "$exec_path/runcmd.mk" \ + -C "$output_dir" \ + ARGS="$args_str" \ + EXEC_PATH="$exec_path" \ + CWD="$cwd" \ + -- "${files[@]}" + exit $? +} + +_repo() { + [[ $# -ne 0 ]] || errusage 1 'Usage: %q repo' + if [ -z "${!varname_REPO:-}" ]; then # we aren't getting a value from then env + local repo=".${PACKAGE,,}" + + # [------can ascend-----] && ! [-not found repo--] + while [ "$PWD" != "$OLDPWD" ] && ! [ -d "$PWD/$repo" ]; do + cd .. + done + + if [ -d "$PWD/$repo" ]; then + # we found a repository + printf '%s\n' "$PWD/$repo" + else + # we didn't find a repository + error 128 "No %s repository found" "$PACKAGE" + fi + else + printf '%s\n' "${!varname_REPO}" + fi +} + +_init() { + [[ $# -gt 1 ]] || errusage 1 'Usage: %q init [directory]' + local dir="${1:-$PWD}" + mkdir -p -- "$dir" + cd "$dir" + repo="$(_repo 2> /dev/null)" || true + if [ -n "${repo:-}" ]; then + _error 129 "Repository already exists at \`%s'" "$repo" + fi + export "$varname_REPO=$PWD/.${PACKAGE,,}" + mkdir "${!varname_REPO}" + _runcmd init "$dir" +} + +main() { + install_sighandlers + [[ $# -ge 1 ]] || error 'No command specified';; + export "${PACKAGE^^}=$program_name" + + local cmd=$1; shift + case "$cmd" in + repo) _repo "$@";; + init) _init "$@";; + *) _runcmd "$cmd" "$@";; + esac +} + +main "$@" + +# 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/runcmd.mk b/wrapper/runcmd.mk new file mode 100644 index 0000000..7cadb43 --- /dev/null +++ b/wrapper/runcmd.mk @@ -0,0 +1,15 @@ +#!/usr/bin/make -f + +# Environment/command line variables: +# - ARGS +# - EXEC_DIR +# - CWD + +SHELL = bash -o pipefail + +export OUTPUT_DIR := $(realpath .) + +% : $(EXEC_PATH)/modules/% + cd $(CWD) && '$<' $(ARGS) | tee -- '$@' + +include $(wildcard $(EXEC_PATH)/modules/*.mk) -- cgit v1.1-4-g5e80