Skip to content

Commit

Permalink
Automaically Update ACE/TAO Versions
Browse files Browse the repository at this point in the history
These changes introduce `acetao.ini` that the configure script, CMake,
and Sphinx can get the ACE/TAO versions and related info from. This can
be updated manually using:

    tools/scripts/gitrelease.pl --update-ace-tao

or by a workflow that will open a PR when the file needs to be updated.
  • Loading branch information
iguessthislldo committed Oct 30, 2023
1 parent ac90cef commit ffcfe6e
Show file tree
Hide file tree
Showing 10 changed files with 444 additions and 84 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/update-ace-tao.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "Update ACE/TAO Versions"

on:
workflow_dispatch:
schedule:
- cron: '0 33 23 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
update-ace-tao:
runs-on: ubuntu-22.04
steps:
- name: Checkout OpenDDS
uses: actions/checkout@v4
with:
path: OpenDDS
submodules: true
- name: Install Perl Dependencies
uses: shogo82148/actions-setup-perl@v1
with:
install-modules: |
Pithub
Net::SFTP::Foreign
Time::Piece
LWP::UserAgent
LWP::Protocol::https
- name: Run gitrelease.pl --update-ace-tao
run: |
cd OpenDDS
GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}} perl tools/scripts/gitrelease.pl --update-ace-tao
# Help make the title and message for commit and PR
perl tools/scripts/modules/ini.pm acetao.ini --join ', ' '.*/version' > ../acevers
echo "ACEVERS=$(cat ../acevers)" >> $GITHUB_ENV
perl tools/scripts/modules/ini.pm acetao.ini --join ', ' '.*/url' > ../acevers_urls
echo "ACEVERS_URLS=$(cat ../acevers_urls)" >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
id: cpr
with:
path: OpenDDS
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |
Update ACE/TAO to ${{env.ACEVERS}}
The releases are ${{env.ACEVERS_URLS}}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: workflows/update-ace-tao
delete-branch: true
title: Update ACE/TAO to ${{env.ACEVERS}}
body: "Releases: ${{env.ACEVERS_URLS}}"
labels: |
dependencies
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
29 changes: 29 additions & 0 deletions acetao.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file contains the common info for ACE/TAO releases. Insead of editing
# this directly, run:
# GITHUB_TOKEN=... ./tools/scripts/gitrelease.pl --update-ace-tao

[ace6tao2]
version=6.5.20
url=https://github.com/DOCGroup/ACE_TAO/releases/tag/ACE%2BTAO-6_5_20
zip-filename=ACE+TAO-src-6.5.20.zip
zip-url=https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-6_5_20/ACE%2BTAO-src-6.5.20.zip
zip-md5=5050fb0a2b97ad32be553102bb85b5ce
tar.gz-filename=ACE+TAO-src-6.5.20.tar.gz
tar.gz-url=https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-6_5_20/ACE%2BTAO-src-6.5.20.tar.gz
tar.gz-md5=10cd636115d7463d96dd1bcb645b8b36
tar.bz2-filename=ACE+TAO-src-6.5.20.tar.bz2
tar.bz2-url=https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-6_5_20/ACE%2BTAO-src-6.5.20.tar.bz2
tar.bz2-md5=2551d7d445456bcb316fe5e9a4b514ea

[ace7tao3]
version=7.1.2
url=https://github.com/DOCGroup/ACE_TAO/releases/tag/ACE%2BTAO-7_1_2
zip-filename=ACE+TAO-src-7.1.2.zip
zip-url=https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-7_1_2/ACE%2BTAO-src-7.1.2.zip
zip-md5=983581a5813331fc7597d1e5ec811e1c
tar.gz-filename=ACE+TAO-src-7.1.2.tar.gz
tar.gz-url=https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-7_1_2/ACE%2BTAO-src-7.1.2.tar.gz
tar.gz-md5=efc1f6cdf976e59c7b6c55198bd1ee3b
tar.bz2-filename=ACE+TAO-src-7.1.2.tar.bz2
tar.bz2-url=https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-7_1_2/ACE%2BTAO-src-7.1.2.tar.bz2
tar.bz2-md5=949c55575b4a5753e8457eb5b5562fac
24 changes: 15 additions & 9 deletions cmake/get_ace_tao.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
cmake_policy(SET CMP0135 NEW)
endif()

