verify pgp signature for a specific package only once

This commit is contained in:
2022-01-18 13:41:12 +01:00
parent 2dfdac8468
commit 907add4e07
11 changed files with 304 additions and 13 deletions

View File

@ -45,6 +45,8 @@ type DbPackage struct {
Lto dbpackage.Lto `json:"lto,omitempty"`
// LastVersionBuild holds the value of the "last_version_build" field.
LastVersionBuild string `json:"last_version_build,omitempty"`
// LastVerified holds the value of the "last_verified" field.
LastVerified time.Time `json:"last_verified,omitempty"`
}
// scanValues returns the types for scanning values from sql.Rows.
@ -58,7 +60,7 @@ func (*DbPackage) scanValues(columns []string) ([]interface{}, error) {
values[i] = new(sql.NullInt64)
case dbpackage.FieldPkgbase, dbpackage.FieldStatus, dbpackage.FieldSkipReason, dbpackage.FieldRepository, dbpackage.FieldMarch, dbpackage.FieldVersion, dbpackage.FieldRepoVersion, dbpackage.FieldHash, dbpackage.FieldLto, dbpackage.FieldLastVersionBuild:
values[i] = new(sql.NullString)
case dbpackage.FieldBuildTimeStart, dbpackage.FieldBuildTimeEnd, dbpackage.FieldUpdated:
case dbpackage.FieldBuildTimeStart, dbpackage.FieldBuildTimeEnd, dbpackage.FieldUpdated, dbpackage.FieldLastVerified:
values[i] = new(sql.NullTime)
default:
return nil, fmt.Errorf("unexpected column %q for type DbPackage", columns[i])
@ -167,6 +169,12 @@ func (dp *DbPackage) assignValues(columns []string, values []interface{}) error
} else if value.Valid {
dp.LastVersionBuild = value.String
}
case dbpackage.FieldLastVerified:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field last_verified", values[i])
} else if value.Valid {
dp.LastVerified = value.Time
}
}
}
return nil
@ -223,6 +231,8 @@ func (dp *DbPackage) String() string {
builder.WriteString(fmt.Sprintf("%v", dp.Lto))
builder.WriteString(", last_version_build=")
builder.WriteString(dp.LastVersionBuild)
builder.WriteString(", last_verified=")
builder.WriteString(dp.LastVerified.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}

View File

@ -39,6 +39,8 @@ const (
FieldLto = "lto"
// FieldLastVersionBuild holds the string denoting the last_version_build field in the database.
FieldLastVersionBuild = "last_version_build"
// FieldLastVerified holds the string denoting the last_verified field in the database.
FieldLastVerified = "last_verified"
// Table holds the table name of the dbpackage in the database.
Table = "db_packages"
)
@ -60,6 +62,7 @@ var Columns = []string{
FieldHash,
FieldLto,
FieldLastVersionBuild,
FieldLastVerified,
}
// ValidColumn reports if the column name is valid (part of the table columns).

View File

@ -162,6 +162,13 @@ func LastVersionBuild(v string) predicate.DbPackage {
})
}
// LastVerified applies equality check predicate on the "last_verified" field. It's identical to LastVerifiedEQ.
func LastVerified(v time.Time) predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldLastVerified), v))
})
}
// PkgbaseEQ applies the EQ predicate on the "pkgbase" field.
func PkgbaseEQ(v string) predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
@ -1465,6 +1472,96 @@ func LastVersionBuildContainsFold(v string) predicate.DbPackage {
})
}
// LastVerifiedEQ applies the EQ predicate on the "last_verified" field.
func LastVerifiedEQ(v time.Time) predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
s.Where(sql.EQ(s.C(FieldLastVerified), v))
})
}
// LastVerifiedNEQ applies the NEQ predicate on the "last_verified" field.
func LastVerifiedNEQ(v time.Time) predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
s.Where(sql.NEQ(s.C(FieldLastVerified), v))
})
}
// LastVerifiedIn applies the In predicate on the "last_verified" field.
func LastVerifiedIn(vs ...time.Time) predicate.DbPackage {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.In(s.C(FieldLastVerified), v...))
})
}
// LastVerifiedNotIn applies the NotIn predicate on the "last_verified" field.
func LastVerifiedNotIn(vs ...time.Time) predicate.DbPackage {
v := make([]interface{}, len(vs))
for i := range v {
v[i] = vs[i]
}
return predicate.DbPackage(func(s *sql.Selector) {
// if not arguments were provided, append the FALSE constants,
// since we can't apply "IN ()". This will make this predicate falsy.
if len(v) == 0 {
s.Where(sql.False())
return
}
s.Where(sql.NotIn(s.C(FieldLastVerified), v...))
})
}
// LastVerifiedGT applies the GT predicate on the "last_verified" field.
func LastVerifiedGT(v time.Time) predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
s.Where(sql.GT(s.C(FieldLastVerified), v))
})
}
// LastVerifiedGTE applies the GTE predicate on the "last_verified" field.
func LastVerifiedGTE(v time.Time) predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
s.Where(sql.GTE(s.C(FieldLastVerified), v))
})
}
// LastVerifiedLT applies the LT predicate on the "last_verified" field.
func LastVerifiedLT(v time.Time) predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
s.Where(sql.LT(s.C(FieldLastVerified), v))
})
}
// LastVerifiedLTE applies the LTE predicate on the "last_verified" field.
func LastVerifiedLTE(v time.Time) predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
s.Where(sql.LTE(s.C(FieldLastVerified), v))
})
}
// LastVerifiedIsNil applies the IsNil predicate on the "last_verified" field.
func LastVerifiedIsNil() predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
s.Where(sql.IsNull(s.C(FieldLastVerified)))
})
}
// LastVerifiedNotNil applies the NotNil predicate on the "last_verified" field.
func LastVerifiedNotNil() predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {
s.Where(sql.NotNull(s.C(FieldLastVerified)))
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.DbPackage) predicate.DbPackage {
return predicate.DbPackage(func(s *sql.Selector) {

View File

@ -184,6 +184,20 @@ func (dpc *DbPackageCreate) SetNillableLastVersionBuild(s *string) *DbPackageCre
return dpc
}
// SetLastVerified sets the "last_verified" field.
func (dpc *DbPackageCreate) SetLastVerified(t time.Time) *DbPackageCreate {
dpc.mutation.SetLastVerified(t)
return dpc
}
// SetNillableLastVerified sets the "last_verified" field if the given value is not nil.
func (dpc *DbPackageCreate) SetNillableLastVerified(t *time.Time) *DbPackageCreate {
if t != nil {
dpc.SetLastVerified(*t)
}
return dpc
}
// Mutation returns the DbPackageMutation object of the builder.
func (dpc *DbPackageCreate) Mutation() *DbPackageMutation {
return dpc.mutation
@ -440,6 +454,14 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) {
})
_node.LastVersionBuild = value
}
if value, ok := dpc.mutation.LastVerified(); ok {
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
Type: field.TypeTime,
Value: value,
Column: dbpackage.FieldLastVerified,
})
_node.LastVerified = value
}
return _node, _spec
}

