Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
Reproducible Builds
reproducible-misc
Compare revisions
6583a90fd4915b7892328473d3e793a0cf770e90...de0974fbe37e9bbb39a7a7a97ba6af1daacf4554
Commits (2)
Use str.format over %s and %r.
· 76937501
Chris Lamb
authored
Aug 30, 2019
76937501
Run the black reformatter over edit-notes.
· de0974fb
Chris Lamb
authored
Aug 30, 2019
de0974fb
Hide whitespace changes
Inline
Side-by-side
edit-notes
View file @
de0974fb
...
...
@@ -7,23 +7,28 @@ from rblib import remote
from
rblib
import
yamlfiles
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'--verbose'
,
action
=
'store_true'
)
parser
.
add_argument
(
'-f'
,
'--fix-note'
,
action
=
'append'
,
default
=
[])
parser
.
add_argument
(
'-r'
,
'--remove-note'
,
action
=
'append'
,
default
=
[])
parser
.
add_argument
(
'-a'
,
'--add-note'
,
action
=
'append'
,
default
=
[])
parser
.
add_argument
(
'-v'
,
'--take-version'
,
action
=
'store_true'
)
parser
.
add_argument
(
'-c'
,
'--set-comment'
)
parser
.
add_argument
(
'-b'
,
'--add-bug'
,
type
=
int
,
action
=
'append'
,
default
=
[])
parser
.
add_argument
(
'-d'
,
'--fix-deterministic'
,
action
=
'store_true'
)
parser
.
add_argument
(
'-u'
,
'--remove'
,
dest
=
'remove'
,
action
=
'store_true'
,
help
=
'remove the whole note block'
)
parser
.
add_argument
(
'packages'
,
nargs
=
'*'
)
parser
.
add_argument
(
"--verbose"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-f"
,
"--fix-note"
,
action
=
"append"
,
default
=[])
parser
.
add_argument
(
"-r"
,
"--remove-note"
,
action
=
"append"
,
default
=[])
parser
.
add_argument
(
"-a"
,
"--add-note"
,
action
=
"append"
,
default
=[])
parser
.
add_argument
(
"-v"
,
"--take-version"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-c"
,
"--set-comment"
)
parser
.
add_argument
(
"-b"
,
"--add-bug"
,
type
=
int
,
action
=
"append"
,
default
=[])
parser
.
add_argument
(
"-d"
,
"--fix-deterministic"
,
action
=
"store_true"
)
parser
.
add_argument
(
"-u"
,
"--remove"
,
dest
=
"remove"
,
action
=
"store_true"
,
help
=
"remove the whole note block"
,
)
parser
.
add_argument
(
"packages"
,
nargs
=
"*"
)
args
=
parser
.
parse_args
()
with
open
(
'
issues.yml
'
)
as
fd
:
with
open
(
"
issues.yml
"
)
as
fd
:
issues
=
yaml
.
safe_load
(
fd
)
if
__name__
==
'
__main__
'
:
if
__name__
==
"
__main__
"
:
to_fix
=
set
(
args
.
fix_note
)
to_remove
=
set
(
args
.
remove_note
)
to_fix
.
update
(
to_remove
)
...
...
@@ -34,12 +39,10 @@ if __name__ == '__main__':
#
Validate
issues
for
add
in
args
.
add_note
:
if
add
not
in
issues
.
keys
():
raise
ValueError
(
'%r
is not a valid issue
'
%
add
)
raise
ValueError
(
"{!r}
is not a valid issue
"
.
format
(
add
)
)
if
args
.
fix_deterministic
:
to_fix
.
update
(
k
for
(
k
,
v
)
in
issues
.
items
()
if
v
.
get
(
'deterministic'
,
False
)
)
to_fix
.
update
(
k
for
(
k
,
v
)
in
issues
.
items
()
if
v
.
get
(
"deterministic"
,
False
))
for
package
in
args
.
packages
or
notes
.
keys
():
try
:
...
...
@@ -48,26 +51,30 @@ if __name__ == '__main__':
try
:
status
=
testedpkgs
[
package
]
except
KeyError
:
print
(
"package
%s
appears not to exist; skipping"
%
package
)
print
(
"package
{}
appears not to exist; skipping"
.
format
(
package
)
)
continue
data
=
notes
[
package
]
=
{
'
version
'
:
status
[
'
version
'
]}
data
=
notes
[
package
]
=
{
"
version
"
:
status
[
"
version
"
]}
if
args
.
take_version
:
data
[
'
version
'
]
=
testedpkgs
[
package
][
'
version
'
]
data
[
"
version
"
]
=
testedpkgs
[
package
][
"
version
"
]
for
fix
in
to_fix
:
if
fix
in
to_remove
or
testedpkgs
.
get
(
package
,
{}).
get
(
'status'
,
False
)
==
'reproducible'
:
package_issues
=
data
.
get
(
'issues'
,
[])
if
(
fix
in
to_remove
or
testedpkgs
.
get
(
package
,
{}).
get
(
"status"
,
False
)
==
"reproducible"
):
package_issues
=
data
.
get
(
"issues"
,
[])
if
fix
in
package_issues
:
if
args
.
verbose
:
print
(
'https://reproducible.debian.net/%s seems to be fixed'
%
package
)
print
(
"https://reproducible.debian.net/{} seems to be fixed"
.
format
(
package
)
)
package_issues
.
remove
(
fix
)
for
src
,
dst
in
(
(
args
.
add_bug
,
'bugs'
),
(
args
.
add_note
,
'issues'
),
):
for
src
,
dst
in
((
args
.
add_bug
,
"bugs"
),
(
args
.
add_note
,
"issues"
)):
for
x
in
src
:
if
dst
not
in
data
:
data
[
dst
]
=
[]
...
...
@@ -77,13 +84,13 @@ if __name__ == '__main__':
data
[
dst
].
append
(
x
)
if
args
.
set_comment
:
data
[
'
comments
'
]
=
args
.
set_comment
data
[
"
comments
"
]
=
args
.
set_comment
if
args
.
remove
:
for
pkg
in
args
.
packages
:
try
:
notes
.
pop
(
pkg
)
except
KeyError
:
print
(
'
W: {} is not in the notes, skipping removing
'
.
format
(
pkg
))
print
(
"
W: {} is not in the notes, skipping removing
"
.
format
(
pkg
))
yamlfiles
.
write_out
(
notes
)