Fix package management for new book, and add a patch for porg

This commit is contained in:
Pierre Labastie 2020-06-24 06:26:05 +00:00
parent 13e52a5572
commit 49f8b03399
3 changed files with 168 additions and 35 deletions

View file

@ -143,28 +143,6 @@ otherwise it is in /bin.-->
</xsl:if> </xsl:if>
<xsl:value-of select="$position"/> <xsl:value-of select="$position"/>
</xsl:variable> </xsl:variable>
<!-- Inclusion of package manager scriptlets -->
<xsl:if test="@id='ch-tools-stripping' and
$pkgmngt='y' and
$bashdir='/tools'">
<xsl:apply-templates
select="document('packageManager.xml')//sect1[contains(@id,'ch-tools')]"
mode="pkgmngt">
<xsl:with-param name="order" select="$order"/>
<xsl:with-param name="dirname" select="$dirname"/>
</xsl:apply-templates>
</xsl:if>
<xsl:if test="@id='ch-system-strippingagain' and
$pkgmngt='y' and
$bashdir='/tools'">
<xsl:apply-templates
select="document('packageManager.xml')//sect1[
contains(@id,'ch-system')]"
mode="pkgmngt">
<xsl:with-param name="order" select="$order"/>
<xsl:with-param name="dirname" select="$dirname"/>
</xsl:apply-templates>
</xsl:if>
<!-- Creating dirs and files --> <!-- Creating dirs and files -->
<exsl:document href="{$dirname}/{$order}-{$filename}" method="text"> <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
<xsl:text>#!</xsl:text> <xsl:text>#!</xsl:text>
@ -187,14 +165,16 @@ otherwise it is in /bin.-->
<xsl:apply-templates <xsl:apply-templates
select="sect2 | select="sect2 |
screen[not(@role) or @role!='nodump']/userinput"/> screen[not(@role) or @role!='nodump']/userinput"/>
<xsl:if test="@id='ch-system-creatingdirs' and $pkgmngt='y'"> <xsl:if test="contains(@id,'creatingdirs') and $pkgmngt='y'">
<xsl:apply-templates <xsl:apply-templates
select="document('packageManager.xml')//sect1[ select="document('packageManager.xml')//sect1[
@id='ch-pkgmngt-creatingdirs' @id='ch-pkgmngt-creatingdirs'
]//userinput" ]//userinput"
mode="pkgmngt"/> mode="pkgmngt"/>
</xsl:if> </xsl:if>
<xsl:if test="@id='ch-system-createfiles' and $pkgmngt='y'"> <xsl:if test="contains(@id,'createfiles')
and $pkgmngt='y'
and $bashdir='/tools'">
<xsl:apply-templates <xsl:apply-templates
select="document('packageManager.xml')//sect1[ select="document('packageManager.xml')//sect1[
@id='ch-pkgmngt-createfiles' @id='ch-pkgmngt-createfiles'
@ -207,6 +187,40 @@ otherwise it is in /bin.-->
</xsl:if> </xsl:if>
<xsl:text>exit&#xA;</xsl:text> <xsl:text>exit&#xA;</xsl:text>
</exsl:document> </exsl:document>
<!-- Inclusion of package manager scriptlets -->
<xsl:if test="$pkgmngt='y' and
following-sibling::sect1[1][@id='ch-tools-stripping']">
<xsl:choose>
<xsl:when test="$bashdir='/tools'">
<xsl:apply-templates
select="document('packageManager.xml')//sect1[
contains(@id,'ch-tools')]"
mode="pkgmngt">
<xsl:with-param name="order" select="$order+1"/>
<xsl:with-param name="dirname" select="$dirname"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates
select="document('packageManager.xml')//sect1[
contains(@id,'ch-chroot')]"
mode="pkgmngt">
<xsl:with-param name="order" select="$order+1"/>
<xsl:with-param name="dirname" select="$dirname"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:if test="$pkgmngt='y' and
following-sibling::sect1[2][@id='ch-system-strippingagain']">
<xsl:apply-templates
select="document('packageManager.xml')//sect1[
contains(@id,'ch-system')]"
mode="pkgmngt">
<xsl:with-param name="order" select="$order+1"/>
<xsl:with-param name="dirname" select="$dirname"/>
</xsl:apply-templates>
</xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="sect2"> <xsl:template match="sect2">
@ -219,7 +233,9 @@ otherwise it is in /bin.-->
not(current()/../@id='ch-tools-dejagnu') and not(current()/../@id='ch-tools-dejagnu') and
not(current()/../@id='ch-system-systemd')]"/> not(current()/../@id='ch-system-systemd')]"/>
<xsl:if <xsl:if
test="ancestor::chapter[@id != 'chapter-temporary-tools'] and test="ancestor::chapter[@id = 'chapter-building-system' or
@id = 'chapter-config' or
@id = 'chapter-bootable'] and
$pkgmngt = 'y' and $pkgmngt = 'y' and
descendant::screen[not(@role) or descendant::screen[not(@role) or
@role != 'nodump']/userinput[ @role != 'nodump']/userinput[
@ -246,7 +262,9 @@ esac
<xsl:apply-templates <xsl:apply-templates
select=".//screen[not(@role) or @role != 'nodump']/ select=".//screen[not(@role) or @role != 'nodump']/
userinput[@remap = 'install']"/> userinput[@remap = 'install']"/>
<xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and <xsl:if test="ancestor::chapter[@id = 'chapter-building-system' or
@id = 'chapter-config' or
@id = 'chapter-bootable'] and
descendant::screen[not(@role) or descendant::screen[not(@role) or
@role != 'nodump']/userinput[ @role != 'nodump']/userinput[
@remap='install']"> @remap='install']">
@ -367,7 +385,7 @@ set -e
select=".//screen[not(@role) or select=".//screen[not(@role) or
@role != 'nodump']/userinput[@remap != 'adjust']" @role != 'nodump']/userinput[@remap != 'adjust']"
mode="pkgmngt"/> mode="pkgmngt"/>
<xsl:if test="$dirname = 'chapter06'"> <xsl:if test="$dirname = 'chapter06' or $dirname = 'chapter08'">
<xsl:text>PREV_SEC=${SECONDS} <xsl:text>PREV_SEC=${SECONDS}
packInstall packInstall
SECONDS=${PREV_SEC} SECONDS=${PREV_SEC}
@ -1216,8 +1234,12 @@ PACKAGE=</xsl:text>
<xsl:call-template name="basename"> <xsl:call-template name="basename">
<xsl:with-param name="path" select=".//sect1info/address/text()"/> <xsl:with-param name="path" select=".//sect1info/address/text()"/>
</xsl:call-template> </xsl:call-template>
<xsl:if test = "( ../@id != 'chapter-temporary-tools' or <xsl:if test = "( ../@id = 'chapter-building-system' or
starts-with(@id,'ch-system') ) and $pkgmngt = 'y'"> ../@id = 'chapter-config' or
../@id = 'chapter-bootable' or
starts-with(@id,'ch-system') ) and $pkgmngt = 'y'">
<!-- the last alternative for old books where some sections in
chapter-config had ch-system -->
<xsl:text> <xsl:text>
source ${ROOT}${SCRIPT_ROOT}/packInstall.sh source ${ROOT}${SCRIPT_ROOT}/packInstall.sh
export -f packInstall</xsl:text> export -f packInstall</xsl:text>

