Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icub-common creation with GH action #675

Merged
merged 122 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
01d79b8
creted GH action for package
mbrunettini Jun 11, 2020
3e3ce5d
variables moved to external file
mbrunettini Jun 11, 2020
4e8cc41
fix
mbrunettini Jun 11, 2020
5afcc5d
Update create_icub-common_deb.sh
mbrunettini Jun 11, 2020
8ff8b33
Update packages_vars.sh
mbrunettini Jun 12, 2020
0df41e4
Merge branch 'master' of https://github.com/mbrunettini/icub-main
mbrunettini Jun 12, 2020
945458d
removed debug
mbrunettini Jun 12, 2020
22edc37
updated with automatic tag detection
mbrunettini Jun 15, 2020
159b2de
added git as dep
mbrunettini Jun 15, 2020
0c0202a
fixed installing git
mbrunettini Jun 15, 2020
a5ceb02
removed git detection
mbrunettini Jun 15, 2020
6f73b90
test
mbrunettini Jun 15, 2020
2180721
back to working
mbrunettini Jun 15, 2020
507e087
added version check
mbrunettini Jul 2, 2020
de47f8b
debug
mbrunettini Jul 2, 2020
32a06ce
removed uneeded code
mbrunettini Jul 2, 2020
ef5b441
debug 2
mbrunettini Jul 2, 2020
a27b2a6
kkk
mbrunettini Jul 2, 2020
0978d90
try
mbrunettini Jul 2, 2020
58639a1
fix
mbrunettini Jul 2, 2020
158beb1
fixed
mbrunettini Jul 2, 2020
a559d27
test
mbrunettini Jul 2, 2020
63d35e5
deps
mbrunettini Jul 2, 2020
06292ea
update
mbrunettini Jul 2, 2020
492411f
new test
mbrunettini Jul 3, 2020
20f972e
xx
mbrunettini Jul 3, 2020
84e8295
zz
mbrunettini Jul 3, 2020
6da7822
nn
mbrunettini Jul 3, 2020
61a0ac8
gg
mbrunettini Jul 3, 2020
c0985dd
vv
mbrunettini Jul 3, 2020
cf6ee0b
xx
mbrunettini Jul 3, 2020
aed80b8
dd
mbrunettini Jul 3, 2020
033be8c
renamed action
mbrunettini Jul 3, 2020
b6fb393
fx
mbrunettini Jul 3, 2020
17f7f5c
test
mbrunettini Jul 6, 2020
625d03d
chaged oin event triggers
mbrunettini Jul 6, 2020
b700723
test
mbrunettini Jul 6, 2020
2a6b2a3
ch
mbrunettini Jul 6, 2020
abba37b
mah
mbrunettini Jul 6, 2020
256c281
boh
mbrunettini Jul 6, 2020
081b197
fi
mbrunettini Jul 6, 2020
53fb291
it works!
mbrunettini Jul 6, 2020
f5c8580
fixes in packages name
mbrunettini Jul 6, 2020
df2426c
s
mbrunettini Jul 6, 2020
bf26661
s
mbrunettini Jul 6, 2020
603a1fe
dd
mbrunettini Jul 6, 2020
01749db
cleanup
mbrunettini Jul 6, 2020
a1b590e
m
mbrunettini Jul 6, 2020
abb6760
removed push
mbrunettini Jul 9, 2020
b2609f8
f
mbrunettini Jul 9, 2020
682ab9f
ss
mbrunettini Jul 9, 2020
45036a5
s
mbrunettini Jul 9, 2020
eeefb41
x
mbrunettini Jul 9, 2020
f1e10ea
d
mbrunettini Jul 9, 2020
58a2d23
modified workflow
mbrunettini Jul 9, 2020
bc25dfc
s
mbrunettini Jul 9, 2020
37e5533
d
mbrunettini Jul 9, 2020
a9d183f
s
mbrunettini Jul 9, 2020
e75bd7a
f
mbrunettini Jul 9, 2020
bb96a6f
s
mbrunettini Jul 9, 2020
6f81dd6
t
mbrunettini Jul 9, 2020
1b0bcdd
dd
mbrunettini Jul 9, 2020
91da318
xxx
mbrunettini Jul 9, 2020
0b7ea8d
s
mbrunettini Jul 10, 2020
9ca31bf
d
mbrunettini Jul 10, 2020
5c58fbb
ddf
mbrunettini Jul 10, 2020
5eb7511
D
mbrunettini Jul 10, 2020
9cd3864
D
mbrunettini Jul 10, 2020
e30c047
d
mbrunettini Jul 10, 2020
057c8c0
d
mbrunettini Jul 10, 2020
9c41d7e
c
mbrunettini Jul 10, 2020
8d404e8
d
mbrunettini Jul 10, 2020
4432d24
x
mbrunettini Jul 13, 2020
ea56dcc
f
mbrunettini Jul 13, 2020
9e62f64
ff
mbrunettini Jul 13, 2020
c420e5b
xx
mbrunettini Jul 13, 2020
9e58092
xf
mbrunettini Jul 13, 2020
35e7c24
fix
mbrunettini Jul 13, 2020
a2bffe8
2fx
mbrunettini Jul 13, 2020
b2bf2cb
ddddd
mbrunettini Jul 13, 2020
9a9168e
s
mbrunettini Jul 13, 2020
5370ea1
d
mbrunettini Jul 13, 2020
5a43d4b
fsdfsd
mbrunettini Jul 13, 2020
a0ac6a4
ewee
mbrunettini Jul 13, 2020
5a97d64
ggg
mbrunettini Jul 13, 2020
7b9bcda
damn it
mbrunettini Jul 13, 2020
6b56ab3
vv
mbrunettini Jul 13, 2020
fe5d238
hfghgh
mbrunettini Jul 13, 2020
8436d19
hhhh
mbrunettini Jul 13, 2020
3df1107
j
mbrunettini Jul 13, 2020
5c7a790
tre
mbrunettini Jul 13, 2020
be92eba
h
mbrunettini Jul 13, 2020
a30cf36
fff
mbrunettini Jul 13, 2020
43315a8
rr
mbrunettini Jul 13, 2020
ab3bf35
try
mbrunettini Jul 13, 2020
b4211d1
gdf
mbrunettini Jul 13, 2020
6226a44
gfgdf
mbrunettini Jul 13, 2020
7d5dab8
fd
mbrunettini Jul 13, 2020
f72a2d8
fix
mbrunettini Jul 13, 2020
6d86024
fgdf
mbrunettini Jul 13, 2020
d2e1098
may
mbrunettini Jul 13, 2020
c8edf5c
dfds
mbrunettini Jul 13, 2020
709c6ab
dfgdf
mbrunettini Jul 13, 2020
d09bd62
uu
mbrunettini Jul 13, 2020
abcff22
xx
mbrunettini Jul 13, 2020
337554b
ss
mbrunettini Jul 13, 2020
de6b050
dfsf
mbrunettini Jul 13, 2020
0de4084
dfg
mbrunettini Jul 13, 2020
0254b20
FVXCVXC
mbrunettini Jul 13, 2020
94e260c
fgfg
mbrunettini Jul 13, 2020
9af2249
rrr
mbrunettini Jul 13, 2020
67c6072
frf
mbrunettini Jul 13, 2020
e2c7e2d
rrr
mbrunettini Jul 13, 2020
af7b91d
efef
mbrunettini Jul 13, 2020
7535ade
ttt
mbrunettini Jul 13, 2020
0b0afdd
eee
mbrunettini Jul 13, 2020
60ea28d
dgdfg
mbrunettini Jul 13, 2020
83bb52a
d
mbrunettini Jul 13, 2020
b4bb8f9
working release
mbrunettini Jul 13, 2020
5d71060
added clean
mbrunettini Jul 15, 2020
e0704bf
fix on delete artifact
mbrunettini Jul 15, 2020
fa116ae
restored ci.yml
mbrunettini Jul 24, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
271 changes: 271 additions & 0 deletions .ci/create_icub-common_deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,271 @@
#!/bin/bash -e
#set -x
# #####################################################
# SCRIPT NAME: create_icub-common_deb.sh
#
# DESCRIPTION: this script creates the icub-common
# metapackage
#
# AUTHOR : Matteo Brunettini <matteo.brunettini@iit.it>
#
# LATEST MODIFICATION DATE (YYYY-MM-DD): 2020-06-10
#
SCRIPT_VERSION="1.0" # Sets version variable
SCRIPT_TEMPLATE_VERSION="1.2.1" #
SCRIPT_NAME=$(realpath -s $0)
SCRIPT_PATH=$(dirname $SCRIPT_NAME)
#
# #####################################################
# COLORS
COL_NORMAL="\e[0m"
COL_ERROR=" \e[31m"
COL_OK="\e[32m"
COL_DONE="\e[96m"
COL_ACTION="\033[1;90m"
COL_WARNING="\e[33m"

