Browse Source

Moved from googlecode to libcode

Serj Kalichev 10 years ago
commit
bedd828f95

+ 95 - 0
Makefile

@@ -0,0 +1,95 @@
+# $Id: Makefile 534 2008-04-08 11:36:22Z gloomy $
+include Rules.make
+
+VERTITLE := $(TITLE)-$(VERSION)
+SUBDIRS  :=
+DATE := $(shell date +'%Y%m%d')
+ARCHIVE := "$(TITLE)-$(DATE).tar.bz2"
+RELEASE := "$(VERTITLE).tar.bz2"
+RPMBUILD := $(shell \
+    rpmbuild --help 2>/dev/null >/dev/null; \
+    if [ $$? == "0" ]; then \
+	echo rpmbuild; \
+    else \
+	echo rpm; \
+    fi \
+    )
+HISTORY := "History"
+
+all: prep
+	@for dir in $(SUBDIRS); do \
+		$(MAKE) -C $$dir $(@) || exit 1; \
+	done;
+
+prep:
+#	sed -e "s|_unique_source_version_|$(VERSION)|" \
+#	-e "s|_unique_libdir_|$(LIB_DIR)|" \
+#	-e "s|_unique_makefiles_dir_|$(TARGET_MAKEFILES_DIR)|" \
+#	$(SCRIPTS_DIR)/$(TITLE)-config.in > $(SCRIPTS_DIR)/$(TITLE)-config
+
+clean:
+	$(RM) *.spec *.tar.bz2
+	rm -f $(SCRIPTS_DIR)/$(TITLE)-config
+	@for dir in $(SUBDIRS); do \
+		$(MAKE) -C $$dir $(@) || exit 1; \
+	done;
+
+install: all
+	@for dir in $(SUBDIRS); do \
+		$(MAKE) -C $$dir install || exit 1; \
+	done;
+
+# Install Makefiles
+	install -d $(INSTALL_MAKEFILES_DIR)
+	install -m 0644 $(MAKEFILES_DIR)/Makefile.repo	$(INSTALL_MAKEFILES_DIR)
+	install -m 0644 $(MAKEFILES_DIR)/Makefile.project	$(INSTALL_MAKEFILES_DIR)
+
+# Install scripts and other stuff
+	install -d $(INSTALL_BIN_DIR)
+	install -m 0755 $(SCRIPTS_DIR)/rf	$(INSTALL_BIN_DIR)
+
+	install -d $(INSTALL_SBIN_DIR)
+	install -m 0755 $(SCRIPTS_DIR)/rfa	$(INSTALL_SBIN_DIR)
+
+# Install configs
+	install -d $(INSTALL_CONF_DIR)
+	install -m 0644 $(CONF_DIR)/rfa.conf	$(INSTALL_CONF_DIR)
+
+	install -d $(INSTALL_PC_DIR)
+	install -m 0644 $(CONF_DIR)/repoforge.pc	$(INSTALL_PC_DIR)
+
+spec:
+	sed -e "s|_unique_source_name_|$(ARCHIVE)|" \
+		-e "s|_unique_source_version_|$(VERSION)|" \
+		-e "s|_unique_source_major_|$(MAJOR)|" \
+		-e "s|_unique_source_minor_|$(MINOR)|" \
+		-e "s|_unique_source_bugfix_|$(BUGFIX)|" \
+		$(TITLE).spec.in > $(TITLE).spec
+
+archive: clean spec
+	ln -sf ./ $(VERTITLE)
+	tar -cj --exclude $(VERTITLE)/$(VERTITLE) --exclude .svn --exclude CVS --exclude $(ARCHIVE) -f $(ARCHIVE) $(VERTITLE)/*
+	$(RM) $(VERTITLE)
+
+release: archive
+	mv -f $(ARCHIVE) $(RELEASE)
+
+srpm: archive
+	$(RPMBUILD) -ts $(ARCHIVE)
+
+rpm: archive
+	$(RPMBUILD) -tb $(ARCHIVE)
+
+history:
+	@> $(HISTORY)
+	@echo "Project: "$(TITLE) >> $(HISTORY)
+	@echo "Version: "$(VERSION) >> $(HISTORY)
+	@echo "Date: "`date` >> $(HISTORY)
+	-@svn update; \
+	if [ $$? == 0 ]; then \
+		svn info | grep "Revision:" >> $(HISTORY); \
+		echo "History:" >> $(HISTORY); \
+		svn -v log >> $(HISTORY); \
+	fi;
+
+.PHONY: all clean libs utils tests install po archive spec rpm srpm history

+ 51 - 0
Rules.make

@@ -0,0 +1,51 @@
+# $Id: Rules.make 532 2008-04-07 11:57:01Z pkun $
+
+TITLE := repoforge
+MAJOR := 0
+MINOR := 5
+BUGFIX := 1
+VERSION := $(MAJOR).$(MINOR).$(BUGFIX)
+
+MAKEFILES_DIR		:= makefiles
+SCRIPTS_DIR		:= scripts
+CONF_DIR		:= conf
+
+TARGET_PREFIX_DIR	:= /usr
+TARGET_DATA_DIR		:= $(TARGET_PREFIX_DIR)/share
+TARGET_MAKEFILES_DIR	:= $(TARGET_DATA_DIR)/$(TITLE)
+TARGET_BIN_DIR		:= $(TARGET_PREFIX_DIR)/bin
+TARGET_SBIN_DIR		:= $(TARGET_PREFIX_DIR)/sbin
+TARGET_PC_DIR		:= $(TARGET_DATA_DIR)/pkgconfig
+TARGET_CONF_DIR		:= /etc/repoforge
+
+DESTDIR			:= /
+INSTALL_FAKE_ROOT	:= $(DESTDIR)
+INSTALL_PREFIX_DIR	:= $(INSTALL_FAKE_ROOT)$(TARGET_PREFIX_DIR)
+INSTALL_DATA_DIR	:= $(INSTALL_FAKE_ROOT)$(TARGET_DATA_DIR)
+INSTALL_MAKEFILES_DIR	:= $(INSTALL_FAKE_ROOT)$(TARGET_MAKEFILES_DIR)
+INSTALL_BIN_DIR		:= $(INSTALL_FAKE_ROOT)$(TARGET_BIN_DIR)
+INSTALL_SBIN_DIR	:= $(INSTALL_FAKE_ROOT)$(TARGET_SBIN_DIR)
+INSTALL_PC_DIR		:= $(INSTALL_FAKE_ROOT)$(TARGET_PC_DIR)
+INSTALL_CONF_DIR	:= $(INSTALL_FAKE_ROOT)$(TARGET_CONF_DIR)
+
+ifdef DEBUG
+DEBUG_FLAGS = -DDEBUG -ggdb -gdwarf-2 -g3
+OPT_FLAGS =
+else
+OPT_FLAGS = -O2
+endif
+
+CC	:= gcc
+ARFLAGS	:= rcs
+CFLAGS	+= $(OPT_FLAGS) \
+    -std=c99 -fno-common \
+    -Wstrict-prototypes -Wmissing-prototypes -Wsign-compare -Wmissing-declarations \
+    -Wshadow -Wpointer-arith -Wcast-align -Wpacked -Wall -Werror $(DEBUG_FLAGS)
+CXXFLAGS += $(OPT_FLAGS) \
+    -fno-common -Wsign-compare \
+    -Wshadow -Wpointer-arith -Wcast-align -Wpacked -Wall -Werror $(DEBUG_FLAGS)
+CPPFLAGS += -MD -D_GNU_SOURCE
+LDFLAGS	+= -z defs 
+
+# Shared libraries specific CFLAGS
+CFLAGS_SO := -fpic

+ 10 - 0
conf/repoforge.pc

@@ -0,0 +1,10 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=/usr/share
+includedir=/usr/include
+makefiledir=${libdir}/repoforge
+ 
+Name: repoforge
+Description: Repository building helper
+Version: 1.0
+Cflags: -I${includedir}

+ 12 - 0
conf/rfa.conf

@@ -0,0 +1,12 @@
+# Minimal GID for vcs groups
+group_gid_min=3000
+
+# Prefixes for write and read vcs group names
+group_r_prefix=svn_r-
+group_w_prefix=svn_w-
+
+repository_root=/massiv/svn
+repository_link=/svn
+
+
+

+ 13 - 0
debian/changelog

@@ -0,0 +1,13 @@
+repoforge (0.4.0) unstable; urgency=low
+
+  * Allow multiply repositories with add/del commands;
+  * Allow multiply user names with useradd/userdel commands;
+  * Implement fixmod command.
+
+ -- Serj Kalichev <serj.kalichev@gmail.com>  Mon, 15 Dec 2008 18:26:46 +0300
+
+repoforge (0.3.0) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Serj Kalichev <serj.kalichev@gmail.com>  Wed, 29 Oct 2008 18:04:51 +0300

+ 1 - 0
debian/compat

@@ -0,0 +1 @@
+7

+ 24 - 0
debian/control

@@ -0,0 +1,24 @@
+Source: repoforge
+Section: devel
+Priority: optional
+Maintainer: Serj Kalichev <serj.kalichev@gmail.com>
+Build-Depends: debhelper, cdbs
+Standards-Version: 3.8.0
+
+Package: repoforge
+Architecture: all
+Depends: make
+Description: system to store packages in VCS
+ RepoForge helps to store and develop packages using VCS. The packages is
+ Debian source packages and SRPMs. These packages is binary files and it's
+ not a right way to store binary information in VCS. RepoForge provides
+ some additional infrastructure to store only origin sources in binary form
+ but all additional changes is in text form suitable for development. The
+ Subversion is supported now.
+
+Package: repoforge-admin
+Architecture: all
+Depends: passwd, subversion
+Description: utility to serve VCS repositories
+ Utility rfa helps to maintain VCS repositories. The Subversion is
+ supported now.

+ 35 - 0
debian/copyright

@@ -0,0 +1,35 @@
+This package was debianized by Serj Kalichev <serj.kalichev@gmail.com> on
+Wed, 29 Oct 2008 18:04:51 +0300.
+
+It was downloaded from http://repoforge.astra.rusbitech.ru
+
+Upstream Authors:
+
+    Serj Kalichev <serj.kalichev@gmail.com>
+
+Copyright:
+
+    Copyright (C) 2008 Serj Kalichev
+
+License:
+
+    This package 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 package 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 package; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2008, pkun <serj.kalichev@gmail.com> and
+is licensed under the GPL, see above.
+

+ 2 - 0
debian/repoforge-admin.install

@@ -0,0 +1,2 @@
+usr/sbin/rfa
+etc/repoforge/rfa.conf

+ 3 - 0
debian/repoforge.install

@@ -0,0 +1,3 @@
+usr/bin/rf
+usr/share/pkgconfig/*
+usr/share/repoforge/*

+ 9 - 0
debian/rules

@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/makefile.mk
+
+DEB_MAKE_CLEAN_TARGET	= clean
+DEB_MAKE_BUILD_TRGET	= all
+DEB_MAKE_INSTALL_TARGET	= install DESTDIR=$(CURDIR)/debian/tmp
+DEB_MAKE_CHECK_TARGET	=

+ 1 - 0
debian/source/format

@@ -0,0 +1 @@
+3.0 (native)

+ 69 - 0
makefiles/Makefile.lib

@@ -0,0 +1,69 @@
+# $Id: Makefile 357 2007-06-26 14:28:49Z pkun $
+include ../Rules.make
+
+ifdef VERSION_SCRIPT
+LDFLAGS		+= --version-script=$(VERSION_SCRIPT) 
+endif
+CFLAGS		+= $(CFLAGS_SO)
+WL		:= -Wl,
+WL_RPATH_LINK	:= $(WL)-rpath-link,
+I		:= $(addprefix -I, $(INC_PATH))
+L		:= $(addprefix -L, $(LIB_PATH))
+WL_L		:= $(addprefix $(WL_RPATH_LINK), $(LIB_PATH))
+WL_LDFLAGS	:= $(addprefix $(WL), $(LDFLAGS))
+
+A	:= lib$(NAME).a
+LDSO	:= lib$(NAME).so
+SONAME	:= $(LDSO).$(MAJOR)
+SO	:= $(SONAME).$(MINOR)
+
+OBJ	:= $(patsubst %.c, %.o, $(SRC))
+
+ifndef NO_SO
+ALL	+= $(SO)
+endif
+ifndef NO_A
+ALL	+= $(A)
+endif
+############################################
+
+all: locale_all_pre $(ALL) locale_all locale_all_post
+
+$(SO): $(OBJ) 
+	$(CC) -Wl,-soname,$(SONAME) -shared -o $(@) $(^) $(LOBJS) $(LIBS) $(L) $(WL_L) $(WL_LDFLAGS)
+	ln -sf $(@) $(SONAME)
+	ln -sf $(SONAME) $(LDSO)
+
+$(A): $(OBJ)
+	for l in $(LIBS_STATIC); do\
+		objs=`$(AR) t $$l`;\
+		$(AR) x $$l;\
+		$(AR) $(ARFLAGS) $(@) $$objs;\
+		rm $$objs;\
+	done;\
+	$(AR) $(ARFLAGS) $(@) $(^)
+
+$(OBJ): %.o : %.c
+	$(CC) -c $(<) $(I) $(CFLAGS) $(CPPFLAGS)
+
+include $(wildcard *.d)
+
+clean: locale_clean
+	$(RM) *.o *.d *.a *.so *.so.*
+
+install: all locale_install_pre install_lib locale_install locale_install_post
+
+install_lib:
+ifndef NO_INSTALL
+	install -d $(INSTALL_LIB_DIR)
+ifndef NO_A
+	install $(A) $(INSTALL_LIB_DIR)
+endif
+ifndef NO_SO
+	install -m 0755 $(SO) $(INSTALL_LIB_DIR)
+	ln -sf $(SO) $(INSTALL_LIB_DIR)/$(SONAME)
+	ln -sf $(SONAME) $(INSTALL_LIB_DIR)/$(LDSO)
+endif
+endif
+
+.PHONY: all clean install locale_all_pre locale_all locale_all_post locale_install_pre locale_install locale_install_post locale_clean

+ 3 - 0
makefiles/Makefile.project

@@ -0,0 +1,3 @@
+# $Id$
+REPOFORGE_MAKEFILES := $(shell pkg-config --variable=makefiledir repoforge)
+include $(REPOFORGE_MAKEFILES)/Makefile.repo

+ 230 - 0
makefiles/Makefile.repo

@@ -0,0 +1,230 @@
+# $Id$
+REPOFORGE := repoforge
+include package.$(REPOFORGE)
+
+PWD := $(shell pwd)
+WORK_DIR := work
+TEMP_DIR := temp
+BUILD_DIR := build
+
+# Function to find out absolute path
+absname = $(if $(filter /%,$(1)),$(1),$(PWD)/$(1))
+
+# Structure of repoforge tree
+ifndef sources_dir
+SOURCES_DIR_ORIG := sources
+else
+SOURCES_DIR_ORIG := $(sources_dir)
+endif
+SOURCES_DIR := $(call absname,$(SOURCES_DIR_ORIG))
+ifndef specs_dir
+SPECS_DIR_ORIG := $(SOURCES_DIR_ORIG)
+else
+SPECS_DIR_ORIG := $(specs_dir)
+endif
+SPECS_DIR := $(call absname,$(SPECS_DIR_ORIG))
+
+PATCH_NAME := $(title)-$(version)-$(REPOFORGE).patch
+PATCH := $(SOURCES_DIR)/$(PATCH_NAME)
+PATCH_LINK := $(PATCH_NAME)
+DATE := $(shell date +'%Y%m%d')
+HISTORY := "History"
+EXCLUDE := exclude.$(REPOFORGE)
+AUTO_EXCLUDE := auto_exclude.$(REPOFORGE)
+
+#------------------- Check title and version
+ifndef title
+  ${error Package title is not specified.}
+endif
+
+#------------------- Find out base package system
+PKG_LEGAL := 0
+ifndef pkg
+  ${error Package system is not specified.}
+endif
+
+ifeq "$(pkg)" "rpm"
+  PKG_LEGAL := 1
+  RPM := rpm
+  RPMBUILD := $(shell \
+    rpmbuild --help 2>/dev/null >/dev/null; \
+    if [ $$? == "0" ]; then \
+	echo rpmbuild; \
+    else \
+	echo rpm; \
+    fi \
+    )
+  RPMOPTS := --define="_sourcedir $(SOURCES_DIR)" --define="_builddir $(PWD)/$(BUILD_DIR)" --define="_specdir $(SPECS_DIR)"
+  PKG_SPEC_NAME := $(title).spec
+  PKG_SPEC := $(SPECS_DIR)/$(PKG_SPEC_NAME)
+  PKG_SPEC_LINK := $(title).spec
+  PKG_WITH_PATCH := --with $(REPOFORGE)_patch
+  PKG_WITHOUT_PATCH := --without $(REPOFORGE)_patch
+  PKG_BP_BUILD := $(RPMBUILD) $(RPMOPTS) -bp --nodeps
+  PKG_BC_BUILD := $(RPMBUILD) $(RPMOPTS) -bc
+  PKG_BS := $(RPMBUILD) $(RPMOPTS) -bs
+  PKG_BB := $(RPMBUILD) $(RPMOPTS) -bb
+  PKG_TREE := $(RPM) $(RPMOPTS) -ivh --nodeps
+endif
+ifeq "$(pkg)" "deb"
+  ${warning Debian package system is not supported yet.}
+endif
+
+ifeq ($(PKG_LEGAL),0)
+  ${error Unsupported package system $(pkg).}
+endif
+
+# Public targets
+
+all: buildprep
+
+clean: temp_del build_del clean_rm
+
+init: work_dir work_link build_bp
+
+bp: temp_dir temp_link build_bp cp_build_work work_link temp_del
+
+bc: temp_dir temp_link build_bc cp_build_work work_link temp_del
+
+srpm: bs
+bs: temp_dir temp_link orig patch_diff build_bs work_link temp_del
+
+rpm: bb
+bb: temp_dir temp_link orig patch_diff build_bb work_link temp_del
+
+patch: temp_dir temp_link orig patch_diff work_link temp_del
+
+prep: rpmize work_link
+
+repair: rep
+rep: clean prep
+
+copy: cop
+cop: cp_build_work work_link temp_del 
+
+# Internal targets
+
+clean_rm:
+	@$(RM) $(PATCH) $(PATCH_LINK) $(AUTO_EXCLUDE) $(HISTORY)
+	@if [ -h $(PKG_SPEC_LINK) ]; then \
+		$(RM) $(PKG_SPEC_LINK); \
+	fi
+
+init_svn:
+	@echo "Add working dir $(WORK_DIR) to the repository..."
+	@status=`svn -N st $(WORK_DIR)`; \
+	if [[ "$$status" =~ "^\?" ]]; then \
+		svn add $(WORK_DIR); \
+		svn ci -m "Initial working dir. Created by repoforge init command." $(WORK_DIR); \
+#		echo "OK"; \
+	else \
+		echo "Directory $(WORK_DIR) is already in repository."; \
+	fi;
+
+build_bp:
+	@echo "Build source tree...";
+	$(PKG_BP_BUILD) $(PKG_SPEC)
+
+orig:
+	$(PKG_BP_BUILD) $(PKG_WITHOUT_PATCH) $(PKG_SPEC)
+
+build_bc:
+	@echo "Build package...";
+	$(PKG_BC_BUILD) $(PKG_SPEC)
+
+cp_build_work:
+	@echo "Copy data from temporary to working directory..."; \
+	tar -c -C $(BUILD_DIR) `ls -A $(BUILD_DIR)` | tar -x -C $(WORK_DIR)
+
+temp_dir:
+	@if [ ! -d $(TEMP_DIR) ]; then \
+		mkdir $(TEMP_DIR); \
+	else \
+		rm -Rf $(TEMP_DIR)/*; \
+	fi; \
+
+temp_del:
+	@rm -Rf $(TEMP_DIR)
+
+work_dir:
+	@echo "Creating directory $(WORK_DIR) ..."
+	@if [ ! -d $(WORK_DIR) ]; then \
+		mkdir $(WORK_DIR); \
+	else \
+		rm -Rf $(WORK_DIR)/*; \
+	fi
+
+work:
+	@echo "Preparing directory $(WORK_DIR) ..."
+	$(PKG_BP_WORK) $(PKG_WITHOUT_PATCH) $(PKG_SPEC)
+
+work_del:
+	@rm -Rf $(WORK_DIR)
+
+buildprep: patch
+
+patch_diff:
+	@echo "Making patch..."
+	@> $(AUTO_EXCLUDE)
+	@svn st $(WORK_DIR) | grep -E "^\?" | sed -e "s|^\? *[^/]*/||" >> $(AUTO_EXCLUDE)
+	@LC_ALL=en_US diff --exclude=".svn" -uNrp $(BUILD_DIR) $(WORK_DIR) | filterdiff -p 1 -X $(AUTO_EXCLUDE) -X $(EXCLUDE) | filterdiff > $(PATCH); true
+	@if [ ! -f $(PATCH_LINK) ]; then \
+		ln -s -f -n $(SOURCES_DIR_ORIG)/$(PATCH_NAME) $(PATCH_LINK); \
+	fi
+
+work_link:
+	@ln -f -n -s $(WORK_DIR) $(BUILD_DIR)
+
+temp_link:
+	@ln -f -n -s $(TEMP_DIR) $(BUILD_DIR)
+
+build_del:
+	@if [ -h "$(BUILD_DIR)" ]; then \
+		$(RM) $(BUILD_DIR); \
+	fi
+
+
+rpmize: spec_link
+
+spec_link:
+ifeq "$(pkg)" "rpm"
+	@if [ ! -f $(PKG_SPEC_LINK) ]; then \
+		ln -s -n -f $(SPECS_DIR_ORIG)/$(PKG_SPEC_NAME) $(PKG_SPEC_LINK); \
+	fi
+endif
+
+tree:
+	@if [ ! -f "$(SOURCES_DIR)" ]; then \
+		mkdir -p $(SOURCES_DIR); \
+	fi
+ifeq "$(pkg)" "rpm"
+	@if [ ! -f "$(SPECS_DIR)" ]; then \
+		mkdir -p $(SPECS_DIR); \
+	fi
+endif
+	@if [ -f "$(SOURCE)" ]; then \
+		$(PKG_TREE) $(SOURCE); \
+	fi
+
+build_bs:
+	@echo "Building SRPM..."
+	$(PKG_BS) $(PKG_SPEC)
+
+build_bb:
+	@echo "Building RPM..."
+	$(PKG_BB) $(PKG_SPEC)
+
+history:
+	@> $(HISTORY)
+	@echo "Project: "$(TITLE) >> $(HISTORY)
+	@echo "Version: "$(version) >> $(HISTORY)
+	@echo "Date: "`date` >> $(HISTORY)
+	-@svn update; \
+	if [ $$? == 0 ]; then \
+		svn info | grep "Revision:" >> $(HISTORY); \
+		echo "History:" >> $(HISTORY); \
+		svn -v log >> $(HISTORY); \
+	fi;
+
+.PHONY: all clean clean_rm install archive rpm srpm history patch build_del buildprep prep work temp work_del temp_del bp bb bs bc init temp_bp temp_cp temp_bc tree work_link temp_link build_bp orig build_bb build_bs
+

