Hi Alon, I'm getting an error after this patch got merged:
$ make clean install-dev PREFIX="$OVIRT_OUT" JBOSS_HOME="$JBOSS_HOME"
...
if [ "1" != 0 ]; then \
build/python-check.sh; \
fi
build/python-check.sh: line 16: pyflakes: command not found
build/python-check.sh: line 17: pep8: command not found
make[1]: *** [python-validation] Error 1
make[1]: Leaving directory `/home/vszocs/work/ovirt-engine'
make: *** [all-dev] Error 2
I assume "pyflakes" and "pep8" are Python packages, shouldn't
README.developer mention they're required now (?)
I was able to fix my problem by doing:
# yum install python-pip
# pip install pyflakes
# pip install pep8
Vojtech
----- Original Message -----
From: "Alon Bar-Lev" <alonbl(a)redhat.com>
Cc: "Alon Bar-Lev" <alonbl(a)redhat.com>
Sent: Sunday, November 3, 2013 1:39:24 PM
Subject: [Engine-patches] Change in ovirt-engine[master]: packaging: build: perform
python validations during build
Alon Bar-Lev has uploaded a new change for review.
Change subject: packaging: build: perform python validations during build
......................................................................
packaging: build: perform python validations during build
Change-Id: Ie4ee9bf80b8a8a75464338bc047dd16e22f0e63b
Signed-off-by: Alon Bar-Lev <alonbl(a)redhat.com>
---
M .gitignore
M Makefile
A build/python-check.sh.in
M ovirt-engine.spec.in
D packaging/check.sh
5 files changed, 35 insertions(+), 15 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/27/20827/1
diff --git a/.gitignore b/.gitignore
index fb33e33..bc736d2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@
# Files generated from templates
###########################
ovirt-engine.spec
+build/python-check.sh
packaging/bin/engine-prolog.sh
packaging/bin/ovirt-engine-log-setup-event.sh
packaging/bin/pki-common.sh
diff --git a/Makefile b/Makefile
index 6047d31..b6063ad 100644
--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,7 @@
BUILD_DEV=0
BUILD_UT=1
EXTRA_BUILD_FLAGS=
+BUILD_PYTHON_VALIDATION=1
DEV_REBUILD=1
DEV_BUILD_GWT_DRAFT=0
DEV_EXTRA_BUILD_FLAGS=
@@ -41,6 +42,8 @@
MVN=mvn
RPMBUILD=rpmbuild
PYTHON=python
+PYFLAKES=pyflakes
+PEP8=pep8
PREFIX=/usr/local
LOCALSTATE_DIR=$(PREFIX)/var
BIN_DIR=$(PREFIX)/bin
@@ -147,11 +150,14 @@
-e "s|@PACKAGE_VERSION@|$(PACKAGE_VERSION)|g" \
-e "s|@DISPLAY_VERSION@|$(DISPLAY_VERSION)|g" \
-e "s|@JBOSS_HOME@|$(JBOSS_HOME)|g" \
+ -e "s|@PEP8@|$(PEP8)|g" \
+ -e "s|@PYFLAKES@|$(PYFLAKES)|g" \
$< > $@
# List of files that will be generated from templates:
GENERATED = \
ovirt-engine.spec \
+ build/python-check.sh \
packaging/bin/engine-prolog.sh \
packaging/bin/ovirt-engine-log-setup-event.sh \
packaging/bin/pki-common.sh \
@@ -184,11 +190,13 @@
all: \
generated-files \
+ python-validation \
dbscripts-validations \
$(BUILD_FILE) \
$(NULL)
generated-files: $(GENERATED)
+ chmod a+x build/python-check.sh
chmod a+x packaging/services/ovirt-engine/ovirt-engine.sysv
chmod a+x
packaging/services/ovirt-engine-notifier/ovirt-engine-notifier.sysv
chmod a+x
packaging/services/ovirt-websocket-proxy/ovirt-websocket-proxy.sysv
@@ -300,6 +308,11 @@
[ -x "$(SOURCEDIR)/$${f}" ] && MASK=0755 || MASK=0644; \
install -m "$${MASK}" "$(SOURCEDIR)/$${f}" "$$(dirname
"$(TARGETDIR)/$${f}")"; \
done
+
+python-validation:
+ if [ "$(BUILD_PYTHON_VALIDATION)" != 0 ]; then \
+ build/python-check.sh; \
+ fi
dbscripts-validations:
test/dbscripts/check_for_duplicate_upgrade_scripts.sh
@@ -417,6 +430,7 @@
$(MAKE) \
install \
BUILD_DEV=1 \
+ BUILD_PYTHON_VALIDATION=0 \
PYTHON_DIR="$(PREFIX)$(PYTHON_SYS_DIR)" \
$(NULL)
diff --git a/build/python-check.sh.in b/build/python-check.sh.in
new file mode 100755
index 0000000..d13c820
--- /dev/null
+++ b/build/python-check.sh.in
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+PEP8="@PEP8@"
+PYFLAKES="@PYFLAKES@"
+SRCDIR="$(dirname "$0")/.."
+
+cd "${SRCDIR}"
+
+ret=0
+FILES="$(
+ find build packaging -name '*.py' | while read f; do
+ [ -e "${f}.in" ] || echo "${f}"
+ done
+)"
+
+"${PYFLAKES}" ${FILES} || ret=1
+"${PEP8}" ${FILES} || ret=1
+
+exit ${ret}
diff --git a/ovirt-engine.spec.in b/ovirt-engine.spec.in
index af2a9c9..c06faf2 100644
--- a/ovirt-engine.spec.in
+++ b/ovirt-engine.spec.in
@@ -110,6 +110,7 @@
BUILD_GWT=%{ovirt_build_gwt} \\\
BUILD_LOCALES=%{ovirt_build_locales} \\\
BUILD_UT=%{ovirt_build_ut} \\\
+ BUILD_PYTHON_VALIDATION=0 \\\
PACKAGE_NAME=%{name} \\\
RPM_VERSION=%{version} \\\
RPM_RELEASE=%{release} \\\
diff --git a/packaging/check.sh b/packaging/check.sh
deleted file mode 100755
index ef6e0d6..0000000
--- a/packaging/check.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-BASE="$(dirname "$0")"
-
-FILES="$(
- find "${BASE}" -name '*.py' | while read f; do
- [ -e "${f}.in" ] || echo "${f}"
- done
-)"
-
-ret=0
-pyflakes ${FILES} || ret=1
-pep8 ${FILES} || ret=1
-
-exit "${ret}"
--
To view, visit
http://gerrit.ovirt.org/20827
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4ee9bf80b8a8a75464338bc047dd16e22f0e63b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alonbl(a)redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches