From 172f84adfd479c65fc45e81d8931a748027ff1d1 Mon Sep 17 00:00:00 2001 From: Simon Leary Date: Fri, 12 Jul 2024 14:13:46 -0400 Subject: [PATCH 1/4] update deb version --- debian/changelog | 7 +++++++ debian/files | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e2598aace..268b31893 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +lmod (8.7.44) unstable; urgency=medium + + * Setting TAG_VERSION to 8.7.44 + + -- Lmod automatic deb changelog script Fri, 12 Jul 2024 11:44:00 -0400 + + lmod (8.7.34) unstable; urgency=medium * Setting TAG_VERSION to 8.7.34 diff --git a/debian/files b/debian/files index 8f0f33588..ff6da6f42 100644 --- a/debian/files +++ b/debian/files @@ -1,2 +1,2 @@ -lmod_8.7.34_all.deb devel optional -lmod_8.7.34_amd64.buildinfo devel optional +lmod_8.7.44_all.deb devel optional +lmod_8.7.44_arm64.buildinfo devel optional From 4382f05f3c82f3accf99d98bacc3e72a890e57cc Mon Sep 17 00:00:00 2001 From: Simon Leary Date: Fri, 12 Jul 2024 14:13:53 -0400 Subject: [PATCH 2/4] rebuild deb docker scripts --- debian/debuild.sh | 55 ++++++++++++++++++++++++++++++++++++ debian/update-version.sh | 38 +++++++++++++++++++++++++ docker/Dockerfile | 53 ----------------------------------- docker/build.sh | 60 ---------------------------------------- 4 files changed, 93 insertions(+), 113 deletions(-) create mode 100755 debian/debuild.sh create mode 100755 debian/update-version.sh delete mode 100644 docker/Dockerfile delete mode 100755 docker/build.sh diff --git a/debian/debuild.sh b/debian/debuild.sh new file mode 100755 index 000000000..94d27c8d8 --- /dev/null +++ b/debian/debuild.sh @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +image_name="debuild-image" +ct_name="lmod-debuild" +repo_dir="$(dirname "$(dirname "$(realpath "$0")")")" +dockerfile_path="$(mktemp)" +output_dir_path="$(mktemp -d)" + +cat >"$dockerfile_path" <<'EOF' +FROM debian:12 + +# Optionally, add incoming to sources.list +#RUN echo 'deb http://incoming.debian.org/debian-buildd buildd-unstable main contrib non-free' > /etc/apt/sources.list.d/incoming.list + +# Add deb-src to sources.list +RUN find /etc/apt/sources.list* -type f -exec sed -i 'p; s/^deb /deb-src /' '{}' + + +# Install developer tools +RUN apt-get update \ + && apt-get install --no-install-recommends -yV \ + apt-utils \ + build-essential \ + devscripts \ + equivs \ + devscripts \ + autoconf \ + automake \ + autopoint \ + autotools-dev \ + debhelper \ + dh-autoreconf \ + dh-strip-nondeterminism \ + dwz \ + libdebhelper-perl \ + libfile-stripnondeterminism-perl \ + libsub-override-perl \ + libtool \ + po-debconf \ + quilt \ + bc + +# recursive copy all files into container. Bind mount can cause unwanted changes in cwd. +COPY . /lmod/src +# install dependencies from the debian control file +RUN mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' /lmod/src/debian/control + +EOF + +cd "$repo_dir" # required for relative path inside dockerfile +docker build . --tag="$image_name" --file="$dockerfile_path" +docker run --name="$ct_name" --workdir="/lmod/src" "$image_name" debuild -us -uc -b +docker cp "$ct_name:/lmod/" "$output_dir_path/" +docker rm "$ct_name" +echo "output files have been copied to \"$output_dir_path\"." diff --git a/debian/update-version.sh b/debian/update-version.sh new file mode 100755 index 000000000..2deccc319 --- /dev/null +++ b/debian/update-version.sh @@ -0,0 +1,38 @@ +#!/bin/bash +set -e + +cd "$(dirname "$(realpath "$0")")" # go to the directory where this script exists + +git fetch --tags +latest_tag="$(git rev-list --tags --max-count=1)" +latest_version="$(git describe --tags "$latest_tag")" +echo "Version is $latest_version" + +if head -n1 ./changelog | grep $latest_version; then + echo "Latest version already in deb changelog. I should not do a thing" + exit 0 +fi + +echo "It's not the latest version. Adding a new tag to changelog" + +### Adding a new changelog entry. Yes, I use ex + +ex ./changelog < $(date -R) + + +. +xit +EOM + +### Adding the filenames to debian/files with correct version + +cat >./files < /etc/apt/sources.list.d/incoming.list - -# Add deb-src to sources.list -RUN find /etc/apt/sources.list* -type f -exec sed -i 'p; s/^deb /deb-src /' '{}' + - -# Install developer tools -RUN apt-get update \ - && apt-get install --no-install-recommends -yV \ - apt-utils \ - build-essential \ - devscripts \ - equivs \ - devscripts \ - autoconf \ - automake \ - autopoint \ - autotools-dev \ - debhelper \ - dh-autoreconf \ - dh-strip-nondeterminism \ - dwz \ - libdebhelper-perl \ - libfile-stripnondeterminism-perl \ - libsub-override-perl \ - libtool \ - po-debconf \ - quilt \ - tcl-dev \ - liblua5.3-dev \ - git \ - nano \ - lua-filesystem \ - lua-json \ - lua-posix \ - lua-term \ - lua5.3 \ - procps \ - bc - - -RUN mkdir /tmp/git-repo; cd /tmp/git-repo ; \ - git clone https://github.com/surak/Lmod.git ; \ - cd Lmod ; \ - git fetch --tags; \ - git checkout tags/8.7.34 ; \ - git checkout origin/debian debian docker ; \ - cd Lmod ; debuild -b -uc -us; \ - cd .. ; dpkg -i ./lmod_8.7.34_all.deb ; \ - bash -c "source /etc/profile.d/lmod.sh; module --version" - diff --git a/docker/build.sh b/docker/build.sh deleted file mode 100755 index d0bb8a500..000000000 --- a/docker/build.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# update master branch, just to keep it up with upstream -git checkout debian -git pull upstream master -git push - -# Get latest tags from upstream. Github UI is not enough -git fetch upstream --tags -git push --tags - -VERSION=$(git describe --tags `git rev-list --tags --max-count=1`) -echo "Version is $VERSION" - -if head -n1 ../debian/changelog | grep $VERSION ; then - echo "Latest version. I should not do a thing" -else - echo "It's not the latest version. Adding a new tag to changelog" - -### Adding a new changelog entry. Yes, I use ex - - ex ../debian/changelog << EOM -1 insert -lmod ($VERSION) unstable; urgency=medium - - * Setting TAG_VERSION to $VERSION - - -- Alexandre Strube $(date -R) - - -. -xit -EOM - -### Adding the filenames to debian/files with correct version - - cat > ../debian/files << EOM -lmod_${VERSION}_all.deb devel optional -lmod_${VERSION}_amd64.buildinfo devel optional -EOM - -### Adding right version to dockerfile . The '' is because of the bsd version of sed. -sed -i '' "s/git checkout tags.*/git checkout tags\/$VERSION \; \\\ /g" Dockerfile -sed -i '' "s/lmod_.*/lmod_${VERSION}_all.deb ; \\\ /g" Dockerfile - -### The container will fetch those from github, so they better be updated -git add ../debian/files ../debian/changelog Dockerfile -git commit -m "Added tag ${VERSION}" -git push - -# Build a docker image, calling Dockerfile from here. It clones this repo, checks out -# the latest tag, builds the debian package inside, creates a container from such -# image, copies the file out and deletes the container (not the image) -docker build -t debian . -docker create --name deb debian -docker cp deb:/tmp/git-repo/lmod_${VERSION}_all.deb . -docker rm deb - -echo "To run this image: docker run --rm -it --name deb debian /bin/bash \nTo cleanup the cache: docker builder prune -a -f " -fi From a51992a5559f1dff5bc7440856c5c36bc1dfcc71 Mon Sep 17 00:00:00 2001 From: Simon Leary Date: Fri, 12 Jul 2024 14:34:59 -0400 Subject: [PATCH 3/4] add comments --- debian/debuild.sh | 2 ++ debian/update-version.sh | 1 + 2 files changed, 3 insertions(+) diff --git a/debian/debuild.sh b/debian/debuild.sh index 94d27c8d8..ce4fd4c11 100755 --- a/debian/debuild.sh +++ b/debian/debuild.sh @@ -1,4 +1,6 @@ #!/bin/bash +# create a debian docker container, build Lmod in that container, copy the build files to +# a new directory, and print the path to that new directory. set -e image_name="debuild-image" diff --git a/debian/update-version.sh b/debian/update-version.sh index 2deccc319..40afa4dba 100755 --- a/debian/update-version.sh +++ b/debian/update-version.sh @@ -1,4 +1,5 @@ #!/bin/bash +# update the debian files based on the latest git tag. set -e cd "$(dirname "$(realpath "$0")")" # go to the directory where this script exists From 205e3f1e533f18ed623376a0e7ea7bb7f8e4a7e8 Mon Sep 17 00:00:00 2001 From: Simon Leary Date: Fri, 12 Jul 2024 15:30:42 -0400 Subject: [PATCH 4/4] require official upstream --- debian/update-version.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/update-version.sh b/debian/update-version.sh index 40afa4dba..aafa4f41e 100755 --- a/debian/update-version.sh +++ b/debian/update-version.sh @@ -4,6 +4,12 @@ set -e cd "$(dirname "$(realpath "$0")")" # go to the directory where this script exists +git remote -v | grep -q -e '^upstream.*TACC/Lmod' || ( + echo "in order to get the latest version number, the official TACC repo must be an upstream." + echo "example: \`git remote add upstream https://github.com/TACC/Lmod.git\`" + exit 1 +) + git fetch --tags latest_tag="$(git rev-list --tags --max-count=1)" latest_version="$(git describe --tags "$latest_tag")"