Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Adam Mercer
Koji Packager
Commits
71fa7dfa
Verified
Commit
71fa7dfa
authored
May 14, 2019
by
Adam Mercer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move rpm methods into rpm.py
parent
cdfe8f2f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
15 deletions
+37
-15
gwkoji/packager.py
gwkoji/packager.py
+9
-15
gwkoji/rpm.py
gwkoji/rpm.py
+28
-0
No files found.
gwkoji/packager.py
View file @
71fa7dfa
...
...
@@ -32,6 +32,7 @@ import tempfile
from
.
import
(
__version__
,
koji
,
rpm
,
)
from
.build
import
build_src_rpm
from
.utils
import
source_type
...
...
@@ -142,17 +143,6 @@ def parse_options():
return
args
# method to get the package name from the source
def
get_package_name_from_source_rpm
(
source
):
try
:
cmd
=
[
'rpm'
,
'--queryformat'
,
'%{NAME}'
,
'-qp'
,
source
]
pkg_name
=
subprocess
.
check_output
(
cmd
)
except
subprocess
.
CalledProcessError
as
e
:
print
(
'Unable to determine package name, %s'
%
e
)
sys
.
exit
(
1
)
return
pkg_name
.
decode
()
#
# main program
#
...
...
@@ -187,10 +177,14 @@ def main():
logger
.
info
(
"temporary src.rpm generated as '{0}'"
.
format
(
args
.
source
))
# get pkg name from source rpm
try
:
if
args
.
source_type
!=
"git"
:
pkg_name
=
get_package_name_from_source_rpm
(
args
.
source
)
pkg_name
=
rpm
.
get_package_name_from_source_rpm
(
args
.
source
)
logger
.
info
(
'package name = %s'
%
pkg_name
)
# how do we determine this when source is from git?
except
subprocess
.
CalledProcessError
as
e
:
logger
.
critical
(
"unable to determine package name, %s"
%
e
)
raise
# check that we can authenticate to koji
try
:
...
...
gwkoji/rpm.py
0 → 100644
View file @
71fa7dfa
# -*- coding: utf-8 -*-
# Copyright(C) 2019 Adam Mercer <adam.mercer@ligo.org>
#
# This file is part of gwkoji.
#
# gwkoji is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Interactions with rpm
"""
import
subprocess
# method to get the package name from the source
def
get_package_name_from_source_rpm
(
source
):
cmd
=
[
'rpm'
,
'--queryformat'
,
'%{NAME}'
,
'-qp'
,
source
]
return
subprocess
.
check_output
(
cmd
).
decode
()
Write
Preview
Markdown
is supported
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