View file

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- $Id$ -->
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY porg-version "0.10"> <!ENTITY porg-version "0.10">
<!ENTITY porg-url "https://sourceforge.net/projects/porg/files/porg-&porg-version;.tar.gz"> <!ENTITY porg-url "https://sourceforge.net/projects/porg/files/porg-&porg-version;.tar.gz">
<!ENTITY porg-md5 "2eceb8a73bb188dbb06b12d90cabdbb4"> <!ENTITY porg-md5 "2eceb8a73bb188dbb06b12d90cabdbb4">
<!ENTITY porg-patch-url "http://www.linuxfromscratch.org/patches/downloads/porg/porg-0.10-renameat2-1.patch">
<!ENTITY porg-patch-md5 "cfc72c817d98902afeaf225f22b8e653">
]> ]>
<article> <article>
@ -14,6 +15,12 @@
<para>Download: <ulink url="&porg-url;"/></para> <para>Download: <ulink url="&porg-url;"/></para>
<para>MD5 sum: <literal>&porg-md5;</literal></para> <para>MD5 sum: <literal>&porg-md5;</literal></para>
</sect1> </sect1>
<sect1 id="patches">
<title>Package Information</title>
<para>Download: <ulink url="&porg-patch-url;"/></para>
<para>MD5 sum: <literal>&porg-patch-md5;</literal></para>
</sect1>
<sect1 id="ch-tools-pkgmngt" role="wrap"> <sect1 id="ch-tools-pkgmngt" role="wrap">
<?dbhtml filename="porg.html"?> <?dbhtml filename="porg.html"?>
@ -27,6 +34,7 @@
<title>Porg in tools</title> <title>Porg in tools</title>
<sect2 role="installation"> <sect2 role="installation">
<title>Instructions</title> <title>Instructions</title>
<screen><userinput remap="pre">patch -Np1 -i ../porg-0.10-renameat2-1.patch</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/tools \ <screen><userinput remap="configure">./configure --prefix=/tools \
--disable-grop \ --disable-grop \
--with-porg-logdir=/tools/var/porg</userinput></screen> --with-porg-logdir=/tools/var/porg</userinput></screen>
@ -69,6 +77,38 @@ mkdir -pv /var/lib/packages</userinput></screen>
<screen><userinput>cp /tools/etc/porgrc /etc</userinput></screen> <screen><userinput>cp /tools/etc/porgrc /etc</userinput></screen>
</sect1> </sect1>
<sect1 id="ch-chroot-pkgmngt" role="wrap">
<?dbhtml filename="porg.html"?>
<sect1info condition="script">
<productname>porg</productname>
<productnumber>&porg-version;</productnumber>
<address>&porg-url;</address>
</sect1info>
<title>Temporary Porg</title>
<sect2 role="installation">
<title>Instructions</title>
<screen><userinput remap="pre">patch -Np1 -i ../porg-0.10-renameat2-1.patch</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--disable-grop \
--sysconfdir=/etc \
--with-porg-logdir=/var/lib/porg</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install
mkdir -p /usr/share/bash-completion/completions
mv /etc/bash_completion.d/porg* /usr/share/bash-completion/completions</userinput></screen>
<screen><userinput>sed -e '/EXCLUDE/{s/^#//;s@$@:/sources:/home@}' \
-e '/LOGDIR/s/^#//' \
-i /etc/porgrc</userinput></screen>
</sect2>
</sect1>
<sect1 id="ch-system-pkgmngt" role="wrap"> <sect1 id="ch-system-pkgmngt" role="wrap">
<?dbhtml filename="porg.html"?> <?dbhtml filename="porg.html"?>
@ -82,6 +122,7 @@ mkdir -pv /var/lib/packages</userinput></screen>
<sect2 role="installation"> <sect2 role="installation">
<title>Instructions</title> <title>Instructions</title>
<screen><userinput remap="pre">patch -Np1 -i ../porg-0.10-renameat2-1.patch</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \ <screen><userinput remap="configure">./configure --prefix=/usr \
--disable-grop \ --disable-grop \
--sysconfdir=/etc \ --sysconfdir=/etc \

