-
Notifications
You must be signed in to change notification settings - Fork 8
[mirror] module pull improvements #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
33bedd4
++
f0a8e2f
++
3f8c5fc
++
7b635d6
++
09e9d43
Do not ignore errors in ApplyChannelAliasesIfNeeded
borg-z 2559b65
publish exact to all release channels
borg-z bc2826f
++
borg-z 63f62cc
help upd (In addition pulls current versions from release channels)
borg-z File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,21 @@ func addFlags(flagSet *pflag.FlagSet) { | |
"include-module", | ||
"i", | ||
nil, | ||
`Whitelist specific modules for downloading. Format is "module-name[@version]". Use one flag per each module. Disables blacklisting by --exclude-module."`, | ||
`Whitelist specific modules for downloading. Use one flag per each module. Disables blacklisting by --exclude-module." | ||
|
||
Example: | ||
Available versions for <module-name>: v1.0.0, v1.1.0, v1.2.0, v1.3.0, v1.3.3, v1.4.1 | ||
|
||
[email protected] → semver ^ constraint (^1.3.0): include v1.3.0, v1.3.3, v1.4.1 | ||
|
||
module-name@~1.3.0 → semver ~ constraint (>=1.3.0 <1.4.0): include only v1.3.0, v1.3.3 | ||
|
||
module-name@=v1.3.0 → exact tag match: include only v1.3.0 | ||
|
||
module-name@=bobV1 → exact tag match: include only bobV1 | ||
|
||
module-name@=v1.3.0+stable → exact tag match: include only v1.3.0 and tag it as stable | ||
`, | ||
) | ||
flagSet.StringArrayVarP( | ||
&ModulesBlacklist, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package modules | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/Masterminds/semver/v3" | ||
) | ||
|
||
type VersionConstraint interface { | ||
Match(version interface{}) bool | ||
IsExact() bool | ||
HasChannelAlias() bool | ||
} | ||
|
||
type SemanticVersionConstraint struct { | ||
constraint *semver.Constraints | ||
} | ||
|
||
func NewSemanticVersionConstraint(c string) (*SemanticVersionConstraint, error) { | ||
constraint, err := semver.NewConstraint(c) | ||
if err != nil { | ||
return nil, fmt.Errorf("invalid semantic version constraint %q: %w", c, err) | ||
} | ||
return &SemanticVersionConstraint{constraint: constraint}, nil | ||
} | ||
|
||
func (s *SemanticVersionConstraint) HasChannelAlias() bool { | ||
return false | ||
} | ||
|
||
func (s *SemanticVersionConstraint) Match(version interface{}) bool { | ||
switch v := version.(type) { | ||
case *semver.Version: | ||
return s.constraint.Check(v) | ||
default: | ||
return false | ||
} | ||
} | ||
|
||
func (s *SemanticVersionConstraint) IsExact() bool { | ||
return false | ||
} | ||
|
||
type ExactTagConstraint struct { | ||
tag string | ||
channel string | ||
} | ||
|
||
func (e *ExactTagConstraint) Tag() string { | ||
return e.tag | ||
} | ||
|
||
func (e *ExactTagConstraint) Channel() string { | ||
return e.channel | ||
} | ||
|
||
func NewExactTagConstraint(tag string) *ExactTagConstraint { | ||
return &ExactTagConstraint{tag: tag} | ||
} | ||
|
||
func NewExactTagConstraintWithChannel(tag string, channel string) *ExactTagConstraint { | ||
return &ExactTagConstraint{tag: tag, channel: channel} | ||
} | ||
|
||
func (e *ExactTagConstraint) Match(version interface{}) bool { | ||
switch v := version.(type) { | ||
case string: | ||
return e.tag == v | ||
default: | ||
return false | ||
} | ||
} | ||
|
||
func (e *ExactTagConstraint) IsExact() bool { | ||
return true | ||
} | ||
|
||
func (e *ExactTagConstraint) HasChannelAlias() bool { | ||
return e.channel != "" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.