added rpm changelog puller
This commit is contained in:
parent
9f9eeb1b3f
commit
acf1bc223f
1 changed files with 22 additions and 0 deletions
22
command_line/rpm_package_changelog_pull.rb
Executable file
22
command_line/rpm_package_changelog_pull.rb
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env ruby
|
||||
# this program will lookup an rpm pkg and create a json of the changes
|
||||
|
||||
require 'pry'
|
||||
require 'json'
|
||||
require 'digest'
|
||||
|
||||
pkgname = ARGV[0]
|
||||
|
||||
# gives us an array of hashes where each element looks like [{:date => date, :name => name}]
|
||||
rpm_name_and_date_query= `rpm -q --qf '[date:%{CHANGELOGTIME:day}\nname:%{CHANGELOGNAME}\n]' #{pkgname}`.split("\n").each_slice(2).map {|s| s.map {|r| r.split(":")}.to_h}
|
||||
|
||||
# we add in the ascii code for record separator in our query to split this afterwards so we get an array of each changelog item
|
||||
split_char = ''
|
||||
|
||||
rpm_text_query = `rpm -q --qf '[%{CHANGELOGTEXT}#{split_char}]' #{pkgname}`.split(split_char)
|
||||
|
||||
hashed_changes = rpm_text_query.map {|changetext| hash = Digest::SHA2.hexdigest changetext; {"checksum" => hash} }
|
||||
|
||||
results = rpm_name_and_date_query.zip(hashed_changes)
|
||||
|
||||
binding.pry
|
Loading…
Add table
Reference in a new issue