kameleon-builder 2.10.12 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES +24 -0
- data/COPYING +5 -5
- data/README.rst +20 -5
- data/RELEASING.md +41 -24
- data/completion/kameleon.bash +0 -2
- data/erb/extend.yaml.erb +1 -1
- data/kameleon-builder.gemspec +11 -9
- data/lib/kameleon/cli.rb +2 -2
- data/lib/kameleon/engine.rb +1 -1
- data/lib/kameleon/persistent_cache.rb +1 -1
- data/lib/kameleon/recipe.rb +26 -21
- data/lib/kameleon/step.rb +3 -3
- data/lib/kameleon/ui.rb +1 -1
- data/lib/kameleon/utils.rb +7 -2
- data/lib/kameleon/version.rb +1 -1
- data/lib/kameleon.rb +1 -1
- metadata +23 -61
- data/.bumpversion.cfg +0 -16
- data/contrib/scripts/VirtualBox_deploy.sh +0 -12
- data/contrib/scripts/chroot_env +0 -9
- data/contrib/scripts/create_passwd.py +0 -17
- data/contrib/scripts/umount-chroot.sh +0 -290
- data/contrib/steps/bootstrap/debian/bootstrap_if_needed.yaml +0 -47
- data/contrib/steps/bootstrap/debian/bootstrap_static.yaml +0 -38
- data/contrib/steps/bootstrap/debian/debootstrap_arm.yaml +0 -23
- data/contrib/steps/export/clean_appliance.yaml +0 -9
- data/contrib/steps/export/compact_qcow_img.yaml +0 -12
- data/contrib/steps/export/save_as_g5k.yaml +0 -63
- data/contrib/steps/setup/add_timestamp.yaml +0 -6
- data/contrib/steps/setup/add_to_sudoers.yaml +0 -5
- data/contrib/steps/setup/archlinux/configure_ruby.yaml +0 -7
- data/contrib/steps/setup/archlinux/install_dev_tools.yaml +0 -18
- data/contrib/steps/setup/archlinux/install_gnome.yaml +0 -27
- data/contrib/steps/setup/archlinux/install_yaourt.yaml +0 -29
- data/contrib/steps/setup/autologin.yaml +0 -16
- data/contrib/steps/setup/centos/6.5/configure_repo.yaml +0 -9
- data/contrib/steps/setup/copy_ssh_auth_file.yaml +0 -10
- data/contrib/steps/setup/debian/add_network_interface.yaml +0 -7
- data/contrib/steps/setup/debian/cluster_tools_install.yaml +0 -16
- data/contrib/steps/setup/debian/install_gnome.yaml +0 -13
- data/contrib/steps/setup/debian/install_kde.yaml +0 -13
- data/contrib/steps/setup/debian/network_config_static.yaml +0 -17
- data/contrib/steps/setup/generate_user_ssh_key.yaml +0 -15
- data/contrib/steps/setup/install_my_ssh_key.yaml +0 -26
- data/contrib/steps/setup/make_swap_file.yaml +0 -9
- data/contrib/steps/setup/root_ssh_config.yaml +0 -18
- data/contrib/steps/setup/set_user_password.yaml +0 -7
- data/contrib/steps/setup/system_optimization.yaml +0 -8
- data/scripts/bumpversion.py +0 -184
@@ -1,63 +0,0 @@
|
|
1
|
-
# Save as a g5k
|
2
|
-
# Export a Grid5000 compliant tar gz image and create the kadeploy config
|
3
|
-
- save_as_g5k:
|
4
|
-
- in2out:
|
5
|
-
- /etc/fstab
|
6
|
-
- ./fstab.bak
|
7
|
-
- on_clean:
|
8
|
-
- exec_out: rm -f ./fstab.bak
|
9
|
-
- exec_in: apt-get -f install -y --force-yes ssh libmlx4-1 libmlx4-dev
|
10
|
-
- write_in:
|
11
|
-
- /etc/fstab
|
12
|
-
- |
|
13
|
-
# UNCONFIGURED FSTAB FOR BASE SYSTEM
|
14
|
-
- write_in:
|
15
|
-
- /etc/apt/apt.conf
|
16
|
-
- |
|
17
|
-
APT::Get::AllowUnauthenticated "true";
|
18
|
-
- write_in:
|
19
|
-
- /etc/modules
|
20
|
-
- |
|
21
|
-
ib_ipoib
|
22
|
-
ib_uverbs
|
23
|
-
ib_umad
|
24
|
-
ib_addr
|
25
|
-
mlx4_ib
|
26
|
-
ib_mthca
|
27
|
-
- exec_in: wget --no-check-certificate https://gforge.inria.fr/frs/download.php/28557/tgz-g5k_1.0.7_all.deb
|
28
|
-
- exec_in: dpkg -i ./tgz-g5k_1.0.7_all.deb
|
29
|
-
- exec_in: rm ./tgz-g5k_1.0.7_all.deb
|
30
|
-
- exec_in: tgz-g5k /tmp/$$filename.tar.gz
|
31
|
-
- in2out:
|
32
|
-
- /tmp/$$filename.tar.gz
|
33
|
-
- $$filename.tar.gz
|
34
|
-
- out2in:
|
35
|
-
- ./fstab.bak
|
36
|
-
- /etc/fstab
|
37
|
-
- exec_out: |
|
38
|
-
echo "Saved tar.gz appliance to $(pwd)/$$filename.tar.gz"
|
39
|
-
- write_out:
|
40
|
-
- $${kameleon_recipe_name}_img.yaml
|
41
|
-
- |
|
42
|
-
#
|
43
|
-
# Kameleon generated $$distrib $$release kadeploy description file
|
44
|
-
#
|
45
|
-
---
|
46
|
-
name: $${kameleon_recipe_name}
|
47
|
-
|
48
|
-
version: 1
|
49
|
-
|
50
|
-
os: linux
|
51
|
-
|
52
|
-
image:
|
53
|
-
file: $$g5k_img_path/$$filename.tar.gz
|
54
|
-
kind: tar
|
55
|
-
compression: gzip
|
56
|
-
|
57
|
-
boot:
|
58
|
-
kernel: /boot/`basename $$rootfs/boot/vmlinu*`
|
59
|
-
initrd: /boot/`basename $$rootfs/boot/init*`
|
60
|
-
|
61
|
-
filesystem: $$filesystem
|
62
|
-
|
63
|
-
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# Dev Tools install
|
2
|
-
# This step is installing all the tools a developer might needs
|
3
|
-
|
4
|
-
- basic_dev_tools:
|
5
|
-
- exec_in: pacman -Sy --noconfirm base-devel wget git meld
|
6
|
-
|
7
|
-
- libvirt_with_qemu:
|
8
|
-
# WARNING: if you have some problems with libvirt/qemu rights you can fix it
|
9
|
-
# mannualy. See https://wiki.archlinux.org/index.php/libvirt#Configuration
|
10
|
-
- exec_in: pacman -Sy --noconfirm qemu libvirt dnsmasq dmidecode virt-manager
|
11
|
-
- exec_in: echo "Enable libvirt deamon"
|
12
|
-
- exec_in: ln -s '/usr/lib/systemd/system/libvirtd.service' '/etc/systemd/system/multi-user.target.wants/libvirtd.service'
|
13
|
-
# The default libvirt network is conflicting with the host libvirt network so
|
14
|
-
# change the defaults
|
15
|
-
- exec_in: sed -i "s/192.168.122/192.168.123/g" /etc/libvirt/qemu/networks/default.xml
|
16
|
-
|
17
|
-
- docker_lxc:
|
18
|
-
- exec_in: pacman -Sy --noconfirm docker lxc
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# Desktop installation on Archlinux
|
2
|
-
#
|
3
|
-
# Install and setup a fully working Gnome configuration
|
4
|
-
- extra_packages: ""
|
5
|
-
|
6
|
-
- install_packages:
|
7
|
-
- exec_in: pacman -Sy --noconfirm gnome xorg xorg-fonts-type1 $$extra_packages
|
8
|
-
|
9
|
-
- enable_services:
|
10
|
-
- exec_in: systemctl enable gdm.service
|
11
|
-
# disable dhcpcd to avoid conflic with NetworkManager
|
12
|
-
- exec_in: systemctl disable dhcpcd.service
|
13
|
-
- exec_in: systemctl enable NetworkManager
|
14
|
-
|
15
|
-
- X11_config:
|
16
|
-
# keyboard config
|
17
|
-
- write_in:
|
18
|
-
- /etc/X11/xorg.conf.d/10-keyboard.conf
|
19
|
-
- |
|
20
|
-
Section "InputClass"
|
21
|
-
Identifier "system-keyboard"
|
22
|
-
MatchIsKeyboard "on"
|
23
|
-
Option "XkbLayout" "$$keyboard_layout"
|
24
|
-
Option "XkbModel" "pc104"
|
25
|
-
EndSection
|
26
|
-
# font config
|
27
|
-
- exec_in: ln -s /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# Yaourt install for Archlinux
|
2
|
-
#
|
3
|
-
# Installing the pacman overlay that handles AUR packages
|
4
|
-
|
5
|
-
- add_repository:
|
6
|
-
- exec_in: |
|
7
|
-
cat >> /etc/pacman.conf <<'EOF'
|
8
|
-
[archlinuxfr]
|
9
|
-
SigLevel = Never
|
10
|
-
Server = http://repo.archlinux.fr/$arch
|
11
|
-
EOF
|
12
|
-
|
13
|
-
- do_install:
|
14
|
-
- exec_in: pacman -Sy yaourt --noconfirm
|
15
|
-
|
16
|
-
#- manual_install:
|
17
|
-
# # script taken from http://archlinux.fr/yaourt-en
|
18
|
-
# - exec_in: |
|
19
|
-
# curl -O https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz
|
20
|
-
# tar zxvf package-query.tar.gz
|
21
|
-
# cd package-query
|
22
|
-
# makepkg -si --asroot --noconfirm
|
23
|
-
# cd ..
|
24
|
-
# curl -O https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz
|
25
|
-
# tar zxvf yaourt.tar.gz
|
26
|
-
# cd yaourt
|
27
|
-
# makepkg -si --asroot --noconfirm
|
28
|
-
# cd ..
|
29
|
-
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# # Autologin
|
2
|
-
- set_autologin:
|
3
|
-
- exec_in: |
|
4
|
-
# check SysV init
|
5
|
-
if [ -f '/etc/inittab' ]
|
6
|
-
then
|
7
|
-
perl -pi -e 's;/sbin/getty.*tty1;/bin/login -f $$user_name tty1 </dev/tty1 >/dev/tty1 2>&1;' /etc/inittab
|
8
|
-
else
|
9
|
-
# use systemd
|
10
|
-
mkdir -p /etc/systemd/system/getty@tty1.service.d
|
11
|
-
cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf <<< '
|
12
|
-
[Service]
|
13
|
-
ExecStart=
|
14
|
-
ExecStart=-/usr/bin/agetty --autologin <username> --noclear %I 38400 linux
|
15
|
-
'
|
16
|
-
fi
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Copy auth file from local to in
|
2
|
-
- home_in: /root
|
3
|
-
- auth_file_in: $$home_in/.ssh/authorized_keys
|
4
|
-
- auth_file_local: $$auth_file_in
|
5
|
-
|
6
|
-
- copy_ssh_auth_content:
|
7
|
-
- exec_in: mkdir -p $$home_in/.ssh
|
8
|
-
- pipe:
|
9
|
-
- exec_local: cat $$auth_file_local
|
10
|
-
- exec_in: cat >> $$auth_file_in
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Cluster Tools Install
|
2
|
-
- install_build_essentials:
|
3
|
-
- deb_install_in: build-essential
|
4
|
-
- install_openmpi:
|
5
|
-
- deb_install_in: |
|
6
|
-
openmpi-bin openmpi-common \
|
7
|
-
openssh-client openssh-server \
|
8
|
-
libopenmpi1.3 libopenmpi-dbg libopenmpi-dev
|
9
|
-
- install_python:
|
10
|
-
- deb_install_in: python python-dev
|
11
|
-
- install_java:
|
12
|
-
- deb_install_in: openjdk-6-jre
|
13
|
-
- install_perl:
|
14
|
-
- deb_install_in: perl
|
15
|
-
- install_tcl:
|
16
|
-
- deb_install_in: tcl
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Desktop installation on Debian
|
2
|
-
#
|
3
|
-
# Install and setup a fully working Gnome configuration
|
4
|
-
- extra_packages: ""
|
5
|
-
|
6
|
-
- install_aptitude:
|
7
|
-
- exec_in: apt-get -y --force-yes install aptitude 2>&1
|
8
|
-
|
9
|
-
- gnome_desktop_task:
|
10
|
-
- exec_in: aptitude -q --without-recommends -o APT::Install-Recommends=no -y install ~t^desktop$ ~t^gnome-desktop$
|
11
|
-
|
12
|
-
- install_extra_packages:
|
13
|
-
- exec_in: apt-get -y --force-yes install gnome-core $$extra_packages 2>&1
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# Desktop installation on Debian
|
2
|
-
#
|
3
|
-
# Install and setup a fully working Gnome configuration
|
4
|
-
- extra_packages: ""
|
5
|
-
|
6
|
-
- install_aptitude:
|
7
|
-
- exec_in: apt-get -y --force-yes install aptitude 2>&1
|
8
|
-
|
9
|
-
- gnome_desktop_task:
|
10
|
-
- exec_in: aptitude -q --without-recommends -o APT::Install-Recommends=no -y install ~t^desktop$ ~t^gkde-desktop$
|
11
|
-
|
12
|
-
- install_extra_packages:
|
13
|
-
- exec_in: apt-get -y --force-yes install kde-standard $$extra_packages 2>&1
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# Network Static Config
|
2
|
-
- network_interfaces:
|
3
|
-
# WARNING: The MTU is set to 1492 to avoid connection failure over some
|
4
|
-
# network du to PPP header
|
5
|
-
- write_in:
|
6
|
-
- /etc/network/interfaces
|
7
|
-
- |
|
8
|
-
auto lo
|
9
|
-
iface lo inet loopback
|
10
|
-
|
11
|
-
auto eth0
|
12
|
-
iface eth0 inet static
|
13
|
-
address $$ip_address
|
14
|
-
netmask $$netmask
|
15
|
-
gateway $$gateway
|
16
|
-
dns-nameservers $$dns
|
17
|
-
mtu $$mtu
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# # Generate User Ssh Key
|
2
|
-
- generate_keys:
|
3
|
-
- exec_in: |
|
4
|
-
mkdir -p /home/$$user_name/.ssh
|
5
|
-
ssh-keygen -t rsa -C "$$user_name@$$network_hostname" -N "" -f home/$$user_name/.ssh/id_rsa
|
6
|
-
#fix permissions
|
7
|
-
chmod 700 /home/$$user_name/.ssh
|
8
|
-
chmod 644 /home/$$user_name/.ssh/id_rsa.pub
|
9
|
-
chmod 600 /home/$$user_name/.ssh/id_rsa
|
10
|
-
- exec_in: chown -R $$user_name:$$user_group home/$$user_name/.ssh
|
11
|
-
- save_public_key:
|
12
|
-
- in2local:
|
13
|
-
- /home/$$user_name/.ssh/id_rsa.pub
|
14
|
-
- $$generated_rsa_pub_dir
|
15
|
-
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# Install your own key in the selected user home
|
2
|
-
# By default from local root to in root
|
3
|
-
|
4
|
-
- local_private_key: /root/.ssh/id_rsa
|
5
|
-
- local_public_key: $$local_private_key.pub
|
6
|
-
- in_user: root
|
7
|
-
- in_group: root
|
8
|
-
- in_home: /root
|
9
|
-
- in_private_key: $$in_home/.ssh/id_rsa
|
10
|
-
- in_public_key: $$in_private_key.pub
|
11
|
-
|
12
|
-
- copy_my_key:
|
13
|
-
- local2in:
|
14
|
-
- $$local_private_key
|
15
|
-
- $$in_private_key
|
16
|
-
- local2in:
|
17
|
-
- $$local_public_key
|
18
|
-
- $$in_public_key
|
19
|
-
|
20
|
-
|
21
|
-
- fix_permissions:
|
22
|
-
- exec_in: |
|
23
|
-
chown -R $$in_user:$$in_group $$in_home/.ssh
|
24
|
-
chmod 755 $$in_home/.ssh
|
25
|
-
chmod 600 $$in_private_key
|
26
|
-
chmod 644 $$in_public_key
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# # Root Ssh Config
|
2
|
-
- ssh_key_create:
|
3
|
-
- exec_in: mkdir -p /root/.ssh
|
4
|
-
- exec_in: ssh-keygen -t rsa -f /root/.ssh/id_rsa -C "root@$$network_hostname" -N ''
|
5
|
-
- exec_in: ssh-keygen -t dsa -f /root/.ssh/id_dsa -C "root@$$network_hostname" -N ''
|
6
|
-
- copy_key_to_auth_file:
|
7
|
-
- exec_in: cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
|
8
|
-
- copy_key_to_auth2_file:
|
9
|
-
- exec_in: cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys2
|
10
|
-
- root_ssh_config:
|
11
|
-
- append_in:
|
12
|
-
- /root/.ssh/config
|
13
|
-
- |
|
14
|
-
Host *
|
15
|
-
PasswordAuthentication yes
|
16
|
-
RSAAuthentication yes
|
17
|
-
StrictHostKeyChecking no
|
18
|
-
NoHostAuthenticationForLocalhost yes
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Sets the user password to "kameleon" hash in SHA512. Use create_script.py
|
2
|
-
# in contrib/scripts to generate your own password
|
3
|
-
|
4
|
-
- hash_password: $6$vDcPTe4u$EMxu.WTCjZaZeWQxiqFLC00gYledHmrvHsjvmAE1yQ/7d43EZrb0QuzcFdDv.Fm2IbbOLNdPvqdS08os6HHPH/
|
5
|
-
|
6
|
-
- set_user_passwd:
|
7
|
-
- exec_in: usermod -p '$$hash_password' $$user_name
|
data/scripts/bumpversion.py
DELETED
@@ -1,184 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
# coding: utf-8
|
3
|
-
from __future__ import unicode_literals, print_function
|
4
|
-
import os
|
5
|
-
import re
|
6
|
-
|
7
|
-
from io import open
|
8
|
-
import datetime
|
9
|
-
import subprocess
|
10
|
-
|
11
|
-
from argparse import RawTextHelpFormatter, ArgumentParser, FileType
|
12
|
-
|
13
|
-
|
14
|
-
def generate_changelog_title(version):
|
15
|
-
version_title = "Version %s" % version
|
16
|
-
return version_title + "\n" + "-" * len(version_title)
|
17
|
-
|
18
|
-
|
19
|
-
def get_release_date():
|
20
|
-
dt = datetime.date.today()
|
21
|
-
if 4 <= dt.day <= 20 or 24 <= dt.day <= 30:
|
22
|
-
suffix = "th"
|
23
|
-
else:
|
24
|
-
suffix = ["st", "nd", "rd"][dt.day % 10 - 1]
|
25
|
-
return dt.strftime("%%B %%d%s %%Y" % suffix)
|
26
|
-
|
27
|
-
|
28
|
-
def bump_release_version(args):
|
29
|
-
"""Automated software release workflow
|
30
|
-
|
31
|
-
* Bumps the release version number (with .bumpversion.cfg)
|
32
|
-
* Preloads the correct changelog template for editing
|
33
|
-
* Builds a source distribution
|
34
|
-
* Sets release date
|
35
|
-
* Tags the release
|
36
|
-
|
37
|
-
You can run it like::
|
38
|
-
|
39
|
-
$ python bumpversion.py
|
40
|
-
|
41
|
-
which will create a 'release' version (Eg. 0.7.2-dev => 0.7.2).
|
42
|
-
|
43
|
-
"""
|
44
|
-
# Dry run 'bumpversion' to find out what the new version number
|
45
|
-
# would be. Useful side effect: exits if the working directory is not
|
46
|
-
# clean.
|
47
|
-
changelog = args.changelog.name
|
48
|
-
bumpver = subprocess.check_output(
|
49
|
-
['bumpversion', 'release', '--dry-run', '--verbose'],
|
50
|
-
stderr=subprocess.STDOUT)
|
51
|
-
m = re.search(r'Parsing version \'(\d+\.\d+\.\d+)\.dev\'', bumpver)
|
52
|
-
current_version = m.groups(0)[0] + ".dev"
|
53
|
-
m = re.search(r'New version will be \'(\d+\.\d+\.\d+)\'', bumpver)
|
54
|
-
release_version = m.groups(0)[0]
|
55
|
-
|
56
|
-
date = get_release_date()
|
57
|
-
|
58
|
-
current_version_title = generate_changelog_title(current_version)
|
59
|
-
release_version_title = generate_changelog_title(release_version)
|
60
|
-
changes = ""
|
61
|
-
with open(changelog) as fd:
|
62
|
-
changes += fd.read()
|
63
|
-
|
64
|
-
changes = changes.replace(current_version_title, release_version_title)\
|
65
|
-
.replace("**unreleased**", "Released on %s" % date)
|
66
|
-
|
67
|
-
with open(changelog, "w") as fd:
|
68
|
-
fd.write(changes)
|
69
|
-
|
70
|
-
# Tries to load the EDITOR environment variable, else falls back to vim
|
71
|
-
editor = os.environ.get('EDITOR', 'vim')
|
72
|
-
os.system("{} {}".format(editor, changelog))
|
73
|
-
|
74
|
-
subprocess.check_output(['gem', 'build', 'kameleon-builder.gemspec'])
|
75
|
-
|
76
|
-
# Have to add it so it will be part of the commit
|
77
|
-
subprocess.check_output(['git', 'add', changelog])
|
78
|
-
subprocess.check_output(
|
79
|
-
['git', 'commit', '-m', 'Changelog for {}'.format(release_version)])
|
80
|
-
|
81
|
-
# Really run bumpver to set the new release and tag
|
82
|
-
bv_args = ['bumpversion', 'release']
|
83
|
-
|
84
|
-
bv_args += ['--new-version', release_version]
|
85
|
-
|
86
|
-
subprocess.check_output(bv_args)
|
87
|
-
|
88
|
-
|
89
|
-
def bump_new_version(args):
|
90
|
-
"""Increment the version number to the next development version
|
91
|
-
|
92
|
-
* Bumps the development version number (with .bumpversion.cfg)
|
93
|
-
* Preloads the correct changelog template for editing
|
94
|
-
|
95
|
-
You can run it like::
|
96
|
-
|
97
|
-
$ python bumpversion.py newversion
|
98
|
-
|
99
|
-
which, by default, will create a 'patch' dev version (0.0.1 => 0.0.2-dev).
|
100
|
-
|
101
|
-
You can also specify a patch level (patch, minor, major) to change to::
|
102
|
-
|
103
|
-
$ python bumpversion.py newversion major
|
104
|
-
|
105
|
-
which will create a 'major' release (0.0.2 => 1.0.0-dev)."""
|
106
|
-
pass
|
107
|
-
# Dry run 'bumpversion' to find out what the new version number
|
108
|
-
# would be. Useful side effect: exits if the working directory is not
|
109
|
-
# clean.
|
110
|
-
changelog = args.changelog.name
|
111
|
-
part = args.part
|
112
|
-
bumpver = subprocess.check_output(
|
113
|
-
['bumpversion', part, '--dry-run', '--verbose'],
|
114
|
-
stderr=subprocess.STDOUT)
|
115
|
-
m = re.search(r'Parsing version \'(\d+\.\d+\.\d+)\'', bumpver)
|
116
|
-
current_version = m.groups(0)[0]
|
117
|
-
m = re.search(r'New version will be \'(\d+\.\d+\.\d+)\.dev\'', bumpver)
|
118
|
-
next_version = m.groups(0)[0] + ".dev"
|
119
|
-
|
120
|
-
current_version_title = generate_changelog_title(current_version)
|
121
|
-
next_version_title = generate_changelog_title(next_version)
|
122
|
-
|
123
|
-
next_release_template = "%s\n\n**unreleased**\n\n" % next_version_title
|
124
|
-
|
125
|
-
changes = ""
|
126
|
-
with open(changelog) as fd:
|
127
|
-
changes += fd.read()
|
128
|
-
|
129
|
-
changes = changes.replace(current_version_title,
|
130
|
-
next_release_template + current_version_title)
|
131
|
-
|
132
|
-
with open(changelog, "w") as fd:
|
133
|
-
fd.write(changes)
|
134
|
-
|
135
|
-
# Tries to load the EDITOR environment variable, else falls back to vim
|
136
|
-
editor = os.environ.get('EDITOR', 'vim')
|
137
|
-
os.system("{} {}".format(editor, changelog))
|
138
|
-
|
139
|
-
# Have to add it so it will be part of the commit
|
140
|
-
subprocess.check_output(['git', 'add', changelog])
|
141
|
-
subprocess.check_output(
|
142
|
-
['git', 'commit', '-m', 'Changelog for {}'.format(next_version)])
|
143
|
-
|
144
|
-
# Really run bumpver to set the new release and tag
|
145
|
-
bv_args = ['bumpversion', part, '--no-tag', '--new-version', next_version]
|
146
|
-
|
147
|
-
subprocess.check_output(bv_args)
|
148
|
-
|
149
|
-
|
150
|
-
def main():
|
151
|
-
'''Parse command-line arguments and execute bumpversion command.'''
|
152
|
-
|
153
|
-
parser = ArgumentParser(prog='bumpversion',
|
154
|
-
description='Bumpversion wrapper')
|
155
|
-
|
156
|
-
default_changelog = os.path.join(os.getcwd(), 'CHANGES')
|
157
|
-
|
158
|
-
subparsers = parser.add_subparsers(title='bumpversion wrapper commands')
|
159
|
-
# release command
|
160
|
-
release_doc = bump_release_version.__doc__
|
161
|
-
subparser = subparsers.add_parser("release",
|
162
|
-
description=release_doc,
|
163
|
-
formatter_class=RawTextHelpFormatter)
|
164
|
-
subparser.add_argument('--changelog', help='Project changelog',
|
165
|
-
type=FileType(),
|
166
|
-
default=default_changelog)
|
167
|
-
subparser.set_defaults(func=bump_release_version)
|
168
|
-
# newversion command
|
169
|
-
newversion_doc = bump_new_version.__doc__
|
170
|
-
subparser = subparsers.add_parser("newversion",
|
171
|
-
description=newversion_doc,
|
172
|
-
formatter_class=RawTextHelpFormatter)
|
173
|
-
subparser.add_argument('--changelog', help='Project changelog',
|
174
|
-
type=FileType(),
|
175
|
-
default=default_changelog)
|
176
|
-
subparser.add_argument('part', help='Part of the version to be bumped',
|
177
|
-
choices=['patch', 'minor', 'major'])
|
178
|
-
subparser.set_defaults(func=bump_new_version)
|
179
|
-
# Parse argv arguments
|
180
|
-
args = parser.parse_args()
|
181
|
-
args.func(args)
|
182
|
-
|
183
|
-
if __name__ == '__main__':
|
184
|
-
main()
|