change module package, add gitlab tag workaround and add new directives

This commit is contained in:
Mustafa Gezen 2021-02-21 14:51:30 +01:00
parent 0c150ed1f8
commit 2782a66848
14 changed files with 990 additions and 68 deletions

View File

@ -3,7 +3,7 @@ package main
import (
"errors"
"fmt"
"github.com/mstg/srpmproc/internal"
"git.rockylinux.org/release-engineering/public/srpmproc/internal"
"github.com/spf13/cobra"
"io/ioutil"
"log"

View File

@ -2,16 +2,16 @@ package main
import (
"fmt"
"git.rockylinux.org/release-engineering/public/srpmproc/internal/blob"
"git.rockylinux.org/release-engineering/public/srpmproc/internal/blob/gcs"
"git.rockylinux.org/release-engineering/public/srpmproc/internal/blob/s3"
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
"github.com/mstg/srpmproc/internal/blob"
"github.com/mstg/srpmproc/internal/blob/gcs"
"github.com/mstg/srpmproc/internal/blob/s3"
"log"
"os/user"
"path/filepath"
"strings"
"github.com/mstg/srpmproc/internal"
"git.rockylinux.org/release-engineering/public/srpmproc/internal"
"github.com/spf13/cobra"
)

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/mstg/srpmproc
module git.rockylinux.org/release-engineering/public/srpmproc
go 1.15

4
go.sum
View File

@ -40,7 +40,9 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
@ -242,6 +244,7 @@ github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
@ -577,6 +580,7 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View File

@ -0,0 +1,39 @@
package directives
import (
"errors"
"fmt"
srpmprocpb "git.rockylinux.org/release-engineering/public/srpmproc/pb"
"github.com/go-git/go-git/v5"
"io/ioutil"
"os"
"path/filepath"
)
func add(cfg *srpmprocpb.Cfg, patchTree *git.Worktree, pushTree *git.Worktree) error {
for _, add := range cfg.Add {
filePath := checkAddPrefix(filepath.Base(add.File))
f, err := pushTree.Filesystem.OpenFile(filePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_OPEN_DESTINATION:%s", filePath))
}
fPatch, err := patchTree.Filesystem.OpenFile(add.File, os.O_RDONLY, 0644)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_OPEN_FROM:%s", add.File))
}
replacingBytes, err := ioutil.ReadAll(fPatch)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_READ_FROM:%s", add.File))
}
_, err = f.Write(replacingBytes)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_WRITE_DESTIONATION:%s", filePath))
}
}
return nil
}

View File

@ -0,0 +1,25 @@
package directives
import (
"errors"
"fmt"
srpmprocpb "git.rockylinux.org/release-engineering/public/srpmproc/pb"
"github.com/go-git/go-git/v5"
)
func del(cfg *srpmprocpb.Cfg, _ *git.Worktree, pushTree *git.Worktree) error {
for _, del := range cfg.Delete {
filePath := del.File
_, err := pushTree.Filesystem.Stat(filePath)
if err != nil {
return errors.New(fmt.Sprintf("FILE_DOES_NOT_EXIST:%s", filePath))
}
err = pushTree.Filesystem.Remove(filePath)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_DELETE_FILE:%s", filePath))
}
}
return nil
}

View File

@ -1,8 +1,11 @@
package directives
import (
"encoding/json"
srpmprocpb "git.rockylinux.org/release-engineering/public/srpmproc/pb"
"github.com/go-git/go-git/v5"
srpmprocpb "github.com/mstg/srpmproc/pb"
"log"
"os"
"path/filepath"
"strings"
)
@ -17,5 +20,34 @@ func checkAddPrefix(file string) string {
}
func Apply(cfg *srpmprocpb.Cfg, patchTree *git.Worktree, pushTree *git.Worktree) {
replace(cfg, patchTree, pushTree)
var errs []string
err := replace(cfg, patchTree, pushTree)
if err != nil {
errs = append(errs, err.Error())
}
err = del(cfg, patchTree, pushTree)
if err != nil {
errs = append(errs, err.Error())
}
err = add(cfg, patchTree, pushTree)
if err != nil {
errs = append(errs, err.Error())
}
err = patch(cfg, patchTree, pushTree)
if err != nil {
errs = append(errs, err.Error())
}
if len(errs) > 0 {
err := json.NewEncoder(os.Stdout).Encode(errs)
if err != nil {
log.Fatal(errs)
}
os.Exit(1)
}
}

View File

@ -0,0 +1,91 @@
package directives
import (
"bytes"
"errors"
"fmt"
srpmprocpb "git.rockylinux.org/release-engineering/public/srpmproc/pb"
"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/go-git/go-git/v5"
"log"
)
func patch(cfg *srpmprocpb.Cfg, patchTree *git.Worktree, pushTree *git.Worktree) error {
for _, patch := range cfg.Patch {
patchFile, err := patchTree.Filesystem.Open(patch.File)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_OPEN_PATCH_FILE:%s", patch.File))
}
files, _, err := gitdiff.Parse(patchFile)
if err != nil {
log.Printf("could not parse patch file: %v", err)
return errors.New(fmt.Sprintf("COULD_NOT_PARSE_PATCH_FILE:%s", patch.File))
}
for _, patchedFile := range files {
srcPath := patchedFile.NewName
if !patch.Strict {
srcPath = checkAddPrefix(patchedFile.NewName)
}
var output bytes.Buffer
if !patchedFile.IsDelete && !patchedFile.IsNew {
patchSubjectFile, err := pushTree.Filesystem.Open(srcPath)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_OPEN_PATCH_SUBJECT:%s", srcPath))
}
err = gitdiff.NewApplier(patchSubjectFile).ApplyFile(&output, patchedFile)
if err != nil {
log.Printf("could not apply patch: %v", err)
return errors.New(fmt.Sprintf("COULD_NOT_APPLY_PATCH_WITH_SUBJECT:%s", srcPath))
}
}
oldName := patchedFile.OldName
if !patch.Strict {
oldName = checkAddPrefix(patchedFile.OldName)
}
_ = pushTree.Filesystem.Remove(oldName)
_ = pushTree.Filesystem.Remove(srcPath)
if patchedFile.IsNew {
newFile, err := pushTree.Filesystem.Create(srcPath)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_CREATE_NEW_FILE:%s", srcPath))
}
err = gitdiff.NewApplier(newFile).ApplyFile(&output, patchedFile)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_APPLY_PATCH_TO_NEW_FILE:%s", srcPath))
}
_, err = newFile.Write(output.Bytes())
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_WRITE_TO_NEW_FILE:%s", srcPath))
}
_, err = pushTree.Add(srcPath)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_ADD_NEW_FILE_TO_GIT:%s", srcPath))
}
} else if !patchedFile.IsDelete {
newFile, err := pushTree.Filesystem.Create(srcPath)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_CREATE_POST_PATCH_FILE:%s", srcPath))
}
_, err = newFile.Write(output.Bytes())
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_WRITE_POST_PATCH_FILE:%s", srcPath))
}
_, err = pushTree.Add(srcPath)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_ADD_POST_PATCH_FILE_TO_GIT:%s", srcPath))
}
} else {
_, err = pushTree.Remove(oldName)
if err != nil {
return errors.New(fmt.Sprintf("COULD_NOT_REMOVE_FILE_FROM_GIT:%s", oldName))
}
}
}
}
return nil
}

View File

