From bd0095150ac71f1060cc2c5b00670bbe5e982a2d Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sun, 18 Jan 2015 16:58:24 +0000 Subject: [PATCH] Add pacman as package manager. --- README.PACKAGE_MANAGEMENT | 76 +++---- .../{packInstall.sh => packInstall.sh.dpkg} | 0 pkgmngt/packInstall.sh.pacman | 59 ++++++ ...ageManager.xml => packageManager.xml.dpkg} | 4 +- pkgmngt/packageManager.xml.pacman | 189 ++++++++++++++++++ pkgmngt/packageManager.xml.template | 2 +- 6 files changed, 281 insertions(+), 49 deletions(-) rename pkgmngt/{packInstall.sh => packInstall.sh.dpkg} (100%) create mode 100644 pkgmngt/packInstall.sh.pacman rename pkgmngt/{packageManager.xml => packageManager.xml.dpkg} (99%) create mode 100644 pkgmngt/packageManager.xml.pacman diff --git a/README.PACKAGE_MANAGEMENT b/README.PACKAGE_MANAGEMENT index 47b8c1d..02f8cad 100644 --- a/README.PACKAGE_MANAGEMENT +++ b/README.PACKAGE_MANAGEMENT @@ -17,59 +17,43 @@ BY : Pierre Labastie (work in progress) 2. OVERVIEW OF THE SYSTEM: For now, package management is only available for LFS. I plan to - upgrade BLFS tools, but nothing usable right now. The other flavours of - LFS do not seem very active, so there is no point in updating jhalfs - for them. - The first thing to do is to modify the install instructions of the - chapter 6, 7 and 8 of the book so that the installed files end up in a - directory other than `/'. We choose to call this directory by the name - of the executed script, and to put the path to this directory in the - PKG_DEST variable which is made available to the scriplets. - Almost all the packages have a way to redirect the destination of - the files they install at the `make install' stage with the variable - DESTDIR. Furthermore, the authors of the book have been kind enough to - flag the installation instructions with `remap=install'. This allows an - xsl stylesheet to find those instructions. Then, places where `make ' - occurs (make followed by a space) are replaced by `make DESTDIR=$PKG_DEST '. - Places where the book instructions move files into their destination - are harder to deal with: it is possible to change all occurences of ` /' or - `>/' (beginning of absolute paths) to `$PKG_DEST', but you end up moving + upgrade BLFS tools, but nothing usable right now. I have not attempted + to adapt this tool for the other flavours of LFS. + This system performs basically a "DESTDIR install" for all pages + in chapter 6, 7 and 8 of the book. The name of the DESTDIR directory is the + same as the one of the executed script. The path to this directory is + available to the scriplets through the PKG_DEST variable. + The XSL stylesheet used for generating the scriptlets, automatically + adds DESTDIR install instructions when "package management" is selected. + Also all the paths beginning with " /" or ">/" (absolute paths) are prepended + with $PKG_DEST. This has the default that you might want to move files to non existent directories. There is no simple way to automatically create those directories, because you have sometimes to use the full path (instructions of the form `cp file dir') and sometimes only the dirname - (instructions of the form `cp file1 file2'). So I am conservative and - create a reasonable subset of the FHS hierarchy into the destination - directory. Empty directories should then be removed before packing the + (instructions of the form `cp file1 file2'). So the XSL stylesheet + creates a reasonable subset of the FHS hierarchy into the destination + directory. Empty directories are then removed before packing the binary package. - Supposing now that the scriptlets have been adequately modified, the - package manager installation instructions have to be added at the end of - chapter 5 and chapter 6. Furthermore, the administrative files and - directories have to be created during the `Creating Directories' and - `Creating Essential Files' stage. For all this, the user has to supply a - file in docbook format, with the necessary instructions and enough - information to download the tarball. A template is provided in the pkgmngt - subdirectory. + In order to use the package manager, it has to be installed at the end of + chapter 5 (temporary installation in /tools) and chapter 6 (final install). + Furthermore, the administrative files and directories have to be created + during the `Creating Directories' and `Creating Essential Files' stages. + For all this, the user has to supply a file in docbook XML format, with + the necessary instructions and enough information to download the tarball. + This file should reside in the `pkgmngt' directory and be named + `packageManager.xml'. A template named `packageManager.xml.template' is + provided in the `pkgmngt' subdirectory. There are also two XML files for + dpkg and pacman, respectively `packageManager.xml.dpkg' and + `packageManager.xml.pacman', that you can copy to `packageManager.xml'. + They are not updated often, so the versions used can be rather old. The last thing to do is to tell how to use the package manager. When the binary package is ready, the scriptlets call a shell function named `packInstall', which should pack the binary package and install it on the system. Note that nothing has been done to manage configuration files, - which are ususally treated specially by package managers. Depending on + which are ususally treated specially by package managers: depending on the book layout, it is sometimes possible to create those files afterwards, and sometimes not, which means that you have to check them after each - upgrade. The user has to provide his own function. A template is provided - in the pkgmngt subdirectory. - -3. DETAILED INSTRUCTIONS: - - Before beginning, you should know which package manager you want, where - to get the sources, and how to use it for: - a) Making a package from a directory tree. Usually, there is some control - file containing the version, pacakager, build system (32 or 64 bits at - least) or other more or less usefull but mandatory bits of information - which you should understand. - b) Unpack the package. - - Second, you ought to have a basic knowledge of bash scripting and - docbook-xml writing, because you have to write a bash function for packing - and unpacking the package, and a set of instructions to install the PM. - + upgrade. The user has to write his own `packInstall' function. The shell + function should be defined in a file named `packInstall.sh', residing in + the `pkgmngt' directory. A template is provided, as well as two example + scripts for dpkg and pacman. diff --git a/pkgmngt/packInstall.sh b/pkgmngt/packInstall.sh.dpkg similarity index 100% rename from pkgmngt/packInstall.sh rename to pkgmngt/packInstall.sh.dpkg diff --git a/pkgmngt/packInstall.sh.pacman b/pkgmngt/packInstall.sh.pacman new file mode 100644 index 0000000..9043c78 --- /dev/null +++ b/pkgmngt/packInstall.sh.pacman @@ -0,0 +1,59 @@ +# $Id$ +# function for packing and installing a tree. We only have access +# to variables PKGDIR and PKG_DEST +# Other variables can be passed on the command line, or in the environment + +packInstall() { + +# A proposed implementation for versions and package names. +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 +case $(uname -m) in + x86_64) local ARCH=x86_64 ;; + *) local ARCH=i686 ;; +esac +local ARCHIVE_NAME=${PACKAGE}-${VERSION}-1-${ARCH}.pkg.tar.gz + +pushd $PKG_DEST +rm -fv ./usr/share/info/dir # recommended since this directory is already there + # on the system +# Right now, we have the files in the current directory. They should be moved +# to /sources/$PACKAGE/src. +mkdir -p ../$PACKAGE/src +mv * ../$PACKAGE/src + +cat > PKGBUILD <This is my choice of package manager. Dpkg is the basic package manager of Debian. It can be complemented by deselect (in the same package), apt or aptitude. We use it in a very crude way. - + &buildtime; &diskspace; @@ -253,7 +253,7 @@ touch /var/log/dpkg.log This is my choice of package manager. Dpkg is the basic package manager of Debian. It can be complemented by deselect (in the same package), apt or aptitude. We use it in a very crude way. - + &buildtime; &diskspace; diff --git a/pkgmngt/packageManager.xml.pacman b/pkgmngt/packageManager.xml.pacman new file mode 100644 index 0000000..b4aa660 --- /dev/null +++ b/pkgmngt/packageManager.xml.pacman @@ -0,0 +1,189 @@ + + + + + + + +
+ + + + Download: + MD5 sum: e9aa6dec29920eba8ef706ea5823bad7 + Download: + MD5 sum: efad5a503f66329bb9d2f4308b5de98a + Download: + MD5 sum: 063c8b0ff6bdf903dc235445525627cd + + + + + + + + +./configure --prefix=/tools \ + --without-bz2lib \ + --enable-bsdtar=static \ + --enable-bsdcpio=static +make +make install + + + + + + +./configure --prefix=/tools \ + --disable-static +make +make install + + + + + + + + + +./configure --prefix=/tools \ + PKG_CONFIG_PATH=/tools/lib/pkgconfig \ + DUPATH=/tools/bin/du + +make + +make install + +sed -e 's@/usr@/tools@g' \ + -e 's/\([^!]\)strip/\1!strip/' \ + -e 's/\([^!]\)zipman/\1!zipman/' \ + -i /tools/etc/makepkg.conf +cat >> /tools/etc/makepkg.conf << EOF +BUILDDIR=/sources +PKGDEST=/var/lib/packages +PACKAGER="Pierre Labastie <lnimbus@club-internet.fr>" +EOF +cat >> /tools/etc/pacman.conf << 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 + + + + + + + + + +mkdir -pv /var/{lib/{packages,pacman},cache/pkg} + + + + + +No file? + + + + + + + +./configure --prefix=/usr \ + --disable-static +make +make DESTDIR=$PKG_DEST install + + + + + + +./configure --prefix=/usr \ + --disable-static \ + --enable-threaded-resolver +make +make DESTDIR=$PKG_DEST install +find docs \( -name "Makefile*" -o -name "*.1" -o -name "*.3" \) -exec rm {} \; +install -v -d -m755 $PKG_DEST/usr/share/doc/curl-7.39.0 +cp -v -R docs/* $PKG_DEST/usr/share/doc/curl-7.39.0 + + + + + + + + +./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var + +make + + +make DESTDIR=$PKG_DEST install + +sed -e 's/\([^!]\)strip/\1!strip/' \ + -e 's/\([^!]\)zipman/\1!zipman/' \ + -i /etc/makepkg.conf +cat >> /etc/makepkg.conf << EOF +BUILDDIR=/sources +PKGDEST=/var/lib/packages +PACKAGER="Pierre Labastie <lnimbus@club-internet.fr<" +EOF +cat >> /etc/pacman.conf << EOF +DBPath = /var/lib/pacman/ +CacheDir = /var/cache/pacman/pkg/ +LogFile = /var/log/pacman.log +SigLevel = Never +EOF + + + + +
diff --git a/pkgmngt/packageManager.xml.template b/pkgmngt/packageManager.xml.template index dbd30b1..9d20546 100644 --- a/pkgmngt/packageManager.xml.template +++ b/pkgmngt/packageManager.xml.template @@ -100,7 +100,7 @@ touch /var/log/dpkg.log