[Piuparts-devel] [Git][debian/piuparts][develop] 2 commits: Makefile: install html files more reliably

Nicolas Dandrimont (@olasd) gitlab at salsa.debian.org
Tue Aug 20 12:33:45 BST 2024



Nicolas Dandrimont pushed to branch develop at Debian / piuparts


Commits:
e6d41683 by Nicolas Dandrimont at 2024-08-20T13:11:37+02:00
Makefile: install html files more reliably

In the way the current piuparts master setup works, the html files are
already installed, so the directory already exists and build directory
gets copied into a html/build directory. Copy the contents of the build
directory into a pre-created html directory instead.

- - - - -
140ade8f by Nicolas Dandrimont at 2024-08-20T13:13:14+02:00
update-piuparts-*-setup: Clean up install directories from stale files

The lib and share directories would accumulate cruft instead of getting
a clean install. Fix that in the update scripts.

- - - - -


3 changed files:

- Makefile
- update-piuparts-master-setup
- update-piuparts-slave-setup


Changes:

=====================================
Makefile
=====================================
@@ -63,7 +63,7 @@ build-master-stamp:
 
 build-doc: $(DOCS_GENERATED)
 
-docs/build: docs/build
+docs/build:
 	python3 -m sphinx docs/ docs/build/
 
 piuparts.1: docs/piuparts/piuparts.1.txt
@@ -81,9 +81,10 @@ piuparts_slave_stop.8: docs/piuparts_slave_stop/piuparts_slave_stop.8.txt
 install-doc: build-stamp
 	# txt
 	install -d $(DESTDIR)$(docdir)/
+	install -d $(DESTDIR)$(docdir)/html/
 	install -m 0644 docs/README.txt docs/README_server.txt $(DESTDIR)$(docdir)/
 	# html
-	cp -r docs/build/ $(DESTDIR)$(docdir)/html/
+	cp -r docs/build/* $(DESTDIR)$(docdir)/html/
 	# manpages
 	install -d $(DESTDIR)$(man1dir)
 	install -m 0644 piuparts.1 $(DESTDIR)$(man1dir)/


=====================================
update-piuparts-master-setup
=====================================
@@ -1,7 +1,8 @@
-#!/bin/sh
+#!/bin/bash
 set -e
 
 # Copyright 2009-2018 Holger Levsen (holger at layer-acht.org)
+# Copyright 2024 Nicolas Dandrimont (nicolas at dandrimont.eu)
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the
@@ -21,7 +22,7 @@ set -e
 #
 
 
-if [ "`id -n -u`" != "piupartsm" ] ; then
+if [ "$(id -n -u)" != "piupartsm" ] ; then
         echo please run this script as piupartsm user
         exit 1
 fi
@@ -69,11 +70,38 @@ fi
 make clean
 make		prefix=$PIUPARTS_PREFIX \
 		build-master build-doc
+
+stamp="$(date "+%Y%m%dT%H%M%S")"
+install_dirs=("$PIUPARTS_HTDOCS/doc" "$PIUPARTS_PREFIX/share/piuparts" "$PIUPARTS_PREFIX/lib/piuparts")
+
+# Clean up directories that should only contain installed files
+for dir in "${install_dirs[@]}"; do
+	if [ -d "$dir" ]; then
+		mv "$dir" "$dir.$stamp"
+	fi
+done
+
+restore_dirs () {
+	for dir in "${install_dirs[@]}"; do
+		if [ -d "$dir" ]; then
+			rm -r "$dir"
+		fi
+		mv "$dir.$stamp" "$dir"
+	done
+}
+
+cleanup_dirs () {
+	for dir in "${install_dirs[@]}"; do
+		rm -rf "$dir.$stamp"
+	done
+}
+
 make		prefix=$PIUPARTS_PREFIX \
 		docdir=$PIUPARTS_HTDOCS/doc \
 		htdocsdir=$PIUPARTS_HTDOCS \
-		install-master install-doc install-conf-4-running-from-git
+		install-master install-doc install-conf-4-running-from-git || restore_dirs
 make clean
+cleanup_dirs
 
 #
 # install copies of the weather icons


=====================================
update-piuparts-slave-setup
=====================================
@@ -1,7 +1,8 @@
-#!/bin/sh
+#!/bin/bash
 set -e
 
 # Copyright 2009-2018 Holger Levsen (holger at layer-acht.org)
+# Copyright 2024 Nicolas Dandrimont (nicolas at dandrimont.eu)
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the
@@ -21,7 +22,7 @@ set -e
 #
 
 
-if [ "`id -n -u`" != "piupartss" ] ; then
+if [ "$(id -n -u)" != "piupartss" ] ; then
         echo please run this script as piupartss user
         exit 1
 fi
@@ -69,11 +70,38 @@ fi
 make clean
 make		prefix=$PIUPARTS_PREFIX \
 		build-slave build-doc
+
+stamp="$(date "+%Y%m%dT%H%M%S")"
+install_dirs=("$PIUPARTS_HTDOCS/doc" "$PIUPARTS_PREFIX/share/piuparts" "$PIUPARTS_PREFIX/lib/piuparts")
+
+# Clean up directories that should only contain installed files
+for dir in "${install_dirs[@]}"; do
+	if [ -d "$dir" ]; then
+		mv "$dir" "$dir.$stamp"
+	fi
+done
+
+restore_dirs () {
+	for dir in "${install_dirs[@]}"; do
+		if [ -d "$dir" ]; then
+			rm -r "$dir"
+		fi
+		mv "$dir.$stamp" "$dir"
+	done
+}
+
+cleanup_dirs () {
+	for dir in "${install_dirs[@]}"; do
+		rm -rf "$dir.$stamp"
+	done
+}
+
 make		prefix=$PIUPARTS_PREFIX \
 		docdir=$PIUPARTS_HTDOCS/doc \
 		htdocsdir=$PIUPARTS_HTDOCS \
-		install-slave install-doc install-conf-4-running-from-git
+		install-slave install-doc install-conf-4-running-from-git || restore_dirs
 make clean
+cleanup_dirs
 
 #
 # update $PIUPARTS_PREFIX



View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/0ac729bff52d3b77feff59c8ac478a57d8fad47d...140ade8f98d0f3bcbf2dc30330cec5c456d4d3be

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/-/compare/0ac729bff52d3b77feff59c8ac478a57d8fad47d...140ade8f98d0f3bcbf2dc30330cec5c456d4d3be
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20240820/dcd3d680/attachment-0001.htm>


More information about the Piuparts-devel mailing list