Skip to content

Commit

Permalink
Merge pull request #1115 from sjd78/drop-engine-yarn
Browse files Browse the repository at this point in the history
Update build to use yarn from ovirt-engine-nodejs-modules
  • Loading branch information
sjd78 committed Sep 10, 2019
2 parents e052308 + 90f9d83 commit b7351eb
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 38 deletions.
8 changes: 4 additions & 4 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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/
Expand Down
1 change: 0 additions & 1 deletion automation/build.packages.force
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
ovirt-engine-nodejs
ovirt-engine-nodejs-modules
ovirt-engine-yarn
1 change: 0 additions & 1 deletion automation/build.repos
Original file line number Diff line number Diff line change
@@ -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/
29 changes: 12 additions & 17 deletions automation/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 4 additions & 11 deletions ovirt-web-ui.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b7351eb

Please sign in to comment.