#
# mrsgui/scripts/svn-retry/Makefile ---
#
# This

SHELL:=/bin/bash
.SUFFIXES:

_default: _test

#####

# We make a copy, as we dont want to replace it on our systems.
/usr/bin/svn-exe:
	sudo cp /usr/bin/svn ${@}

/usr/bin/svn-original:
	sudo cp /usr/bin/svn ${@}

_svn_exe: /usr/bin/svn-exe /usr/bin/svn-original

#####

# return an error if the prior command worked.
expect_fail:=if [[ "$$?" = "0" ]] ; then exit 1 ; else exit 0 ; fi

I279_URL:="https://svn.hbaspecto.com/svn/pecas/PECASAlberta/Scenarios/I279"

_test_test_fail:
	false; ${expect_fail}

_test_help:
	./svn-retry --help

_test_version:
	./svn-retry --version

_test_ls_1:
	./svn-retry ls ${I279_URL}

_test_ls_2:
	./svn-retry ls "bogus url"; ${expect_fail}

# Tell it to use "false" which will fail
_test_checkout_fail_1:
	SVN_RETRY_SVN_EXE=/bin/false ./svn-retry checkout ${I279_URL} ; ${expect_fail}

# A checkout which should work
_test_checkout_ok_1:
	./svn-retry checkout ${I279_URL}/2080 I279-2080

#####

_test+=_test_test_fail
#
_test+=_test_help
_test+=_test_version
_test+=_test_ls_1
_test+=_test_ls_2
#
_test+=_test_checkout_fail_1
_test+=_test_checkout_ok_1

_test: ${_test}


#####

zip_date:=$(shell date +%Y%m%d)
zip_file:=svn-retry-${zip_date}.zip

_zip_make:
	cd .. && \
	  rm -f ${zip_file} && \
	  ln -s svn-retry svn-retry-${zip_date} && \
	  zip ${zip_file} \
	    svn-retry-${zip_date}/{README.rst,Makefile,hba-setup.env,svn-retry} && \
	  rm svn-retry-${zip_date} && \
	  zipinfo ${zip_file}
