|
|
@ -16,32 +16,99 @@ use Cwd qw/abs_path cwd/;
|
|
|
|
use JSON::PP;
|
|
|
|
use JSON::PP;
|
|
|
|
use Getopt::Long;
|
|
|
|
use Getopt::Long;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $avr_platform_template = {
|
|
|
|
|
|
|
|
'archiveFileName' => $filename,
|
|
|
|
|
|
|
|
'toolsDependencies' => [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"packager" => "arduino",
|
|
|
|
|
|
|
|
"name" => "avr-gcc",
|
|
|
|
|
|
|
|
"version" => "7.3.0-atmel3.6.1-arduino7"
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"packager" => "arduino",
|
|
|
|
|
|
|
|
"name" => "avrdude",
|
|
|
|
|
|
|
|
"version" => "6.3.0-arduino17"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
'url' => $build_base_url . '/' . $filename,
|
|
|
|
|
|
|
|
'name' => "Kaleidoscope keyboards",
|
|
|
|
|
|
|
|
'version' => $version,
|
|
|
|
|
|
|
|
'checksum' => 'SHA-256:' . $sha256,
|
|
|
|
|
|
|
|
'size' => $size,
|
|
|
|
|
|
|
|
'boards' => [
|
|
|
|
|
|
|
|
{ 'name' => 'Keyboardio Model 01' }, { 'name' => 'Keyboardio Atreus' }
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
'architecture' => 'avr',
|
|
|
|
|
|
|
|
'category' => 'Contributed',
|
|
|
|
|
|
|
|
'help' => {
|
|
|
|
|
|
|
|
'online' => 'https://community.keyboard.io'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $gd32_platform_template = {
|
|
|
|
|
|
|
|
'archiveFileName' => $filename,
|
|
|
|
|
|
|
|
'url' => $build_base_url . '/' . $filename,
|
|
|
|
|
|
|
|
'name' => "Kaleidoscope keyboards (GD32)",
|
|
|
|
|
|
|
|
'version' => $version,
|
|
|
|
|
|
|
|
'checksum' => 'SHA-256:' . $sha256,
|
|
|
|
|
|
|
|
'size' => $size,
|
|
|
|
|
|
|
|
'architecture' => 'gd32',
|
|
|
|
|
|
|
|
'toolsDependencies' => [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'name' => 'xpack-arm-none-eabi-gcc',
|
|
|
|
|
|
|
|
'packager' => 'GD32Community',
|
|
|
|
|
|
|
|
'version' => '9.3.1-1.3'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'packager' => 'GD32Community',
|
|
|
|
|
|
|
|
'version' => '0.11.0-1',
|
|
|
|
|
|
|
|
'name' => 'xpack-openocd'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'name' => 'dfu-util',
|
|
|
|
|
|
|
|
'version' => '0.10.0-arduino1',
|
|
|
|
|
|
|
|
'packager' => 'GD32Community'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
'version' => '0.0.1',
|
|
|
|
|
|
|
|
'name' => 'Kaleidoscope Keyboards (GD32)',
|
|
|
|
|
|
|
|
'boards' => [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
'name' => 'Keyboardio Model 100'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
'category' => 'Contributed',
|
|
|
|
|
|
|
|
'help' => {
|
|
|
|
|
|
|
|
'online' => 'https://community.keyboard.io'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
my $sha256 = 0;
|
|
|
|
my $sha256 = 0;
|
|
|
|
my $size = 0;
|
|
|
|
my $size = 0;
|
|
|
|
|
|
|
|
|
|
|
|
my $version = '';
|
|
|
|
my $version = '';
|
|
|
|
my $tag = 'master';
|
|
|
|
my $tag = 'master';
|
|
|
|
my $kaleidoscope_tag = 'master';
|
|
|
|
my $kaleidoscope_tag = 'master';
|
|
|
|
my $temp_dir = tempdir( CLEANUP => 0 );
|
|
|
|
my $working_dir = tempdir( CLEANUP => 0 );
|
|
|
|
my $index_filename_slug = 'keyboardio';
|
|
|
|
my $index_filename_slug = 'keyboardio';
|
|
|
|
|
|
|
|
|
|
|
|
my $only_latest_platform = 0;
|
|
|
|
my $only_latest_platform = 0;
|
|
|
|
|
|
|
|
|
|
|
|
my $bundle_repo = 'https://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio';
|
|
|
|
my $bundle_repo =
|
|
|
|
|
|
|
|
'https://github.com/keyboardio/Kaleidoscope-Bundle-Keyboardio';
|
|
|
|
my $boards_repo = 'https://github.com/keyboardio/boardsmanager';
|
|
|
|
my $boards_repo = 'https://github.com/keyboardio/boardsmanager';
|
|
|
|
my $push_package_repo = 0;
|
|
|
|
my $push_package_repo = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GetOptions(
|
|
|
|
|
|
|
|
"bundle-tag=s" => \$tag,
|
|
|
|
GetOptions ("bundle-tag=s" => \$tag,
|
|
|
|
|
|
|
|
"kaleidoscope-tag=s" => \$kaleidoscope_tag,
|
|
|
|
"kaleidoscope-tag=s" => \$kaleidoscope_tag,
|
|
|
|
"bundle-repo=s" => \$bundle_repo,
|
|
|
|
"bundle-repo=s" => \$bundle_repo,
|
|
|
|
"output-repo=s" => \$boards_repo,
|
|
|
|
"output-repo=s" => \$boards_repo,
|
|
|
|
"index-filename-slug=s" => \$index_filename_slug,
|
|
|
|
"index-filename-slug=s" => \$index_filename_slug,
|
|
|
|
"version=s" => \$version,
|
|
|
|
"version=s" => \$version,
|
|
|
|
"only-one-platform-revision" => \$only_latest_platform,
|
|
|
|
"only-one-platform-revision" => \$only_latest_platform,
|
|
|
|
"push" => \$push_package_repo)
|
|
|
|
"push" => \$push_package_repo
|
|
|
|
or die("Error in command line arguments\n");
|
|
|
|
) or die("Error in command line arguments\n");
|
|
|
|
|
|
|
|
|
|
|
|
my $index_filename = 'package_' . $index_filename_slug . '_index.json';
|
|
|
|
my $index_filename = 'package_' . $index_filename_slug . '_index.json';
|
|
|
|
|
|
|
|
|
|
|
@ -56,34 +123,29 @@ my $build_base_url = $boards_repo."/master/builds/";
|
|
|
|
$build_base_url =~ s|^ssh://git\@github.com|https://raw.githubusercontent.com|;
|
|
|
|
$build_base_url =~ s|^ssh://git\@github.com|https://raw.githubusercontent.com|;
|
|
|
|
$build_base_url =~ s|^https?://github.com|https://raw.githubusercontent.com|;
|
|
|
|
$build_base_url =~ s|^https?://github.com|https://raw.githubusercontent.com|;
|
|
|
|
|
|
|
|
|
|
|
|
my @bundle_dirs_to_remove = qw|toolchain etc doc avr/build-tools avr/bootloaders/*/lufa avr/libraries/Kaleidoscope/testing avr/libraries/Kaleidoscope/tests avr/libraries/Kaleidoscope/docs|;
|
|
|
|
print "Working directory: $working_dir\n";
|
|
|
|
|
|
|
|
chdir($working_dir);
|
|
|
|
chdir($temp_dir);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`git clone --depth=1 --quiet --recurse-submodules --branch $tag $bundle_repo $checkout_dir`;
|
|
|
|
|
|
|
|
`git clone $boards_repo boardsmanager`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clone_repos();
|
|
|
|
|
|
|
|
|
|
|
|
print "cd $checkout_dir\n";
|
|
|
|
print "cd $checkout_dir\n";
|
|
|
|
chdir($checkout_dir);
|
|
|
|
chdir($checkout_dir);
|
|
|
|
|
|
|
|
my @bundle_dirs_to_remove =
|
|
|
|
|
|
|
|
qw|toolchain etc doc avr/build-tools avr/bootloaders/*/lufa avr/libraries/Kaleidoscope/testing avr/libraries/Kaleidoscope/tests avr/libraries/Kaleidoscope/docs|;
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $dir_to_remove (@bundle_dirs_to_remove) {
|
|
|
|
foreach my $dir_to_remove (@bundle_dirs_to_remove) {
|
|
|
|
print "rm -rf $dir_to_remove\n";
|
|
|
|
print "rm -rf $dir_to_remove\n";
|
|
|
|
`rm -rf $dir_to_remove`;
|
|
|
|
`rm -rf $dir_to_remove`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
chdir("avr/libraries/Kaleidoscope");
|
|
|
|
chdir("avr/libraries/Kaleidoscope");
|
|
|
|
`git checkout --quiet $kaleidoscope_tag`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( -d 'plugins') {
|
|
|
|
checkout_kaleidoscope($kaleidoscope_tag);
|
|
|
|
chdir("plugins");
|
|
|
|
|
|
|
|
# move the plugins to where they should live
|
|
|
|
|
|
|
|
`mv * ../../`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lift_plugins_to_arduino_libs();
|
|
|
|
set_plugin_versions();
|
|
|
|
set_plugin_versions();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chdir($working_dir);
|
|
|
|
chdir($temp_dir);
|
|
|
|
|
|
|
|
`mv $checkout_dir/avr $checkout_dir/$checkout_dir`
|
|
|
|
`mv $checkout_dir/avr $checkout_dir/$checkout_dir`
|
|
|
|
; # A hack to get consistent naming with the old setup
|
|
|
|
; # A hack to get consistent naming with the old setup
|
|
|
|
`find $checkout_dir -name .git |xargs rm -rf`;
|
|
|
|
`find $checkout_dir -name .git |xargs rm -rf`;
|
|
|
@ -100,63 +162,74 @@ if ($only_latest_platform) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`cp $filename boardsmanager/builds/`;
|
|
|
|
`cp $filename boardsmanager/builds/`;
|
|
|
|
|
|
|
|
|
|
|
|
my $platform_template = {
|
|
|
|
update_index_file();
|
|
|
|
'archiveFileName' => $filename,
|
|
|
|
|
|
|
|
'toolsDependencies' => [
|
|
|
|
chdir('boardsmanager');
|
|
|
|
{
|
|
|
|
|
|
|
|
"packager" => "arduino",
|
|
|
|
commit_results();
|
|
|
|
"name" => "avr-gcc",
|
|
|
|
|
|
|
|
"version" => "7.3.0-atmel3.6.1-arduino7"
|
|
|
|
if ($push_package_repo) {
|
|
|
|
},
|
|
|
|
`git push`;
|
|
|
|
{
|
|
|
|
|
|
|
|
"packager" => "arduino",
|
|
|
|
|
|
|
|
"name" => "avrdude",
|
|
|
|
|
|
|
|
"version" => "6.3.0-arduino17"
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
else {
|
|
|
|
'url' => $build_base_url . '/' . $filename,
|
|
|
|
|
|
|
|
'name' => "Kaleidoscope keyboards",
|
|
|
|
print
|
|
|
|
'version' => $version,
|
|
|
|
"Now, you need to cd to $working_dir/boardsmanager check the content and push it\n";
|
|
|
|
'checksum' => 'SHA-256:' . $sha256,
|
|
|
|
|
|
|
|
'size' => $size,
|
|
|
|
|
|
|
|
'boards' => [
|
|
|
|
|
|
|
|
{ 'name' => 'Keyboardio Model 01' }, { 'name' => 'Keyboardio Atreus' }
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
'architecture' => 'avr',
|
|
|
|
|
|
|
|
'category' => 'Contributed',
|
|
|
|
|
|
|
|
'help' => {
|
|
|
|
|
|
|
|
'online' => 'https://community.keyboard.io'
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
exit 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub set_plugin_versions {
|
|
|
|
|
|
|
|
chdir("$working_dir/$checkout_dir/avr/libraries");
|
|
|
|
|
|
|
|
`perl -pi -e's/version=0.0.0/version=$version/' */library.properties`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub clone_repos {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`git clone --depth=1 --quiet --recurse-submodules --branch $tag $bundle_repo $checkout_dir`;
|
|
|
|
|
|
|
|
`git clone $boards_repo boardsmanager`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub checkout_kaleidoscope {
|
|
|
|
|
|
|
|
my $tag = shift;
|
|
|
|
|
|
|
|
`git checkout --quiet $tag`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub lift_plugins_to_arduino_libs {
|
|
|
|
|
|
|
|
if ( -d 'plugins' ) {
|
|
|
|
|
|
|
|
chdir("plugins");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# move the plugins to be fullfledged arduino libraries
|
|
|
|
|
|
|
|
`mv * ../../`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub update_index_file {
|
|
|
|
|
|
|
|
|
|
|
|
my $json = JSON::PP->new->allow_nonref;
|
|
|
|
my $json = JSON::PP->new->allow_nonref;
|
|
|
|
local $/;
|
|
|
|
local $/;
|
|
|
|
open( my $fh, '<', 'boardsmanager/'.$index_filename) || die "Could not open boardsmanager/$index_filename $!";
|
|
|
|
open( my $fh, '<', 'boardsmanager/' . $index_filename )
|
|
|
|
|
|
|
|
|| die "Could not open boardsmanager/$index_filename $!";
|
|
|
|
my $json_text = <$fh>;
|
|
|
|
my $json_text = <$fh>;
|
|
|
|
my $data = decode_json($json_text);
|
|
|
|
my $data = decode_json($json_text);
|
|
|
|
if ($only_latest_platform) {
|
|
|
|
if ($only_latest_platform) {
|
|
|
|
@{ $data->{'packages'}->[0]->{'platforms'} } = ( $platform_template);
|
|
|
|
@{ $data->{'packages'}->[0]->{'platforms'} } =
|
|
|
|
} else {
|
|
|
|
( $avr_platform_template, $gd32_platform_template );
|
|
|
|
push @{ $data->{'packages'}->[0]->{'platforms'} }, $platform_template;
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
push @{ $data->{'packages'}->[0]->{'platforms'} },
|
|
|
|
|
|
|
|
$avr_platform_template,
|
|
|
|
|
|
|
|
$gd32_platform_template;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
my $json_out = $json->canonical->pretty->encode($data);
|
|
|
|
my $json_out = $json->canonical->pretty->encode($data);
|
|
|
|
open( my $out_fh, '>', 'boardsmanager/' . $index_filename );
|
|
|
|
open( my $out_fh, '>', 'boardsmanager/' . $index_filename );
|
|
|
|
print $out_fh $json_out;
|
|
|
|
print $out_fh $json_out;
|
|
|
|
close($out_fh);
|
|
|
|
close($out_fh);
|
|
|
|
chdir('boardsmanager');
|
|
|
|
|
|
|
|
`git add $index_filename`;
|
|
|
|
|
|
|
|
`git add builds`;
|
|
|
|
|
|
|
|
`git commit -a -m 'Built by $executed_as'`;
|
|
|
|
|
|
|
|
if ($push_package_repo) {
|
|
|
|
|
|
|
|
`git push`;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print
|
|
|
|
|
|
|
|
"Now, you need to cd to $temp_dir/boardsmanager check the content and push it\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sub commit_results {
|
|
|
|
|
|
|
|
|
|
|
|
sub set_plugin_versions {
|
|
|
|
`git add $index_filename`;
|
|
|
|
chdir("$temp_dir/$checkout_dir/avr/libraries");
|
|
|
|
`git add builds`;
|
|
|
|
`perl -pi -e's/version=0.0.0/version=$version/' */library.properties`
|
|
|
|
`git commit -a -m 'Built by $executed_as'`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|