[crux-devel] use flags

Anton cbou at mail.ru
Tue Aug 29 16:16:01 UTC 2006


On Tue, Aug 29, 2006 at 05:23:49PM +0200, heidi wrote:
> hello
> on first sorry for my English :)
> 
> I write something like gentoo's use flags but more simplest.
> for example i need (or i like :) ) fluxbox witch imlib2 but i don't need
> xinerama
> if i wont add or delete some functionality  i  must  rewrite  Pkgfile  .
[...]

> What you thinking about it ?

Personally I think it's ghastly to death. :-)

What is CRUX? ISO images? No. Pkgutils? No - they are really not
necessary, you can write simple scripts in shell using tar with similar
functionality. Pkgfiles? Bingo! Indeed, Pkgfiles is really valuable thing
in CRUX. That's it, Pkgfiles should be as KISS as possible. If they are
not, then it's not CRUX anymore.

Think about the reason why you need USE flags? To customize ports,
right? Okay, you can do that in much cleaner way: subversion.

You can use attached file, place it in /etc/ports/drivers, chmod +x it,
then replace /etc/ports/{core,opt}.rsync with other two attached files.
Next, rm -rf /usr/ports/{core,opt} ; ports -u. From that point can
change Pkgfiles as you wish, and don't look back for the maintainer
preference.

Using subversion for the controlling /usr/ports gives you additional
benefits (distro upgrading, easy reverting,...) which is offtopic in
that thread, but I hope that subversion usage will be fully covered
in the public wiki.

-- Anton (irc: bd2)
-------------- next part --------------
#!/bin/sh

#
# ports(8) driver for subversion
#

# create a file with the name <collectionname>.svn into your /etc/ports
#
# ----------------------------------------------------------
# ROOT_DIR=/usr/ports
# URL=svn://svn.berlios.de/clc/x86/tags/CRUX-2_1/base
# COLLECTION=base
# USER=
# PASS=
# ----------------------------------------------------------
# this will create a directory called '$COLLECTION' in '$ROOT_DIR'
# with the contents of $URL
# 'USER' and 'PASS' can contain username and password if this is required

if [ $# -ne 1 ]; then
        echo "usage: $0 <file>" >&2
        exit 1
fi

. $1

if [ -z "$ROOT_DIR" ]; then
    echo "ROOT_DIR not set in '$1'" >&2
    exit 2
fi

if [ -z "$COLLECTION" ]; then
    echo "COLLECTION not set in '$1'" >&2
    exit 2
fi

if [ -z "$URL" ]; then
    echo "URL not set in '$1'" >&2
    exit 2
fi

if [ ! -d "$ROOT_DIR" ]; then
    echo "NOTICE: ROOT_DIR '$ROOT_DIR' does not exist. Trying to create."
    mkdir -p $ROOT_DIR
    if [ "$?" != "0" ]; then
        echo "Failed to create '$ROOT_DIR', exiting."
        exit 3
    fi
fi

if [ -d $ROOT_DIR/$COLLECTION ] && [ ! -d $ROOT_DIR/$COLLECTION/.svn ]; then
    echo "$ROOT_DIR/$COLLECTION is not a subversion; deleting"
    rm -rf $ROOT_DIR/$COLLECTION
fi


if [ ! -z "$USER" ]; then
    USER="--username $USER"
fi
if [ ! -z "$PASS" ]; then
    PASS="--password $PASS"
fi


echo "Connection to $URL"
echo "Updating collection $COLLECTION"
if [ -d $ROOT_DIR/$COLLECTION ]; then
    svn $USER $PASS update $ROOT_DIR/$COLLECTION|\
          sed -e 's|^|  |g'|sed -e '/At revision.*/d'
else
    svn $USER $PASS co $URL $ROOT_DIR/$COLLECTION|\
          sed -e 's|^|  |g'|sed -e '/At revision.*/d'
fi
echo "Finished successfully"
-------------- next part --------------
ROOT_DIR=/usr/ports
URL=http://crux.nu/svn/crux-2.2/ports/core
COLLECTION=core
-------------- next part --------------
ROOT_DIR=/usr/ports
URL=http://crux.nu/svn/crux-2.2/ports/opt
COLLECTION=opt


More information about the crux-devel mailing list