Skip to content

Commit 09b8689

Browse files
authored
Merge pull request #2 from alfred-bratterud/master
Reorganize scripts
2 parents d02e7b4 + f087f48 commit 09b8689

9 files changed

Lines changed: 93 additions & 16 deletions

File tree

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
draw_white_space = all
11+
trim_trailing_white_space_on_save = true
12+
13+
[Makefile]
14+
indent_style = tab
15+
16+
[Makelib]
17+
indent_style = tab
18+
19+
[*.py]
20+
indent_size = 4
21+
22+
[boot]
23+
indent_size = 4
24+
25+
[*.asm]
26+
indent_size = 4

conanfile.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import os
2+
from conans import ConanFile,tools
3+
4+
def get_version():
5+
git = tools.Git()
6+
try:
7+
prev_tag = git.run("describe --tags --abbrev=0")
8+
commits_behind = int(git.run("rev-list --count %s..HEAD" % (prev_tag)))
9+
# Commented out checksum due to a potential bug when downloading from bintray
10+
#checksum = git.run("rev-parse --short HEAD")
11+
if prev_tag.startswith("v"):
12+
prev_tag = prev_tag[1:]
13+
if commits_behind > 0:
14+
prev_tag_split = prev_tag.split(".")
15+
prev_tag_split[-1] = str(int(prev_tag_split[-1]) + 1)
16+
output = "%s-%d" % (".".join(prev_tag_split), commits_behind)
17+
else:
18+
output = "%s" % (prev_tag)
19+
return output
20+
except:
21+
return '0.0.0'
22+
23+
24+
class VmrunnerConan(ConanFile):
25+
name = "vmrunner"
26+
version = get_version()
27+
license = "Apache-2.0"
28+
description = "A set of tools for booting IncludeOS binaries as VM's"
29+
scm = {
30+
"type" : "git",
31+
"url" : "auto",
32+
"subfolder": ".",
33+
"revision" : "auto"
34+
}
35+
no_copy_source=True
36+
default_user="includeos"
37+
default_channel="test"
38+
39+
def package(self):
40+
self.copy("*", dst="vmrunner", src="vmrunner")
41+
self.copy("*", dst="bin", src="scripts")
42+
43+
def package_info(self):
44+
self.env_info.INCLUDEOS_VMRUNNER=self.package_folder
45+
self.env_info.path.append((os.path.join(self.package_folder, "bin")))
46+
47+
def deploy(self):
48+
self.copy("*", dst="vmrunner",src="vmrunner")
49+
self.copy("*", dst="bin",src="bin")

etc/boot renamed to scripts/boot

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,20 @@ import argparse
1111
import subprocess
1212
import re
1313

14-
INCLUDEOS_PREFIX = None
15-
default_prefix = "/usr/local/includeos"
16-
17-
# Locate IncludeOS installation
18-
if "INCLUDEOS_PREFIX" not in os.environ:
19-
INCLUDEOS_PREFIX = default_prefix
20-
else:
21-
INCLUDEOS_PREFIX = os.environ['INCLUDEOS_PREFIX']
22-
23-
if not os.path.isdir(INCLUDEOS_PREFIX):
24-
print "Couldn't find IncludeOS installation. If you installed to a non-default location (e.g. not " + default_prefix + ") please set the environment variable INCLUDEOS_PREFIX to point to this location."
14+
INCLUDEOS_VMRUNNER = None
15+
16+
# Locate vmrunner installation
17+
if "INCLUDEOS_VMRUNNER" not in os.environ or not os.path.isdir(os.environ['INCLUDEOS_VMRUNNER']):
18+
errmsg="""
19+
Couldn't find vmrunner installation. Please set the environment variable
20+
INCLUDEOS_VMRUNNER to point to this location (if your using conan virtualenv
21+
this should have been done for you)
22+
"""
23+
print(errmsg)
2524
sys.exit(0)
2625

2726
# Location of vmrunner
28-
sys.path.append(INCLUDEOS_PREFIX+'/tools')
27+
sys.path.append(os.environ["INCLUDEOS_VMRUNNER"])
2928

3029
from vmrunner.prettify import color
3130

@@ -160,10 +159,13 @@ hyper_name = "qemu"
160159
if args.solo5:
161160
hyper_name = "solo5"
162161
os.environ['PLATFORM'] = "x86_solo5"
163-
solo5_hvt = INCLUDEOS_PREFIX + "/x86_64/bin/solo5-hvt"
162+
163+
# We expect these to be added to path now, e.g. by conan virtualenv
164+
solo5_hvt = "solo5-hvt"
165+
solo5_ifup = "solo5-ifup.sh"
164166

165167
subprocess.call(['chmod', '+x', solo5_hvt])
166-
subprocess.call(['sudo', INCLUDEOS_PREFIX + "/scripts/solo5-ifup.sh" ])
168+
subprocess.call(['sudo', solo5_ifup])
167169

168170
vm = vmrunner.add_vm(config = config, hyper_name = hyper_name)
169171

@@ -182,7 +184,7 @@ if (args.debug):
182184

183185
if args.bridge:
184186
print INFO, "Creating bridge"
185-
subprocess.call(INCLUDEOS_PREFIX + "/scripts/create_bridge.sh", shell=True)
187+
subprocess.call("create_bridge.sh", shell=True)
186188

187189
# If the binary name is a folder, such as ".", build the service
188190
if os.path.isdir(image_name):
@@ -207,7 +209,7 @@ if (args.grub or args.grub_reuse):
207209
if args.grub_reuse:
208210
opts += "-u "
209211

210-
subprocess.call(INCLUDEOS_PREFIX + "/scripts/grubify.sh " + opts + image_name, shell=True)
212+
subprocess.call("grubify.sh " + opts + image_name, shell=True)
211213
image_name = image_name + ".grub.img"
212214
has_bootloader = True
213215

File renamed without changes.

0 commit comments

Comments
 (0)