Skip to content
Snippets Groups Projects
Commit 9640c1ab authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[dev] add script to quickly produce Docker images from current dev

parent ff3926bd
No related branches found
No related tags found
No related merge requests found
...@@ -88,6 +88,10 @@ custom.% custom-gui.% custom-stripped.%: ...@@ -88,6 +88,10 @@ custom.% custom-gui.% custom-stripped.%:
exit 1 exit 1
else else
BUILD_ARGS += --build-arg=from_archive=$(FRAMAC_ARCHIVE) BUILD_ARGS += --build-arg=from_archive=$(FRAMAC_ARCHIVE)
custom-fast.%: $(DEPS)
cp ../../reference-configuration.md .
$(DOCKER) build . -t frama-c-$@ $(BUILD_ARGS) --target frama-c
custom.%: $(DEPS) custom.%: $(DEPS)
cp ../../reference-configuration.md . cp ../../reference-configuration.md .
$(DOCKER) build . -t frama-c-$@ $(BUILD_ARGS) --target frama-c-slim $(DOCKER) build . -t frama-c-$@ $(BUILD_ARGS) --target frama-c-slim
......
#!/usr/bin/bash -eu
##########################################################################
# #
# This file is part of Frama-C. #
# #
# Copyright (C) 2007-2024 #
# CEA (Commissariat à l'énergie atomique et aux énergies #
# alternatives) #
# #
# you can redistribute it and/or modify it under the terms of the GNU #
# Lesser General Public License as published by the Free Software #
# Foundation, version 2.1. #
# #
# It 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 Lesser General Public License for more details. #
# #
# See the GNU Lesser General Public License version 2.1 #
# for more details (enclosed in the file licenses/LGPLv2.1). #
# #
##########################################################################
# Script used to quickly generate a Frama-C Docker image based on the
# current state of the repository
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$SCRIPT_DIR/../"
USE_STASH=yes dev/make-distrib.sh
mv "frama-c-current.tar.gz" "$SCRIPT_DIR/docker/frama-c-current.tar.gz"
cd "$SCRIPT_DIR/docker"
FRAMAC_ARCHIVE="frama-c-current.tar.gz" make custom-fast.debian
if command -v podman 2>&1; then
DOCKER=podman
else
DOCKER=docker
fi
"$DOCKER" tag frama-c-custom-fast.debian frama-c-current
echo "Created Docker image: frama-c-current"
...@@ -82,6 +82,7 @@ do ...@@ -82,6 +82,7 @@ do
echo " VERSION_CODENAME=<name> (overriden by --codename)" echo " VERSION_CODENAME=<name> (overriden by --codename)"
echo " OPEN_SOURCE=yes|no (overriden by --open-source and --closed-source)" echo " OPEN_SOURCE=yes|no (overriden by --open-source and --closed-source)"
echo " CI_LINK=yes|no (also set by --ci-link)" echo " CI_LINK=yes|no (also set by --ci-link)"
echo " USE_STASH=yes|no (default: no)"
echo "" echo ""
exit 0 exit 0
;; ;;
...@@ -117,7 +118,11 @@ VERSION=$(cat VERSION) ...@@ -117,7 +118,11 @@ VERSION=$(cat VERSION)
VERSION_SAFE=${VERSION/~/-} VERSION_SAFE=${VERSION/~/-}
FRAMAC="frama-c-$VERSION_SAFE-$VERSION_CODENAME" FRAMAC="frama-c-$VERSION_SAFE-$VERSION_CODENAME"
FRAMAC_TAR="$FRAMAC.tar" if [ "$USE_STASH" == "yes" ]; then
FRAMAC_TAR="frama-c-current.tar"
else
FRAMAC_TAR="$FRAMAC.tar"
fi
################################################################################ ################################################################################
# Check Opam file # Check Opam file
...@@ -164,7 +169,7 @@ echo "----------------------------------------------------------------" ...@@ -164,7 +169,7 @@ echo "----------------------------------------------------------------"
# Warn if there are uncommitted changes (will not be taken into account) # Warn if there are uncommitted changes (will not be taken into account)
GIT_STATUS="$(git status --porcelain -- $(sed 's/^./:!&/' <<< $EXTERNAL_PLUGINS))" GIT_STATUS="$(git status --porcelain -- $(sed 's/^./:!&/' <<< $EXTERNAL_PLUGINS))"
if [ "" != "$GIT_STATUS" ]; then if [ "" != "$GIT_STATUS" -a "$USE_STASH" != "yes" ]; then
echo "WARNING: uncommitted changes will be IGNORED when making archive:" echo "WARNING: uncommitted changes will be IGNORED when making archive:"
echo "$GIT_STATUS" | sed 's/^/ /' echo "$GIT_STATUS" | sed 's/^/ /'
echo "----------------------------------------------------------------" echo "----------------------------------------------------------------"
...@@ -173,7 +178,12 @@ fi ...@@ -173,7 +178,12 @@ fi
################################################################################ ################################################################################
# Prepare Archive # Prepare Archive
git archive HEAD -o $FRAMAC_TAR --prefix "$FRAMAC/" # For the "instant Docker image" script: allow inclusion of uncommitted changes
if [ "$USE_STASH" == "yes" ]; then
ARCHIVE_COMMIT=$(git stash create)
fi
git archive ${ARCHIVE_COMMIT:-HEAD} -o $FRAMAC_TAR --prefix "$FRAMAC/"
################################################################################ ################################################################################
# Add external plugin to archive # Add external plugin to archive
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment