Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Script to modify linux-stable recipe to build latest kernel tag
- # Requires ruby. To install ruby: sudo apt-get install ruby1.9.1
- def get_latest_tag(force_tag)
- return force_tag if (force_tag && force_tag != '')
- x=`git ls-remote --tags git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git master v\*`
- x.scan(/refs\/tags\/(v[\d\.]+)\n/).flatten.last
- end
- def need_to_run(tag)
- if !File.exists? "latest-linux-stable-run"
- update_latest_run(tag)
- return true
- else
- last_run = File.open("latest-linux-stable-run").read
- update_latest_run(tag)
- tag.strip != last_run.strip
- end
- end
- def update_latest_run(tag)
- f = File.new("latest-linux-stable-run", 'w')
- f.write(tag)
- f.close
- end
- def update_recipe(recipe,tag)
- `cat #{recipe} | sed 's/SRCREV = ".*"/SRCREV = "#{tag}"/g' > #{recipe}.tmp; mv #{recipe}.tmp #{recipe}`
- end
- ########################################
- ########## START SCRIPT BODY ###########
- ########################################
- recipe = ARGV[0]
- force_tag = ARGV[1]
- tag = get_latest_tag(force_tag)
- if need_to_run(tag)
- update_recipe(recipe,tag)
- puts "Done. #{recipe} udpated to use tag #{tag}\n"
- exit 0
- else
- puts "There are no new tags. We are done! \n"
- exit 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement