From feb281cebc3e4c5f1f4dd01925cbfa5513a245d2 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Thu, 24 Sep 2020 09:10:21 -0300 Subject: [PATCH 01/32] Added python script to automate doc uploading --- tools/deploy/rkh-ftp.py | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 tools/deploy/rkh-ftp.py diff --git a/tools/deploy/rkh-ftp.py b/tools/deploy/rkh-ftp.py new file mode 100755 index 00000000..b02eff0e --- /dev/null +++ b/tools/deploy/rkh-ftp.py @@ -0,0 +1,53 @@ +#!/usr/bin/python3 + +import sys +import argparse +import os +import re +from ftplib import FTP + +RKH_DOC_PATH = 'htdocs/rkh' +parser = argparse.ArgumentParser(add_help=True, + formatter_class=argparse.RawDescriptionHelpFormatter, + description="Updates RKH's docs using a ftp client") + +parser.add_argument('server', action="store", + help='FTP server') +parser.add_argument('user', action="store", + help='FTP server user') +parser.add_argument('passwd', action="store", + help='FTP server password') +parser.add_argument('dest', action="store", + help='destination directory') +parser.add_argument('doc', action="store", + help='doc directory to be uploaded') + +if __name__ == "__main__": + try: + args = parser.parse_args(sys.argv[1:]) + if os.path.isdir(args.doc): + ftp = FTP(host=args.server, user=args.user, passwd=args.passwd) + ftp.cwd(RKH_DOC_PATH) + lst = [] + files = [] + dirs = [] + ftp.dir(lst.append) + for f in lst[2:]: + match = re.search(r'^(?P[d-])\S+\s+\d+\s\S+\s+\S+\s+\d+\s\S+\s+\d+\s+\d+\s(?P\S+)', f) + if match.group('type') == '-': + files.append(match.group('name')) + elif match.group('type') == 'd': + dirs.append(match.group('name')) + else: + print('Unknonw file entry') + print('Found {0:d} files in \'{1:s}\''.format(len(files), RKH_DOC_PATH)) + print('Found {0:d} directories in \'{1:s}\''.format(len(dirs), RKH_DOC_PATH)) + + # Delete 'htdocs/rkh' content + # Upload doc to 'htdocs/rkh' + ftp.quit() + else: + print('ERROR: {} does not exist'.format(args.doc)) + + except IOError as msg: + parser.error(str(msg)) From 2551f22e40d9e1489a4339ea9861df64d868c02e Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Thu, 24 Sep 2020 14:30:14 -0300 Subject: [PATCH 02/32] Working on ftp management --- tools/deploy/rkh-ftp.py | 56 +++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/tools/deploy/rkh-ftp.py b/tools/deploy/rkh-ftp.py index b02eff0e..e8465ce4 100755 --- a/tools/deploy/rkh-ftp.py +++ b/tools/deploy/rkh-ftp.py @@ -4,9 +4,10 @@ import argparse import os import re -from ftplib import FTP +from ftplib import FTP, error_perm + +RKH_DOC_SEARH_DIR = 'search' -RKH_DOC_PATH = 'htdocs/rkh' parser = argparse.ArgumentParser(add_help=True, formatter_class=argparse.RawDescriptionHelpFormatter, description="Updates RKH's docs using a ftp client") @@ -22,28 +23,43 @@ parser.add_argument('doc', action="store", help='doc directory to be uploaded') +def findFiles(dirName): + fileList = [] + foundFiles = [] + ftp.dir(fileList.append) + for f in fileList[2:]: + split = f.split() + attribute = split[0] + name = split[-1] + if attribute.startswith('-'): + foundFiles.append(name) + print('Found {0:d} files in \'{1:s}\''.format(len(foundFiles), dirName)) + return foundFiles + +def deleteFiles(dirName): + files = [] + files = findFiles(dirName) + for f in files: + ftp.delete(f) + print('Deleted {0:d} files in \'{1:s}\''.format(len(files), dirName)) + +def deleteDir(dirName): + curDir = ftp.pwd() + ftp.cwd(dirName) + deleteFiles(dirName) + ftp.cwd(curDir) + ftp.rmd(dirName) + print('Deleted {0:s} directory'.format(dirName)) + if __name__ == "__main__": try: args = parser.parse_args(sys.argv[1:]) if os.path.isdir(args.doc): ftp = FTP(host=args.server, user=args.user, passwd=args.passwd) - ftp.cwd(RKH_DOC_PATH) - lst = [] - files = [] - dirs = [] - ftp.dir(lst.append) - for f in lst[2:]: - match = re.search(r'^(?P[d-])\S+\s+\d+\s\S+\s+\S+\s+\d+\s\S+\s+\d+\s+\d+\s(?P\S+)', f) - if match.group('type') == '-': - files.append(match.group('name')) - elif match.group('type') == 'd': - dirs.append(match.group('name')) - else: - print('Unknonw file entry') - print('Found {0:d} files in \'{1:s}\''.format(len(files), RKH_DOC_PATH)) - print('Found {0:d} directories in \'{1:s}\''.format(len(dirs), RKH_DOC_PATH)) - - # Delete 'htdocs/rkh' content + directory = args.dest + ftp.cwd(directory) + deleteFiles(directory) + deleteDir('toto') # delete RKH_DOC_SEARH_DIR directory # Upload doc to 'htdocs/rkh' ftp.quit() else: @@ -51,3 +67,5 @@ except IOError as msg: parser.error(str(msg)) + except error_perm as reason: + print('ERROR: ftp {}'.format(reason)) From 3d263d1cb4fd49deca8288d7b6d9153a7d2135ee Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Thu, 5 Nov 2020 00:37:12 -0300 Subject: [PATCH 03/32] Doc uploader written in Python is done --- tools/deploy/.gitignore | 7 ++ tools/deploy/rkh-ftp.py | 71 ---------------- tools/deploy/rkhupdoc.py | 179 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 186 insertions(+), 71 deletions(-) create mode 100644 tools/deploy/.gitignore delete mode 100755 tools/deploy/rkh-ftp.py create mode 100755 tools/deploy/rkhupdoc.py diff --git a/tools/deploy/.gitignore b/tools/deploy/.gitignore new file mode 100644 index 00000000..69c9e1fd --- /dev/null +++ b/tools/deploy/.gitignore @@ -0,0 +1,7 @@ +# +# git files that we don't want to ignore even it they are dot-files +# +!.gitignore +!.gitattributes + +__pycache__ diff --git a/tools/deploy/rkh-ftp.py b/tools/deploy/rkh-ftp.py deleted file mode 100755 index e8465ce4..00000000 --- a/tools/deploy/rkh-ftp.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/python3 - -import sys -import argparse -import os -import re -from ftplib import FTP, error_perm - -RKH_DOC_SEARH_DIR = 'search' - -parser = argparse.ArgumentParser(add_help=True, - formatter_class=argparse.RawDescriptionHelpFormatter, - description="Updates RKH's docs using a ftp client") - -parser.add_argument('server', action="store", - help='FTP server') -parser.add_argument('user', action="store", - help='FTP server user') -parser.add_argument('passwd', action="store", - help='FTP server password') -parser.add_argument('dest', action="store", - help='destination directory') -parser.add_argument('doc', action="store", - help='doc directory to be uploaded') - -def findFiles(dirName): - fileList = [] - foundFiles = [] - ftp.dir(fileList.append) - for f in fileList[2:]: - split = f.split() - attribute = split[0] - name = split[-1] - if attribute.startswith('-'): - foundFiles.append(name) - print('Found {0:d} files in \'{1:s}\''.format(len(foundFiles), dirName)) - return foundFiles - -def deleteFiles(dirName): - files = [] - files = findFiles(dirName) - for f in files: - ftp.delete(f) - print('Deleted {0:d} files in \'{1:s}\''.format(len(files), dirName)) - -def deleteDir(dirName): - curDir = ftp.pwd() - ftp.cwd(dirName) - deleteFiles(dirName) - ftp.cwd(curDir) - ftp.rmd(dirName) - print('Deleted {0:s} directory'.format(dirName)) - -if __name__ == "__main__": - try: - args = parser.parse_args(sys.argv[1:]) - if os.path.isdir(args.doc): - ftp = FTP(host=args.server, user=args.user, passwd=args.passwd) - directory = args.dest - ftp.cwd(directory) - deleteFiles(directory) - deleteDir('toto') # delete RKH_DOC_SEARH_DIR directory - # Upload doc to 'htdocs/rkh' - ftp.quit() - else: - print('ERROR: {} does not exist'.format(args.doc)) - - except IOError as msg: - parser.error(str(msg)) - except error_perm as reason: - print('ERROR: ftp {}'.format(reason)) diff --git a/tools/deploy/rkhupdoc.py b/tools/deploy/rkhupdoc.py new file mode 100755 index 00000000..8fd0d508 --- /dev/null +++ b/tools/deploy/rkhupdoc.py @@ -0,0 +1,179 @@ +#!/usr/bin/python3 + +import sys +import argparse +import os +import re +from ftplib import FTP, error_perm + +RKH_DOC_SEARH_DIR = 'search' +ROOT_DIR = '/' + +parser = argparse.ArgumentParser(add_help=True, + formatter_class=argparse.RawDescriptionHelpFormatter, + description="Updates RKH's docs using a ftp client") + +parser.add_argument('server', action="store", + help='FTP server') +parser.add_argument('user', action="store", + help='FTP server user') +parser.add_argument('passwd', action="store", + help='FTP server password') +parser.add_argument('dest', action="store", + help='destination directory') +parser.add_argument('doc', action="store", + help='doc directory to be uploaded') + +class FtpAddOns(): + PATH_CACHE = [] + + def __init__(self, ftp): + self.ftp = ftp + + def pathExists(self, path): + '''path exists check function for ftp handler''' + exists = None + if path not in self.PATH_CACHE: + try: + self.ftp.cwd(path) + exists = True + self.PATH_CACHE.append(path) + except error_perm as reason: + exists = False + else: + exists = True + return exists + + + def mkdirs(self, path, sep='/'): + '''mkdirs function for ftp handler''' + splitPath = path.split(sep) + + newDir = '' + for serverDir in splitPath: + if serverDir: + newDir += sep + serverDir + if not self.pathExists(newDir): + try: + print("Attempting to create directory %s ..." % newDir) + self.ftp.mkd(newDir) + print("Done!") + except error_perm as reason: + print('ERROR: ftp {}'.format(reason)) + +def _removeprefix(self: str, prefix: str, /) -> str: + if self.startswith(prefix): + return self[len(prefix):] + else: + return self[:] + +def _findFiles(ftp, dirName): + fileList = [] + foundFiles = [] + ftp.dir(fileList.append) + for f in fileList[2:]: + split = f.split() + attribute = split[0] + name = split[-1] + if attribute.startswith('-'): + foundFiles.append(name) + print('Found {0:d} files in \'{1:s}\''.format(len(foundFiles), dirName)) + return foundFiles + +def _deleteFiles(ftp, dirName): + files = [] + files = _findFiles(ftp, dirName) + for f in files: + ftp.delete(f) + print('Deleted {0:d} files in \'{1:s}\''.format(len(files), dirName)) + +def _deleteDir(ftp, dirName, ftpPathTools): + curDir = ftp.pwd() + if ftpPathTools.pathExists(dirName): + _deleteFiles(ftp, dirName) + ftp.cwd(curDir) + ftp.rmd(dirName) + print('Deleted {0:s} directory'.format(dirName)) + else: + print('{0:s} does not exist in server'.format(dirName)) + +def _getLocalFiles(localDir, walk = False): + result = [] + + baseDir = os.path.abspath(localDir) + for currentDir, dirs, files in os.walk(baseDir): + subDir = currentDir.replace(baseDir, '') + + if not walk and subDir: + break + + for thisFile in files: + filePath = os.path.join(currentDir, thisFile) + fileMonitor = {'path': filePath, 'mtime': os.path.getmtime(filePath)} + result.append(fileMonitor) + return result + +def _upload(ftp, local, remote, ftpPathTools): + '''Private function. Upload all files in local directory to remote directory''' + localFiles = [] + + localDir = os.path.abspath(local) + remoteDir = os.path.normpath(remote) + localFiles = _getLocalFiles(localDir, True) + + if localFiles: + for fileInfo in localFiles: + filePath = fileInfo['path'] + path, fileName = os.path.split(filePath) + remoteSubPath = path.replace(localDir, '') + remoteSubPath = _removeprefix(remoteSubPath, '/') + remotePath = path.replace(localDir, remoteDir) + remotePath = remotePath.replace('\\', '/') # Convert to unix style + + if not ftpPathTools.pathExists(remotePath): + ftpPathTools.mkdirs(remotePath) + + ftp.cwd(ROOT_DIR) + ftp.cwd(remotePath) + if os.path.exists(filePath): + f = open(filePath, 'rb') + fileName = os.path.split(f.name)[-1] + displayFileName = os.path.join(remoteSubPath, fileName) + displayFileName = displayFileName.replace('\\', '/') + + print("Sending %s ..." % displayFileName) + sendCmd = 'STOR %s' % fileName + ftp.storbinary(sendCmd, f) + f.close() + print("Done") + else: + print("ERROR: No files found in %s" % localDir) + +def uploadDoc(server, user, password, remote, local): + '''Upload all files on local directory to remote directory''' + try: + local = os.path.expanduser(local) + if os.path.isdir(local): + ftp = FTP(host=server, user=user, passwd=password) + ftpPathTools = FtpAddOns(ftp) + if ftpPathTools.pathExists(remote): + _deleteFiles(ftp, remote) + _deleteDir(ftp, RKH_DOC_SEARH_DIR, ftpPathTools) + _upload(ftp, local, remote, ftpPathTools) + else: + print('ERROR: {0:s} does not exist in server'.format(remote)) + ftp.quit() + else: + print('ERROR: {} does not exist'.format(local)) + except error_perm as reason: + print('ERROR: ftp {}'.format(reason)) + +if __name__ == "__main__": + try: + args = parser.parse_args(sys.argv[1:]) + uploadDoc(args.server, args.user, args.passwd, args.dest, args.doc) + + except IOError as msg: + parser.error(str(msg)) + except error_perm as reason: + print('ERROR: ftp {}'.format(reason)) From f7e12b5b16c23a2454b9813ce0392838c69eedc6 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Thu, 5 Nov 2020 10:03:32 -0300 Subject: [PATCH 04/32] Added release module written in Python --- tools/deploy/release.py | 134 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100755 tools/deploy/release.py diff --git a/tools/deploy/release.py b/tools/deploy/release.py new file mode 100755 index 00000000..f445ed8d --- /dev/null +++ b/tools/deploy/release.py @@ -0,0 +1,134 @@ +#!/usr/bin/python3 + +import sys +import argparse +from github import Github, GithubException, GitRelease +import os +import shutil +import tarfile + +parser = argparse.ArgumentParser( + add_help=True, + formatter_class=argparse.RawDescriptionHelpFormatter, + description='Creates and publishes a release in a GitHub ' + 'repository') + +parser.add_argument('version', action="store", + help='desired version. For example, 1.2.3 or 1.2.3-beta.1') +parser.add_argument('repository', action="store", + help='specifies the repository info /. ' + 'For example, itdelsat/CIM-ARM') +parser.add_argument('package', action="store", + help='specifies the directory or tar.gz package in order ' + 'to publish it') +parser.add_argument('-b', action="store", metavar='branch', default='master', + help='specifies the commitish value that determines where ' + 'the Git tag is created from. Default: master') +parser.add_argument('changelog', action="store", + help='text file describing the contents of the release') +parser.add_argument('-d', action="store_true", default=False, + help='creates a draft (unpublished) release') +parser.add_argument('-p', action="store_true", default=False, + help='identifies the release as a prerelease') +parser.add_argument('token', action="store", metavar='token', + help='personal access token') + +def upload_file(repository, package, release): + ''' + Upload a file to latest release + ''' + try: + print("Uploading file " + + "{0:s} to {1:s} repository...".format(package, repository.name)) + release.upload_asset(package, '', 'application/gzip', package) + except GithubException as ex: + print("ERROR: cannot upload file + " + "{0:s} to {1:s} release. Error code ({2:d})".format(package, + release.tag_name, ex.status)) + raise + print("Upload file {0:s} to {1:s} release".format(package, + release.tag_name)) + +def create_release(repository, version, changelog, draft, prerelease): + try: + print("Creating release " + + "{0:s} of {1:s} repository...".format(version, repository.name)) + name = 'v' + version + changelogPath = os.path.normpath(os.path.expanduser(changelog)) + changelogFile = open(changelogPath, 'r') + msg = changelogFile.read() + changelogFile.close() + release = repository.create_git_release(name, name, msg, draft, prerelease, + "master") + print("Release {0:s} published in {1:s} repository".format(name, + repository.name)) + except GithubException as ex: + print("ERROR: cannot create release " + + "{0:s}. Error code ({1:d})".format(version, ex.status)) + raise + return release + +def isNotLocal(dir): + if dir != "" and dir != '.' and dir != os.getcwd(): + return True + else: + return False + +def releasePkg(version, repository, package, changelog, token, + branch = "master", draft = False, prerelease = False): + try: + result = True + g = Github(token) + repo = g.get_repo(repository) + release = create_release(repo, version, changelog, draft, prerelease) + dirExp = os.path.normpath(os.path.expanduser(package)) + if os.path.exists(dirExp): + curDir = os.getcwd() + dirPath = os.path.dirname(dirExp) + dirName = os.path.basename(dirExp) + if os.path.isdir(dirExp): + if isNotLocal(dirPath): + if os.path.exists(dirName) == True: # Setup + print("Delete old '{0:s}' in '{1:s}'".format(dirName, + curDir)) + shutil.rmtree(dirName) + print("Copy '{0:s}' to '{1:s}'".format(dirName, curDir)) + shutil.copytree(dirExp, os.path.join(curDir, dirName)) + print("Compressing '{}'...".format(dirName)) + file = shutil.make_archive(os.path.join(curDir, dirName), + 'gztar', + os.path.join(curDir, dirName)) + upload_file(repo, os.path.basename(file), release) + if isNotLocal(dirPath): # Cleanup + print("Delete '{0:s}' in '{1:s}'".format(dirName, curDir)) + shutil.rmtree(dirName) + print("Delete '{0:s}' in '{1:s}'".format(file, curDir)) + os.remove(file) + else: + if tarfile.is_tarfile(dirExp): + if isNotLocal(dirPath): + shutil.copy2(dirExp, curDir) + upload_file(repo, os.path.basename(dirExp), release) + print("Delete '{0:s}' in '{1:s}'".format(dirName, + curDir)) + os.remove(dirName) + else: + print('ERROR: {} is not a valid tar file'.format(package)) + result = False + else: + print('ERROR: {} is not found'.format(package)) + result = False + return result + + except GithubException as msg: + print("ERROR: message from Github: {}".format(msg.data)) + +if __name__ == "__main__": + try: + args = parser.parse_args(sys.argv[1:]) + releasePkg(args.version, args.repository, args.package, args.changelog, + args.token, args.b, args.d, args.p) + except IOError as msg: + parser.error(str(msg)) + except GithubException as msg: + print("ERROR: message from Github: {}".format(msg.data)) From a1a1e91ff3fdd27d8524529d37c29c8f237f1c25 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 6 Nov 2020 11:00:11 -0300 Subject: [PATCH 05/32] Added deploy written in Python --- tools/deploy/deploy.py | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 tools/deploy/deploy.py diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py new file mode 100755 index 00000000..abbc485c --- /dev/null +++ b/tools/deploy/deploy.py @@ -0,0 +1,60 @@ +#!/usr/bin/python3 + +import sys +import argparse +import os +import shutil +import tarfile +import git + +GitHostURL = 'https://github.com/' + +parser = argparse.ArgumentParser( + add_help=True, + formatter_class=argparse.RawDescriptionHelpFormatter, + description="Creates and publishes RKH's artifacts in order to " + "be released") + +parser.add_argument('version', action="store", + help='desired version. For example, 1.2.3 or 1.2.3-beta.1') +parser.add_argument('repository', action="store", + help='specifies the repository info /. ' + 'For example, itdelsat/CIM-ARM') +parser.add_argument('working', action="store", + help='specifies the working directory') +parser.add_argument('changelog', action="store", + help='text file describing the contents of the release') +parser.add_argument('token', action="store", metavar='token', + help='personal access token') +parser.add_argument('-b', action="store", metavar='branch', default='master', + help='specifies the commitish value that determines where ' + 'the Git tag is created from. Default: master') +parser.add_argument('-d', action="store_true", default=False, + help='creates a draft (unpublished) release') +parser.add_argument('-p', action="store_true", default=False, + help='identifies the release as a prerelease') + + +def deploy(version, repository, workingDir, changelog, token, + branch = "master", draft = False, prerelease = False): + workingDir = os.path.expanduser(workingDir) + repoName = repository.split('/')[-1] + repoPath = os.path.join(workingDir, repoName) + + if os.path.isdir(workingDir): + if not os.path.isdir(repoPath): + os.mkdir(repoPath) + if not os.path.isdir(os.path.join(repoPath, '.git')): + repo = git.Repo.clone_from(GitHostURL + repository + '.git', + repoPath) + else: + print("ERROR: {0:s} does not exist".format(workingDir)) + return False + +if __name__ == "__main__": + try: + args = parser.parse_args(sys.argv[1:]) + deploy(args.version, args.repository, args.working, args.changelog, + args.token, args.b, args.d, args.p) + except IOError as msg: + parser.error(str(msg)) From 1a7a53e2228ca8e6866f761dcab85225391d2eb7 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Mon, 9 Nov 2020 00:12:25 -0300 Subject: [PATCH 06/32] Working on deploy --- tools/deploy/deploy.py | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index abbc485c..a8ddcd8f 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -34,6 +34,20 @@ parser.add_argument('-p', action="store_true", default=False, help='identifies the release as a prerelease') +def printTitle(title): + print("\n{}".format(title)) + print("{}".format('-' * len(title))) + +def runRegressionTests(): + return + +def genDoc(repoPath): + printTitle("Generating doc (html) using doxygen") + curDir = os.getcwd() + os.chdir(os.path.join(repoPath, "doc")) + os.system('doxygen Doxyfile') + os.chdir(curDir) + print("Done") def deploy(version, repository, workingDir, changelog, token, branch = "master", draft = False, prerelease = False): @@ -41,12 +55,29 @@ def deploy(version, repository, workingDir, changelog, token, repoName = repository.split('/')[-1] repoPath = os.path.join(workingDir, repoName) + printTitle("Verifying directories and files") if os.path.isdir(workingDir): if not os.path.isdir(repoPath): os.mkdir(repoPath) if not os.path.isdir(os.path.join(repoPath, '.git')): - repo = git.Repo.clone_from(GitHostURL + repository + '.git', - repoPath) + repoUrl = GitHostURL + repository + '.git' + print("Cloning repository from {}...".format(repoUrl)) + repo = git.Repo.clone_from(repoUrl, repoPath) + print("Done") + else: + repo = git.Repo(repoPath) + head = repo.active_branch + if head.name != 'master': + print("[WARNING] Must be realeased only from master branch") + + +# updateVersion() +# genDoc(repoPath) +# build() +# runRegressionTests() +# publish() +# createPackage() +# release() else: print("ERROR: {0:s} does not exist".format(workingDir)) return False From a60ed7fc771f059533527eba302163f7d575df2c Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Mon, 9 Nov 2020 12:20:47 -0300 Subject: [PATCH 07/32] Replaced version and date --- tools/deploy/deploy.py | 46 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index a8ddcd8f..e8757752 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -6,6 +6,9 @@ import shutil import tarfile import git +import re +from datetime import date +import fileinput GitHostURL = 'https://github.com/' @@ -41,6 +44,39 @@ def printTitle(title): def runRegressionTests(): return +def updateVersion(repoPath, relVersion): + versionFilePath = os.path.join(repoPath, 'source/fwk/inc/rkhfwk_version.h') + relVersionNum = relVersion.replace('.', '') + today = date.today().strftime("%m/%d/%Y") + + with fileinput.FileInput(versionFilePath, inplace = True) as verFile: + for line in verFile: + matchVersion = re.search(r"^#define\sRKH_VERSION_CODE\s+0x(?P[0-9]{4})", line) + matchDate = re.search(r"^\s\*\s+\\releasedate\s+(?P[0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4})", line) + if matchVersion: + if matchVersion.group('code') != relVersionNum: + print(line.replace(matchVersion.group('code'), + relVersionNum), end = '') + elif matchDate: + if matchDate.group('date') != today: + print(line.replace(matchDate.group('date'), today), end = '') + else: + print(line, end = '') + +# verFile = open(versionFilePath, 'r+') +# for line in verFile: +# matchVersion = re.search(r"^#define\sRKH_VERSION_CODE\s+0x(?P[0-9]{4})", line) +# matchDate = re.search(r"^\s\*\s+\\releasedate\s+(?P[0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4})", line) +# if matchVersion: +# if matchVersion.group('code') != relVersionNum: +# print(line.replace(matchVersion.group('code'), +# relVersionNum), end = '') +# elif matchDate: +# print('date') +# if matchDate.group('date') != today: +# print(line.replace(matchDate.group('date'), today), end = '') +# verFile.close() + def genDoc(repoPath): printTitle("Generating doc (html) using doxygen") curDir = os.getcwd() @@ -55,7 +91,11 @@ def deploy(version, repository, workingDir, changelog, token, repoName = repository.split('/')[-1] repoPath = os.path.join(workingDir, repoName) - printTitle("Verifying directories and files") + printTitle("Verifying directories, files and version") + if not re.match(r'[0-9].[0-9].[0-9]{2}', version): + print("[ERROR] Invalid version code: {}".format(version)) + return + if os.path.isdir(workingDir): if not os.path.isdir(repoPath): os.mkdir(repoPath) @@ -66,12 +106,12 @@ def deploy(version, repository, workingDir, changelog, token, print("Done") else: repo = git.Repo(repoPath) + print('Repository {0:s} found in {1:s}'.format(repoName, repoPath)) head = repo.active_branch if head.name != 'master': print("[WARNING] Must be realeased only from master branch") - -# updateVersion() + updateVersion(repoPath, version) # genDoc(repoPath) # build() # runRegressionTests() From 5a57a200c8ea2d7a96bf1f0230f26f9403d7e058 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 20 Nov 2020 09:32:16 -0300 Subject: [PATCH 08/32] Working on version --- tools/deploy/deploy.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index e8757752..df8cb2ae 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -63,19 +63,8 @@ def updateVersion(repoPath, relVersion): else: print(line, end = '') -# verFile = open(versionFilePath, 'r+') -# for line in verFile: -# matchVersion = re.search(r"^#define\sRKH_VERSION_CODE\s+0x(?P[0-9]{4})", line) -# matchDate = re.search(r"^\s\*\s+\\releasedate\s+(?P[0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4})", line) -# if matchVersion: -# if matchVersion.group('code') != relVersionNum: -# print(line.replace(matchVersion.group('code'), -# relVersionNum), end = '') -# elif matchDate: -# print('date') -# if matchDate.group('date') != today: -# print(line.replace(matchDate.group('date'), today), end = '') -# verFile.close() +def updateChangeLog(): + return def genDoc(repoPath): printTitle("Generating doc (html) using doxygen") @@ -111,7 +100,8 @@ def deploy(version, repository, workingDir, changelog, token, if head.name != 'master': print("[WARNING] Must be realeased only from master branch") - updateVersion(repoPath, version) +# updateVersion(repoPath, version) + updateChangeLog() # genDoc(repoPath) # build() # runRegressionTests() From 1cc464f5c166a99f51d9e8d4b4405d11067e8484 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Tue, 22 Dec 2020 13:22:46 -0300 Subject: [PATCH 09/32] Updated Python script --- tools/deploy/deploy.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index df8cb2ae..2f967f65 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -100,11 +100,11 @@ def deploy(version, repository, workingDir, changelog, token, if head.name != 'master': print("[WARNING] Must be realeased only from master branch") +# runRegressionTests() +# build() # updateVersion(repoPath, version) - updateChangeLog() +# updateChangeLog() # genDoc(repoPath) -# build() -# runRegressionTests() # publish() # createPackage() # release() From 93b87ba8953ada21fa1d91a8b55b71457f3a9c97 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Thu, 4 Feb 2021 11:26:16 -0300 Subject: [PATCH 10/32] Deleted build and unit test processes from deploy script --- tools/deploy/deploy.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 2f967f65..2159e7c1 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -41,9 +41,6 @@ def printTitle(title): print("\n{}".format(title)) print("{}".format('-' * len(title))) -def runRegressionTests(): - return - def updateVersion(repoPath, relVersion): versionFilePath = os.path.join(repoPath, 'source/fwk/inc/rkhfwk_version.h') relVersionNum = relVersion.replace('.', '') @@ -100,8 +97,6 @@ def deploy(version, repository, workingDir, changelog, token, if head.name != 'master': print("[WARNING] Must be realeased only from master branch") -# runRegressionTests() -# build() # updateVersion(repoPath, version) # updateChangeLog() # genDoc(repoPath) From 554ad8895a52be3b4f77cd44c3ebb9b43ceb4427 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Mon, 8 Feb 2021 18:01:00 -0300 Subject: [PATCH 11/32] Working on release automation using python --- tools/deploy/deploy.py | 57 +++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 2159e7c1..592ccd9c 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -6,12 +6,18 @@ import shutil import tarfile import git +from git import RemoteProgress import re from datetime import date import fileinput GitHostURL = 'https://github.com/' +class MyProgressPrinter(RemoteProgress): + def update(self, op_code, cur_count, max_count=None, message=''): + print(op_code, cur_count, max_count, + cur_count / (max_count or 100.0), message or "NO MESSAGE") + parser = argparse.ArgumentParser( add_help=True, formatter_class=argparse.RawDescriptionHelpFormatter, @@ -22,11 +28,12 @@ help='desired version. For example, 1.2.3 or 1.2.3-beta.1') parser.add_argument('repository', action="store", help='specifies the repository info /. ' - 'For example, itdelsat/CIM-ARM') + 'For example, vortexmakes/RKH') parser.add_argument('working', action="store", help='specifies the working directory') -parser.add_argument('changelog', action="store", - help='text file describing the contents of the release') +parser.add_argument('changelog', metavar='changelog-file', + type=argparse.FileType('rt'), + help='text file describing code changes') parser.add_argument('token', action="store", metavar='token', help='personal access token') parser.add_argument('-b', action="store", metavar='branch', default='master', @@ -45,7 +52,10 @@ def updateVersion(repoPath, relVersion): versionFilePath = os.path.join(repoPath, 'source/fwk/inc/rkhfwk_version.h') relVersionNum = relVersion.replace('.', '') today = date.today().strftime("%m/%d/%Y") + isFoundVersionPattern = None + isFoundDatePattern = None + printTitle("Updating version") with fileinput.FileInput(versionFilePath, inplace = True) as verFile: for line in verFile: matchVersion = re.search(r"^#define\sRKH_VERSION_CODE\s+0x(?P[0-9]{4})", line) @@ -54,15 +64,26 @@ def updateVersion(repoPath, relVersion): if matchVersion.group('code') != relVersionNum: print(line.replace(matchVersion.group('code'), relVersionNum), end = '') + isFoundVersionPattern = True elif matchDate: if matchDate.group('date') != today: print(line.replace(matchDate.group('date'), today), end = '') + isFoundDatePattern = True else: print(line, end = '') + if isFoundDatePattern and isFoundVersionPattern: + print("Updated version: {}".format(relVersion)) + print("Updated version date: {}".format(today)) + else: + print("[ERROR] Unknown version file format") + def updateChangeLog(): return +def updateBranches(repo): + print("Updating default branch from develop") + def genDoc(repoPath): printTitle("Generating doc (html) using doxygen") curDir = os.getcwd() @@ -88,19 +109,37 @@ def deploy(version, repository, workingDir, changelog, token, if not os.path.isdir(os.path.join(repoPath, '.git')): repoUrl = GitHostURL + repository + '.git' print("Cloning repository from {}...".format(repoUrl)) - repo = git.Repo.clone_from(repoUrl, repoPath) + repo = git.Repo.clone_from(repoUrl, repoPath, + progress=MyProgressPrinter()) + # Setup a local tracking branch of a remote branch + ## create local branch "master" from remote "master" + origin = repo.remotes['origin'] + repo.create_head('develop', origin.refs.develop) + ## set local "develop" to track remote "develop" + repo.heads.develop.set_tracking_branch(origin.refs.develop) + ## checkout local "develop" to working tree + repo.heads.develop.checkout() print("Done") else: repo = git.Repo(repoPath) print('Repository {0:s} found in {1:s}'.format(repoName, repoPath)) - head = repo.active_branch - if head.name != 'master': - print("[WARNING] Must be realeased only from master branch") + if repo.is_dirty(): + print("[ERROR] Repository is dirty:") + print("{}".format(repo.git.diff('--name-only'))) + return + if repo.active_branch.name != 'develop': + print("[ERROR] It process must only be performed on " + + "develop branch") + return + origin = repo.remotes['origin'] + origin.pull(progress=MyProgressPrinter()) -# updateVersion(repoPath, version) + updateVersion(repoPath, version) # updateChangeLog() # genDoc(repoPath) -# publish() +# publishDoc() +# updateBranches(repo) +# updateDftBranch() # createPackage() # release() else: From b629170d1f2c98f0ad7c3fc468dc557ed8e5d6c8 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Wed, 10 Feb 2021 13:52:54 -0300 Subject: [PATCH 12/32] Generated sections of changelog --- tools/deploy/deploy.py | 70 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 592ccd9c..e81835dd 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -10,8 +10,25 @@ import re from datetime import date import fileinput +import json GitHostURL = 'https://github.com/' +RelFileHeader = ''' +/** +\page changelog Release Notes + +\\tableofcontents + +''' +RelFileTail = ''' +*/ +''' + +MsgType = {"new": 'new', + "bugfix": 'bugFix', + "apichg": 'apichg', + "deprecated": 'par Deprecated features', + "note": 'warning'} class MyProgressPrinter(RemoteProgress): def update(self, op_code, cur_count, max_count=None, message=''): @@ -78,7 +95,53 @@ def updateVersion(repoPath, relVersion): else: print("[ERROR] Unknown version file format") -def updateChangeLog(): +def getSection(version): + verCode = version.split('.') + line = "\section rkhVer_" + line += "{0:s}_{1:s}_{2:s} ".format(verCode[0], verCode[1], verCode[2]) + line += "Version {}\n".format(version) + return line + +def getDate(date): + line = "\\releasedate {}\n\n".format(date) + return line + +def getMessage(msgType, messages): + section = "" + if len(messages) != 0: + section = "\\{}\n".format(MsgType[msgType]) + for line in messages: + section += "- " + line + '\n' + section += '\n' + return section + +def genChangeLog(repo, inFilePath, outFilePath): + if os.path.exists(inFilePath): + with open(outFilePath, "w+") as relfile: + relfile.write(RelFileHeader) # Add the header file + + jsonFile = open(inFilePath, 'r') + releases = json.load(jsonFile) + jsonFile.close() + for release in releases: + line = getSection(release['version']) + relfile.write(line) + line = getDate(release['date']) + relfile.write(line) + line = getMessage('new', release['new']) + relfile.write(line) + line = getMessage('bugfix', release['bugfix']) + relfile.write(line) + line = getMessage('apichg', release['apichg']) + relfile.write(line) + line = getMessage('deprecated', release['deprecated']) + relfile.write(line) + line = getMessage('note', release['note']) + relfile.write(line) + + relfile.write(RelFileTail) # Add the tail file + else: + print("[ERROR] Release file {} does not exist".format(jsonFile)) return def updateBranches(repo): @@ -134,8 +197,9 @@ def deploy(version, repository, workingDir, changelog, token, origin = repo.remotes['origin'] origin.pull(progress=MyProgressPrinter()) - updateVersion(repoPath, version) -# updateChangeLog() +# updateVersion(repoPath, version) + genChangeLog(repo, os.path.join(repo.working_dir, 'changelog.json'), + os.path.join(repo.working_dir, 'chglog.txt')) # genDoc(repoPath) # publishDoc() # updateBranches(repo) From 7e8a33869b06a15d16d7596d85ed4db3cd9e3fe8 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Wed, 10 Feb 2021 15:52:09 -0300 Subject: [PATCH 13/32] Generated release message --- tools/deploy/deploy.py | 187 ++++++++++++++++++++++++++++++++--------- 1 file changed, 146 insertions(+), 41 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index e81835dd..c09ab427 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -24,11 +24,111 @@ */ ''' -MsgType = {"new": 'new', - "bugfix": 'bugFix', - "apichg": 'apichg', - "deprecated": 'par Deprecated features', - "note": 'warning'} +RelMsgHeader = ''' +''' + +RelMsgTail = ''' +''' + +class Release: + header = "" + tail = "" + version = "" + date = "" + new = [] + bugfix = [] + apichg = [] + deprecated = [] + port = [] + note = [] + + def __init__(self, relDic): + self.version = relDic['version'] + self.date = relDic['date'] + self.new = relDic['new'] + self.bugfix = relDic['bugfix'] + self.apichg = relDic['apichg'] + self.deprecated = relDic['deprecated'] + self.port = relDic['port'] + self.note = relDic['note'] + + def message(self, kindOf, messages): + section = "" + if len(messages) != 0: + section = "{}\n".format(self.MsgType[kindOf]) + for line in messages: + section += "- " + line + '\n' + section += '\n' + return section + +class RelMsg(Release): + HeaderText = "" + TailText = "" + MsgType = {"new": '**New features**', + "bugfix": '**Bug fixes**', + "apichg": '**API changes**', + "deprecated": '**Deprecated features**', + "note": '**Notes**'} + + def __init__(self, relDic): + super().__init__(relDic) + self.header = self.HeaderText + self.tail = self.TailText + + def news(self): + return self.message('new', self.new) + + def bugfixes(self): + return self.message('bugfix', self.bugfix) + + def apichanges(self): + return self.message('apichg', self.apichg) + + def deprecatedFeatures(self): + return self.message('deprecated', self.deprecated) + + def notes(self): + return self.message('note', self.note) + +class RelLog(Release): + HeaderText = "/**\n\page changelog Release Notes\n\n\\tableofcontents\n\n" + TailText = "\n*/" + MsgType = {"new": '\\new', + "bugfix": '\\bugfix', + "apichg": '\\apichg', + "deprecated": '\\deprecated', + "note": '\\warning'} + + def __init__(self, relDic): + super().__init__(relDic) + self.header = self.HeaderText + self.tail = self.TailText + + def section(self): + verCode = self.version.split('.') + line = "\section rkhVer_" + line += "{0:s}_{1:s}_{2:s} ".format(verCode[0], verCode[1], verCode[2]) + line += "Version {}\n".format(self.version) + return line + + def relDate(self): + line = "\\releasedate {}\n\n".format(self.date) + return line + + def news(self): + return self.message('new', self.new) + + def bugfixes(self): + return self.message('bugfix', self.bugfix) + + def apichanges(self): + return self.message('apichg', self.apichg) + + def deprecatedFeatures(self): + return self.message('deprecated', self.deprecated) + + def notes(self): + return self.message('note', self.note) class MyProgressPrinter(RemoteProgress): def update(self, op_code, cur_count, max_count=None, message=''): @@ -95,26 +195,6 @@ def updateVersion(repoPath, relVersion): else: print("[ERROR] Unknown version file format") -def getSection(version): - verCode = version.split('.') - line = "\section rkhVer_" - line += "{0:s}_{1:s}_{2:s} ".format(verCode[0], verCode[1], verCode[2]) - line += "Version {}\n".format(version) - return line - -def getDate(date): - line = "\\releasedate {}\n\n".format(date) - return line - -def getMessage(msgType, messages): - section = "" - if len(messages) != 0: - section = "\\{}\n".format(MsgType[msgType]) - for line in messages: - section += "- " + line + '\n' - section += '\n' - return section - def genChangeLog(repo, inFilePath, outFilePath): if os.path.exists(inFilePath): with open(outFilePath, "w+") as relfile: @@ -123,23 +203,47 @@ def genChangeLog(repo, inFilePath, outFilePath): jsonFile = open(inFilePath, 'r') releases = json.load(jsonFile) jsonFile.close() + + latest = RelMsg(releases[0]) + relfile.write(latest.header) # Add the message header + for release in releases: - line = getSection(release['version']) - relfile.write(line) - line = getDate(release['date']) - relfile.write(line) - line = getMessage('new', release['new']) - relfile.write(line) - line = getMessage('bugfix', release['bugfix']) - relfile.write(line) - line = getMessage('apichg', release['apichg']) - relfile.write(line) - line = getMessage('deprecated', release['deprecated']) - relfile.write(line) - line = getMessage('note', release['note']) - relfile.write(line) - - relfile.write(RelFileTail) # Add the tail file + rel = RelLog(release) + text = rel.section() + relfile.write(text) + text = rel.relDate() + relfile.write(text) + text = rel.news() + relfile.write(text) + text = rel.bugfixes() + relfile.write(text) + text = rel.apichanges() + relfile.write(text) + text = rel.deprecatedFeatures() + relfile.write(text) + text = rel.notes() + relfile.write(text) + + relfile.write(latest.tail) # Add the tail file + else: + print("[ERROR] Release file {} does not exist".format(jsonFile)) + return + +def genRelMsg(repo, inFilePath): + if os.path.exists(inFilePath): + jsonFile = open(inFilePath, 'r') + releases = json.load(jsonFile) + jsonFile.close() + release = RelMsg(releases[0]) + text = release.header # Add the message header + ### + text += release.news() + text += release.bugfixes() + text += release.apichanges() + text += release.deprecatedFeatures() + text += release.notes() + text += release.tail # Add the message tail + print(text) else: print("[ERROR] Release file {} does not exist".format(jsonFile)) return @@ -200,6 +304,7 @@ def deploy(version, repository, workingDir, changelog, token, # updateVersion(repoPath, version) genChangeLog(repo, os.path.join(repo.working_dir, 'changelog.json'), os.path.join(repo.working_dir, 'chglog.txt')) + genRelMsg(repo, os.path.join(repo.working_dir, 'changelog.json')) # genDoc(repoPath) # publishDoc() # updateBranches(repo) From be9399239a96f245656c72cc717c10ba0a112c19 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Thu, 11 Feb 2021 12:55:41 -0300 Subject: [PATCH 14/32] Fixed some doxygen groups in rkhdef.h file --- source/fwk/inc/rkhdef.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/fwk/inc/rkhdef.h b/source/fwk/inc/rkhdef.h index 58b347a3..12aa3dd1 100644 --- a/source/fwk/inc/rkhdef.h +++ b/source/fwk/inc/rkhdef.h @@ -101,7 +101,7 @@ extern "C" { #define RKH_BIT08(bit) ((rui8_t)((rui8_t) 1u << (bit))) #define RKH_BIT16(bit) ((rui16_t)((rui16_t) 1u << (bit))) #define RKH_BIT32(bit) ((rui32_t)((rui32_t) 1u << (bit))) -/*@}*/ +/**@}*/ /** * \brief @@ -136,7 +136,7 @@ extern "C" { ((rui16_t)((rui16_t)(bit_mask) << (bit_shift))) #define RKH_BIT_MASK_32(bit_mask, bit_shift) \ ((rui32_t)((rui32_t)(bit_mask) << (bit_shift))) -/*@}*/ +/**@}*/ /**@{ * \brief @@ -156,7 +156,7 @@ extern "C" { ((val) = (rui16_t)(((rui16_t)(val)) | ((rui16_t)(mask)))) #define RKH_BIT_SET_32(val, mask) \ ((val) = (rui32_t)(((rui32_t)(val)) | ((rui32_t)(mask)))) -/*@}*/ +/**@}*/ /**@{ * \brief @@ -176,7 +176,7 @@ extern "C" { ((val) = (rui16_t)(((rui16_t)(val)) & ((rui16_t) ~(mask)))) #define RKH_BIT_CLR_32(val, mask) \ ((val) = (rui32_t)(((rui32_t)(val)) & ((rui32_t) ~(mask)))) -/*@}*/ +/**@}*/ /** * \brief @@ -276,7 +276,7 @@ extern "C" { #define RKH_FAIL 0u #define RKH_OK 1u -/*@}*/ +/**@}*/ /* ------------------------------- Data types ------------------------------ */ /* -------------------------- External variables --------------------------- */ From 90db66e231f0109a6a06705d9cc8580f6b63dd6d Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 12 Feb 2021 11:26:53 -0300 Subject: [PATCH 15/32] Tested FTP client --- tools/deploy/deploy.py | 139 ++++++++++++++++++--------------------- tools/deploy/rkhupdoc.py | 3 +- 2 files changed, 67 insertions(+), 75 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index c09ab427..8ac5cde6 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -11,24 +11,12 @@ from datetime import date import fileinput import json +import subprocess +from rkhupdoc import uploadDoc GitHostURL = 'https://github.com/' -RelFileHeader = ''' -/** -\page changelog Release Notes - -\\tableofcontents - -''' -RelFileTail = ''' -*/ -''' - -RelMsgHeader = ''' -''' - -RelMsgTail = ''' -''' +CHANGELOG_PATH = 'tools/deploy/changelog.json' +DOC_CHANGELOG_PATH = 'doc/chglog.txt' class Release: header = "" @@ -61,20 +49,6 @@ def message(self, kindOf, messages): section += '\n' return section -class RelMsg(Release): - HeaderText = "" - TailText = "" - MsgType = {"new": '**New features**', - "bugfix": '**Bug fixes**', - "apichg": '**API changes**', - "deprecated": '**Deprecated features**', - "note": '**Notes**'} - - def __init__(self, relDic): - super().__init__(relDic) - self.header = self.HeaderText - self.tail = self.TailText - def news(self): return self.message('new', self.new) @@ -90,6 +64,20 @@ def deprecatedFeatures(self): def notes(self): return self.message('note', self.note) +class RelMsg(Release): + HeaderText = "" + TailText = "" + MsgType = {"new": '**New features**', + "bugfix": '**Bug fixes**', + "apichg": '**API changes**', + "deprecated": '**Deprecated features**', + "note": '**Notes**'} + + def __init__(self, relDic): + super().__init__(relDic) + self.header = self.HeaderText + self.tail = self.TailText + class RelLog(Release): HeaderText = "/**\n\page changelog Release Notes\n\n\\tableofcontents\n\n" TailText = "\n*/" @@ -115,21 +103,6 @@ def relDate(self): line = "\\releasedate {}\n\n".format(self.date) return line - def news(self): - return self.message('new', self.new) - - def bugfixes(self): - return self.message('bugfix', self.bugfix) - - def apichanges(self): - return self.message('apichg', self.apichg) - - def deprecatedFeatures(self): - return self.message('deprecated', self.deprecated) - - def notes(self): - return self.message('note', self.note) - class MyProgressPrinter(RemoteProgress): def update(self, op_code, cur_count, max_count=None, message=''): print(op_code, cur_count, max_count, @@ -148,9 +121,6 @@ def update(self, op_code, cur_count, max_count=None, message=''): 'For example, vortexmakes/RKH') parser.add_argument('working', action="store", help='specifies the working directory') -parser.add_argument('changelog', metavar='changelog-file', - type=argparse.FileType('rt'), - help='text file describing code changes') parser.add_argument('token', action="store", metavar='token', help='personal access token') parser.add_argument('-b', action="store", metavar='branch', default='master', @@ -165,6 +135,12 @@ def printTitle(title): print("\n{}".format(title)) print("{}".format('-' * len(title))) +def printTaskTitle(title): + print("{}...".format(title)) + +def printTaskDone(): + print("{}".format('Done')) + def updateVersion(repoPath, relVersion): versionFilePath = os.path.join(repoPath, 'source/fwk/inc/rkhfwk_version.h') relVersionNum = relVersion.replace('.', '') @@ -172,7 +148,7 @@ def updateVersion(repoPath, relVersion): isFoundVersionPattern = None isFoundDatePattern = None - printTitle("Updating version") + printTaskTitle("Updating version") with fileinput.FileInput(versionFilePath, inplace = True) as verFile: for line in verFile: matchVersion = re.search(r"^#define\sRKH_VERSION_CODE\s+0x(?P[0-9]{4})", line) @@ -196,16 +172,15 @@ def updateVersion(repoPath, relVersion): print("[ERROR] Unknown version file format") def genChangeLog(repo, inFilePath, outFilePath): + printTaskTitle("Generating change log file") if os.path.exists(inFilePath): - with open(outFilePath, "w+") as relfile: - relfile.write(RelFileHeader) # Add the header file - - jsonFile = open(inFilePath, 'r') - releases = json.load(jsonFile) - jsonFile.close() + jsonFile = open(inFilePath, 'r') + releases = json.load(jsonFile) + jsonFile.close() + with open(outFilePath, "w+") as relfile: latest = RelMsg(releases[0]) - relfile.write(latest.header) # Add the message header + relfile.write(latest.header) # Add the header file for release in releases: rel = RelLog(release) @@ -225,25 +200,30 @@ def genChangeLog(repo, inFilePath, outFilePath): relfile.write(text) relfile.write(latest.tail) # Add the tail file + printTaskDone() else: print("[ERROR] Release file {} does not exist".format(jsonFile)) return def genRelMsg(repo, inFilePath): + printTaskTitle("Generating release message") if os.path.exists(inFilePath): jsonFile = open(inFilePath, 'r') releases = json.load(jsonFile) jsonFile.close() + release = RelMsg(releases[0]) text = release.header # Add the message header - ### + text += release.news() text += release.bugfixes() text += release.apichanges() text += release.deprecatedFeatures() text += release.notes() + text += release.tail # Add the message tail - print(text) + printTaskDone() + return text else: print("[ERROR] Release file {} does not exist".format(jsonFile)) return @@ -252,20 +232,26 @@ def updateBranches(repo): print("Updating default branch from develop") def genDoc(repoPath): - printTitle("Generating doc (html) using doxygen") - curDir = os.getcwd() - os.chdir(os.path.join(repoPath, "doc")) - os.system('doxygen Doxyfile') - os.chdir(curDir) - print("Done") - -def deploy(version, repository, workingDir, changelog, token, + printTaskTitle("Generating doc (html) using doxygen") + docPath = os.path.join(repoPath, 'doc') + proc = subprocess.run("doxygen Doxyfile", shell=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + cwd=docPath) + if proc.returncode != 0: + print("[ERROR] Doxygen fails:\n{}".format(proc.stdout)) + else: + printTaskDone() + +def publishDoc(server, user, passwd, dest, doc): + uploadDoc(server, user, passwd, dest, doc) + +def deploy(version, repository, workingDir, token, branch = "master", draft = False, prerelease = False): workingDir = os.path.expanduser(workingDir) repoName = repository.split('/')[-1] repoPath = os.path.join(workingDir, repoName) - printTitle("Verifying directories, files and version") + printTaskTitle("Verifying directories, files and code version") if not re.match(r'[0-9].[0-9].[0-9]{2}', version): print("[ERROR] Invalid version code: {}".format(version)) return @@ -286,7 +272,7 @@ def deploy(version, repository, workingDir, changelog, token, repo.heads.develop.set_tracking_branch(origin.refs.develop) ## checkout local "develop" to working tree repo.heads.develop.checkout() - print("Done") + printTaskDone() else: repo = git.Repo(repoPath) print('Repository {0:s} found in {1:s}'.format(repoName, repoPath)) @@ -300,17 +286,22 @@ def deploy(version, repository, workingDir, changelog, token, return origin = repo.remotes['origin'] origin.pull(progress=MyProgressPrinter()) + printTaskDone() # updateVersion(repoPath, version) - genChangeLog(repo, os.path.join(repo.working_dir, 'changelog.json'), - os.path.join(repo.working_dir, 'chglog.txt')) - genRelMsg(repo, os.path.join(repo.working_dir, 'changelog.json')) + genChangeLog(repo, os.path.join(repo.working_dir, CHANGELOG_PATH), + os.path.join(repo.working_dir, DOC_CHANGELOG_PATH)) + relMsg = genRelMsg(repo, os.path.join(repo.working_dir, CHANGELOG_PATH)) # genDoc(repoPath) -# publishDoc() +# publishDoc('ftp.vortexmakes.com', +# 'webmaster.vortexmakes.com', +# 'V0rt3xM4k35!', +# 'htdocs/rkh/lolo', +# '~/lolo/') # updateBranches(repo) # updateDftBranch() # createPackage() -# release() +# release(relMsg) else: print("ERROR: {0:s} does not exist".format(workingDir)) return False @@ -318,7 +309,7 @@ def deploy(version, repository, workingDir, changelog, token, if __name__ == "__main__": try: args = parser.parse_args(sys.argv[1:]) - deploy(args.version, args.repository, args.working, args.changelog, + deploy(args.version, args.repository, args.working, args.token, args.b, args.d, args.p) except IOError as msg: parser.error(str(msg)) diff --git a/tools/deploy/rkhupdoc.py b/tools/deploy/rkhupdoc.py index 8fd0d508..b0f2eadd 100755 --- a/tools/deploy/rkhupdoc.py +++ b/tools/deploy/rkhupdoc.py @@ -71,7 +71,8 @@ def _findFiles(ftp, dirName): fileList = [] foundFiles = [] ftp.dir(fileList.append) - for f in fileList[2:]: + for f in fileList[2:]: # Ignore '.' and '..' directories +# for f in fileList: split = f.split() attribute = split[0] name = split[-1] From e2feb8a4585a81b53fd6a85b350ba2094a20a806 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 12 Feb 2021 11:28:10 -0300 Subject: [PATCH 16/32] Added code change history in JSON format --- tools/deploy/changelog.json | 304 ++++++++++++++++++++++++++++++++++++ 1 file changed, 304 insertions(+) create mode 100644 tools/deploy/changelog.json diff --git a/tools/deploy/changelog.json b/tools/deploy/changelog.json new file mode 100644 index 00000000..c52be4c0 --- /dev/null +++ b/tools/deploy/changelog.json @@ -0,0 +1,304 @@ +[ + { + "version": "3.2.03", + "date": "2019-28-08", + "new": ["Added support for null transitions on init a state machine", + "Added bsp for blinky project on Linux platform", + "Added TimeEvt type for declaring time events", + "Added support for final state in state machine's region", + "Enhanced quick reference and doc related to timers"], + "bugfix": ["Fixed tick rate for Linux bsp", + "Fixed stop method of timer module", + "Fixed a race condition in Linux port"], + "apichg": ["Added period to timer start method and a return flag to stop method"], + "deprecated": [], + "port": [], + "note": [] + }, + { + "version": "3.2.00", + "date": "2019-09-01", + "new": ["Added Ceedling, LCOV, Codecov, Cppcheck, Uno and Travis CI support!. The main purpose of this is to improve the quality of source code, by means of Continuous Integration process", + "Included a new alternative in license scheme: GPLv3 + linking exception", + "Added Publish-Subscriber module. It addresses the specific issue of how to notify a set of interested active objects (clients) in a timely way that a value that they care about has changed. The basic solution offered by this module is to have the clients 'subscribe' to the server to be notified about the value in question according to the policy: 'when the value changes, receiving a proper event carrying the value of interest", + "Added RKH_SMA_DISPATCH() polymorphic function in native scheduler", + "Added a deploy script to release new versions", + "Enhanced README file"], + "bugfix": [], + "apichg": [], + "deprecated": [], + "port": [], + "note": ["From this version, you must include the files rkhfwk_rdygrp.h and rkhfwk_rdygrp.c located in /source/fwk/inc and /source/fwk/src respectively, to maintain the backward-compatiblity with the existing application projects"] + }, + { + "version": "3.1.00", + "date": "2018-05-03", + "new": ["Added support for using any kind of vertex as target of a default transition in both composite state region or root region, according to UML 2.x."], + "bugfix": [], + "apichg": [], + "deprecated": ["The RKH_TE_SM_NTRNACT trace record is now deprecated and not recommended for new designs. It remains supported for backwards compatibility", + "Deleted RKH_INIT_ACT_T type and deprecated its config option RKH_CFG_SMA_INIT_ARG_SMA_EN. Therefore, was replaced RKH_INIT_ACT_T by RKH_TRN_ACT_T and was fixed every demo application according to that"], + "port": [], + "note": [] + }, + { + "version": "3.0.00", + "date": "2017-08-01", + "new": ["Added unit test cases of trace, sma and fwk modules", + "Added test harness of framework's modules to test for", + "Added Ceedling submodule", + "Rearranged files and directories (modules, ports and demo apps)", + "Improved trace module", + "Improved doc files (doxygen) and comments"], + "bugfix": [], + "apichg": [], + "deprecated": [], + "port": [], + "note": [] + }, + { + "version": "2.4.06", + "date": "2016-12-14", + "new": ["Improved doc files (doxygen) and comments", + "Improved template of C implementation file", + "Deleted template_aoAct.c/.h", + "Changed the template files for active object definition", + "Rearranged the blinky.c and blinky.h files"], + "bugfix": ["After executing the SM's initial action the trace event RKH_TE_SM_INIT is sent to trazer, to avoid trace events without symbols which are frequently sent within initial action"], + "apichg": [], + "deprecated": [], + "port": [], + "note": [] + }, + { + "version": "2.4.05", + "date": "2016-04-25", + "new": ["Added support for code beautifier Uncrustify in /tools/uncrustify, to be used as a code formatting tool according to RKH rules. Also, included source and header file templates", + "Reformatted source and header files in /sources and /sources/include", + "Added support for TDD with Unity + Cmock + Trazer. The directory /tests includes the related files", + "Added #RKH_CFG_HOOK_PUT_TRCEVT_EN configuration option to include the new bsp dependent function rkh_hook_putTrcEvt()", + "Refactored trace module (/tests/trace), state machine module (/tests/sm) and trazer (/tests/utrazer) through the test harness. It implies various performance improvements, memory usage reduction, better documentation, and learning tests", + "Removed NULL macro usage from rkh.h file, and thus inclusion", + "Improved doc files (doxygen) and comments", + "Added deprecated list", + "Enhanced module section by including the configuration, trace, test, and API referecen manual sections", + "Added test suite of state machine module", + "Multiple enabled transitions (same trigger) with mutually exclusive guards according to UML is now supported. This usage of this feature is demonstrated through various and provided learning tests", + "Completion transition (also as known as null transition) and completion event in simple and composite states is now supported. This usage of this feature is demonstrated through various and provided learning tests", + "Final state in composite states is now supported. This usage of this feature is demonstrated through various and provided learning tests", + "The default transition (also as known as initial transition) in a composite state can have its own associated behavior (effect) is now supported. This usage of this feature is demonstrated through various and provided learning tests", + "Added macro RKH_CREATE_COMP_REGION_STATE() to instantiate a composite state with a single region, including its own initial pseudostate, history (shallow or deep type) pseudostate, as well as its own final state. This usage of this feature is demonstrated through various and provided learning tests", + "Multiple enabled transitions (same trigger) with mutually exclusive guards according to UML is now supported. This usage of this feature is demonstrated through various and provided learning tests", + "A state machine is now allowed to be instantiated regardless of an active object instance. It is very useful to create reactive parts (or orthogonal regions) of composite active objects. Also, by means of RKH_CFG_SMA_SM_CONST_EN option a state machine instance could be allocated into ROM or RAM. It is useful to dynamic allocation. This usage of this feature is demonstrated through various and provided learning tests", + "Polimorphic active objects with 'virtual. table (in C) is now supported. It is composed as activate, task, post_fifo, and post_lifo operations. This usage of this feature is demonstrated through various and provided learning tests", + "Added runtime constructors for active object and state machine classes for multiple and single instances. This usage of this feature is demonstrated through various and provided learning tests", + "Added RKH_CFG_SMA_VFUNCT_EN and RKH_CFG_SMA_RT_CTOR_EN options to set the active object as polymorphic and to use the runtime constructors of RKH_SMA_T/RKH_SM_T classes. This usage of this feature is demonstrated through various and provided learning tests", + "Template files for dealing with implementation and specification of active objects is now added to /template", +"Added RKH_DECLARE_TR_TBL(), RKH_INIT_BASIC_STATE(), and RKH_INIT_COMPOSITE_STATE() macros to derive a state (basic or composite) class to any other using single inheritance in C by literally embedding the base type (or super-class), RKHSBSC_T or RKHSCMP_T, as the first member of the derived structure"], + "bugfix": ["Fixed a old bug at rkh_sm_dispatch() function in rkh.c file related with entry and exited states on a loop transition. The implemented solution have adopted the UML's local transition feature"], + "apichg": ["The API for RKH_CREATE_DEEP_HISTORY_STATE() and RKH_CREATE_SHALLOW_HISTORY_STATE() changed. Added arguments to set (optional) the history default transition. However, those macros are now backwards compatibility"], + "deprecated": ["The RKH_CREATE_DEEP_HISTORY_STATE() and RKH_CREATE_SHALLOW_HISTORY_STATE() macros are now deprecated and not recommended for new designs. It remains supported for backwards compatibility"], + "port": ["Added a port to be exclusively used in the x86 test harness in source/portable/test directory, tagged as '__TEST__'"], + "note": [] + }, + { + "version": "2.4.03", + "date": "2013-07-15", + "new": ["Added cross-platform demo 'shared' for s08 and x86 platforms", + "Adds RKH_TR_QUE_FULL macro from rkh_queue_put_fifo() and rkh_queue_put_lifo() functions", + "Added RKH_VERSION_CODE to RKH_TR_FWK_TCFG", + "Updated comments", + "Changed RKH_TRC_EN_SM_CSTATE by RKH_CFG_TRC_SM_TS_STATE_EN", + "Changed RKH_TE_SM_CSTATE by RKH_TE_SM_TS_STATE", + "Added assert in rkh_queue_put_fifo()/lifo() when queue is full", + "Added little code in favor of defensive programming (rkhmempool.c)", + "Added new arguments to trace event macros. See 'trace event table'", + "Updated configuration table and preprocessor checking in rkhitl.h"], + "bugfix": [], + "apichg": ["Added sender object (and macro RKH_CFG_SMA_TRC_SNDR_EN to rkhcfg.h) to rkh_tmr_tick(), and rkh_sma_post_fifo(), and rkh_sma_post_lifo()", + "Added RKH_TIM_TICK(), RKH_SMA_POST_FIFO()/_LIFO() macros to invoke functions rkh_tmr_tick(), and rkh_sma_post_fifo(), and rkh_sma_post_lifo(), respectively", + "Added choice pseudostate.", + "Added macros RKH_GET_PRIO() and RKH_GET_SMA().", + "Added macros RKH_ARRAY_SMA_CREATE() and RKH_ARRAY_SMA_DCLR().", + "Added macros RKH_EVT_CAST() and RKH_CAST().", + "Added to RKH_ST_T structure (base structure for basic, composite and submachine states) the 'trtbl' member (pointer to transition table), as new basic attribute"], + "deprecated": ["Removed RKH_TRC_MAX_EVENTS from rkhcfg.h file"], + "port": [], + "note": [] + }, + { + "version": "2.4.00", + "date": "2013-05-03", + "new": ["Added cross-platform demo 'blinky' for arm-cortex, s08 and coldfire v1", + "Added arm-cortex port", + "Added RKH_CFG_FWK_TICK_RATE_HZ and RKH_TICK_RATE_MS constants", + "Fixed RKH_FILTER_OFF_GROUP_ALL_EVENTS() and RKH_FILTER_ON_GROUP_ALL_EVENTS() macros"], + "bugfix": [], + "apichg": [], + "deprecated": ["Eliminated rkhdata.h file from demos"], + "port": [], + "note": [] + }, + { + "version": "2.3.00", + "date": "2013-02-05", + "new": ["Enhanced runtime trace filter", + "Enhanced software timer module", + "Added arbitrary trace records to be used in the application space", + "Added RKH_CFG_TRC_USER_TRACE_EN configuration option for enabling/disabling the user trace records", + "Added RKH_TR_FWK_TUSR() macro for sending to Trazer a symbolic name of the user-defined trace event", + "Moved configurations RKH_CFGPORT_SMA_THREAD_EN, RKH_CFGPORT_SMA_THREAD_DATA_EN, RKH_CFGPORT_NATIVE_SCHEDULER_EN, RKH_CFGPORT_NATIVE_EQUEUE_EN, RKH_CFGPORT_NATIVE_DYN_EVT_EN, and RKH_CFGPORT_REENTRANT_EN from rkhcfg.h to rkhport.h file to achieve the platform independence in rkhcfg.h file", + "Added macro RKH_TR_FWK_TCFG() to send the trace configuration parameters to Trazer", + "Added RKH_CFG_TRC_ASSERT_EN configuration option to rkhcfg.h file, RKH_TE_FWK_ASSERT trace record and RKH_TR_FWK_ASSERT() macro to RKH_ASSERT() macro"], + "bugfix": ["Fixed the linux port"], + "apichg": [], + "deprecated": ["Eliminated RKH_TIM_EN_RESTART from rkhcfg.h."], + "port": [], + "note": [] + }, + { + "version": "2.2.00", + "date": "2013-08-13", + "new": ["Added runtime filter of active objects to emmit or suppress all events from a specified AO, by means of RKH_FILTER_ON_SMA() and RKH_FILTER_OFF_SMA() macros. See the main.c demo file. Used to clean up the trazer output", + "Added RKH_TRC_FLUSH() macro in RKH_TRCR_RKH_OBJ() and RKH_TRCR_RKH_SIG()", + "Added CCE() macro", + "Added RKH_RESERVE() macro", + "Added dtcptrc.c and tcptrc.h files to demo projects", + "Added support to trazer program in ahsm and subm projects", + "Added RKH_TRC_OPEN, RKH_TRC_CLOSE, and RKH_TRC_FLUSH", + "Added CV() macro"], + "bugfix": ["Fixed name of the deplete queue, function rkh_queue_deplete().", + "Fixed RKH_TRC_CLOSE() macro.", + "Fixed a bug in rkhtmr.c file. Complete the RKH_SET_THOOK() macro when configuring RKH_CFG_TMR_HOOK_EN = 0.", + "Fixed a bug in RKH_SMA_BLOCK() macro.", + "Fixed a bug in rkh_queue_get() function, when invocking the rkh_sma_recall() function.", + "Fixed a bug in rkh_tmr_restart() function RKH_REQUIRE() args.", + "Fixed a bug in rkh_sma_defer() function. Also, include an internal macro RKH_INC_REF() to avoid the dependence of dynamic event in deferral mechanism.", + "Fixed a bug in rkh_add_tr_action() function."], + "apichg": ["Changed args of RKH_REQUIRE() macro in rkh_sma_register() function"], + "deprecated": ["Elimate RKH_MP_QUERY definition and change RKH_MP_GET_BLKSIZE to RKH_MP_GET_BSIZE", + "Delete the CRR() macro", + "Delete trazer.c and trazer.h files"], + "port": ["Added S08 port files.", + "Changed 80x86 port files. Relocate the event pool from rkhport.c to bsp.c file, in rkh_hook_start() hook function. Now, the usage of event pools is resposability of the application"], + "note": [] + }, + { + "version": "2.1.00", + "date": "2012-05-09", + "new": ["Added a submachine state and demo application 'subm' to illustrate the submachine usage"], + "bugfix": [], + "apichg": [], + "deprecated": [], + "port": [], + "note": [] + }, + { + "version": "2.0.00", + "date": "2012-04-13", + "new": ["Added a platform abstraction layer", + "Added queue, software timer and dynamic memory modules", + "Added a dispatching event mechanism based on active object's priority", + "Because of applied drastic changes this release is not compatible with previous releases", + ""], + "bugfix": [], + "apichg": [], + "deprecated": [], + "port": [], + "note": [] + }, + { + "version": "1.1.06", + "date": "2012-02-13", + "new": [], + "bugfix": ["Fixed bug in call rkhallege() macro", + "Fixed bug in rkhallege(), rkhrequire(), rkhensure(), and rkhinvariant() macros"], + "apichg": [], + "deprecated": [], + "port": [], + "note": [] + }, + { + "version": "1.1.05", + "date": "2012-01-02", + "new": ["Added RKH_ROM_STATIC_EVENT macro to declare and initialize a event object as one static event", + "Added a new configuration option RKH_EN_STATE_ID to reduce the state structure", + "Added RKH_DCLR_SM_GLOBAL macro to declare a state machine object as global pointer", + "Added assertions within rkh.c module", + "Added assertion events in rkhtrace.h", + "Added definition of rkh_trace_getts() in rkhtrace.h", + "Added condition \\#if RKH_CFG_FWK_DYN_EVT_EN == 1 to include rkh_put_fifo() and rkh_put_lifo() functions", + "Added checks every config. options from rkhcfg.h in rkhitl.h", + "Enhanced tested version of rkh_engine() function with TEST_GUARD option, see code", + "Tested version of rkh_engine() function with TEST_GUARD option, see code", + "Changed internal RKH_T structure definition to reduce the use of precious RAM when instantiating a state machine", + "Added if is not defined RKH_EN_DOXYGEN then RKH_EN_DOXYGEN = 0", + "Added RKH_EN_RT_INIT_HSM_OBJ preprocessor option to include rkh_init_hsm_obj() function. Frequently, this function is not used", + "Added rkh_init_hsm_obj() function to initialize a RKH_T structure in runtime", + "Changed RKH_CREATE_HSM and RKH_DCLR_HSM macros to implement a easy way for deriving state machine structures from RKH_T.", + "Added dynamic and defer event support. This facility is implemented by means of rkh_fwk_ae(), rkh_fwk_gc(), rkh_put_fifo(), rkh_put_lifo(), rkh_sma_defer() and rkh_sma_recall() and added member dynamic_ to RKH_EVT_T structure", + "Changed rkh.h file name to rkhitl.h", + "Changed rkhsm.h file name to rkh.h", + "Added rkh_enter_critical() and rkh_exit_critical() to be defined within rkhport.h file", + "Added assert feature. This facility is defined in rkhassert.h file", + "Added RKH_NUM_STATE_MACHINES directive in rkhcfg.h and rkhtrace.c files", + "Added checks to platform-dependent functions within rkhtrace.h", + "Added mksevt() macro"], + "bugfix": ["Fixed rkh_tropen, rkh_trclose, rkh_trflush and rkh_trgetts macro definitions", + "Fixed rkh_tropen, rkh_trclose, rkh_trflush and rkh_trgetts macro definitions"], + "apichg": [], + "deprecated": ["Eliminated rkhdata.h dependence from rkhtrace.c and rkh.c files"], + "port": ["Added support for Codewarrior Coldfire V1"], + "note": [] + }, + { + "version": "1.1.04", + "date": "2011-06-10", + "new": ["Changed RKH_PPRO_T type to support pointer to HSM as argument", + "Added RKH_EN_PPRO_HSM_ARG configuration", + "Added RKH_HPPTY_T enumeration to be used in RKH_CREATE_HSM() macro", + "Update demo and doc files"], + "bugfix": [], + "apichg": [], + "deprecated": [], + "port": [], + "note": [] + }, + { + "version": "1.1.03", + "date": "2011-05-19", + "new": ["Changed RKH_EVT_T data type", + "Added rkh_get_sdata() macro to rkhsm.h file", + "Added state's abstract data by means of single inheritance", + "Update demo and doc files"], + "bugfix": [], + "apichg": [], + "deprecated": [], + "port": [], + "note": [] + }, + { + "version": "1.1.02", + "date": "2011-05-05", + "new": ["Changed external transition to local transition support. Therefore, just modified rkh_define_ex_en_states() macro to support this feature according to UML 2.0", + "Modified demo directory to test local transition feature and added some improvements to main.c file"], + "bugfix": ["Fixed and update doc files"], + "apichg": [], + "deprecated": [], + "port": [], + "note": [] + }, + { + "version": "1.0.00", + "date": "2011-05-03", + "new": ["Added rkh_sm_else function to be used when if all the guards on the other branches are false", + "Changed conditional (branch) pseudostate related macros. Therefore, the demo and doc files too", + "Changed macros RKH_CREATE_*_STATE, RKH_CREATE_TRANS_TABLE and RKH_END_TRANS_TABLE", + "Changed demo files"], + "bugfix": ["Fixed VC08 project settings"], + "apichg": [], + "deprecated": [], + "port": [], + "note": [] + } +] From 4e08711f69be4f6a40225840ca65087c9e0b9207 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Sat, 13 Feb 2021 16:27:00 -0300 Subject: [PATCH 17/32] Merge develop to master is done using Python --- tools/deploy/deploy.py | 57 +++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 8ac5cde6..f88acadd 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -13,11 +13,15 @@ import json import subprocess from rkhupdoc import uploadDoc +import time GitHostURL = 'https://github.com/' CHANGELOG_PATH = 'tools/deploy/changelog.json' DOC_CHANGELOG_PATH = 'doc/chglog.txt' +class DeployError(Exception): + pass + class Release: header = "" tail = "" @@ -169,7 +173,7 @@ def updateVersion(repoPath, relVersion): print("Updated version: {}".format(relVersion)) print("Updated version date: {}".format(today)) else: - print("[ERROR] Unknown version file format") + raise DeployError("\nAbort: unknown version file format") def genChangeLog(repo, inFilePath, outFilePath): printTaskTitle("Generating change log file") @@ -202,7 +206,7 @@ def genChangeLog(repo, inFilePath, outFilePath): relfile.write(latest.tail) # Add the tail file printTaskDone() else: - print("[ERROR] Release file {} does not exist".format(jsonFile)) + raise DeployError("\nAbort: Release file {} does not exist".format(inFilePath)) return def genRelMsg(repo, inFilePath): @@ -225,11 +229,33 @@ def genRelMsg(repo, inFilePath): printTaskDone() return text else: - print("[ERROR] Release file {} does not exist".format(jsonFile)) + raise DeployError("\nAbort: Release file {} does not exist".format(inFilePath)) return def updateBranches(repo): - print("Updating default branch from develop") + printTaskTitle("Updating branch develop") + if repo.active_branch.name == 'develop': + mfiles = repo.git.diff('--name-only').split('\n') + files = ['doc/chglog.txt', 'source/fwk/inc/rkhfwk_version.h'] + if files == mfiles: + repo.index.add(mfiles) + repo.index.commit("Updated version and log of code changes") + print('Committed {} files'.format(mfiles)) + printTaskDone() + else: + raise DeployError("\nAbort: Cannot update develop branch") + else: + raise DeployError("\nAbort: Cannot update develop branch") + + printTaskTitle("Integrating develop onto master") + repo.git.checkout('master') + repo.git.merge('develop') + printTaskDone() + + printTaskTitle("Updating remote branch develop") + printTaskDone() + printTaskTitle("Updating remote branch master") + printTaskDone() def genDoc(repoPath): printTaskTitle("Generating doc (html) using doxygen") @@ -238,7 +264,7 @@ def genDoc(repoPath): stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=docPath) if proc.returncode != 0: - print("[ERROR] Doxygen fails:\n{}".format(proc.stdout)) + raise DeployError("\nAbort: Doxygen fails:\n{}".format(proc.stdout)) else: printTaskDone() @@ -253,8 +279,7 @@ def deploy(version, repository, workingDir, token, printTaskTitle("Verifying directories, files and code version") if not re.match(r'[0-9].[0-9].[0-9]{2}', version): - print("[ERROR] Invalid version code: {}".format(version)) - return + raise DeployError("\nAbort: Invalid version code: {}".format(version)) if os.path.isdir(workingDir): if not os.path.isdir(repoPath): @@ -277,18 +302,15 @@ def deploy(version, repository, workingDir, token, repo = git.Repo(repoPath) print('Repository {0:s} found in {1:s}'.format(repoName, repoPath)) if repo.is_dirty(): - print("[ERROR] Repository is dirty:") - print("{}".format(repo.git.diff('--name-only'))) - return + raise DeployError("\nAbort: Repository is dirty") if repo.active_branch.name != 'develop': - print("[ERROR] It process must only be performed on " + - "develop branch") - return + raise DeployError("\nAbort: It process must only be performed on " + + "develop branch") origin = repo.remotes['origin'] origin.pull(progress=MyProgressPrinter()) printTaskDone() -# updateVersion(repoPath, version) + updateVersion(repoPath, version) genChangeLog(repo, os.path.join(repo.working_dir, CHANGELOG_PATH), os.path.join(repo.working_dir, DOC_CHANGELOG_PATH)) relMsg = genRelMsg(repo, os.path.join(repo.working_dir, CHANGELOG_PATH)) @@ -298,12 +320,11 @@ def deploy(version, repository, workingDir, token, # 'V0rt3xM4k35!', # 'htdocs/rkh/lolo', # '~/lolo/') -# updateBranches(repo) -# updateDftBranch() + updateBranches(repo) # createPackage() # release(relMsg) else: - print("ERROR: {0:s} does not exist".format(workingDir)) + raise DeployError("\nAbort: {0:s} does not exist".format(workingDir)) return False if __name__ == "__main__": @@ -313,3 +334,5 @@ def deploy(version, repository, workingDir, token, args.token, args.b, args.d, args.p) except IOError as msg: parser.error(str(msg)) + except DeployError as e: + print(e) From df985d171684c5886c0696932667bb261bc5802d Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Sat, 13 Feb 2021 16:35:56 -0300 Subject: [PATCH 18/32] Used subprocess to merge branches --- tools/deploy/deploy.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index f88acadd..8c5daf70 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -249,7 +249,11 @@ def updateBranches(repo): printTaskTitle("Integrating develop onto master") repo.git.checkout('master') - repo.git.merge('develop') + proc = subprocess.run('git merge develop', shell=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + cwd=repo.working_dir) + if proc.returncode != 0: + raise DeployError("\nAbort: Cannot integrate develop onto master") printTaskDone() printTaskTitle("Updating remote branch develop") From 49d77084d6338d854d2e1a66c228d4b5fc0cc611 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Mon, 15 Feb 2021 09:37:22 -0300 Subject: [PATCH 19/32] Created release package --- tools/deploy/deploy.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 8c5daf70..60f77e07 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -275,6 +275,35 @@ def genDoc(repoPath): def publishDoc(server, user, passwd, dest, doc): uploadDoc(server, user, passwd, dest, doc) +def createPackage(repo, workingDir, version): + printTaskTitle("Exporting Git repository") + extractDir = 'tmp_rkh_rel' + htmlDirSrc = os.path.join(repo.working_dir, 'doc/html') + htmlDirDst = os.path.join(workingDir, extractDir + '/doc/html') + releaseOut = 'rkh_v' + version + '.tar.gz' + if os.path.isdir(htmlDirSrc): + archive = extractDir + '.tar' + repo.git.archive('--worktree-attributes', + '-o', + os.path.join(workingDir, archive), + 'develop') + print("Extracting archive") + shutil.unpack_archive(os.path.join(workingDir, archive), + os.path.join(workingDir, extractDir), 'tar') + print("Copying doc (html) into archive") + os.mkdir(htmlDirDst) + shutil.copytree(htmlDirSrc, htmlDirDst, dirs_exist_ok=True) + print("Packing release package") + os.remove(os.path.join(workingDir, archive)) + fileName = shutil.make_archive(os.path.join(workingDir, extractDir), + 'gztar', + os.path.join(workingDir, extractDir)) + os.rename(os.path.join(workingDir, fileName), + os.path.join(workingDir, releaseOut)) + else: + raise DeployError("\nAbort: doc/html directory is not found") + printTaskDone() + def deploy(version, repository, workingDir, token, branch = "master", draft = False, prerelease = False): workingDir = os.path.expanduser(workingDir) @@ -324,8 +353,8 @@ def deploy(version, repository, workingDir, token, # 'V0rt3xM4k35!', # 'htdocs/rkh/lolo', # '~/lolo/') - updateBranches(repo) -# createPackage() +# updateBranches(repo) + createPackage(repo, workingDir, version) # release(relMsg) else: raise DeployError("\nAbort: {0:s} does not exist".format(workingDir)) From bb14df44de1e9e53dec06efa54b338ab65bd2a7c Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Wed, 17 Feb 2021 00:50:58 -0300 Subject: [PATCH 20/32] Working on release version --- tools/deploy/deploy.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 60f77e07..774cee70 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -14,6 +14,7 @@ import subprocess from rkhupdoc import uploadDoc import time +from release import releasePkg GitHostURL = 'https://github.com/' CHANGELOG_PATH = 'tools/deploy/changelog.json' @@ -291,7 +292,8 @@ def createPackage(repo, workingDir, version): shutil.unpack_archive(os.path.join(workingDir, archive), os.path.join(workingDir, extractDir), 'tar') print("Copying doc (html) into archive") - os.mkdir(htmlDirDst) + if not os.path.isdir(htmlDirDst): + os.mkdir(htmlDirDst) shutil.copytree(htmlDirSrc, htmlDirDst, dirs_exist_ok=True) print("Packing release package") os.remove(os.path.join(workingDir, archive)) @@ -300,10 +302,19 @@ def createPackage(repo, workingDir, version): os.path.join(workingDir, extractDir)) os.rename(os.path.join(workingDir, fileName), os.path.join(workingDir, releaseOut)) + return os.path.join(workingDir, releaseOut) else: raise DeployError("\nAbort: doc/html directory is not found") printTaskDone() +def releasePackage(pkg, version, repository, workingDir, token, + branch, draft, prerelease, relMsg): + changelogPath = os.path.join(workingDir, 'changelog') + with open(changelogPath, "w") as clFile: + clFile.write(relMsg) + releasePkg(version, 'leanfrancucci/ci-test', pkg, changelogPath, token, + branch, draft, prerelease) + def deploy(version, repository, workingDir, token, branch = "master", draft = False, prerelease = False): workingDir = os.path.expanduser(workingDir) @@ -354,8 +365,9 @@ def deploy(version, repository, workingDir, token, # 'htdocs/rkh/lolo', # '~/lolo/') # updateBranches(repo) - createPackage(repo, workingDir, version) -# release(relMsg) + pkg = createPackage(repo, workingDir, version) + releasePackage(pkg, version, repository, workingDir, token, + branch, draft, prerelease, relMsg) else: raise DeployError("\nAbort: {0:s} does not exist".format(workingDir)) return False From 4eba7d32a887c56af0a41e7ef6b92b26e76dbda9 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Wed, 17 Feb 2021 16:41:55 -0300 Subject: [PATCH 21/32] Used release.sh from deploy.py --- tools/deploy/deploy.py | 30 +++++++-- tools/deploy/{rkh-release.sh => release.sh} | 74 ++++++++++++++++++--- 2 files changed, 86 insertions(+), 18 deletions(-) rename tools/deploy/{rkh-release.sh => release.sh} (72%) mode change 100644 => 100755 diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 774cee70..84a5cec7 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -14,7 +14,7 @@ import subprocess from rkhupdoc import uploadDoc import time -from release import releasePkg +#from release import releasePkg GitHostURL = 'https://github.com/' CHANGELOG_PATH = 'tools/deploy/changelog.json' @@ -263,7 +263,7 @@ def updateBranches(repo): printTaskDone() def genDoc(repoPath): - printTaskTitle("Generating doc (html) using doxygen") + printTaskTitle("Generating doc (html) using doxygen...") docPath = os.path.join(repoPath, 'doc') proc = subprocess.run("doxygen Doxyfile", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -295,7 +295,7 @@ def createPackage(repo, workingDir, version): if not os.path.isdir(htmlDirDst): os.mkdir(htmlDirDst) shutil.copytree(htmlDirSrc, htmlDirDst, dirs_exist_ok=True) - print("Packing release package") + print("Compression release package...") os.remove(os.path.join(workingDir, archive)) fileName = shutil.make_archive(os.path.join(workingDir, extractDir), 'gztar', @@ -312,8 +312,24 @@ def releasePackage(pkg, version, repository, workingDir, token, changelogPath = os.path.join(workingDir, 'changelog') with open(changelogPath, "w") as clFile: clFile.write(relMsg) - releasePkg(version, 'leanfrancucci/ci-test', pkg, changelogPath, token, - branch, draft, prerelease) +# releasePkg(version, 'leanfrancucci/ci-test', pkg, changelogPath, token, +# branch, draft, prerelease) + cmd = "./release.sh -v " + version +# cmd += " -r " + repository + cmd += " -r " + 'leanfrancucci/ci-test' + cmd += " -s " + pkg + cmd += " -m " + changelogPath + cmd += " -t " + token + cmd += " -b " + branch + cmd += " -d " if draft == True else '' + cmd += " -p " if prerelease == True else '' + print(cmd) + proc = subprocess.run(cmd, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + if proc.returncode != 0: + raise DeployError("\nAbort: cannot create " + + "the release {0:d}".format(proc.returncode)) + printTaskDone() def deploy(version, repository, workingDir, token, branch = "master", draft = False, prerelease = False): @@ -348,8 +364,8 @@ def deploy(version, repository, workingDir, token, if repo.is_dirty(): raise DeployError("\nAbort: Repository is dirty") if repo.active_branch.name != 'develop': - raise DeployError("\nAbort: It process must only be performed on " + - "develop branch") + raise DeployError("\nAbort: It process must only be " + + "performed on develop branch") origin = repo.remotes['origin'] origin.pull(progress=MyProgressPrinter()) printTaskDone() diff --git a/tools/deploy/rkh-release.sh b/tools/deploy/release.sh old mode 100644 new mode 100755 similarity index 72% rename from tools/deploy/rkh-release.sh rename to tools/deploy/release.sh index 3f226a58..cfba4ae9 --- a/tools/deploy/rkh-release.sh +++ b/tools/deploy/release.sh @@ -39,6 +39,37 @@ gh_curl() $@ } +# +# Get release +# +# \param repo +# \param release-id +# \usage +# repo="itdelsat/release-test-a" +# release-id="v1.0.36-beta" +# get_release $repo $release-id +# +get_release() +{ + if [[ -n $1 || -n $2 ]]; then + response=$(gh_curl -s $github/repos/$1/releases/$2) + result=$(echo $response | jq "select(.message == \"Not Found\")") + if [ -n "$result" ]; then + echo "ERROR: cannot find $2 release from $1 repository" + else + tag_name=$(echo $response | jq .tag_name) + id=$(echo $response | jq .id) + published_at=$(echo $response | jq .published_at) + draftFlag=$(echo $response | jq .draft) + prereleaseFlag=$(echo $response | jq .prerelease) + echo -n "Get release $id (id) published at $published_at" + echo "- Tag:$tag_name, Draft:$draftFlag, Prerelease:$prereleaseFlag" + fi + else + echo "ERROR: get_release() - missing or wrong arguments" + fi +} + # # Get latest release # @@ -51,9 +82,11 @@ get_latest() { if [ -n $1 ]; then response=$(gh_curl -s $github/repos/$1/releases/latest) + echo "$response" | jq '.' result=$(echo $response | jq "select(.message == \"Not Found\")") if [ -n "$result" ]; then echo "ERROR: cannot find latest release from $1 repository" + exit 1 else tag_name=$(echo $response | jq .tag_name) published_at=$(echo $response | jq .published_at) @@ -61,6 +94,7 @@ get_latest() fi else echo "ERROR: get_latest() - missing or wrong arguments" + exit 2 fi } @@ -78,21 +112,28 @@ upload_file() { if [[ -n $1 && -n $2 ]]; then echo "Uploading file $2 to $1..." - get_latest $1 + if [[ "$draft" == "false" && "$prerelease" == "false" ]]; then + get_latest $1 + else + get_release $1 $release_id + fi upload_url="$(echo "$response" | jq -r .upload_url | sed -e "s/{?name,label}//")" response=$(curl --silent -H "Authorization: token $token" \ --header "Content-Type:application/gzip" \ - --data-binary "$2" \ - "$upload_url?name="$2"") + --data-binary @$2 \ + $upload_url?name=$2) result=$(echo $response | jq "select(.message == \"Validation Failed\")") + echo "$response" | jq '.' if [ -n "$result" ]; then result=$(echo $response | jq ".errors | .[0].code") echo "ERROR: cannot upload file $2 to $tag_name release. Code from server: $result" + exit 3 else echo "Upload file $2 to $tag_name release" fi else echo "ERROR: upload_file() - missing or wrong arguments" + exit 4 fi } @@ -106,11 +147,11 @@ upload_file() # repo="itdelsat/release-test-a" # version="1.0.16" # message="Release X" -# create_release $repo $version "$message" +# create_release $repo $version "$message" $branch # create_release() { - if [[ -n $1 && -n $2 && -n $3 ]]; then + if [[ -n $1 && -n $2 && -n $3 && -n $4 ]]; then echo "Creating release $2 of $1..." payload=$( jq --null-input \ @@ -118,26 +159,32 @@ create_release() --arg body "$3" \ --argjson prerelease $pre \ --argjson draft $draft \ - '{tag_name: $tag, target_commitish: "master", name: $tag, body: $body, draft: $draft, prerelease: $prerelease}' + --arg target "$4" \ + '{tag_name: $tag, target_commitish: $target, name: $tag, body: $body, draft: $draft, prerelease: $prerelease}' ) response=$( curl \ --silent \ + -H "Authorization: token $token" \ --location \ --data "$payload" \ - "$github/repos/$1/releases?access_token=$token" + "$github/repos/$1/releases" ) + echo "$response" | jq '.' result=$(echo $response | jq "select(.message == \"Validation Failed\")") if [ -n "$result" ]; then result=$(echo $response | jq ".errors | .[0].code") echo "ERROR: cannot create the release $2. Code from server: $result" + exit 5 else upload_url="$(echo "$response" | jq -r .upload_url | sed -e "s/{?name,label}//")" + release_id="$(echo "$response" | jq -r .id)" echo "Release v$2 published in $1 repository" fi else echo "ERROR: create_release() - missing or wrong arguments" + exit 6 fi } @@ -157,6 +204,7 @@ get_tarball() curl -H "Authorization: token $token" -L $github/repos/$1/tarball/$branch > $tarball else echo "ERROR: get_tarball() - missing or wrong arguments" + exit 7 fi } @@ -167,7 +215,7 @@ check_args() { if [[ -z $version || -z $token ]]; then usage - exit 1 + exit 8 fi if [[ ! -z $changelog && -e $changelog ]]; then @@ -194,10 +242,10 @@ done check_args if [ -z $repository ]; then echo "ERROR: unavailable repository info (\"owner/name\")" - exit 1 + exit 9 fi -create_release $repository $version "$message" +create_release $repository $version "$message" $branch if [ -z $dir ]; then get_tarball $repository upload_file $repository $tarball @@ -207,7 +255,11 @@ elif [ -d $dir ]; then upload_file $repository $(basename $dir).tar.gz elif [ -e $dir ]; then ext="${dir##*.}" - if [ "$ext" == "tar.gz" ]; then + if [ "$ext" == "gz" ]; then + dir_path=$(dirname $dir) + if [[ -n $dir_path && "$dir_path" != "." ]]; then + cp $dir . + fi upload_file $repository $(basename $dir) fi fi From 0c7ea2dc0bf2e84453d6053a5fee3ce85ba0147b Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Wed, 17 Feb 2021 21:09:28 -0300 Subject: [PATCH 22/32] Fixed Bash release --- tools/deploy/release.sh | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tools/deploy/release.sh b/tools/deploy/release.sh index cfba4ae9..8e4f4f0c 100755 --- a/tools/deploy/release.sh +++ b/tools/deploy/release.sh @@ -82,7 +82,6 @@ get_latest() { if [ -n $1 ]; then response=$(gh_curl -s $github/repos/$1/releases/latest) - echo "$response" | jq '.' result=$(echo $response | jq "select(.message == \"Not Found\")") if [ -n "$result" ]; then echo "ERROR: cannot find latest release from $1 repository" @@ -123,7 +122,6 @@ upload_file() --data-binary @$2 \ $upload_url?name=$2) result=$(echo $response | jq "select(.message == \"Validation Failed\")") - echo "$response" | jq '.' if [ -n "$result" ]; then result=$(echo $response | jq ".errors | .[0].code") echo "ERROR: cannot upload file $2 to $tag_name release. Code from server: $result" @@ -171,7 +169,6 @@ create_release() "$github/repos/$1/releases" ) - echo "$response" | jq '.' result=$(echo $response | jq "select(.message == \"Validation Failed\")") if [ -n "$result" ]; then result=$(echo $response | jq ".errors | .[0].code") @@ -250,17 +247,36 @@ if [ -z $dir ]; then get_tarball $repository upload_file $repository $tarball elif [ -d $dir ]; then - echo "Compressing $dir..." - tar -czf $(basename $dir).tar.gz $dir - upload_file $repository $(basename $dir).tar.gz + dir_path=$(dirname $dir) + dir_name=$(basename $dir) + file=$dir_name.tar.gz + if [ "$dir_path" != "." ]; then + if [ -d $PWD/$dir_name ]; then + echo "Delete old $dir_name in $PWD" + rm -r ./$dir_name + fi + echo "Copy $dir to $PWD" + cp -r $dir . + fi + echo "Compressing $dir_name..." + tar -czf $file $dir_name + upload_file $repository $file + if [ "$dir_path" != "." ]; then + if [ -d $PWD/$dir_name ]; then + echo "Delete $dir_name in $PWD" + rm -r ./$dir_name + fi + mv $file $dir_path + fi elif [ -e $dir ]; then ext="${dir##*.}" if [ "$ext" == "gz" ]; then dir_path=$(dirname $dir) + file=$(basename $dir) if [[ -n $dir_path && "$dir_path" != "." ]]; then cp $dir . fi - upload_file $repository $(basename $dir) + upload_file $repository $file fi fi exit 0 From 5781b5da998f130f604b75d24e15d82ccc39dd68 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Thu, 18 Feb 2021 08:39:38 -0300 Subject: [PATCH 23/32] Added ftp parameters to store reference manual --- tools/deploy/deploy.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 84a5cec7..55e5412c 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -272,6 +272,7 @@ def genDoc(repoPath): raise DeployError("\nAbort: Doxygen fails:\n{}".format(proc.stdout)) else: printTaskDone() + return os.path.join(docPath, 'html') def publishDoc(server, user, passwd, dest, doc): uploadDoc(server, user, passwd, dest, doc) @@ -281,7 +282,8 @@ def createPackage(repo, workingDir, version): extractDir = 'tmp_rkh_rel' htmlDirSrc = os.path.join(repo.working_dir, 'doc/html') htmlDirDst = os.path.join(workingDir, extractDir + '/doc/html') - releaseOut = 'rkh_v' + version + '.tar.gz' + releaseOutDir = 'rkh_v' + version + releaseOut = releaseOutDir + '.tar.gz' if os.path.isdir(htmlDirSrc): archive = extractDir + '.tar' repo.git.archive('--worktree-attributes', @@ -297,9 +299,11 @@ def createPackage(repo, workingDir, version): shutil.copytree(htmlDirSrc, htmlDirDst, dirs_exist_ok=True) print("Compression release package...") os.remove(os.path.join(workingDir, archive)) - fileName = shutil.make_archive(os.path.join(workingDir, extractDir), + os.rename(os.path.join(workingDir, extractDir), + os.path.join(workingDir, releaseOutDir)) + fileName = shutil.make_archive(os.path.join(workingDir, releaseOutDir), 'gztar', - os.path.join(workingDir, extractDir)) + os.path.join(workingDir, releaseOutDir)) os.rename(os.path.join(workingDir, fileName), os.path.join(workingDir, releaseOut)) return os.path.join(workingDir, releaseOut) @@ -315,8 +319,7 @@ def releasePackage(pkg, version, repository, workingDir, token, # releasePkg(version, 'leanfrancucci/ci-test', pkg, changelogPath, token, # branch, draft, prerelease) cmd = "./release.sh -v " + version -# cmd += " -r " + repository - cmd += " -r " + 'leanfrancucci/ci-test' + cmd += " -r " + repository cmd += " -s " + pkg cmd += " -m " + changelogPath cmd += " -t " + token @@ -327,8 +330,7 @@ def releasePackage(pkg, version, repository, workingDir, token, proc = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if proc.returncode != 0: - raise DeployError("\nAbort: cannot create " + - "the release {0:d}".format(proc.returncode)) + raise DeployError("\nAbort: {}".format(proc.stdout)) printTaskDone() def deploy(version, repository, workingDir, token, @@ -374,13 +376,13 @@ def deploy(version, repository, workingDir, token, genChangeLog(repo, os.path.join(repo.working_dir, CHANGELOG_PATH), os.path.join(repo.working_dir, DOC_CHANGELOG_PATH)) relMsg = genRelMsg(repo, os.path.join(repo.working_dir, CHANGELOG_PATH)) -# genDoc(repoPath) -# publishDoc('ftp.vortexmakes.com', -# 'webmaster.vortexmakes.com', -# 'V0rt3xM4k35!', -# 'htdocs/rkh/lolo', -# '~/lolo/') -# updateBranches(repo) + docPath = genDoc(repoPath) + publishDoc('ftp.vortexmakes.com', + 'webmaster.vortexmakes.com', + 'V0rt3xM4k35!', + 'htdocs/rkh', + docPath) + updateBranches(repo) pkg = createPackage(repo, workingDir, version) releasePackage(pkg, version, repository, workingDir, token, branch, draft, prerelease, relMsg) From 7680c283f554a03b135b719a7781ff67ef215fbe Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Thu, 18 Feb 2021 14:34:48 -0300 Subject: [PATCH 24/32] Fixed several bugs --- tools/deploy/README.md | 36 ++++++++++++++++++----- tools/deploy/deploy.py | 67 +++++++++++++++++++++++++++--------------- 2 files changed, 72 insertions(+), 31 deletions(-) diff --git a/tools/deploy/README.md b/tools/deploy/README.md index a1730bd5..700867b9 100644 --- a/tools/deploy/README.md +++ b/tools/deploy/README.md @@ -1,9 +1,29 @@ -# How to release -```bash -cd path/to/ -vim changelog # Copy the latest changes from -cd path/to//tools/deploy -./rkh-deploy.sh clean path/to/ -./rkh-deploy.sh deploy 3.2.3 ../../../rkh-git/ path/to/ # Use an absolut path -./rkh-release.sh -v 3.2.3 -r vortexmakes/RKH -s path/to//rkh_v3.2.3.tar.gz -m path/to//changelog -t +# How to deploy and release + +## Create a release directory +```bash +mkdir path/to/ +``` + +## Clone RKH framework +```bash +cd path/to/ +git clone https://github.com/vortexmakes/RKH.git +``` + +## Add code changes into changelog file +```bash +cd path/to//RKH # RKH clone +vim tools/deploy/changelog.json # Add a new release section and complete + # it with your changes. Do not forget to + # add the release version and the release + # date +``` + +## Execute release process +```bash +cd path/to//RKH # RKH clone +cd tools/deploy +./deploy.py -c vortexmakes/RKH +./deploy.py vortexmakes/RKH ``` diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 55e5412c..594145ef 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -135,6 +135,8 @@ def update(self, op_code, cur_count, max_count=None, message=''): help='creates a draft (unpublished) release') parser.add_argument('-p', action="store_true", default=False, help='identifies the release as a prerelease') +parser.add_argument('-c', action="store_true", default=False, + help='clean release (working) directory') def printTitle(title): print("\n{}".format(title)) @@ -159,14 +161,12 @@ def updateVersion(repoPath, relVersion): matchVersion = re.search(r"^#define\sRKH_VERSION_CODE\s+0x(?P[0-9]{4})", line) matchDate = re.search(r"^\s\*\s+\\releasedate\s+(?P[0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4})", line) if matchVersion: - if matchVersion.group('code') != relVersionNum: - print(line.replace(matchVersion.group('code'), - relVersionNum), end = '') - isFoundVersionPattern = True + print(line.replace(matchVersion.group('code'), + relVersionNum), end = '') + isFoundVersionPattern = True elif matchDate: - if matchDate.group('date') != today: - print(line.replace(matchDate.group('date'), today), end = '') - isFoundDatePattern = True + print(line.replace(matchDate.group('date'), today), end = '') + isFoundDatePattern = True else: print(line, end = '') @@ -184,7 +184,7 @@ def genChangeLog(repo, inFilePath, outFilePath): jsonFile.close() with open(outFilePath, "w+") as relfile: - latest = RelMsg(releases[0]) + latest = RelLog(releases[0]) relfile.write(latest.header) # Add the header file for release in releases: @@ -235,6 +235,7 @@ def genRelMsg(repo, inFilePath): def updateBranches(repo): printTaskTitle("Updating branch develop") + origin = repo.remotes['origin'] if repo.active_branch.name == 'develop': mfiles = repo.git.diff('--name-only').split('\n') files = ['doc/chglog.txt', 'source/fwk/inc/rkhfwk_version.h'] @@ -242,6 +243,7 @@ def updateBranches(repo): repo.index.add(mfiles) repo.index.commit("Updated version and log of code changes") print('Committed {} files'.format(mfiles)) + origin.push(progress=MyProgressPrinter()) printTaskDone() else: raise DeployError("\nAbort: Cannot update develop branch") @@ -255,11 +257,7 @@ def updateBranches(repo): cwd=repo.working_dir) if proc.returncode != 0: raise DeployError("\nAbort: Cannot integrate develop onto master") - printTaskDone() - - printTaskTitle("Updating remote branch develop") - printTaskDone() - printTaskTitle("Updating remote branch master") + origin.push(progress=MyProgressPrinter()) printTaskDone() def genDoc(repoPath): @@ -290,10 +288,10 @@ def createPackage(repo, workingDir, version): '-o', os.path.join(workingDir, archive), 'develop') - print("Extracting archive") + print("Extracting exported repository") shutil.unpack_archive(os.path.join(workingDir, archive), os.path.join(workingDir, extractDir), 'tar') - print("Copying doc (html) into archive") + print("Copying doc (html)") if not os.path.isdir(htmlDirDst): os.mkdir(htmlDirDst) shutil.copytree(htmlDirSrc, htmlDirDst, dirs_exist_ok=True) @@ -313,6 +311,7 @@ def createPackage(repo, workingDir, version): def releasePackage(pkg, version, repository, workingDir, token, branch, draft, prerelease, relMsg): + printTaskTitle("Releasing version...") changelogPath = os.path.join(workingDir, 'changelog') with open(changelogPath, "w") as clFile: clFile.write(relMsg) @@ -326,7 +325,6 @@ def releasePackage(pkg, version, repository, workingDir, token, cmd += " -b " + branch cmd += " -d " if draft == True else '' cmd += " -p " if prerelease == True else '' - print(cmd) proc = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) if proc.returncode != 0: @@ -377,11 +375,11 @@ def deploy(version, repository, workingDir, token, os.path.join(repo.working_dir, DOC_CHANGELOG_PATH)) relMsg = genRelMsg(repo, os.path.join(repo.working_dir, CHANGELOG_PATH)) docPath = genDoc(repoPath) - publishDoc('ftp.vortexmakes.com', - 'webmaster.vortexmakes.com', - 'V0rt3xM4k35!', - 'htdocs/rkh', - docPath) +# publishDoc('ftp.vortexmakes.com', +# 'webmaster.vortexmakes.com', +# 'V0rt3xM4k35!', +# 'htdocs/rkh', +# docPath) updateBranches(repo) pkg = createPackage(repo, workingDir, version) releasePackage(pkg, version, repository, workingDir, token, @@ -390,11 +388,34 @@ def deploy(version, repository, workingDir, token, raise DeployError("\nAbort: {0:s} does not exist".format(workingDir)) return False +def clean(workingDir, repository): + printTaskTitle("Clean release directory") + workingDir = os.path.expanduser(workingDir) + repoName = repository.split('/')[-1] + repoPath = os.path.join(workingDir, repoName) + + with os.scandir(workingDir) as it: + for entry in it: + if not entry.name.startswith('.'): + if entry.is_dir(): + if entry.name == 'RKH' or \ + re.search(r'rkh_v[0-9]{1}\.[0-9]{1}\.[0-9]{1,2}', + entry.name): + shutil.rmtree(os.path.join(workingDir, entry.name)) + print('Deleted directory {}'.format(entry.name)) + elif entry.is_file(): + if re.search(r'rkh_v[0-9]{1}\.[0-9]{1}\.[0-9]{1,2}\.tar\.gz', entry.name) or entry.name == 'changelog': + os.remove(os.path.join(workingDir, entry.name)) + print('Deleted file {}'.format(entry.name)) + if __name__ == "__main__": try: args = parser.parse_args(sys.argv[1:]) - deploy(args.version, args.repository, args.working, - args.token, args.b, args.d, args.p) + if args.c == True: + clean(args.working, args.repository) + else: + deploy(args.version, args.repository, args.working, + args.token, args.b, args.d, args.p) except IOError as msg: parser.error(str(msg)) except DeployError as e: From 64101ad57cef0fcb025708820b2bf23ad55bbab7 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Thu, 18 Feb 2021 15:17:55 -0300 Subject: [PATCH 25/32] Enhanced reference manual and added release notes to README.md --- README.md | 13 +--- doc/rkh.txt | 188 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 150 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 594c738e..2a9e2e14 100644 --- a/README.md +++ b/README.md @@ -172,14 +172,5 @@ published under the GNU GPLv3 license (closed source code), please, contact us. ## RKH Release notes -Changes between [V3.2.0](https://github.com/vortexmakes/RKH/releases/tag/v3.2.0) and V3.2.3 released 08/28/2019 - -- Added support for null transitions on init a state machine -- Added bsp for blinky project on Linux platform -- Added TimeEvt type for declaring time events -- Added support for final state in state machine's region -- Enhanced quick reference and doc related to timers -- Fixed tick rate for Linux bsp -- Fixed stop method of timer module -- Fixed a race condition in Linux port -- Added period to timer start method and a return flag to stop method +Available releases [here](https://github.com/vortexmakes/RKH/releases). It contains +package software, along with release notes. diff --git a/doc/rkh.txt b/doc/rkh.txt index 4f58cfee..c8195f20 100644 --- a/doc/rkh.txt +++ b/doc/rkh.txt @@ -56,24 +56,81 @@ David Harel - \ref Download - \ref changelog - \ref deprecated -- \ref Others -- \ref Resources +- \ref Examples - \ref Licensing - \ref contact +- \ref Community +- \ref Resources +- \ref Others - \ref ack
\section Overview Overview -RKH is a generic, flexible, modular, highly portable, ANSI-C compliant, -and open-source development tool for implementing hierarchical -state machines based on modern state machine concepts. This modern -techniques are used to give an abstract description of the dynamic -behavior of a system in a substantial manner. RKH is built based on -platform-independent modules which is shown in the following figure. +RKH (Reactive frameworK for Hierarchical state machines) is a framework used +to build software for reactive and real-time embedded systems in a safely and +timely way. It is composed of modules, procedures and supporting tools; such as +a method for implementing and executing flat and Statechart state machines, +asynchronous and synchronous messaging, cross-platform abstraction, runtime +tracing, time management, dynamic memory mechanism to deal with fragmentation, +unit test harness, among others. These elements make up the needed +infrastructure to build apps in embedded systems. \image html rkh_framework_2.png +Frequently, real-time embedded system’s development is slow, error-prone, and +hard. Thanks to the use of RKH, this has been greatly improved. RKH enables +higher quality and functionality, and decreases the development time. Since +common software infrastructure do not have to be reimplemented, there is no +need to reinvent the wheel over and over again. + +Moreover, by using RKH, developers can build softwares in a user-friendly, +well-defined, formal and structured environment. This is achieved because +RKH's infrastructure enables them to code using event-driven programming +paradigm. + +Due to its event-driven nature, a state machine is usually employed to +represent the dynamic behaviour of a reactive application. That is why RKH +provides a powerful and efficient module for building and executing state +machines. It almost entirely supports UML state machines semantics, which are +based on David Harel’s statechart formalism. + +RKH also provides the complete infrastructure for the execution of state +machines which supports both synchronous and asynchronous event triggers. In +the case of the asynchronous event triggers, the state machine is executed +according to the Active Object execution model which is the UML concurrency +unit. In RKH framework, an Active Object can be made up by one or more state +machines. + +RKH not only enables to develop a reactive application from the ground up, but +also to reinforce the reactive part of an existing functional application. + +RKH includes a platform abstraction layer (PAL) which allows the framework to +be portable. By allowing the PAL to be replaced, the framework can be easily +ported to different target platforms. The PAL contains the abstraction of +operating system, compiler, IDE and hardware components. + +RKH allows developers to verify and validate the reactive application’s +behaviour at runtime by means of its built-in tracer, which is a flexible, +configurable and cross-platform software module. In addition, RKH provides a +very simple but powerful console application to visualize the trace events’ +output in a legible manner. +Since RKH has been carefully developed from the ground up by using best +principles and practices of software engineering, such as OOD +(Object-Oriented Design), software modeling, design patterns, TDD +(Test-Driven Development), continuous integration, among others; it is +considered a safe, flexible, maintainable, and reusable software. + +In conclusion, RKH is a framework that provides the infrastructure for the +quick and safe development of reactive applications for real-time embedded +systems. It supplies an efficient method for both implementing and executing +Statecharts. +It also encourages the embedded software community to apply best principles +and practices of software engineering for building flexible, maintainable and +reusable software. +And finally, RKH improves embedded softwares by increasing their quality and +functionality and decreased their development time. + The key features of the RKH framework: - State machines representation is based on state tables. @@ -131,14 +188,90 @@ easily adapted to 16 or 32-bits platforms.
\section Download Download -RKH download: http://sourceforge.net/projects/rkh-reactivesys/ +RKH download: https://github.com/vortexmakes/RKH/releases
-\section Others Other implementations +\section Examples Examples + +Repo [rkh-examples](https://github.com/vortexmakes/rkh-examples) contains a +collection of open source examples based on RKH framework to develop embedded +software for several platforms. In this context, it refers to combination of +CPU architecture, compiler or IDE, and operating system. Also, rkh-examples +includes some demostrative and cross-platform applications running under +Windows and Linux to improve and fast development cycle. + +### Other embedded applications based on RKH framework +- [Spora](https://sporaio.com/): open source project to build wearables. +- [DIMBA](https://github.com/vortexmakes/dimba): IoT application, using MQTT +protocol over GSM network. +- [YipiesAgro](https://github.com/vortexmakes/AgroIoT): IoT application, for +precision agriculture. -Open-source frameworks that support Statecharts. +
+\section Community How to collaborate on RKH? + +Would you like to collaborate with RKH? Great, go ahead!. First of all, you +must get the project from its official repository: +> $ git clone --recurse-submodules https://github.com/vortexmakes/RKH + +Then, you are ready to share your bug fixes and improvements with other users. +Your contributions may enhance your professional training and increase your +skills about embedded software development, specially in responsive systems. +As a means of keeping a code quality, we strongly recommend you to use the +‘pull request’ mechanism to include your contributions. Once a pull request is +opened, you will be able to discuss and review the potential changes with +collaborators and add follow-up commits before your changes are merged into +the base branch. You can also use the test harness that RKH provides. +If you are interested in collaborating with the project but you have not made +any specific contribution yet, there is a list of desirable features available. In this way, you will be able to be part of the framework. By using a feature +from the list, you can both develop and include it to the project. That is why, our goal is that you can easily join the RKH’s developer community. -- Quantum Leap - http://www.state-machine.com/ +
+\section Licensing Licensing + +Copyright (C) 2010 Leandro Francucci. All rights reserved. + +RKH is distributed under the terms of the GNU General Public License +v3.0 with the following clarification and special exception. + +> Linking this framework statically or dynamically with other modules is +> making a combined work based on this framework. Thus, the terms and +> conditions of the GNU General Public License cover the whole combination. +> +> As a special exception, the copyright holders of this framework give you +> permission to link this framework with independent modules to produce an +> executable, regardless of the license terms of these independent modules, and +> to copy and distribute the resulting executable under terms of your choice, +> provided that you also meet, for each linked independent module, the terms +> and conditions of the license of that module. An independent module is a +> module which is not derived from or based on this framework. If you modify +> this framework, you may extend this exception to your version of the +> framework, but you are not obligated to do so. If you do not wish to do so, +> delete this exception statement from your version. + +### Licensing scheme +- GPLv3 + linking exception license, which will allow a customer to link +proprietary source code. Observe that, the GPLv3 can be used for research & +development and educational purposes (academic purposes). +- Commercial license, when the source code of your application should not be +published under the GNU GPLv3 license (closed source code), please, contact us. See \ref contact section. + +### Why does RKH use the GPL? +RKH is licensed under terms of GPL, since its main goal is to grant everyone +the freedom to copy, redistribute, understand, and modify a program. A crucial +aspect of free software is that users are free to cooperate. It is absolutely +essential to permit users, who wish to help each other, to share their bug +fixes and improvements with other users. For this reason, RKH’s goal is to be +a free software; as FSF says, ‘Free software is a matter of liberty, not of +price’. + +
+\section contact Contact information + +RKH site: http://vortexmakes.com/que-es/ +RKH GitHub: https://github.com/vortexmakes/RKH +RKH Sourceforge: https://sourceforge.net/projects/rkh-reactivesys/ +\n e-mail: lf@vortexmakes.com
\section Resources Resources @@ -152,36 +285,11 @@ Open-source frameworks that support Statecharts. - D. Harel and H. Kugler - "The Rhapsody Semantics of Statecharts", Lecture Notes in Computer Science, Vol. 3147, Springer-Verlag, 2004, pp. 325-354
-\section Licensing Licensing - -Copyright (C) 2010 Leandro Francucci. All rights reserved. - -RKH is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -RKH is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with RKH package. If not, see . - -(*) Observe that, the GPLv3 can be used for research & development and -educational purposes (academic purposes). \n -(**) When the source code of your application should not be published -under the GNU GPLv3 license (closed source code), please, contact contact me. -See \ref contact section. +\section Others Other implementations -
-\section contact Contact information +Open-source frameworks that support Statecharts. -RKH site: http://vortexmakes.com/que-es/ -RKH GitHub: https://github.com/vortexmakes/RKH -RKH Sourceforge: https://sourceforge.net/projects/rkh-reactivesys/ -\n e-mail: lf@vortexmakes.com +- Quantum Leap - http://www.state-machine.com/
\section ack Acknowlegments From c14a4c47352daedb632bfd4b32f107bd539b5373 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 19 Feb 2021 01:34:36 -0300 Subject: [PATCH 26/32] Added release changes of 3.3.00 version to changelog.json file --- tools/deploy/changelog.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/deploy/changelog.json b/tools/deploy/changelog.json index c52be4c0..b49e61e3 100644 --- a/tools/deploy/changelog.json +++ b/tools/deploy/changelog.json @@ -1,4 +1,32 @@ [ + { + "version": "3.3.00", + "date": "2019-19-02", + "new": ["Enhanced reference manual and added release notes to README.md", + "Added a Python script to automate the deploy and release process. Most of them are written in Python in order to achieve more flexible and maintainable scripts than those written in Bash. The project changes must be added to the file changelog.json according to its format from now on", + "Allowed applications to run when trace output was configured as file. It modified the libbsp for Linux platform", + "Added code owners file", + "Enhanced periodic timer operations", + "Added several CI workflows to execute static code analyzers, to run Ceedling unit test, to check code compliance and to test build and execution of a demo for Linux platform. These workflows were configurated to run on Pull Request and Push events. The CI platform Travis was replaced with GitHub actions", + "Added gitlint configuration file", + "Added STM32 port critical section priority flexible configuration", + "Added RKH_CFG_FWK_AWARE_ISR_PRIO configuration option", + "Added function rkh_trc_getWholeBlock() to get whole block from trace stream", + "Supported reinit and restart a already started timer", + "Added new options of Uncrustify", + "Sent memory pool symbols as traces", + "Deleted reinitialized timer from the timer list", + "Ported cross demo Blinky to Eclipse for Linux single thread", + "Ported cross demo Shared to Eclipse for Linux single thread"], + "bugfix": ["Fixed some doxygen groups in rkhdef.h file", + "Fixed makefile of cross demo Blinky for Linux platform", + "Fixed macros RKH_TR_FWK_EXE_FUN and RKH_TR_FWK_SYNC_EVT for recording sync event traces", + "Fixed macro RKH_TR_FWK_EPOOL for recording evtPool trace"], + "apichg": [""], + "deprecated": [], + "port": [], + "note": [] + }, { "version": "3.2.03", "date": "2019-28-08", From a81edcc3f9925c2b50232303d6768023feb4360b Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 19 Feb 2021 01:47:04 -0300 Subject: [PATCH 27/32] Added the older code change to the next release into changelog.json --- tools/deploy/changelog.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/deploy/changelog.json b/tools/deploy/changelog.json index b49e61e3..84d23588 100644 --- a/tools/deploy/changelog.json +++ b/tools/deploy/changelog.json @@ -21,7 +21,8 @@ "bugfix": ["Fixed some doxygen groups in rkhdef.h file", "Fixed makefile of cross demo Blinky for Linux platform", "Fixed macros RKH_TR_FWK_EXE_FUN and RKH_TR_FWK_SYNC_EVT for recording sync event traces", - "Fixed macro RKH_TR_FWK_EPOOL for recording evtPool trace"], + "Fixed macro RKH_TR_FWK_EPOOL for recording evtPool trace", + "Function isCompletionTrn() affected by RKH_CFG_SMA_HCAL_EN when it was enabled"], "apichg": [""], "deprecated": [], "port": [], From 51c01dc824d6402079fb1f86ef377edcab384d36 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 19 Feb 2021 12:55:30 -0300 Subject: [PATCH 28/32] Fixed release date of 3.3.00 --- tools/deploy/changelog.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/deploy/changelog.json b/tools/deploy/changelog.json index 84d23588..bbf604f4 100644 --- a/tools/deploy/changelog.json +++ b/tools/deploy/changelog.json @@ -1,7 +1,7 @@ [ { "version": "3.3.00", - "date": "2019-19-02", + "date": "2021-19-02", "new": ["Enhanced reference manual and added release notes to README.md", "Added a Python script to automate the deploy and release process. Most of them are written in Python in order to achieve more flexible and maintainable scripts than those written in Bash. The project changes must be added to the file changelog.json according to its format from now on", "Allowed applications to run when trace output was configured as file. It modified the libbsp for Linux platform", From e0dd3b0553a4072b996d63f46a874649e13e9f4e Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 19 Feb 2021 12:55:54 -0300 Subject: [PATCH 29/32] Prepared for merging it to develop --- tools/deploy/deploy.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 594145ef..2c39e5da 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -177,7 +177,7 @@ def updateVersion(repoPath, relVersion): raise DeployError("\nAbort: unknown version file format") def genChangeLog(repo, inFilePath, outFilePath): - printTaskTitle("Generating change log file") + printTaskTitle("Generating change log file {}".format(outFilePath)) if os.path.exists(inFilePath): jsonFile = open(inFilePath, 'r') releases = json.load(jsonFile) @@ -211,7 +211,7 @@ def genChangeLog(repo, inFilePath, outFilePath): return def genRelMsg(repo, inFilePath): - printTaskTitle("Generating release message") + printTaskTitle("Generating release notes") if os.path.exists(inFilePath): jsonFile = open(inFilePath, 'r') releases = json.load(jsonFile) @@ -261,7 +261,7 @@ def updateBranches(repo): printTaskDone() def genDoc(repoPath): - printTaskTitle("Generating doc (html) using doxygen...") + printTaskTitle("Generating doc (html) using doxygen") docPath = os.path.join(repoPath, 'doc') proc = subprocess.run("doxygen Doxyfile", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -375,11 +375,11 @@ def deploy(version, repository, workingDir, token, os.path.join(repo.working_dir, DOC_CHANGELOG_PATH)) relMsg = genRelMsg(repo, os.path.join(repo.working_dir, CHANGELOG_PATH)) docPath = genDoc(repoPath) -# publishDoc('ftp.vortexmakes.com', -# 'webmaster.vortexmakes.com', -# 'V0rt3xM4k35!', -# 'htdocs/rkh', -# docPath) + publishDoc('ftp.vortexmakes.com', + 'webmaster.vortexmakes.com', + 'V0rt3xM4k35!', + 'htdocs/rkh', + docPath) updateBranches(repo) pkg = createPackage(repo, workingDir, version) releasePackage(pkg, version, repository, workingDir, token, From 01a6fade6efe51724fde8c7e4523f5e44342a268 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 19 Feb 2021 13:08:09 -0300 Subject: [PATCH 30/32] Enhanced versioning in rkhfwk_version.h --- source/fwk/inc/rkhfwk_version.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/source/fwk/inc/rkhfwk_version.h b/source/fwk/inc/rkhfwk_version.h index a9bc4856..833a6545 100644 --- a/source/fwk/inc/rkhfwk_version.h +++ b/source/fwk/inc/rkhfwk_version.h @@ -38,13 +38,6 @@ */ /* -------------------------- Development history -------------------------- */ -/* - * 2017.21.04 LeFr v2.4.05 Initial version - * 2018.03.05 LeFr v3.1.00 ... - * 2019.08.01 LeFr v3.2.00 - * 2019.28.08 LeFr v3.2.03 - */ - /* -------------------------------- Authors -------------------------------- */ /* * LeFr Leandro Francucci lf@vortexmakes.com @@ -70,9 +63,18 @@ extern "C" { * This macro expands to the binary representation of the RKH version. * * The version number is composed as 0xABCC, where: - * the number A (1-digit) denoted the major revision, the number B (1-digit) - * denoted the minor revision, and the number C (2-digit) indicated the - * release number. For example, the code for 2.2.04 is 0x2204. + * the number A (1-digit) denoted the MAJOR version, the number B (1-digit) + * denoted the MINOR version, and the number C (2-digit) indicated the + * PATCH version. For example, the code number for version 2.2.04 is 0x2204. + * + * Giving a version number MAJOR.MINOR.PATCH, increment the: + * + * MAJOR version when you make incompatible API changes, + * MINOR version when you add functionality in a backwards-compatible manner, and + * PATCH version when you make backwards-compatible bug fixes. + * + * \note + * For more additional information please read https://semver.org/. * * \releasedate 08/28/2019 */ From e6ed03fc4594babb24313c4bb5bc8bbd1c4320b6 Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Fri, 19 Feb 2021 16:11:22 -0300 Subject: [PATCH 31/32] Before executing doxygen verified its correct installation --- tools/deploy/deploy.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/deploy/deploy.py b/tools/deploy/deploy.py index 2c39e5da..b04b71a6 100755 --- a/tools/deploy/deploy.py +++ b/tools/deploy/deploy.py @@ -263,7 +263,14 @@ def updateBranches(repo): def genDoc(repoPath): printTaskTitle("Generating doc (html) using doxygen") docPath = os.path.join(repoPath, 'doc') - proc = subprocess.run("doxygen Doxyfile", shell=True, + if os.path.exists('/usr/bin/doxygen'): # Verify doxygen installation + cmd = '/usr/bin/doxygen' + elif os.path.exists('/usr/local/bin/doxygen'): + cmd = '/usr/local/bin/doxygen' + else: + raise DeployError("\nAbort: Doxygen does not installed") + cmd += " Doxyfile" + proc = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=docPath) if proc.returncode != 0: From fefd788df12692c1ac8e4dd8d4b5bbb57795501c Mon Sep 17 00:00:00 2001 From: Leandro Francucci Date: Sat, 20 Feb 2021 11:13:36 -0300 Subject: [PATCH 32/32] Fixed a spelling mistake in changelog.json --- tools/deploy/changelog.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/deploy/changelog.json b/tools/deploy/changelog.json index bbf604f4..7a5548bb 100644 --- a/tools/deploy/changelog.json +++ b/tools/deploy/changelog.json @@ -12,7 +12,7 @@ "Added STM32 port critical section priority flexible configuration", "Added RKH_CFG_FWK_AWARE_ISR_PRIO configuration option", "Added function rkh_trc_getWholeBlock() to get whole block from trace stream", - "Supported reinit and restart a already started timer", + "Supported reinit and restart an already started timer", "Added new options of Uncrustify", "Sent memory pool symbols as traces", "Deleted reinitialized timer from the timer list",