diff --git a/config_dist.yaml b/config_dist.yaml index 4d80f69..27a92ab 100644 --- a/config_dist.yaml +++ b/config_dist.yaml @@ -27,7 +27,8 @@ db: basedir: repo: /var/lib/alhp/repo/ - work: /var/lib/alhp/chroot/ + work: /var/lib/alhp/workspace/ + debug: /var/lib/alhp/debug/ march: - x86-64-v3 diff --git a/ent/dbpackage.go b/ent/dbpackage.go index f12a7ae..998a098 100644 --- a/ent/dbpackage.go +++ b/ent/dbpackage.go @@ -47,6 +47,8 @@ type DbPackage struct { LastVersionBuild string `json:"last_version_build,omitempty"` // LastVerified holds the value of the "last_verified" field. LastVerified time.Time `json:"last_verified,omitempty"` + // DebugSymbols holds the value of the "debug_symbols" field. + DebugSymbols dbpackage.DebugSymbols `json:"debug_symbols,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([]byte) case dbpackage.FieldID: 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: + case dbpackage.FieldPkgbase, dbpackage.FieldStatus, dbpackage.FieldSkipReason, dbpackage.FieldRepository, dbpackage.FieldMarch, dbpackage.FieldVersion, dbpackage.FieldRepoVersion, dbpackage.FieldHash, dbpackage.FieldLto, dbpackage.FieldLastVersionBuild, dbpackage.FieldDebugSymbols: values[i] = new(sql.NullString) case dbpackage.FieldBuildTimeStart, dbpackage.FieldBuildTimeEnd, dbpackage.FieldUpdated, dbpackage.FieldLastVerified: values[i] = new(sql.NullTime) @@ -175,6 +177,12 @@ func (dp *DbPackage) assignValues(columns []string, values []interface{}) error } else if value.Valid { dp.LastVerified = value.Time } + case dbpackage.FieldDebugSymbols: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field debug_symbols", values[i]) + } else if value.Valid { + dp.DebugSymbols = dbpackage.DebugSymbols(value.String) + } } } return nil @@ -233,6 +241,8 @@ func (dp *DbPackage) String() string { builder.WriteString(dp.LastVersionBuild) builder.WriteString(", last_verified=") builder.WriteString(dp.LastVerified.Format(time.ANSIC)) + builder.WriteString(", debug_symbols=") + builder.WriteString(fmt.Sprintf("%v", dp.DebugSymbols)) builder.WriteByte(')') return builder.String() } diff --git a/ent/dbpackage/dbpackage.go b/ent/dbpackage/dbpackage.go index 42b60f4..02a3eac 100644 --- a/ent/dbpackage/dbpackage.go +++ b/ent/dbpackage/dbpackage.go @@ -41,6 +41,8 @@ const ( FieldLastVersionBuild = "last_version_build" // FieldLastVerified holds the string denoting the last_verified field in the database. FieldLastVerified = "last_verified" + // FieldDebugSymbols holds the string denoting the debug_symbols field in the database. + FieldDebugSymbols = "debug_symbols" // Table holds the table name of the dbpackage in the database. Table = "db_packages" ) @@ -63,6 +65,7 @@ var Columns = []string{ FieldLto, FieldLastVersionBuild, FieldLastVerified, + FieldDebugSymbols, } // ValidColumn reports if the column name is valid (part of the table columns). @@ -165,3 +168,30 @@ func LtoValidator(l Lto) error { return fmt.Errorf("dbpackage: invalid enum value for lto field: %q", l) } } + +// DebugSymbols defines the type for the "debug_symbols" enum field. +type DebugSymbols string + +// DebugSymbolsUnknown is the default value of the DebugSymbols enum. +const DefaultDebugSymbols = DebugSymbolsUnknown + +// DebugSymbols values. +const ( + DebugSymbolsAvailable DebugSymbols = "available" + DebugSymbolsUnknown DebugSymbols = "unknown" + DebugSymbolsNotAvailable DebugSymbols = "not_available" +) + +func (ds DebugSymbols) String() string { + return string(ds) +} + +// DebugSymbolsValidator is a validator for the "debug_symbols" field enum values. It is called by the builders before save. +func DebugSymbolsValidator(ds DebugSymbols) error { + switch ds { + case DebugSymbolsAvailable, DebugSymbolsUnknown, DebugSymbolsNotAvailable: + return nil + default: + return fmt.Errorf("dbpackage: invalid enum value for debug_symbols field: %q", ds) + } +} diff --git a/ent/dbpackage/where.go b/ent/dbpackage/where.go index 66532f7..6998348 100644 --- a/ent/dbpackage/where.go +++ b/ent/dbpackage/where.go @@ -1562,6 +1562,68 @@ func LastVerifiedNotNil() predicate.DbPackage { }) } +// DebugSymbolsEQ applies the EQ predicate on the "debug_symbols" field. +func DebugSymbolsEQ(v DebugSymbols) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldDebugSymbols), v)) + }) +} + +// DebugSymbolsNEQ applies the NEQ predicate on the "debug_symbols" field. +func DebugSymbolsNEQ(v DebugSymbols) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.NEQ(s.C(FieldDebugSymbols), v)) + }) +} + +// DebugSymbolsIn applies the In predicate on the "debug_symbols" field. +func DebugSymbolsIn(vs ...DebugSymbols) 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(FieldDebugSymbols), v...)) + }) +} + +// DebugSymbolsNotIn applies the NotIn predicate on the "debug_symbols" field. +func DebugSymbolsNotIn(vs ...DebugSymbols) 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(FieldDebugSymbols), v...)) + }) +} + +// DebugSymbolsIsNil applies the IsNil predicate on the "debug_symbols" field. +func DebugSymbolsIsNil() predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldDebugSymbols))) + }) +} + +// DebugSymbolsNotNil applies the NotNil predicate on the "debug_symbols" field. +func DebugSymbolsNotNil() predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldDebugSymbols))) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.DbPackage) predicate.DbPackage { return predicate.DbPackage(func(s *sql.Selector) { diff --git a/ent/dbpackage_create.go b/ent/dbpackage_create.go index 20be6c2..7e91d4c 100644 --- a/ent/dbpackage_create.go +++ b/ent/dbpackage_create.go @@ -198,6 +198,20 @@ func (dpc *DbPackageCreate) SetNillableLastVerified(t *time.Time) *DbPackageCrea return dpc } +// SetDebugSymbols sets the "debug_symbols" field. +func (dpc *DbPackageCreate) SetDebugSymbols(ds dbpackage.DebugSymbols) *DbPackageCreate { + dpc.mutation.SetDebugSymbols(ds) + return dpc +} + +// SetNillableDebugSymbols sets the "debug_symbols" field if the given value is not nil. +func (dpc *DbPackageCreate) SetNillableDebugSymbols(ds *dbpackage.DebugSymbols) *DbPackageCreate { + if ds != nil { + dpc.SetDebugSymbols(*ds) + } + return dpc +} + // Mutation returns the DbPackageMutation object of the builder. func (dpc *DbPackageCreate) Mutation() *DbPackageMutation { return dpc.mutation @@ -277,6 +291,10 @@ func (dpc *DbPackageCreate) defaults() { v := dbpackage.DefaultLto dpc.mutation.SetLto(v) } + if _, ok := dpc.mutation.DebugSymbols(); !ok { + v := dbpackage.DefaultDebugSymbols + dpc.mutation.SetDebugSymbols(v) + } } // check runs all checks and user-defined validators on the builder. @@ -315,6 +333,11 @@ func (dpc *DbPackageCreate) check() error { return &ValidationError{Name: "lto", err: fmt.Errorf(`ent: validator failed for field "DbPackage.lto": %w`, err)} } } + if v, ok := dpc.mutation.DebugSymbols(); ok { + if err := dbpackage.DebugSymbolsValidator(v); err != nil { + return &ValidationError{Name: "debug_symbols", err: fmt.Errorf(`ent: validator failed for field "DbPackage.debug_symbols": %w`, err)} + } + } return nil } @@ -462,6 +485,14 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) { }) _node.LastVerified = value } + if value, ok := dpc.mutation.DebugSymbols(); ok { + _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ + Type: field.TypeEnum, + Value: value, + Column: dbpackage.FieldDebugSymbols, + }) + _node.DebugSymbols = value + } return _node, _spec } diff --git a/ent/dbpackage_update.go b/ent/dbpackage_update.go index 46eed5f..2385c50 100644 --- a/ent/dbpackage_update.go +++ b/ent/dbpackage_update.go @@ -266,6 +266,26 @@ func (dpu *DbPackageUpdate) ClearLastVerified() *DbPackageUpdate { return dpu } +// SetDebugSymbols sets the "debug_symbols" field. +func (dpu *DbPackageUpdate) SetDebugSymbols(ds dbpackage.DebugSymbols) *DbPackageUpdate { + dpu.mutation.SetDebugSymbols(ds) + return dpu +} + +// SetNillableDebugSymbols sets the "debug_symbols" field if the given value is not nil. +func (dpu *DbPackageUpdate) SetNillableDebugSymbols(ds *dbpackage.DebugSymbols) *DbPackageUpdate { + if ds != nil { + dpu.SetDebugSymbols(*ds) + } + return dpu +} + +// ClearDebugSymbols clears the value of the "debug_symbols" field. +func (dpu *DbPackageUpdate) ClearDebugSymbols() *DbPackageUpdate { + dpu.mutation.ClearDebugSymbols() + return dpu +} + // Mutation returns the DbPackageMutation object of the builder. func (dpu *DbPackageUpdate) Mutation() *DbPackageMutation { return dpu.mutation @@ -348,6 +368,11 @@ func (dpu *DbPackageUpdate) check() error { return &ValidationError{Name: "lto", err: fmt.Errorf(`ent: validator failed for field "DbPackage.lto": %w`, err)} } } + if v, ok := dpu.mutation.DebugSymbols(); ok { + if err := dbpackage.DebugSymbolsValidator(v); err != nil { + return &ValidationError{Name: "debug_symbols", err: fmt.Errorf(`ent: validator failed for field "DbPackage.debug_symbols": %w`, err)} + } + } return nil } @@ -532,6 +557,19 @@ func (dpu *DbPackageUpdate) sqlSave(ctx context.Context) (n int, err error) { Column: dbpackage.FieldLastVerified, }) } + if value, ok := dpu.mutation.DebugSymbols(); ok { + _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ + Type: field.TypeEnum, + Value: value, + Column: dbpackage.FieldDebugSymbols, + }) + } + if dpu.mutation.DebugSymbolsCleared() { + _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ + Type: field.TypeEnum, + Column: dbpackage.FieldDebugSymbols, + }) + } if n, err = sqlgraph.UpdateNodes(ctx, dpu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{dbpackage.Label} @@ -789,6 +827,26 @@ func (dpuo *DbPackageUpdateOne) ClearLastVerified() *DbPackageUpdateOne { return dpuo } +// SetDebugSymbols sets the "debug_symbols" field. +func (dpuo *DbPackageUpdateOne) SetDebugSymbols(ds dbpackage.DebugSymbols) *DbPackageUpdateOne { + dpuo.mutation.SetDebugSymbols(ds) + return dpuo +} + +// SetNillableDebugSymbols sets the "debug_symbols" field if the given value is not nil. +func (dpuo *DbPackageUpdateOne) SetNillableDebugSymbols(ds *dbpackage.DebugSymbols) *DbPackageUpdateOne { + if ds != nil { + dpuo.SetDebugSymbols(*ds) + } + return dpuo +} + +// ClearDebugSymbols clears the value of the "debug_symbols" field. +func (dpuo *DbPackageUpdateOne) ClearDebugSymbols() *DbPackageUpdateOne { + dpuo.mutation.ClearDebugSymbols() + return dpuo +} + // Mutation returns the DbPackageMutation object of the builder. func (dpuo *DbPackageUpdateOne) Mutation() *DbPackageMutation { return dpuo.mutation @@ -878,6 +936,11 @@ func (dpuo *DbPackageUpdateOne) check() error { return &ValidationError{Name: "lto", err: fmt.Errorf(`ent: validator failed for field "DbPackage.lto": %w`, err)} } } + if v, ok := dpuo.mutation.DebugSymbols(); ok { + if err := dbpackage.DebugSymbolsValidator(v); err != nil { + return &ValidationError{Name: "debug_symbols", err: fmt.Errorf(`ent: validator failed for field "DbPackage.debug_symbols": %w`, err)} + } + } return nil } @@ -1079,6 +1142,19 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage, Column: dbpackage.FieldLastVerified, }) } + if value, ok := dpuo.mutation.DebugSymbols(); ok { + _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ + Type: field.TypeEnum, + Value: value, + Column: dbpackage.FieldDebugSymbols, + }) + } + if dpuo.mutation.DebugSymbolsCleared() { + _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ + Type: field.TypeEnum, + Column: dbpackage.FieldDebugSymbols, + }) + } _node = &DbPackage{config: dpuo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index e5fa961..aaac8e1 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -26,6 +26,7 @@ var ( {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}, + {Name: "debug_symbols", Type: field.TypeEnum, Nullable: true, Enums: []string{"available", "unknown", "not_available"}, Default: "unknown"}, } // DbPackagesTable holds the schema information for the "db_packages" table. DbPackagesTable = &schema.Table{ diff --git a/ent/mutation.go b/ent/mutation.go index f4e644e..8a9d7b1 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -48,6 +48,7 @@ type DbPackageMutation struct { lto *dbpackage.Lto last_version_build *string last_verified *time.Time + debug_symbols *dbpackage.DebugSymbols clearedFields map[string]struct{} done bool oldValue func(context.Context) (*DbPackage, error) @@ -848,6 +849,55 @@ func (m *DbPackageMutation) ResetLastVerified() { delete(m.clearedFields, dbpackage.FieldLastVerified) } +// SetDebugSymbols sets the "debug_symbols" field. +func (m *DbPackageMutation) SetDebugSymbols(ds dbpackage.DebugSymbols) { + m.debug_symbols = &ds +} + +// DebugSymbols returns the value of the "debug_symbols" field in the mutation. +func (m *DbPackageMutation) DebugSymbols() (r dbpackage.DebugSymbols, exists bool) { + v := m.debug_symbols + if v == nil { + return + } + return *v, true +} + +// OldDebugSymbols returns the old "debug_symbols" 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) OldDebugSymbols(ctx context.Context) (v dbpackage.DebugSymbols, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldDebugSymbols is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldDebugSymbols requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldDebugSymbols: %w", err) + } + return oldValue.DebugSymbols, nil +} + +// ClearDebugSymbols clears the value of the "debug_symbols" field. +func (m *DbPackageMutation) ClearDebugSymbols() { + m.debug_symbols = nil + m.clearedFields[dbpackage.FieldDebugSymbols] = struct{}{} +} + +// DebugSymbolsCleared returns if the "debug_symbols" field was cleared in this mutation. +func (m *DbPackageMutation) DebugSymbolsCleared() bool { + _, ok := m.clearedFields[dbpackage.FieldDebugSymbols] + return ok +} + +// ResetDebugSymbols resets all changes to the "debug_symbols" field. +func (m *DbPackageMutation) ResetDebugSymbols() { + m.debug_symbols = nil + delete(m.clearedFields, dbpackage.FieldDebugSymbols) +} + // Where appends a list predicates to the DbPackageMutation builder. func (m *DbPackageMutation) Where(ps ...predicate.DbPackage) { m.predicates = append(m.predicates, ps...) @@ -867,7 +917,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, 15) + fields := make([]string, 0, 16) if m.pkgbase != nil { fields = append(fields, dbpackage.FieldPkgbase) } @@ -913,6 +963,9 @@ func (m *DbPackageMutation) Fields() []string { if m.last_verified != nil { fields = append(fields, dbpackage.FieldLastVerified) } + if m.debug_symbols != nil { + fields = append(fields, dbpackage.FieldDebugSymbols) + } return fields } @@ -951,6 +1004,8 @@ func (m *DbPackageMutation) Field(name string) (ent.Value, bool) { return m.LastVersionBuild() case dbpackage.FieldLastVerified: return m.LastVerified() + case dbpackage.FieldDebugSymbols: + return m.DebugSymbols() } return nil, false } @@ -990,6 +1045,8 @@ func (m *DbPackageMutation) OldField(ctx context.Context, name string) (ent.Valu return m.OldLastVersionBuild(ctx) case dbpackage.FieldLastVerified: return m.OldLastVerified(ctx) + case dbpackage.FieldDebugSymbols: + return m.OldDebugSymbols(ctx) } return nil, fmt.Errorf("unknown DbPackage field %s", name) } @@ -1104,6 +1161,13 @@ func (m *DbPackageMutation) SetField(name string, value ent.Value) error { } m.SetLastVerified(v) return nil + case dbpackage.FieldDebugSymbols: + v, ok := value.(dbpackage.DebugSymbols) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetDebugSymbols(v) + return nil } return fmt.Errorf("unknown DbPackage field %s", name) } @@ -1170,6 +1234,9 @@ func (m *DbPackageMutation) ClearedFields() []string { if m.FieldCleared(dbpackage.FieldLastVerified) { fields = append(fields, dbpackage.FieldLastVerified) } + if m.FieldCleared(dbpackage.FieldDebugSymbols) { + fields = append(fields, dbpackage.FieldDebugSymbols) + } return fields } @@ -1220,6 +1287,9 @@ func (m *DbPackageMutation) ClearField(name string) error { case dbpackage.FieldLastVerified: m.ClearLastVerified() return nil + case dbpackage.FieldDebugSymbols: + m.ClearDebugSymbols() + return nil } return fmt.Errorf("unknown DbPackage nullable field %s", name) } @@ -1273,6 +1343,9 @@ func (m *DbPackageMutation) ResetField(name string) error { case dbpackage.FieldLastVerified: m.ResetLastVerified() return nil + case dbpackage.FieldDebugSymbols: + m.ResetDebugSymbols() + return nil } return fmt.Errorf("unknown DbPackage field %s", name) } diff --git a/ent/schema/dbpackage.go b/ent/schema/dbpackage.go index bd2e6d5..4cbf057 100644 --- a/ent/schema/dbpackage.go +++ b/ent/schema/dbpackage.go @@ -28,6 +28,7 @@ func (DbPackage) Fields() []ent.Field { field.Enum("lto").Values("enabled", "unknown", "disabled", "auto_disabled").Default("unknown").Optional(), field.String("last_version_build").Optional(), field.Time("last_verified").Optional(), + field.Enum("debug_symbols").Values("available", "unknown", "not_available").Default("unknown").Optional(), } } diff --git a/go.sum b/go.sum index eea2367..d68bf99 100644 --- a/go.sum +++ b/go.sum @@ -120,9 +120,11 @@ github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope 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/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= +github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -141,7 +143,9 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -233,6 +237,7 @@ golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/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.9-0.20211216111533-8d383106f7e7 h1:M1gcVrIb2lSn2FIL19DG0+/b8nNVKJ7W7b4WcAGZAYM= 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= diff --git a/main.go b/main.go index 5bb64d5..5774adf 100644 --- a/main.go +++ b/main.go @@ -394,20 +394,23 @@ func (b *BuildManager) parseWorker() { func (b *BuildManager) htmlWorker() { type Pkg struct { - Pkgbase string - Status string - Class string - Skip string - Version string - Svn2GitVersion string - BuildDate string - BuildDuration time.Duration - Checked string - Log string - LTO bool - LTOUnknown bool - LTODisabled bool - LTOAutoDisabled bool + Pkgbase string + Status string + Class string + Skip string + Version string + Svn2GitVersion string + BuildDate string + BuildDuration time.Duration + Checked string + Log string + LTO bool + LTOUnknown bool + LTODisabled bool + LTOAutoDisabled bool + DebugSym bool + DebugSymNotAvailable bool + DebugSymUnknown bool } type Repo struct { @@ -487,6 +490,17 @@ func (b *BuildManager) htmlWorker() { addPkg.LTOAutoDisabled = true } + switch pkg.DebugSymbols { + case dbpackage.DebugSymbolsUnknown: + if pkg.Status != dbpackage.StatusSkipped && pkg.Status != dbpackage.StatusFailed { + addPkg.DebugSymUnknown = true + } + case dbpackage.DebugSymbolsAvailable: + addPkg.DebugSym = true + case dbpackage.DebugSymbolsNotAvailable: + addPkg.DebugSymNotAvailable = true + } + addRepo.Packages = append(addRepo.Packages, addPkg) } addMarch.Repos = append(addMarch.Repos, addRepo) @@ -565,7 +579,23 @@ func (b *BuildManager) repoWorker(repo string) { for _, pkg := range pkgL { pkg.toDbPackage(true) - pkg.DbPackage = pkg.DbPackage.Update().SetStatus(dbpackage.StatusLatest).ClearSkipReason().SetRepoVersion(pkg.Version).SetHash(pkg.Hash).SaveX(context.Background()) + if _, err := os.Stat(filepath.Join(conf.Basedir.Debug, pkg.March, pkg.DbPackage.Packages[0]+"-debug-"+pkg.Version+"-"+conf.Arch+".pkg.tar.zst")); err == nil { + pkg.DbPackage = pkg.DbPackage.Update(). + SetStatus(dbpackage.StatusLatest). + ClearSkipReason(). + SetDebugSymbols(dbpackage.DebugSymbolsAvailable). + SetRepoVersion(pkg.Version). + SetHash(pkg.Hash). + SaveX(context.Background()) + } else { + pkg.DbPackage = pkg.DbPackage.Update(). + SetStatus(dbpackage.StatusLatest). + ClearSkipReason(). + SetDebugSymbols(dbpackage.DebugSymbolsNotAvailable). + SetRepoVersion(pkg.Version). + SetHash(pkg.Hash). + SaveX(context.Background()) + } } cmd = exec.Command("paccache", "-rc", filepath.Join(conf.Basedir.Repo, repo, "os", conf.Arch), "-k", "1") diff --git a/tpl/packages.html b/tpl/packages.html index 03bb79f..c926edb 100644 --- a/tpl/packages.html +++ b/tpl/packages.html @@ -68,6 +68,8 @@ title="link time optimization does not guarantee that package is actually build with LTO"> LTO + DgbSym + Archlinux Version {{$repo.Name}}-{{$march.Name}} Version Info @@ -91,6 +93,15 @@ {{if $pkg.LTOUnknown}}{{end}} + + {{if $pkg.DebugSym}}{{end}} + {{if $pkg.DebugSymNotAvailable}}{{end}} + {{if $pkg.DebugSymUnknown}}{{end}} + {{$pkg.Svn2GitVersion}} {{$pkg.Version}} diff --git a/utils.go b/utils.go index 4050781..89ba544 100644 --- a/utils.go +++ b/utils.go @@ -87,7 +87,7 @@ type Conf struct { Repos, March []string Svn2git map[string]string Basedir struct { - Repo, Work string + Repo, Work, Debug string } Db struct { Driver string @@ -153,6 +153,7 @@ func updateLastUpdated() { check(os.WriteFile(filepath.Join(conf.Basedir.Repo, lastUpdate), []byte(strconv.FormatInt(time.Now().Unix(), 10)), 0644)) } +// Name returns the name from Package func (path Package) Name() string { fNameSplit := strings.Split(filepath.Base(string(path)), "-") return strings.Join(fNameSplit[:len(fNameSplit)-3], "-") @@ -453,8 +454,25 @@ func movePackagesLive(fullRepo string) error { for _, file := range pkgFiles { pkg := Package(file) - dbpkg, err := pkg.DBPackageIsolated(march, dbpackage.Repository(repo)) + dbPkg, err := pkg.DBPackageIsolated(march, dbpackage.Repository(repo)) if err != nil { + if strings.HasSuffix(pkg.Name(), "-debug") { + mkErr := os.MkdirAll(filepath.Join(conf.Basedir.Debug, march), 755) + if mkErr != nil { + return fmt.Errorf("unable to create folder for debug-packages: %w", mkErr) + } + forPackage := strings.TrimSuffix(pkg.Name(), "-debug") + log.Infof("[MOVE] Found debug package for package %s: %s", forPackage, pkg.Name()) + + if _, err := os.Stat(filepath.Join(conf.Basedir.Debug, march, filepath.Base(file))); err == nil { + log.Warningf("[MOVE] Existing debug infos for %s, skipping: %s", forPackage, filepath.Join(conf.Basedir.Debug, march, filepath.Base(file))) + } else { + err = os.Rename(file, filepath.Join(conf.Basedir.Debug, march, filepath.Base(file))) + _ = os.Remove(file + ".sig") + continue + } + } + log.Warningf("[MOVE] Deleting package %s: %v", pkg.Name(), err) _ = os.Remove(file) _ = os.Remove(file + ".sig") @@ -471,10 +489,11 @@ func movePackagesLive(fullRepo string) error { } toAdd = append(toAdd, &BuildPackage{ - DbPackage: dbpkg, - Pkgbase: dbpkg.Pkgbase, + DbPackage: dbPkg, + Pkgbase: dbPkg.Pkgbase, PkgFiles: []string{filepath.Join(conf.Basedir.Repo, fullRepo, "os", conf.Arch, filepath.Base(file))}, Version: pkg.Version(), + March: march, }) }