diff --git a/ent/dbpackage.go b/ent/dbpackage.go index 9227097..41cac22 100644 --- a/ent/dbpackage.go +++ b/ent/dbpackage.go @@ -57,6 +57,8 @@ type DbPackage struct { IoIn *int64 `json:"io_in,omitempty"` // IoOut holds the value of the "io_out" field. IoOut *int64 `json:"io_out,omitempty"` + // Srcinfo holds the value of the "srcinfo" field. + Srcinfo *string `json:"srcinfo,omitempty"` } // scanValues returns the types for scanning values from sql.Rows. @@ -68,7 +70,7 @@ func (*DbPackage) scanValues(columns []string) ([]interface{}, error) { values[i] = new([]byte) case dbpackage.FieldID, dbpackage.FieldMaxRss, dbpackage.FieldUTime, dbpackage.FieldSTime, dbpackage.FieldIoIn, dbpackage.FieldIoOut: 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, dbpackage.FieldDebugSymbols: + case dbpackage.FieldPkgbase, dbpackage.FieldStatus, dbpackage.FieldSkipReason, dbpackage.FieldRepository, dbpackage.FieldMarch, dbpackage.FieldVersion, dbpackage.FieldRepoVersion, dbpackage.FieldHash, dbpackage.FieldLto, dbpackage.FieldLastVersionBuild, dbpackage.FieldDebugSymbols, dbpackage.FieldSrcinfo: values[i] = new(sql.NullString) case dbpackage.FieldBuildTimeStart, dbpackage.FieldUpdated, dbpackage.FieldLastVerified: values[i] = new(sql.NullTime) @@ -220,6 +222,13 @@ func (dp *DbPackage) assignValues(columns []string, values []interface{}) error dp.IoOut = new(int64) *dp.IoOut = value.Int64 } + case dbpackage.FieldSrcinfo: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field srcinfo", values[i]) + } else if value.Valid { + dp.Srcinfo = new(string) + *dp.Srcinfo = value.String + } } } return nil @@ -317,6 +326,11 @@ func (dp *DbPackage) String() string { builder.WriteString("io_out=") builder.WriteString(fmt.Sprintf("%v", *v)) } + builder.WriteString(", ") + if v := dp.Srcinfo; v != nil { + builder.WriteString("srcinfo=") + builder.WriteString(*v) + } builder.WriteByte(')') return builder.String() } diff --git a/ent/dbpackage/dbpackage.go b/ent/dbpackage/dbpackage.go index 5820bd4..edb02e4 100644 --- a/ent/dbpackage/dbpackage.go +++ b/ent/dbpackage/dbpackage.go @@ -51,6 +51,8 @@ const ( FieldIoIn = "io_in" // FieldIoOut holds the string denoting the io_out field in the database. FieldIoOut = "io_out" + // FieldSrcinfo holds the string denoting the srcinfo field in the database. + FieldSrcinfo = "srcinfo" // Table holds the table name of the dbpackage in the database. Table = "db_packages" ) @@ -78,6 +80,7 @@ var Columns = []string{ FieldSTime, FieldIoIn, FieldIoOut, + FieldSrcinfo, } // ValidColumn reports if the column name is valid (part of the table columns). diff --git a/ent/dbpackage/where.go b/ent/dbpackage/where.go index 0d9d70e..011e084 100644 --- a/ent/dbpackage/where.go +++ b/ent/dbpackage/where.go @@ -185,6 +185,13 @@ func IoOut(v int64) predicate.DbPackage { }) } +// Srcinfo applies equality check predicate on the "srcinfo" field. It's identical to SrcinfoEQ. +func Srcinfo(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldSrcinfo), v)) + }) +} + // PkgbaseEQ applies the EQ predicate on the "pkgbase" field. func PkgbaseEQ(v string) predicate.DbPackage { return predicate.DbPackage(func(s *sql.Selector) { @@ -1772,6 +1779,119 @@ func IoOutNotNil() predicate.DbPackage { }) } +// SrcinfoEQ applies the EQ predicate on the "srcinfo" field. +func SrcinfoEQ(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.EQ(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoNEQ applies the NEQ predicate on the "srcinfo" field. +func SrcinfoNEQ(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.NEQ(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoIn applies the In predicate on the "srcinfo" field. +func SrcinfoIn(vs ...string) predicate.DbPackage { + v := make([]interface{}, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.In(s.C(FieldSrcinfo), v...)) + }) +} + +// SrcinfoNotIn applies the NotIn predicate on the "srcinfo" field. +func SrcinfoNotIn(vs ...string) predicate.DbPackage { + v := make([]interface{}, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.NotIn(s.C(FieldSrcinfo), v...)) + }) +} + +// SrcinfoGT applies the GT predicate on the "srcinfo" field. +func SrcinfoGT(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.GT(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoGTE applies the GTE predicate on the "srcinfo" field. +func SrcinfoGTE(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.GTE(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoLT applies the LT predicate on the "srcinfo" field. +func SrcinfoLT(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.LT(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoLTE applies the LTE predicate on the "srcinfo" field. +func SrcinfoLTE(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.LTE(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoContains applies the Contains predicate on the "srcinfo" field. +func SrcinfoContains(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.Contains(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoHasPrefix applies the HasPrefix predicate on the "srcinfo" field. +func SrcinfoHasPrefix(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.HasPrefix(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoHasSuffix applies the HasSuffix predicate on the "srcinfo" field. +func SrcinfoHasSuffix(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.HasSuffix(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoIsNil applies the IsNil predicate on the "srcinfo" field. +func SrcinfoIsNil() predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.IsNull(s.C(FieldSrcinfo))) + }) +} + +// SrcinfoNotNil applies the NotNil predicate on the "srcinfo" field. +func SrcinfoNotNil() predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.NotNull(s.C(FieldSrcinfo))) + }) +} + +// SrcinfoEqualFold applies the EqualFold predicate on the "srcinfo" field. +func SrcinfoEqualFold(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.EqualFold(s.C(FieldSrcinfo), v)) + }) +} + +// SrcinfoContainsFold applies the ContainsFold predicate on the "srcinfo" field. +func SrcinfoContainsFold(v string) predicate.DbPackage { + return predicate.DbPackage(func(s *sql.Selector) { + s.Where(sql.ContainsFold(s.C(FieldSrcinfo), v)) + }) +} + // 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 761b588..dce00d3 100644 --- a/ent/dbpackage_create.go +++ b/ent/dbpackage_create.go @@ -268,6 +268,20 @@ func (dpc *DbPackageCreate) SetNillableIoOut(i *int64) *DbPackageCreate { return dpc } +// SetSrcinfo sets the "srcinfo" field. +func (dpc *DbPackageCreate) SetSrcinfo(s string) *DbPackageCreate { + dpc.mutation.SetSrcinfo(s) + return dpc +} + +// SetNillableSrcinfo sets the "srcinfo" field if the given value is not nil. +func (dpc *DbPackageCreate) SetNillableSrcinfo(s *string) *DbPackageCreate { + if s != nil { + dpc.SetSrcinfo(*s) + } + return dpc +} + // Mutation returns the DbPackageMutation object of the builder. func (dpc *DbPackageCreate) Mutation() *DbPackageMutation { return dpc.mutation @@ -587,6 +601,14 @@ func (dpc *DbPackageCreate) createSpec() (*DbPackage, *sqlgraph.CreateSpec) { }) _node.IoOut = &value } + if value, ok := dpc.mutation.Srcinfo(); ok { + _spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{ + Type: field.TypeString, + Value: value, + Column: dbpackage.FieldSrcinfo, + }) + _node.Srcinfo = &value + } return _node, _spec } diff --git a/ent/dbpackage_update.go b/ent/dbpackage_update.go index 936459f..0cfc931 100644 --- a/ent/dbpackage_update.go +++ b/ent/dbpackage_update.go @@ -402,6 +402,26 @@ func (dpu *DbPackageUpdate) ClearIoOut() *DbPackageUpdate { return dpu } +// SetSrcinfo sets the "srcinfo" field. +func (dpu *DbPackageUpdate) SetSrcinfo(s string) *DbPackageUpdate { + dpu.mutation.SetSrcinfo(s) + return dpu +} + +// SetNillableSrcinfo sets the "srcinfo" field if the given value is not nil. +func (dpu *DbPackageUpdate) SetNillableSrcinfo(s *string) *DbPackageUpdate { + if s != nil { + dpu.SetSrcinfo(*s) + } + return dpu +} + +// ClearSrcinfo clears the value of the "srcinfo" field. +func (dpu *DbPackageUpdate) ClearSrcinfo() *DbPackageUpdate { + dpu.mutation.ClearSrcinfo() + return dpu +} + // Mutation returns the DbPackageMutation object of the builder. func (dpu *DbPackageUpdate) Mutation() *DbPackageMutation { return dpu.mutation @@ -779,6 +799,19 @@ func (dpu *DbPackageUpdate) sqlSave(ctx context.Context) (n int, err error) { Column: dbpackage.FieldIoOut, }) } + if value, ok := dpu.mutation.Srcinfo(); ok { + _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ + Type: field.TypeString, + Value: value, + Column: dbpackage.FieldSrcinfo, + }) + } + if dpu.mutation.SrcinfoCleared() { + _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ + Type: field.TypeString, + Column: dbpackage.FieldSrcinfo, + }) + } _spec.Modifiers = dpu.modifiers if n, err = sqlgraph.UpdateNodes(ctx, dpu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { @@ -1173,6 +1206,26 @@ func (dpuo *DbPackageUpdateOne) ClearIoOut() *DbPackageUpdateOne { return dpuo } +// SetSrcinfo sets the "srcinfo" field. +func (dpuo *DbPackageUpdateOne) SetSrcinfo(s string) *DbPackageUpdateOne { + dpuo.mutation.SetSrcinfo(s) + return dpuo +} + +// SetNillableSrcinfo sets the "srcinfo" field if the given value is not nil. +func (dpuo *DbPackageUpdateOne) SetNillableSrcinfo(s *string) *DbPackageUpdateOne { + if s != nil { + dpuo.SetSrcinfo(*s) + } + return dpuo +} + +// ClearSrcinfo clears the value of the "srcinfo" field. +func (dpuo *DbPackageUpdateOne) ClearSrcinfo() *DbPackageUpdateOne { + dpuo.mutation.ClearSrcinfo() + return dpuo +} + // Mutation returns the DbPackageMutation object of the builder. func (dpuo *DbPackageUpdateOne) Mutation() *DbPackageMutation { return dpuo.mutation @@ -1580,6 +1633,19 @@ func (dpuo *DbPackageUpdateOne) sqlSave(ctx context.Context) (_node *DbPackage, Column: dbpackage.FieldIoOut, }) } + if value, ok := dpuo.mutation.Srcinfo(); ok { + _spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{ + Type: field.TypeString, + Value: value, + Column: dbpackage.FieldSrcinfo, + }) + } + if dpuo.mutation.SrcinfoCleared() { + _spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{ + Type: field.TypeString, + Column: dbpackage.FieldSrcinfo, + }) + } _spec.Modifiers = dpuo.modifiers _node = &DbPackage{config: dpuo.config} _spec.Assign = _node.assignValues diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index ba9d5f5..bbd2a51 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -31,6 +31,7 @@ var ( {Name: "s_time", Type: field.TypeInt64, Nullable: true}, {Name: "io_in", Type: field.TypeInt64, Nullable: true}, {Name: "io_out", Type: field.TypeInt64, Nullable: true}, + {Name: "srcinfo", Type: field.TypeString, Nullable: true, Size: 2147483647}, } // DbPackagesTable holds the schema information for the "db_packages" table. DbPackagesTable = &schema.Table{ diff --git a/ent/mutation.go b/ent/mutation.go index 2a70b09..aa65cd2 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -58,6 +58,7 @@ type DbPackageMutation struct { addio_in *int64 io_out *int64 addio_out *int64 + srcinfo *string clearedFields map[string]struct{} done bool oldValue func(context.Context) (*DbPackage, error) @@ -1208,6 +1209,55 @@ func (m *DbPackageMutation) ResetIoOut() { delete(m.clearedFields, dbpackage.FieldIoOut) } +// SetSrcinfo sets the "srcinfo" field. +func (m *DbPackageMutation) SetSrcinfo(s string) { + m.srcinfo = &s +} + +// Srcinfo returns the value of the "srcinfo" field in the mutation. +func (m *DbPackageMutation) Srcinfo() (r string, exists bool) { + v := m.srcinfo + if v == nil { + return + } + return *v, true +} + +// OldSrcinfo returns the old "srcinfo" 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) OldSrcinfo(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldSrcinfo is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldSrcinfo requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldSrcinfo: %w", err) + } + return oldValue.Srcinfo, nil +} + +// ClearSrcinfo clears the value of the "srcinfo" field. +func (m *DbPackageMutation) ClearSrcinfo() { + m.srcinfo = nil + m.clearedFields[dbpackage.FieldSrcinfo] = struct{}{} +} + +// SrcinfoCleared returns if the "srcinfo" field was cleared in this mutation. +func (m *DbPackageMutation) SrcinfoCleared() bool { + _, ok := m.clearedFields[dbpackage.FieldSrcinfo] + return ok +} + +// ResetSrcinfo resets all changes to the "srcinfo" field. +func (m *DbPackageMutation) ResetSrcinfo() { + m.srcinfo = nil + delete(m.clearedFields, dbpackage.FieldSrcinfo) +} + // Where appends a list predicates to the DbPackageMutation builder. func (m *DbPackageMutation) Where(ps ...predicate.DbPackage) { m.predicates = append(m.predicates, ps...) @@ -1227,7 +1277,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, 20) + fields := make([]string, 0, 21) if m.pkgbase != nil { fields = append(fields, dbpackage.FieldPkgbase) } @@ -1288,6 +1338,9 @@ func (m *DbPackageMutation) Fields() []string { if m.io_out != nil { fields = append(fields, dbpackage.FieldIoOut) } + if m.srcinfo != nil { + fields = append(fields, dbpackage.FieldSrcinfo) + } return fields } @@ -1336,6 +1389,8 @@ func (m *DbPackageMutation) Field(name string) (ent.Value, bool) { return m.IoIn() case dbpackage.FieldIoOut: return m.IoOut() + case dbpackage.FieldSrcinfo: + return m.Srcinfo() } return nil, false } @@ -1385,6 +1440,8 @@ func (m *DbPackageMutation) OldField(ctx context.Context, name string) (ent.Valu return m.OldIoIn(ctx) case dbpackage.FieldIoOut: return m.OldIoOut(ctx) + case dbpackage.FieldSrcinfo: + return m.OldSrcinfo(ctx) } return nil, fmt.Errorf("unknown DbPackage field %s", name) } @@ -1534,6 +1591,13 @@ func (m *DbPackageMutation) SetField(name string, value ent.Value) error { } m.SetIoOut(v) return nil + case dbpackage.FieldSrcinfo: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSrcinfo(v) + return nil } return fmt.Errorf("unknown DbPackage field %s", name) } @@ -1678,6 +1742,9 @@ func (m *DbPackageMutation) ClearedFields() []string { if m.FieldCleared(dbpackage.FieldIoOut) { fields = append(fields, dbpackage.FieldIoOut) } + if m.FieldCleared(dbpackage.FieldSrcinfo) { + fields = append(fields, dbpackage.FieldSrcinfo) + } return fields } @@ -1743,6 +1810,9 @@ func (m *DbPackageMutation) ClearField(name string) error { case dbpackage.FieldIoOut: m.ClearIoOut() return nil + case dbpackage.FieldSrcinfo: + m.ClearSrcinfo() + return nil } return fmt.Errorf("unknown DbPackage nullable field %s", name) } @@ -1811,6 +1881,9 @@ func (m *DbPackageMutation) ResetField(name string) error { case dbpackage.FieldIoOut: m.ResetIoOut() return nil + case dbpackage.FieldSrcinfo: + m.ResetSrcinfo() + return nil } return fmt.Errorf("unknown DbPackage field %s", name) } diff --git a/ent/schema/dbpackage.go b/ent/schema/dbpackage.go index 82d720a..ea557b4 100644 --- a/ent/schema/dbpackage.go +++ b/ent/schema/dbpackage.go @@ -33,6 +33,7 @@ func (DbPackage) Fields() []ent.Field { field.Int64("s_time").Optional().Nillable(), field.Int64("io_in").Optional().Nillable(), field.Int64("io_out").Optional().Nillable(), + field.Text("srcinfo").Optional().Nillable(), } } diff --git a/go.sum b/go.sum index 755f0dc..e8735c7 100644 --- a/go.sum +++ b/go.sum @@ -114,9 +114,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/mattn/go-sqlite3 v1.14.13 h1:1tj15ngiFfcZzii7yd82foL+ks+ouQcj8j/TPq3fk1I= 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/otiai10/copy v1.7.0 h1:hVoPiN+t+7d2nzzwMiDHPSOogsWAStewq3TwU05+clE= github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -141,6 +143,8 @@ 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.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= +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.13-0.20220804200503-81c7dc4e4efa h1:uKcci2q7Qtp6nMTC/AAvfNUAldFtJuHWV9/5QWiypts= 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/proto_package.go b/proto_package.go index 4752072..0f758a3 100644 --- a/proto_package.go +++ b/proto_package.go @@ -683,6 +683,15 @@ func (p *ProtoPackage) genSrcinfo() error { return nil } + if p.DbPackage != nil && p.DbPackage.Srcinfo != nil { + var err error + p.Srcinfo, err = srcinfo.Parse(*p.DbPackage.Srcinfo) + if err != nil { + return err + } + return nil + } + cmd := exec.Command("makepkg", "--printsrcinfo", "-p", filepath.Base(p.Pkgbuild)) cmd.Dir = filepath.Dir(p.Pkgbuild) res, err := cmd.CombinedOutput() @@ -696,6 +705,10 @@ func (p *ProtoPackage) genSrcinfo() error { } p.Srcinfo = info + if p.DbPackage != nil { + p.DbPackage = p.DbPackage.Update().SetSrcinfo(string(res)).SaveX(context.Background()) + } + return nil } diff --git a/utils.go b/utils.go index 0ebfe4e..3b0c43e 100644 --- a/utils.go +++ b/utils.go @@ -256,6 +256,9 @@ func genQueue(path string) ([]*ProtoPackage, error) { if dbPkg != nil && b3s == dbPkg.Hash { log.Debugf("[%s/%s] Skipped: PKGBUILD hash matches db (%s)", mPkgbuild.Repo(), mPkgbuild.PkgBase(), b3s) continue + } else if dbPkg != nil && b3s != dbPkg.Hash { + log.Debugf("[%s/%s] srcinfo cleared", mPkgbuild.Repo(), mPkgbuild.PkgBase()) + dbPkg = dbPkg.Update().ClearSrcinfo().SaveX(context.Background()) } pkgbuilds = append(pkgbuilds, &ProtoPackage{