Skip to content

Commit

Permalink
Merge pull request #163 from marvin-w/feature/added_script_for_upstre…
Browse files Browse the repository at this point in the history
…am_changes

Added script to allow merging back to HA.
  • Loading branch information
Julius2342 committed Jan 1, 2019
2 parents 7307826 + 816fc75 commit b8fd834
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
16 changes: 13 additions & 3 deletions home-assistant-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ Installation Instructions:

See documentation at [http://xknx.io/home_assistant](http://xknx.io/home_assistant)

Syncing with Upstream:
Merge upstream in XKNX
-------------

Use the `sync_upstream.pl` script to update the KNX component to the latest HA version.
Use the `merge_from_upstream.pl` script to update the KNX component to the latest HA version.
It will copy all the files from your HA installation into the local XKNX repository.

Please make sure you read the instructions in the `sync_upstream.pl` script first before
Please make sure you read the instructions in the `merge_from_upstream.pl` script first before
you do this as it will override all changes in the XKNX repository with those from HA.

Merge XKNX changes into HA
-------------

Use the `merge_to_upstream.pl` script to update the HA KNX component to the current XKNX version.
It will copy all the files from your local XKNX repository to the HA repository.

Please make sure you read the instructions in the `merge_to_upstream.pl` script first before
you do this as it will override all changes in the HA component that were made to the KNX
component(s).
File renamed without changes.
39 changes: 39 additions & 0 deletions home-assistant-plugin/merge_to_upstream.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/perl
use strict;
my ($ha_upstream, $local_xknx) = @ARGV;

if (not defined $ha_upstream) {
die "ha_upstream (1) is not defined. Set it to the path to your HA repository."
}

if (not defined $local_xknx) {
die "local_xknx (2) is not defined. Set it to the path of your XKNX repository."
}

my @FILES = split /\n/, `find $local_xknx/home-assistant-plugin/custom_components |grep xknx|grep -v __pycache__|grep -v .gitignore`;

print `rm $ha_upstream/homeassistant/components/*/knx.py`;
print `rm $ha_upstream/homeassistant/components/knx.py`;

foreach(@FILES)
{
if (-d $_)
{
print "Skipping $_\n";
}
else
{
my $orig = $_;
s/^.*components\///g;
s/xknx.py/knx.py/g;
my $to = $ha_upstream . "/homeassistant/components/".$_;
print "$orig -> $to\n";
print `cp $orig $to`;
print `sed -i '.bak' 's/custom_components.xknx/homeassistant.components.knx/g' $to`;
print `sed -i '.bak' \"s/DEPENDENCIES = \\['xknx'\\]/DEPENDENCIES = \\['knx'\\]/g\" $to`;
print `sed -i '.bak' \"s/DEFAULT_NAME = 'XKNX/DEFAULT_NAME = 'KNX/g\" $to`;
print `sed -i '.bak' \"s/_XKNX_/_KNX_/g\" $to`;
print `sed -i '.bak' \"s/DATA_XKNX/DATA_KNX/g\" $to`;
print `sed -i '.bak' \"s/DOMAIN = \\\"xknx\\\"/DOMAIN = \\\"knx\\\"/g\" $to`;
}
}

0 comments on commit b8fd834

Please sign in to comment.