Blob Blame History Raw
From 7deb7db8596587cf79044451f80f4acbc0abea80 Mon Sep 17 00:00:00 2001
From: Ondrej Mular <omular@redhat.com>
Date: Wed, 18 Oct 2017 12:11:51 +0200
Subject: [PATCH] fedfix

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

diff --git a/pcs/pcs b/pcs/pcs
index 4585fd57..d35933e4 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 cce2d006..68972555 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 d452ac06..ad21cb3d 100644
--- a/pcsd/Makefile
+++ b/pcsd/Makefile
@@ -1,36 +1,11 @@
-FFI_VERSION="1.9.18"
-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 \
 	-- '--with-ldflags="-Wl,-z,now -Wl,-z,relro"'
 
 get_gems:
diff --git a/pcsd/pcsd.rb b/pcsd/pcsd.rb
index ad0370c1..bde1230b 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 883d2908..712913ea 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.13.6