Skip to content

Commit

Permalink
Merge pull request #1 from MagnusS/update-conanfile
Browse files Browse the repository at this point in the history
Update conanfile.py
  • Loading branch information
MagnusS authored Mar 11, 2019
2 parents 9b0f9e3 + 14b4ea4 commit 578b2fe
Showing 1 changed file with 40 additions and 13 deletions.
53 changes: 40 additions & 13 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,59 @@
from conans import ConanFile,tools,CMake
import shutil

def get_version():
git = tools.Git()
try:
prev_tag = git.run("describe --tags --abbrev=0")
commits_behind = int(git.run("rev-list --count %s..HEAD" % (prev_tag)))
# Commented out checksum due to a potential bug when downloading from bintray
#checksum = git.run("rev-parse --short HEAD")
if prev_tag.startswith("v"):
prev_tag = prev_tag[1:]
if commits_behind > 0:
prev_tag_split = prev_tag.split(".")
prev_tag_split[-1] = str(int(prev_tag_split[-1]) + 1)
output = "%s-%d" % (".".join(prev_tag_split), commits_behind)
else:
output = "%s" % (prev_tag)
return output
except:
return '0.0.0'

class VmbuildConan(ConanFile):
settings= "os","arch"
settings= "os_build","arch_build"
name = "vmbuild"
license = 'Apache-2.0'
description = 'Run your application with zero overhead'
description = 'Utilities to build IncludeOS VMs'
version = get_version()
generators = 'cmake'
url = "http://www.includeos.org/"
exports_sources = "elf.h"
url = "http://github.com/includeos/vmbuild"

scm = {
"type" : "git",
"url" : "auto",
"subfolder": ".",
"revision" : "auto"
}

no_copy_source=True
default_user="includeos"
default_channel="test"

def build_requirements(self):
self.build_requires("GSL/2.0.0@includeos/test")

def source(self):
repo = tools.Git(folder="includeos")
repo.clone("https://github.com/hioa-cs/IncludeOS.git",branch="dev")
shutil.copy("elf.h", "includeos/vmbuild")

def _configure_cmake(self):
def _cmake_configure(self):
cmake = CMake(self)
cmake.configure(source_folder=self.source_folder+"/includeos/vmbuild")
cmake.configure(source_folder=self.source_folder)
return cmake

def build(self):
cmake=self._configure_cmake()
cmake=self._cmake_configure()
cmake.build()

def package(self):
cmake=self._configure_cmake()
cmake=self._cmake_configure()
cmake.install()

def package_info(self):
Expand Down

0 comments on commit 578b2fe

Please sign in to comment.