mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-10 05:06:44 +02:00
fix: allow double digit epoch for Debian packages (#8671)
Debian packages were capped for a single digit epoch, relax that requirement to a double digit epoch. This is allowed by Debian. Resolves forgejo/forgejo#8649 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8671 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: pkpkpkpk <pkpkpkpk@noreply.codeberg.org> Co-committed-by: pkpkpkpk <pkpkpkpk@noreply.codeberg.org>
This commit is contained in:
parent
1761dae2db
commit
98e2a64e2d
2 changed files with 9 additions and 1 deletions
|
@ -46,7 +46,7 @@ var (
|
||||||
// https://www.debian.org/doc/debian-policy/ch-controlfields.html#source
|
// https://www.debian.org/doc/debian-policy/ch-controlfields.html#source
|
||||||
namePattern = regexp.MustCompile(`\A[a-z0-9][a-z0-9+-.]+\z`)
|
namePattern = regexp.MustCompile(`\A[a-z0-9][a-z0-9+-.]+\z`)
|
||||||
// https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
|
// https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
|
||||||
versionPattern = regexp.MustCompile(`\A(?:[0-9]:)?[a-zA-Z0-9.+~]+(?:-[a-zA-Z0-9.+-~]+)?\z`)
|
versionPattern = regexp.MustCompile(`\A(?:[1-9]?[0-9]:)?[a-zA-Z0-9.+~]+(?:-[a-zA-Z0-9.+-~]+)?\z`)
|
||||||
)
|
)
|
||||||
|
|
||||||
type Package struct {
|
type Package struct {
|
||||||
|
|
|
@ -167,6 +167,14 @@ func TestParseControlFile(t *testing.T) {
|
||||||
require.ErrorIs(t, err, ErrInvalidArchitecture)
|
require.ErrorIs(t, err, ErrInvalidArchitecture)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("ValidVersionEpoch", func(t *testing.T) {
|
||||||
|
for _, version := range []string{"0:1.2.3-test", "1:1.2.3-test", "9:1.2.3-test", "10:1.2.3-test", "37:1.2.3-test", "99:1.2.3-test"} {
|
||||||
|
p, err := ParseControlFile(buildContent(packageName, version, packageArchitecture))
|
||||||
|
require.NoError(t, err)
|
||||||
|
assert.NotNil(t, p)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
t.Run("Valid", func(t *testing.T) {
|
t.Run("Valid", func(t *testing.T) {
|
||||||
content := buildContent(packageName, packageVersion, packageArchitecture)
|
content := buildContent(packageName, packageVersion, packageArchitecture)
|
||||||
full := content.String()
|
full := content.String()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue