first commit

This commit is contained in:
Jérôme Delacotte
2025-03-06 11:15:32 +01:00
commit 7b30d6e298
5276 changed files with 2108927 additions and 0 deletions

View File

@@ -0,0 +1,159 @@
#!/bin/bash
# vi:ts=4
#
# mkChangLog - produce a ChangeLog from git history on stdout
#
# SYNOPSIS
# mkChangeLog [OPTION]
#
# DESCRIPTION
# Extract commit comments and label each tag with a date
# from most recent to oldest.
# Default output is suitable for including in markdown files
#
# -c curRev - use CurRev as tag name if current rev (latest commit) has no tag
#
# -s stopRev - will stop the log with the specified tag
# changelog will not show commit messages earlier than the stopRev tag
# To indicate stopping at very first tag, use -
#
# -H heading - use heading instead of "CHANGELOG" for heading1 of log
#
# -h heading - use heading instead of "------------" for heading2 of log
#
# AUTHOR
# Bill Perry bperrybap@opensource.billsworld.billandterrie.com
# 2016-08-08
#
# NOTES:
# The reason for the curRev option is that when creating a changelog file that
# needs to be part of a tagged revision, there is a chicken & egg problem of
# how do you create the changelog for that revision and also set the tag for
# the revision that includes the updated changelog file?
# If you set the tag to get the changelog output to include the new tag, then
# when you commit the changelog file created from the log output, there is an
# additional commit that affects the log and the log file for the commit is
# *after* the tag instead of being at the tag.
# The answer to this dilema: "CHEAT" a bit.
# So the curRev option will fake the tagname on the most recent commits since
# the previous tag to be the name "curRev" even though the tag has not yet been
# set. There is still one limitation the commit log message for updating the
# changelog file will not be shown for the changes associated with the new tag.
# There is no way to work around this.
# However, the log message entry will show when the next tag is created, so it
# is only the most recent tag that will be missing the commit message for the
# changelog file update.
#
# This allows a process of:
#
# - generate the ChangeLog with curRev as tag about to be created
# - commit ChangeLog
# - tag with the tag used as curRev
#
# This will create a single commit as well as the desired tag pointing
# to the commit that contains the log for new tag.
#
#
pname=`basename $0`
HEADING1="CHANGELOG"
HEADING2="----------------------"
function USAGE {
printf "usage:\n"
printf "$pname [option]\n"
printf "\t-c curRev\n\t\tuse CurRev as tagname if current rev has no tag\n"
printf "\t-s stopRev\n\t\tno log output prior to stopRev tag\n"
printf "\t-H heading\n\t\tuse heading instead of \"$HEADING1\" for heading1 of log\n"
printf "\t-h heading\n\t\tuse heading instead of \"$HEADING2\" for heading2 of log\n"
}
# check for arguments
while getopts ":s:c:H:h:" opt; do
case $opt in
c)
curRev=$OPTARG
;;
s)
stopRev=$OPTARG
;;
H)
HEADING1=$OPTARG
;;
h)
HEADING2=$OPTARG
;;
\?)
echo "$pname: invalid option: -$OPTARG" >&2
USAGE
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
USAGE
exit 1
;;
esac
done
# if stopRev is "-" then use first tag in repo
if [ "$stopRev" = "-" ]
then
stopRev=$(git tag -l | head -1)
fi
#now generate the change log
# if headings are empty, don't output them
if [ "$HEADING1" != "" ]
then
echo "$HEADING1"
fi
if [ "$HEADING2" != "" ]
then
echo "$HEADING2"
fi
git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags |tac |grep -v '^$' | while read TAG ; do
echo
if [ $NEXT ];then
rev=$NEXT
else
if [ "$curRev" != "" ]
then
rev=$curRev
else
rev=`git describe --dirty`
fi
fi
if [ "$rev" != "$TAG" ]
then
echo [$rev] - `git log -1 --format=%ad --date=short $NEXT`
if [ "$rev" = "$stopRev" ]
then
# note: the exit below exits the loop command not the script
# the exit value will be the status code of the loop
exit 9
fi
GIT_PAGER=cat git log --no-merges --format=" * %s" $TAG..$NEXT
fi
NEXT=$TAG
done
# if loop exited because it stopped early from a stopRev, status will be non zero
# so exit script
if [ $? -ne 0 ]
then
exit 0
fi
FIRST=$(git tag -l | head -1)
echo
echo [$FIRST] - `git log -1 --format=%ad --date=short $FIRST`
if [ "$FIRST" = "$stopRev" ]
then
exit 0
fi
# if this GIT_PAGER below is commented out then the logs for the first tag are not emitted
GIT_PAGER=cat git log --no-merges --format=" * %s" $FIRST

View File

@@ -0,0 +1,205 @@
#!/usr/bin/env bash
#=============================================================================
# bash script to assist in creating a new library release.
# Created by Bill Perry 2016-08-01
# bperrybap@opensource.billsworld.billandterrie.com
#
# the script will:
# - update version strings in the library files.
# optionally:
# - commit updated files
# - create tag using supplied revision string
#
#
# To use, just run script.
# if argument is given it will be assumd to be the revision string
# if not, it will prompt for input.
#
# script will prompt to optionally commit updates, & tag the updated repo
#
# Note:
# It is recommend that all other change be commited prior to running script
#
#=============================================================================
# location of root repository directory relative to directory where script lives
repodir=../..
#get name & location of this script
progname=`basename $0`
progwd=`dirname $0`
# pre/post/patcher scripts
# (assume in same dirctory with this scketh)
PREPATCHER=$progwd/mkreleasePrePatcher
PATCHER=$progwd/mkreleasePatcher
POSTPATCHER=$progwd/mkreleasePostPatcher
#make sure script running where script lives
cd $progwd
# check to see if on master branch and ask to proceed if not
git rev-parse --abbrev-ref HEAD |grep -q master
if [ $? -ne 0 ]
then
while
read -e -p "Not on master branch; continue?:" -i "n" yesno
[ "$yesno" = "" ]
do
:;
done
fi
if [ "$yesno" = "n" ]
then
exit 0
fi
# check to see if there are uncommitted changes and ask to proceed if so
git diff-index --quiet HEAD --
if [ $? -ne 0 ]
then
while
read -e -p "Uncommitted changes; continue?:" -i "n" yesno
[ "$yesno" = "" ]
do
:;
done
fi
if [ "$yesno" = "n" ]
then
exit 0
fi
#check to see if version string passed in
#if not then ask for it interactively
if [ $# = 1 ]
then
rawverstr=$1
else
while
read -e -p "Version:" rawverstr;
[ "$rawverstr" = "" ]
do
:;
done
fi
#
# create RETARDED SemVer compliant Revision string by sanitizing input string
# http://semver.org/
# this uses sed to alter a string to be @#$@$ SEMVER compliant
# it will work as long as the version used starts with a version number that is
# either 2 digits or 3 digits. Example 1.0 1.0.0
# string will be massaged to ensure compliance should tags used not be SEMVER
# compliant. i.e. v1.2rc1 will be turned into 1.2.0-rc1
#
# shown here is how each "-e" works:
# - strip out leading a leading leading non numeric chars (like 'v')
# will change a tag of v1.0 to 1.0 trailing strings after digits are left alone
#
# - convert 2 digit version numbers to 3 digit numbers
# will change #.# to #.#.0 trailing strings are left alone
#
# - change a period after the 3rd version digit to a dash
# will change #.#.#.foo to #.#.#-foo
#
# - insert a "-" afer the 3rd version digit if the character is not already a - or a +
# handles case of changing #.#.#foo to #.#.#-foo
#
#
VERSIONSTR=$(echo $rawverstr | sed -e 's/^\([^0-9]*\)\(.*\)/\2/' -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\)\($\|[^\.].*\|\.[^0-9].*\)/\1.0\2/' -e 's/^\([0-9][0-9]*\.[0-9][0-9]*.[0-9][0-9]*\)\.\(.*\)/\1-\2/' -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\([^0-9+-].*\)/\1-\2/')
#extract out the major, minor, and point version numbers from the semver version string
MAJ=$(echo $VERSIONSTR | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(.*\)/\1/')
MIN=$(echo $VERSIONSTR | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(.*\)/\2/')
PT=$(echo $VERSIONSTR | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)\(.*\)/\3/')
#debug
#echo VERSIONSTR $VERSIONSTR
#echo MAJ $MAJ
#echo MIN $MIN
#echo PT $PT
# create a single numeric version number from the components.
# format is MMmmPP so each version digit consumes two decimal digits
# leading zeros are dropped to prevent number being octal
# Examples:
# 1.2.3 would be 10203
# 1.0.0 would be 10000
# 0.5.0 would be 500 (can't start with 0 as that means octal)
# drop the Major number if 0 since we don't want an octal number
if [ $MAJ -ne 0 ]
then
VERSION=`printf "%d%02d%02d" $MAJ $MIN $PT`
else
# drop the Minor number if 0 when MAJ is 0 ince we don't want an octal number
if [ $MIN -ne 0 ]
then
VERSION=`printf "%d%02d" $MIN $PT`
else
VERSION=`printf "%d" $PT`
fi
fi
#debug
#echo $progname: "setting VERSION to $VERSION"
#echo $progname: "setting VERSIONSTR to $VERSIONSTR"
# check to see if a prepatcher script exists, if does does,
# call prepatcher script to do anything needed before doing patching
if [ -e $PREPATCHER ]
then
$PREPATCHER
if [ $? -ne 0 ]
then
echo "$progname: error pre patching files"
exit 1
fi
fi
# call patcher script to do the actual file patching
# hand patch all the version information and let it do its thing...
$PATCHER "$VERSIONSTR" "$VERSION" "$MAJ" "$MIN" "$PT"
if [ $? -ne 0 ]
then
echo "$progname: error patching version files"
exit 1
fi
# check to see if a postpatcher script exists, if does does,
# call postpatcher script to do anything needed after doing patching
if [ -e $POSTPATCHER ]
then
$POSTPATCHER
if [ $? -ne 0 ]
then
echo "$progname: error post patching files"
exit 1
fi
fi
# ask if changes should be committed and tagged
while
read -e -p "Commit & Tag Release version updates?:" -i "n" yesno
[ "$yesno" = "" ]
do
:;
done
if [ "$yesno" = "y" ]
then
gitcomment="update version info for $VERSIONSTR release"
echo commiting changes to git with comment: $gitcomment
git commit -a -m "$gitcomment"
echo "setting git tag to $VERSIONSTR"
git tag -a $VERSIONSTR -m "Release of library version $VERSIONSTR"
fi
echo "---"
read -n1 -p "Press any key to exit"
echo

View File

@@ -0,0 +1,155 @@
#!/usr/bin/env bash
# vi:ts=4
#=============================================================================
# This version of the script patches files for the hd44780 arduino library
#=============================================================================
#
# mkreleasePatcher - patch all necessary files with new version information
#
# SYNOPSIS
# mkreleasePatcher VersionStr Version Major Minor Point
#
# DESCRIPTION
# mkreleasePatcher is called by the mkRelease script that controls the
# process for making a new release.
# mkrelease will pass mkreleasePatcher release information and the
# mkreleasePatcher script is free to use it anyway it wants to update
# any/all necessary files to indicate the version information.
# Any/all decisions about commits & tagging should nomally be handled by
# mkrelease rather than this script.
#
# EXAMPLE
# if the version string in mkrelease is "1.2.3-alpha"
# then mkrelease will run mkreleasePatcher with this commandline:
# mkreleasePatcher 1.2.3.3-alpha 12030 1 2 3
#
# AUTHOR
# Created by Bill Perry 2016-08-09
# bperrybap@opensource.billsworld.billandterrie.com
#
#=============================================================================
# location of root repository directory relative to directory where script lives
repodir=../..
#get name & location of this script
progname=`basename $0`
progwd=`dirname $0`
#make sure script running in root repo directory where script lives
# note: this is done in two steps since progwd might or might not be a full path
cd $progwd
#make sure progwd is full path
progwd=`pwd`
cd $repodir
#name of changelog tool
MKCHANGELOG=$progwd/mkChangeLog
#check to see if all version fields were passed in.
if [ $# -ne 5 ]
then
echo "usage: $progname VersionStr Version Maj Min Point"
exit 1
fi
VERSIONSTR=$1
VERSION=$2
MAJ=$3
MIN=$4
PT=$5
#debug output
#echo "$progname: VERSIONSTR $VERSIONSTR"
#echo "$progname: VERSION $VERSION"
#echo "$progname: MAJ $MAJ"
#echo "$progname: MIN $MIN"
#echo "$progname: PT $PT"
echo $progname: "setting HD44780_VERSION to $VERSION"
echo $progname: "setting HD44780_VERSIONSTR to $VERSIONSTR"
#######################################################################
# patch the files that have version information in them
# - hd44780.h
# - library.properties
# - examples/Documentation/Documentation.ino
# - README.md
#######################################################################
# script is running in the root of repository
# so all files being updated need to be relative to that location
#######################################################################
# patch hd44780.h version defines
ed -s hd44780.h << EOF
,s/\(HD44780_VERSION\)\s.*$/\1 $VERSION/
,s/\(HD44780_VERSIONSTR\)\s.*$/\1 \"$VERSIONSTR\"/
w
q
EOF
#######################################################################
#######################################################################
# patch library.properties version
ed -s library.properties << EOF
,s/\(version=\).*$/\1$VERSIONSTR/
w
q
EOF
#######################################################################
#######################################################################
# patch Documentation sketch used to display documentation links
# patch "Version #"
ed -s examples/Documentation/Documentation.ino << EOF
,s/\(Version \)[0-9]\.*[0-9]*\.*[0-9]*\(.*$\)/\1$VERSIONSTR\2/
w
q
EOF
# patch github link to specific vesion tree: "https://.../tree/{tag}"
ed -s examples/Documentation/Documentation.ino << EOF
,s/\(tree\/\).*$/\1$VERSIONSTR/
w
q
EOF
#######################################################################
#######################################################################
# patch iobadge in README.md
# first, patch the VERSIONSTR string for the iobadge reference
# iobadge parameter strings require double dash to indicate a dash
IOBVERSIONSTR=$(echo $VERSIONSTR | sed -e 's/-/--/')
# now patch that actual badge in the README.md
# The format of the badge is:
# https://img.shields.io/badge/<SUBJECT>-<STATUS>-<COLOR>.svg
# this will only patch the STATUS field of the badge.
# the rest will remain as it was.
ed -s README.md << EOF
,s/\(https:.*io\/badge\/\)\(.*-\)\([0-9].*-\)\(.*$\)/\1\2$IOBVERSIONSTR-\4/
w
q
EOF
#######################################################################
#######################################################################
# update ChangeLog in README.md file
#
# this is done by looking for "CHANGELOG" and removing everything in
# the file after that and appending a new log on to the end of the file.
#
# First strip out the old CHANGELOG
ed -s README.md << EOF
/CHANGELOG/,\$d
w
q
EOF
# now create the new change log and append to end of README.md
$MKCHANGELOG -c $VERSIONSTR -s - -H CHANGELOG >> README.md
#######################################################################
exit 0

View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
# vi:ts=4
#=============================================================================
# This version of the script patches files for the hd44780 arduino library
#=============================================================================
#
# mkreleasePostPatcher - do things after patcher has run
#
# SYNOPSIS
# mkreleasePostPatcher
#
# DESCRIPTION
# mkreleasePostPatcher is called by the mkRelease script that controls the
# process for making a new release.
# mkrelease will call it after mkreleasePatch has been run
# It massages patched files like the README.md markdown file to html for use
# in the documentation
#
# This script depends on the tool 'grip' which can be found here:
# https://github.com/joeyespo/grip
#
# AUTHOR
# Created by Bill Perry 2018-02-03
# bperrybap@opensource.billsworld.billandterrie.com
#
#=============================================================================
# location of root repository directory relative to directory where script lives
repodir=../..
# location of where Documenation files are stored
HTMLdocs=./examples/Documentation/docs
#get name & location of this script
progname=`basename $0`
progwd=`dirname $0`
#make sure script running in root repo directory where script lives
# note: this is done in two steps since progwd might or might not be a full path
cd $progwd
#make sure progwd is full path
progwd=`pwd`
cd $repodir
#######################################################################
# Create the README.html file from the README.md file
#######################################################################
# this script is running in the root of repository
# so all files being used/updated need to be relative to that location
echo Creating README html file in docs area
grip --quiet --title=README README.md --export $HTMLdocs/README.html
exit 0

View File

@@ -0,0 +1,30 @@
This directory contains scripts to aid in the building of a library release.
Their main purpose is the update revision information in the files and to
automatically create a changelog.
The scripts are bash shell scripts.
If you are using a Wimpy/Crappy OS like Windows you are SOL.
To create a new release:
- commit all file changes
- run mkrelease script (optionally pass in version string like 1.0.5 etc...)
Note: use "grip" tool to view README file as html
mkrelease can be run from the commandline or from a gui file manager
The mkrelease script will:
- check to see if all files have been commited
- prompt for a version string if not passed in
- massasge version string to make it SemVer compliant
- call mkreleasePrePatcher (if it exists)
- this potentially does things that need to be done before the patcher runs
currently this does nothing.
- call mkreleasePatcher:
- patches all the necessary files to update version information.
- calls mkChangeLog to insert an auto generated changelog from git log info into Readme.md
- call mkreleasePostPatcher (if it exists)
- this potentially does things that need to be after the patcher runs
currently this converts the patched README.md to html stored in the "docs" directory
- optionally commit all modified files & tag repo with specified tag