2013-06-15 12:10:11 +04:00
PYTHON = python
SITELIB = $( shell $( PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" )
2014-04-29 19:19:14 +04:00
OFFICIAL ?= no
2014-01-07 23:14:07 +04:00
PACKER ?= packer
2014-03-19 19:29:02 +04:00
GRUNT ?= $( shell [ -t 0 ] && echo "grunt" || echo "grunt --no-color" )
2015-02-07 00:52:41 +03:00
BROCCOLI ?= ./node_modules/.bin/broccoli
2015-02-09 22:29:48 +03:00
NODE ?= node
2015-08-31 19:01:15 +03:00
DEPS_SCRIPT ?= packaging/offline/deps.py
2015-08-11 23:04:36 +03:00
AW_REPO_URL ?= "http://releases.ansible.com/ansible-tower"
2013-06-24 21:03:33 +04:00
# Get the branch information from git
GIT_DATE := $( shell git log -n 1 --format= "%ai" )
2013-06-26 03:46:12 +04:00
DATE := $( shell date -u +%Y%m%d%H%M)
2013-06-24 21:03:33 +04:00
2014-10-17 17:01:45 +04:00
NAME = ansible-tower
VERSION = $( shell $( PYTHON) -c "from awx import __version__; print(__version__.split('-')[0])" )
GIT_REMOTE_URL = $( shell git config --get remote.origin.url)
2014-10-28 22:20:33 +03:00
BUILD = 0.git$( DATE)
i f e q ( $( OFFICIAL ) , y e s )
RELEASE ?= 1
e l s e
RELEASE ?= $( BUILD)
e n d i f
2014-01-28 18:58:44 +04:00
2014-02-03 22:22:58 +04:00
# Allow AMI license customization
2015-04-24 17:44:22 +03:00
AWS_INSTANCE_COUNT ?= 0
2014-01-28 18:58:44 +04:00
2015-05-26 18:03:36 +03:00
# GPG signature parameters (BETA key not yet used)
GPG_RELEASE = 442667A9
GPG_BETA = D7B00447
GPG_RELEASE_FILE = RPM-GPG-KEY-ansible-release
GPG_BETA_FILE = RPM-GPG-KEY-ansible-beta
# Determine GPG key for RPM signing
i f e q ( $( OFFICIAL ) , y e s )
GPG_KEY = $( GPG_RELEASE)
GPG_FILE = $( GPG_RELEASE_FILE)
e n d i f
2014-10-17 17:01:45 +04:00
# TAR build parameters
2015-05-26 18:03:36 +03:00
i f e q ( $( OFFICIAL ) , y e s )
2014-10-17 17:01:45 +04:00
SETUP_TAR_NAME = $( NAME) -setup-$( VERSION)
SDIST_TAR_NAME = $( NAME) -$( VERSION)
2014-12-02 19:29:49 +03:00
PACKER_BUILD_OPTS = -var-file= vars-release.json
2015-05-26 18:03:36 +03:00
e l s e
SETUP_TAR_NAME = $( NAME) -setup-$( VERSION) -$( BUILD)
SDIST_TAR_NAME = $( NAME) -$( VERSION) -$( BUILD)
PACKER_BUILD_OPTS = -var-file= vars-nightly.json
2013-06-24 21:03:33 +04:00
e n d i f
2014-10-17 17:01:45 +04:00
SDIST_TAR_FILE = $( SDIST_TAR_NAME) .tar.gz
2014-10-28 22:20:33 +03:00
SETUP_TAR_FILE = $( SETUP_TAR_NAME) .tar.gz
2014-11-18 17:31:43 +03:00
SETUP_TAR_LINK = $( NAME) -setup-latest.tar.gz
2014-10-17 17:01:45 +04:00
# DEB build parameters
DEBUILD_BIN ?= debuild
DEBUILD_OPTS = --source-option= "-I"
DPUT_BIN ?= dput
DPUT_OPTS ?=
i f e q ( $( OFFICIAL ) , y e s )
DEB_DIST ?= stable
# Sign OFFICIAL builds using 'DEBSIGN_KEYID'
# DEBSIGN_KEYID is required when signing
ifneq ( $( DEBSIGN_KEYID) ,)
DEBUILD_OPTS += -k$( DEBSIGN_KEYID)
endif
e l s e
DEB_DIST ?= unstable
# Do not sign development builds
DEBUILD_OPTS += -uc -us
DPUT_OPTS += -u
e n d i f
DEBUILD = $( DEBUILD_BIN) $( DEBUILD_OPTS)
DEB_PPA ?= reprepro
2015-08-26 18:49:09 +03:00
DEB_ARCH ?= amd64
2014-10-17 17:01:45 +04:00
# RPM build parameters
RPM_SPECDIR = packaging/rpm
RPM_SPEC = $( RPM_SPECDIR) /$( NAME) .spec
2014-10-21 23:50:24 +04:00
RPM_DIST ?= $( shell rpm --eval '%{?dist}' 2>/dev/null)
2015-08-26 18:49:09 +03:00
RPM_ARCH ?= $( shell rpm --eval '%{_arch}' 2>/dev/null)
2014-10-28 22:20:33 +03:00
RPM_NVR = $( NAME) -$( VERSION) -$( RELEASE) $( RPM_DIST)
2014-05-09 16:59:02 +04:00
MOCK_BIN ?= mock
MOCK_CFG ?=
2015-08-20 17:25:34 +03:00
# Offline TAR build parameters
2015-08-31 20:16:59 +03:00
DIST = $( shell echo $( RPM_DIST) | sed -e 's|^\.\(el\)\([0-9]\).*|\1|' )
DIST_MAJOR = $( shell echo $( RPM_DIST) | sed -e 's|^\.\(el\)\([0-9]\).*|\2|' )
2015-08-31 19:01:15 +03:00
DIST_FULL = $( DIST) $( DIST_MAJOR)
OFFLINE_TAR_NAME = $( NAME) -offline-$( DIST_FULL) -$( VERSION) -$( RELEASE)
OFFLINE_TAR_FILE = $( OFFLINE_TAR_NAME) .tar.gz
2015-09-01 03:43:44 +03:00
OFFLINE_TAR_LINK = $( NAME) -offline-$( DIST_FULL) -latest.tar.gz
2015-08-20 17:25:34 +03:00
2015-08-27 18:18:38 +03:00
DISTRO := $( shell . /etc/os-release 2>/dev/null && echo $$ { ID} || echo redhat)
2015-08-26 23:15:07 +03:00
i f e q ( $( DISTRO ) , u b u n t u )
SETUP_INSTALL_ARGS = --skip-build --no-compile --root= $( DESTDIR) -v --install-layout= deb
e l s e
SETUP_INSTALL_ARGS = --skip-build --no-compile --root= $( DESTDIR) -v
e n d i f
.DEFAULT_GOAL := build
2015-08-11 23:54:52 +03:00
.PHONY : clean rebase push requirements requirements_dev requirements_jenkins \
real-requirements real-requirements_dev real-requirements_jenkins \
2014-10-02 21:26:32 +04:00
develop refresh adduser syncdb migrate dbchange dbshell runserver celeryd \
2015-01-29 21:31:55 +03:00
receiver test test_coverage coverage_html ui_analysis_report test_ui test_jenkins dev_build \
2015-05-26 18:03:36 +03:00
release_build release_clean sdist rpmtar mock-rpm mock-srpm rpm-sign \
2015-08-11 23:04:36 +03:00
devjs minjs testjs testjs_ci node-tests browser-tests jshint ngdocs sync_ui \
deb deb-src debian reprepro setup_tarball \
virtualbox-ovf virtualbox-centos-7 virtualbox-centos-6 \
clean-offline setup_offline_tarball
2014-10-28 22:20:33 +03:00
# Remove setup build files
clean-tar :
rm -rf tar-build
2013-06-20 23:53:10 +04:00
2014-10-23 00:41:24 +04:00
# Remove rpm build files
clean-rpm :
rm -rf rpm-build
# Remove debian build files
clean-deb :
rm -rf deb-build reprepro
# Remove grunt build files
clean-grunt :
2015-02-05 23:27:16 +03:00
rm -f package.json Gruntfile.js Brocfile.js bower.json
2014-10-23 00:41:24 +04:00
rm -rf node_modules
# Remove UI build files
clean-ui :
2015-03-03 00:55:51 +03:00
rm -rf awx/ui/static/dist
2015-02-27 19:21:32 +03:00
rm -rf awx/ui/dist
2014-08-28 20:12:04 +04:00
rm -rf awx/ui/static/docs
2014-10-23 00:41:24 +04:00
2015-04-24 17:44:22 +03:00
# Remove packer artifacts
clean-packer :
rm -rf packer_cache
rm -rf packaging/packer/packer_cache
rm -rf packaging/packer/output-virtualbox-iso/
rm -f packaging/packer/ansible-tower-*.box
rm -rf packaging/packer/ansible-tower*-ova
rm -f Vagrantfile
2015-08-11 23:04:36 +03:00
clean-offline :
2015-08-31 19:01:15 +03:00
rm -rf offline-tar-build
2015-08-11 23:04:36 +03:00
2014-10-23 00:41:24 +04:00
# Remove temporary build files, compiled Python files.
2015-08-11 23:04:36 +03:00
clean : clean -rpm clean -deb clean -grunt clean -ui clean -tar clean -packer clean -offline
2015-08-10 18:02:51 +03:00
rm -rf awx/lib/site-packages
2014-10-23 00:41:24 +04:00
rm -rf dist/*
rm -rf build $( NAME) -$( VERSION) *.egg-info
2013-03-13 21:09:36 +04:00
find . -type f -regex " .*\.py[co] $$ " -delete
2013-06-20 23:53:10 +04:00
# Fetch from origin, rebase local commits on top of origin commits.
2013-03-13 23:28:30 +04:00
rebase :
git pull --rebase origin master
2013-06-20 23:53:10 +04:00
# Push changes to origin.
2013-03-14 00:06:19 +04:00
push :
2013-06-20 23:53:10 +04:00
git push origin master
2013-03-13 23:15:35 +04:00
2015-08-11 23:54:52 +03:00
# Install runtime, development and jenkins requirements
2015-08-26 18:49:09 +03:00
requirements requirements_dev requirements_jenkins : %: real -%
2015-08-11 23:54:52 +03:00
2015-08-05 15:10:16 +03:00
# Install third-party requirements needed for development environment.
2015-08-26 18:49:09 +03:00
# NOTE:
# * --target is only supported on newer versions of pip
# * https://github.com/pypa/pip/issues/3056 - the workaround is to override the `install-platlib`
# * --user (in conjunction with PYTHONUSERBASE="awx" may be a better option
2015-09-02 15:23:11 +03:00
# * --target implies --ignore-installed
2015-08-11 23:54:52 +03:00
real-requirements :
2015-09-02 15:23:11 +03:00
pip install -r requirements/requirements.txt --target awx/lib/site-packages/ --install-option= " --install-platlib=\$ $base /lib/python "
2013-06-20 23:53:10 +04:00
2015-09-02 15:23:11 +03:00
real-requirements_dev :
pip install -r requirements/requirements_dev.txt --target awx/lib/site-packages/ --install-option= " --install-platlib=\$ $base /lib/python "
2013-06-20 23:53:10 +04:00
2014-09-10 23:25:29 +04:00
# Install third-party requirements needed for running unittests in jenkins
2015-09-02 15:23:11 +03:00
real-requirements_jenkins :
2015-08-11 23:54:52 +03:00
pip install -r requirements/requirements_jenkins.txt
2015-03-10 19:36:33 +03:00
npm install csslint jshint
2014-09-10 23:25:29 +04:00
2015-08-05 15:10:16 +03:00
# "Install" ansible-tower package in development mode.
2013-05-25 01:55:03 +04:00
develop :
2013-09-25 05:40:53 +04:00
@if [ " $( VIRTUAL_ENV) " ] ; then \
2014-01-29 22:49:29 +04:00
pip uninstall -y awx; \
2013-09-25 05:40:53 +04:00
$( PYTHON) setup.py develop; \
else \
2014-01-29 22:49:29 +04:00
sudo pip uninstall -y awx; \
2013-09-25 05:40:53 +04:00
sudo $( PYTHON) setup.py develop; \
2014-11-11 23:18:39 +03:00
fi
2015-08-05 15:10:16 +03:00
version_file :
mkdir -p /var/lib/awx/
python -c "import awx as awx; print awx.__version__" > /var/lib/awx/.tower_version
2014-11-11 23:18:39 +03:00
# Do any one-time init tasks.
init :
@if [ " $( VIRTUAL_ENV) " ] ; then \
2014-12-02 20:20:03 +03:00
awx-manage register_instance --primary --hostname= 127.0.0.1; \
2014-11-11 23:18:39 +03:00
else \
2014-12-02 20:20:03 +03:00
sudo awx-manage register_instance --primary --hostname= 127.0.0.1; \
2013-09-25 05:40:53 +04:00
fi
2013-05-25 01:55:03 +04:00
2013-06-20 23:53:10 +04:00
# Refresh development environment after pulling new code.
2015-08-05 15:10:16 +03:00
refresh : clean requirements_dev version_file develop migrate
2013-05-22 01:39:34 +04:00
2013-06-20 23:53:10 +04:00
# Create Django superuser.
2013-03-14 01:20:50 +04:00
adduser :
2013-09-25 05:40:53 +04:00
$( PYTHON) manage.py createsuperuser
2013-03-14 01:20:50 +04:00
2013-06-20 23:53:10 +04:00
# Create initial database tables (excluding migrations).
2013-03-01 04:52:14 +04:00
syncdb :
2013-09-25 05:40:53 +04:00
$( PYTHON) manage.py syncdb --noinput
2013-03-01 04:52:14 +04:00
2013-06-20 23:53:10 +04:00
# Create database tables and apply any new migrations.
2013-05-22 01:39:34 +04:00
migrate : syncdb
2013-09-25 05:40:53 +04:00
$( PYTHON) manage.py migrate --noinput
2013-03-13 23:15:35 +04:00
2013-06-20 23:53:10 +04:00
# Run after making changes to the models to create a new migration.
dbchange :
2013-09-25 05:40:53 +04:00
$( PYTHON) manage.py schemamigration main v14_changes --auto
2013-06-20 23:53:10 +04:00
2013-06-23 21:21:02 +04:00
# access database shell, asks for password
2013-03-13 23:15:35 +04:00
dbshell :
2013-12-21 03:16:52 +04:00
sudo -u postgres psql -d awx-dev
2013-03-01 04:52:14 +04:00
2014-05-02 23:26:05 +04:00
server_noattach :
2014-03-19 21:51:48 +04:00
tmux new-session -d -s tower 'exec make runserver'
tmux rename-window 'Tower'
tmux select -window -t tower:0
tmux split-window -v 'exec make celeryd'
tmux split-window -h 'exec make taskmanager'
2015-04-23 20:34:56 +03:00
tmux new-window 'exec make receiver'
tmux select -window -t tower:1
tmux rename-window 'Extra Services'
tmux split-window -v 'exec make socketservice'
tmux split-window -h 'exec make factcacher'
2014-05-02 23:26:05 +04:00
server : server_noattach
2014-03-19 21:51:48 +04:00
tmux -2 attach-session -t tower
2015-02-13 18:30:01 +03:00
# Use with iterm2's native tmux protocol support
2015-02-10 20:34:52 +03:00
servercc : server_noattach
tmux -2 -CC attach-session -t tower
2013-06-20 23:53:10 +04:00
# Run the built-in development webserver (by default on http://localhost:8013).
runserver :
2013-09-25 05:40:53 +04:00
$( PYTHON) manage.py runserver
2013-06-20 23:53:10 +04:00
# Run to start the background celery worker for development.
celeryd :
2014-02-04 02:04:56 +04:00
$( PYTHON) manage.py celeryd -l DEBUG -B --autoscale= 20,2 -Ofair
2013-06-20 23:53:10 +04:00
2014-02-19 00:16:39 +04:00
# Run to start the zeromq callback receiver
receiver :
$( PYTHON) manage.py run_callback_receiver
2014-03-12 22:09:00 +04:00
taskmanager :
$( PYTHON) manage.py run_task_system
2014-04-16 23:26:52 +04:00
socketservice :
$( PYTHON) manage.py run_socketio_service
2015-04-23 20:34:56 +03:00
factcacher :
$( PYTHON) manage.py run_fact_cache_receiver
2015-05-20 22:26:44 +03:00
reports :
mkdir -p $@
2014-04-23 21:55:09 +04:00
2015-05-20 22:26:44 +03:00
pep8 : reports
@( set -o pipefail && $@ | tee reports/$@ .report)
2014-04-23 21:55:09 +04:00
2015-05-20 22:26:44 +03:00
flake8 : reports
@$@ --output-file= reports/$@ .report
pyflakes : reports
@( set -o pipefail && $@ | tee reports/$@ .report)
pylint : reports
@( set -o pipefail && $@ | reports/$@ .report)
check : flake 8 pep 8 # pyflakes pylint
2015-02-05 18:40:22 +03:00
2013-09-25 05:40:53 +04:00
# Run all API unit tests.
2013-03-01 04:52:14 +04:00
test :
2014-09-10 21:17:35 +04:00
$( PYTHON) manage.py test -v2 awx.main.tests
2013-05-22 01:39:34 +04:00
2013-09-25 05:40:53 +04:00
# Run all API unit tests with coverage enabled.
2013-05-22 03:08:46 +04:00
test_coverage :
2014-09-10 21:17:35 +04:00
coverage run manage.py test -v2 awx.main.tests
2013-05-22 03:08:46 +04:00
2013-06-20 23:53:10 +04:00
# Output test coverage as HTML (into htmlcov directory).
2013-05-22 03:08:46 +04:00
coverage_html :
coverage html
2015-03-31 22:01:19 +03:00
ui_analysis_report : reports /ui_code node_modules Gruntfile .js
2015-01-29 21:31:55 +03:00
$( GRUNT) plato:report
2015-03-31 22:01:19 +03:00
reports/ui_code : node_modules clean -ui Brocfile .js bower .json Gruntfile .js
rm -rf reports/ui_code
2015-04-22 22:15:28 +03:00
$( BROCCOLI) build reports/ui_code -- --no-concat --no-tests --no-styles --no-sourcemaps
2015-03-31 22:01:19 +03:00
2015-01-29 20:06:17 +03:00
# Run UI unit tests
2015-02-11 18:15:32 +03:00
test_ui : node_modules minjs_ci Gruntfile .js
2015-01-29 20:06:17 +03:00
$( GRUNT) karma:ci
2013-09-25 05:40:53 +04:00
# Run API unit tests across multiple Python/Django versions with Tox.
test_tox :
tox -v
# Run unit tests to produce output for Jenkins.
test_jenkins :
2014-10-02 21:26:32 +04:00
$( PYTHON) manage.py jenkins -v2 --enable-coverage --project-apps-tests
2013-09-25 05:40:53 +04:00
2015-02-11 18:15:32 +03:00
Gruntfile.js : packaging /grunt /Gruntfile .js
cp $< $@
2014-07-07 17:41:44 +04:00
2015-02-11 18:15:32 +03:00
Brocfile.js : packaging /grunt /Brocfile .js
cp $< $@
2015-02-05 23:27:16 +03:00
2015-02-11 18:15:32 +03:00
bower.json : packaging /grunt /bower .json
cp $< $@
2014-07-07 17:41:44 +04:00
2015-02-11 18:15:32 +03:00
package.json : packaging /grunt /package .template
sed -e 's#%NAME%#$(NAME)#;s#%VERSION%#$(VERSION)#;s#%GIT_REMOTE_URL%#$(GIT_REMOTE_URL)#;' $< > $@
2014-02-26 17:36:32 +04:00
2015-02-11 18:15:32 +03:00
sync_ui : node_modules Brocfile .js
2015-03-13 18:44:19 +03:00
$( NODE) tools/ui/timepiece.js awx/ui/dist -- --debug
2015-02-09 19:20:48 +03:00
2014-02-17 19:18:33 +04:00
# Update local npm install
2015-02-11 18:15:32 +03:00
node_modules : package .json
2014-02-17 19:18:33 +04:00
npm install
2015-02-11 18:15:32 +03:00
touch $@
2014-02-17 19:18:33 +04:00
2015-02-11 18:15:32 +03:00
devjs : node_modules clean -ui Brocfile .js bower .json Gruntfile .js
2015-02-27 19:21:32 +03:00
$( BROCCOLI) build awx/ui/dist -- --debug
2015-02-11 18:15:32 +03:00
2013-09-25 05:40:53 +04:00
# Build minified JS/CSS.
2015-02-11 18:15:32 +03:00
minjs : node_modules clean -ui Brocfile .js
2015-04-22 22:15:28 +03:00
$( BROCCOLI) build awx/ui/dist -- --silent --no-debug --no-tests --compress --no-docs --no-sourcemaps
2014-02-13 02:19:30 +04:00
2015-02-11 18:15:32 +03:00
minjs_ci : node_modules clean -ui Brocfile .js
2015-03-25 00:27:03 +03:00
$( BROCCOLI) build awx/ui/dist -- --no-debug --compress --no-docs
2015-02-09 17:45:23 +03:00
2014-02-17 19:18:33 +04:00
# Check .js files for errors and lint
2015-02-11 18:15:32 +03:00
jshint : node_modules Gruntfile .js
2014-08-28 20:01:35 +04:00
$( GRUNT) $@
2015-03-25 00:27:03 +03:00
ngdocs : devjs Gruntfile .js
2014-08-28 20:01:35 +04:00
$( GRUNT) $@
2013-09-25 05:40:53 +04:00
2013-06-20 23:53:10 +04:00
# Build a pip-installable package into dist/ with a timestamped version number.
2014-02-17 19:18:33 +04:00
dev_build :
2013-09-25 05:40:53 +04:00
$( PYTHON) setup.py dev_build
2013-05-22 01:39:34 +04:00
2013-06-20 23:53:10 +04:00
# Build a pip-installable package into dist/ with the release version number.
2013-05-22 01:39:34 +04:00
release_build :
2013-09-25 05:40:53 +04:00
$( PYTHON) setup.py release_build
2014-10-28 22:20:33 +03:00
# Build setup tarball
tar-build/$(SETUP_TAR_FILE) :
@mkdir -p tar-build
@cp -a setup tar-build/$( SETUP_TAR_NAME)
@cd tar-build/$( SETUP_TAR_NAME) && sed -e 's#%NAME%#$(NAME)#;s#%VERSION%#$(VERSION)#;s#%RELEASE%#$(RELEASE)#;' group_vars/all.in > group_vars/all
@cd tar-build && tar -czf $( SETUP_TAR_FILE) --exclude "*/all.in" $( SETUP_TAR_NAME) /
2014-11-18 17:31:43 +03:00
@ln -sf $( SETUP_TAR_FILE) tar-build/$( SETUP_TAR_LINK)
2015-08-31 19:01:15 +03:00
setup_tarball : tar -build /$( SETUP_TAR_FILE )
2014-10-17 17:01:45 +04:00
@echo "#############################################"
@echo "Setup artifacts:"
2014-10-28 22:20:33 +03:00
@echo tar-build/$( SETUP_TAR_FILE)
2014-11-18 17:31:43 +03:00
@echo tar-build/$( SETUP_TAR_LINK)
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2013-06-11 01:21:04 +04:00
release_clean :
2013-05-26 19:01:00 +04:00
-( rm *.tar)
2013-06-11 01:21:04 +04:00
-( rm -rf ( $RELEASE ) )
2013-06-15 12:10:11 +04:00
2014-10-17 17:01:45 +04:00
dist/$(SDIST_TAR_FILE) :
2014-10-19 23:05:54 +04:00
BUILD = " $( BUILD) " $( PYTHON) setup.py sdist
2014-05-22 19:25:50 +04:00
2015-08-26 18:49:09 +03:00
sdist : minjs dist /$( SDIST_TAR_FILE )
2013-06-15 12:10:11 +04:00
2015-08-11 23:04:36 +03:00
# Build setup offline tarball
2015-08-31 19:01:15 +03:00
offline-tar-build :
mkdir -p $@
2015-08-11 23:04:36 +03:00
2015-08-31 19:01:15 +03:00
offline-tar-build/$(DIST_FULL) :
mkdir -p $@
# TODO - Somehow share implementation with setup_tarball
offline-tar-build/$(DIST_FULL)/$(OFFLINE_TAR_FILE) :
2015-08-31 20:04:11 +03:00
cp -a setup offline-tar-build/$( DIST_FULL) /$( OFFLINE_TAR_NAME)
cd offline-tar-build/$( DIST_FULL) /$( OFFLINE_TAR_NAME) && sed -e 's#%NAME%#$(NAME)#;s#%VERSION%#$(VERSION)#;s#%RELEASE%#$(RELEASE)#;' group_vars/all.in > group_vars/all
2015-08-31 19:01:15 +03:00
$( PYTHON) $( DEPS_SCRIPT) -d $( DIST) -r $( DIST_MAJOR) -u $( AW_REPO_URL) -s offline-tar-build/$( DIST_FULL) /$( OFFLINE_TAR_NAME) -v -v -v
2015-08-31 20:04:11 +03:00
cd offline-tar-build/$( DIST_FULL) && tar -czf $( OFFLINE_TAR_FILE) --exclude "*/all.in" $( OFFLINE_TAR_NAME) /
ln -sf $( OFFLINE_TAR_FILE) offline-tar-build/$( DIST_FULL) /$( OFFLINE_TAR_LINK)
2015-08-31 19:01:15 +03:00
setup_offline_tarball : offline -tar -build offline -tar -build /$( DIST_FULL ) offline -tar -build /$( DIST_FULL ) /$( OFFLINE_TAR_FILE )
@echo "#############################################"
@echo "Offline artifacts:"
@echo offline-tar-build/$( DIST_FULL) /$( OFFLINE_TAR_FILE)
@echo offline-tar-build/$( DIST_FULL) /$( OFFLINE_TAR_LINK)
@echo "#############################################"
2015-08-11 23:04:36 +03:00
2015-05-26 18:03:36 +03:00
rpm-build :
2015-08-31 19:01:15 +03:00
mkdir -p $@
2015-05-26 18:03:36 +03:00
rpm-build/$(SDIST_TAR_FILE) : rpm -build dist /$( SDIST_TAR_FILE )
2014-10-17 17:01:45 +04:00
cp packaging/rpm/$( NAME) .spec rpm-build/
2014-04-23 21:52:08 +04:00
cp packaging/rpm/$( NAME) .te rpm-build/
2014-11-25 17:22:02 +03:00
cp packaging/rpm/$( NAME) .sysconfig rpm-build/
2014-10-20 23:00:00 +04:00
cp packaging/remove_tower_source.py rpm-build/
2013-06-26 16:10:17 +04:00
if [ " $( OFFICIAL) " != "yes" ] ; then \
2014-10-17 17:01:45 +04:00
( cd dist/ && tar zxf $( SDIST_TAR_FILE) ) ; \
( cd dist/ && mv $( NAME) -$( VERSION) -$( BUILD) $( NAME) -$( VERSION) ) ; \
( cd dist/ && tar czf ../rpm-build/$( SDIST_TAR_FILE) $( NAME) -$( VERSION) ) ; \
ln -sf $( SDIST_TAR_FILE) rpm-build/$( NAME) -$( VERSION) .tar.gz ; \
else \
2014-11-15 00:11:39 +03:00
cp -a dist/$( SDIST_TAR_FILE) rpm-build/ ; \
2013-06-26 16:10:17 +04:00
fi
2014-10-17 17:01:45 +04:00
2014-10-23 00:41:24 +04:00
rpmtar : sdist rpm -build /$( SDIST_TAR_FILE )
2014-10-17 17:01:45 +04:00
rpm-build/$(RPM_NVR).src.rpm : /etc /mock /$( MOCK_CFG ) .cfg
$( MOCK_BIN) -r $( MOCK_CFG) --resultdir rpm-build --buildsrpm --spec rpm-build/$( NAME) .spec --sources rpm-build \
2014-10-28 22:20:33 +03:00
--define " tower_version $( VERSION) " --define " tower_release $( RELEASE) "
2014-10-17 17:01:45 +04:00
@echo "#############################################"
@echo "SRPM artifacts:"
@echo rpm-build/$( RPM_NVR) .src.rpm
@echo "#############################################"
mock-srpm : rpmtar rpm -build /$( RPM_NVR ) .src .rpm
2015-08-26 18:49:09 +03:00
rpm-build/$(RPM_NVR).$(RPM_ARCH).rpm : rpm -build /$( RPM_NVR ) .src .rpm
2014-10-17 17:01:45 +04:00
$( MOCK_BIN) -r $( MOCK_CFG) --resultdir rpm-build --rebuild rpm-build/$( RPM_NVR) .src.rpm \
2014-10-28 22:20:33 +03:00
--define " tower_version $( VERSION) " --define " tower_release $( RELEASE) "
2014-10-17 17:01:45 +04:00
@echo "#############################################"
@echo "RPM artifacts:"
2015-08-26 18:49:09 +03:00
@echo rpm-build/$( RPM_NVR) .$( RPM_ARCH) .rpm
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-08-26 18:49:09 +03:00
mock-rpm : rpmtar rpm -build /$( RPM_NVR ) .$( RPM_ARCH ) .rpm
2014-10-17 17:01:45 +04:00
2015-06-01 22:58:07 +03:00
i f e q ( $( OFFICIAL ) , y e s )
2015-06-08 18:38:50 +03:00
rpm-build/$(GPG_FILE) : rpm -build
gpg --export -a " ${ GPG_KEY } " > " $@ "
2015-05-26 18:03:36 +03:00
2015-08-26 18:49:09 +03:00
rpm-sign : rpm -build /$( GPG_FILE ) rpmtar rpm -build /$( RPM_NVR ) .$( RPM_ARCH ) .rpm
rpm --define "_signature gpg" --define " _gpg_name $( GPG_KEY) " --addsign rpm-build/$( RPM_NVR) .$( RPM_ARCH) .rpm
2015-06-01 22:58:07 +03:00
e n d i f
2015-05-26 18:03:36 +03:00
2014-10-17 17:01:45 +04:00
deb-build/$(SDIST_TAR_NAME) :
mkdir -p deb-build
tar -C deb-build/ -xvf dist/$( SDIST_TAR_FILE)
cp -a packaging/debian deb-build/$( SDIST_TAR_NAME) /
2014-10-20 23:00:00 +04:00
cp packaging/remove_tower_source.py deb-build/$( SDIST_TAR_NAME) /debian/
2014-10-28 22:20:33 +03:00
sed -ie " s#^ $( NAME) (\([^)]*\)) \([^;]*\);# $( NAME) ( $( VERSION) - $( RELEASE) ) $( DEB_DIST) ;# " deb-build/$( SDIST_TAR_NAME) /debian/changelog
2014-10-17 17:01:45 +04:00
debian : sdist deb -build /$( SDIST_TAR_NAME )
2015-08-26 18:49:09 +03:00
deb-build/$(NAME)_$(VERSION)-$(RELEASE)_$(DEB_ARCH).deb :
2014-10-17 17:01:45 +04:00
cd deb-build/$( SDIST_TAR_NAME) && $( DEBUILD) -b
@echo "#############################################"
@echo "DEB artifacts:"
2015-08-26 18:49:09 +03:00
@echo deb-build/$( NAME) _$( VERSION) -$( RELEASE) _$( DEB_ARCH) .deb
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2015-08-26 18:49:09 +03:00
deb : debian deb -build /$( NAME ) _ $( VERSION ) -$( RELEASE ) _ $( DEB_ARCH ) .deb
2014-10-17 17:01:45 +04:00
2014-10-28 22:20:33 +03:00
deb-build/$(NAME)_$(VERSION)-$(RELEASE)_source.changes :
2014-10-17 17:01:45 +04:00
cd deb-build/$( SDIST_TAR_NAME) && $( DEBUILD) -S
@echo "#############################################"
@echo "DEB artifacts:"
2014-10-28 22:20:33 +03:00
@echo deb-build/$( NAME) _$( VERSION) -$( RELEASE) _source.changes
2014-10-17 17:01:45 +04:00
@echo "#############################################"
2014-10-28 22:20:33 +03:00
deb-src : debian deb -build /$( NAME ) _ $( VERSION ) -$( RELEASE ) _source .changes
2014-10-17 17:01:45 +04:00
deb-upload : deb
2015-08-26 18:49:09 +03:00
$( DPUT_BIN) $( DPUT_OPTS) $( DEB_PPA) deb-build/$( NAME) _$( VERSION) -$( RELEASE) _$( DEB_ARCH) .changes ; \
2014-10-17 17:01:45 +04:00
deb-src-upload : deb -src
2014-10-28 22:20:33 +03:00
$( DPUT_BIN) $( DPUT_OPTS) $( DEB_PPA) deb-build/$( NAME) _$( VERSION) -$( RELEASE) _source.changes ; \
2014-10-17 17:01:45 +04:00
reprepro : deb
mkdir -p reprepro/conf
cp -a packaging/reprepro/* reprepro/conf/
2015-08-26 18:49:09 +03:00
@DEB= deb-build/$( NAME) _$( VERSION) -$( RELEASE) _$( DEB_ARCH) .deb ; \
2014-10-17 17:01:45 +04:00
for DIST in trusty precise ; do \
echo " Removing ' $( NAME) ' from the $$ {DIST} apt repo " ; \
echo reprepro --export= force -b reprepro remove $$ { DIST} $( NAME) ; \
done ; \
reprepro --export= force -b reprepro clearvanished; \
for DIST in trusty precise ; do \
echo " Adding $$ {DEB} to the $$ {DIST} apt repo " ; \
reprepro --keepunreferencedfiles --export= force -b reprepro --ignore= brokenold includedeb $$ { DIST} $$ { DEB} ; \
done ; \
2013-06-23 23:40:07 +04:00
2015-04-24 17:44:22 +03:00
amazon-ebs :
cd packaging/packer && $( PACKER) build -only $@ $( PACKER_BUILD_OPTS) -var " aws_instance_count= $( AWS_INSTANCE_COUNT) " -var " product_version= $( VERSION) " packer-$( NAME) .json
virtualbox-ovf : packaging /packer /ansible -tower -$( VERSION ) -virtualbox .box
packaging/packer/ansible-tower-$(VERSION)-virtualbox.box : packaging /packer /output -virtualbox -iso /centos -7.ovf
cd packaging/packer && $( PACKER) build -only virtualbox-ovf $( PACKER_BUILD_OPTS) -var " aws_instance_count= $( AWS_INSTANCE_COUNT) " -var " product_version= $( VERSION) " packer-$( NAME) .json
packaging/packer/output-virtualbox-iso/centos-6.ovf :
cd packaging/packer && $( PACKER) build packer-centos-6.json
virtualbox-centos-6 : packaging /packer /output -virtualbox -iso /centos -6.ovf
packaging/packer/output-virtualbox-iso/centos-7.ovf :
cd packaging/packer && $( PACKER) build packer-centos-7.json
virtualbox-centos-7 : packaging /packer /output -virtualbox -iso /centos -7.ovf
2014-01-07 21:04:25 +04:00
2015-06-08 23:00:18 +03:00
docker-dev :
docker build --no-cache= true --rm= true -t ansible/tower_devel:latest tools/docker
2015-08-26 23:15:07 +03:00
# TODO - figure out how to build the front-end and python requirements with
# 'build'
build :
$( PYTHON) setup.py build
# TODO - only use --install-layout=deb on Debian
2013-06-23 23:40:07 +04:00
install :
2015-08-26 23:15:07 +03:00
$( PYTHON) setup.py install $( SETUP_INSTALL_ARGS)