-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
82 lines (65 loc) · 3.02 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# version now specified in osgbuild/version.py
PYTHON ?= python3
PYTHON := $(shell which $(PYTHON) )
VERSION := $(shell $(PYTHON) -c "import sys; sys.path.insert(0, '.'); from osgbuild import version; sys.stdout.write(version.__version__ + '\n')")
HASH := $(shell git rev-parse HEAD)
NAME = osg-build
NAME_VERSION = $(NAME)-$(VERSION)
PYDIR = osgbuild
TESTDIR = $(PYDIR)/test
SVNDATADIR = data
MAIN_SCRIPT = $(NAME)
EXTRA_SCRIPTS = koji-tag-diff osg-import-srpm osg-koji osg-promote koji-blame osg-sign
TEST_SCRIPT = osg-build-test
MAIN_TEST = $(TESTDIR)/test_osgbuild.py
PYTHON_SITELIB := $(shell $(PYTHON) -c "import sysconfig; print(sysconfig.get_paths()['platlib'])")
BINDIR = /usr/bin
DATADIR = /usr/share/$(NAME)
AFS_SOFTWARE_DIR = /p/vdt/public/html/upstream/$(NAME)
_default:
@echo "Nothing to make. Try make install"
clean:
rm -f *.py[co] *~ $(PYDIR)/*.py[co] $(PYDIR)/*~ $(TESTDIR)/*.py[co] $(TESTDIR)/*~ tags
install-common:
mkdir -p $(DESTDIR)/$(BINDIR)
install -p -m 755 $(MAIN_SCRIPT) $(DESTDIR)/$(BINDIR)
install -p -m 755 $(EXTRA_SCRIPTS) $(DESTDIR)/$(BINDIR)
for file in $(MAIN_SCRIPT) $(EXTRA_SCRIPTS); do \
sed -ri '1s,^#!/usr/bin/env python.*,#!$(PYTHON),' $(DESTDIR)/$(BINDIR)/$$file; \
done
mkdir -p $(DESTDIR)/$(DATADIR)
install -p -m 644 $(SVNDATADIR)/* $(DESTDIR)/$(DATADIR)
install: install-common
mkdir -p $(DESTDIR)/$(PYTHON_SITELIB)/$(PYDIR)
install -p -m 644 $(PYDIR)/*.py $(DESTDIR)/$(PYTHON_SITELIB)/$(PYDIR)
mkdir -p $(DESTDIR)/$(PYTHON_SITELIB)/$(TESTDIR)
install -p -m 755 $(TESTDIR)/*.py $(DESTDIR)/$(PYTHON_SITELIB)/$(TESTDIR)
install -p -m 755 $(TEST_SCRIPT) $(DESTDIR)/$(BINDIR)
sed -ri '1s,^#!/usr/bin/env python.*,#!$(PYTHON),' $(DESTDIR)/$(BINDIR)/$(TEST_SCRIPT)
dist:
mkdir -p $(NAME_VERSION)
cp -rp $(MAIN_SCRIPT) $(EXTRA_SCRIPTS) $(TEST_SCRIPT) $(PYDIR) $(SVNDATADIR) Makefile pylintrc $(NAME_VERSION)/
tar czf $(NAME_VERSION).tar.gz $(NAME_VERSION)/ --exclude='*/.svn*' --exclude='*/*.py[co]' --exclude='*/*~'
check:
pylint -E osg-build osg-promote osg-koji $(PYDIR)/*.py $(TESTDIR)/*.py
test:
pylint -E osg-build osg-promote osg-koji $(PYDIR)/*.py $(TESTDIR)/*.py
$(PYTHON) $(MAIN_TEST) -v TestSuiteAll
$(PYTHON) $(TESTDIR)/test_osgpromote.py
shorttest:
pylint -E osg-build osg-promote osg-koji $(PYDIR)/*.py $(TESTDIR)/*.py
$(PYTHON) $(MAIN_TEST) -v TestSuiteShort
$(PYTHON) $(TESTDIR)/test_osgpromote.py
lint:
-pylint --rcfile=pylintrc osg-build osg-promote osg-koji $(PYDIR)/*.py $(TESTDIR)/*.py
# ignore return code in above
tags:
-ctags -R --exclude='.backup' --exclude='.bak' --exclude='*~' --exclude='.svn' --exclude='_darcs' --exclude='.git' --exclude='CVS' --exclude='.pyc' --exclude='Attic/*' --exclude='data/*' --exclude='doc/*' .
testsource:
mkdir -p upstream
echo "type=git url=. name=osg-build tag=HEAD tarball=$(NAME_VERSION).tar.gz hash=$(HASH)" > upstream/test.source
rpmbuild: testsource
osg-build rpmbuild
kojiscratch: testsource
osg-build koji --scratch --getfiles
.PHONY: _default clean install-common install dist check test shorttest lint tags testsource rpmbuild kojiscratch