[librsvg: 4/7] Update readme and fix typos Also adjust the docker files for the systems to install correctly




commit 8a9997391e06fd667a1e93f0fcf34ce7c65ec6f3
Author: Madds H <madds hollandart io>
Date:   Mon Aug 23 21:10:02 2021 -0500

    Update readme and fix typos
    Also adjust the docker files for the systems to install correctly
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/579>

 tools/docker/README.md                      | 28 +++++++++++++++++++++-------
 tools/docker/docker-test.sh                 | 28 +++++++++++++++++++++++++---
 tools/docker/librsvg-base/debian/Dockerfile |  2 +-
 tools/docker/librsvg-base/fedora/Dockerfile |  2 +-
 4 files changed, 48 insertions(+), 12 deletions(-)
---
diff --git a/tools/docker/README.md b/tools/docker/README.md
index 70a8ef68..bce12ac6 100644
--- a/tools/docker/README.md
+++ b/tools/docker/README.md
@@ -1,10 +1,12 @@
-### Librsvg Docker Tests
+## Librsvg Docker Tests
 
 Run the librsvg test suite inside a docker container. Run the script from within this directory. The Librsvg 
CI runs on opensuse, so this is a simple-ish way to run the test suite locally on the same packages that are 
used by the Gitlab integration. 
 
 The build-librsvg.sh script is used internally by the docker-test.sh script, do not run it by itself. (It's 
not harmful but can unexpectedly modify some files in your tmp directory.)
 
-Usage:
+Docker requires root for nearly all of its commands so the script will ask for root. 
+
+### Usage:
 ```
 This tool lets you run Librsvg's test suite under a couple different docker containers for testing, it 
requires sudo privleges, which it will ask for in the terminal (this is by the docker commands, which require 
root)
 
@@ -17,26 +19,38 @@ use -p to repackage the librsvg image (use in conjunction with -r otherwise the
 use -t to specify a temporary directory (default: /tmp/librsvg)
 ```
 
-Example:
+### Example:
 ```
 If the librsvg folder is in your home directory:
 ./docker-test.sh -d ~/librsvg -s opensuse -i 
 
-This will run it pointing at /home/Username/librsvg with opensuse tumbleweed docker image, and interactive, 
meaning it pauses and has the user input a keystroke before continuing, useful for debugging. 
+This will run it pointing at /home/Username/librsvg (-d) with opensuse tumbleweed docker image (-s), and 
interactive (-i), meaning it pauses and has the user input a keystroke before continuing, useful for 
debugging or catching typos. 
+
+The first run will take some time as Docker downloads and installs the system, updates the packages, and 
installs the build requirements, but it's set up so that it won't re-download the system image each time, 
which takes more disk space but saves on bandwidth.
 ```
 
 
-Cleanup:
+### Cleanup:
 ```
 To do a full cleanup of the docker images:
 ./docker-test.sh -c
 This requires user input
 
-I would then suggest either manually rm -r the temp directory you're using (if different than default) or 
restarting your system to clear out /tmp
+This asks if it should also clear out the tmp directory passed to it, or the default one. It checks if "/" 
is passed to it, so it shouldn't delete your system. If you answer "no" to clearing out the tmp directory, 
the files will not be deleted. 
 
 Also:
 docker image prune
+docker container prune
+
+This removes any dangling (not attached to an tagged image) docker images and containers. I would recommend 
running it once in a while, or you may end up with 100gb of docker containers like me, don't be like me. 
(disclaimer: I have also been testing all of this so there's been a lot of mishaps and learning)
 
-removes any dangling (not attached to an tagged image) docker containers
+This tool should use ~3gb of disk space for running the tests with the opensuse image alone. 
+If all 3 systems are tested, the disk usage goes up to ~9gb
+
+See your disk usage with:
+docker system df
 ```
 
