mirror of
https://github.com/rocky-linux/srpmproc.git
synced 2024-06-02 08:10:17 +00:00
Merge 6eb95dd278
into f2864a875a
This commit is contained in:
commit
20b8627e68
|
@ -35,6 +35,7 @@ var (
|
||||||
sshKeyLocation string
|
sshKeyLocation string
|
||||||
sshUser string
|
sshUser string
|
||||||
upstreamPrefix string
|
upstreamPrefix string
|
||||||
|
upstreamVersion int
|
||||||
version int
|
version int
|
||||||
storageAddr string
|
storageAddr string
|
||||||
gitCommitterName string
|
gitCommitterName string
|
||||||
|
@ -70,6 +71,7 @@ var root = &cobra.Command{
|
||||||
func mn(_ *cobra.Command, _ []string) {
|
func mn(_ *cobra.Command, _ []string) {
|
||||||
pd, err := srpmproc.NewProcessData(&srpmproc.ProcessDataRequest{
|
pd, err := srpmproc.NewProcessData(&srpmproc.ProcessDataRequest{
|
||||||
Version: version,
|
Version: version,
|
||||||
|
UpstreamVersion: upstreamVersion,
|
||||||
StorageAddr: storageAddr,
|
StorageAddr: storageAddr,
|
||||||
Package: sourceRpm,
|
Package: sourceRpm,
|
||||||
ModuleMode: moduleMode,
|
ModuleMode: moduleMode,
|
||||||
|
@ -122,6 +124,8 @@ func main() {
|
||||||
_ = root.MarkFlagRequired("upstream-prefix")
|
_ = root.MarkFlagRequired("upstream-prefix")
|
||||||
root.Flags().IntVar(&version, "version", 0, "Upstream version")
|
root.Flags().IntVar(&version, "version", 0, "Upstream version")
|
||||||
_ = root.MarkFlagRequired("version")
|
_ = root.MarkFlagRequired("version")
|
||||||
|
root.Flags().IntVar(&upstreamVersion, "upstream-version", 0, "Upstream version")
|
||||||
|
|
||||||
root.Flags().StringVar(&storageAddr, "storage-addr", "", "Bucket to use as blob storage")
|
root.Flags().StringVar(&storageAddr, "storage-addr", "", "Bucket to use as blob storage")
|
||||||
_ = root.MarkFlagRequired("storage-addr")
|
_ = root.MarkFlagRequired("storage-addr")
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ type ProcessData struct {
|
||||||
RpmLocation string
|
RpmLocation string
|
||||||
UpstreamPrefix string
|
UpstreamPrefix string
|
||||||
Version int
|
Version int
|
||||||
|
UpstreamVersion int
|
||||||
GitCommitterName string
|
GitCommitterName string
|
||||||
GitCommitterEmail string
|
GitCommitterEmail string
|
||||||
Mode int
|
Mode int
|
||||||
|
|
|
@ -69,6 +69,7 @@ const (
|
||||||
type ProcessDataRequest struct {
|
type ProcessDataRequest struct {
|
||||||
// Required
|
// Required
|
||||||
Version int
|
Version int
|
||||||
|
UpstreamVersion int
|
||||||
StorageAddr string
|
StorageAddr string
|
||||||
Package string
|
Package string
|
||||||
|
|
||||||
|
@ -172,6 +173,9 @@ func NewProcessData(req *ProcessDataRequest) (*data.ProcessData, error) {
|
||||||
logger := log.New(writer, "", log.LstdFlags)
|
logger := log.New(writer, "", log.LstdFlags)
|
||||||
|
|
||||||
// Set defaults
|
// Set defaults
|
||||||
|
if req.UpstreamVersion == 0 {
|
||||||
|
req.UpstreamVersion = req.Version
|
||||||
|
}
|
||||||
if req.ModulePrefix == "" {
|
if req.ModulePrefix == "" {
|
||||||
req.ModulePrefix = ModulePrefixCentOS
|
req.ModulePrefix = ModulePrefixCentOS
|
||||||
}
|
}
|
||||||
|
@ -313,6 +317,7 @@ func NewProcessData(req *ProcessDataRequest) (*data.ProcessData, error) {
|
||||||
RpmLocation: sourceRpmLocation,
|
RpmLocation: sourceRpmLocation,
|
||||||
UpstreamPrefix: req.UpstreamPrefix,
|
UpstreamPrefix: req.UpstreamPrefix,
|
||||||
Version: req.Version,
|
Version: req.Version,
|
||||||
|
UpstreamVersion: req.UpstreamVersion,
|
||||||
BlobStorage: blobStorage,
|
BlobStorage: blobStorage,
|
||||||
GitCommitterName: req.GitCommitterName,
|
GitCommitterName: req.GitCommitterName,
|
||||||
GitCommitterEmail: req.GitCommitterEmail,
|
GitCommitterEmail: req.GitCommitterEmail,
|
||||||
|
@ -1360,7 +1365,7 @@ func taglessBranchName(fullBranch string, pd *data.ProcessData) string {
|
||||||
|
|
||||||
// Simple case: if our branch is not a modular stream branch, just return the normal <prefix><version><suffix> pattern
|
// Simple case: if our branch is not a modular stream branch, just return the normal <prefix><version><suffix> pattern
|
||||||
if !strings.HasPrefix(branch, "stream-") {
|
if !strings.HasPrefix(branch, "stream-") {
|
||||||
return fmt.Sprintf("%s%d%s", pd.BranchPrefix, pd.Version, pd.BranchSuffix)
|
return fmt.Sprintf("%s%d%s", pd.BranchPrefix, pd.UpstreamVersion, pd.BranchSuffix)
|
||||||
}
|
}
|
||||||
|
|
||||||
// index where the "-rhel-" starts near the end of the string
|
// index where the "-rhel-" starts near the end of the string
|
||||||
|
@ -1373,5 +1378,6 @@ func taglessBranchName(fullBranch string, pd *data.ProcessData) string {
|
||||||
majorMinor := branch[rhelSpot+6:]
|
majorMinor := branch[rhelSpot+6:]
|
||||||
|
|
||||||
// return translated modular branch:
|
// return translated modular branch:
|
||||||
return fmt.Sprintf("%s%d%s-%s_%s", pd.BranchPrefix, pd.Version, pd.BranchSuffix, moduleString, majorMinor)
|
|
||||||
|
return fmt.Sprintf("%s%d%s-%s_%s", pd.BranchPrefix, pd.UpstreamVersion, pd.BranchSuffix, moduleString, majorMinor)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user