set(url_base "https://github.com/DOCGroup/ACE_TAO/releases/download/")
set(ace_ver "7.1.2")
set(zip_md5 "983581a5813331fc7597d1e5ec811e1c")
set(tbz_md5 "949c55575b4a5753e8457eb5b5562fac")

set(_OPENDDS_CONFIGURE_ACE_TAO_ARGS)
set(ACE_IS_BEING_BUILT MPC CACHE INTERNAL "")
set(TAO_IS_BEING_BUILT MPC CACHE INTERNAL "")
if(WIN32)
set(ext "zip")
set(md5 "${zip_md5}")
if(CMAKE_GENERATOR STREQUAL "Visual Studio 17 2022")
set(_OPENDDS_MPC_TYPE vs2022)
elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 16 2019")
Expand All @@ -29,7 +23,6 @@ if(WIN32)
set(_OPENDDS_ACE_CONFIG_FILE "config-win32.h")
else()
set(ext "tar.bz2")
set(md5 "${tbz_md5}")
set(_OPENDDS_MPC_TYPE gnuace)
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(_OPENDDS_ACE_CONFIG_FILE "config-linux.h")
Expand Down Expand Up @@ -78,7 +71,6 @@ if(NOT DEFINED _OPENDDS_MPC_TYPE OR NOT DEFINED _OPENDDS_ACE_CONFIG_FILE)
"(${CMAKE_SYSTEM_NAME}/${CMAKE_GENERATOR})")
endif()

string(REPLACE "." "_" ace_ver_tag "${ace_ver}")
if(DEFINED OPENDDS_ACE_TAO_SRC)
if(NOT DEFINED OPENDDS_MPC)
message(FATAL_ERROR "OPENDDS_ACE_TAO_SRC requires OPENDDS_MPC to be set")
Expand All @@ -104,7 +96,21 @@ else()
set(OPENDDS_ACE "${OPENDDS_ACE_TAO_SRC}" CACHE INTERNAL "")
set(OPENDDS_MPC "${OPENDDS_ACE}/MPC" CACHE INTERNAL "")
set(OPENDDS_TAO "${OPENDDS_ACE}/TAO" CACHE INTERNAL "")
set(url "${url_base}ACE+TAO-${ace_ver_tag}/ACE+TAO-src-${ace_ver}.${ext}")

file(STRINGS "${OPENDDS_SOURCE_DIR}/acetao.ini" ace_tao_ini)
unset(section)
foreach(line IN LISTS ace_tao_ini)
if(line MATCHES "^\\[(.*)\\]$")
set(section "${CMAKE_MATCH_1}")
elseif(section AND line MATCHES "^([^=#]+)=(.*)$")
set(name "${CMAKE_MATCH_1}")
set(value "${CMAKE_MATCH_2}")
set("${section}-${name}" "${value}")
endif()
endforeach()
set(url "${ace7tao3-${ext}-url}")
set(md5 "${ace7tao3-${ext}-md5}")

