Skip to content

Commit

Permalink
Bump version for v0.2.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
johnramsden committed Jun 11, 2018
1 parent 23ad746 commit 7d02dbe
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 10 deletions.
3 changes: 2 additions & 1 deletion doc/source/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Create a new boot environment.

.. code-block:: shell
zedenv activate [OPTIONS] BOOT_ENVIRONMENT
zedenv create [OPTIONS] BOOT_ENVIRONMENT
.. table::

Expand All @@ -70,6 +70,7 @@ Destroy a boot environment or snapshot.
Option Description
=================================== =========================================================
``-v``, ``--verbose`` Print verbose output.
``-b``, ``--bootloader`` ``TEXT`` Use bootloader type.
``-y``, ``--noconfirm`` Assume yes in situations where confirmation is needed.
``-n``, ``--noop`` Print what would be destroyed but don't apply.
``--help`` Show this message and exit.
Expand Down
4 changes: 2 additions & 2 deletions doc/source/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ Alternate Mountpoint
First, remount the ``$esp`` to a new location, the default is ``/mnt/efi``.

If you would like to explicitly specify the mountpoint used, you can set the
``org.zedenv:esp`` property on your current boot environment, and the plugin
``org.zedenv.systemdboot:esp`` property on your current boot environment, and the plugin
will use the specified location:

.. code-block:: shell
zfs set org.zedenv:esp='/mnt/efi' zpool/ROOT/default
zfs set org.zedenv.systemdboot:esp='/mnt/efi' zpool/ROOT/default
Don't forget to change the mount point in ``/etc/fstab``.

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from setuptools import setup, find_packages

from zedenv import __version__
from zedenv import get_release_version

tests_require = [
'coverage',
Expand All @@ -27,7 +28,7 @@ def readme():

setup(
name='zedenv',
version=__version__,
version=get_release_version(__version__),
description='Utility to manage Boot Environments using ZFS',
long_description=readme(),
url='http://github.com/johnramsden/zedenv',
Expand Down
33 changes: 32 additions & 1 deletion zedenv/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# __init__.py

__version__ = '0.1.1'
import subprocess

__version__ = '0.2.0'


def vcs_release(version: str):
"""
If in git repo, get git version
"""
try:
git_hash = subprocess.check_output(
['git', 'rev-parse', '--short', 'HEAD'],
universal_newlines=True, stderr=subprocess.PIPE)
except subprocess.CalledProcessError:
return version

return version + '+git.' + git_hash


def get_release_version(version: str):
"""
If on a tagged release, use tagged version, else append git hash
"""
has_tags = None
try:
has_tags = subprocess.check_output(
['git', 'tag', '-l', '--points-at', 'HEAD'],
universal_newlines=True, stderr=subprocess.PIPE)
except subprocess.CalledProcessError:
pass

return version if has_tags and has_tags.startswith("v") else vcs_release(version)
8 changes: 4 additions & 4 deletions zedenv/cli/umount.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ def cli(boot_environment: str, verbose: Optional[bool]):
}, exit_on_error=True)

if dataset_mountpoint == "/":
ZELogger.log({
"level": "EXCEPTION",
"message": f"Cannot Unmount root dataset.\n"
}, exit_on_error=True)
ZELogger.log({
"level": "EXCEPTION",
"message": f"Cannot Unmount root dataset.\n"
}, exit_on_error=True)

if not dataset_mountpoint:
ZELogger.log({
Expand Down
5 changes: 5 additions & 0 deletions zedenv/lib/be.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ def size(boot_environment) -> int:


def bootfs_for_pool(zpool: str) -> str:
"""
Get the 'bootfs' dataset for a given zpool
:param zpool: Pool to get bootfs of.
:return: The name of the 'bootfs' dataset.
"""
bootfs_list = None
try:
bootfs_list = pyzfscmds.cmd.zpool_get(pool=zpool,
Expand Down
3 changes: 2 additions & 1 deletion zedenv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import signal
import sys
import subprocess
import platform

import click
Expand All @@ -18,7 +19,7 @@
def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo(f"Version {zedenv.__version__}")
click.echo(f"Version {zedenv.get_release_version(zedenv.__version__)}")
ctx.exit()


Expand Down

0 comments on commit 7d02dbe

Please sign in to comment.