+ 84 - 0
repoforge.spec.in

@@ -0,0 +1,84 @@
+# $Id$
+
+%if %{_arch} != %{_build_arch}
+%define cross_compile 1
+%else
+%define cross_compile 0
+%endif
+%ifarch %{ix86}
+%define cross_compile 0
+%endif
+
+#undefine _enable_debug_packages
+
+# Version
+%define major _unique_source_major_
+%define minor _unique_source_minor_
+
+Name: repoforge
+Summary: Helper tools for distributive creation.
+Version: %{major}.%{minor}
+Release: vniins3
+License: %{_license}
+Vendor: %{_vendor}
+Group: %{_group_tools}
+BuildRoot: /var/tmp/%{name}-root
+Requires: make
+Source0: _unique_source_name_
+
+%description
+Helper tools for building distributive. 
+It allows to use subversion (or another control version systems) to store SRPM packages and
+makes easier the development and patching.
+
+%prep
+
+%setup -q
+
+%build
+
+%if %{cross_compile}==1
+export LDFLAGS=" $LDFLAGS -L$TARGET_ROOTFS/lib "
+%endif
+
+make VERSION=%{version}
+
+%install
+rm -rf ${RPM_BUILD_ROOT} 
+make install \
+	INSTALL_FAKE_ROOT=${RPM_BUILD_ROOT} \
+	TARGET_DATA_DIR=%{_datadir} \
+	TARGET_BIN_DIR=%{_bindir} \
+	VERSION=%{version}
+%post 
+#/sbin/ldconfig
+
+%preun
+
+%postun
+#/sbin/ldconfig
+
+%clean
+rm -rf ${RPM_BUILD_ROOT} 
+
+%files
+%defattr(-,root,root)
+%dir %{_datadir}/%{name}
+%{_datadir}/%{name}/*
+%dir %{_bindir}
+%attr(0755,root,root) %{_bindir}/rf
+%dir %{_datadir}/pkgconfig
+%attr(0644,root,root) %config(noreplace) %{_datadir}/pkgconfig/* 
+#%config(noreplace) %{_mcfgdir}/mswitch.conf
+
+%changelog
+
+* Tue Jul 01 2008 Serj Kalichev (serj.kalichev@gmail.com) vniins3
+- New directory structure;
+- Targets pepair, copy etc.
+
+* Tue Jun 05 2008 Serj Kalichev (serj.kalichev@gmail.com) vniins2
+- New concept using rf utility.
+
+* Mon May 19 2008 Serj Kalichev (serj.kalichev@gmail.com) vniins1
+- First version.

+ 38 - 0
scripts/rf

@@ -0,0 +1,38 @@
+#!/bin/sh
+
+REPOFORGE=repoforge
+PACKAGE_FILE=package.$REPOFORGE
+if [ $# -lt 1 ]; then
+	set "all"
+fi
+MAKEFILEDIR=`pkg-config --variable=makefiledir repoforge`
+if [ -f "Makefile" ]; then
+	MAKEFILE=./Makefile
+else
+	MAKEFILE=$MAKEFILEDIR/Makefile.repo
+fi
+TARGETS=`make --makefile="$MAKEFILE" --print-data-base --dry-run --ignore-errors --keep-going 2>/dev/null | grep -E "^$1:"`
+IFSRC=`echo "$1" | grep -E "src.rpm$"`
+if [ "$TARGETS" ]; then
+	make --makefile="$MAKEFILE" "$@"
+#	echo "make --makefile=$MAKEFILE $@"
+elif [ "$IFSRC" ]; then
+	SOURCE=$1
+	shift
+	TITLE=`echo $SOURCE | sed -r "s|-[^-]*-[^-]*\.src\.rpm$||"`
+	echo "Title: $TITLE"
+	VERSION=`echo $SOURCE | sed -r "s|.*-([^-]*)-[^-]*\.src\.rpm$|\1|"`
+	echo "Version: $VERSION"
+	RELEASE=`echo $SOURCE | sed -r "s|.*-[^-]*-([^-]*)\.src\.rpm$|\1|"`
+	echo "Release: $RELEASE"
+	> $PACKAGE_FILE
+	echo "# Auto generated file by repoforge" >> $PACKAGE_FILE
+	echo >> $PACKAGE_FILE
+	echo "title = $TITLE" >> $PACKAGE_FILE
+	echo "version = $VERSION" >> $PACKAGE_FILE
+	echo "pkg = rpm" >> $PACKAGE_FILE
+	make --makefile="$MAKEFILE" tree init prep SOURCE="$SOURCE" "$@"
+else
+	svn "$@"
+#	echo "svn $@"
+fi

+ 276 - 0
scripts/rfa

@@ -0,0 +1,276 @@
+#!/bin/bash
+
+# Config file name
+rfa_conf=/etc/repoforge/rfa.conf
+
+# Defaults for rfa.conf
+group_gid_min=3000
+group_w_prefix=svn_w-
+group_r_prefix=svn_r-
+repository_root=
+repository_link=
+
+# Options
+opts_force=0
+
+todo=""
+
+# Echo help information
+usage()
+{
+	echo "Usage: "`basename $0`" [options] <command> <parameters>"
+	echo "Tool for VCS repository administration. Now supports" \
+	"Subversion only."
+	printf "Options:\n"
+	printf "\t-h, --help\n"
+	printf "\t\tPrint help message.\n"
+	printf "Commands:\n"
+	printf "\tadd <repository1> [repository2] ...\n"
+	printf "\t\tCreate new repository.\n"
+	printf "\tdel <repository1> [repository2] ...\n"
+	printf "\t\tDelete existing repository.\n"
+	printf "\tfixmod <repository1> [repository2] ...\n"
+	printf "\t\tFix access rights for repository.\n"
+	printf "\tuseradd <repository> <r/w/rw> <user1> [user2] ...\n"
+	printf "\t\tSet access rights for user(s) to repository.\n"
+	printf "\tuserdel <repository> <r/w/rw> <user1> [user2] ...\n"
+	printf "\t\tRemove access rights for user(s) to repository.\n"
+}
+
+group_add()
+{
+	groupadd -K GID_MIN=${group_gid_min} ${group_r_prefix}$1
+	groupadd -K GID_MIN=${group_gid_min} ${group_w_prefix}$1
+}
+
+group_del()
+{
+	groupdel ${group_r_prefix}$1
+	groupdel ${group_w_prefix}$1
+}
+
+svn_add()
+{
+	repository_name=$1
+	repo_r=${repository_root}/${repository_name}
+	repo_w=${repository_root}/${repository_name}/${repository_name}
+
+	mkdir ${repo_r}
+	saved_umask=`umask`
+	umask 002
+	svnadmin --fs-type=fsfs create ${repo_w}
+	umask ${saved_umask}
+}
+
+svn_fixmod()
+{
+	repository_name=$1
+	repo_r=${repository_root}/${repository_name}
+	repo_w=${repository_root}/${repository_name}/${repository_name}
+
+	chmod 750 ${repo_r}
+	chgrp ${group_r_prefix}${repository_name} ${repo_r}
+	chgrp -R ${group_w_prefix}${repository_name} ${repo_w}
+	dirs=`find ${repo_w} -type d`
+	for dir in $dirs; do
+		chmod g+s $dir
+	done
+	chmod -R g+w ${repo_w}
+}
+
+svn_del()
+{
+	rm -Rf ${repository_root}/$1
+}
+
+link_add()
+{
+	ln -s ${repository_root}/$1/$1 ${repository_link}/$1
+}
+
+link_del()
+{
+	rm -f ${repository_link}/$1
+}
+
+repository_add()
+{
+	for rep_name in "$@"; do
+		group_add $rep_name
+		svn_add $rep_name
+		svn_fixmod $rep_name
+		link_add $rep_name
+	done
+}
+
+repository_fixmod()
+{
+	for rep_name in "$@"; do
+		svn_fixmod $rep_name
+	done
+}
+
+repository_del()
+{
+	for rep_name in "$@"; do
+		link_del $rep_name
+		svn_del $rep_name
+		group_del $rep_name
+	done
+}
+
+user_add()
+{
+	w=0
+	r=0
+	
+	repository_name=$1
+	shift
+	case "$1" in
+	r)
+		r=1
+		;;
+	w)
+		w=1
+		;;
+	rw|wr)
+		r=1
+		w=1
+		;;
+	*)
+		echo "Illegal parameter $1"
+		exit -1
+		;;
+	esac
+	shift
+	for user_name in "$@"; do
+		if [ $r -ne 0 ]; then
+			adduser ${user_name} ${group_r_prefix}${repository_name}
+		fi
+		if [ $w -ne 0 ]; then
+			adduser ${user_name} ${group_w_prefix}${repository_name}
+		fi
+	done
+}
+
+user_del()
+{
+	w=0
+	r=0
+
+	repository_name=$1
+	shift
+	case "$1" in
+	r)
+		r=1
+		;;
+	w)
+		w=1
+		;;
+	rw|wr)
+		r=1
+		w=1
+		;;
+	*)
+		echo "Illegal parameter $1"
+		exit -1
+		;;
+	esac
+	shift
+	for user_name in "$@"; do
+		if [ $r -ne 0 ]; then
+			deluser ${user_name} ${group_r_prefix}${repository_name}
+		fi
+		if [ $w -ne 0 ]; then
+			deluser ${user_name} ${group_w_prefix}${repository_name}
+		fi
+	done
+}
+
+# Parse command line options
+cmd_options=$(getopt -o "+hfl:" -l help,force,level -- "$@")
+if test "$?" != 0; then
+	usage
+	exit 1
+fi
+
+eval set -- ${cmd_options}
+while  test "$1" != "--"; do
+	case "$1" in
+	-h|--help) 
+		usage
+		exit 0 
+		;;
+	-f|--force)
+		opts_force=1
+		;;
+	-l|--level)
+		shift
+		level=$1 
+		;;
+	*)
+		;;
+	esac
+	shift
+done
+shift
+
+. $rfa_conf
+
+if [ $# -lt 1 ]; then
+	echo "Command is expected"
+	exit -1
+fi
+
+case "$1" in
+"help") 
+	usage
+	exit 0 
+	;;
+"add")
+	if [ $# -lt 2 ]; then
+		echo "Repository name is expected"
+		exit -1
+	fi
+	shift
+	repository_add "$@"
+	;;
+"fixmod")
+	if [ $# -lt 2 ]; then
+		echo "Repository name is expected"
+		exit -1
+	fi
+	shift
+	repository_fixmod "$@"
+	;;
+"del")
+	if [ $# -lt 2 ]; then
+		echo "Repository name is expected"
+		exit -1
+	fi
+	shift
+	repository_del "$@"
+	;;
+"adduser"|"useradd")
+	if [ $# -lt 4 ]; then
+		echo "Not enought parameters"
+		exit -1
+	fi
+	shift
+	user_add "$@"
+	;;
+"deluser"|"userdel")
+	if [ $# -lt 4 ]; then
+		echo "Not enought parameters"
+		exit -1
+	fi
+	shift
+	user_del "$@"
+	;;
+*)
+	echo "Unknown command"
+	exit -1
+	;;
+esac
+
+exit 0