View file

@ -16,6 +16,7 @@ it in html -->
<!-- First section for the tarball download address. <!-- First section for the tarball download address.
Only the next four lines are mandatory, but you can add anything Only the next four lines are mandatory, but you can add anything
to make the text look more like the LFS book. to make the text look more like the LFS book.
You can add several packages (see packageManager.xml.pacman)
Do not change anything, except the url and the md5 checksum. --> Do not change anything, except the url and the md5 checksum. -->
<sect1 id="package"> <sect1 id="package">
<para>Download: <ulink url="http://your/package-manager/url"/></para> <para>Download: <ulink url="http://your/package-manager/url"/></para>
@ -29,11 +30,76 @@ Do not change anything, except the url and the md5 checksum. -->
</sect1> </sect1>
--> -->
<!-- Do not change the next line. The name of the scriptlet will be taken <!-- We have three groups of sections with installation instructions:
from the dbhtml instruction: it is the name of the file less .html, with - the one with id ch-tools-xxx is for old book, where
xxx-x-added before (x, digits). --> the package manager (and its needed deps) is built as user
lfs in /tools
- the one with id ch-chroot-xxx is for new book, where the
package manager (and its needed deps) is built temporarily
in chroot
- the one with id ch-system-xxx is for both book, when the
package manager (and its deps) is rebuilt with instructions
to make a package of it.
Do not change the next line, except the -pkgmngt part.
The name of the scriptlet will be taken from the dbhtml instruction:
it is the name of the file less .html, with xxx-x-added before
(x, digits). -->
<sect1 id="ch-tools-pkgmngt" role="wrap"> <sect1 id="ch-tools-pkgmngt" role="wrap">
<?dbhtml filename="dpkg.html"?> <?dbhtml filename="pkgmngt.html"?>
<!-- the next lines are now mandatory for unpacking the tarball at the
beginning of the scriptlet -->
<sect1info condition="script">
<productname>dpkg</productname>
<productnumber>x.y.z</productnumber><!-- version -->
<address>http://where/is/your/package</address><!-- url -->
</sect1info>
<!-- next line mandatory without change, but feel free to add any title,
other sect2 (with different role), sectinfo and so on -->
<sect2 role="installation">
<!-- You can use any number of remap="pre", "configure", "make", "test", "install"
<screen><userinput remap="something">Instructions</userinput></screen>.
They are executed in that order. "pre" can be used for patching for example.
In case testing is enabled, the instructions flagged test are logged to a different
file (test-log). If testing is not enabled, they are not executed at all. Do not
put line breaks before and after your instructions. <userinput> without
remap attribute are considered configuration instructions and executed last. You
can also use remap="adjust" for the same purpose. -->
<screen><userinput remap="configure">./configure --prefix=/tools \
--disable-nls --without-dselect \
--without-start-stop-daemon \
--without-update-alternatives \
--without-install-info \
--without-zlib --with-bz2=static --without-selinux</userinput></screen>
<screen><userinput remap="make">(cd lib &amp;&amp; make)
(cd src &amp;&amp; make)
(cd dpkg-deb &amp;&amp; make)
(cd dpkg-split &amp;&amp; make)</userinput></screen>
<screen><userinput remap="install">cp src/dpkg src/dpkg-* /tools/bin
cp dpkg-deb/dpkg-deb /tools/bin
cp dpkg-split/dpkg-split /tools/bin
mkdir -pv /tools/etc/dpkg/{,dpkg.cfg.d}
cp debian/dpkg.cfg /tools/etc/dpkg</userinput></screen>
<screen><userinput>cat &gt;&gt; /tools/etc/dpkg/dpkg.cfg &lt;&lt; EOF
# admindir on LFS system
admindir /var/lib/dpkg
EOF</userinput></screen>
<screen><userinput>cat &gt;&gt; /tools/etc/dpkg/dpkg.cfg &lt;&lt; EOF
# disable fatal error on path checking
force-bad-path
EOF</userinput></screen>
</sect2>
</sect1>
<!-- for new book, at the end of chapter 7 -->
<sect1 id="ch-chroot-pkgmngt" role="wrap">
<?dbhtml filename="pkgmngt.html"?>
<!-- the next lines are now mandatory for unpacking the tarball at the <!-- the next lines are now mandatory for unpacking the tarball at the
beginning of the scriptlet --> beginning of the scriptlet -->
<sect1info condition="script"> <sect1info condition="script">
@ -95,7 +161,9 @@ any explaining <title>Title</title> and <para>explanations</para> -->
mkdir -pv /var/lib/packages</userinput></screen> mkdir -pv /var/lib/packages</userinput></screen>
</sect1> </sect1>
<!-- Same for files. Do not change the following line --> <!-- Same for files. Do not change the following line.
Those instructions are not executed for the new book.
If needed create files at the end of the temp install. -->
<sect1 id="ch-pkgmngt-createfiles"> <sect1 id="ch-pkgmngt-createfiles">
<screen><userinput>touch /var/lib/dpkg/{available,status} <screen><userinput>touch /var/lib/dpkg/{available,status}
@ -106,6 +174,8 @@ touch /var/log/dpkg.log</userinput></screen>
<!-- Last but not least : Final instructions for installing the <!-- Last but not least : Final instructions for installing the
package manager at the end of chapter 6. Again, the scriptlet file name is package manager at the end of chapter 6. Again, the scriptlet file name is
taken from the dbhtml instruction, with digits added before and .html cut. taken from the dbhtml instruction, with digits added before and .html cut.
There can be any number of sections for dependencies, all with id
ch-system-xxx (all the id's must be different).
--> -->
<sect1 id="ch-system-pkgmngt" role="wrap"> <sect1 id="ch-system-pkgmngt" role="wrap">
<?dbhtml filename="dpkg.html"?> <?dbhtml filename="dpkg.html"?>