message(STATUS "Getting ACE/TAO from ${url}")
FetchContent_Declare(ace_tao_dl
PREFIX "${OPENDDS_BUILD_DIR}/ace_tao_tmp"
Expand Down
96 changes: 60 additions & 36 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ use FileHandle;
use Cwd;
use POSIX qw(strftime);
use B qw/perlstring/;
use Digest::MD5;

use FindBin;
use lib "$FindBin::RealBin/tools/scripts/modules";
use command_utils;
use ChangeDir;

## Version of DOC Group ACE/TAO to download, uses the ACE version number
my $doc_tao2_version = '6.5.20';
my $doc_tao3_version = '7.1.2';
use ini qw/read_ini_file/;

my $backup_timestamp = strftime "%Y-%m-%d-%H-%M-%S", localtime time;

Expand Down Expand Up @@ -534,6 +532,24 @@ sub git_ensure_submodule {
return !git_clone($path, git_submodule_prop($path, 'url'), commit => $commit);
}

sub md5sum {
my $path = shift();
my $expected_hash = shift();

my $md5 = Digest::MD5->new;
open(my $fh, $path) or die("Couldn't open \"$path\": $!");
$md5->addfile($fh);
my $hash = $md5->hexdigest();
my $failed = $expected_hash ne $hash;
if ($failed) {
print(
"MD5 hash mismatch for $path\n",
" expected: $expected_hash\n",
" got: $hash\n");
}
return $failed;
}

my $curpathRef = $specific{'refpre'} . 'PATH' . $specific{'refpost'};
my %hostEnv = ('build' => 'host', 'PATH' => $curpathRef);
my %targetEnv = ('build' => 'target', 'PATH' => $curpathRef);
Expand Down Expand Up @@ -870,65 +886,73 @@ if (!$ace_src || !$tao_src) {
$tao_src = normalizePath('ACE_TAO/TAO');
}
else {
my($urlbase, $file, $download_message);

if ($opts{'doc-group3'}) {
my $github_url_tao_version = $doc_tao3_version;
$github_url_tao_version =~ s/\./_/g;
$urlbase = 'https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-' . $github_url_tao_version . '/';
$file = 'ACE+TAO-src-' . $doc_tao3_version . '.'
. ($is_windows ? 'zip' : 'tar.gz');
$download_message = "Downloading $file";
}
else {
my $github_url_tao_version = $doc_tao2_version;
$github_url_tao_version =~ s/\./_/g;
$urlbase = 'https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-' . $github_url_tao_version . '/';
$file = 'ACE+TAO-src-' . $doc_tao2_version . '.'
. ($is_windows ? 'zip' : 'tar.gz');
$download_message = "Downloading $file";
}
# Get ACE/TAO version info
my ($section_names, $sections) = read_ini_file("$FindBin::RealBin/acetao.ini");
my $ace_tao_version = $opts{'doc-group3'} ? $sections->{ace7tao3} : $sections->{ace6tao2};
if ($opts{verbose}) {
print("ACE/TAO Version Info:");
new Dumpvalue()->dumpValue($ace_tao_version);
}
my $ext = $is_windows ? 'zip' : 'tar.gz';
my $file = $ace_tao_version->{"$ext-filename"};
my $url = $ace_tao_version->{"$ext-url"};
my $md5_hash = $ace_tao_version->{"$ext-md5"};

# Check for an existing file
if (-r $file) {
print "Using ACE+TAO source package $file\n" if $opts{'verbose'};
if (md5sum($file, $md5_hash)) {
if ($opts{'dry-run'}) {
print("Would remove existing $file and attempt to download\n");
}
else {
print("Removing existing $file and attempting to download\n");
unlink($file) or die("Couldn't remove $file: $!\nStopped");
}
}
elsif ($opts{'verbose'}) {
print("Using ACE+TAO source package $file\n");
}
}
else {

if (!-r $file) {
my $dl_msg = "Downloading $file from using";
$would_download = 1;
eval {
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
$ua->env_proxy;
print $download_message . "\n";
print("$dl_msg LWP\n");
if ($opts{'dry-run'}) {
print "Dry-run: would LWP::UserAgent get $urlbase$file\n";
print("Dry-run: would LWP::UserAgent get $url\n");
}
else {
my $response = $ua->get($urlbase . $file, ':content_file' => $file);
my $response = $ua->get($url, ':content_file' => $file);
if ($response->is_error) {
die $response->message . "\nstopped";
}
}
};
if ($@) {
if (which('wget')) {
print $download_message . " (using wget)\n";
if (run_command(['wget', "$urlbase$file"])) {
die "ERROR from wget, stopped";
}
print("$dl_msg wget\n");
run_command(['wget', '--output-document', $file, $url], autodie => 1);
}
elsif (which('curl')) {
print $download_message . " (using curl)\n";
if (run_command(['curl', '-L', "$urlbase$file", '-o', "$file"])) {
die "ERROR: from curl, stopped";
}
print("$dl_msg curl\n");
run_command(['curl', '--location', $url, '--output', $file], autodie => 1);
}
else {
die "ERROR: Can't download ACE+TAO using LWP, wget, or curl.\n" .
"Download ACE+TAO from $urlbase$file, place the file here\n, " .
"Download ACE+TAO from $url, place the file here\n, " .
"and re-run the script.\nStopped";
}
}
}

if (!$opts{'dry-run'} && md5sum($file, $md5_hash)) {
die("MD5 hash check failed after download, try running again?\nStopped");
}

print "Extracting archive $file\n";
$ENV{'ACTIVEPERL_CONFIG_DISABLE'} = 1 if $^O eq 'MSWin32';
$ENV{'ACTIVEPERL_CONFIG_SILENT'} = 1 if $^O eq 'MSWin32';
Expand Down
13 changes: 6 additions & 7 deletions docs/devguide/building/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,23 @@ ACE/TAO

The DOC Group repository for ACE/TAO is hosted on Github at `DOCGroup/ACE_TAO <https://github.com/DOCGroup/ACE_TAO>`__.

There are two release series of ACE/TAO that are officially supported by OpenDDS:
There are two versions of ACE/TAO that are officially supported by OpenDDS in this release (|release|):

DOC Group ACE 6.5/TAO 2.5
The configure script will download this version (|ace6tao2_version|) by default.
DOC Group :acetaorel:`ace6tao2`
The configure script will download this version by default.

Pass ``--ace-github-latest`` to the configure script to clone the ``ace6tao2`` branch of ACE/TAO as is.
This also clones the ``master`` branch of MPC as is.

DOC Group ACE 7.1/TAO 3.1
Pass ``--doc-group3`` to the configure script to download this version (|ace7tao3_version|).
DOC Group :acetaorel:`ace7tao3`
:ref:`CMake <cmake-building>` will download this version by default.
Pass ``--doc-group3`` to the configure script to download this version.

This version requires a C++14-capable compiler.

Pass ``--ace-github-latest`` to the configure script to clone the ``master`` branch of ACE/TAO as is.
This also clones the ``master`` branch of MPC as is.

Both can also be manually downloaded from https://github.com/DOCGroup/ACE_TAO/releases

.. _deps-ace:

ACE
Expand Down
16 changes: 16 additions & 0 deletions docs/internal/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,22 @@ These come in the form of `RST roles <https://docutils.sourceforge.io/docs/ref/r

:ghrelease:`This is the release <DDS-3.24>`

.. rst:role:: acetaorel
``acetaorel`` accepts the ACE/TAO major version nickname from :ghfile:`acetao.ini` and makes a link to that release this version of OpenDDS uses.

.. code-block:: rst
See :acetaorel:`ace6tao2`
Also see :acetaorel:`this <ace7tao3>`
Turns into:

See :acetaorel:`ace6tao2`

Also see :acetaorel:`this <ace7tao3>`

.. rst:role:: omgissue
.. code-block:: rst
Expand Down
16 changes: 16 additions & 0 deletions docs/sphinx_extensions/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,19 @@ def ghrelease_role(name, rawtext, text, lineno, inliner, options={}, content=[])
return ([node], [])


def acetaorel_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
config = get_config(inliner)
info = vars(config.opendds_version_info)
explicit_title, title, target = process_title_target(text)
if not explicit_title:
ace_ver = info[target + '_version']
parts = ace_ver.split('.')
tao_ver = '.'.join([str(int(parts[0]) - 4)] + parts[1:3])
title = f'ACE {ace_ver}/TAO {tao_ver}'
return link_node(rawtext, lineno, inliner,
title, explicit_title, info[target + '_url'], options)


def omgissue_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
explicit_title, title, target = process_title_target(
text, 'OMG Issue {}'.format(text))
Expand Down Expand Up @@ -375,6 +388,9 @@ def setup(app):
app.add_role('ghpr', ghpr_role)
app.add_role('ghrelease', ghrelease_role)

app.add_config_value('opendds_version_info', None, 'env')
app.add_role('acetaorel', acetaorel_role)

app.add_config_value('omg_specs', {}, 'env', types=[dict])
app.add_role('omgissue', omgissue_role)
app.add_role('omgspec', omgspec_role)
Expand Down
Loading

0 comments on commit ffcfe6e

Please sign in to comment.