Re: [Tails-dev] TAILS build system with Vagrant 1.7.3

Delete this message

Reply to this message
Autor: Adam Burns
Data:  
A: tails-dev
Assumpte: Re: [Tails-dev] TAILS build system with Vagrant 1.7.3
On 07/19/2015 12:11 PM, Adam Burns wrote:
> On 07/19/2015 09:37 AM, intrigeri wrote:
>> Adam Burns wrote (18 Jul 2015 21:31:55 GMT) :
>>> Bingo. Build now completes from current devel branch and generates iso file!
>>
>> Yay :)
>>
>> May you please share the changes that allowed you to build with
>> Vagrant 1.7+?
>
> Tested and working under Fedora 21 with vagrant RPM installed from
> https://dl.bintray.com/mitchellh/vagrant/vagrant_1.7.4_x86_64.rpm


A *slightly* improved Rakefile patch that is back compatible with older
vagrant gem or distribution package environments.

If the vagrant libraries cannot be found (ie require 'vagrant' fails),
this patch will optimistically add deb/rpm package paths for the vagrant
libraries and try again.

Again, it works in personal environment above.

And again, it's still ugly & I'm still stupid (wrt rvm/ruby at least!) ;)

Can someone sanity check this under Debian with the 'official' Vagrant
deb package? Note I believe that you will need to clean/uninstall
existing vagrant gem files or packages first.

Shine


$ git diff
diff --git a/Rakefile b/Rakefile
index 0eeba39..e2485d4 100644
--- a/Rakefile
+++ b/Rakefile
@@ -18,9 +18,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

+
 require 'rbconfig'
 require 'rubygems'
-require 'vagrant'
+begin
+  require 'vagrant'
+rescue LoadError
+  VAGRANT_PKG_REQ_PREFIX = "/opt/vagrant/embedded/gems/gems/"
+  puts "vagrant library require files from gem not found, attempting
vagrant [deb,rpm] package require paths under #{VAGRANT_PKG_REQ_PREFIX}"
+  Dir.glob("#{VAGRANT_PKG_REQ_PREFIX}*/lib").each do |pkg_req_dir|
+    $LOAD_PATH.unshift File.expand_path("#{pkg_req_dir}", __FILE__)
+  end
+  # attempt to load vagrant library again, this time failing by terminating
+  require 'vagrant'
+end
 require 'uri'


$:.unshift File.expand_path('../vagrant/lib', __FILE__)