Remove i386 and update bump version script

This commit is contained in:
Otto Winter 2020-07-25 19:28:44 +02:00
parent 73c4a69cf0
commit ece55be88c
No known key found for this signature in database
GPG Key ID: 48ED2DDB96D7682C
6 changed files with 58 additions and 52 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
__pycache__/
*.py[cod]
*$py.class

View File

@ -1,10 +1,9 @@
{ {
"args": {}, "args": {},
"build_from": { "build_from": {
"aarch64": "esphome/esphome-hassio-base-aarch64:2.3.3", "aarch64": "esphome/esphome-hassio-base-aarch64:2.3.4",
"amd64": "esphome/esphome-hassio-base-amd64:2.3.3", "amd64": "esphome/esphome-hassio-base-amd64:2.3.4",
"armv7": "esphome/esphome-hassio-base-armv7:2.3.3", "armv7": "esphome/esphome-hassio-base-armv7:2.3.4"
"i386": "esphome/esphome-hassio-base-i386:2.3.3"
}, },
"squash": false "squash": false
} }

View File

@ -1,7 +1,6 @@
{ {
"arch": [ "arch": [
"amd64", "amd64",
"i386",
"armv7", "armv7",
"aarch64" "aarch64"
], ],
@ -28,7 +27,7 @@
"6052/tcp": null "6052/tcp": null
}, },
"ports_description": { "ports_description": {
"6052/tcp": "Web interface (Not required for Hass.io Ingress)" "6052/tcp": "Web interface (Not required for Home Assistant Ingress)"
}, },
"schema": { "schema": {
"certfile": "str?", "certfile": "str?",
@ -41,6 +40,7 @@
"streamer_mode": "bool?" "streamer_mode": "bool?"
}, },
"slug": "esphome-dev", "slug": "esphome-dev",
"stage": "experimental",
"startup": "application", "startup": "application",
"url": "https://next.esphome.io/", "url": "https://next.esphome.io/",
"version": "dev", "version": "dev",

View File

@ -5,6 +5,10 @@ import re
import subprocess import subprocess
from dataclasses import dataclass from dataclasses import dataclass
import sys import sys
import os
sys.path.append(os.path.dirname(__file__))
import generate
@dataclass @dataclass
@ -65,29 +69,20 @@ def write_version(target: str, version: Version):
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('new_version', type=str) parser.add_argument('new_version', type=str)
parser.add_argument('--beta', action='store_true', help="Update the beta addon")
parser.add_argument('--stable', action='store_true', help="Update the stable addon")
parser.add_argument('--commit', action='store_true')
args = parser.parse_args() args = parser.parse_args()
if not any([args.beta, args.stable]):
print("At least one of beta or stable has to be bumped")
return 1
if args.commit and subprocess.call(["git", "diff", "--quiet"]) == 1:
print("Cannot use --commit because git is dirty.")
return 1
version = Version.parse(args.new_version) version = Version.parse(args.new_version)
assert not version.dev
print(f"Bumping to {version}") print(f"Bumping to {version}")
if args.beta: if version.beta:
write_version('beta', version) write_version('beta', version)
if args.stable: generate.main(['beta'])
else:
assert not version.beta assert not version.beta
write_version('stable', version) write_version('stable', version)
write_version('beta', version)
if args.commit: generate.main(['stable', 'beta'])
subprocess.check_call(["git", "commit", "-nam", f"Bump version to v{version}"])
return 0 return 0

View File

@ -6,43 +6,50 @@ from pathlib import Path
from enum import Enum from enum import Enum
import json import json
from shutil import copyfile from shutil import copyfile
import sys
class Channel(Enum): class Channel(Enum):
stable = 'stable' stable = 'stable'
beta = 'beta' beta = 'beta'
dev = 'dev' dev = 'dev'
parser = argparse.ArgumentParser(description='Generate ESPHome Home Assistant config.json')
parser.add_argument('channels', nargs='+', type=Channel, choices=list(Channel))
args = parser.parse_args()
root = Path(__file__).parent.parent def main(args):
templ = root / 'template' parser = argparse.ArgumentParser(description='Generate ESPHome Home Assistant config.json')
parser.add_argument('channels', nargs='+', type=Channel, choices=list(Channel))
args = parser.parse_args(args)
with open(templ / "config.yaml", 'r') as f: root = Path(__file__).parent.parent
config = yaml.safe_load(f) templ = root / 'template'
copyf = config['copy_files'] with open(templ / "config.yaml", 'r') as f:
config = yaml.safe_load(f)
for channel in args.channels: copyf = config['copy_files']
conf = config[f'esphome-{channel.value}']
base_image = conf.pop('base_image')
dir_ = root / conf.pop('directory')
path = dir_ / 'config.json'
with open(path, 'w') as f:
json.dump(conf, f, indent=2, sort_keys=True)
for file_, conf_ in copyf.items(): for channel in args.channels:
copyfile(templ / file_, dir_ / file_) conf = config[f'esphome-{channel.value}']
base_image = conf.pop('base_image')
if channel == Channel.dev: dir_ = root / conf.pop('directory')
path = dir_ / 'build.json' path = dir_ / 'config.json'
build_conf = {
'squash': False,
"build_from": {arch: base_image.format(arch=arch) for arch in conf['arch']},
"args": {}
}
with open(path, 'w') as f: with open(path, 'w') as f:
json.dump(build_conf, f, indent=2, sort_keys=True) json.dump(conf, f, indent=2, sort_keys=True)
print(f"Wrote {path}") for file_, conf_ in copyf.items():
copyfile(templ / file_, dir_ / file_)
if channel == Channel.dev:
path = dir_ / 'build.json'
build_conf = {
'squash': False,
"build_from": {arch: base_image.format(arch=arch) for arch in conf['arch']},
"args": {}
}
with open(path, 'w') as f:
json.dump(build_conf, f, indent=2, sort_keys=True)
print(f"Wrote {path}")
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -6,7 +6,6 @@ base: &base
boot: auto boot: auto
arch: arch:
- amd64 - amd64
- i386
- armv7 - armv7
- aarch64 - aarch64
# Uses Hass.io API (auth) # Uses Hass.io API (auth)
@ -26,7 +25,7 @@ base: &base
ports: ports:
'6052/tcp': null '6052/tcp': null
ports_description: ports_description:
'6052/tcp': "Web interface (Not required for Hass.io Ingress)" '6052/tcp': "Web interface (Not required for Home Assistant Ingress)"
map: map:
- ssl:ro - ssl:ro
- config:rw - config:rw
@ -39,7 +38,7 @@ base: &base
streamer_mode: bool? streamer_mode: bool?
relative_url: str? relative_url: str?
status_use_ping: bool? status_use_ping: bool?
base_image: esphome/esphome-hassio-base-{arch}:2.3.3 base_image: esphome/esphome-hassio-base-{arch}:2.3.4
esphome-dev: esphome-dev:
<<: *base <<: *base
@ -49,6 +48,7 @@ esphome-dev:
slug: esphome-dev slug: esphome-dev
description: "Development Version! Manage and program ESP8266/ESP32 microcontrollers through YAML configuration files" description: "Development Version! Manage and program ESP8266/ESP32 microcontrollers through YAML configuration files"
url: https://next.esphome.io/ url: https://next.esphome.io/
stage: experimental
options: options:
esphome_version: dev esphome_version: dev
@ -61,6 +61,7 @@ esphome-beta:
description: "Beta version of ESPHome Hass.io add-on." description: "Beta version of ESPHome Hass.io add-on."
url: https://beta.esphome.io/ url: https://beta.esphome.io/
image: esphome/esphome-hassio-{arch} image: esphome/esphome-hassio-{arch}
stage: experimental
options: {} options: {}
esphome-stable: esphome-stable:
@ -71,6 +72,7 @@ esphome-stable:
slug: esphome slug: esphome
description: "ESPHome Hass.io add-on for intelligently managing all your ESP8266/ESP32 devices." description: "ESPHome Hass.io add-on for intelligently managing all your ESP8266/ESP32 devices."
image: esphome/esphome-hassio-{arch} image: esphome/esphome-hassio-{arch}
stage: stable
options: {} options: {}
copy_files: copy_files: