Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Adam Mercer
Koji Packager
Commits
4099eba4
Verified
Commit
4099eba4
authored
May 09, 2019
by
Adam Mercer
Browse files
pep8 formatting changes
parent
9da7edc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
koji-packager
View file @
4099eba4
...
...
@@ -30,58 +30,63 @@ import subprocess
# metadata
#
__version__
=
"0.0.1"
__version__
=
"0.0.1"
__target__
=
"sandbox"
#
# helper methods
#
def
parse_options
():
# define option parser
parser
=
argparse
.
ArgumentParser
(
description
=
'Build RPMs using Koji'
)
parser
.
add_argument
(
'--version'
,
action
=
'version'
,
version
=
__version__
)
parser
.
add_argument
(
'srpm'
,
help
=
'Source RPM to build with Koji'
)
koji_options
=
parser
.
add_argument_group
(
'Koji Options'
)
koji_options
.
add_argument
(
'--target'
,
default
=
__target__
,
help
=
'Koji tag to tag (%s)'
%
__target__
)
# define option parser
parser
=
argparse
.
ArgumentParser
(
description
=
'Build RPMs using Koji'
)
parser
.
add_argument
(
'--version'
,
action
=
'version'
,
version
=
__version__
)
parser
.
add_argument
(
'srpm'
,
help
=
'Source RPM to build with Koji'
)
koji_options
=
parser
.
add_argument_group
(
'Koji Options'
)
koji_options
.
add_argument
(
'--target'
,
default
=
__target__
,
help
=
'Koji tag to tag (%s)'
%
__target__
)
# parse options
args
=
parser
.
parse_args
()
# parse options
args
=
parser
.
parse_args
()
# check that source-rpm exists
srpm
=
pathlib
.
Path
(
args
.
srpm
)
if
not
srpm
.
is_file
():
print
(
'File %s does not exist.'
%
args
.
srpm
)
sys
.
exit
(
1
)
# check that source-rpm exists
srpm
=
pathlib
.
Path
(
args
.
srpm
)
if
not
srpm
.
is_file
():
print
(
'File %s does not exist.'
%
args
.
srpm
)
sys
.
exit
(
1
)
return
args
return
args
# method to check for connection to koji
def
check_connection_to_koji
():
try
:
subprocess
.
check_call
([
'koji'
,
'moshimoshi'
],
stdout
=
subprocess
.
DEVNULL
,
stderr
=
subprocess
.
STDOUT
)
except
subprocess
.
CalledProcessError
as
e
:
print
(
'Authentication failed, do you have a valid kerberos ticket?'
)
sys
.
exit
(
1
)
return
try
:
subprocess
.
check_call
([
'koji'
,
'moshimoshi'
],
stdout
=
subprocess
.
DEVNULL
,
stderr
=
subprocess
.
STDOUT
)
except
subprocess
.
CalledProcessError
:
print
(
'Authentication failed, do you have a valid kerberos ticket?'
)
sys
.
exit
(
1
)
return
#
# main program
#
def
main
():
args
=
parse_options
()
print
(
'source-rpm = %s'
%
args
.
srpm
)
print
(
'target tag = %s'
%
args
.
target
)
args
=
parse_options
()
print
(
'source-rpm = %s'
%
args
.
srpm
)
print
(
'target tag = %s'
%
args
.
target
)
# check that we can authenticate to koji
check_connection_to_koji
()
# check that we can authenticate to koji
check_connection_to_koji
()
#
# main program entry point
#
if
__name__
==
'__main__'
:
main
()
main
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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