Skip to content

Commit

Permalink
do not hardcode go version
Browse files Browse the repository at this point in the history
  • Loading branch information
marguerite committed Feb 24, 2016
1 parent 9300109 commit 005c223
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion golang.req
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ buildroot = RpmSysinfo.get_buildroot
contribdir = RpmSysinfo.get_go_contribdir
importpath = RpmSysinfo.get_go_importpath

def go_get_version()
IO.popen("go version") do |process|
process.each_line do |l|
version_re = /^go version go(?<version>\S+)\s+(?<goos>[^\/]+)\/(?<goarch>.*)$/
md = version_re.match(l.chomp)
return md[:version] if md
end
end
end

# read stdin for filelist rpm feeds us for a (sub) package
filelist = []
ARGF.each do |l|
Expand All @@ -22,7 +32,7 @@ requires = []

unless filelist.empty? then

requires << "golang(API) = 1.5"
requires << "golang(API) = " + go_get_version()

filelist.each do |f|
# unarchive .a
Expand Down
2 changes: 1 addition & 1 deletion golang/rpmsysinfo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def self.get_go_importpath

return importpath

end
end

end

0 comments on commit 005c223

Please sign in to comment.