mock build.Part 3

This commit is contained in:
alexey
2025-03-16 00:12:37 +03:00
parent 6520ca97df
commit c9ac228ab6
9 changed files with 165 additions and 5 deletions

View File

@@ -70,4 +70,16 @@ class IniConfig
"locks/counter"
end
end
def get_items_per_page()
unless @config["pages"]["items_per_page"].nil?
res = @config["pages"]["items_per_page"].to_i
if res < 1
res = 30
end
res
else
30
end
end
end

View File

@@ -1,7 +1,7 @@
require "sequel"
cfg_internal = IniConfig.new()
Sequel.connect(cfg_internal.get_db)
$DDB = Sequel.connect(cfg_internal.get_db)
class Repos < Sequel::Model(:repos)
end
@@ -254,7 +254,7 @@ class DBase
end
def after_fork()
Sequel.connect(@cfg.get_db)
$DDB = Sequel.connect(@cfg.get_db)
end
def save_rpm(build_id, path_to_rpm, rpm_name, git_id)
@@ -262,4 +262,12 @@ class DBase
@last_id = id
BuildRpms.insert(build_id: build_id.to_i, rpm_id: id)
end
def get_gits_rpms()
$DDB["select t1.id, t1.reponame, count(*) as packages from repos as t1 join rpms as t2 on t2.repo_id = t1.id group by t1.id, t1.reponame order by t1.id"].all
end
def get_rpms_for_git(git_id)
$DDB["select t2.id as rpmid, t2.rpmname, t1.reponame as repoid, t4.id as builid, t4.proj_id as prjid, t4.create_at from repos as t1 join rpms as t2 on t2.repo_id = t1.id join build_rpm as t3 on t3.rpm_id = t2.id join buildtask as t4 on t4.id = t3.build_id where t1.id = ? and t2.savepath not like '%.src.rpm' order by t4.create_at, t2.rpmname", git_id.to_i].all
end
end