aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Labastie <pierre.labastie@neuf.fr>2021-09-01 11:08:49 +0200
committerPierre Labastie <pierre.labastie@neuf.fr>2021-09-01 11:08:49 +0200
commitbd90b9b7476860532e8ee3d8e16bc848846e1f5d (patch)
tree96f1dc4f9cdcee2bf13a0174ba7c2abc3c47a4d9
parent3443abb60a3ad31e0c3058f9ad55e859d6f25cab (diff)
Add a conditional entity for sysv/systemd
This removes the need for versiond, and other xxxd entities. Those entities will be removed in the next commits.
-rw-r--r--.gitignore1
-rw-r--r--Makefile2
-rw-r--r--general.ent27
-rwxr-xr-xgit-version.sh30
4 files changed, 47 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index e5fb52276..0d2478625 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
lfs-bootscripts-*.tar.xz
+conditional.ent
version.ent
appendices/*.script
diff --git a/Makefile b/Makefile
index be9c522f3..f4a74e67a 100644
--- a/Makefile
+++ b/Makefile
@@ -189,7 +189,7 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
$(BASEDIR)/md5sums
version:
- $(Q)./git-version.sh
+ $(Q)./git-version.sh $(REV)
#dump-commands: validate
# @echo "Dumping book commands..."
diff --git a/general.ent b/general.ent
index 4c7e25795..fb8e9e79b 100644
--- a/general.ent
+++ b/general.ent
@@ -1,29 +1,40 @@
+<!-- Automatically generated by git-version.sh -->
+<!ENTITY % conditional-entities SYSTEM "conditional.ent">
+%conditional-entities;
+
<!-- version info automatically generated by git
- comment the following two lines for release -->
+ comment out the following two lines for release -->
<!ENTITY % version-entities SYSTEM "version.ent">
%version-entities;
<!-- uncomment and edit the following four lines
for releases (including -rc) -->
<!--
+<![ %sysv; [
<!ENTITY version "10.2-rc1">
-<!ENTITY versiond "10.2-systemd-rc1">
+]]>
+<![ %systemd; [
+<!ENTITY version "10.2-systemd-rc1">
+]]>
<!ENTITY releasedate "August 26th, 2021">
<!ENTITY copyrightdate "1999-2021">
-->
<!-- jhalfs needs a literal dash, not &ndash; -->
+<![ %sysv; [
<!ENTITY short-version "svn"> <!-- Used below in &blfs-book;
Change to x.y for release but not -rc releases -->
<!ENTITY generic-version "development"> <!-- Use "development" or "x.y[-pre{x}]" -->
-
-<!ENTITY short-versiond "systemd"> <!--Change to stable-systemd for release -->
-<!ENTITY generic-versiond "systemd">
+]]>
+<![ %systemd; [
+<!ENTITY short-version "systemd"> <!--Change to stable-systemd for release -->
+<!ENTITY generic-version "systemd">
+]]>
<!ENTITY lfs-root "https://www.linuxfromscratch.org/">
<!ENTITY blfs-root "&lfs-root;blfs/">
<!ENTITY blfs-book "&blfs-root;view/&short-version;/">
-<!ENTITY blfs-systemd-book "&blfs-root;view/&short-versiond;/">
+<!ENTITY blfs-book "&blfs-root;view/&short-version;/">
<!ENTITY faq-root "&lfs-root;faq/">
<!ENTITY hints-root "&lfs-root;hints/downloads/files/">
<!ENTITY hints-index "&lfs-root;hints/list.html">
@@ -34,12 +45,12 @@
<!ENTITY errata "&lfs-root;lfs/errata/&generic-version;/">
<!ENTITY secadv "&lfs-root;lfs/advisories/">
<!ENTITY min-kernel "3.2">
-
+<!--
<!ENTITY patches-rootd "&lfs-root;patches/lfs/&generic-versiond;/">
<!ENTITY downloads-rootd "&lfs-root;lfs/downloads/&generic-versiond;/">
<!ENTITY test-resultsd "&lfs-root;lfs/build-logs/&generic-versiond;/">
<!ENTITY erratad "&lfs-root;lfs/errata/&generic-versiond;/">
-
+-->
<!ENTITY lfs-ticket-root "https://wiki.linuxfromscratch.org/lfs/ticket/">
<!ENTITY anduin-sources "https://anduin.linuxfromscratch.org/LFS">
diff --git a/git-version.sh b/git-version.sh
index ff0eb6cdd..8f5cdb33b 100755
--- a/git-version.sh
+++ b/git-version.sh
@@ -1,10 +1,28 @@
#!/bin/sh
+if [ "$1" = sysv ]; then
+ SYSV="INCLUDE"
+ SYSTEMD="IGNORE "
+elif [ "$1" = systemd ]; then
+ SYSV="IGNORE "
+ SYSTEMD="INCLUDE"
+else
+ echo You must provide either \"sysv\" or \"systemd\" as argument
+ exit 1
+fi
+
+echo "<!ENTITY % sysv \"$SYSV\">" > conditional.ent
+echo "<!ENTITY % systemd \"$SYSTEMD\">" >> conditional.ent
+
if ! git status > /dev/null; then
# Either it's not a git repository, or git is unavaliable.
# Just workaround.
- echo "<!ENTITY version \"unknown\">" > version.ent
- echo "<!ENTITY versiond \"unknown-systemd\">" >> version.ent
+ echo "<![ %sysv; [" > version.ent
+ echo "<!ENTITY version \"unknown\">" >> version.ent
+ echo "]]>" >> version.ent
+ echo "<![ %systemd; [" >> version.ent
+ echo "<!ENTITY version \"unknown-systemd\">" >> version.ent
+ echo "]]>" >> version.ent
echo "<!ENTITY releasedate \"unknown\">" >> version.ent
echo "<!ENTITY copyrightdate \"1999-2021\">" >> version.ent
exit 0
@@ -41,7 +59,11 @@ if [ "$(git diff HEAD | wc -l)" != "0" ]; then
versiond="$versiond+"
fi
-echo "<!ENTITY version \"$version\">" > version.ent
-echo "<!ENTITY versiond \"$versiond\">" >> version.ent
+echo "<![ %sysv; [" > version.ent
+echo "<!ENTITY version \"$version\">" >> version.ent
+echo "]]>" >> version.ent
+echo "<![ %systemd; [" >> version.ent
+echo "<!ENTITY version \"$versiond\">" >> version.ent
+echo "]]>" >> version.ent
echo "<!ENTITY releasedate \"$full_date\">" >> version.ent
echo "<!ENTITY copyrightdate \"1999-$year\">" >> version.ent