summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2014-11-10 09:39:58 +0100
committerPascal Terjan <pterjan@mageia.org>2020-03-25 22:21:06 +0000
commita93198ca0fb136b1f5d693d1a42eb59f420c7fad (patch)
tree4da5ce3c4705d68280808d7088297712fc53469c
parent46222ceb3586394df7e9436ee68bfcb4c95abd63 (diff)
downloadautobuild-a93198ca0fb136b1f5d693d1a42eb59f420c7fad.tar
autobuild-a93198ca0fb136b1f5d693d1a42eb59f420c7fad.tar.gz
autobuild-a93198ca0fb136b1f5d693d1a42eb59f420c7fad.tar.bz2
autobuild-a93198ca0fb136b1f5d693d1a42eb59f420c7fad.tar.xz
autobuild-a93198ca0fb136b1f5d693d1a42eb59f420c7fad.zip
Store interesting per-package build dependencies
This can be used in the web front-end to display useful information about each package.
-rwxr-xr-xautobuild.rb126
1 files changed, 118 insertions, 8 deletions
diff --git a/autobuild.rb b/autobuild.rb
index 599b03b..c52986c 100755
--- a/autobuild.rb
+++ b/autobuild.rb
@@ -15,6 +15,10 @@ def create_tables(db)
FOREIGN KEY(Result) REFERENCES ResultValues(Id),
UNIQUE(Package, Run, Result))"
db.execute "CREATE TABLE IF NOT EXISTS Diffs(Run INTEGER PRIMARY KEY, New INTEGER, Fixed INTEGER, NotFixed INTEGER)"
+ db.execute "CREATE TABLE IF NOT EXISTS Attributes(Id INTEGER PRIMARY KEY, Package INTEGER, Run INTEGER, Attr TEXT,
+ FOREIGN KEY(Package) REFERENCES Packages(Id),
+ FOREIGN KEY(Run) REFERENCES Run(Id),
+ UNIQUE(Package, Run))"
end
def get_or_add_resultvalue(db, result)
@@ -28,6 +32,104 @@ def get_or_add_package(db, name, version, release)
db.execute "INSERT OR IGNORE INTO Packages(Name) VALUES('#{name}')"
return db.execute("SELECT Id FROM Packages WHERE Name = '#{name}'")[0][0]
end
+
+# Find interesting attributes about the package. Right now, this is just interesting
+# dependencies.
+def find_attributes(build_dir)
+ attr = {}
+ rpm_list_files = Dir.glob(build_dir + '/rpm_qa.*.log')
+ rpm_list_file = rpm_list_files[0]
+ if rpm_list_file then
+ File.open(rpm_list_file, 'r') {|f|
+ f.each_line{|l|
+ if l !~ /^(.*)-([^-]*)-([^-]*)/ then
+ puts "Skipping " + l
+ next
+ end
+ name = $1
+ if name =~ /^((bwbasic)|(yabasic)|(mono-basic))$/ then
+ attr[:lang_basic] = true
+ end
+ if name =~ /^mono$/ then
+ attr[:lang_mono] = true
+ end
+ if name =~ /^(erlang)-compiler$/ then
+ attr[:lang_erlang] = true
+ end
+ if name =~ /^gcc-g(fortran)$/ then
+ attr[:lang_fortran] = true
+ end
+ if name =~ /^groovy$/ then
+ attr[:lang_groovy] = true
+ end
+ if name =~ /^ghc$/ then
+ attr[:lang_haskell] = true
+ end
+ if name =~ /^(java)|(gcc-java)/ then
+ attr[:lang_java] = true
+ end
+ if name =~ /^c(lisp)-devel$/ then
+ attr[:lang_lisp] = true
+ end
+ if name =~ /^lib(64)?lua-devel$/ then
+ attr[:lang_lua] = true
+ end
+ if name =~ /^gcc-objc$/ then
+ attr[:lang_objc] = true
+ end
+ if name =~ /^(ocaml)-compiler$/ then
+ attr[:lang_ocaml] = true
+ end
+ if name =~ /^(nodejs)|(uglify-js)|(slimit)|(yuicompressor)$/ then
+ attr[:lang_javascript] = true
+ end
+ if name =~ /^fpc(-src)?$/ then
+ attr[:lang_pascal] = true
+ end
+ if name =~ /^(perl)/ then
+ # A bunch of perl modules are installed in every installation,
+ # so ignore those.
+ if name !~ /^((perl)|(perl-base)|(perl-Config-IniFiles)|(perl-Exporter-Tiny)|(perl-File-Slurp)|(perl-File-Sync)|(perl-Filesys-Df)|(perl-JSON)|(perl-libintl-perl)|(perl-List-MoreUtils)|(perl-Locale-gettext)|(perl-MDK-Common)|(perl-MDV-Distribconf)|(perl-MDV-Packdrakeng)|(perl-Module-ScanDeps)|(perl-Time-ZoneInfo)|(perl-URPM)|(perl-XML-LibXML)|(perl-XML-NamespaceSupport)|(perl-XML-SAX)|(perl-XML-SAX-Base)|(perl-YAML)|(perl-YAML-Tiny))$/ then
+ attr[:lang_perl] = true
+ end
+ end
+ if name =~ /^((php)-devel)|(lib(64)?php_common)/ then
+ attr[:lang_php] = true
+ end
+ if name =~ /^((python3?-setuptools)|(lib(64)?python3?-devel))$/ then
+ attr[:lang_python] = true
+ end
+ if name =~ /^((ruby)-devel)|(lib(64)?ruby[0-9])/ then
+ attr[:lang_ruby] = true
+ end
+ if name =~ /^(tcl)$/ then
+ attr[:lang_tcl] = true
+ end
+
+ # Check for a few build systems, too
+ if name =~ /^(ant)$/ then
+ attr[:build_ant] = true
+ end
+ if name =~ /^(cmake)$/ then
+ attr[:build_cmake] = true
+ end
+ if name =~ /^(maven)$/ then
+ attr[:build_maven] = true
+ end
+ if name =~ /^(scons)$/ then
+ attr[:build_scons] = true
+ end
+ }
+ }
+ end
+
+ attr_line = ''
+ attr.keys.sort.each do |key|
+ attr_line = attr_line + ' ' + key.to_s
+ end
+ attr_line = attr_line.strip()
+ return attr_line
+end
def insert_run(db, status_file)
t_start = Date.parse(File.basename(File.dirname(status_file))).strftime('%s')
@@ -36,7 +138,7 @@ def insert_run(db, status_file)
db.execute "INSERT INTO Runs(Start, End) VALUES(#{t_start}, #{t_end})"
run_id = db.last_insert_row_id
File.open(status_file, 'r') {|f|
- db.transaction
+ db.transaction
f.each_line{|l|
if l !~ /^(.*)-([^-]*)-([^-]*).src.rpm: (.*)$/ then
puts l
@@ -46,15 +148,23 @@ def insert_run(db, status_file)
version = $2
release = $3
result = $4
- if result == 'rejected' then
- next
- end
- result_id = get_or_add_resultvalue(db, result)
- package_id = get_or_add_package(db, name, version, release)
- puts name
+ if result == 'rejected' then
+ next
+ end
+ result_id = get_or_add_resultvalue(db, result)
+ package_id = get_or_add_package(db, name, version, release)
+ puts name
db.execute "INSERT INTO Results(Package, Run, Result) VALUES(#{package_id}, #{run_id}, #{result_id})"
+
+ # Store some interesting attributes about the build
+ attr = find_attributes(File.dirname(status_file) + '/' + name + '-' + version + '-' + release + '.src.rpm')
+ #puts "\t\t\tAttributes: " + attr
+ if attr then
+ db.execute "INSERT INTO Attributes(Package, Run, Attr) VALUES(#{package_id}, #{run_id}, '#{attr}')"
+ end
+
}
- db.commit
+ db.commit
}
end