add group and summary fields

This commit is contained in:
2025-04-20 08:41:36 +03:00
parent b46dd41ada
commit c51d1d9202
10 changed files with 179 additions and 55 deletions

View File

@ -31,7 +31,7 @@ import (
// CurrentVersion is the current version of the database.
// The database is reset if its version doesn't match this.
const CurrentVersion = 3
const CurrentVersion = 4
// Package is a ALR package's database representation
type Package struct {
@ -40,7 +40,9 @@ type Package struct {
Version string `sh:"version,required" db:"version"`
Release int `sh:"release,required" db:"release"`
Epoch uint `sh:"epoch" db:"epoch"`
Summary JSON[map[string]string] `db:"summary"`
Description JSON[map[string]string] `db:"description"`
Group JSON[map[string]string] `db:"group_name"`
Homepage JSON[map[string]string] `db:"homepage"`
Maintainer JSON[map[string]string] `db:"maintainer"`
Architectures JSON[[]string] `sh:"architectures" db:"architectures"`
@ -106,7 +108,9 @@ func (d *Database) initDB(ctx context.Context) error {
version TEXT NOT NULL,
release INT NOT NULL,
epoch INT,
summary TEXT CHECK(summary = 'null' OR (JSON_VALID(summary) AND JSON_TYPE(summary) = 'object')),
description TEXT CHECK(description = 'null' OR (JSON_VALID(description) AND JSON_TYPE(description) = 'object')),
group_name TEXT CHECK(group_name = 'null' OR (JSON_VALID(group_name) AND JSON_TYPE(group_name) = 'object')),
homepage TEXT CHECK(homepage = 'null' OR (JSON_VALID(homepage) AND JSON_TYPE(homepage) = 'object')),
maintainer TEXT CHECK(maintainer = 'null' OR (JSON_VALID(maintainer) AND JSON_TYPE(maintainer) = 'object')),
architectures TEXT CHECK(architectures = 'null' OR (JSON_VALID(architectures) AND JSON_TYPE(architectures) = 'array')),
@ -204,7 +208,9 @@ func (d *Database) InsertPackage(ctx context.Context, pkg Package) error {
version,
release,
epoch,
summary,
description,
group_name,
homepage,
maintainer,
architectures,
@ -222,7 +228,9 @@ func (d *Database) InsertPackage(ctx context.Context, pkg Package) error {
:version,
:release,
:epoch,
:summary,
:description,
:group_name,
:homepage,
:maintainer,
:architectures,

View File

@ -157,6 +157,8 @@ type ResolvedPackage struct {
Version string `sh:"version"`
Release int `sh:"release"`
Epoch uint `sh:"epoch"`
Group string `db:"group_name"`
Summary string `db:"summary"`
Description string `db:"description"`
Homepage string `db:"homepage"`
Maintainer string `db:"maintainer"`

View File

@ -274,11 +274,11 @@ msgstr ""
msgid "OPTIONS"
msgstr ""
#: internal/db/db.go:133
#: internal/db/db.go:137
msgid "Database version mismatch; resetting"
msgstr ""
#: internal/db/db.go:140
#: internal/db/db.go:144
msgid ""
"Database version does not exist. Run alr fix if something isn't working."
msgstr ""
@ -397,15 +397,15 @@ msgstr ""
msgid "Building package metadata"
msgstr ""
#: pkg/build/script_executor.go:356
#: pkg/build/script_executor.go:368
msgid "Executing prepare()"
msgstr ""
#: pkg/build/script_executor.go:365
#: pkg/build/script_executor.go:377
msgid "Executing build()"
msgstr ""
#: pkg/build/script_executor.go:394 pkg/build/script_executor.go:414
#: pkg/build/script_executor.go:406 pkg/build/script_executor.go:426
msgid "Executing %s()"
msgstr ""
@ -471,39 +471,39 @@ msgstr ""
msgid "Pull all repositories that have changed"
msgstr ""
#: search.go:36
#: search.go:40
msgid "Search packages"
msgstr ""
#: search.go:42
#: search.go:51
msgid "Search by name"
msgstr ""
#: search.go:47
#: search.go:56
msgid "Search by description"
msgstr ""
#: search.go:52
#: search.go:61
msgid "Search by repository"
msgstr ""
#: search.go:57
#: search.go:66
msgid "Search by provides"
msgstr ""
#: search.go:62
#: search.go:71
msgid "Format output using a Go template"
msgstr ""
#: search.go:96
#: search.go:130
msgid "Error while executing search"
msgstr ""
#: search.go:104
#: search.go:138
msgid "Error parsing format template"
msgstr ""
#: search.go:112
#: search.go:153
msgid "Error executing template"
msgstr ""

View File

@ -12,8 +12,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
"X-Generator: Gtranslator 48.0\n"
#: build.go:42
@ -281,11 +281,11 @@ msgstr "КАТЕГОРИЯ"
msgid "OPTIONS"
msgstr "ПАРАМЕТРЫ"
#: internal/db/db.go:133
#: internal/db/db.go:137
msgid "Database version mismatch; resetting"
msgstr "Несоответствие версий базы данных; сброс настроек"
#: internal/db/db.go:140
#: internal/db/db.go:144
msgid ""
"Database version does not exist. Run alr fix if something isn't working."
msgstr ""
@ -409,15 +409,15 @@ msgstr ""
msgid "Building package metadata"
msgstr "Сборка метаданных пакета"
#: pkg/build/script_executor.go:356
#: pkg/build/script_executor.go:368
msgid "Executing prepare()"
msgstr "Выполнение prepare()"
#: pkg/build/script_executor.go:365
#: pkg/build/script_executor.go:377
msgid "Executing build()"
msgstr "Выполнение build()"
#: pkg/build/script_executor.go:394 pkg/build/script_executor.go:414
#: pkg/build/script_executor.go:406 pkg/build/script_executor.go:426
msgid "Executing %s()"
msgstr "Выполнение %s()"
@ -485,39 +485,39 @@ msgstr "Ошибка при удалении пакетов из базы дан
msgid "Pull all repositories that have changed"
msgstr "Скачать все изменённые репозитории"
#: search.go:36
#: search.go:40
msgid "Search packages"
msgstr "Поиск пакетов"
#: search.go:42
#: search.go:51
msgid "Search by name"
msgstr "Искать по имени"
#: search.go:47
#: search.go:56
msgid "Search by description"
msgstr "Искать по описанию"
#: search.go:52
#: search.go:61
msgid "Search by repository"
msgstr "Искать по репозиторию"
#: search.go:57
#: search.go:66
msgid "Search by provides"
msgstr "Иcкать по provides"
#: search.go:62
#: search.go:71
msgid "Format output using a Go template"
msgstr "Формат выходных данных с использованием шаблона Go"
#: search.go:96
#: search.go:130
msgid "Error while executing search"
msgstr "Ошибка при выполнении поиска"
#: search.go:104
#: search.go:138
msgid "Error parsing format template"
msgstr "Ошибка при разборе шаблона"
#: search.go:112
#: search.go:153
msgid "Error executing template"
msgstr "Ошибка при выполнении шаблона"

View File

@ -20,10 +20,6 @@
package types
type BuildOpts struct {
// Script string
// Repository string
// Packages []string
// Manager manager.Manager
Clean bool
Interactive bool
}
@ -32,7 +28,9 @@ type BuildVarsPre struct {
Version string `sh:"version,required"`
Release int `sh:"release,required"`
Epoch uint `sh:"epoch"`
Summary string `sh:"summary"`
Description string `sh:"desc"`
Group string `sh:"group"`
Homepage string `sh:"homepage"`
Maintainer string `sh:"maintainer"`
Architectures []string `sh:"architectures"`