commit
fc9a07dfba
9 changed files with 105 additions and 7 deletions
|
@ -1,4 +1,8 @@
|
||||||
## [0.4.2](https://github.com/fgrehm/vagrant-cachier/compare/v0.4.1...master) (unreleased)
|
## [0.5.0](https://github.com/fgrehm/vagrant-cachier/compare/v0.4.1...v0.5.0) (Nov 6, 2013)
|
||||||
|
|
||||||
|
FEATURES:
|
||||||
|
|
||||||
|
- Support for [zypper] [GH-54]
|
||||||
|
|
||||||
## [0.4.1](https://github.com/fgrehm/vagrant-cachier/compare/v0.4.0...v0.4.1) (Oct 27, 2013)
|
## [0.4.1](https://github.com/fgrehm/vagrant-cachier/compare/v0.4.0...v0.4.1) (Oct 27, 2013)
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ GIT
|
||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
vagrant-cachier (0.4.1)
|
vagrant-cachier (0.5.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
|
|
15
README.md
15
README.md
|
@ -142,7 +142,20 @@ _Please note that to avoid re-downloading packages, you should avoid `apt-get cl
|
||||||
as much as possible in order to make a better use of the cache, even if you are
|
as much as possible in order to make a better use of the cache, even if you are
|
||||||
packaging a box_
|
packaging a box_
|
||||||
|
|
||||||
##### Yum
|
##### Zypper
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
Vagrant.configure("2") do |config|
|
||||||
|
config.vm.box = 'some-suse-box'
|
||||||
|
config.cache.enable :zypper
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
Used by SuSE guests, will get configured under guest's `/var/cache/zypp/packages`. It will
|
||||||
|
also [make sure](lib/vagrant-cachier/bucket/zypper.rb#L20) that `keep-packages` is enabled
|
||||||
|
for all repositories.
|
||||||
|
|
||||||
|
###### Yum
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Vagrant.configure("2") do |config|
|
Vagrant.configure("2") do |config|
|
||||||
|
|
27
development/Vagrantfile
vendored
27
development/Vagrantfile
vendored
|
@ -14,9 +14,6 @@ Vagrant.configure("2") do |config|
|
||||||
config.cache.auto_detect = true
|
config.cache.auto_detect = true
|
||||||
config.cache.enable_nfs = true
|
config.cache.enable_nfs = true
|
||||||
|
|
||||||
config.vm.provider :virtualbox do |_, vb|
|
|
||||||
vb.vm.network :private_network, ip: "192.168.50.123"
|
|
||||||
end
|
|
||||||
|
|
||||||
config.omnibus.chef_version = :latest
|
config.omnibus.chef_version = :latest
|
||||||
config.vm.provision :chef_solo do |chef|
|
config.vm.provision :chef_solo do |chef|
|
||||||
|
@ -62,6 +59,10 @@ Vagrant.configure("2") do |config|
|
||||||
fi
|
fi
|
||||||
'
|
'
|
||||||
|
|
||||||
|
configure_private_network = lambda do |node, suffix|
|
||||||
|
node.vm.network :private_network, ip: "192.168.50.#{suffix}"
|
||||||
|
end
|
||||||
|
|
||||||
debian_like_configs = lambda do |debian|
|
debian_like_configs = lambda do |debian|
|
||||||
# Here we have the RubyGems cache bucket configured to the right path, so we
|
# Here we have the RubyGems cache bucket configured to the right path, so we
|
||||||
# bundle the project
|
# bundle the project
|
||||||
|
@ -74,22 +75,26 @@ Vagrant.configure("2") do |config|
|
||||||
config.vm.define :ubuntu do |ubuntu|
|
config.vm.define :ubuntu do |ubuntu|
|
||||||
ubuntu.vm.box = "quantal64"
|
ubuntu.vm.box = "quantal64"
|
||||||
debian_like_configs.call ubuntu
|
debian_like_configs.call ubuntu
|
||||||
|
configure_private_network.call ubuntu, 10
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.define :lucid do |lucid|
|
config.vm.define :lucid do |lucid|
|
||||||
lucid.vm.box = "lucid64"
|
lucid.vm.box = "lucid64"
|
||||||
debian_like_configs.call lucid
|
debian_like_configs.call lucid
|
||||||
|
configure_private_network.call lucid, 11
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.define :debian do |debian|
|
config.vm.define :debian do |debian|
|
||||||
debian.vm.box = "squeeze64"
|
debian.vm.box = "squeeze64"
|
||||||
debian.vm.box_url = 'http://f.willianfernandes.com.br/vagrant-boxes/DebianSqueeze64.box'
|
debian.vm.box_url = 'http://f.willianfernandes.com.br/vagrant-boxes/DebianSqueeze64.box'
|
||||||
debian_like_configs.call debian
|
debian_like_configs.call debian
|
||||||
|
configure_private_network.call debian, 12
|
||||||
end
|
end
|
||||||
|
|
||||||
config.vm.define :centos do |centos|
|
config.vm.define :centos do |centos|
|
||||||
centos.vm.box = 'centos6_64'
|
centos.vm.box = 'centos6_64'
|
||||||
centos.vm.box_url = 'http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130309.box'
|
centos.vm.box_url = 'http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130309.box'
|
||||||
|
configure_private_network.call centos, 13
|
||||||
# Here we have the RubyGems cache bucket configured to the right path, so we
|
# Here we have the RubyGems cache bucket configured to the right path, so we
|
||||||
# bundle the project
|
# bundle the project
|
||||||
centos.vm.provision :shell, inline: '
|
centos.vm.provision :shell, inline: '
|
||||||
|
@ -100,8 +105,24 @@ Vagrant.configure("2") do |config|
|
||||||
config.vm.define :arch do |arch|
|
config.vm.define :arch do |arch|
|
||||||
arch.vm.box = 'arch64'
|
arch.vm.box = 'arch64'
|
||||||
arch.vm.box_url = 'http://vagrant.pouss.in/archlinux_2012-07-02.box'
|
arch.vm.box_url = 'http://vagrant.pouss.in/archlinux_2012-07-02.box'
|
||||||
|
configure_private_network.call arch, 14
|
||||||
arch.vm.provision :shell, inline: '
|
arch.vm.provision :shell, inline: '
|
||||||
pacman -Syu --noconfirm libffi git
|
pacman -Syu --noconfirm libffi git
|
||||||
HOME=/home/vagrant su -p vagrant -l -c "cd /vagrant && bundle"'
|
HOME=/home/vagrant su -p vagrant -l -c "cd /vagrant && bundle"'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Please note that we are not able to install chef on the VM, so when bringing
|
||||||
|
# this up we should always pass in `--provision-with=shell`
|
||||||
|
#
|
||||||
|
# TODO: Find out how to install chef on this or other box or find one that has
|
||||||
|
# it pre installed
|
||||||
|
config.vm.define :opensuse do |suse|
|
||||||
|
suse.vm.box = 'opensuse-12'
|
||||||
|
suse.vm.box_url = 'http://sourceforge.net/projects/opensusevagrant/files/12.3/opensuse-12.3-64.box/download'
|
||||||
|
configure_private_network.call suse, 15
|
||||||
|
suse.cache.enable_nfs = false
|
||||||
|
# This seems to not be working
|
||||||
|
suse.omnibus.chef_version = nil
|
||||||
|
suse.vm.provision :shell, inline: 'time zypper install -y git'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,3 +42,4 @@ require_relative "bucket/rvm"
|
||||||
require_relative "bucket/apt_cacher"
|
require_relative "bucket/apt_cacher"
|
||||||
require_relative "bucket/composer"
|
require_relative "bucket/composer"
|
||||||
require_relative "bucket/npm"
|
require_relative "bucket/npm"
|
||||||
|
require_relative "bucket/zypper"
|
||||||
|
|
36
lib/vagrant-cachier/bucket/zypper.rb
Normal file
36
lib/vagrant-cachier/bucket/zypper.rb
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
module VagrantPlugins
|
||||||
|
module Cachier
|
||||||
|
class Bucket
|
||||||
|
class Zypper < Bucket
|
||||||
|
def self.capability
|
||||||
|
:zypper_cache_dir
|
||||||
|
end
|
||||||
|
|
||||||
|
def install
|
||||||
|
machine = @env[:machine]
|
||||||
|
guest = machine.guest
|
||||||
|
|
||||||
|
if guest.capability?(:zypper_cache_dir)
|
||||||
|
guest_path = guest.capability(:zypper_cache_dir)
|
||||||
|
|
||||||
|
@env[:cache_dirs] << guest_path
|
||||||
|
|
||||||
|
machine.communicate.tap do |comm|
|
||||||
|
# Ensure caching is enabled
|
||||||
|
comm.sudo("zypper modifyrepo --keep-packages --all")
|
||||||
|
|
||||||
|
comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}")
|
||||||
|
unless comm.test("test -L #{guest_path}")
|
||||||
|
comm.sudo("rm -rf #{guest_path}")
|
||||||
|
comm.sudo("mkdir -p `dirname #{guest_path}`")
|
||||||
|
comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Zypper')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
14
lib/vagrant-cachier/cap/suse/zypper_cache_dir.rb
Normal file
14
lib/vagrant-cachier/cap/suse/zypper_cache_dir.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
module VagrantPlugins
|
||||||
|
module Cachier
|
||||||
|
module Cap
|
||||||
|
module SuSE
|
||||||
|
module ZypperCacheDir
|
||||||
|
def self.zypper_cache_dir(machine)
|
||||||
|
# TODO: Find out if there is a config file we can read from
|
||||||
|
'/var/cache/zypp/packages'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -56,11 +56,20 @@ module VagrantPlugins
|
||||||
Cap::RedHat::YumCacheDir
|
Cap::RedHat::YumCacheDir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
guest_capability 'suse', 'yum_cache_dir' do
|
||||||
|
# Disable Yum on suse guests
|
||||||
|
end
|
||||||
|
|
||||||
guest_capability 'arch', 'pacman_cache_dir' do
|
guest_capability 'arch', 'pacman_cache_dir' do
|
||||||
require_relative 'cap/arch/pacman_cache_dir'
|
require_relative 'cap/arch/pacman_cache_dir'
|
||||||
Cap::Arch::PacmanCacheDir
|
Cap::Arch::PacmanCacheDir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
guest_capability 'suse', 'zypper_cache_dir' do
|
||||||
|
require_relative 'cap/suse/zypper_cache_dir'
|
||||||
|
Cap::SuSE::ZypperCacheDir
|
||||||
|
end
|
||||||
|
|
||||||
# TODO: This should be generic, we don't want to hard code every single
|
# TODO: This should be generic, we don't want to hard code every single
|
||||||
# possible provider action class that Vagrant might have
|
# possible provider action class that Vagrant might have
|
||||||
ensure_single_cache_root = lambda do |hook|
|
ensure_single_cache_root = lambda do |hook|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module Cachier
|
module Cachier
|
||||||
VERSION = "0.4.2.dev"
|
VERSION = "0.5.0"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue