Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
ce544f12
Commit
ce544f12
authored
Feb 15, 2012
by
Nicolas Dandrimont
🤔
Browse files
Overhaul the watchfile plugin
parent
2e2323e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
debexpo/plugins/watchfile.py
View file @
ce544f12
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
# This file is part of debexpo - http://debexpo.workaround.org
# This file is part of debexpo - http://debexpo.workaround.org
#
#
# Copyright © 2008 Jonny Lamb <jonny@debian.org>
# Copyright © 2008 Jonny Lamb <jonny@debian.org>
# Copyright © 2012 Nicolas Dandrimont <Nicolas.Dandrimont@crans.org>
#
#
# Permission is hereby granted, free of charge, to any person
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# obtaining a copy of this software and associated documentation
...
@@ -32,7 +33,10 @@ Holds the watchfile plugin.
...
@@ -32,7 +33,10 @@ Holds the watchfile plugin.
"""
"""
__author__
=
'Jonny Lamb'
__author__
=
'Jonny Lamb'
__copyright__
=
'Copyright © 2008 Jonny Lamb'
__copyright__
=
', '
.
join
([
'Copyright © 2008 Jonny Lamb'
,
'Copyright © 2012 Nicolas Dandrimont'
,
])
__license__
=
'MIT'
__license__
=
'MIT'
import
subprocess
import
subprocess
...
@@ -61,55 +65,46 @@ class WatchFilePlugin(BasePlugin):
...
@@ -61,55 +65,46 @@ class WatchFilePlugin(BasePlugin):
self
.
_run_uscan
()
self
.
_run_uscan
()
return
(
self
.
output
.
find
(
'Newest version on remote site is'
)
!=
-
1
)
return
(
self
.
output
.
find
(
'Newest version on remote site is'
)
!=
-
1
)
def
test_
watch_file_present
(
self
):
def
test_
uscan
(
self
):
"""
"""
Check to see whether there is a watch file
in the package
.
Run the watch file-related checks
in the package
"""
"""
data
=
{
"watch-file-present"
:
False
,
}
log
.
debug
(
'Checking to see whether there is a watch file in the package'
)
log
.
debug
(
'Checking to see whether there is a watch file in the package'
)
if
self
.
_watch_file_present
():
if
self
.
_watch_file_present
():
log
.
debug
(
'Watch file present'
)
log
.
debug
(
'Watch file present'
)
self
.
passed
(
'
watch-file-present
'
,
None
,
constants
.
PLUGIN_SEVERITY_INFO
)
data
[
"
watch-file-present
"
]
=
True
else
:
else
:
log
.
warning
(
'Watch file not present'
)
log
.
warning
(
'Watch file not present'
)
self
.
failed
(
'watch-file-not-present'
,
None
,
constants
.
PLUGIN_SEVERITY_WARNING
)
self
.
failed
(
'Watch file is not present'
,
data
,
constants
.
PLUGIN_SEVERITY_WARNING
)
return
def
test_watch_file_works
(
self
):
"""
Check to see whether the watch file works.
"""
if
not
self
.
_watch_file_present
():
return
[]
log
.
debug
(
'Checking to see whether the watch file works'
)
if
self
.
_watch_file_works
():
if
self
.
_watch_file_works
():
log
.
debug
(
'Watch file works'
)
log
.
debug
(
'Watch file works'
)
self
.
passed
(
'watch-file-works'
,
None
,
constants
.
PLUGIN_SEVERITY_INFO
)
data
[
"watch-file-works"
]
=
True
data
[
"uscan-output"
]
=
self
.
output
else
:
else
:
log
.
warning
(
'Watch file does not work'
)
log
.
warning
(
'Watch file does not work'
)
self
.
failed
(
'watch-file-does-not-work'
,
self
.
output
,
constants
.
PLUGIN_SEVERITY_WARNING
)
data
[
"watch-file-works"
]
=
False
data
[
"uscan-output"
]
=
self
.
output
self
.
failed
(
"A watch file is present but doesn't work"
,
data
,
constants
.
PLUGIN_SEVERITY_WARNING
)
return
def
test_new_upstream
(
self
):
"""
Check to see whether there is a new upstream version.
"""
if
not
self
.
_watch_file_present
():
return
[]
if
not
self
.
_watch_file_works
():
return
[]
log
.
debug
(
'Looking whether there is a new upstream version'
)
log
.
debug
(
'Looking whether there is a new upstream version'
)
if
self
.
status
==
1
:
if
self
.
status
==
1
:
log
.
debug
(
'Package is the latest upstream version'
)
log
.
debug
(
'Package is the latest upstream version'
)
self
.
passed
(
'no-new-upstream-available'
,
None
,
constants
.
PLUGIN_SEVERITY_INFO
)
data
[
"latest-upstream"
]
=
True
self
.
passed
(
'Package is the latest upstream version'
,
data
,
constants
.
PLUGIN_SEVERITY_INFO
)
else
:
else
:
log
.
warning
(
'Package is not the latest upstream version'
)
log
.
warning
(
'Package is not the latest upstream version'
)
self
.
failed
(
'new-upstream-available'
,
self
.
output
,
constants
.
PLUGIN_SEVERITY_WARNING
)
data
[
"latest-upstream"
]
=
False
self
.
failed
(
'Package is not the latest upstream version'
,
data
,
constants
.
PLUGIN_SEVERITY_WARNING
)
plugin
=
WatchFilePlugin
plugin
=
WatchFilePlugin
outcomes
=
{
'watch-file-present'
:
{
'name'
:
'A watch file is present'
},
'watch-file-not-present'
:
{
'name'
:
'A watch file is not present'
},
'watch-file-works'
:
{
'name'
:
'The watch file works'
},
'watch-file-does-not-work'
:
{
'name'
:
'The watch file does not work'
},
'new-upstream-available'
:
{
'name'
:
'A new upstream version is available'
},
'no-new-upstream-available'
:
{
'name'
:
'Package is the latest upstream version'
},
}
debexpo/templates/plugins/watchfile/html.mako
0 → 100644
View file @
ce544f12
<div class="qa-header">
${o.outcome}
</div>
%if o.rich_data["watch-file-present"] and (not o.rich_data["watch-file-works"] or not o.rich_data["latest-upstream"]):
<div class="qa-content">
${h.converters.nl2br(o.rich_data["uscan-output"])}
</div>
%endif
debexpo/templates/plugins/watchfile/text.mako
0 → 100644
View file @
ce544f12
${o.outcome}
%if o.rich_data["watch-file-present"] and (not o.rich_data["watch-file-works"] or not data["latest-upstream"]):
Uscan output :
${o.rich_data["uscan-output"]}
%endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment