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
5559796a
Verified
Commit
5559796a
authored
Aug 23, 2019
by
Mattia Rizzolo
Browse files
Merge branch 'feature/rfs-template' of salsa.debian.org:lyknode-guest/debexpo into live
MR:
!87
Signed-off-by:
Mattia Rizzolo
<
mattia@debian.org
>
parents
577fbd23
c943320a
Pipeline
#66469
passed with stage
in 7 minutes and 32 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
debexpo/controllers/sponsor.py
View file @
5559796a
...
@@ -103,7 +103,48 @@ class SponsorController(BaseController):
...
@@ -103,7 +103,48 @@ class SponsorController(BaseController):
return
False
return
False
return
True
return
True
def
_get_package_description
(
self
,
package_version
):
control
=
meta
.
session
.
query
(
PackageInfo
)
\
.
filter_by
(
package_version_id
=
package_version
.
id
)
\
.
filter_by
(
from_plugin
=
'controlfields'
)
\
.
first
()
if
control
:
info
=
json
.
loads
(
control
.
data
)
if
info
:
return
info
.
get
(
'Short-Description'
)
def
_get_package_rfs_info
(
self
,
package_version
):
def
_get_package_rfs_info
(
self
,
package_version
):
info
=
None
rfstemplate
=
meta
.
session
.
query
(
PackageInfo
)
\
.
filter_by
(
package_version_id
=
package_version
.
id
)
\
.
filter_by
(
from_plugin
=
'rfstemplate'
)
\
.
first
()
if
rfstemplate
:
info
=
json
.
loads
(
rfstemplate
.
data
)
control_fields
=
meta
.
session
.
query
(
PackageInfo
)
\
.
filter_by
(
package_version_id
=
package_version
.
id
)
\
.
filter_by
(
from_plugin
=
'controlfields'
)
\
.
first
()
if
rfstemplate
and
control_fields
:
fields
=
json
.
loads
(
control_fields
.
data
)
if
'Homepage'
in
fields
:
info
[
'upstream-url'
]
=
\
fields
[
'Homepage'
]
if
'Vcs-Browser'
in
fields
:
info
[
'package-vcs'
]
=
\
fields
[
'Vcs-Browser'
]
return
info
def
_get_package_extra_info
(
self
,
package_version
):
category
=
[]
category
=
[]
categories
=
None
categories
=
None
severity
=
None
severity
=
None
...
@@ -261,11 +302,13 @@ class SponsorController(BaseController):
...
@@ -261,11 +302,13 @@ class SponsorController(BaseController):
c
.
rfstemplate
=
None
c
.
rfstemplate
=
None
c
.
category
=
None
c
.
category
=
None
c
.
severity
=
None
c
.
severity
=
None
c
.
description
=
None
if
packagename
:
if
packagename
:
package
=
meta
.
session
.
query
(
Package
)
\
package
=
meta
.
session
.
query
(
Package
)
\
.
filter_by
(
name
=
packagename
)
\
.
filter_by
(
name
=
packagename
)
\
.
first
()
.
first
()
if
package
:
if
package
:
c
.
package
=
package
c
.
package
=
package
c
.
package_dir
=
get_package_dir
(
package
.
name
)
c
.
package_dir
=
get_package_dir
(
package
.
name
)
...
@@ -274,32 +317,12 @@ class SponsorController(BaseController):
...
@@ -274,32 +317,12 @@ class SponsorController(BaseController):
.
filter_by
(
package_id
=
package
.
id
)
\
.
filter_by
(
package_id
=
package
.
id
)
\
.
order_by
(
PackageVersion
.
id
.
desc
())
\
.
order_by
(
PackageVersion
.
id
.
desc
())
\
.
first
()
.
first
()
if
latest
:
rfstemplate
=
meta
.
session
.
query
(
PackageInfo
)
\
.
filter_by
(
package_version_id
=
latest
.
id
)
\
.
filter_by
(
from_plugin
=
'rfstemplate'
)
\
.
first
()
if
rfstemplate
:
if
latest
:
c
.
rfstemplate
=
json
.
loads
(
rfstemplate
.
data
)
c
.
rfstemplate
=
self
.
_get_package_rfs_info
(
latest
)
(
c
.
category
,
c
.
severity
)
=
\
control_fields
=
meta
.
session
.
query
(
PackageInfo
)
\
self
.
_get_package_extra_info
(
latest
)
.
filter_by
(
package_version_id
=
latest
.
id
)
\
c
.
description
=
self
.
_get_package_description
(
latest
)
.
filter_by
(
from_plugin
=
'controlfields'
)
\
.
first
()
if
rfstemplate
and
control_fields
:
fields
=
json
.
loads
(
control_fields
.
data
)
if
'Homepage'
in
fields
:
c
.
rfstemplate
[
'upstream-url'
]
=
\
fields
[
'Homepage'
]
if
'Vcs-Browser'
in
fields
:
c
.
rfstemplate
[
'package-vcs'
]
=
\
fields
[
'Vcs-Browser'
]
(
c
.
category
,
c
.
severity
)
=
self
.
_get_package_rfs_info
(
latest
)
# This is a workaround for Thunderbird and some other clients
# This is a workaround for Thunderbird and some other clients
# not handling properly '+' in the mailto body parameter.
# not handling properly '+' in the mailto body parameter.
...
...
debexpo/plugins/controlfields.py
View file @
5559796a
...
@@ -90,13 +90,18 @@ class ControlFieldsPlugin(BasePlugin):
...
@@ -90,13 +90,18 @@ class ControlFieldsPlugin(BasePlugin):
descriptions
=
[]
descriptions
=
[]
for
package
in
deb822
.
Dsc
.
iter_paragraphs
(
for
package
in
deb822
.
Dsc
.
iter_paragraphs
(
file
(
join
(
'extracted'
,
'debian'
,
'control'
))):
file
(
join
(
'extracted'
,
'debian'
,
'control'
))):
if
(
'Description'
in
package
and
'Package'
in
package
and
if
all
(
package
.
get
(
i
)
for
i
in
(
'Package'
,
'Description'
)):
package
[
'Package'
]
and
package
[
'Description'
]):
if
package
[
'Package'
]
==
control
.
get
(
'Source'
):
data
[
'Short-Description'
]
=
\
package
[
'Description'
].
split
(
'
\n
'
)[
0
]
descriptions
.
append
(
'{} - {}'
.
format
(
package
[
'Package'
],
descriptions
.
append
(
'{} - {}'
.
format
(
package
[
'Package'
],
package
[
'Description'
].
split
(
'
\n
'
)[
0
]))
package
[
'Description'
].
split
(
'
\n
'
)[
0
]))
data
[
'Description'
]
=
'
\n
'
.
join
(
descriptions
)
data
[
'Description'
]
=
'
\n
'
.
join
(
descriptions
)
if
'Short-Description'
not
in
data
and
descriptions
:
data
[
'Short-Description'
]
=
descriptions
[
0
].
split
(
' - '
)[
1
]
self
.
failed
(
outcome
,
data
,
severity
)
self
.
failed
(
outcome
,
data
,
severity
)
...
...
debexpo/plugins/rfstemplate.py
View file @
5559796a
...
@@ -91,6 +91,9 @@ class RfsTemplatePlugin(BasePlugin):
...
@@ -91,6 +91,9 @@ class RfsTemplatePlugin(BasePlugin):
upstream_license
=
"[fill in]"
upstream_license
=
"[fill in]"
package_changelog
=
"[your most recent changelog entry]"
package_changelog
=
"[your most recent changelog entry]"
outcome
=
"RFS: license, author and changelog parsed"
severity
=
constants
.
PLUGIN_SEVERITY_INFO
package_changelog
=
self
.
changes
.
get
(
'Changes'
,
''
).
strip
()
package_changelog
=
self
.
changes
.
get
(
'Changes'
,
''
).
strip
()
if
len
(
package_changelog
.
split
(
'
\n
'
))
>
2
:
if
len
(
package_changelog
.
split
(
'
\n
'
))
>
2
:
...
@@ -100,8 +103,15 @@ class RfsTemplatePlugin(BasePlugin):
...
@@ -100,8 +103,15 @@ class RfsTemplatePlugin(BasePlugin):
if
'author'
in
copyright_info
:
if
'author'
in
copyright_info
:
upstream_author
=
copyright_info
[
'author'
]
upstream_author
=
copyright_info
[
'author'
]
else
:
outcome
=
"RFS: author info missing"
severity
=
constants
.
PLUGIN_SEVERITY_WARNING
if
'license'
in
copyright_info
:
if
'license'
in
copyright_info
:
upstream_license
=
copyright_info
[
'license'
]
upstream_license
=
copyright_info
[
'license'
]
else
:
outcome
=
"RFS: no dep5 license"
severity
=
constants
.
PLUGIN_SEVERITY_ERROR
data
=
{
data
=
{
'upstream-author'
:
upstream_author
,
'upstream-author'
:
upstream_author
,
...
@@ -109,8 +119,6 @@ class RfsTemplatePlugin(BasePlugin):
...
@@ -109,8 +119,6 @@ class RfsTemplatePlugin(BasePlugin):
'package-changelog'
:
package_changelog
,
'package-changelog'
:
package_changelog
,
}
}
outcome
=
"RFS template information"
severity
=
constants
.
PLUGIN_SEVERITY_INFO
self
.
passed
(
outcome
,
data
,
severity
)
self
.
passed
(
outcome
,
data
,
severity
)
...
...
debexpo/templates/plugins/rfstemplate/html.mako
0 → 100644
View file @
5559796a
<div class="qa-header">
${str(o.outcome)}
</div>
%if o.rich_data:
%if o.severity != 3:
<div class="qa-content">
%if o.severity == 2:
Upstream-Contact: was not found in d/copyright.<br/>
RFS will not autocomplete the Upstream author.
%else:
<dt>Author</dt>
<dd>${o.rich_data['upstream-author']}</dd>
%endif
<dt>License</dt>
<dd>${o.rich_data['upstream-license']}</dd>
<dt>Changelog</dt>
<dd><pre>${o.rich_data['package-changelog']}</pre></dd>
</dl>
</div>
%endif
%endif
debexpo/templates/plugins/rfstemplate/text.mako
0 → 100644
View file @
5559796a
%for field, contents in sorted(o.rich_data.items()):
${field}: ${contents}
%endfor
debexpo/templates/sponsor/rfs_howto.mako
View file @
5559796a
...
@@ -40,9 +40,9 @@ list. You can browser other packages and give other people feedback while you ar
...
@@ -40,9 +40,9 @@ list. You can browser other packages and give other people feedback while you ar
<
p
>
<
p
>
%
if
c
.
package
:
%
if
c
.
package
:
%
if
c
.
category
:
%
if
c
.
category
:
<
a
href
=
"mailto:submit@bugs.debian.org?subject=RFS: ${ c.package.name }/${ c.package.package_versions[-1].version } ${ c.category } -- ${ c.
package.short_
description
()
}&body=${ c.mailbody }"
>
<
a
href
=
"mailto:submit@bugs.debian.org?subject=RFS: ${ c.package.name }/${ c.package.package_versions[-1].version } ${ c.category } -- ${ c.description }&body=${ c.mailbody }"
>
%
else
:
%
else
:
<
a
href
=
"mailto:submit@bugs.debian.org?subject=RFS: ${ c.package.name }/${ c.package.package_versions[-1].version } -- ${ c.
package.short_
description
()
}&body=${ c.mailbody }"
>
<
a
href
=
"mailto:submit@bugs.debian.org?subject=RFS: ${ c.package.name }/${ c.package.package_versions[-1].version } -- ${ c.description }&body=${ c.mailbody }"
>
%
endif
%
endif
%
else
:
%
else
:
<
a
href
=
"mailto:submit@bugs.debian.org?subject=RFS: hello/3.1-4 [put in ITP, ITA, RC, NMU if applicable] -- friendly greeter&body=${ c.mailbody }"
>
<
a
href
=
"mailto:submit@bugs.debian.org?subject=RFS: hello/3.1-4 [put in ITP, ITA, RC, NMU if applicable] -- friendly greeter&body=${ c.mailbody }"
>
...
@@ -63,9 +63,9 @@ From: J. Maintainer <j@example.com>
...
@@ -63,9 +63,9 @@ From: J. Maintainer <j@example.com>
To
:
submit
@
bugs
.
debian
.
org
To
:
submit
@
bugs
.
debian
.
org
%
if
c
.
package
:
%
if
c
.
package
:
%
if
c
.
category
:
%
if
c
.
category
:
Subject
:
RFS
:
${
c
.
package
.
name
}/${
c
.
package
.
package_versions
[-
1
].
version
}
${
c
.
category
}
--
${
c
.
package
.
short_
description
()
}
Subject
:
RFS
:
${
c
.
package
.
name
}/${
c
.
package
.
package_versions
[-
1
].
version
}
${
c
.
category
}
--
${
c
.
description
}
%
else
:
%
else
:
Subject
:
RFS
:
${
c
.
package
.
name
}/${
c
.
package
.
package_versions
[-
1
].
version
}
--
${
c
.
package
.
short_
description
()
}
Subject
:
RFS
:
${
c
.
package
.
name
}/${
c
.
package
.
package_versions
[-
1
].
version
}
--
${
c
.
description
}
%
endif
%
endif
%
else
:
%
else
:
Subject
:
RFS
:
hello
/
3.1
-
4
[
put
in
ITP
,
ITA
,
RC
,
NMU
if
applicable
]
--
friendly
greeter
Subject
:
RFS
:
hello
/
3.1
-
4
[
put
in
ITP
,
ITA
,
RC
,
NMU
if
applicable
]
--
friendly
greeter
...
...
debexpo/templates/sponsor/rfs_template.mako
View file @
5559796a
...
@@ -38,6 +38,7 @@ I am looking for a sponsor for my package "hello":
...
@@ -38,6 +38,7 @@ I am looking for a sponsor for my package "hello":
Upstream Author : [fill in name and email of upstream]
Upstream Author : [fill in name and email of upstream]
* URL : [fill in URL of upstream's web site]
* URL : [fill in URL of upstream's web site]
* License : [fill in]
* License : [fill in]
* Vcs : [fill in URL of packaging vcs]
%endif
%endif
%if c.package:
%if c.package:
Section : ${ c.package.package_versions[-1].section }
Section : ${ c.package.package_versions[-1].section }
...
@@ -47,8 +48,8 @@ I am looking for a sponsor for my package "hello":
...
@@ -47,8 +48,8 @@ I am looking for a sponsor for my package "hello":
It builds those binary packages:
It builds those binary packages:
%if c.package:
%if c.package
and c.package.description
:
${ c.package.description }
${
'\n '.join(
c.package.description
.splitlines())
}
%else:
%else:
hello - friendly greeter
hello - friendly greeter
%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