From 14b4ea4df9f2b806902796eb53182d173e32e6cf Mon Sep 17 00:00:00 2001 From: Magnus Skjegstad Date: Mon, 11 Mar 2019 10:12:35 +0100 Subject: [PATCH] Update conanfile.py - Use scm section instead of git checkout - Normalise function names - Automatic versioning based on commit id - Update metadata Signed-off-by: Magnus Skjegstad --- conanfile.py | 53 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/conanfile.py b/conanfile.py index d1725f77c..d1d3974b4 100644 --- a/conanfile.py +++ b/conanfile.py @@ -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):