Remove installing nodejs repo from nodejs.tchol.org
Since said rpm is no longer valid, add a script under tools to build/install nodejs rpm from source, provide pre-built nodejs rpm under local-rpms dir and install nodejs rpm from that dir itself if horizon is being used. Change-Id: Iae724d73d5433f9de2bd35038edc66c5da185419
This commit is contained in:
parent
5ba433dd4f
commit
215ccaed49
@ -72,42 +72,6 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
|||||||
comp.PythonInstallComponent.verify(self)
|
comp.PythonInstallComponent.verify(self)
|
||||||
self._check_ug()
|
self._check_ug()
|
||||||
|
|
||||||
def pre_install(self):
|
|
||||||
self._install_node_repo()
|
|
||||||
|
|
||||||
def _install_node_repo(self):
|
|
||||||
repo_url = self.get_option('nodejs_repo')
|
|
||||||
if not repo_url:
|
|
||||||
# Ok then, hope node js is in your path for when horizon attempts
|
|
||||||
# to use it... if not possibly follow:
|
|
||||||
#
|
|
||||||
# http://www.chrisabernethy.com/installing-node-js-on-centos-redhat/
|
|
||||||
return
|
|
||||||
# Download the said url and install it so that we can actually install
|
|
||||||
# the node.js requirement which seems to be needed by horizon for css compiling??
|
|
||||||
repo_basename = sh.basename(repo_url)
|
|
||||||
(_fn, fn_ext) = os.path.splitext(repo_basename)
|
|
||||||
fn_ext = fn_ext.lower().strip()
|
|
||||||
if fn_ext not in ['.rpm', '.repo']:
|
|
||||||
LOG.warn("Unknown node.js repository configuration extension %s (we only support .rpm or .repo)!", colorizer.quote(fn_ext))
|
|
||||||
return
|
|
||||||
with NamedTemporaryFile(suffix=fn_ext) as temp_fh:
|
|
||||||
LOG.info("Downloading node.js repository configuration from %s to %s.", repo_url, temp_fh.name)
|
|
||||||
down.UrlLibDownloader(repo_url, temp_fh.name).download()
|
|
||||||
temp_fh.flush()
|
|
||||||
if fn_ext == ".repo":
|
|
||||||
# Just write out the repo file after downloading it...
|
|
||||||
repo_file_name = sh.joinpths("/etc/yum.repos.d", repo_basename)
|
|
||||||
if not sh.exists(repo_file_name):
|
|
||||||
with sh.Rooted(True):
|
|
||||||
sh.write_file(repo_file_name, sh.load_file(temp_fh.name),
|
|
||||||
tracewriter=self.tracewriter)
|
|
||||||
sh.chmod(repo_file_name, 0644)
|
|
||||||
elif fn_ext == ".rpm":
|
|
||||||
# Install it instead from said rpm (which likely is a
|
|
||||||
# file that contains said repo location)...
|
|
||||||
yum.YumPackager(self.distro).direct_install(temp_fh.name)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def symlinks(self):
|
def symlinks(self):
|
||||||
links = super(HorizonInstaller, self).symlinks
|
links = super(HorizonInstaller, self).symlinks
|
||||||
|
@ -17,13 +17,6 @@ apache_user: "$(auto:user)"
|
|||||||
# Port horizon should run on
|
# Port horizon should run on
|
||||||
port: 80
|
port: 80
|
||||||
|
|
||||||
# We need to get a viable node.js repository to work
|
|
||||||
# with, this is only really needed for distributions where
|
|
||||||
# said distributions do not have node.js available yet...
|
|
||||||
#
|
|
||||||
# NOTE(harlowja): blank out/remove as needed...
|
|
||||||
nodejs_repo: "http://nodejs.tchol.org/repocfg/el/nodejs-stable-release.noarch.rpm"
|
|
||||||
|
|
||||||
# Needed for setting up your database
|
# Needed for setting up your database
|
||||||
db:
|
db:
|
||||||
type: "$(db:type)"
|
type: "$(db:type)"
|
||||||
|
@ -259,9 +259,7 @@ components:
|
|||||||
packages:
|
packages:
|
||||||
- name: httpd
|
- name: httpd
|
||||||
- name: mod_wsgi
|
- name: mod_wsgi
|
||||||
- name: nodejs
|
- name: ./local-rpms/nodejs-0.10.0-1.x86_64.rpm
|
||||||
- name: nodejs-compat-symlinks
|
|
||||||
- name: npm
|
|
||||||
pips:
|
pips:
|
||||||
- name: django-openstack-auth
|
- name: django-openstack-auth
|
||||||
- name: nosexcover
|
- name: nosexcover
|
||||||
|
BIN
local-rpms/nodejs-0.10.0-1.x86_64.rpm
Normal file
BIN
local-rpms/nodejs-0.10.0-1.x86_64.rpm
Normal file
Binary file not shown.
57
tools/build-install-node-from-source.sh
Executable file
57
tools/build-install-node-from-source.sh
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -x
|
||||||
|
|
||||||
|
nodejs_dir="`pwd`/.nodejs-build-dir"
|
||||||
|
mkdir $nodejs_dir
|
||||||
|
cd $nodejs_dir
|
||||||
|
|
||||||
|
echo "Downloading http://nodejs.org/dist/node-latest.tar.gz"
|
||||||
|
wget "http://nodejs.org/dist/node-latest.tar.gz"
|
||||||
|
tar -xzf node-latest.tar.gz
|
||||||
|
|
||||||
|
VERSION=`ls $nodejs_dir/ | grep node-v | cut -d 'v' -f2`
|
||||||
|
echo $VERSION
|
||||||
|
|
||||||
|
cd node-v$VERSION*
|
||||||
|
export CFLAGS=" -w -pipe -O3"
|
||||||
|
export CXXFLAGS=" -w -pipe -O3"
|
||||||
|
./configure --prefix=/usr
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Building Node ..."
|
||||||
|
make
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Installing into $nodejs_dir/install-root ..."
|
||||||
|
mkdir -p "$nodejs_dir/install-root"
|
||||||
|
make install DESTDIR="$nodejs_dir/install-root"
|
||||||
|
|
||||||
|
cd $nodejs_dir
|
||||||
|
echo
|
||||||
|
echo "Building RPM ..."
|
||||||
|
mkdir -p "$nodejs_dir/RPMS"
|
||||||
|
|
||||||
|
RELEASE=1
|
||||||
|
echo "Name: nodejs
|
||||||
|
|
||||||
|
Version: $VERSION
|
||||||
|
Release: $RELEASE
|
||||||
|
Summary: Server Side JavaScript Engine
|
||||||
|
URL: http://nodejs.org
|
||||||
|
Group: Development/Languages
|
||||||
|
License: MIT and BSD
|
||||||
|
Requires: openssl, zlib, glibc
|
||||||
|
|
||||||
|
%description
|
||||||
|
Node.js is Google V8 JavaScript with an evented I/O based interface to POSIX. This RPM was built using https://github.com/ddopson/nodejs-rpm-builder
|
||||||
|
as a reference
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
/" > package.spec
|
||||||
|
|
||||||
|
rpmbuild -bb package.spec --buildroot "$nodejs_dir/install-root" --define "_topdir $nodejs_dir" --define "VERSION $VERSION"
|
||||||
|
|
||||||
|
yum install -y -q $nodejs_dir/RPMS/x86_64/nodejs-$VERSION-$RELEASE.x86_64.rpm
|
||||||
|
|
||||||
|
rm -rf $nodejs_dir
|
Loading…
Reference in New Issue
Block a user