Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kraman committed Aug 23, 2013
0 parents commit fd593d8
Show file tree
Hide file tree
Showing 25 changed files with 1,452 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/.rakeTasks

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/scopes/scope_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .idea/vagrant-openshift.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

619 changes: 619 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in vagrant-openshift.gemspec
gemspec
13 changes: 13 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2013 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# @title OpenShift Origin Build Tools

#License

Copyright 2013 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

# Notice of Export Control Law

This software distribution includes cryptographic software that is subject to the U.S. Export Administration Regulations (the "*EAR*") and other U.S. and foreign laws and may not be exported, re-exported or transferred (a) to any country listed in Country Group E:1 in Supplement No. 1 to part 740 of the EAR (currently, Cuba, Iran, North Korea, Sudan & Syria); (b) to any prohibited destination or to any end user who has been prohibited from participating in U.S. export transactions by any federal agency of the U.S. government; or (c) for use in connection with the design, development or production of nuclear, chemical or biological weapons, or rocket systems, space launch vehicles, or sounding rockets, or unmanned air vehicle systems.You may not download this software or technical information if you are located in one of these countries or otherwise subject to these restrictions. You may not provide this software or technical information to individuals or entities located in one of these countries or otherwise subject to these restrictions. You are also responsible for compliance with foreign law requirements applicable to the import, export and use of this software and technical information.
35 changes: 35 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#--
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#++

require 'rubygems'
require 'bundler/setup'
require 'pry'
$stdout.sync = true
$stderr.sync = true

namespace :vagrant do

desc "Install plugin into Vagrant"
task :install do
Rake::Task['build'].invoke
name = Bundler::GemHelper.instance.send(:name)
version = Bundler::GemHelper.instance.send(:version).to_s
system("vagrant plugin install pkg/#{name}-#{version}.gem")
end
end

Bundler::GemHelper.install_tasks
task :default => "vagrant:install"
51 changes: 51 additions & 0 deletions builder/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#--
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#++

require 'rubygems'
require 'pathname'
require 'yaml'
require_relative 'lib/constants'
$stdout.sync = true
$stderr.sync = true

namespace :openshift do
task :install_deps do
spec_files = []
parent_dir = Pathname.new(File.expand_path("__FILE__/../../"))
Vagrant::Openshift::Constants.repos.each do |name, url|
repo_dir = parent_dir + name
spec_files += Dir.glob((repo_dir + "**/*.spec").to_s)
end

all_build_dependencies = []
all_inst_dependencies = []
spec_files.each do |spec|
spec_build_deps = YAML.load(`./yum-listbuilddep #{spec}`)
all_build_dependencies += spec_build_deps

spec_inst_deps = `rpm -q --specfile --requires #{spec}`.split("\n")
all_inst_dependencies += spec_inst_deps
end

all_packages = all_build_dependencies + all_inst_dependencies
print "Installing #{all_packages.size} in chunks of 20 packages"
all_packages.uniq.each_slice(20) do |list|
system %{sudo yum install -y --skip-broken "#{list.join('" "')}"}
end
end


end
Empty file added builder/lib/.gitkeep
Empty file.
124 changes: 124 additions & 0 deletions builder/yum-listbuilddep
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#!/usr/bin/python -tt

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import sys
sys.path.insert(0,'/usr/share/yum-cli')

import yum
from yum.misc import setup_locale
from yum.i18n import exception2msg
import yum.Errors
from utils import YumUtilBase

import logging
import rpmUtils
import rpm

rhn_source_repos = False



class YumBuildDep(YumUtilBase):
NAME = 'yum-listbuilddep'
VERSION = '1.0'
USAGE = 'yum-listbuilddep package1.spec [package2.spec] [...]'

def __init__(self):
YumUtilBase.__init__(self,
YumBuildDep.NAME,
YumBuildDep.VERSION,
YumBuildDep.USAGE)
self.logger = logging.getLogger("yum.verbose.cli.yumbuildep")
# Add util commandline options to the yum-cli ones
self.optparser = self.getOptionParser()
if hasattr(rpm, 'reloadConfig'):
self.optparser.add_option("--target",
help="set target architecture for spec parsing")
self.main()

def main(self):
# Parse the commandline option and setup the basics.
try:
opts = self.doUtilConfigSetup()
except yum.Errors.RepoError, e:
self.logger.error("Cannot handle specific enablerepo/disablerepo options.")
sys.exit(50)

# turn of our local gpg checking for opening the srpm if it is turned
# off for repos :)
if (opts.nogpgcheck or
not self.conf.localpkg_gpgcheck or not self.conf.gpgcheck):
self.ts.pushVSFlags((rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS))

# Check if there is anything to do.
if len(self.cmds) < 1:
print self.optparser.format_help()
sys.exit(0)

try:
self.get_build_deps(opts)
except yum.Errors.MiscError, e:
msg = "There was a problem getting the build deps, exiting:\n %s" % e
self.logger.error(msg)
sys.exit(1)
sys.exit()

def get_build_deps(self,opts):
srcnames = []
specnames = []
srpms = []
specworks = False
reloadworks = False

# See if we can use spec files for buildrequires
if hasattr(rpm, 'spec') and hasattr(rpm.spec, 'sourceHeader'):
specworks = True
# See if we can reload rpm configuration
if hasattr(rpm, 'reloadConfig'):
reloadworks = True

for arg in self.cmds:
if specworks and arg.endswith('.spec'):
specnames.append(arg)

toActOn = []
for name in specnames:
# (re)load rpm config for target if set
if reloadworks and opts.target:
rpm.reloadConfig(opts.target)

try:
spec = rpm.spec(name)
except ValueError:
self.logger.error("Bad spec: %s" % name)
continue

# reset default rpm config after each parse to avoid side-effects
if reloadworks:
rpm.reloadConfig()

buildreqs = []
for d in rpm.ds(spec.sourceHeader, 'requires'):
buildreqs.append(d.DNEVR()[2:])

if len(buildreqs) > 0:
self.logger.info('["%s"]' % '","'.join(buildreqs))
else:
self.logger.info('[]')

if __name__ == '__main__':
setup_locale()
util = YumBuildDep()
34 changes: 34 additions & 0 deletions lib/vagrant-openshift.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#--
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#++
require "vagrant-openshift/version"
require "pathname"

begin
require "vagrant"
rescue LoadError
raise "Not running in vagrant environment"
end

module Vagrant
module Openshift
plugin_path = Pathname.new(File.expand_path("#{__FILE__}/../vagrant-openshift/"))

autoload :CommandHelper, plugin_path + "helpers/command_helper"
autoload :Constants, plugin_path + "constants"
end
end

require "vagrant-openshift/plugin"
Loading

0 comments on commit fd593d8

Please sign in to comment.