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
718f7d44
Commit
718f7d44
authored
Feb 14, 2012
by
Nicolas Dandrimont
🤔
Browse files
Overhaul the build-system plugin
parent
bf19f91a
Changes
3
Hide whitespace changes
Inline
Side-by-side
debexpo/plugins/buildsystem.py
View file @
718f7d44
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#
#
# Copyright © 2008 Jonny Lamb <jonny@debian.org>
# Copyright © 2008 Jonny Lamb <jonny@debian.org>
# Copyright © 2010 Jan Dittberner <jandd@debian.org>
# Copyright © 2010 Jan Dittberner <jandd@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
...
@@ -33,10 +34,16 @@ Holds the buildsystem plugin.
...
@@ -33,10 +34,16 @@ Holds the buildsystem plugin.
"""
"""
__author__
=
'Jonny Lamb'
__author__
=
'Jonny Lamb'
__copyright__
=
'Copyright © 2008 Jonny Lamb, Copyright © 2010 Jan Dittberner'
__copyright__
=
', '
.
join
([
'Copyright © 2008 Jonny Lamb'
,
'Copyright © 2010 Jan Dittberner'
,
'Copyright © 2012 Nicolas Dandrimont'
,
])
__license__
=
'MIT'
__license__
=
'MIT'
import
logging
import
logging
import
os
from
debian
import
deb822
from
debian
import
deb822
from
debexpo.lib
import
constants
from
debexpo.lib
import
constants
...
@@ -54,26 +61,39 @@ class BuildSystemPlugin(BasePlugin):
...
@@ -54,26 +61,39 @@ class BuildSystemPlugin(BasePlugin):
dsc
=
deb822
.
Dsc
(
file
(
self
.
changes
.
get_dsc
()))
dsc
=
deb822
.
Dsc
(
file
(
self
.
changes
.
get_dsc
()))
data
=
{}
severity
=
constants
.
PLUGIN_SEVERITY_INFO
build_depends
=
dsc
.
get
(
'Build-Depends'
,
''
)
build_depends
=
dsc
.
get
(
'Build-Depends'
,
''
)
if
'cdbs'
in
build_depends
:
if
'cdbs'
in
build_depends
:
log
.
debug
(
'Package uses CDBS'
)
outcome
=
"Package uses CDBS"
self
.
info
(
'uses-cdbs'
,
None
)
data
[
"build-system"
]
=
"cdbs"
elif
'debhelper (7'
in
build_depends
:
log
.
debug
(
'Package uses debhelper 7'
)
self
.
info
(
'uses-dh'
,
None
)
elif
'debhelper'
in
build_depends
:
elif
'debhelper'
in
build_depends
:
log
.
debug
(
'Package uses straight debhelper'
)
data
[
"build-system"
]
=
"debhelper"
self
.
info
(
'uses-debhelper'
,
None
)
# Retrieve the debhelper compat level
compatpath
=
os
.
path
.
join
(
self
.
tempdir
,
"extracted/debian/compat"
)
try
:
with
open
(
compatpath
,
"rb"
)
as
f
:
compat_level
=
int
(
f
.
read
().
strip
())
except
IOError
:
compat_level
=
None
data
[
"compat-level"
]
=
compat_level
# Warn on old compatibility levels
if
compat_level
is
None
or
compat_level
<=
4
:
outcome
=
"Package uses debhelper with an old compatibility level"
severity
=
constants
.
PLUGIN_SEVERITY_WARNING
else
:
outcome
=
"Package uses debhelper"
else
:
else
:
log
.
warning
(
'Build system cannot be determined'
)
outcome
=
"Package uses an unknown build system"
self
.
failed
(
'unknown-build-system'
,
None
,
constants
.
PLUGIN_SEVERITY_WARNING
)
data
[
"build-system"
]
=
"unknown"
severity
=
constants
.
PLUGIN_SEVERITY_WARNING
plugin
=
BuildSystemPlugin
self
.
failed
(
outcome
,
data
,
severity
)
outcomes
=
{
'uses-cdbs'
:
{
'name'
:
'The packages uses CDBS'
},
plugin
=
BuildSystemPlugin
'uses-debhelper'
:
{
'name'
:
'The package uses straight debhelper'
},
'uses-dh'
:
{
'name'
:
'The package uses debhelper 7'
},
'unknown-build-system'
:
{
'name'
:
'The package
\'
s build system cannot be determined'
},
}
debexpo/templates/plugins/buildsystem/html.mako
0 → 100644
View file @
718f7d44
<div class="qa-header">
Buildsystem: ${o.outcome}
</div>
<div class="qa-content">
%if o.rich_data["build-system"] == "debhelper":
%if o.rich_data["compat-level"]:
Debhelper compatibility level ${o.rich_data["compat-level"]}
%else:
No compatibility level set!
%endif
%endif
</div>
\ No newline at end of file
debexpo/templates/plugins/buildsystem/text.mako
0 → 100644
View file @
718f7d44
Buildsystem: ${o.outcome}
%if o.rich_data["build-system"] == "debhelper":
%if o.rich_data["compat-level"]:
Debhelper compatibility level ${o.rich_data["compat-level"]}
%else:
No compatibility level set!
%endif
%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