aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice Ferrazzi <alicef@gentoo.org>2017-07-11 13:09:05 +0900
committerAlice Ferrazzi <alicef@gentoo.org>2017-07-11 13:09:05 +0900
commitdc77b8aad29ad39187c475dc1f4a6bfba432bd5f (patch)
tree0f807bd25929b2001cbf2ba4eb43020bc13af52b
parentadded function to the server for downloading the gentoo-sources (diff)
downloadelivepatch-dc77b8aad29ad39187c475dc1f4a6bfba432bd5f.tar.gz
elivepatch-dc77b8aad29ad39187c475dc1f4a6bfba432bd5f.tar.bz2
elivepatch-dc77b8aad29ad39187c475dc1f4a6bfba432bd5f.zip
Git clone is execute only if can be executed without stopping the server.
small fixes. Call to get kernel sources
-rw-r--r--elivepatch_server/resources/dispatcher.py3
-rw-r--r--elivepatch_server/resources/livepatch.py21
2 files changed, 13 insertions, 11 deletions
diff --git a/elivepatch_server/resources/dispatcher.py b/elivepatch_server/resources/dispatcher.py
index ed724f3..80fe469 100644
--- a/elivepatch_server/resources/dispatcher.py
+++ b/elivepatch_server/resources/dispatcher.py
@@ -75,8 +75,7 @@ class BuildLivePatch(Resource):
print("build livepatch: " + str(args))
# check vmlinux presence if not rebuild the kernel
kernel_vmlinux = os.path.join(kernel_dir, 'vmlinux')
- if not os.path.isdir(kernel_dir):
- lpatch.get_kernel(args['KernelVersion'])
+ lpatch.get_kernel_sources(args['UserID'], args['KernelVersion'])
if not os.path.isfile(kernel_vmlinux):
lpatch.build_kernel(kernel_dir)
lpatch.build_livepatch(kernel_dir, kernel_vmlinux)
diff --git a/elivepatch_server/resources/livepatch.py b/elivepatch_server/resources/livepatch.py
index 1307692..32fb2b5 100644
--- a/elivepatch_server/resources/livepatch.py
+++ b/elivepatch_server/resources/livepatch.py
@@ -97,15 +97,18 @@ class PaTch(object):
:return: void
"""
- command(['git','clone','https://github.com/aliceinwire/gentoo-sources_overlay.git'])
- command(['sudo','ROOT=/tmp/' + uuid_dir,'ebuild','gentoo-sources_overlay/sys-kernel/gentoo-sources/gentoo-sources-' + kernel_version + '.ebuild ', 'merge'])
-
-
-def build_kernel(self, kernel_source_dir):
- command(['sudo','make','oldconfig'], kernel_source_dir)
- command(['sudo','make'], kernel_source_dir)
- command(['sudo','make', 'modules'], kernel_source_dir)
- command(['sudo','make', 'modules_install'], kernel_source_dir)
+ try:
+ command(['git','clone','https://github.com/aliceinwire/gentoo-sources_overlay.git'])
+ except:
+ print('Gentoo-sources overlay already present.')
+ command(['sudo','ROOT=/tmp/' + uuid_dir,'ebuild','gentoo-sources_overlay/sys-kernel/gentoo-sources/gentoo-sources-' + kernel_version + '.ebuild', 'merge'])
+
+
+ def build_kernel(self, kernel_source_dir):
+ command(['sudo','make','oldconfig'], kernel_source_dir)
+ command(['sudo','make'], kernel_source_dir)
+ command(['sudo','make', 'modules'], kernel_source_dir)
+ command(['sudo','make', 'modules_install'], kernel_source_dir)
def command(bashCommand, kernel_source_dir=None):