@ -1,54 +1,57 @@
package directives
import (
"errors"
"fmt"
srpmprocpb "git.rockylinux.org/release-engineering/public/srpmproc/pb"
"github.com/go-git/go-git/v5"
srpmprocpb "github.com/mstg/srpmproc/pb"
"io/ioutil"
"log"
"os"
)
func replace(cfg *srpmprocpb.Cfg, patchTree *git.Worktree, pushTree *git.Worktree) {
func replace(cfg *srpmprocpb.Cfg, patchTree *git.Worktree, pushTree *git.Worktree) error {
for _, replace := range cfg.Replace {
filePath := checkAddPrefix(replace.File)
stat, err := pushTree.Filesystem.Stat(filePath)
if replace.File == "" || err != nil {
log.Fatalf("file to replace is invalid")
return errors.New(fmt.Sprintf("INVALID_FILE:%s", filePath))
}
err = pushTree.Filesystem.Remove(filePath)
if err != nil {
log.Fatalf("could not remove old file: %v", err)
return errors.New(fmt.Sprintf("COULD_NOT_REMOVE_OLD_FILE:%s", filePath))
}
f, err := pushTree.Filesystem.OpenFile(filePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, stat.Mode())
if err != nil {
log.Fatalf("could not open replacement file: %v", err)
return errors.New(fmt.Sprintf("COULD_NOT_OPEN_REPLACEMENT:%s", filePath))
}
switch replacing := replace.Replacing.(type) {
case *srpmprocpb.Replace_WithFile:
fPatch, err := patchTree.Filesystem.OpenFile(replacing.WithFile, os.O_RDONLY, 0644)
if err != nil {
log.Fatalf("could not open replacing file: %v", err)
return errors.New(fmt.Sprintf("COULD_NOT_OPEN_REPLACING:%s", replacing.WithFile))
}
replacingBytes, err := ioutil.ReadAll(fPatch)
if err != nil {
log.Fatalf("could not read replacing file: %v", err)
return errors.New(fmt.Sprintf("COULD_NOT_READ_REPLACING:%s", replacing.WithFile))
}
_, err = f.Write(replacingBytes)
if err != nil {
log.Fatalf("could not write replacing file: %v", err)
return errors.New(fmt.Sprintf("COULD_NOT_WRITE_REPLACING:%s", replacing.WithFile))
}
break
case *srpmprocpb.Replace_WithInline:
_, err := f.Write([]byte(replacing.WithInline))
if err != nil {
log.Fatalf("could not write inline replacement: %v", err)
return errors.New(fmt.Sprintf("COULD_NOT_WRITE_INLINE:%s", filePath))
}
break
}
}
return nil
}

View File

@ -60,10 +60,9 @@ func (g *GitMode) RetrieveSource(pd *ProcessData) *modeData {
}
err = remote.Fetch(&git.FetchOptions{
RemoteName: "upstream",
RefSpecs: []config.RefSpec{refspec},
Tags: git.AllTags,
Force: true,
RefSpecs: []config.RefSpec{refspec},
Tags: git.AllTags,
Force: true,
})
if err != nil {
log.Fatalf("could not fetch upstream: %v", err)
@ -71,20 +70,45 @@ func (g *GitMode) RetrieveSource(pd *ProcessData) *modeData {
var branches remoteTargetSlice
tagIter, err := repo.TagObjects()
if err != nil {
log.Fatalf("could not get tag objects: %v", err)
}
_ = tagIter.ForEach(func(tag *object.Tag) error {
log.Printf("tag: %s", tag.Name)
if strings.HasPrefix(tag.Name, fmt.Sprintf("imports/c%d", pd.Version)) {
tagAdd := func(tag *object.Tag) error {
if strings.HasPrefix(tag.Name, fmt.Sprintf("imports/%s%d", pd.ImportBranchPrefix, pd.Version)) {
log.Printf("tag: %s", tag.Name)
branches = append(branches, remoteTarget{
remote: fmt.Sprintf("refs/tags/%s", tag.Name),
when: tag.Tagger.When,
})
}
return nil
})
}
tagIter, err := repo.TagObjects()
if err != nil {
log.Fatalf("could not get tag objects: %v", err)
}
_ = tagIter.ForEach(tagAdd)
if len(branches) == 0 {
list, err := remote.List(&git.ListOptions{})
if err != nil {
log.Fatalf("could not list upstream: %v", err)
}
for _, ref := range list {
if ref.Hash().IsZero() {
continue
}
commit, err := repo.CommitObject(ref.Hash())
if err != nil {
log.Fatalf("could not get commit object: %v", err)
}
_ = tagAdd(&object.Tag{
Name: strings.TrimPrefix(string(ref.Name()), "refs/tags/"),
Tagger: commit.Committer,
})
}
}
sort.Sort(branches)
var sortedBranches []string
@ -125,7 +149,7 @@ func (g *GitMode) WriteSource(pd *ProcessData, md *modeData) {
Tags: git.AllTags,
Force: true,
})
if err != nil {
if err != nil && err != git.NoErrAlreadyUpToDate {
log.Fatalf("could not fetch upstream: %v", err)
}

View File

@ -3,15 +3,15 @@ package internal
import (
"bytes"
"fmt"
"git.rockylinux.org/release-engineering/public/srpmproc/internal/directives"
"git.rockylinux.org/release-engineering/public/srpmproc/modulemd"
srpmprocpb "git.rockylinux.org/release-engineering/public/srpmproc/pb"
"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/config"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/storage/memory"
"github.com/mstg/srpmproc/internal/directives"
"github.com/mstg/srpmproc/modulemd"
srpmprocpb "github.com/mstg/srpmproc/pb"
"google.golang.org/protobuf/encoding/prototext"
"io/ioutil"
"log"

View File

@ -4,6 +4,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"git.rockylinux.org/release-engineering/public/srpmproc/internal/blob"
"github.com/cavaliercoder/go-rpm"
"github.com/go-git/go-billy/v5/memfs"
"github.com/go-git/go-git/v5"
@ -12,7 +13,6 @@ import (
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
"github.com/go-git/go-git/v5/storage/memory"
"github.com/mstg/srpmproc/internal/blob"
"hash"
"io/ioutil"
"log"
@ -162,8 +162,8 @@ func ProcessRPM(pd *ProcessData) {
}
match := tagImportRegex.FindStringSubmatch(matchString)
md.pushBranch = pd.BranchPrefix + strings.TrimPrefix(match[2], "c")
newTag := "imports/" + pd.BranchPrefix + strings.TrimPrefix(match[1], "imports/c")
md.pushBranch = pd.BranchPrefix + strings.TrimPrefix(match[2], pd.ImportBranchPrefix)
newTag := "imports/" + pd.BranchPrefix + strings.TrimPrefix(match[1], "imports/"+pd.ImportBranchPrefix)
shouldContinue := true
for _, ignoredTag := range tagIgnoreList {

View File

@ -25,14 +25,64 @@ const (
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
// Replace directive replaces literal files with other files.
type SpecChange_FileOperation_Type int32
const (
SpecChange_FileOperation_Unknown SpecChange_FileOperation_Type = 0
SpecChange_FileOperation_Source SpecChange_FileOperation_Type = 1
SpecChange_FileOperation_Patch SpecChange_FileOperation_Type = 2
)
// Enum value maps for SpecChange_FileOperation_Type.
var (
SpecChange_FileOperation_Type_name = map[int32]string{
0: "Unknown",
1: "Source",
2: "Patch",
}
SpecChange_FileOperation_Type_value = map[string]int32{
"Unknown": 0,
"Source": 1,
"Patch": 2,
}
)
func (x SpecChange_FileOperation_Type) Enum() *SpecChange_FileOperation_Type {
p := new(SpecChange_FileOperation_Type)
*p = x
return p
}
func (x SpecChange_FileOperation_Type) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (SpecChange_FileOperation_Type) Descriptor() protoreflect.EnumDescriptor {
return file_cfg_proto_enumTypes[0].Descriptor()
}
func (SpecChange_FileOperation_Type) Type() protoreflect.EnumType {
return &file_cfg_proto_enumTypes[0]
}
func (x SpecChange_FileOperation_Type) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use SpecChange_FileOperation_Type.Descriptor instead.
func (SpecChange_FileOperation_Type) EnumDescriptor() ([]byte, []int) {
return file_cfg_proto_rawDescGZIP(), []int{4, 0, 0}
}
// Replace directive replaces a file from the rpm repository
// with a file from the patch repository.
// Replacing content can either be inline or in the same patch-tree.
type Replace struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// required - replaced file
// Required - Replaced file
File string `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"`
// Types that are assignable to Replacing:
// *Replace_WithFile
@ -105,12 +155,12 @@ type isReplace_Replacing interface {
}
type Replace_WithFile struct {
// replace with in-tree file
// Replace with in-tree file
WithFile string `protobuf:"bytes,2,opt,name=with_file,json=withFile,proto3,oneof"`
}
type Replace_WithInline struct {
// replace with inline content
// Replace with inline content
WithInline string `protobuf:"bytes,3,opt,name=with_inline,json=withInline,proto3,oneof"`
}
@ -118,18 +168,318 @@ func (*Replace_WithFile) isReplace_Replacing() {}
func (*Replace_WithInline) isReplace_Replacing() {}
// Delete directive deletes literal files from the rpm repository.
// Won't delete from spec automatically.
// Use the `SpecChange` directive for that
type Delete struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Required
File string `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"`
}
func (x *Delete) Reset() {
*x = Delete{}
if protoimpl.UnsafeEnabled {
mi := &file_cfg_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Delete) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Delete) ProtoMessage() {}
func (x *Delete) ProtoReflect() protoreflect.Message {
mi := &file_cfg_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Delete.ProtoReflect.Descriptor instead.
func (*Delete) Descriptor() ([]byte, []int) {
return file_cfg_proto_rawDescGZIP(), []int{1}
}
func (x *Delete) GetFile() string {
if x != nil {
return x.File
}
return ""
}
// Add directive adds a file from the patch repository to the rpm repository.
type Add struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Required - file to add
File string `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"`
// Overrides file name if specified
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
}
func (x *Add) Reset() {
*x = Add{}
if protoimpl.UnsafeEnabled {
mi := &file_cfg_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Add) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Add) ProtoMessage() {}
func (x *Add) ProtoReflect() protoreflect.Message {
mi := &file_cfg_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Add.ProtoReflect.Descriptor instead.
func (*Add) Descriptor() ([]byte, []int) {
return file_cfg_proto_rawDescGZIP(), []int{2}
}
func (x *Add) GetFile() string {
if x != nil {
return x.File
}
return ""
}
func (x *Add) GetName() string {
if x != nil {
return x.Name
}
return ""
}
// Lookaside directive puts patched files in blob storage.
// If tar is true, the files will be put into a tarball and gzipped
type Lookaside struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Required - List of files that should be stored in blob storage
Files []string `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"`
// Whether files should be put into a tarball and gzipped
Tar bool `protobuf:"varint,2,opt,name=tar,proto3" json:"tar,omitempty"`
}
func (x *Lookaside) Reset() {
*x = Lookaside{}
if protoimpl.UnsafeEnabled {
mi := &file_cfg_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Lookaside) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Lookaside) ProtoMessage() {}
func (x *Lookaside) ProtoReflect() protoreflect.Message {
mi := &file_cfg_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Lookaside.ProtoReflect.Descriptor instead.
func (*Lookaside) Descriptor() ([]byte, []int) {
return file_cfg_proto_rawDescGZIP(), []int{3}
}
func (x *Lookaside) GetFiles() []string {
if x != nil {
return x.Files
}
return nil
}
func (x *Lookaside) GetTar() bool {
if x != nil {
return x.Tar
}
return false
}
// SpecChange directive makes it possible to execute certain
// plans against the package spec
type SpecChange struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Types that are assignable to Operation:
// *SpecChange_FileOperation_
Operation isSpecChange_Operation `protobuf_oneof:"operation"`
}
func (x *SpecChange) Reset() {
*x = SpecChange{}
if protoimpl.UnsafeEnabled {
mi := &file_cfg_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SpecChange) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SpecChange) ProtoMessage() {}
func (x *SpecChange) ProtoReflect() protoreflect.Message {
mi := &file_cfg_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SpecChange.ProtoReflect.Descriptor instead.
func (*SpecChange) Descriptor() ([]byte, []int) {
return file_cfg_proto_rawDescGZIP(), []int{4}
}
func (m *SpecChange) GetOperation() isSpecChange_Operation {
if m != nil {
return m.Operation
}
return nil
}
func (x *SpecChange) GetFileOperation() *SpecChange_FileOperation {
if x, ok := x.GetOperation().(*SpecChange_FileOperation_); ok {
return x.FileOperation
}
return nil
}
type isSpecChange_Operation interface {
isSpecChange_Operation()
}
type SpecChange_FileOperation_ struct {
FileOperation *SpecChange_FileOperation `protobuf:"bytes,1,opt,name=file_operation,json=fileOperation,proto3,oneof"`
}
func (*SpecChange_FileOperation_) isSpecChange_Operation() {}
type Patch struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Path to patch file from repo root
File string `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"`
// Srpmproc adds `SOURCES/` to files in a diff
// without a prefix if strict is false.
// If strict is true, then that is disabled.
Strict bool `protobuf:"varint,2,opt,name=strict,proto3" json:"strict,omitempty"`
}
func (x *Patch) Reset() {
*x = Patch{}
if protoimpl.UnsafeEnabled {
mi := &file_cfg_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Patch) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Patch) ProtoMessage() {}
func (x *Patch) ProtoReflect() protoreflect.Message {
mi := &file_cfg_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Patch.ProtoReflect.Descriptor instead.
func (*Patch) Descriptor() ([]byte, []int) {
return file_cfg_proto_rawDescGZIP(), []int{5}
}
func (x *Patch) GetFile() string {
if x != nil {
return x.File
}
return ""
}
func (x *Patch) GetStrict() bool {
if x != nil {
return x.Strict
}
return false
}
type Cfg struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Replace []*Replace `protobuf:"bytes,1,rep,name=replace,proto3" json:"replace,omitempty"`
Replace []*Replace `protobuf:"bytes,1,rep,name=replace,proto3" json:"replace,omitempty"`
Delete []*Delete `protobuf:"bytes,2,rep,name=delete,proto3" json:"delete,omitempty"`
Add []*Add `protobuf:"bytes,3,rep,name=add,proto3" json:"add,omitempty"`
Lookaside []*Lookaside `protobuf:"bytes,4,rep,name=lookaside,proto3" json:"lookaside,omitempty"`
SpecChange []*SpecChange `protobuf:"bytes,5,rep,name=spec_change,json=specChange,proto3" json:"spec_change,omitempty"`
Patch []*Patch `protobuf:"bytes,6,rep,name=patch,proto3" json:"patch,omitempty"`
}
func (x *Cfg) Reset() {
*x = Cfg{}
if protoimpl.UnsafeEnabled {
mi := &file_cfg_proto_msgTypes[1]
mi := &file_cfg_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -142,7 +492,7 @@ func (x *Cfg) String() string {
func (*Cfg) ProtoMessage() {}
func (x *Cfg) ProtoReflect() protoreflect.Message {
mi := &file_cfg_proto_msgTypes[1]
mi := &file_cfg_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -155,7 +505,7 @@ func (x *Cfg) ProtoReflect() protoreflect.Message {
// Deprecated: Use Cfg.ProtoReflect.Descriptor instead.
func (*Cfg) Descriptor() ([]byte, []int) {
return file_cfg_proto_rawDescGZIP(), []int{1}
return file_cfg_proto_rawDescGZIP(), []int{6}
}
func (x *Cfg) GetReplace() []*Replace {
@ -165,6 +515,145 @@ func (x *Cfg) GetReplace() []*Replace {
return nil
}
func (x *Cfg) GetDelete() []*Delete {
if x != nil {
return x.Delete
}
return nil
}
func (x *Cfg) GetAdd() []*Add {
if x != nil {
return x.Add
}
return nil
}
func (x *Cfg) GetLookaside() []*Lookaside {
if x != nil {
return x.Lookaside
}
return nil
}
func (x *Cfg) GetSpecChange() []*SpecChange {
if x != nil {
return x.SpecChange
}
return nil
}
func (x *Cfg) GetPatch() []*Patch {
if x != nil {
return x.Patch
}
return nil
}
// The FileOperation plan allows patchers to add or delete
// a file from the spec.
type SpecChange_FileOperation struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// File name
File string `protobuf:"bytes,1,opt,name=file,proto3" json:"file,omitempty"`
// File type
Type SpecChange_FileOperation_Type `protobuf:"varint,2,opt,name=type,proto3,enum=srpmproc.SpecChange_FileOperation_Type" json:"type,omitempty"`
// Types that are assignable to Mode:
// *SpecChange_FileOperation_Add
// *SpecChange_FileOperation_Delete
Mode isSpecChange_FileOperation_Mode `protobuf_oneof:"mode"`
}
func (x *SpecChange_FileOperation) Reset() {
*x = SpecChange_FileOperation{}
if protoimpl.UnsafeEnabled {
mi := &file_cfg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SpecChange_FileOperation) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SpecChange_FileOperation) ProtoMessage() {}
func (x *SpecChange_FileOperation) ProtoReflect() protoreflect.Message {
mi := &file_cfg_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SpecChange_FileOperation.ProtoReflect.Descriptor instead.
func (*SpecChange_FileOperation) Descriptor() ([]byte, []int) {
return file_cfg_proto_rawDescGZIP(), []int{4, 0}
}
func (x *SpecChange_FileOperation) GetFile() string {
if x != nil {
return x.File
}
return ""
}
func (x *SpecChange_FileOperation) GetType() SpecChange_FileOperation_Type {
if x != nil {
return x.Type
}
return SpecChange_FileOperation_Unknown
}
func (m *SpecChange_FileOperation) GetMode() isSpecChange_FileOperation_Mode {
if m != nil {
return m.Mode
}
return nil
}
func (x *SpecChange_FileOperation) GetAdd() bool {
if x, ok := x.GetMode().(*SpecChange_FileOperation_Add); ok {
return x.Add
}
return false
}
func (x *SpecChange_FileOperation) GetDelete() bool {
if x, ok := x.GetMode().(*SpecChange_FileOperation_Delete); ok {
return x.Delete
}
return false
}
type isSpecChange_FileOperation_Mode interface {
isSpecChange_FileOperation_Mode()
}
type SpecChange_FileOperation_Add struct {
// Add won't add the file to the tree.
// Use the `Add` directive for that
Add bool `protobuf:"varint,3,opt,name=add,proto3,oneof"`
}
type SpecChange_FileOperation_Delete struct {
// Delete won't delete the file from the tree.
// Use the `Delete` directive for that
Delete bool `protobuf:"varint,4,opt,name=delete,proto3,oneof"`
}
func (*SpecChange_FileOperation_Add) isSpecChange_FileOperation_Mode() {}
func (*SpecChange_FileOperation_Delete) isSpecChange_FileOperation_Mode() {}
var File_cfg_proto protoreflect.FileDescriptor
var file_cfg_proto_rawDesc = []byte{
@ -176,13 +665,57 @@ var file_cfg_proto_rawDesc = []byte{
0x69, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x77, 0x69, 0x74, 0x68, 0x5f, 0x69, 0x6e, 0x6c, 0x69,
0x6e, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0a, 0x77, 0x69, 0x74, 0x68,
0x49, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63,
0x69, 0x6e, 0x67, 0x22, 0x32, 0x0a, 0x03, 0x43, 0x66, 0x67, 0x12, 0x2b, 0x0a, 0x07, 0x72, 0x65,
0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x73, 0x72,
0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x52, 0x07,
0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x73, 0x74, 0x67, 0x2f, 0x73, 0x72, 0x70, 0x6d, 0x70,
0x72, 0x6f, 0x63, 0x2f, 0x70, 0x62, 0x3b, 0x73, 0x72, 0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x69, 0x6e, 0x67, 0x22, 0x1c, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x12, 0x0a,
0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c,
0x65, 0x22, 0x2d, 0x0a, 0x03, 0x41, 0x64, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x22, 0x33, 0x0a, 0x09, 0x4c, 0x6f, 0x6f, 0x6b, 0x61, 0x73, 0x69, 0x64, 0x65, 0x12, 0x14, 0x0a,
0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69,
0x6c, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08,
0x52, 0x03, 0x74, 0x61, 0x72, 0x22, 0xab, 0x02, 0x0a, 0x0a, 0x53, 0x70, 0x65, 0x63, 0x43, 0x68,
0x61, 0x6e, 0x67, 0x65, 0x12, 0x4b, 0x0a, 0x0e, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6f, 0x70, 0x65,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x73,
0x72, 0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x43, 0x68, 0x61, 0x6e,
0x67, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x48, 0x00, 0x52, 0x0d, 0x66, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x1a, 0xc2, 0x01, 0x0a, 0x0d, 0x46, 0x69, 0x6c, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x73, 0x72, 0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63,
0x2e, 0x53, 0x70, 0x65, 0x63, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x46, 0x69, 0x6c, 0x65,
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04,
0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x03, 0x61, 0x64, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28,
0x08, 0x48, 0x00, 0x52, 0x03, 0x61, 0x64, 0x64, 0x12, 0x18, 0x0a, 0x06, 0x64, 0x65, 0x6c, 0x65,
0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x06, 0x64, 0x65, 0x6c, 0x65,
0x74, 0x65, 0x22, 0x2a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x6e,
0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x63, 0x68, 0x10, 0x02, 0x42, 0x06,
0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x22, 0x33, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x63, 0x68, 0x12, 0x12, 0x0a, 0x04,
0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65,
0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08,
0x52, 0x06, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x22, 0x8e, 0x02, 0x0a, 0x03, 0x43, 0x66, 0x67,
0x12, 0x2b, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x11, 0x2e, 0x73, 0x72, 0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63, 0x2e, 0x52, 0x65, 0x70,
0x6c, 0x61, 0x63, 0x65, 0x52, 0x07, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x28, 0x0a,
0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e,
0x73, 0x72, 0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52,
0x06, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x1f, 0x0a, 0x03, 0x61, 0x64, 0x64, 0x18, 0x03,
0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x73, 0x72, 0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63, 0x2e,
0x41, 0x64, 0x64, 0x52, 0x03, 0x61, 0x64, 0x64, 0x12, 0x31, 0x0a, 0x09, 0x6c, 0x6f, 0x6f, 0x6b,
0x61, 0x73, 0x69, 0x64, 0x65, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x72,
0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x61, 0x73, 0x69, 0x64, 0x65,
0x52, 0x09, 0x6c, 0x6f, 0x6f, 0x6b, 0x61, 0x73, 0x69, 0x64, 0x65, 0x12, 0x35, 0x0a, 0x0b, 0x73,
0x70, 0x65, 0x63, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b,
0x32, 0x14, 0x2e, 0x73, 0x72, 0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63, 0x2e, 0x53, 0x70, 0x65, 0x63,
0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x0a, 0x73, 0x70, 0x65, 0x63, 0x43, 0x68, 0x61, 0x6e,
0x67, 0x65, 0x12, 0x25, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x06, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x72, 0x70, 0x6d, 0x70, 0x72, 0x6f, 0x63, 0x2e, 0x50, 0x61, 0x74,
0x63, 0x68, 0x52, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x73, 0x74, 0x67, 0x2f, 0x73, 0x72, 0x70,
0x6d, 0x70, 0x72, 0x6f, 0x63, 0x2f, 0x70, 0x62, 0x3b, 0x73, 0x72, 0x70, 0x6d, 0x70, 0x72, 0x6f,
0x63, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -197,18 +730,33 @@ func file_cfg_proto_rawDescGZIP() []byte {
return file_cfg_proto_rawDescData
}
var file_cfg_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_cfg_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_cfg_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_cfg_proto_goTypes = []interface{}{
(*Replace)(nil), // 0: srpmproc.Replace
(*Cfg)(nil), // 1: srpmproc.Cfg
(SpecChange_FileOperation_Type)(0), // 0: srpmproc.SpecChange.FileOperation.Type
(*Replace)(nil), // 1: srpmproc.Replace
(*Delete)(nil), // 2: srpmproc.Delete
(*Add)(nil), // 3: srpmproc.Add
(*Lookaside)(nil), // 4: srpmproc.Lookaside
(*SpecChange)(nil), // 5: srpmproc.SpecChange
(*Patch)(nil), // 6: srpmproc.Patch
(*Cfg)(nil), // 7: srpmproc.Cfg
(*SpecChange_FileOperation)(nil), // 8: srpmproc.SpecChange.FileOperation
}
var file_cfg_proto_depIdxs = []int32{
0, // 0: srpmproc.Cfg.replace:type_name -> srpmproc.Replace
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
8, // 0: srpmproc.SpecChange.file_operation:type_name -> srpmproc.SpecChange.FileOperation
1, // 1: srpmproc.Cfg.replace:type_name -> srpmproc.Replace
2, // 2: srpmproc.Cfg.delete:type_name -> srpmproc.Delete
3, // 3: srpmproc.Cfg.add:type_name -> srpmproc.Add
4, // 4: srpmproc.Cfg.lookaside:type_name -> srpmproc.Lookaside
5, // 5: srpmproc.Cfg.spec_change:type_name -> srpmproc.SpecChange
6, // 6: srpmproc.Cfg.patch:type_name -> srpmproc.Patch
0, // 7: srpmproc.SpecChange.FileOperation.type:type_name -> srpmproc.SpecChange.FileOperation.Type
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_cfg_proto_init() }
@ -230,6 +778,66 @@ func file_cfg_proto_init() {
}
}
file_cfg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Delete); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cfg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Add); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cfg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Lookaside); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cfg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SpecChange); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cfg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Patch); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cfg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Cfg); i {
case 0:
return &v.state
@ -241,23 +849,43 @@ func file_cfg_proto_init() {
return nil
}
}
file_cfg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SpecChange_FileOperation); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_cfg_proto_msgTypes[0].OneofWrappers = []interface{}{
(*Replace_WithFile)(nil),
(*Replace_WithInline)(nil),
}
file_cfg_proto_msgTypes[4].OneofWrappers = []interface{}{
(*SpecChange_FileOperation_)(nil),
}
file_cfg_proto_msgTypes[7].OneofWrappers = []interface{}{
(*SpecChange_FileOperation_Add)(nil),
(*SpecChange_FileOperation_Delete)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cfg_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumEnums: 1,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cfg_proto_goTypes,
DependencyIndexes: file_cfg_proto_depIdxs,
EnumInfos: file_cfg_proto_enumTypes,
MessageInfos: file_cfg_proto_msgTypes,
}.Build()
File_cfg_proto = out.File

View File

@ -1,24 +1,100 @@
syntax = "proto3";
option go_package = "github.com/mstg/srpmproc/pb;srpmprocpb";
option go_package = "git.rockylinux.org/release-engineering/public/srpmproc/pb;srpmprocpb";
package srpmproc;
// Replace directive replaces literal files with other files.
// Replace directive replaces a file from the rpm repository
// with a file from the patch repository.
// Replacing content can either be inline or in the same patch-tree.
message Replace {
// required - replaced file
// Required - Replaced file
string file = 1;
oneof replacing {
// replace with in-tree file
// Replace with in-tree file
string with_file = 2;
// replace with inline content
// Replace with inline content
string with_inline = 3;
}
}
// Delete directive deletes literal files from the rpm repository.
// Won't delete from spec automatically.
// Use the `SpecChange` directive for that
message Delete {
// Required
string file = 1;
}
// Add directive adds a file from the patch repository to the rpm repository.
// The file is added in the `SOURCES` directory
// Won't add to spec automatically.
// Use the `SpecChange` directive for that
message Add {
// Required - file to add
string file = 1;
// Overrides file name if specified
string name = 2;
}
// Lookaside directive puts patched files in blob storage.
// If tar is true, the files will be put into a tarball and gzipped
message Lookaside {
// Required - List of files that should be stored in blob storage
repeated string files = 1;
// Whether files should be put into a tarball and gzipped
bool tar = 2;
}
// SpecChange directive makes it possible to execute certain
// plans against the package spec
message SpecChange {
// The FileOperation plan allows patchers to add or delete
// a file from the spec.
message FileOperation {
enum Type {
Unknown = 0;
Source = 1;
Patch = 2;
}
// File name
string file = 1;
// File type
Type type = 2;
oneof mode {
// Add won't add the file to the tree.
// Use the `Add` directive for that
bool add = 3;
// Delete won't delete the file from the tree.
// Use the `Delete` directive for that
bool delete = 4;
}
}
oneof operation {
FileOperation file_operation = 1;
}
}
message Patch {
// Path to patch file from repo root
string file = 1;
// Srpmproc adds `SOURCES/` to files in a diff
// without a prefix if strict is false.
// If strict is true, then that is disabled.
bool strict = 2;
}
message Cfg {
repeated Replace replace = 1;
repeated Delete delete = 2;
repeated Add add = 3;
repeated Lookaside lookaside = 4;
repeated SpecChange spec_change = 5;
repeated Patch patch = 6;
}