clearcontainers / packaging

Packaging data for Clear Containers
11 stars 11 forks source link

qemu-lite: Add version support #99

Closed gorozco1 closed 7 years ago

gorozco1 commented 7 years ago

Qemu supports 2 types of version info in its binary:

  1. By Default: Qemu adds the output of git describe --match 'v*' HEAD to its version string. This is defined in its top level makefile. The version string results as following: v2.9.0-28-g6177d1bd7c-dirty which is decoded as: v2.9.0: The latest tag to match from the current commit 28: The number of actual commits since the tag g6177d1bd7c: Drop 'g'. 6177d1bd7c is the current commit hash short form. dirty: If any change is not committed

    This gets changed when one does a new commit on the local tree, and runs make. Subsequent makes will not change any of the string, until a new commit is made.

    Hence qemu --version already gives the commit version, which is required.

  2. One can add a string during configure phase: ./configure --with-pkgversion=foo.

    Then Qemu wont use git query to determine the commit version etc. It would simply add this string as version. This is useful for hot fixes. But one needs to keep track of the strings with corresponding built image hashes.

    http://lists.gnu.org/archive/html/qemu-devel/2017-03/msg03229.html

  3. In case its built from a tgz download with no .git subfolder, and user does not supply the pkgversion string, the version might be coming as blank. This I have not tested but deducing from the top level Makefile.

Adds a small patch to fix the default version of the qemu-lite we were shiping. 2.7.0 instead of 2.7.1

Fixes: #100 Fixes: #114

Signed-off-by: Geronimo Orozco geronimo.orozco@intel.com

gorozco1 commented 7 years ago

This commit is missing a change in https://github.com/clearcontainers/packaging/blob/master/qemu-lite/debian.rules and https://github.com/clearcontainers/packaging/blob/master/scripts/configure-hypervisor.sh

jodh-intel commented 7 years ago

On an Ubuntu test system, I see:

$ dpkg -l qemu-lite|grep ^ii       
ii  qemu-lite      2.7.1+git.741f430a96-6.1 amd64        linux kernel optimised for container-like workloads.
$  qemu-lite-system-x86_64 --version
QEMU emulator version 2.7.0, Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers

Unless I'm mis-reading this PR, won't it just generate a version of 2.7.1-0?

What we really want --version to display is:

$  qemu-lite-system-x86_64 --version
QEMU emulator version 2.7.0+git.741f430a96-6.1, Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers

I even wonder if we want to add a cc to the version string to make it even clearer that this is a Clear Containers version.

gorozco1 commented 7 years ago

@jodh-intel Two issues:

1- We are about to get rid of the "+git.{hash}" string in packages as we have the release version in each package. 2- Yes the intention here is to show this:

  qemu-lite-system-x86_64 --version
QEMU emulator version 2.7.0.741f430a96-7 Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers
jodh-intel commented 7 years ago

Hi @gorozco1 - I don't think that version string is what we want as it doesn't conform to http://semver.org/. All the components we produce use semantic versioning. Obviously, we don't control QEMU, but it seems to follow the semantic versioning standard.

2.7.0.741f430a96-7 Doesn't really work as it's not a semver version.

I think we have two main options:

gorozco1 commented 7 years ago

@jodh-intel oh, thanks for the feedback, I'll go for the first option, as we are in the run to remove the "+git-{hash}" from the package name #101, we can add this to the string of the output --version in qemu

Retain a "build metadata" version using +... (for example, 2.7.0+741f430a96-7)

Related #104

erick0z commented 7 years ago

@gorozco1 Can you rebase and push again? Just to make Travis happy

gorozco1 commented 7 years ago

@erick0z done

gorozco1 commented 7 years ago

Tested:

Fedora:

[fedora@cc-fedora ~]$ qemu-lite-system-x86_64 --version
QEMU emulator version 2.7.0(2.7.1+git.741f430a96-8.1.cc), Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers
[fedora@cc-fedora ~]$ rpm -qa | grep qemu-lite
qemu-lite-bin-2.7.1+git.741f430a96-8.1.x86_64
qemu-lite-data-2.7.1+git.741f430a96-8.1.x86_64
qemu-lite-2.7.1+git.741f430a96-8.1.x86_64

Ubuntu

ubuntu@cc-ubuntu:~$ qemu-lite-system-x86_64 --version
QEMU emulator version 2.7.0(2.7.1+git.741f430a96-8.cc), Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers
ubuntu@cc-ubuntu:~$ dpkg -la | grep qemu-lite
ii  qemu-lite                          2.7.1+git.741f430a96-8             amd64        linux kernel optimised for container-like workloads.
gorozco1 commented 7 years ago

@jodh-intel @erick0z I think we need to take this off of the release due it could cause confusions to the end-user and fix it on 2.9.x

jodh-intel commented 7 years ago

@gorozco1 - why does that version string show two different versions? (2.7.0(2.7.1))? I was imagining it would be just:

QEMU emulator version 2.7.1+git.741f430a96-8.cc, ...

@sameo, @grahamwhaley - what do you think about the release comment above?

jodh-intel commented 7 years ago

I don't think this change should probably be release-gating, but it would be super-useful if we could get this change in ready for the release as we have already seen users trying to run CC with odd versions of qemu. Hence, having a clearer qemu version string in the output of cc-env would make it much clearer their system is mis-configured.

gorozco1 commented 7 years ago

@jodh-intel seems 2.7.0 is from the code itself we need at least a patch to fix that in https://github.com/01org/qemu-lite/tree/qemu-2.7-lite

version.rc:      VALUE "FileVersion", QEMU_VERSION
vl.c:    printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", "
gorozco1 commented 7 years ago

@jodh-intel found it I will add a patch in the meantime.

gorozco1 commented 7 years ago

@jodh-intel \o/

Ubuntu

qemu-lite-system-x86_64 --version
QEMU emulator version 2.7.1(2.7.1+git.741f430a96-8.cc), Copyright (c) 2003-2016 Fabrice Bellard and the QEMU Project developers