# Defaults
LOG_FILE=""
VARS_FILE="${SCRIPT_PATH}/packages_vars.sh"
PLATFORM_HARDWARE=""
PLATFORM_RELEASE=""

# locals
_WHO_AM_I=$(whoami)
_EQUIVS_BIN=$(which equivs-build || true)
_LSB_BIN=$(which lsb_release || true)
_CONTROL_FILE=""
# #####################################################

print_defs ()
{
echo "Default parameters are"
echo " SCRIPT_TEMPLATE_VERSION is $SCRIPT_TEMPLATE_VERSION"
echo " SCRIPT_VERSION is $SCRIPT_VERSION"
if [ "$LOG_FILE" != "" ]
then
echo " log file is $LOG_FILE"
fi
echo "Local parameters are"
echo " VARS_FILE is $VARS_FILE"
echo " _WHO_AM_I is $_WHO_AM_I"
echo " _EQUIVS_BIN is $_EQUIVS_BIN"
echo " _LSB_BIN is $_LSB_BIN"
echo " _CONTROL_FILE is $_CONTROL_FILE "
}

usage ()
{
echo "SCRIPT DESCRIPTION"

echo "Usage: $0 [options]"
echo "options are :"
echo " -f VARS_FILE : use file VARS_FILE as variables container file"
echo " -V PACKAGE_VERSION : use PACKAGE_VERSION as version for metapackage"
echo " -R DEBIAN_REVISION_NUMBER : use DEBIAN_REVISION_NUMBER ad revision for metapackage"
echo " -l LOG_FILE : write logs to file LOG_FILE"
echo " -d : print defaults"
echo " -v : print version"
echo " -h : print this help"
}

log() {
if [ "$LOG_FILE" != "" ]
then
echo -e "$(date +%d-%m-%Y) - $(date +%H:%M:%S) : ${1}${COL_NORMAL}" >> $LOG_FILE
else
echo -e "$(date +%d-%m-%Y) - $(date +%H:%M:%S) : ${1}${COL_NORMAL}"
fi
}

warn() {
log "${COL_WARNING}WARNING - $1"
}

error() {
log "${COL_ERROR}ERROR - $1"
}

exit_err () {
error "$1"
exit 1
}

print_version() {
echo "Script version is $SCRIPT_VERSION based of Template version $SCRIPT_TEMPLATE_VERSION"
}

parse_opt() {
while getopts hdvl:V:R:f: opt
do
case "$opt" in
"f")
VARS_FILE="$OPTARG"
;;
"V")
ICUB_PACKAGE_VERSION="$OPTARG"
;;
"R")
ICUB_DEBIAN_REVISION_NUMBER="$OPTARG"
;;
"l")
LOG_FILE="$OPTARG"
;;
h)
usage
exit 0
;;
d)
print_defs
exit 0
;;
v)
print_version
exit 0
;;
\?) # unknown flag
usage
exit 1
;;
esac
done
}

init()
{
if [ ! -f "$VARS_FILE" ]; then
exit_err "variables container file $VARS_FILE not found"
fi
source "$VARS_FILE"

check_and_install_deps

PLATFORM_RELEASE=$(lsb_release -sc)
if [ "$PLATFORM_RELEASE" == "" ]; then
exit_err "unable to read release key"
fi

_MACHINE_TYPE=`uname -m`
case "$_MACHINE_TYPE" in
x86_64)
PLATFORM_HARDWARE="amd64"
;;
i?86)
PLATFORM_HARDWARE="i386"
;;
*)
exit_err "invalid platform hardware $_MACHINE_TYPE"
;;
esac

_CONTROL_FILE="icub-common.${PLATFORM_RELEASE}-${PLATFORM_HARDWARE}.control"

if [ "$ICUB_PACKAGE_VERSION" == "" ]; then
exit_err "Package version string is empty"
fi

if [ "$ICUB_DEBIAN_REVISION_NUMBER" == "" ]; then
exit_err "Package revision string is empty"
fi

if [[ ! "$SUPPORTED_DISTRO_LIST" =~ "$PLATFORM_RELEASE" ]]; then
exit_err "Distro $PLATFORM_RELEASE is not supported, we support only $SUPPORTED_DISTRO_LIST"
fi

if [[ ! "$SUPPORTED_TARGET_LIST" =~ "$PLATFORM_HARDWARE" ]]; then
exit_err "Distro $PLATFORM_HARDWARE is not supported, we support only $SUPPORTED_TARGET_LIST"
fi

log "$0 ${COL_OK}Creating package.."
}

fini()
{
if [ -f "$_CONTROL_FILE" ]; then
rm "$_CONTROL_FILE"
fi

export ICUB_PACKAGE_NAME="icub-common_${ICUB_PACKAGE_VERSION}-${ICUB_DEBIAN_REVISION_NUMBER}~${PLATFORM_RELEASE}_${PLATFORM_HARDWARE}.deb"
echo $ICUB_PACKAGE_NAME > ICUB_PACKAGE_NAME.txt
ls
log "${COL_OK}${ICUB_PACKAGE_NAME} CREATED"
}

check_and_install_deps()
{
export DEBIAN_FRONTEND=noninteractive

if [ "$_WHO_AM_I" != "root" ]; then
sudo apt-get update
else
apt-get update
fi
if [ "$_LSB_BIN" == "" ]; then
if [ "$_WHO_AM_I" != "root" ]; then
log "installing lsb_release, so we may need your password"
sudo apt-get install -y lsb-release
else
log "installing lsb_release"
apt-get install -y lsb-release
fi
_LSB_BIN=$(which lsb_release)
fi
if [ "$_EQUIVS_BIN" == "" ]; then
if [ "$_WHO_AM_I" != "root" ]; then
log "installing equivs, so we may need your password"
sudo apt-get install -y equivs
else
log "installing equivs"
apt-get install -y equivs
fi
_EQUIVS_BIN=$(which equivs-build)
fi
}

create_control_file()
{
_ICUB_COMMON_DEPENDENCIES=""
for dep in $ICUB_DEPS_COMMON ; do
if [ "$_ICUB_COMMON_DEPENDENCIES" == "" ]; then
_ICUB_COMMON_DEPENDENCIES="$dep"
else
_ICUB_COMMON_DEPENDENCIES="${_ICUB_COMMON_DEPENDENCIES}, $dep"
fi
done
_PLAT_DEPS_TAG="ICUB_DEPS_${PLATFORM_RELEASE}"
for pdep in ${!_PLAT_DEPS_TAG} ; do
if [ "$_ICUB_COMMON_DEPENDENCIES" == "" ]; then
_ICUB_COMMON_DEPENDENCIES="$pdep"
else
_ICUB_COMMON_DEPENDENCIES="${_ICUB_COMMON_DEPENDENCIES}, $pdep"
fi
done
echo "Package: icub-common
Version: ${ICUB_PACKAGE_VERSION}-${ICUB_DEBIAN_REVISION_NUMBER}~${PLATFORM_RELEASE}
Section: contrib/science
Priority: optional
Architecture: $PLATFORM_HARDWARE
Depends: $_ICUB_COMMON_DEPENDENCIES, cmake (>=${CMAKE_MIN_REQ_VER})
Homepage: http://www.icub.org
Maintainer: ${ICUB_PACKAGE_MAINTAINER}
Description: List of dependencies for iCub software (metapackage)
This metapackage lists all the dependencies needed to install the icub platform software or to download the source code and compile it directly onto your machine." | tee $_CONTROL_FILE

}

create_deb()
{
$_EQUIVS_BIN $_CONTROL_FILE
}

main()
{
create_control_file
create_deb
}

parse_opt "$@"
init
main
fini
exit 0
Loading