From 90f9d83931a9b74bed7ddfe8c27dd4581f080b26 Mon Sep 17 00:00:00 2001 From: Scott J Dickerson Date: Fri, 6 Sep 2019 12:37:26 -0400 Subject: [PATCH] Update build to use yarn from ovirt-engine-nodejs-modules Now that version 2.0.2 of ovirt-engine-nodejs-modules has yarn embedded, there is no need to use the ovirt-engine-yarn during the build process. - Removed references to ovirt-engine-yarn in build scripts, documentation and error messages - Use `make rpm` and `make snapshot-rpm` targets instead of patching configure.ac on the fly for snapshot builds - make ovirt-web-ui target prints versions for `node` and `yarn` that will be used for the build - until ovirt-engine-nodejs-modules has an executable for yarn, patch in the yarn-*.js from nodejs-modules to do the job --- DEVELOPERS.md | 8 ++++---- Makefile.am | 4 +++- automation/build.packages.force | 1 - automation/build.repos | 1 - automation/build.sh | 29 ++++++++++++----------------- configure.ac | 4 +--- ovirt-web-ui.spec.in | 15 ++++----------- 7 files changed, 24 insertions(+), 38 deletions(-) diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 0b51caa87..ac7feac72 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -24,13 +24,13 @@ Please report bugs and feature requests to the [GitHub issue tracker](https://gi #### ovirt-engine packages -Install `ovirt-engine-nodejs`, `ovirt-engine-nodejs-modules` and `ovirt-engine-yarn` -from the `ovirt/tested` yum repo for your platform to use the same packages that will -be used by CI to build the app. (See [BZ 1427045](https://bugzilla.redhat.com/show_bug.cgi?id=1427045)) +Install `ovirt-engine-nodejs`, `ovirt-engine-nodejs-modules` from the `ovirt/tested` +yum repo for your platform to use the same packages that will be used by CI to build +the app. (See [BZ 1427045](https://bugzilla.redhat.com/show_bug.cgi?id=1427045)) REPO=fc28 # or the appropriate release and version for you dnf config-manager --add-repo http://resources.ovirt.org/repos/ovirt/tested/master/rpm/$REPO - dnf install ovirt-engine-nodejs ovirt-engine-nodejs-modules ovirt-engine-yarn + dnf install ovirt-engine-nodejs ovirt-engine-nodejs-modules To set PATH and the project's `node_modules` directory based on yarn offline cache and use these packages for development or building use: diff --git a/Makefile.am b/Makefile.am index 3dd04bc5b..65fa8b829 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,7 +69,7 @@ rpm: srpm @echo snapshot-rpm: - make rpm RELEASE_SUFFIX=".$$(date --utc +%Y%m%d).git$$(git rev-parse --short HEAD)" + make rpm RELEASE_SUFFIX=".$$(date --utc +%Y%m%d).git$$(git log --no-merges -1 --pretty=format:%h)" publish: mkdir -p $(OVIRT_CACHE_DIR) @@ -84,6 +84,8 @@ distclean-local: all: ovirt-web-ui ovirt-web-ui: + node --version + $(YARN) --version $(YARN) run build cp -rpv packaging/* build/ mv build/static build/index.jsp build/ovirt-web-ui.config build/ovirt-web-ui.war/ diff --git a/automation/build.packages.force b/automation/build.packages.force index c7ea88498..7968985ee 100644 --- a/automation/build.packages.force +++ b/automation/build.packages.force @@ -1,3 +1,2 @@ ovirt-engine-nodejs ovirt-engine-nodejs-modules -ovirt-engine-yarn diff --git a/automation/build.repos b/automation/build.repos index 7065e18b9..1d679d4d3 100644 --- a/automation/build.repos +++ b/automation/build.repos @@ -1,3 +1,2 @@ ovirt-engine-nodejs_master,http://jenkins.ovirt.org/job/ovirt-engine-nodejs_master_build-artifacts-$distro-x86_64/lastSuccessfulBuild/artifact/exported-artifacts/ ovirt-engine-nodejs-modules_master,https://jenkins.ovirt.org/job/ovirt-engine-nodejs-modules_standard-on-merge/lastSuccessfulBuild/artifact/build-artifacts.$distro.x86_64 -ovirt-engine-yarn_master,http://jenkins.ovirt.org/job/ovirt-engine-yarn_master_build-artifacts-$distro-x86_64/lastSuccessfulBuild/artifact/exported-artifacts/ \ No newline at end of file diff --git a/automation/build.sh b/automation/build.sh index a1addfbfa..6e215ca3c 100755 --- a/automation/build.sh +++ b/automation/build.sh @@ -16,31 +16,26 @@ rm -f ./*tar.gz # Resolve the release version (is this a snapshot build?) version_release="$(grep -m1 VERSION_RELEASE configure.ac | cut -d ' ' -f2 | sed 's/[][)]//g')" -if [[ "${version_release}" == "0" ]]; then - date="$(date --utc +%Y%m%d)" - commit="$(git log --no-merges -1 --pretty=format:%h)" - version_release="0.${date}git${commit}" - # update configure.ac with this - sed -i -r "s/define\(\[VERSION_RELEASE\], \[0\]\)/define([VERSION_RELEASE], [${version_release}])/" configure.ac -fi - -# The "build.packages.force" file contains BuildRequires packages -# to be installed using their latest version. -# When reading the file, make sure to remove blank lines as well -# as lines starting with the "#" character: -build_requires="$(sed -e '/^[ \t]*$/d' -e '/^#/d' -e 's/^/BuildRequires: /' < \ - automation/build.packages.force | \ - sed ':a;N;$!ba;s/\n/\\n/g')" # Force CI to get the latest version of these packages: dependencies="$(sed -e '/^[ \t]*$/d' -e '/^#/d' automation/build.packages.force)" ${PACKAGER} clean metadata ${PACKAGER} -y install ${dependencies} -export PATH="/usr/share/ovirt-engine-nodejs/bin:/usr/share/ovirt-engine-yarn/bin:${PATH}" +export PATH="/usr/share/ovirt-engine-nodejs/bin:/usr/share/ovirt-engine-nodejs-modules/bin:${PATH}" + +# if yarn is not available, patch in the yarn-*.js from nodejs-modules +# (really only necessary until nodejs-modules makes a yarn executable available) +if [[ "$(type -t yarn)" == "" ]]; then + export YARN="node $(find /usr/share/ovirt-engine-nodejs-modules -maxdepth 1 -name 'yarn-*.js')" +fi ./autogen.sh --prefix=/usr --datarootdir=/share -make rpm +if [[ "${version_release}" == "0" ]]; then + make snapshot-rpm +else + make rpm +fi # Store any relevant artifacts in exported-artifacts for the ci system to # archive diff --git a/configure.ac b/configure.ac index 498b5b61e..9797031f4 100644 --- a/configure.ac +++ b/configure.ac @@ -33,11 +33,9 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax]) AC_ARG_VAR([RPMBUILD], [path to rpmbuild utility]) AC_CHECK_PROGS([RPMBUILD], [rpmbuild]) -echo ${PATH} AC_ARG_VAR([YARN], [path to yarn utility]) AC_CHECK_PROGS([YARN], [yarn]) - -test -z "${YARN}" && AC_MSG_ERROR([YARN program not found (install ovirt-engine-yarn, ovirt-engine-nodejs-modules, ovirt-engine-nodejs]) +test -z "${YARN}" && AC_MSG_ERROR([YARN program not found (install ovirt-engine-nodejs, ovirt-engine-nodejs-modules]) AC_CONFIG_FILES([ Makefile diff --git a/ovirt-web-ui.spec.in b/ovirt-web-ui.spec.in index 07eae5c7d..87a7c9cfa 100644 --- a/ovirt-web-ui.spec.in +++ b/ovirt-web-ui.spec.in @@ -16,32 +16,25 @@ Source0: https://github.com/oVirt/ovirt-web-ui/archive/%{source_basename} BuildArch: noarch -# Keep ovirt-engine-{nodejs|nodejs-modules|yarn} at particular version unless tested on higher +# Keep ovirt-engine-{nodejs|nodejs-modules} at particular version unless tested on higher BuildRequires: ovirt-engine-nodejs = 8.11.4 -BuildRequires: ovirt-engine-yarn = 1.7.0 - -BuildRequires: ovirt-engine-nodejs-modules >= 2.0.1 +BuildRequires: ovirt-engine-nodejs-modules >= 2.0.2 %description This package provides the VM Portal for %{product}. %prep -# Use the ovirt-engine nodejs installation -# export PATH="%{_datadir}/ovirt-engine-nodejs/bin:${PATH}" - %setup -q -n"%{source_basename}-%{version}" rpm -qa | grep ovirt-engine-nodejs echo "=== Workaround: 'yarn check' is recently failing on requiring webpack >= v2. Manually" echo "=== verified that this is ok for recent code base but may be a real failure in the" echo "=== future. Please watch carefully for other potential types of errors." -export IGNORE_YARN_CHECK=1 -source /usr/share/ovirt-engine-nodejs-modules/setup-env.sh +IGNORE_YARN_CHECK=1 source /usr/share/ovirt-engine-nodejs-modules/setup-env.sh %build -export PATH="%{_datadir}/ovirt-engine-nodejs/bin:%{_datadir}/ovirt-engine-yarn/bin:${PATH}" +export PATH="%{_datadir}/ovirt-engine-nodejs/bin:%{_datadir}/ovirt-engine-nodejs-modules/bin:${PATH}" %configure -export PATH="./node_modules/.bin:${PATH}" make %install