commit: a6bcc350bf37e4f0e248444839657ad3d142d1ba
Author: Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 23 12:47:04 2023 +0000
Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Thu Mar 23 12:51:31 2023 +0000
URL: https://gitweb.gentoo.org/data/api.git/commit/?id=a6bcc350
mirrors: check XML formatting
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
Makefile | 11 +++++++++--
files/mirrors/.gitignore | 2 ++
files/mirrors/Makefile | 25 +++++++++++++++++++++++++
files/mirrors/distfiles.xml | 3 ++-
files/mirrors/rsync.xml | 1 +
5 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 369236e..ee2feab 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,10 @@
.PHONY: check
-check:
- $(MAKE) -C files/overlays $@
+check: check-overlays check-mirrors
+
+.PHONY: check-overlays
+check-overlays:
+ $(MAKE) -C files/overlays check
+
+.PHONY: check-mirrors
+check-mirrors:
+ $(MAKE) -C files/mirrors check
diff --git a/files/mirrors/.gitignore b/files/mirrors/.gitignore
new file mode 100644
index 0000000..df8ee85
--- /dev/null
+++ b/files/mirrors/.gitignore
@@ -0,0 +1,2 @@
+*.expected-format.xml
+*.expected-format.xml.ok
diff --git a/files/mirrors/Makefile b/files/mirrors/Makefile
new file mode 100644
index 0000000..3aebd33
--- /dev/null
+++ b/files/mirrors/Makefile
@@ -0,0 +1,25 @@
+.%.expected-format.xml: %.xml
+ xmlstarlet fo --encode utf-8 $^ > $@
+
+.ONESHELL:
+.%.expected-format.xml.ok: SHELL = /bin/bash
+.%.expected-format.xml.ok: .%.expected-format.xml
+ if ! cmp -s $*.xml $^; then
+ diff -u $*.xml $^
+ exit 1
+ fi
+ touch $@
+
+.PHONY: check
+check: .distfiles.expected-format.xml.ok .rsync.expected-format.xml.ok
+
+.PHONY: format
+.ONESHELL:
+format: SHELL = /bin/bash
+format:.distfiles.expected-format.xml .rsync.expected-format.xml
+ for FILE in distfiles rsync; do
+ if cmp -s "$${FILE}.xml" ".$${FILE}.expected-format.xml"; then
+ continue
+ fi
+ cp ".$${FILE}.expected-format.xml" "$${FILE}.xml"
+ done
diff --git a/files/mirrors/distfiles.xml b/files/mirrors/distfiles.xml
index 9d71165..1e6c755 100644
--- a/files/mirrors/distfiles.xml
+++ b/files/mirrors/distfiles.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
vim: ft=xml et ts=2 sts=2 sw=2:
-->
@@ -348,7 +349,7 @@ vim: ft=xml et ts=2 sts=2 sw=2:
</mirror>
<mirror>
<name>Get Hosted online</name>
- <uri protocol="ftp" ipv4="y" ipv6="n"
partial="n">ftp://mirrors.gethosted.online/gentoo</uri>
+ <uri protocol="ftp" ipv4="y" ipv6="n"
partial="n">ftp://mirrors.gethosted.online/gentoo</uri>
<uri protocol="http" ipv4="y" ipv6="n"
partial="n">https://mirrors.gethosted.online/gentoo</uri>
<uri protocol="http" ipv4="y" ipv6="n"
partial="n">http://mirrors.gethosted.online/gentoo</uri>
</mirror>
diff --git a/files/mirrors/rsync.xml b/files/mirrors/rsync.xml
index f6b0039..b285825 100644
--- a/files/mirrors/rsync.xml
+++ b/files/mirrors/rsync.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!--
vim: ft=xml et ts=2 sts=2 sw=2:
-->