Blob Blame History Raw
From 0e0a738cbe1a361e548a31a5a9aaf9b4acfec7cb Mon Sep 17 00:00:00 2001
From: Ondrej Mular <omular@redhat.com>
Date: Sat, 1 Jul 2017 20:21:26 +0200
Subject: [PATCH] fedfix

---
 pcs/pcs                  |  2 +-
 pcs/test/suite.py        |  2 +-
 pcsd/Makefile            | 30 +++---------------------------
 pcsd/pcsd.rb             |  1 +
 pcsd/pcsd.service-runner |  3 ++-
 5 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/pcs/pcs b/pcs/pcs
index 4585fd5..d35933e 100755
--- a/pcs/pcs
+++ b/pcs/pcs
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 from __future__ import absolute_import
 import os.path
diff --git a/pcs/test/suite.py b/pcs/test/suite.py
index fcac586..ec4b864 100755
--- a/pcs/test/suite.py
+++ b/pcs/test/suite.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 from __future__ import (
     absolute_import,
     division,
diff --git a/pcsd/Makefile b/pcsd/Makefile
index 2ecd4de..24ce1fe 100644
--- a/pcsd/Makefile
+++ b/pcsd/Makefile
@@ -1,33 +1,9 @@
-FFI_VERSION="1.9.17"
-FFI_C_DIR=vendor/bundle/ruby/gems/ffi-${FFI_VERSION}/ext/ffi_c
-
-build_gems: get_gems
-	bundle install --local --deployment
-	#ffi makes symlink with absolute path. Let's change it to relative path.
-	for fname in `ls ${FFI_C_DIR}/libffi-*/include/ffitarget.h`; do \
-		if [[ -L "$$fname" ]]; then \
-			target=$$(readlink $$fname | sed "s~.*/${FFI_C_DIR}\(/libffi/src/[^/]\+/ffitarget.h\)~../..\1~"); \
-			rm $$fname; \
-			ln -s $$target $$fname; \
-		fi; \
-	done;
-
-# RHEL6 needs special rpam-ruby19 gem to work with 1.8.7
-# also bundler is not available on RHEL6 in rpm
-build_gems_rhel6:
+build_gems:
 	mkdir -p vendor/bundle/ruby
-	gem install --verbose --no-rdoc --no-ri -l -i vendor/bundle/ruby \
-	vendor/cache/backports-3.6.8.gem \
-	vendor/cache/ethon-0.9.1.gem \
-	vendor/cache/ffi-${FFI_VERSION}.gem \
-	vendor/cache/json-2.0.3.gem \
-	vendor/cache/multi_json-1.12.1.gem \
-	vendor/cache/open4-1.3.4.gem \
+	gem install --force --verbose --no-rdoc --no-ri -l -i vendor/bundle/ruby \
 	vendor/cache/orderedhash-0.0.6.gem \
 	vendor/cache/rack-1.6.4.gem \
-	vendor/cache/rack-protection-1.5.3.gem \
-	vendor/cache/rack-test-0.6.3.gem \
-	vendor/cache/rpam-ruby19-feist-1.2.1.1.gem \
+	vendor/cache/rpam-ruby19-1.2.1.gem \
 	vendor/cache/sinatra-1.4.8.gem \
 	vendor/cache/sinatra-contrib-1.4.7.gem \
 	vendor/cache/tilt-2.0.6.gem \
diff --git a/pcsd/pcsd.rb b/pcsd/pcsd.rb
index 1026a36..ac1b3b9 100644
--- a/pcsd/pcsd.rb
+++ b/pcsd/pcsd.rb
@@ -1,3 +1,4 @@
+gem 'sinatra', '= 1.4.8'
 require 'sinatra'
 require 'sinatra/reloader' if development?
 require 'sinatra/cookies'
diff --git a/pcsd/pcsd.service-runner b/pcsd/pcsd.service-runner
index 883d290..712913e 100644
--- a/pcsd/pcsd.service-runner
+++ b/pcsd/pcsd.service-runner
@@ -3,8 +3,9 @@
 # it also serves as a holder of a selinux context
 
 begin
-  # add pcsd to the load path (ruby -I)
+  # add pcsd and bundled gems to the load path (ruby -I)
   libdir = File.dirname(__FILE__)
+  $LOAD_PATH.unshift(*Dir[libdir + '/vendor/bundle/ruby/gems/*/lib'])
   $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
 
   # change current directory (ruby -C)
-- 
2.9.4