diff options
author | Alice Ferrazzi <alice.ferrazzi@gmail.com> | 2017-08-22 19:00:09 +0900 |
---|---|---|
committer | Alice Ferrazzi <alice.ferrazzi@gmail.com> | 2017-08-22 19:00:09 +0900 |
commit | 01b691c50b7f11df685008358e562ef17f8a5312 (patch) | |
tree | 3a228d0a865f061cf58e693529a58c8075c9ec14 | |
parent | refactor (diff) | |
download | elivepatch-01b691c50b7f11df685008358e562ef17f8a5312.tar.gz elivepatch-01b691c50b7f11df685008358e562ef17f8a5312.tar.bz2 elivepatch-01b691c50b7f11df685008358e562ef17f8a5312.zip |
added debug option to get_kernel_Sources function
code refactor
-rw-r--r-- | elivepatch_server/resources/livepatch.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/elivepatch_server/resources/livepatch.py b/elivepatch_server/resources/livepatch.py index b4890c9..c304f79 100644 --- a/elivepatch_server/resources/livepatch.py +++ b/elivepatch_server/resources/livepatch.py @@ -46,7 +46,7 @@ class PaTch(object): if debug: _command(['cp', '-f', os.path.join(kpatch_cachedir, 'build.log'), uuid_dir]) - def get_kernel_sources(self, uuid, kernel_version): + def get_kernel_sources(self, uuid, kernel_version, debug=True): """ Function for download the kernel sources @@ -58,14 +58,19 @@ class PaTch(object): print('git clone failed.') uuid_dir = os.path.join('/tmp/', 'elivepatch-' + uuid) - ebuild_path = os.path.join('gentoo-sources_overlay', 'sys-kernel', 'gentoo-sources', 'gentoo-sources-' + kernel_version + '.ebuild') + ebuild_path = os.path.join('gentoo-sources_overlay', 'sys-kernel', 'gentoo-sources', 'gentoo-sources-' + + kernel_version + '.ebuild') print(ebuild_path) if os.path.isfile(ebuild_path): # Use a private tmpdir for portage with tempfile.TemporaryDirectory(dir=uuid_dir) as portage_tmpdir: print('uuid_dir: ' + str(uuid_dir) + ' PORTAGE_TMPDIR: ' + str(portage_tmpdir)) - # portage_tmpdir is not always working with root priviledges - env = {'ROOT': uuid_dir, 'PORTAGE_CONFIGROOT': uuid_dir, 'PORTAGE_TMPDIR': portage_tmpdir} + # portage_tmpdir is not always working with root privileges + if debug: + env = {'ROOT': uuid_dir, 'PORTAGE_CONFIGROOT': uuid_dir, 'PORTAGE_TMPDIR': portage_tmpdir, + 'PORTAGE_DEBUG': '1'} + else: + env = {'ROOT': uuid_dir, 'PORTAGE_CONFIGROOT': uuid_dir, 'PORTAGE_TMPDIR': portage_tmpdir} _command(['ebuild', ebuild_path, 'clean', 'digest', 'merge'], env=env) kernel_sources_status = True else: |