BUILDRESULT=$(CURDIR)/result
VER=$(shell LANG=C grep '>software_version' gforge/common/include/FusionForge.class.php | cut -d\' -f2)
-ID=$(shell LANG=C svnversion)
-URL=$(shell LANG=C svn info | grep 'Root:' | awk '{print $$3}')
-TAG=$(shell LANG=C svn log $(URL) -r $(ID) -l 1 2>/dev/null | awk '{ if ($$1=="Tag-Release") print $$1}')
+in_svn_repo:= $(wildcard .svn/)
+ifeq ($(strip $(in_svn_repo)),)
+ ID=unknown
+ URL=unknown
+ TAG=unknown
+else
+ ID=$(shell LANG=C svnversion)
+ URL=$(shell LANG=C svn info | grep 'Root:' | awk '{print $$3}')
+ TAG=$(shell LANG=C svn log $(URL) -r $(ID) -l 1 2>/dev/null | awk '{ if ($$1=="Tag-Release") print $$1}')
+endif
ifeq ($(TAG),)
VERSION=fusionforge-$(VER)-$(ID)
else
gfversion=$(shell head -1 $(PKGNAME)/debian/changelog | sed 's/.*(\(.[^+-]*\).*).*/\1/')
gfminor=$(shell head -1 $(PKGNAME)/debian/changelog | sed 's/.*(.[^+-]*[+-]\(.*\)).*/\1/')
-svnrev=$(shell LANG=C svn info | grep Revision | cut -d: -f2| sed 's/ //g')
-
+in_svn_repo:= $(wildcard .svn/)
+ifeq ($(strip $(in_svn_repo)),)
+ svnrev=unknown
+else
+ svnrev=$(shell LANG=C svn info | grep Revision | cut -d: -f2| sed 's/ //g')
+endif
MINOR=-1
MINOR=-$(BRANCH)$(svnrev)+$(XDISTRIB)