We probably need something very similar, but we won't need it right now.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/templates/jobs-buildroot.html \
src/templates/log.html \
src/templates/login.html \
- src/templates/package-properties.html \
src/templates/queue.html \
src/templates/search.html \
src/templates/source-list.html
"""
return await self.backend.open(self.path)
- ## properties
-
- def update_property(self, key, value):
- if self.properties:
- self.db.execute("UPDATE packages_properties SET %s = %%s \
- WHERE name = %%s" % key, value, self.name)
- else:
- self.db.execute("INSERT INTO packages_properties(name, %s) \
- VALUES(%%s, %%s)" % key, self.name, value)
-
- # Update cache
- self.properties[key] = value
-
- @lazy_property
- def properties(self):
- res = self.db.get("SELECT * FROM packages_properties WHERE name = %s", self.name)
-
- ret = {}
- if res:
- for key in res:
- if key in ("id", "name"):
- continue
-
- ret[key] = res[key]
-
- return ret
-
class File(base.Object):
def init(self, package, data):
ALTER SEQUENCE public.packages_id_seq OWNED BY public.packages.id;
---
--- Name: packages_properties; Type: TABLE; Schema: public; Owner: -
---
-
-CREATE TABLE public.packages_properties (
- id integer NOT NULL,
- name text NOT NULL,
- priority integer DEFAULT 0 NOT NULL
-);
-
-
---
--- Name: packages_properties_id_seq; Type: SEQUENCE; Schema: public; Owner: -
---
-
-CREATE SEQUENCE public.packages_properties_id_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
-
-
---
--- Name: packages_properties_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
---
-
-ALTER SEQUENCE public.packages_properties_id_seq OWNED BY public.packages_properties.id;
-
-
--
-- Name: relation_sizes; Type: VIEW; Schema: public; Owner: -
--
ALTER TABLE ONLY public.packages ALTER COLUMN id SET DEFAULT nextval('public.packages_id_seq'::regclass);
---
--- Name: packages_properties id; Type: DEFAULT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.packages_properties ALTER COLUMN id SET DEFAULT nextval('public.packages_properties_id_seq'::regclass);
-
-
--
-- Name: repositories id; Type: DEFAULT; Schema: public; Owner: -
--
ADD CONSTRAINT idx_2198115_primary PRIMARY KEY (id);
---
--- Name: packages_properties idx_2198147_primary; Type: CONSTRAINT; Schema: public; Owner: -
---
-
-ALTER TABLE ONLY public.packages_properties
- ADD CONSTRAINT idx_2198147_primary PRIMARY KEY (id);
-
-
--
-- Name: repositories_builds idx_2198189_primary; Type: CONSTRAINT; Schema: public; Owner: -
--
CREATE UNIQUE INDEX distributions_slug ON public.distributions USING btree (slug) WHERE (deleted IS FALSE);
---
--- Name: idx_2198147_name; Type: INDEX; Schema: public; Owner: -
---
-
-CREATE UNIQUE INDEX idx_2198147_name ON public.packages_properties USING btree (name);
-
-
--
-- Name: idx_2198189_build_id; Type: INDEX; Schema: public; Owner: -
--
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}{{ _("Package") }} {{ pkg.name }}{% end block %}
-
-{% block body %}
- <ul class="breadcrumb">
- <li>
- <a href="/">{{ _("Home") }}</a>
- <span class="divider">/</span>
- </li>
- <li>
- <a href="/packages">{{ _("Packages") }}</a>
- <span class="divider">/</span>
- </li>
- <li>
- <a href="/package/{{ pkg.name }}">{{ pkg.name }}</a>
- <span class="divider">/</span>
- </li>
- <li class="active">
- <a href="/package/{{ pkg.name }}/properties">{{ _("Properties") }}</a>
- </li>
- </ul>
-
- {% module BuildHeadline(build, shorter=True) %}
-
- <div class="row">
- <div class="span8">
- <form class="form form-horizontal" method="POST" action="">
- {% raw xsrf_form_html() %}
-
- <fieldset>
- <legend>{{ _("Maintainers") }}</legend>
-
- </fieldset>
-
- <fieldset>
- <legend>{{ _("Default priority") }}</legend>
- <p>
- {{ _("A big benefit of the Pakfire Build Service is, that builds are available to end-users in a very short time.") }}
- {{ _("Some packages might need some extra boost if the build servers are very busy.") }}
- </p>
- <p>
- {{ _("You may set a default priority for all builds of this package.") }}
- </p>
-
- <div class="control-group">
- <label class="control-label" for="priority">{{ _("Default priority") }}</label>
- <div class="controls">
- <select name="priority" id="priority">
- <option value="2" {% if properties.priority >= 2 %}selected="selected"{% end %}>
- {{ _("Very high") }}
- </option>
- <option value="1" {% if properties.priority == 1 %}selected="selected"{% end %}>
- {{ _("High") }}
- </option>
- <option value="0" {% if properties.priority == 0 %}selected="selected"{% end %}>
- {{ _("Medium") }}
- </option>
- <option value="-1" {% if properties.priority == -1 %}selected="selected"{% end %}>
- {{ _("Low") }}
- </option>
- <option value="-2" {% if properties.priority <= -2 %}selected="selected"{% end %}>
- {{ _("Very low") }}
- </option>
- </select>
- </div>
- </div>
- </fieldset>
-
- <fieldset>
- <legend>{{ _("Critical path") }}</legend>
- <p>
- {{ _("A package that belongs to the critical path is a package that plays a very essential role in the distribution.") }}
- {{ _("If such a package is broken, it may not be possible to boot or recover the system anymore, so we need to be extra sure that these packages work.") }}
- </p>
- <p>
- {{ _("If this package is marked to belong to the critical path, it will need a higher score to pass to the next repository and more.") }}
- <a href="/documents/critical-path">{{ _("Learn more.") }}</a>
- </p>
- </fieldset>
-
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">{{ _("Save changes") }}</button>
- <a class="btn" href="/package/{{ pkg.name }}">{{ _("Cancel") }}</a>
- </div>
- </form>
- </div>
- </div>
-{% end block %}
packages.FileDownloadHandler),
(r"/package/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/view(.*)",
packages.FileViewHandler),
- (r"/package/([\w\-\+]+)/properties", packages.PackagePropertiesHandler),
# Files
(r"/file/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})", FileDetailHandler),
self.render("packages/show.html", package=package)
-class PackagePropertiesHandler(base.BaseHandler):
- @tornado.web.authenticated
- def get(self, name):
- build = self.backend.builds.get_latest_by_name(name)
-
- if not build:
- raise tornado.web.HTTPError(404, "Package '%s' was not found" % name)
-
- # Check if the user has sufficient permissions.
- if not build.has_perm(self.current_user):
- raise tornado.web.HTTPError(403, "User %s is not allowed to manage build %s" \
- % (self.current_user, build))
-
- self.render("package-properties.html", build=build,
- pkg=build.pkg, properties=build.pkg.properties)
-
- @tornado.web.authenticated
- def post(self, name):
- build = self.backend.builds.get_latest_by_name(name)
-
- if not build:
- raise tornado.web.HTTPError(404, "Package '%s' was not found" % name)
-
- # Check if the user has sufficient permissions.
- if not build.has_perm(self.current_user):
- raise tornado.web.HTTPError(403, "User %s is not allowed to manage build %s" \
- % (self.current_user, build))
-
-
class FileDownloadHandler(base.BaseHandler):
async def get(self, uuid, path):
package = self.backend.packages.get_by_uuid(uuid)