Porg style package management:
- Add new variable WRAP_INSTALL in COnfig.in and jhalfs - Generates the install commands inside a wrapper function - Add files packInstall.sh.porg and packageManager.xml.porg - TODO: update README.PACKAGE... - TODO: make new templates in pkgmngt and document them
This commit is contained in:
parent
33ff403b33
commit
df42c7cff7
8 changed files with 332 additions and 68 deletions
29
Config.in
29
Config.in
|
@ -835,10 +835,18 @@ menu "--- Build Settings"
|
|||
help
|
||||
#-- Use package management
|
||||
#
|
||||
# If set, the packages in the final phase are built
|
||||
# If set, you'll have to choose between
|
||||
# two package management styles:
|
||||
# - Build and install:
|
||||
# the packages in the final phase are built
|
||||
# in a separate directory, PKG_DEST.
|
||||
# You should provide a bash function for packing
|
||||
# and installing the package.
|
||||
# You should provide a bash function for
|
||||
# packaing and installing the package.
|
||||
# - Preload a library before install:
|
||||
# Run the install instructions inside a
|
||||
# wrapper command, which monitors the
|
||||
# installed files.
|
||||
#
|
||||
# Also, you have to provide the instructions
|
||||
# to build the package manager during the
|
||||
# temporary tools phase, in the form of a
|
||||
|
@ -846,7 +854,22 @@ menu "--- Build Settings"
|
|||
# sect1. See README.PACKAGE_MANAGEMENT
|
||||
#
|
||||
# For now, this only works with LFS
|
||||
choice
|
||||
depends PKGMNGT
|
||||
prompt "Package management style"
|
||||
default PKG_PACK
|
||||
|
||||
config PKG_PACK
|
||||
bool "Build and pack (pacman or dpkg style)"
|
||||
|
||||
config LIB_LOAD
|
||||
bool "Preload a library before installing (porg style)"
|
||||
endchoice
|
||||
|
||||
config WRAP_INSTALL
|
||||
bool
|
||||
default y if LIB_LOAD
|
||||
default n if PKG_PACK
|
||||
#--- End package management
|
||||
|
||||
#--- Installed files logs
|
||||
|
|
126
LFS/lfs.xsl
126
LFS/lfs.xsl
|
@ -14,7 +14,14 @@
|
|||
n = no, original behavior
|
||||
y = yes, add PKG_DEST to scripts in install commands of chapter06-08
|
||||
-->
|
||||
<xsl:param name="pkgmngt" select="n"/>
|
||||
<xsl:param name="pkgmngt" select="'n'"/>
|
||||
|
||||
<!-- Package management with "porg style" ?
|
||||
n = no, same as pkgmngt description above
|
||||
y = yes, wrap install commands of chapter06-08 into a bash function.
|
||||
note that pkgmngt must be 'y' in this case
|
||||
-->
|
||||
<xsl:param name="wrap-install" select='"n"'/>
|
||||
|
||||
<!-- Run test suites?
|
||||
0 = none
|
||||
|
@ -28,29 +35,29 @@
|
|||
n = no, I want to build the full system and review the logs
|
||||
y = yes, bomb at the first test suite failure to can review the build dir
|
||||
-->
|
||||
<xsl:param name="bomb-testsuite" select="n"/>
|
||||
<xsl:param name="bomb-testsuite" select="'n'"/>
|
||||
|
||||
<!-- Install vim-lang package? OBSOLETE should always be 'n'-->
|
||||
<xsl:param name="vim-lang" select="n"/>
|
||||
<xsl:param name="vim-lang" select="'n'"/>
|
||||
|
||||
<!-- Time zone -->
|
||||
<xsl:param name="timezone" select="GMT"/>
|
||||
<xsl:param name="timezone" select="'GMT'"/>
|
||||
|
||||
<!-- Page size -->
|
||||
<xsl:param name="page" select="letter"/>
|
||||
<xsl:param name="page" select="'letter'"/>
|
||||
|
||||
<!-- Locale settings -->
|
||||
<xsl:param name="lang" select="C"/>
|
||||
<xsl:param name="lang" select="'C'"/>
|
||||
|
||||
<!-- Install the whole set of locales -->
|
||||
<xsl:param name='full-locale' select='n'/>
|
||||
<xsl:param name='full-locale' select='"n"'/>
|
||||
|
||||
<!-- Hostname -->
|
||||
<xsl:param name='hostname' select='"HOSTNAME"'/>
|
||||
|
||||
<!-- Network parameters: interface, ip, gateway, prefix, broadcast, domain
|
||||
and nameservers -->
|
||||
<xsl:param name='interface' select='eth0'/>
|
||||
<xsl:param name='interface' select="'eth0'"/>
|
||||
<xsl:param name='ip' select='"10.0.2.9"'/>
|
||||
<xsl:param name='gateway' select='"10.0.2.2"'/>
|
||||
<xsl:param name='prefix' select='24'/>
|
||||
|
@ -180,6 +187,12 @@
|
|||
descendant::screen[not(@role) or
|
||||
@role != 'nodump']/userinput[
|
||||
@remap='install']">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$wrap-install='y'">
|
||||
<xsl:text>wrapInstall '
|
||||
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
|
||||
mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include}
|
||||
mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
|
||||
|
@ -189,10 +202,13 @@ case $(uname -m) in
|
|||
x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
|
||||
esac
|
||||
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:if test="../@id = 'ch-system-glibc' and
|
||||
@role='installation' and
|
||||
$pkgmngt = 'y'">
|
||||
$pkgmngt = 'y' and
|
||||
$wrap-install = 'n'">
|
||||
<xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc}
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
|
@ -204,6 +220,33 @@ esac
|
|||
descendant::screen[not(@role) or
|
||||
@role != 'nodump']/userinput[
|
||||
@remap='install']">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$wrap-install='y'">
|
||||
<xsl:if test="../@id = 'ch-system-man-pages'">
|
||||
<!-- these files are provided by the shadow package -->
|
||||
<xsl:text>rm -fv /usr/share/man/{man3/getspnam.3,man5/passwd.5}
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
<!-- Attr man/man2 pages are already installed by man-pages. As of
|
||||
March 2013, they are the same pages.
|
||||
November 2015: now they are more accurate
|
||||
in man-pages, and the man5 section is also in man-pages... -->
|
||||
<xsl:if test="../@id = 'ch-system-attr'">
|
||||
<xsl:text>rm -fv /usr/share/man/man2/*
|
||||
rm -fv /usr/share/man/man5/*
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
<!-- nologin is installed by util-linux. remove it from shadow -->
|
||||
<xsl:if test="../@id = 'ch-system-shadow'">
|
||||
<xsl:text>rm -fv /usr/share/man/man8/nologin.8
|
||||
rm -fv /sbin/nologin
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>'
|
||||
packInstall
|
||||
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:if test="../@id = 'ch-system-man-pages'">
|
||||
<!-- these files are provided by the shadow package -->
|
||||
<xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
|
||||
|
@ -241,6 +284,8 @@ done
|
|||
packInstall
|
||||
rm -rf $PKG_DEST
|
||||
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
<xsl:if test="$testsuite='3' and
|
||||
../@id='ch-tools-glibc' and
|
||||
|
@ -309,7 +354,7 @@ cd $PKGDIR
|
|||
mode="pkgmngt"/>
|
||||
<xsl:if test="$dirname = 'chapter06'">
|
||||
<xsl:text>packInstall
|
||||
rm -rf $PKG_DEST
|
||||
rm -rf "$PKG_DEST"
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates
|
||||
|
@ -452,7 +497,26 @@ exit
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise><!--pkgmngt = 'y'-->
|
||||
<xsl:when test="$wrap-install='y'">
|
||||
<xsl:choose>
|
||||
<xsl:when test="./literal">
|
||||
<xsl:call-template name="output-wrap">
|
||||
<xsl:with-param name="commands" select="text()[1]"/>
|
||||
</xsl:call-template>
|
||||
<xsl:apply-templates select="literal"/>
|
||||
<xsl:call-template name="output-wrap">
|
||||
<xsl:with-param name="commands" select="text()[2]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="output-wrap">
|
||||
<xsl:with-param name="commands" select="string()"/>
|
||||
</xsl:call-template>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise><!--pkgmngt = 'y' and wrap-install='n'-->
|
||||
<xsl:choose>
|
||||
<xsl:when test="./literal">
|
||||
<xsl:call-template name="outputpkgdest">
|
||||
|
@ -476,7 +540,7 @@ exit
|
|||
tzdata. -->
|
||||
<xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
|
||||
<xsl:text>
|
||||
OLD_PKG_DEST=$PKG_DEST
|
||||
OLD_PKG_DEST="$PKG_DEST"
|
||||
OLD_PKGDIR=$PKGDIR
|
||||
PKG_DEST=$(dirname $OLD_PKG_DEST)/001-tzdata
|
||||
PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
|
||||
|
@ -485,12 +549,28 @@ PKGDIR=$(dirname $PKGDIR)/tzdata-</xsl:text>
|
|||
'.tar')"/>
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$wrap-install='n'">
|
||||
<xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
|
||||
<xsl:text>ZONEINFO=$PKG_DEST</xsl:text>
|
||||
<xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
|
||||
<xsl:text>
|
||||
packInstall
|
||||
rm -rf $PKG_DEST
|
||||
</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise><!-- wrap-install='y' -->
|
||||
<xsl:copy-of select="substring-before(string(),'ZONEINFO=')"/>
|
||||
<xsl:text>
|
||||
wrapInstall '
|
||||
ZONEINFO=</xsl:text>
|
||||
<xsl:copy-of select="substring-after(string(),'ZONEINFO=')"/>
|
||||
<xsl:text>'
|
||||
packInstall
|
||||
</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>
|
||||
PKG_DEST=$OLD_PKG_DEST
|
||||
unset OLD_PKG_DEST
|
||||
PKGDIR=$OLD_PKGDIR
|
||||
|
@ -732,4 +812,26 @@ unset OLD_PKGDIR
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:variable name="APOS">'</xsl:variable>
|
||||
<xsl:template name="output-wrap">
|
||||
<xsl:param name="commands" select="''"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($commands,string($APOS))">
|
||||
<xsl:call-template name="output-wrap">
|
||||
<xsl:with-param name="commands"
|
||||
select="substring-before($commands,string($APOS))"/>
|
||||
</xsl:call-template>
|
||||
<xsl:text>'\''</xsl:text>
|
||||
<xsl:call-template name="output-wrap">
|
||||
<xsl:with-param name="commands"
|
||||
select="substring-after($commands,string($APOS))"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$commands"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
|
|
@ -166,6 +166,7 @@ extract_commands() { #
|
|||
--stringparam page $PAGE \
|
||||
--stringparam lang $LANG \
|
||||
--stringparam pkgmngt $PKGMNGT \
|
||||
--stringparam wrap-install $WRAP_INSTALL \
|
||||
--stringparam hostname $HOSTNAME \
|
||||
--stringparam interface $INTERFACE \
|
||||
--stringparam ip $IP_ADDR \
|
||||
|
|
|
@ -41,7 +41,7 @@ inline_doc
|
|||
local -r CLFS3_book="$BOOK_common $BOOK_clfsX PLATFORM MIPS_LEVEL"
|
||||
|
||||
# Build Settings by book
|
||||
local -r LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT FULL_LOCALE"
|
||||
local -r LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT FULL_LOCALE WRAP_INSTALL"
|
||||
local -r HLFS_build="$BUILD_chroot $BUILD_common"
|
||||
local -r CLFS_build="$BUILD_chroot VIMLANG $BUILD_common"
|
||||
local -r CLFS2_build="STRIP VIMLANG $BUILD_common"
|
||||
|
|
|
@ -115,6 +115,7 @@ define get_pkg_root2
|
|||
echo "export PKG_DEST=$(SRC)/$@" >> envars; \
|
||||
echo "source packInstall.sh" >> envars; \
|
||||
echo "export -f packInstall" >> envars; \
|
||||
echo "export -f wrapInstall" >> envars; \
|
||||
fi;
|
||||
endef
|
||||
|
||||
|
|
1
jhalfs
1
jhalfs
|
@ -123,6 +123,7 @@ COMPARE=${COMPARE:-n}
|
|||
RUN_FARCE=${RUN_FARCE:-n}
|
||||
RUN_ICA=${RUN_ICA:-n}
|
||||
PKGMNGT=${PKGMNGT:-n}
|
||||
WRAP_INSTALL=${WRAP_INSTALL:-n}
|
||||
BOMB_TEST=${BOMB_TEST:-n}
|
||||
STRIP=${STRIP:=n}
|
||||
REPORT=${REPORT:=n}
|
||||
|
|
56
pkgmngt/packInstall.sh.porg
Normal file
56
pkgmngt/packInstall.sh.porg
Normal file
|
@ -0,0 +1,56 @@
|
|||
# $Id:$
|
||||
# functions for recording installation of a package and make a tarball,
|
||||
# or using fakeroot type commands for install, then packing and installing
|
||||
# the package.
|
||||
# We only have access to variables PKGDIR and PKG_DEST. Other variables could
|
||||
# be set in the environment
|
||||
|
||||
wrapInstall() {
|
||||
# a bash command is passed as an argument (that may be a compound command).
|
||||
# It is executed by this function, after various set-ups...
|
||||
|
||||
local PCKGVRS=$(basename $PKGDIR)
|
||||
local TGTPKG=$(basename $PKG_DEST)
|
||||
local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
|
||||
sed 's/^[0-9]\{1\}-//')
|
||||
# version is only accessible from PKGDIR name. Since the format of the
|
||||
# name is not normalized, several hacks are necessary...
|
||||
case $PCKGVRS in
|
||||
expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
|
||||
vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
|
||||
tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
|
||||
docbook-xml) local VERSION=4.5 ;;
|
||||
*) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
|
||||
sed 's/_/./g');;
|
||||
# the last sed above is because some package managers do not want a '_'
|
||||
# in version.
|
||||
esac
|
||||
|
||||
porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
|
||||
$*
|
||||
PORG_EOF
|
||||
}
|
||||
|
||||
#----------------
|
||||
packInstall() {
|
||||
|
||||
# With porg, we need only the package name to make the tarball
|
||||
local TGTPKG=$(basename $PKG_DEST)
|
||||
local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
|
||||
sed 's/^[0-9]\{1\}-//')
|
||||
local PCKGVRS=$(basename $PKGDIR)
|
||||
case $PCKGVRS in
|
||||
expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
|
||||
vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
|
||||
tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
|
||||
docbook-xml) local VERSION=4.5 ;;
|
||||
*) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
|
||||
sed 's/_/./g');;
|
||||
# the last sed above is because some package managers do not want a '_'
|
||||
# in version.
|
||||
esac
|
||||
# Building the binary package
|
||||
porgball ${PACKAGE}
|
||||
# The package is in the current directory
|
||||
mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
|
||||
}
|
80
pkgmngt/packageManager.xml.porg
Normal file
80
pkgmngt/packageManager.xml.porg
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" >
|
||||
|
||||
<article>
|
||||
|
||||
<sect1 id="package">
|
||||
<title>Package Information</title>
|
||||
<para>Download: <ulink url="https://sourceforge.net/projects/porg/files/porg-0.10.tar.gz"/></para>
|
||||
<para>MD5 sum: <literal>2eceb8a73bb188dbb06b12d90cabdbb4</literal></para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="ch-tools-pkgmngt" role="wrap">
|
||||
<?dbhtml filename="porg.html"?>
|
||||
<title>Porg in tools</title>
|
||||
<sect2 role="installation">
|
||||
<title>Instructions</title>
|
||||
<screen><userinput remap="configure">./configure --prefix=/tools \
|
||||
--disable-grop \
|
||||
--with-porg-logdir=/tools/var/porg</userinput></screen>
|
||||
|
||||
<para>
|
||||
<parameter>--disable-grop</parameter> is needed to prevent the sytem from
|
||||
trying to build the graphical interface, and
|
||||
<parameter>--with-porg-logdir=...</parameter> is needed because
|
||||
<command>make install</command> insists on creating a directory in
|
||||
<filename class="directory">/var</filename>, where we do not want
|
||||
to write.
|
||||
</para>
|
||||
|
||||
<screen><userinput remap="make">make</userinput></screen>
|
||||
|
||||
<screen><userinput remap="install">make install</userinput></screen>
|
||||
|
||||
<screen><userinput>cat >> /tools/etc/porgrc << EOF
|
||||
# Porg logdir on LFS system
|
||||
LOGDIR=/var/lib/porg
|
||||
EOF
|
||||
sed -e '/EXCLUDE/{s/^#//;s@$@:/sources:/home@}' \
|
||||
-i /tools/etc/porgrc</userinput></screen>
|
||||
|
||||
</sect2>
|
||||
|
||||
</sect1>
|
||||
|
||||
<sect1 id="ch-pkgmngt-creatingdirs">
|
||||
|
||||
<title>Directories</title>
|
||||
<screen><userinput>mkdir -pv /var/lib/porg
|
||||
mkdir -pv /var/lib/packages</userinput></screen>
|
||||
|
||||
</sect1>
|
||||
<sect1 id="ch-pkgmngt-createfiles">
|
||||
<title>Files</title>
|
||||
<para><command>porgball</command> needs <filename>porgrc</filename>
|
||||
in <filename class="directory">/etc</filename>:</para>
|
||||
<screen><userinput>cp /tools/etc/porgrc /etc</userinput></screen>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="ch-system-pkgmngt" role="wrap">
|
||||
<?dbhtml filename="porg.html"?>
|
||||
<title>Final Porg</title>
|
||||
<sect2 role="installation">
|
||||
<title>Instructions</title>
|
||||
|
||||
<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">porg -lD "make install"</userinput></screen>
|
||||
|
||||
<screen><userinput>sed -e '/EXCLUDE/{s/^#//;s@$@:/sources:/home@}' \
|
||||
-i /etc/porgrc</userinput></screen>
|
||||
</sect2>
|
||||
|
||||
</sect1>
|
||||
</article>
|
Reference in a new issue