+### How does this tool work?
+
+
diff --git a/tools/docker/docker-test.sh b/tools/docker/docker-test.sh
index 661f7abd..c4fc6dc5 100755
--- a/tools/docker/docker-test.sh
+++ b/tools/docker/docker-test.sh
@@ -32,7 +32,7 @@ function prepare_librsvg {
 
        if [[ ! -f "$SYS/librsvg.tar.gz" ]]
        then
-               if [[! $REPACKAGE == false]] 
+               if [[ $REPACKAGE == false ]] 
                then
                        if [[ $INT == true ]]
                        then
@@ -88,7 +88,7 @@ function build_system_image {
 #removes the system image and rebuilds it, this doesn't touch the system images
 function rebuild_docker {
        echo "removing old image"
-       sudo docker rmi librsvg/librsvg-$SYS
+       sudo docker rmi --force librsvg/librsvg-$SYS
        sudo docker build -t librsvg/librsvg-$SYS --no-cache -f $SYS/Dockerfile $SYS/.
 }
 
@@ -118,11 +118,19 @@ function remove_system_image {
        sudo docker rmi --force librsvg/librsvg-base-$SYS
 }
 
+#removes the librsvg image
 function remove_librsvg_image {
        echo "removing librsvg image librsvg-$SYS"
        sudo docker rmi --force librsvg/librsvg-$SYS
 }
 
+function remove_distro_image {
+       echo "removing base system images"
+       sudo docker rmi --force debian
+       sudo docker rmi --force opensuse/tumbleweed
+       sudo docker rmi --force fedora
+}
+
 function cleanup {
        if [[ $CLEANUP == true ]]
        then
@@ -138,11 +146,14 @@ function cleanup {
                rm $SYS/librsvg.tar.gz
                rm $SYS/build-librsvg.sh
                SYS=debian
-               emove_librsvg_image
+               remove_librsvg_image
                remove_system_image
                rm $SYS/librsvg.tar.gz
                rm $SYS/build-rsvg.sh
 
+               confirm_rm_distro
+               remove_distro_image
+
                confirm_rm_dir
                if [[ "$TMPDIR" == "/" ]] 
                then
@@ -171,6 +182,7 @@ function confirm {
                esac
        done
 }
+
 function confirm_rm_dir {
        echo "Would you like to also remove the librsvg files from the tmp directory: $TMPDIR"
        select yn in "Yes" "No"; do
@@ -181,6 +193,16 @@ function confirm_rm_dir {
        done
 }
 
+function confirm_rm_distro {
+       echo "Would you like to remove the base system images ie. opensuse (do this if you don't plan to 
build librsvg with this tool in the future, otherwise keep them, it takes a while to build)"
+       select yn in "Yes" "No"; do
+       case $yn in
+           Yes ) break;;
+           No ) exit 1;;
+               esac
+       done
+}
+
 #runs the built docker image, this runs build_librsvg.sh automatically attached to the console
 function run_docker {
        sudo docker run -it librsvg/librsvg-$SYS
diff --git a/tools/docker/librsvg-base/debian/Dockerfile b/tools/docker/librsvg-base/debian/Dockerfile
index bfe91add..7eba8ad6 100644
--- a/tools/docker/librsvg-base/debian/Dockerfile
+++ b/tools/docker/librsvg-base/debian/Dockerfile
@@ -1,6 +1,6 @@
 FROM debian:testing
 MAINTAINER librsvg
-RUN apt-get update && apt-get install -y gcc make rustc cargo \
+RUN apt-get update && apt-get upgrade -y && apt-get install -y gcc make rustc cargo \
 automake autoconf libtool gtk-doc-tools git \
 libgdk-pixbuf2.0-dev libgirepository1.0-dev \
 libxml2-dev libcairo2-dev libpango1.0-dev
\ No newline at end of file
diff --git a/tools/docker/librsvg-base/fedora/Dockerfile b/tools/docker/librsvg-base/fedora/Dockerfile
index fd526ba4..62a5b752 100644
--- a/tools/docker/librsvg-base/fedora/Dockerfile
+++ b/tools/docker/librsvg-base/fedora/Dockerfile
@@ -1,6 +1,6 @@
 FROM fedora
 MAINTAINER librsvg
-RUN dnf update && dnf install -y gcc rust rust-std-static cargo make \
+RUN dnf update -y && dnf install -y gcc rust rust-std-static cargo make \
 automake autoconf libtool gtk-doc git redhat-rpm-config \
 gdk-pixbuf2-devel gobject-introspection-devel \
 libxml2-devel cairo-devel cairo-gobject-devel pango-devel


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]