You are not logged in.
I've been wanting to do 2 things for the last couple weeks: 1) create a wrapper script to build Arch pkg's in RAM and 2) create KDE trunk PKGBUILDs for those adventurous enough to use them (such as myself). Anyway, I sat down and began the task today; I haven't progressed too far, and probably won't do much more with it until next weekend because of school, but here is the current, very alpha-ish but working, wrapper script I will use:
#!/bin/bash
# =============================================================
# kdepkg is a wrapper script to build KDE-TRUNK packages in RAM.
# =============================================================# Holds the location of the original directory
ORIG_DIR="`pwd`"# Build each package listed as arguments
for dir in ${@}; do
cd ${dir}# Create some local variables
PKG_NAME="`grep pkgname PKGBUILD| head -n1 | sed -e "s/'//g" | sed -e 's/"//g' |
sed -e 's/=/ /' | awk '{print $2}'`"
SRC_DIR="`pwd`/src/`grep _svnmod PKGBUILD | head -n1 | sed -e "s/'//g" |
sed -e 's/"//g' | sed -e 's/=/ /' | awk '{print $2}'`"
BUILD_DIR="/dev/shm/${PKG_NAME}-build"# Create the necessary directories
mkdir -p ${SRC_DIR} \
${BUILD_DIR}# Link the build directory to the source directory
ln -sf ${BUILD_DIR} ${SRC_DIR}# Create a unique stamp for the backup PKGBUILD
UNIQUE="`date +"%m%d%y_%H%M%S"`"# Modify the PKGBUILD && make a pkg
mv -f PKGBUILD PKGBUILD.${UNIQUE}.bak
sed -e "s:[.][.]:${SRC_DIR}:" PKGBUILD.${UNIQUE}.bak > PKGBUILD && makepkg
mv -f PKGBUILD.${UNIQUE}.bak PKGBUILD# Remove the build directory
rm -rf ${BUILD_DIR} \
${SRC_DIR}/${PKG_NAME}-build
done# Return to the original directory
cd ${ORIG_DIR}
It's currently very picky about what it will build, but is sufficient enough to build my packages. I plan to extend its abilities to include building any package, whether it uses a build directory or not, regardless of the packaging technique utilized. I will also include options to specify the temp directory to use as the base for build directories and whether to delete them after package creation.
Here's an example of one of the PKGBUILD's this will work with:
# KDE Trunk Libraries
# Contributor: Dylon Edwards <deltaecho@archlinux.us>pkgname=kdetrunk-kdelibs
pkgver=860962
pkgrel=1
pkgdesc="KDE Core Libraries"
arch=('i686' 'x86_64')
url='http://www.kde.org'
license=('GPL' 'LGPL' 'FDL')
groups=('kde')
depends=('libxcursor' 'kdetrunk-phonon' 'shared-mime-info' 'qt-copy' 'libxpm'
'enchant' 'jasper' 'openexr' 'kdetrunk-strigi' 'bzip2' 'libxslt' 'libxtst'
'giflib' 'kdetrunk-soprano' 'ca-certificates' 'heimdal' 'pmount')
makedepends=('pkgconfig' 'cmake' 'kdetrunk-automoc4' 'intltool' 'avahi' 'libgl')
replaces=('arts')
conflicts=('kdelibs' 'kdemod-kdelibs')
options=('docs')
source=()
md5sums=()_svnmod='kdelibs'
_svntrunk="svn://anonsvn.kde.org/home/kde/trunk/KDE"build() {
cd ${srcdir}# update the src as needed
[ -d ${_svnmod}/.svn ] && svn up ${_svnmod} || svn co ${_svnroot}/${_svnmod}
cd ${_svnmod}# Create a build directory
mkdir -p ${_svnmod}-build && cd ${_svnmod}-build# Configure the package
cmake -D CMAKE_BUILD_TYPE=Release \
-D KDE_DISTRIBUTION_TEXT='Arch Linux' \
-D CMAKE_INSTALL_PREFIX=/usr \
-D SYSCONF_INSTALL_DIR=/etc \
-D KDE_DEFAULT_HOME='.kde4' .. || return 1# Begin make
make || return 1# Install the package to the fakeroot directory
make DESTDIR=${pkgdir} install || return 1
}
What do y'all think?
Edit: I might should add, in case my intentions weren't very clear, that this script will be extended to building PKGBUILD's other than those designed for KDE. Its advantage over moving the entire directory to RAM and building it there is that only the build directory is located off the hard disk. This is important to my project because I only need to update KDE's subversion files in order to keep up-to-date (if I had to download everything each time I updated the packages, I would do everything in RAM). Building the packages in a tmpfs directory is MUCH faster than building them directly from the hard disk, and reduces the latter's wear and tear on the life and fragmentation of the hard drive. I got the idea from here and here.
Last edited by deltaecho (2008-09-14 22:01:08)
Dylon
Offline
Good show...pleased to see the speed and performance of a ram based PKGBUILD.
My system has no HDD, is based on Compact Flash devices in Faunos. I may give this procedure a tryout on a "Live" system.
EDIT:
Faunos already uses tmpfs so I guess the PKGBUILDS already perform in ram along with the system via aufs for downloads.
Last edited by lilsirecho (2008-09-14 22:47:31)
Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit! X-ray confirms Iam spineless!
Offline