msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-10-12 13:55+0000\n"
+"POT-Creation-Date: 2022-10-12 18:09+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
from . import jobqueue
from . import jobs
from . import keys
-from . import logs
from . import messages
from . import mirrors
from . import packages
import time
from . import base
-from . import logs
from . import misc
from .decorators import *
builder = self._get_builder("INSERT INTO builders(name) \
VALUES(%s) RETURNING *", name)
- # Log what we have done.
- if log:
- builder.log("created", user=user)
-
# The Builder object and the passphrase are returned.
return builder
return self._get_builder("SELECT * FROM builders \
WHERE name = %s AND deleted IS FALSE", name)
- def get_history(self, limit=None, offset=None, builder=None, user=None):
- query = "SELECT * FROM builders_history"
- args = []
-
- conditions = []
-
- if builder:
- conditions.append("builder_id = %s")
- args.append(builder.id)
-
- if user:
- conditions.append("user_id = %s")
- args.append(user.id)
-
- if conditions:
- query += " WHERE %s" % " AND ".join(conditions)
-
- query += " ORDER BY time DESC"
-
- if limit:
- if offset:
- query += " LIMIT %s,%s"
- args += [offset, limit,]
- else:
- query += " LIMIT %s"
- args += [limit,]
-
- entries = []
- for entry in self.db.query(query, *args):
- entry = logs.BuilderLogEntry(self.pakfire, entry)
- entries.append(entry)
-
- return entries
-
async def sync(self, *args, **kwargs):
"""
Synchronize any state with AWS
def __str__(self):
return self.hostname
- def log(self, action, user=None):
- user_id = None
- if user:
- user_id = user.id
-
- self.db.execute("INSERT INTO builders_history(builder_id, action, user_id, time) \
- VALUES(%s, %s, %s, NOW())", self.id, action, user_id)
-
# Description
def set_description(self, description):
return "online"
- def get_history(self, *args, **kwargs):
- kwargs["builder"] = self
-
- return self.pakfire.builders.get_history(*args, **kwargs)
-
def is_ready(self):
# If the builder is not enabled, we are obviously not ready
if not self.enabled:
# Delete all comments
self.db.execute("DELETE FROM builds_comments WHERE build_id = %s", self.id)
- # Delete the repository history
- self.db.execute("DELETE FROM repositories_history WHERE build_id = %s", self.id)
-
# Delete all watchers
self.db.execute("DELETE FROM builds_watchers WHERE build_id = %s", self.id)
- # Delete build history
- self.db.execute("DELETE FROM builds_history WHERE build_id = %s", self.id)
-
# Delete the build itself.
self.db.execute("DELETE FROM builds WHERE id = %s", self.id)
# Delete source package
self.pkg.delete()
- def log(self, action, user=None, bug_id=None):
- user_id = None
- if user:
- user_id = user.id
-
- self.db.execute("INSERT INTO builds_history(build_id, action, user_id, time, bug_id) \
- VALUES(%s, %s, %s, NOW(), %s)", self.id, action, user_id, bug_id)
-
@property
def uuid(self):
"""
import pakfire.config
from . import base
-from . import logs
from . import users
from .constants import *
import location
from . import base
-from . import logs
from .decorators import lazy_property
mirror = self._get_mirror("INSERT INTO mirrors(hostname, path, owner, contact) \
VALUES(%s, %s, %s, %s) RETURNING *", hostname, path, owner, contact)
- # Log creation
- mirror.log("created", user=user)
-
return mirror
def get_by_id(self, id):
return mirrors
- def get_history(self, limit=None, offset=None, mirror=None, user=None):
- query = "SELECT * FROM mirrors_history"
- args = []
-
- conditions = []
-
- if mirror:
- conditions.append("mirror_id = %s")
- args.append(mirror.id)
-
- if user:
- conditions.append("user_id = %s")
- args.append(user.id)
-
- if conditions:
- query += " WHERE %s" % " AND ".join(conditions)
-
- query += " ORDER BY time DESC"
-
- if limit:
- if offset:
- query += " LIMIT %s,%s"
- args += [offset, limit,]
- else:
- query += " LIMIT %s"
- args += [limit,]
-
- entries = []
- for entry in self.db.query(query, *args):
- entry = logs.MirrorLogEntry(self.pakfire, entry)
- entries.append(entry)
-
- return entries
-
def check(self, **kwargs):
"""
Runs the mirror check for all mirrors
return NotImplemented
- def log(self, action, user=None):
- user_id = None
- if user:
- user_id = user.id
-
- self.db.execute("INSERT INTO mirrors_history(mirror_id, action, user_id, time) \
- VALUES(%s, %s, %s, NOW())", self.id, action, user_id)
-
def set_hostname(self, hostname):
self._set_attribute("hostname", hostname)
return network.country_code
return "UNKNOWN"
-
- def get_history(self, *args, **kwargs):
- kwargs["mirror"] = self
-
- return self.pakfire.mirrors.get_history(*args, **kwargs)
import pakfire
from . import base
-from . import logs
from . import misc
from .constants import *
return self._get_repository("SELECT * FROM repositories \
WHERE id = %s", repo_id)
- def get_history(self, limit=None, offset=None, build=None, repo=None, user=None):
- query = "SELECT * FROM repositories_history"
- args = []
-
- query += " ORDER BY time DESC"
-
- if limit:
- if offset:
- query += " LIMIT %s,%s"
- args += [offset, limit,]
- else:
- query += " LIMIT %s"
- args += [limit,]
-
- entries = []
- for entry in self.db.query(query, *args):
- entry = logs.RepositoryLogEntry(self.pakfire, entry)
- entries.append(entry)
-
- return entries
-
async def write(self):
"""
Write/re-write all repositories
# XXX TODO
return []
- def _log_build(self, action, build, from_repo=None, to_repo=None, user=None):
- user_id = None
- if user:
- user_id = user.id
-
- from_repo_id = None
- if from_repo:
- from_repo_id = from_repo.id
-
- to_repo_id = None
- if to_repo:
- to_repo_id = to_repo.id
-
- self.db.execute("INSERT INTO repositories_history(action, build_id, from_repo_id, to_repo_id, user_id, time) \
- VALUES(%s, %s, %s, %s, %s, NOW())", action, build.id, from_repo_id, to_repo_id, user_id)
-
def add_build(self, build, user=None, log=True):
self.db.execute("INSERT INTO repositories_builds(repo_id, build_id, time_added)"
" VALUES(%s, %s, NOW())", self.id, build.id)
return { row.arch : row.size for row in res if row.arch in self.distro.arches }
- def get_history(self, **kwargs):
- kwargs.update({
- "repo" : self,
- })
-
- return self.pakfire.repos.get_history(**kwargs)
-
# Write repository
async def write(self, *args, **kwargs):
);
---
--- Name: builders_history; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.builders_history (
- id integer NOT NULL,
- builder_id integer NOT NULL,
- action text NOT NULL,
- user_id integer,
- "time" timestamp without time zone NOT NULL
-);
-
-
---
--- Name: builders_history_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.builders_history_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: builders_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.builders_history_id_seq OWNED BY public.builders_history.id;
-
-
--
-- Name: builders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
ALTER SEQUENCE public.builds_comments_id_seq OWNED BY public.builds_comments.id;
---
--- Name: builds_history; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.builds_history (
- id integer NOT NULL,
- build_id integer NOT NULL,
- action text NOT NULL,
- user_id integer,
- "time" timestamp without time zone NOT NULL,
- bug_id integer
-);
-
-
---
--- Name: builds_history_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.builds_history_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: builds_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.builds_history_id_seq OWNED BY public.builds_history.id;
-
-
--
-- Name: builds_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
);
---
--- Name: jobs_history; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.jobs_history (
- job_id integer NOT NULL,
- action text NOT NULL,
- state text,
- user_id integer,
- "time" timestamp without time zone NOT NULL,
- builder_id integer,
- test_job_id integer
-);
-
-
--
-- Name: jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
ALTER SEQUENCE public.mirrors_checks_id_seq OWNED BY public.mirrors_checks.id;
---
--- Name: mirrors_history; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.mirrors_history (
- id integer NOT NULL,
- mirror_id integer NOT NULL,
- action text NOT NULL,
- user_id integer,
- "time" timestamp without time zone NOT NULL
-);
-
-
---
--- Name: mirrors_history_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.mirrors_history_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: mirrors_history_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.mirrors_history_id_seq OWNED BY public.mirrors_history.id;
-
-
--
-- Name: mirrors_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
ALTER SEQUENCE public.repositories_builds_id_seq OWNED BY public.repositories_builds.id;
---
--- Name: repositories_history; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.repositories_history (
- build_id bigint NOT NULL,
- action text NOT NULL,
- from_repo_id integer,
- to_repo_id integer,
- user_id integer,
- "time" timestamp without time zone NOT NULL
-);
-
-
--
-- Name: repositories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
ALTER TABLE ONLY public.builders ALTER COLUMN id SET DEFAULT nextval('public.builders_id_seq'::regclass);
---
--- Name: builders_history id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.builders_history ALTER COLUMN id SET DEFAULT nextval('public.builders_history_id_seq'::regclass);
-
-
--
-- Name: builds id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.builds_comments ALTER COLUMN id SET DEFAULT nextval('public.builds_comments_id_seq'::regclass);
---
--- Name: builds_history id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.builds_history ALTER COLUMN id SET DEFAULT nextval('public.builds_history_id_seq'::regclass);
-
-
--
-- Name: distributions id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.mirrors_checks ALTER COLUMN id SET DEFAULT nextval('public.mirrors_checks_id_seq'::regclass);
---
--- Name: mirrors_history id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.mirrors_history ALTER COLUMN id SET DEFAULT nextval('public.mirrors_history_id_seq'::regclass);
-
-
--
-- Name: packages id; Type: DEFAULT; Schema: public; Owner: -
--
ADD CONSTRAINT idx_2197954_primary PRIMARY KEY (id);
---
--- Name: builders_history idx_2197982_primary; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.builders_history
- ADD CONSTRAINT idx_2197982_primary PRIMARY KEY (id);
-
-
--
-- Name: builds_bugs_updates idx_2198008_primary; Type: CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT idx_2198018_primary PRIMARY KEY (id);
---
--- Name: builds_history idx_2198027_primary; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.builds_history
- ADD CONSTRAINT idx_2198027_primary PRIMARY KEY (id);
-
-
--
-- Name: images_types idx_2198057_primary; Type: CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT idx_2198115_primary PRIMARY KEY (id);
---
--- Name: mirrors_history idx_2198126_primary; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.mirrors_history
- ADD CONSTRAINT idx_2198126_primary PRIMARY KEY (id);
-
-
--
-- Name: packages_properties idx_2198147_primary; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE public.filelists CLUSTER ON filelists_pkg_id;
---
--- Name: idx_2197982_builder_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_2197982_builder_id ON public.builders_history USING btree (builder_id);
-
-
--
-- Name: idx_2198018_build_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idx_2198018_user_id ON public.builds_comments USING btree (user_id);
---
--- Name: idx_2198080_job_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_2198080_job_id ON public.jobs_history USING btree (job_id);
-
-
--
-- Name: idx_2198147_name; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX idx_2198189_build_id ON public.repositories_builds USING btree (build_id);
---
--- Name: idx_2198193_build_id; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE INDEX idx_2198193_build_id ON public.repositories_history USING btree (build_id);
-
-
--
-- Name: idx_2198199_k; Type: INDEX; Schema: public; Owner: -
--
ADD CONSTRAINT builder_stats_builder_id FOREIGN KEY (builder_id) REFERENCES public.builders(id);
---
--- Name: builders_history builders_history_builder_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.builders_history
- ADD CONSTRAINT builders_history_builder_id FOREIGN KEY (builder_id) REFERENCES public.builders(id);
-
-
---
--- Name: builders_history builders_history_user_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.builders_history
- ADD CONSTRAINT builders_history_user_id FOREIGN KEY (user_id) REFERENCES public.users(id);
-
-
--
-- Name: builds builds_build_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT builds_comments_user_id FOREIGN KEY (user_id) REFERENCES public.users(id);
---
--- Name: builds_history builds_history_build_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.builds_history
- ADD CONSTRAINT builds_history_build_id FOREIGN KEY (build_id) REFERENCES public.builds(id);
-
-
---
--- Name: builds_history builds_history_user_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.builds_history
- ADD CONSTRAINT builds_history_user_id FOREIGN KEY (user_id) REFERENCES public.users(id);
-
-
--
-- Name: builds builds_owner_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT jobs_buildroots_job_id FOREIGN KEY (job_id) REFERENCES public.jobs(id);
---
--- Name: jobs_history jobs_history_builder_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.jobs_history
- ADD CONSTRAINT jobs_history_builder_id FOREIGN KEY (builder_id) REFERENCES public.builders(id);
-
-
---
--- Name: jobs_history jobs_history_job_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.jobs_history
- ADD CONSTRAINT jobs_history_job_id FOREIGN KEY (job_id) REFERENCES public.jobs(id);
-
-
---
--- Name: jobs_history jobs_history_test_job_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.jobs_history
- ADD CONSTRAINT jobs_history_test_job_id FOREIGN KEY (test_job_id) REFERENCES public.jobs(id);
-
-
---
--- Name: jobs_history jobs_history_user_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.jobs_history
- ADD CONSTRAINT jobs_history_user_id FOREIGN KEY (user_id) REFERENCES public.users(id);
-
-
--
-- Name: jobs_packages jobs_packaged_job_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT mirrors_checks_mirror_id FOREIGN KEY (mirror_id) REFERENCES public.mirrors(id);
---
--- Name: mirrors_history mirrors_history_mirror_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.mirrors_history
- ADD CONSTRAINT mirrors_history_mirror_id FOREIGN KEY (mirror_id) REFERENCES public.mirrors(id);
-
-
---
--- Name: mirrors_history mirrors_history_user_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.mirrors_history
- ADD CONSTRAINT mirrors_history_user_id FOREIGN KEY (user_id) REFERENCES public.users(id);
-
-
--
-- Name: packages packages_commit_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT repositories_distro_id FOREIGN KEY (distro_id) REFERENCES public.distributions(id);
---
--- Name: repositories_history repositories_history_build_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.repositories_history
- ADD CONSTRAINT repositories_history_build_id FOREIGN KEY (build_id) REFERENCES public.builds(id);
-
-
---
--- Name: repositories_history repositories_history_from_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.repositories_history
- ADD CONSTRAINT repositories_history_from_repo_id FOREIGN KEY (from_repo_id) REFERENCES public.repositories(id);
-
-
---
--- Name: repositories_history repositories_history_to_repo_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.repositories_history
- ADD CONSTRAINT repositories_history_to_repo_id FOREIGN KEY (to_repo_id) REFERENCES public.repositories(id);
-
-
---
--- Name: repositories_history repositories_history_user_id; Type: FK CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.repositories_history
- ADD CONSTRAINT repositories_history_user_id FOREIGN KEY (user_id) REFERENCES public.users(id);
-
-
--
-- Name: repositories repositories_key_id; Type: FK CONSTRAINT; Schema: public; Owner: -
--
{% module JobsList(builder.jobs) %}
{% end %}
-
- {% if log %}
- <div class="row">
- <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
- <h3>{{ _("Log") }}</h3>
- {% module Log(log) %}
- </div>
- </div>
- {% end %}
{% end block %}
</div>
</div>
</div>
-
- {% if log %}
- <div class="row">
- <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
- <h3>{{ _("Log") }}</h3>
- {% module Log(log) %}
- </div>
- </div>
- {% end %}
-
{% end block %}
</div>
</div>
{% end %}
-
- {% if log %}
- <div class="row">
- <div class="col-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
- <h2>{{ _("Log") }}</h2>
- {% module Log(log) %}
- </div>
- </div>
- {% end %}
{% end block %}
if not builder:
raise tornado.web.HTTPError(404, "Could not find builder %s" % hostname)
- # Get log.
- log = builder.get_history(limit=5)
-
- self.render("builders/detail.html", builder=builder, log=log)
+ self.render("builders/detail.html", builder=builder)
class BuilderNewHandler(base.BaseHandler):
class MirrorListHandler(base.BaseHandler):
def get(self):
- self.render("mirrors/list.html", mirrors=self.backend.mirrors,
- log=self.backend.mirrors.get_history(limit=5))
+ self.render("mirrors/list.html", mirrors=self.backend.mirrors)
class MirrorDetailHandler(base.BaseHandler):
if not mirror:
raise tornado.web.HTTPError(404, "Could not find mirror: %s" % hostname)
- log = self.backend.mirrors.get_history(mirror=mirror, limit=10)
-
- self.render("mirrors/detail.html", mirror=mirror, log=log)
+ self.render("mirrors/detail.html", mirror=mirror)
class MirrorNewHandler(base.BaseHandler):