View File

@ -245,6 +245,26 @@ func (dpu *DbPackageUpdate) ClearLastVersionBuild() *DbPackageUpdate {
return dpu
}
// SetLastVerified sets the "last_verified" field.
func (dpu *DbPackageUpdate) SetLastVerified(t time.Time) *DbPackageUpdate {
dpu.mutation.SetLastVerified(t)
return dpu
}
// SetNillableLastVerified sets the "last_verified" field if the given value is not nil.
func (dpu *DbPackageUpdate) SetNillableLastVerified(t *time.Time) *DbPackageUpdate {
if t != nil {
dpu.SetLastVerified(*t)
}
return dpu
}
// ClearLastVerified clears the value of the "last_verified" field.
func (dpu *DbPackageUpdate) ClearLastVerified() *DbPackageUpdate {
dpu.mutation.ClearLastVerified()
return dpu
}
// Mutation returns the DbPackageMutation object of the builder.
func (dpu *DbPackageUpdate) Mutation() *DbPackageMutation {
return dpu.mutation
@ -498,6 +518,19 @@ func (dpu *DbPackageUpdate) sqlSave(ctx context.Context) (n int, err error) {
Column: dbpackage.FieldLastVersionBuild,
})
}
if value, ok := dpu.mutation.LastVerified(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeTime,
Value: value,
Column: dbpackage.FieldLastVerified,
})
}
if dpu.mutation.LastVerifiedCleared() {
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
Type: field.TypeTime,
Column: dbpackage.FieldLastVerified,
})
}
if n, err = sqlgraph.UpdateNodes(ctx, dpu.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{dbpackage.Label}
@ -735,6 +768,26 @@ func (dpuo *DbPackageUpdateOne) ClearLastVersionBuild() *DbPackageUpdateOne {
return dpuo
}
// SetLastVerified sets the "last_verified" field.
func (dpuo *DbPackageUpdateOne) SetLastVerified(t time.Time) *DbPackageUpdateOne {
dpuo.mutation.SetLastVerified(t)
return dpuo
}
// SetNillableLastVerified sets the "last_verified" field if the given value is not nil.
func (dpuo *DbPackageUpdateOne) SetNillableLastVerified(t *time.Time) *DbPackageUpdateOne {
if t != nil {
dpuo.SetLastVerified(*t)
}
return dpuo
}
// ClearLastVerified clears the value of the "last_verified" field.
func (dpuo *DbPackageUpdateOne) ClearLastVerified() *DbPackageUpdateOne {
dpuo.mutation.ClearLastVerified()
return dpuo
}
// Mutation returns the DbPackageMutation object of the builder.
func (dpuo *DbPackageUpdateOne) Mutation() *DbPackageMutation {
return dpuo.mutation
@ -1012,6 +1065,19 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage,
Column: dbpackage.FieldLastVersionBuild,
})
}
if value, ok := dpuo.mutation.LastVerified(); ok {
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
Type: field.TypeTime,
Value: value,
Column: dbpackage.FieldLastVerified,
})
}
if dpuo.mutation.LastVerifiedCleared() {
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
Type: field.TypeTime,
Column: dbpackage.FieldLastVerified,
})
}
_node = &DbPackage{config: dpuo.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues

View File

@ -25,6 +25,7 @@ var (
{Name: "hash", Type: field.TypeString, Nullable: true},
{Name: "lto", Type: field.TypeEnum, Nullable: true, Enums: []string{"enabled", "unknown", "disabled", "auto_disabled"}, Default: "unknown"},
{Name: "last_version_build", Type: field.TypeString, Nullable: true},
{Name: "last_verified", Type: field.TypeTime, Nullable: true},
}
// DbPackagesTable holds the schema information for the "db_packages" table.
DbPackagesTable = &schema.Table{

View File

@ -46,6 +46,7 @@ type DbPackageMutation struct {
hash *string
lto *dbpackage.Lto
last_version_build *string
last_verified *time.Time
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*DbPackage, error)
@ -778,6 +779,55 @@ func (m *DbPackageMutation) ResetLastVersionBuild() {
delete(m.clearedFields, dbpackage.FieldLastVersionBuild)
}
// SetLastVerified sets the "last_verified" field.
func (m *DbPackageMutation) SetLastVerified(t time.Time) {
m.last_verified = &t
}
// LastVerified returns the value of the "last_verified" field in the mutation.
func (m *DbPackageMutation) LastVerified() (r time.Time, exists bool) {
v := m.last_verified
if v == nil {
return
}
return *v, true
}
// OldLastVerified returns the old "last_verified" field's value of the DbPackage entity.
// If the DbPackage object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *DbPackageMutation) OldLastVerified(ctx context.Context) (v time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, fmt.Errorf("OldLastVerified is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, fmt.Errorf("OldLastVerified requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldLastVerified: %w", err)
}
return oldValue.LastVerified, nil
}
// ClearLastVerified clears the value of the "last_verified" field.
func (m *DbPackageMutation) ClearLastVerified() {
m.last_verified = nil
m.clearedFields[dbpackage.FieldLastVerified] = struct{}{}
}
// LastVerifiedCleared returns if the "last_verified" field was cleared in this mutation.
func (m *DbPackageMutation) LastVerifiedCleared() bool {
_, ok := m.clearedFields[dbpackage.FieldLastVerified]
return ok
}
// ResetLastVerified resets all changes to the "last_verified" field.
func (m *DbPackageMutation) ResetLastVerified() {
m.last_verified = nil
delete(m.clearedFields, dbpackage.FieldLastVerified)
}
// Where appends a list predicates to the DbPackageMutation builder.
func (m *DbPackageMutation) Where(ps ...predicate.DbPackage) {
m.predicates = append(m.predicates, ps...)
@ -797,7 +847,7 @@ func (m *DbPackageMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *DbPackageMutation) Fields() []string {
fields := make([]string, 0, 14)
fields := make([]string, 0, 15)
if m.pkgbase != nil {
fields = append(fields, dbpackage.FieldPkgbase)
}
@ -840,6 +890,9 @@ func (m *DbPackageMutation) Fields() []string {
if m.last_version_build != nil {
fields = append(fields, dbpackage.FieldLastVersionBuild)
}
if m.last_verified != nil {
fields = append(fields, dbpackage.FieldLastVerified)
}
return fields
}
@ -876,6 +929,8 @@ func (m *DbPackageMutation) Field(name string) (ent.Value, bool) {
return m.Lto()
case dbpackage.FieldLastVersionBuild:
return m.LastVersionBuild()
case dbpackage.FieldLastVerified:
return m.LastVerified()
}
return nil, false
}
@ -913,6 +968,8 @@ func (m *DbPackageMutation) OldField(ctx context.Context, name string) (ent.Valu
return m.OldLto(ctx)
case dbpackage.FieldLastVersionBuild:
return m.OldLastVersionBuild(ctx)
case dbpackage.FieldLastVerified:
return m.OldLastVerified(ctx)
}
return nil, fmt.Errorf("unknown DbPackage field %s", name)
}
@ -1020,6 +1077,13 @@ func (m *DbPackageMutation) SetField(name string, value ent.Value) error {
}
m.SetLastVersionBuild(v)
return nil
case dbpackage.FieldLastVerified:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetLastVerified(v)
return nil
}
return fmt.Errorf("unknown DbPackage field %s", name)
}
@ -1083,6 +1147,9 @@ func (m *DbPackageMutation) ClearedFields() []string {
if m.FieldCleared(dbpackage.FieldLastVersionBuild) {
fields = append(fields, dbpackage.FieldLastVersionBuild)
}
if m.FieldCleared(dbpackage.FieldLastVerified) {
fields = append(fields, dbpackage.FieldLastVerified)
}
return fields
}
@ -1130,6 +1197,9 @@ func (m *DbPackageMutation) ClearField(name string) error {
case dbpackage.FieldLastVersionBuild:
m.ClearLastVersionBuild()
return nil
case dbpackage.FieldLastVerified:
m.ClearLastVerified()
return nil
}
return fmt.Errorf("unknown DbPackage nullable field %s", name)
}
@ -1180,6 +1250,9 @@ func (m *DbPackageMutation) ResetField(name string) error {
case dbpackage.FieldLastVersionBuild:
m.ResetLastVersionBuild()
return nil
case dbpackage.FieldLastVerified:
m.ResetLastVerified()
return nil
}
return fmt.Errorf("unknown DbPackage field %s", name)
}

