ruby/generate_rubygemprovides.awk

59 lines
2.4 KiB
Awk
Raw Normal View History

#!/usr/bin/awk -f
#
# Generate 'Provides' for embedded rubygems
#
# Call-seq:
# generate_rubygemprovides.awk <ruby-version> <arch> <gemname> <gemmajor> <gemminor> <gemmicro> [ <gemtiny> ]
#
# Provides: rubygem(<rubyversion>:<gemname>) = <gemversion>
# Provides: rubygem(<rubyversion>:<gemname>:<gemmajorversion>) = <gemversion>
# Provides: rubygem(<rubyversion>:<gemname>:<gemmajorversion>.<gemminorversion>) = <gemversion>
# Provides: rubygem(<rubyversion>:<gemname>:<gemmajorversion>.<gemminorversion>.<gemtinyversion) = <gemversion>
# Provides: rubygem(<rubyversion>:<gemname>:<gemversion>) = <gemversion>
# Provides: rubygem(<gemname>) = <gemversion>
# Provides: rubygem-<gemname> = <gemversion>
# Provides: rubygem-<gemname> = <gemversion>-<rubyrelease>
# Provides: rubygem-<gemname>(<arch>) = <gemversion>-<rubyrelease>
# Provides: rubygem-<gemname>-<gemmajorversion> = <gemversion>
# Provides: rubygem-<gemname>-<gemmajorversion>_<gemminorversion> = <gemversion>
# Provides: rubygem-<gemname>-<gemmajorversion>_<gemminorversion>_<gemmicroversion> = <gemversion>
# Provides: rubygem-<gemname>-<gemmajorversion>_<gemminorversion>_<gemmicroversion>_<gemtinyversion> = <gemversion>
BEGIN {
rbver = ARGV[1]
arch = ARGV[2]
name = ARGV[3]
major = ARGV[4]
minor = ARGV[5]
micro = ARGV[6]
tiny = ARGV[7]
if (tiny != "") {
version = major "." minor "." micro "." tiny
}
else {
version = major "." minor "." micro
}
print "Provides: rubygem(" rbver ":" name ") = " version
print "Provides: rubygem(" rbver ":" name ":" major ") = " version
print "Provides: rubygem(" rbver ":" name ":" major "." minor ") = " version
print "Provides: rubygem(" rbver ":" name ":" major "." minor "." micro ") = " version
if (tiny != "") {
print "Provides: rubygem(" rbver ":" name ":" major "." minor "." micro "." tiny ") = " version
}
print "Provides: rubygem(" rbver ":" name ":" version ") = " version
print "Provides: rubygem(" name ") = " version
print "Provides: rubygem-" name " = " version
# not needed currently
# if ( arch == "x86_64") {
# print "Provides: rubygem-" name "(" arch ") = " version
# }
print "Provides: rubygem-" name "-" major " = " version
print "Provides: rubygem-" name "-" major "_" minor " = " version
print "Provides: rubygem-" name "-" major "_" minor "_" micro " = " version
if (tiny != "") {
print "Provides: rubygem-" name "-" major "_" minor "_" micro "_" tiny " = " version
}
}