<commit_before>DEFAULT_REGISTRY      = registry.mgr.suse.de
DEFAULT_VERSION       = sles12sp1
DEFAULT_FLAVOR        = products
TOASTER_MOUNTPOINT    = /salt-toaster
ROOT_MOUNTPOINT       = /salt/src
SALT_REPO_MOUNTPOINT  = $(ROOT_MOUNTPOINT)/salt-devel
SALT_TESTS            = $(ROOT_MOUNTPOINT)/salt-*/tests
DOCKER_VOLUMES        = -v "$(CURDIR)/:$(TOASTER_MOUNTPOINT)"
EXPORTS += \
	-e "SALT_TESTS=$(SALT_TESTS)" \
	-e "TOASTER_MOUNTPOINT=$(TOASTER_MOUNTPOINT)" \
	-e "VERSION=$(VERSION)" \
	-e "FLAVOR=$(FLAVOR)" \
	-e "MINION_VERSION=$(MINION_VERSION)" \
	-e "MINION_FLAVOR=$(MINION_FLAVOR)"


ifndef DOCKER_IMAGE
	ifndef DOCKER_REGISTRY
		DOCKER_REGISTRY = $(DEFAULT_REGISTRY)
	endif
	ifndef VERSION
		VERSION = $(DEFAULT_VERSION)
	endif
	ifndef FLAVOR
		FLAVOR = $(DEFAULT_FLAVOR)
	endif
	DOCKER_IMAGE = $(DOCKER_REGISTRY)/toaster-$(VERSION)-$(FLAVOR)
endif

help:
	@echo "Salt Toaster: an ultimate test suite for Salt."
	@echo
	@echo "Commands:"
	@echo "  set_env              Create environment"
	@echo "  docker_shell         Start Docker shell"
	@echo "  build_image          Build Docker image"
	@echo "  salt_integration     Run Salt integration tests"
	@echo "  custom_integration   Run custom integration tests"
	@echo "  changelog            Show the last three change log entries"
	@echo ""

default: help

set_env:
	bin/prepare_environment.sh --create sandbox

build_image:
ifeq ("$(FLAVOR)", "devel")
	$(eval BUILD_OPTS:=--nopull)
ifdef SALT_REPO
	tar --exclude=.git --exclude=.cache --exclude="*.pyc" -cvzf docker/salt.archive -C $(SALT_REPO) .
else
	curl https://codeload.github.com/saltstack/salt/zip/develop > docker/develop.zip
	rm -rf docker/salt.archive
	unzip docker/develop.zip -d docker
	rm -rf docker/develop.zip
	tar -cvzf docker/salt.archive -C docker/salt-develop .
	rm -rf docker/salt-develop
	rm -rf docker/salt.archive
endif
endif
	VERSION=$(VERSION) FLAVOR=$(FLAVOR) sandbox/bin/python -m build $(BUILD_OPTS)

install_salt_sources:
	VERSION=$(VERSION) bin/install_salt_sources.sh

fixtures:
	ln -s $(TOASTER_MOUNTPOINT)/conftest.py.source $(ROOT_MOUNTPOINT)/conftest.py

setup: install_salt_sources fixtures

shell: setup
	/bin/bash

salt_master: install_salt_sources
	salt-master -l debug

salt_minion: install_salt_sources
	salt-minion -l debug

salt_unit_tests: setup
	py.test -c $(TOASTER_MOUNTPOINT)/unittests.cfg $(SALT_TESTS)

salt_integration: setup
	py.test -c $(TOASTER_MOUNTPOINT)/integration_tests.cfg $(SALT_TESTS)
<commit_msg>Rebuild the products image before building the devel<commit_after>DEFAULT_REGISTRY      = registry.mgr.suse.de
DEFAULT_VERSION       = sles12sp1
DEFAULT_FLAVOR        = products
TOASTER_MOUNTPOINT    = /salt-toaster
ROOT_MOUNTPOINT       = /salt/src
SALT_REPO_MOUNTPOINT  = $(ROOT_MOUNTPOINT)/salt-devel
SALT_TESTS            = $(ROOT_MOUNTPOINT)/salt-*/tests
DOCKER_VOLUMES        = -v "$(CURDIR)/:$(TOASTER_MOUNTPOINT)"
EXPORTS += \
	-e "SALT_TESTS=$(SALT_TESTS)" \
	-e "TOASTER_MOUNTPOINT=$(TOASTER_MOUNTPOINT)" \
	-e "VERSION=$(VERSION)" \
	-e "FLAVOR=$(FLAVOR)" \
	-e "MINION_VERSION=$(MINION_VERSION)" \
	-e "MINION_FLAVOR=$(MINION_FLAVOR)"


ifndef DOCKER_IMAGE
	ifndef DOCKER_REGISTRY
		DOCKER_REGISTRY = $(DEFAULT_REGISTRY)
	endif
	ifndef VERSION
		VERSION = $(DEFAULT_VERSION)
	endif
	ifndef FLAVOR
		FLAVOR = $(DEFAULT_FLAVOR)
	endif
	DOCKER_IMAGE = $(DOCKER_REGISTRY)/toaster-$(VERSION)-$(FLAVOR)
endif

help:
	@echo "Salt Toaster: an ultimate test suite for Salt."
	@echo
	@echo "Commands:"
	@echo "  set_env              Create environment"
	@echo "  docker_shell         Start Docker shell"
	@echo "  build_image          Build Docker image"
	@echo "  salt_integration     Run Salt integration tests"
	@echo "  custom_integration   Run custom integration tests"
	@echo "  changelog            Show the last three change log entries"
	@echo ""

default: help

set_env:
	bin/prepare_environment.sh --create sandbox

build_image:
ifeq ("$(FLAVOR)", "devel")
	$(eval BUILD_OPTS:=--nopull)
ifdef SALT_REPO
	tar --exclude=.git --exclude=.cache --exclude="*.pyc" -cvzf docker/salt.archive -C $(SALT_REPO) .
else
	curl https://codeload.github.com/saltstack/salt/zip/develop > docker/develop.zip
	rm -rf docker/salt.archive
	unzip docker/develop.zip -d docker
	rm -rf docker/develop.zip
	tar -cvzf docker/salt.archive -C docker/salt-develop .
	rm -rf docker/salt-develop
	rm -rf docker/salt.archive
endif
endif
ifeq ("$(FLAVOR)", "devel")
	VERSION=$(VERSION) FLAVOR=products sandbox/bin/python -m build
endif
	VERSION=$(VERSION) FLAVOR=$(FLAVOR) sandbox/bin/python -m build $(BUILD_OPTS)

install_salt_sources:
	VERSION=$(VERSION) bin/install_salt_sources.sh

fixtures:
	ln -s $(TOASTER_MOUNTPOINT)/conftest.py.source $(ROOT_MOUNTPOINT)/conftest.py

setup: install_salt_sources fixtures

shell: setup
	/bin/bash

salt_master: install_salt_sources
	salt-master -l debug

salt_minion: install_salt_sources
	salt-minion -l debug

salt_unit_tests: setup
	py.test -c $(TOASTER_MOUNTPOINT)/unittests.cfg $(SALT_TESTS)

salt_integration: setup
	py.test -c $(TOASTER_MOUNTPOINT)/integration_tests.cfg $(SALT_TESTS)

{'fraction_non_alphanumeric': 0.11947337394380035, 'fraction_numerical': 0.0011790135586559245, 'mean_word_length': 4.125881168177241, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '149832', 'n_tokens_mistral': 2002, 'n_tokens_neox': 1860, 'n_words': 396}