Skip to content

Commit 77bbeb0

Browse files
author
Mohamad Noor Alim Hussin
committed
fixed syntax
1 parent 2eb24e0 commit 77bbeb0

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

toolkit/tools/internal/packagerepo/repocloner/rpmrepocloner/rpmrepocloner.go

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -670,63 +670,63 @@ func (r *RpmRepoCloner) clonePackage(baseArgs []string) (preBuilt bool, err erro
670670
}
671671

672672
func convertPackageVersionToTdnfArg(pkgVer *pkgjson.PackageVer) (tdnfArg string) {
673-
tdnfArg = pkgVer.Name
674-
675-
// TDNF does not accept versioning information on implicit provides.
676-
if pkgVer.IsImplicitPackage() {
677-
if pkgVer.Condition != "" || pkgVer.SCondition != "" {
678-
logger.Log.Warnf("Discarding version constraint for implicit package: %v", pkgVer)
679-
}
680-
return
681-
}
682-
683-
// Handle first condition
684-
var firstConstraint, secondConstraint string
685-
686-
switch pkgVer.Condition {
687-
case "":
688-
case "=":
689-
firstConstraint = fmt.Sprintf("%s-%s", pkgVer.Name, pkgVer.Version)
690-
tdnfArg = firstConstraint // For exact matches, use this format
691-
return // Don't process second condition for exact matches
692-
case "<=", "<":
693-
firstConstraint = fmt.Sprintf("%s %s %s", pkgVer.Name, pkgVer.Condition, pkgVer.Version)
694-
case ">", ">=":
695-
logger.Log.Warnf("Discarding '%s' version constraint for performance: %v", pkgVer.Condition, pkgVer)
696-
// Don't set firstConstraint, we're discarding this
697-
default:
698-
if pkgVer.Condition != "" {
699-
logger.Log.Errorf("Unsupported version constraint: %s", pkgVer.Condition)
700-
}
701-
}
702-
703-
// Handle second condition
704-
switch pkgVer.SCondition {
705-
case "":
706-
case "=":
707-
secondConstraint = fmt.Sprintf("%s-%s", pkgVer.Name, pkgVer.SVersion)
708-
case "<=", "<":
709-
secondConstraint = fmt.Sprintf("%s %s %s", pkgVer.Name, pkgVer.SCondition, pkgVer.SVersion)
710-
case ">", ">=":
711-
logger.Log.Warnf("Discarding '%s' second version constraint for performance: %v", pkgVer.SCondition, pkgVer)
712-
// Don't set secondConstraint, we're discarding this
713-
default:
714-
if pkgVer.SCondition != "" {
715-
logger.Log.Errorf("Unsupported second version constraint: %s", pkgVer.SCondition)
716-
}
717-
}
718-
719-
// Combine constraints
720-
if firstConstraint != "" && secondConstraint != "" {
721-
tdnfArg = fmt.Sprintf("%s %s", firstConstraint, secondConstraint)
722-
} else if firstConstraint != "" {
723-
tdnfArg = firstConstraint
724-
} else if secondConstraint != "" {
725-
tdnfArg = secondConstraint
726-
}
727-
// else tdnfArg remains just the package name
728-
729-
return
673+
tdnfArg = pkgVer.Name
674+
675+
// TDNF does not accept versioning information on implicit provides.
676+
if pkgVer.IsImplicitPackage() {
677+
if pkgVer.Condition != "" || pkgVer.SCondition != "" {
678+
logger.Log.Warnf("Discarding version constraint for implicit package: %v", pkgVer)
679+
}
680+
return
681+
}
682+
683+
// Handle first condition
684+
var firstConstraint, secondConstraint string
685+
686+
switch pkgVer.Condition {
687+
case "":
688+
case "=":
689+
firstConstraint = fmt.Sprintf("%s-%s", pkgVer.Name, pkgVer.Version)
690+
tdnfArg = firstConstraint // For exact matches, use this format
691+
return // Don't process second condition for exact matches
692+
case "<=", "<":
693+
firstConstraint = fmt.Sprintf("%s %s %s", pkgVer.Name, pkgVer.Condition, pkgVer.Version)
694+
case ">", ">=":
695+
logger.Log.Warnf("Discarding '%s' version constraint for performance: %v", pkgVer.Condition, pkgVer)
696+
// Don't set firstConstraint, we're discarding this
697+
default:
698+
if pkgVer.Condition != "" {
699+
logger.Log.Errorf("Unsupported version constraint: %s", pkgVer.Condition)
700+
}
701+
}
702+
703+
// Handle second condition
704+
switch pkgVer.SCondition {
705+
case "":
706+
case "=":
707+
secondConstraint = fmt.Sprintf("%s-%s", pkgVer.Name, pkgVer.SVersion)
708+
case "<=", "<":
709+
secondConstraint = fmt.Sprintf("%s %s %s", pkgVer.Name, pkgVer.SCondition, pkgVer.SVersion)
710+
case ">", ">=":
711+
logger.Log.Warnf("Discarding '%s' second version constraint for performance: %v", pkgVer.SCondition, pkgVer)
712+
// Don't set secondConstraint, we're discarding this
713+
default:
714+
if pkgVer.SCondition != "" {
715+
logger.Log.Errorf("Unsupported second version constraint: %s", pkgVer.SCondition)
716+
}
717+
}
718+
719+
// Combine constraints
720+
if firstConstraint != "" && secondConstraint != "" {
721+
tdnfArg = fmt.Sprintf("%s %s", firstConstraint, secondConstraint)
722+
} else if firstConstraint != "" {
723+
tdnfArg = firstConstraint
724+
} else if secondConstraint != "" {
725+
tdnfArg = secondConstraint
726+
}
727+
// else tdnfArg remains just the package name
728+
729+
return
730730
}
731731

732732
func (r *RpmRepoCloner) GetRepoSnapshotTime() string {

0 commit comments

Comments
 (0)