Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
e94437835f |
|||
|
6b13ae1212 |
2 changed files with 12 additions and 14 deletions
|
|
@ -45,6 +45,11 @@ class Dependency: # export
|
||||||
case 3:
|
case 3:
|
||||||
if not parts[0] or not parts[2]:
|
if not parts[0] or not parts[2]:
|
||||||
self.__raise(f'Invalid dependency spec "{self.__spec}"')
|
self.__raise(f'Invalid dependency spec "{self.__spec}"')
|
||||||
|
if parts[2] == 'REVISION':
|
||||||
|
self.__raise(
|
||||||
|
f'Spec "{self.__spec}": a bare REVISION renders as a '
|
||||||
|
'bare number, which is likely not what the user intended'
|
||||||
|
)
|
||||||
return parts[0], Boundary(
|
return parts[0], Boundary(
|
||||||
op=parts[1],
|
op=parts[1],
|
||||||
version=Version(parts[0], parts[2], self.__lookup_version),
|
version=Version(parts[0], parts[2], self.__lookup_version),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
import io
|
|
||||||
|
|
||||||
from jw.pkg.lib.log import add_capture_stream, rm_capture_stream
|
|
||||||
from jw.pkg.lib.version import Component, Dependency, Syntax, Version
|
from jw.pkg.lib.version import Component, Dependency, Syntax, Version
|
||||||
|
|
||||||
class FakeApp:
|
class FakeApp:
|
||||||
|
|
@ -82,17 +79,13 @@ assert d.constraint_str(untemplated=False, include_revision=False) == \
|
||||||
# untemplated=False keeps the specifiers as written
|
# untemplated=False keeps the specifiers as written
|
||||||
d = Dependency('foo = VERSION', app.get_version)
|
d = Dependency('foo = VERSION', app.get_version)
|
||||||
assert d.constraint_str(untemplated = False) == 'foo = VERSION'
|
assert d.constraint_str(untemplated = False) == 'foo = VERSION'
|
||||||
# REVISION resolves to the revision part
|
# A bare REVISION is rejected on the grounds that is assumed that
|
||||||
d = Dependency('foo = REVISION', app.get_version)
|
# the user wanted VERSION instead
|
||||||
assert d.constraint_str() == 'foo = 45'
|
try:
|
||||||
assert d.constraint_str(untemplated = False) == 'foo = REVISION'
|
Dependency('foo = REVISION', app.get_version).constraint_str()
|
||||||
# A bare REVISION warns: RPM reads a bare number as a version
|
assert False, 'Should have raised'
|
||||||
buf = io.StringIO()
|
except Dependency.Error:
|
||||||
sd = add_capture_stream(buf)
|
pass
|
||||||
d = Dependency('foo = REVISION', app.get_version)
|
|
||||||
assert d.constraint_str() == 'foo = 45'
|
|
||||||
assert 'not a release constraint' in buf.getvalue()
|
|
||||||
rm_capture_stream(sd)
|
|
||||||
|
|
||||||
# The lookup uses the base name, not the subpackage name
|
# The lookup uses the base name, not the subpackage name
|
||||||
d = Dependency('foo-devel = VERSION', app.get_version)
|
d = Dependency('foo-devel = VERSION', app.get_version)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue