Compare commits
8 Commits
253c77489b
...
feature/st
Author | SHA1 | Date | |
---|---|---|---|
56013daed0 | |||
4c4fd6d42c | |||
546e62e077 | |||
4b61e5dafc | |||
c83e6190c4 | |||
cad163ffd0 | |||
97fd00a3c7 | |||
fdba555beb |
15
hooks/build/stdeb/build
Executable file
15
hooks/build/stdeb/build
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cd src
|
||||||
|
for archive in *.tar.gz
|
||||||
|
do
|
||||||
|
py2dsc $archive
|
||||||
|
folder="$(find deb_dist/* -maxdepth 0 -type d)"
|
||||||
|
pushd $folder
|
||||||
|
dpkg-buildpackage -b -a"${TAMARIN_TARGET_ARCH}"
|
||||||
|
find ../ -maxdepth 1 -name "*.deb" -type f -print0 | xargs -0r mv -t /dist/
|
||||||
|
popd
|
||||||
|
rm -rf $folder
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
28
hooks/containerbuild/debian/install-letsencrypt-ca
Executable file
28
hooks/containerbuild/debian/install-letsencrypt-ca
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DESTDIR=/usr/local/share/ca-certificates
|
||||||
|
UPDATE_CERTS_CMD=update-ca-certificates
|
||||||
|
CERTS="$(cat <<EOF
|
||||||
|
https://letsencrypt.org/certs/isrgrootx1.pem
|
||||||
|
https://letsencrypt.org/certs/isrg-root-x2.pem
|
||||||
|
https://letsencrypt.org/certs/lets-encrypt-r3.pem
|
||||||
|
https://letsencrypt.org/certs/lets-encrypt-e1.pem
|
||||||
|
https://letsencrypt.org/certs/lets-encrypt-r4.pem
|
||||||
|
https://letsencrypt.org/certs/lets-encrypt-e2.pem
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
|
||||||
|
|
||||||
|
echo "ENV DEBIAN_FRONTEND=noninteractive" >> Dockerfile
|
||||||
|
echo "RUN apt-get update && apt-get install --yes --no-install-recommends openssl ca-certificates" >> Dockerfile
|
||||||
|
|
||||||
|
for cert in $CERTS; do
|
||||||
|
filename=$(basename "$cert")
|
||||||
|
echo "ADD $cert $DESTDIR/$filename" >> Dockerfile
|
||||||
|
echo "RUN openssl x509 -in '$DESTDIR/$filename' -inform PEM -out '$DESTDIR/$filename.crt'" >> Dockerfile
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "RUN $UPDATE_CERTS_CMD" >> Dockerfile
|
||||||
|
echo "ENV DEBIAN_FRONTEND=" >> Dockerfile
|
9
hooks/containerbuild/ubuntu/install-stdeb
Executable file
9
hooks/containerbuild/ubuntu/install-stdeb
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo 'ENV DEBIAN_FRONTEND=noninteractive' >> Dockerfile
|
||||||
|
echo 'RUN apt-get update && apt-get install --yes --no-install-recommends python3-all dh-python python3-pip' >> Dockerfile
|
||||||
|
echo 'RUN pip3 install stdeb' >> Dockerfile
|
||||||
|
echo 'ENV DEBIAN_FRONTEND=' >> Dockerfile
|
||||||
|
|
@ -12,11 +12,11 @@ pkg_tags="$(git for-each-ref --format '%(refname)' refs/tags | tac)"
|
|||||||
|
|
||||||
# Set starting commit
|
# Set starting commit
|
||||||
ceiling_commit=$(git describe --match "build/*" --abbrev=0 2>/dev/null)
|
ceiling_commit=$(git describe --match "build/*" --abbrev=0 2>/dev/null)
|
||||||
if [ -z "ceiling_commit" ]
|
if [ -z "$ceiling_commit" ]
|
||||||
then
|
then
|
||||||
ceiling_commit="HEAD"
|
ceiling_commit="HEAD"
|
||||||
fi
|
fi
|
||||||
first_commit=$(git rev-list --max-parents=0 master)
|
first_commit=$(git rev-list --max-parents=0 HEAD)
|
||||||
|
|
||||||
# Get commits log as changelog
|
# Get commits log as changelog
|
||||||
|
|
||||||
@ -105,13 +105,11 @@ function get_package_version_from_tag {
|
|||||||
function get_distribution_from_tag {
|
function get_distribution_from_tag {
|
||||||
# tag pkg like pkg/<level>/<distrib>/<version>
|
# tag pkg like pkg/<level>/<distrib>/<version>
|
||||||
# <distrib> may be composed
|
# <distrib> may be composed
|
||||||
set -x
|
|
||||||
tag="$1"
|
tag="$1"
|
||||||
distribution="${tag#pkg/*/}"
|
distribution="${tag#pkg/*/}"
|
||||||
distribution="${distribution%/*}"
|
distribution="${distribution%/*}"
|
||||||
distribution="${distribution/\//-}"
|
distribution="${distribution/\//-}"
|
||||||
echo $distribution
|
echo $distribution
|
||||||
set +x
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_previous_release_tag {
|
function get_previous_release_tag {
|
||||||
@ -222,14 +220,13 @@ function next_version {
|
|||||||
function gen_changelog_entry {
|
function gen_changelog_entry {
|
||||||
ceiling_commit=$1
|
ceiling_commit=$1
|
||||||
floor_commit="$(next_step "${ceiling_commit}")"
|
floor_commit="$(next_step "${ceiling_commit}")"
|
||||||
|
|
||||||
if [ "$(get_hash ${ceiling_commit})" = "$(get_hash ${floor_commit})" ]
|
if [ "$(get_hash ${ceiling_commit})" = "$(get_hash ${floor_commit})" ]
|
||||||
then
|
then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if on_pkg_tag $ceiling_commit
|
if on_pkg_tag $ceiling_commit
|
||||||
then
|
then
|
||||||
|
ceiling_commit="$(get_previous_pkg_tag $ceiling_commit)"
|
||||||
version="$(get_upstream_version_from_tag $ceiling_commit)-$(get_package_version_from_tag $ceiling_commit)"
|
version="$(get_upstream_version_from_tag $ceiling_commit)-$(get_package_version_from_tag $ceiling_commit)"
|
||||||
distribution="$(get_distribution_from_tag $ceiling_commit)"
|
distribution="$(get_distribution_from_tag $ceiling_commit)"
|
||||||
else
|
else
|
||||||
@ -237,13 +234,11 @@ function gen_changelog_entry {
|
|||||||
version=$(next_version $ceiling_commit)
|
version=$(next_version $ceiling_commit)
|
||||||
distribution="UNRELEASED"
|
distribution="UNRELEASED"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#current_release="$(git describe --abbrev=0 --always --match='release/*' $ceiling_commit)"
|
#current_release="$(git describe --abbrev=0 --always --match='release/*' $ceiling_commit)"
|
||||||
tamarin_info "Création de l’entrée de changelog entre ${ceiling_commit} et ${floor_commit}"
|
tamarin_info "Création de l’entrée de changelog entre ${ceiling_commit} et ${floor_commit}"
|
||||||
|
|
||||||
maintainer="$(packager_from_commit ${ceiling_commit})"
|
maintainer="$(packager_from_commit ${ceiling_commit})"
|
||||||
package_date="$(date_from_commit ${ceiling_commit})"
|
package_date="$(date_from_commit ${ceiling_commit})"
|
||||||
|
|
||||||
version=${version/_/-}
|
version=${version/_/-}
|
||||||
changelog_entry="${project_name} (${version}) ${distribution}; urgency=${urgency}"
|
changelog_entry="${project_name} (${version}) ${distribution}; urgency=${urgency}"
|
||||||
echo "$changelog_entry" >> debian/changelog
|
echo "$changelog_entry" >> debian/changelog
|
||||||
|
@ -12,6 +12,9 @@ def run_profile_hooks(profile, step, **kwargs):
|
|||||||
hook_path = os.path.join(hooks_dir, trimmed_hook_name)
|
hook_path = os.path.join(hooks_dir, trimmed_hook_name)
|
||||||
run([hook_path], **kwargs)
|
run([hook_path], **kwargs)
|
||||||
|
|
||||||
|
def get_base_dir():
|
||||||
|
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
||||||
|
|
||||||
def get_hooks_dir():
|
def get_hooks_dir():
|
||||||
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/../hooks")
|
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/../hooks")
|
||||||
|
|
||||||
|
15
package
15
package
@ -23,13 +23,16 @@ def create_args_parser():
|
|||||||
parser.add_argument("--cleanup", help="Clear the workspace and remove obsolete Docker images before build", action="store_true", default=False)
|
parser.add_argument("--cleanup", help="Clear the workspace and remove obsolete Docker images before build", action="store_true", default=False)
|
||||||
parser.add_argument("--override-docker-args", help="Override all 'docker run' arguments. Use '[IMAGE_TAG]', '[PROFILE]' and '[ARCH]' to insert the corresponding values into your command.", default="")
|
parser.add_argument("--override-docker-args", help="Override all 'docker run' arguments. Use '[IMAGE_TAG]', '[PROFILE]' and '[ARCH]' to insert the corresponding values into your command.", default="")
|
||||||
parser.add_argument("--prepare-only", help="Only prepare build environment for the given profile", action="store_true", default=False)
|
parser.add_argument("--prepare-only", help="Only prepare build environment for the given profile", action="store_true", default=False)
|
||||||
|
parser.add_argument("--no-lib-mounts", help="Disable Tamarin library volumes mount", action="store_true", default=False)
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def build_image(build_workspace, base_image, profile_name, profile, debug=False, rebuild=False):
|
def build_image(build_workspace, base_image, profile_name, profile, debug=False, rebuild=False):
|
||||||
|
shutil.copytree(tamarin.get_base_dir(), os.path.join(build_workspace, '.tamarin'))
|
||||||
|
|
||||||
with open("{:s}/Dockerfile".format(build_workspace), 'w') as dockerfile:
|
with open("{:s}/Dockerfile".format(build_workspace), 'w') as dockerfile:
|
||||||
dockerfile.write("FROM {:s}\n".format(base_image))
|
dockerfile.write("FROM {:s}\n".format(base_image))
|
||||||
|
dockerfile.write("COPY .tamarin /tamarin\n")
|
||||||
|
|
||||||
# Configure "containerbuild" hooks environment
|
# Configure "containerbuild" hooks environment
|
||||||
hooks_env = os.environ.copy()
|
hooks_env = os.environ.copy()
|
||||||
@ -107,12 +110,16 @@ if __name__ == "__main__":
|
|||||||
docker_args += [
|
docker_args += [
|
||||||
"-v", "{:s}:/src:ro".format(project_dir),
|
"-v", "{:s}:/src:ro".format(project_dir),
|
||||||
"-v", "{:s}:/dist".format(output_dir),
|
"-v", "{:s}:/dist".format(output_dir),
|
||||||
"-v", "{:s}:/tamarin/hooks:ro".format(tamarin.get_hooks_dir()),
|
|
||||||
"-v", "{:s}:/tamarin/lib:ro".format(tamarin.get_lib_dir()),
|
|
||||||
"-v", "{:s}:/tamarin/profiles:ro".format(tamarin.get_profiles_dir()),
|
|
||||||
"-v", "{:s}:/tamarin/utils:ro".format(tamarin.get_utils_dir())
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if not args.no_lib_mounts:
|
||||||
|
docker_args += [
|
||||||
|
"-v", "{:s}:/tamarin/hooks:ro".format(tamarin.get_hooks_dir()),
|
||||||
|
"-v", "{:s}:/tamarin/lib:ro".format(tamarin.get_lib_dir()),
|
||||||
|
"-v", "{:s}:/tamarin/profiles:ro".format(tamarin.get_profiles_dir()),
|
||||||
|
"-v", "{:s}:/tamarin/utils:ro".format(tamarin.get_utils_dir())
|
||||||
|
]
|
||||||
|
|
||||||
# Use environment proxy if defined
|
# Use environment proxy if defined
|
||||||
for proxy_var in ['HTTP_PROXY', 'HTTPS_PROXY', 'http_proxy', 'https_proxy']:
|
for proxy_var in ['HTTP_PROXY', 'HTTPS_PROXY', 'http_proxy', 'https_proxy']:
|
||||||
if proxy_var in os.environ:
|
if proxy_var in os.environ:
|
||||||
|
@ -7,7 +7,8 @@ default_image=debian:stretch
|
|||||||
[containerbuild]
|
[containerbuild]
|
||||||
hooks=
|
hooks=
|
||||||
containerbuild/debian/install-build-essential,
|
containerbuild/debian/install-build-essential,
|
||||||
containerbuild/debian/install-git
|
containerbuild/debian/install-git,
|
||||||
|
containerbuild/debian/install-letsencrypt-ca
|
||||||
|
|
||||||
# Configuration de l'étape de pré-construction du paquet
|
# Configuration de l'étape de pré-construction du paquet
|
||||||
[prebuild]
|
[prebuild]
|
||||||
|
30
profiles/eole-2.7.2.conf
Normal file
30
profiles/eole-2.7.2.conf
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Configuration générale du profil
|
||||||
|
[profile]
|
||||||
|
# Image Docker par défaut
|
||||||
|
default_image=ubuntu:bionic
|
||||||
|
|
||||||
|
# Configuration de l'étape de pré-construction du conteneur
|
||||||
|
[containerbuild]
|
||||||
|
hooks=
|
||||||
|
containerbuild/debian/install-build-essential,
|
||||||
|
containerbuild/debian/install-git,
|
||||||
|
|
||||||
|
# Configuration de l'étape de pré-construction du paquet
|
||||||
|
[prebuild]
|
||||||
|
hooks=
|
||||||
|
prebuild/debian/copy-sources-to-workspace,
|
||||||
|
prebuild/debian/run-project-hooks,
|
||||||
|
prebuild/debian/load-project-db,
|
||||||
|
prebuild/debian/complete-project-db,
|
||||||
|
prebuild/eole/create-changelog,
|
||||||
|
prebuild/debian/install-build-depends
|
||||||
|
|
||||||
|
# Configuration de l'étape de construction du paquet
|
||||||
|
[build]
|
||||||
|
hooks=build/debian/build
|
||||||
|
|
||||||
|
# Configuration de l'étape de post-construction du paquet
|
||||||
|
[postbuild]
|
||||||
|
hooks=
|
||||||
|
postbuild/debian/run-project-hooks,
|
||||||
|
postbuild/debian/export-dist
|
28
profiles/pypi-2.8.1.conf
Normal file
28
profiles/pypi-2.8.1.conf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Configuration générale du profil
|
||||||
|
[profile]
|
||||||
|
# Image Docker par défaut
|
||||||
|
default_image=ubuntu:focal
|
||||||
|
|
||||||
|
# Configuration de l'étape de pré-construction du conteneur
|
||||||
|
[containerbuild]
|
||||||
|
hooks=
|
||||||
|
containerbuild/debian/install-build-essential,
|
||||||
|
containerbuild/ubuntu/install-stdeb,
|
||||||
|
|
||||||
|
# Configuration de l'étape de pré-construction du paquet
|
||||||
|
[prebuild]
|
||||||
|
hooks=
|
||||||
|
prebuild/debian/copy-sources-to-workspace,
|
||||||
|
prebuild/debian/run-project-hooks,
|
||||||
|
prebuild/debian/load-project-db,
|
||||||
|
|
||||||
|
# Configuration de l'étape de construction du paquet
|
||||||
|
[build]
|
||||||
|
hooks=build/stdeb/build
|
||||||
|
|
||||||
|
# Configuration de l'étape de post-construction du paquet
|
||||||
|
[postbuild]
|
||||||
|
hooks=
|
||||||
|
postbuild/debian/run-project-hooks,
|
||||||
|
postbuild/debian/export-dist
|
||||||
|
|
Reference in New Issue
Block a user