View File

@ -27,6 +27,7 @@ func (DbPackage) Fields() []ent.Field {
field.String("hash").Optional(),
field.Enum("lto").Values("enabled", "unknown", "disabled", "auto_disabled").Default("unknown").Optional(),
field.String("last_version_build").Optional(),
field.Time("last_verified").Optional(),
}
}

4
go.mod
View File

@ -11,8 +11,8 @@ require (
github.com/jackc/pgx/v4 v4.14.1
github.com/sirupsen/logrus v1.8.1
github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e // indirect
golang.org/x/sys v0.0.0-20211204120058-94396e421777 // indirect
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce // indirect
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/yaml.v2 v2.4.0
lukechampine.com/blake3 v1.1.7

12
go.sum
View File

@ -70,6 +70,7 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4=
github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4=
github.com/go-sql-driver/mysql v1.5.1-0.20200311113236-681ffa848bae/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
@ -220,6 +221,7 @@ github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
@ -239,6 +241,7 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
@ -282,9 +285,11 @@ github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4k
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M=
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@ -333,6 +338,8 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e h1:MUP6MR3rJ7Gk9LEia0LP2ytiH6MuCfs7qYz+47jGdD8=
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce h1:Roh6XWxHFKrPgC/EQhVubSAGQ6Ozk6IdxHSzt1mR0EI=
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -352,6 +359,7 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCc
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -410,6 +418,8 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211204120058-94396e421777 h1:QAkhGVjOxMa+n4mlsAWeAU+BMZmimQAaNiMu+iUi94E=
golang.org/x/sys v0.0.0-20211204120058-94396e421777/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -447,12 +457,14 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=

View File

@ -834,15 +834,21 @@ func housekeeping(repo string, wg *sync.WaitGroup) error {
continue
}
// check if pkg signature is valid
valid, err := mPackage.hasValidSignature()
if err != nil {
return err
}
if !valid {
log.Infof("[HK/%s/%s] invalid package signature", pkg.FullRepo, pkg.Pkgbase)
buildManager.repoPurge[pkg.FullRepo] <- []*BuildPackage{pkg}
continue
if pkg.DbPackage.LastVerified.Before(pkg.DbPackage.BuildTimeStart) {
err := pkg.DbPackage.Update().SetLastVerified(time.Now().UTC()).Exec(context.Background())
if err != nil {
return err
}
// check if pkg signature is valid
valid, err := mPackage.hasValidSignature()
if err != nil {
return err
}
if !valid {
log.Infof("[HK/%s/%s] invalid package signature", pkg.FullRepo, pkg.Pkgbase)
buildManager.repoPurge[pkg.FullRepo] <- []*BuildPackage{pkg}
continue
}
}
// compare db-version with repo version