Various updates for pacman PM

- update versions and instructions in packageManager.xml.pacman.
  Also remove the pages for old books.
- Fix packInstall.sh.pacman, so that restarting after a failure
  is possible
- Change LFS/lfs.xsl so that destdir install use symlinks for
  /lib, /sbin, and /bin. Remove also absolete commands for old
  books
- fix gcc script in book parser
This commit is contained in:
Pierre Labastie 2022-06-12 22:54:14 +02:00
parent 84d0d39a97
commit 55e82d2ae0
4 changed files with 61 additions and 225 deletions

View file

@ -10,13 +10,13 @@
<!-- use package management ? <!-- use package management ?
n = no, original behavior n = no, original behavior
y = yes, add PKG_DEST to scripts in install commands of chapter06-08 y = yes, add PKG_DEST to scripts in install commands of chapter08-10
--> -->
<xsl:param name="pkgmngt" select="'n'"/> <xsl:param name="pkgmngt" select="'n'"/>
<!-- Package management with "porg style" ? <!-- Package management with "porg style" ?
n = no, same as pkgmngt description above n = no, same as pkgmngt description above
y = yes, wrap install commands of chapter06-08 into a bash function. y = yes, wrap install commands of chapter08-10 into a bash function.
note that pkgmngt must be 'y' in this case note that pkgmngt must be 'y' in this case
--> -->
<xsl:param name="wrap-install" select='"n"'/> <xsl:param name="wrap-install" select='"n"'/>
@ -187,17 +187,6 @@ otherwise it is in /bin.-->
<!-- Inclusion of package manager scriptlets --> <!-- Inclusion of package manager scriptlets -->
<xsl:if test="$pkgmngt='y' and <xsl:if test="$pkgmngt='y' and
following-sibling::sect1[1][@id='ch-tools-stripping' or @id='ch-tools-cleanup']"> following-sibling::sect1[1][@id='ch-tools-stripping' or @id='ch-tools-cleanup']">
<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 <xsl:apply-templates
select="document('packageManager.xml')//sect1[ select="document('packageManager.xml')//sect1[
contains(@id,'ch-chroot')]" contains(@id,'ch-chroot')]"
@ -205,8 +194,6 @@ otherwise it is in /bin.-->
<xsl:with-param name="order" select="$order+1"/> <xsl:with-param name="order" select="$order+1"/>
<xsl:with-param name="dirname" select="$dirname"/> <xsl:with-param name="dirname" select="$dirname"/>
</xsl:apply-templates> </xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:if> </xsl:if>
<xsl:if test="$pkgmngt='y' and <xsl:if test="$pkgmngt='y' and
following-sibling::sect1[2][@id='ch-system-strippingagain' or @id='ch-system-stripping']"> following-sibling::sect1[2][@id='ch-system-strippingagain' or @id='ch-system-stripping']">
@ -245,14 +232,19 @@ otherwise it is in /bin.-->
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<!-- We cannot know which directory(ies) are needed by the package. Create a <!-- We cannot know which directory(ies) are needed by the package. Create a
reasonable bunch of them. Should be close to "Creating Directories".--> reasonable bunch of them. Should be close to "Creating Directories".
<xsl:text>mkdir -pv $PKG_DEST/{bin,boot,etc,lib,sbin} Create also symlinks from /lib, /bin, /sbin to their counterpart
in usr, so that the package only has files in /usr-->
<xsl:text>mkdir -pv $PKG_DEST/{boot,etc}
mkdir -pv $PKG_DEST/usr/{bin,include,lib/pkgconfig,sbin} mkdir -pv $PKG_DEST/usr/{bin,include,lib/pkgconfig,sbin}
mkdir -pv $PKG_DEST/usr/share/{doc,info,bash-completion/completions} mkdir -pv $PKG_DEST/usr/share/{doc,info,bash-completion/completions}
mkdir -pv $PKG_DEST/usr/share/man/man{1..8} mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
case $(uname -m) in case $(uname -m) in
x86_64) mkdir -v $PKG_DEST/lib64 ;; x86_64) mkdir -v $PKG_DEST/lib64 ;;
esac esac
ln -sv usr/sbin $PKG_DEST
ln -sv usr/bin $PKG_DEST
ln -sv usr/lib $PKG_DEST
</xsl:text> </xsl:text>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
@ -299,17 +291,18 @@ SECONDS=${PREV_SEC}
rm -fv $PKG_DEST/sbin/nologin rm -fv $PKG_DEST/sbin/nologin
</xsl:text> </xsl:text>
</xsl:if> </xsl:if>
<!-- remove empty directories --> <!-- remove empty directories and symlinks-->
<xsl:text>for dir in $PKG_DEST/usr/share/man/man{1..8} \ <xsl:text>for dir in $PKG_DEST/usr/share/man/man{1..8} \
$PKG_DEST/usr/share/bash-completion{/completions,} \ $PKG_DEST/usr/share/bash-completion{/completions,} \
$PKG_DEST/usr/share/{doc,info,man,} \ $PKG_DEST/usr/share/{doc,info,man,} \
$PKG_DEST/usr/lib/pkgconfig \ $PKG_DEST/usr/lib/pkgconfig \
$PKG_DEST/usr/{lib,bin,sbin,include} \ $PKG_DEST/usr/{lib,bin,sbin,include} \
$PKG_DEST/{boot,etc,lib,bin,sbin}; do $PKG_DEST/{boot,etc}; do
[ -d "$dir" ] &amp;&amp; [ -z "$(ls $dir)" ] &amp;&amp; rmdir -v $dir [ -d "$dir" ] &amp;&amp; [ -z "$(ls $dir)" ] &amp;&amp; rmdir -v $dir
done done
[ -d $PKG_DEST/lib64 ] &amp;&amp; [ -z "$(ls $PKG_DEST/lib64)" ] &amp;&amp; [ -d $PKG_DEST/lib64 ] &amp;&amp; [ -z "$(ls $PKG_DEST/lib64)" ] &amp;&amp;
rmdir -v $PKG_DEST/lib64 rmdir -v $PKG_DEST/lib64
rm -v $PKG_DEST/{lib,bin,sbin}
<!-- prevent overwriting symlinks: if a package install something in <!-- prevent overwriting symlinks: if a package install something in
these directories, it'll be lost if not using package management, these directories, it'll be lost if not using package management,
since they are symlinks to tmpfs. So, remove it too if using PM. --> since they are symlinks to tmpfs. So, remove it too if using PM. -->
@ -1266,6 +1259,7 @@ PKGDIR=$(tar -tf $PACKAGE | head -n1 | sed 's@^./@@;s@/.*@@')
export PKGDIR VERSION PKG_DEST export PKGDIR VERSION PKG_DEST
if [ -d "$PKGDIR" ]; then rm -rf $PKGDIR; fi if [ -d "$PKGDIR" ]; then rm -rf $PKGDIR; fi
if [ -d "$PKG_DEST" ]; then rm -rf $PKG_DEST; fi
if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi if [ -d "${PKGDIR%-*}-build" ]; then rm -rf ${PKGDIR%-*}-build; fi
</xsl:text> </xsl:text>
</xsl:if> </xsl:if>

View file

@ -109,7 +109,14 @@ extract_commands() { #
# Remove flags requesting user action in some cases. Much easier here than # Remove flags requesting user action in some cases. Much easier here than
# in the stylesheet... # in the stylesheet...
sed -i 's/-iv /-v /' "./${COMMANDS}/"chapter??/*kernel* sed -i 's/-iv /-v /' "./${COMMANDS}/"chapter??/*kernel*
# If doing a destdir install (PM without wrap), the gcc instructions
# fail for two reasons: a missing dir, and gcc -dumpmachine returns a
# wrong string.
if [ "$PKGMNGT" = y ] && [ "$WRAP_INSTALL" = n ]; then
sed -e 's|(gcc|&/xgcc|' \
-e '/lto_plug/imkdir -pv $PKG_DEST/usr/lib/bfd-plugins' \
-i ./${COMMANDS}/chapter08/*gcc
fi
echo "done" echo "done"
# Make the scripts executable. # Make the scripts executable.

View file

@ -30,13 +30,16 @@ pushd $PKG_DEST
rm -fv ./usr/share/info/dir # recommended since this directory is already there rm -fv ./usr/share/info/dir # recommended since this directory is already there
# on the system # on the system
# Right now, we have the files in the current directory. They should be moved # Right now, we have the files in the current directory. They should be moved
# to /sources/$PACKAGE/src. # to /sources/$PACKAGE/src. Also, in case there was a failure before, clean
mkdir -p ../$PACKAGE/src # /sources/$PACKAGE
rm -rf /sources/$PACKAGE
mkdir -p /sources/$PACKAGE/src
# We'll build as user builder. We need this directory to be owned by that user. # We'll build as user builder. We need this directory to be owned by that user.
chown -R builder ../$PACKAGE chown -R builder /sources/$PACKAGE
mv * ../$PACKAGE/src mv * /sources/$PACKAGE/src
chown -R builder $PKG_DEST chown -R builder $PKG_DEST
chmod -R o+r ../$PACKAGE chmod -R o+r /sources/$PACKAGE
cat > PKGBUILD <<EOF cat > PKGBUILD <<EOF
pkgname=( '$PACKAGE' ) pkgname=( '$PACKAGE' )

View file

@ -9,18 +9,18 @@ book if you prefer. That slightly changes the aspect if you render
it in html --> it in html -->
<!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 libarchive-version "3.4.3"> <!ENTITY libarchive-version "3.6.1">
<!ENTITY curl-version "7.71.1"> <!ENTITY curl-version "7.83.1">
<!ENTITY fakeroot-version "1.24"> <!ENTITY fakeroot-version "1.29">
<!ENTITY pacman-version "5.2.2"> <!ENTITY pacman-version "6.0.1">
<!ENTITY libarchive-url "https://github.com/libarchive/libarchive/releases/download/v&libarchive-version;/libarchive-&libarchive-version;.tar.xz"> <!ENTITY libarchive-url "https://github.com/libarchive/libarchive/releases/download/v&libarchive-version;/libarchive-&libarchive-version;.tar.xz">
<!ENTITY curl-url "https://curl.haxx.se/download/curl-&curl-version;.tar.xz"> <!ENTITY curl-url "https://curl.se/download/curl-&curl-version;.tar.xz">
<!ENTITY fakeroot-url "http://deb.debian.org/debian/pool/main/f/fakeroot/fakeroot_&fakeroot-version;.orig.tar.gz"> <!ENTITY fakeroot-url "http://deb.debian.org/debian/pool/main/f/fakeroot/fakeroot_&fakeroot-version;.orig.tar.gz">
<!ENTITY pacman-url "https://sources.archlinux.org/other/pacman/pacman-&pacman-version;.tar.gz"> <!ENTITY pacman-url "https://sources.archlinux.org/other/pacman/pacman-&pacman-version;.tar.xz">
<!ENTITY curl-md5 "b54b386057846ce3edd3584b19741569"> <!ENTITY curl-md5 "08c6d9c25d9cf8d17be28363753e42ca">
<!ENTITY libarchive-md5 "4b216ea3015ecf8ae555a2026f9a6b73"> <!ENTITY libarchive-md5 "9465f7995649c9ea84854a7fd8c76f30">
<!ENTITY fakeroot-md5 "964e5f438f1951e5a515dd54edd50fa6"> <!ENTITY fakeroot-md5 "cab9604a7dc1d58346e0d15bb285bd0f">
<!ENTITY pacman-md5 "3a9b078a83996a3272844807b91959c6"> <!ENTITY pacman-md5 "f71e6f06867749735960d0c1d199d375">
<!ENTITY % general-entities SYSTEM "BOOK/general.ent"> <!ENTITY % general-entities SYSTEM "BOOK/general.ent">
%general-entities; %general-entities;
]> ]>
@ -54,173 +54,7 @@ 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 <!-- pacman now needs ninja and meson, which needs
from the dbhtml instruction: it is the name of the file less .html, with
xxx-x-added before (x, digits).-->
<sect1 id="ch-tools-libarchive" role="wrap">
<?dbhtml filename="libarchive.html"?>
<sect1info condition="script">
<productname>libarchive</productname>
<productnumber>&libarchive-version;</productnumber>
<address>&libarchive-url;</address>
</sect1info>
<title>Libarchive-&libarchive-version;</title>
<sect2 role="installation">
<title/>
<screen><userinput remap="configure">./configure --prefix=/tools \
--without-bz2lib \
--without-xml2 \
--enable-bsdtar=static \
--enable-bsdcpio=static</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
</sect1>
<sect1 id="ch-tools-openssl" role="wrap">
<?dbhtml filename="openssl.html"?>
<sect1info condition="script">
<productname>openssl</productname>
<productnumber>&openssl-version;</productnumber>
<address>&openssl-url;</address>
</sect1info>
<title>openssl-&openssl-version;</title>
<sect2 role="installation">
<title/>
<screen><userinput remap="configure">./config --prefix=/tools \
--openssldir=/tools/etc/ssl \
--libdir=lib</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
</sect1>
<sect1 id="ch-tools-curl" role="wrap">
<?dbhtml filename="curl.html"?>
<sect1info condition="script">
<productname>curl</productname>
<productnumber>&curl-version;</productnumber>
<address>&curl-url;</address>
</sect1info>
<title>Curl-&curl-version;</title>
<sect2 role="installation">
<title/>
<screen><userinput remap="configure">./configure --prefix=/tools \
--disable-static</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
</sect1>
<sect1 id="ch-tools-libcap" role="wrap">
<?dbhtml filename="libcap.html"?>
<sect1info condition="script">
<productname>libcap</productname>
<productnumber>&libcap-version;</productnumber>
<address>&libcap-url;</address>
</sect1info>
<title>libcap-&libcap-version;</title>
<sect2 role="installation">
<title/>
<screen><userinput remap="make">make lib=lib prefix=/tools GOLANG=no PAM_CAP=no</userinput></screen>
<screen><userinput remap="install">make lib=lib prefix=/tools GOLANG=no PAM_CAP=no install</userinput></screen>
</sect2>
</sect1>
<sect1 id="ch-tools-fakeroot" role="wrap">
<?dbhtml filename="fakeroot.html"?>
<sect1info condition="script">
<productname>fakeroot</productname>
<productnumber>&fakeroot-version;</productnumber>
<address>&fakeroot-url;</address>
</sect1info>
<title>fakeroot-&fakeroot-version;</title>
<sect2 role="installation">
<title/>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
</sect1>
<sect1 id="ch-tools-pkgmngt" role="wrap">
<?dbhtml filename="pacman.html"?>
<sect1info condition="script">
<productname>pacman</productname>
<productnumber>&pacman-version;</productnumber>
<address>&pacman-url;</address>
</sect1info>
<title>Pacman-&pacman-version;</title>
<sect2 role="installation">
<title/>
<!-- 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">mkdir build
cd build
meson --prefix=/tools \
--sysconfdir=/tools/etc \
--localstatedir=/tools/var \
-Dcrypto=openssl \
-Ddoc=disabled \
-Dgpgme=disabled \
-Dpkg_config_path=/tools/lib/pkgconfig</userinput></screen>
<screen><userinput remap="make">ninja</userinput></screen>
<screen><userinput remap="install">ninja install</userinput></screen>
<screen><userinput>sed -e 's@/usr@/tools@g' \
-e 's/\([^!]\)strip/\1!strip/' \
-e 's/\([^!]\)libtool/\1!libtool/' \
-e 's/\([^!]\)zipman/\1!zipman/' \
-i /tools/etc/makepkg.conf
cat &gt;&gt; /tools/etc/makepkg.conf &lt;&lt; EOF
BUILDDIR=/sources
PKGDEST=/var/lib/packages
PACKAGER="Pierre Labastie &lt;lnimbus@club-internet.fr&gt;"
EOF
cat &gt;&gt; /tools/etc/pacman.conf &lt;&lt; EOF
DBPath = /var/lib/pacman/
CacheDir = /var/cache/pacman/pkg/
LogFile = /var/log/pacman.log
SigLevel = Never
# Repository: do not add one now: repo-add needs openssl.
EOF</userinput></screen>
</sect2>
</sect1>
<!-- version for new book: needs ninja and meson, which needs
Python rebuilt with libffi and zlib. Needs also pkg-config --> Python rebuilt with libffi and zlib. Needs also pkg-config -->
<sect1 id="ch-chroot-libarchive" role="wrap"> <sect1 id="ch-chroot-libarchive" role="wrap">
<?dbhtml filename="libarchive.html"?> <?dbhtml filename="libarchive.html"?>
@ -284,7 +118,8 @@ EOF</userinput></screen>
<sect2 role="installation"> <sect2 role="installation">
<title/> <title/>
<screen><userinput remap="configure">./configure --prefix=/usr \ <screen><userinput remap="configure">./configure --prefix=/usr \
--disable-static</userinput></screen> --disable-static \
--with-openssl</userinput></screen>
<screen><userinput remap="make">make</userinput></screen> <screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install</userinput></screen> <screen><userinput remap="install">make install</userinput></screen>
</sect2> </sect2>
@ -304,13 +139,9 @@ EOF</userinput></screen>
<sect2 role="installation"> <sect2 role="installation">
<title/> <title/>
<screen><userinput remap="pre">sed -i '/install.*STACAPLIBNAME/d' libcap/Makefile</userinput></screen> <screen><userinput remap="pre">sed -i '/install -m.*STA/d' libcap/Makefile</userinput></screen>
<screen><userinput remap="make">make lib=lib</userinput></screen> <screen><userinput remap="make">make prefix=/usr lib=lib</userinput></screen>
<screen><userinput remap="install">make lib=lib PKGCONFIGDIR=/usr/lib/pkgconfig install <screen><userinput remap="install">make lib=lib prefix=/usr install</userinput></screen>
chmod -v 755 /lib/libcap.so.&libcap-version;
mv -v /lib/libpsx.a /usr/lib
rm -v /lib/libcap.so
ln -sfv ../../lib/libcap.so.2 /usr/lib/libcap.so</userinput></screen>
</sect2> </sect2>
</sect1> </sect1>
@ -351,8 +182,7 @@ ln -sfv ../../lib/libcap.so.2 /usr/lib/libcap.so</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> <screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
<screen><userinput remap="make">make</userinput></screen> <screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install <screen><userinput remap="install">make install
mv -v /usr/lib/libz.so.* /lib rm -fv /usr/lib/libz.a</userinput></screen>
ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so</userinput></screen>
</sect2> </sect2>
</sect1> </sect1>
@ -370,7 +200,7 @@ ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so</userinput></scr
<sect2 role="installation"> <sect2 role="installation">
<title/> <title/>
<screen><userinput remap="configure">./configure --prefix=/usr --disable-static --with-gcc-arch=native</userinput></screen> <screen><userinput remap="configure">./configure --prefix=/usr --disable-static --with-gcc-arch=native --disable-exec-static-tramp</userinput></screen>
<screen><userinput remap="make">make</userinput></screen> <screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install</userinput></screen> <screen><userinput remap="install">make install</userinput></screen>
</sect2> </sect2>
@ -522,10 +352,10 @@ find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \ sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \
-e 's:/var/spool/mail:/var/mail:' \ -e 's:/var/spool/mail:/var/mail:' \
-i etc/login.defs -e '/PATH=/{s@/sbin:@@;s@/bin:@@}' \
sed -i 's/1000/999/' etc/useradd</userinput></screen> -i etc/login.defs</userinput></screen>
<screen><userinput remap="configure">touch /usr/bin/passwd <screen><userinput remap="configure">touch /usr/bin/passwd
./configure --sysconfdir=/etc \ ./configure --sysconfdir=/etc --disable-static \
--with-group-name-max-length=32</userinput></screen> --with-group-name-max-length=32</userinput></screen>
<screen><userinput remap="make">make</userinput></screen> <screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install</userinput></screen> <screen><userinput remap="install">make install</userinput></screen>
@ -604,10 +434,12 @@ sets of instructions end up in the same file, which is usually not a problem.
<sect2 role="installation"> <sect2 role="installation">
<title/> <title/>
<screen><userinput remap="configure">./configure --prefix=/usr \ <screen><userinput remap="configure">./configure --prefix=/usr \
--disable-static \ --disable-static --with-openssl \
--enable-threaded-resolver</userinput></screen> --enable-threaded-resolver \
--with-ca-path=/etc/ssl/certs</userinput></screen>
<screen><userinput remap="make">make</userinput></screen> <screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$PKG_DEST install <screen><userinput remap="install">make DESTDIR=$PKG_DEST install
rm -rf docs/examples/.deps
find docs \( -name "Makefile*" -o -name "*.1" -o -name "*.3" \) -exec rm {} \; find docs \( -name "Makefile*" -o -name "*.1" -o -name "*.3" \) -exec rm {} \;
install -v -d -m755 $PKG_DEST/usr/share/doc/curl-&curl-version; install -v -d -m755 $PKG_DEST/usr/share/doc/curl-&curl-version;
cp -v -R docs/* $PKG_DEST/usr/share/doc/curl-&curl-version;</userinput></screen> cp -v -R docs/* $PKG_DEST/usr/share/doc/curl-&curl-version;</userinput></screen>