Copyright (C) 2010 Jason Woodward <woodwardj at jaos dot org>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Library General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Table of Contents:
 1. About
 2. Features
 3. Requirements
 4. Installation
 5. slapt-getrc
 6. SLACKBUILDS.TXT
 7. Troubleshooting
 8. Thanks and contributions


1. About

slapt-src is a utility to make querying, retrieving, and building slackbuilds as
easily as working with binary packages with slapt-get.


2. Features

  * Remote and local SlackBuild repository support
  * fast
  * more

3. Requirements

  * slapt-get
  * curl

4. Installation

Currently slapt-src is only available via git.  See
http://software.jaos.org/git/slapt-src/

After unpacking, run ./autogen.sh.  After the configure script is built, run
the usual ./configure && make.

5. slapt-srcrc

The slapt-srcrc file consists of the following keys:
  * SOURCE
  * BUILDDIR
  * PKGEXT
  * PKGTAG

Refer to the slapt-src(8) man page for more on the configuration format and options.

Source should point to a local or remote SlackBuild repository that contains
the necessary meta data.  See SLACKBUILDS.TXT below.

6. SLACKBUILDS.TXT

The following script can generate the currently supported format of SLACKBUILDS.TXT.
The filename and format are likely to change.

#!/bin/bash
set -e

for sb in $(find . -name '*.SlackBuild' | sort)
do
  name=$(basename $sb | sed -re 's/\.SlackBuild$//')
  location=$(dirname $sb)
  if [ -f $location/$name.info ]; then
    echo "SLACKBUILD NAME: $name"
    echo "SLACKBUILD LOCATION: $location"
    files=$(ls $location | xargs)
    echo "SLACKBUILD FILES: $files"

    # remove those pesky multi line listings for each interesting field
    TMP=$(mktemp)
    sed ':a;N;$!ba;s/\\\n*\s*//g' $location/$name.info > $TMP

    DOWNLOAD=$(grep ^DOWNLOAD= $TMP | cut -f2 -d\" )
    DOWNLOAD_x86_64=$(grep ^DOWNLOAD_x86_64= $TMP | cut -f2 -d\" )
    MD5SUM=$(grep ^MD5SUM= $TMP | cut -f2 -d\" )
    MD5SUM_x86_64=$(grep ^MD5SUM_x86_64= $TMP | cut -f2 -d\" )
    VERSION=$(grep ^VERSION= $TMP | cut -f2 -d\" )

    echo "SLACKBUILD VERSION: $VERSION"
    echo "SLACKBUILD DOWNLOAD: $DOWNLOAD"
    echo "SLACKBUILD DOWNLOAD_x86_64: $DOWNLOAD_x86_64"
    echo "SLACKBUILD MD5SUM: $MD5SUM"
    echo "SLACKBUILD MD5SUM_x86_64: $MD5SUM_x86_64"

    if [ -f $location/slack-desc ]; then
      SHORTDESC=$(grep ^$name: $location/slack-desc | head -n 1 | sed -re "s/^$name://")
      echo "SLACKBUILD SHORT DESCRIPTION: $SHORTDESC"
    else
      echo "SLACKBUILD SHORT DESCRIPTION: "
    fi

    echo
    rm -f $TMP
  fi

done > SLACKBUILDS.TXT
gzip -9 SLACKBUILDS.TXT -c > SLACKBUILDS.TXT.gz

# END

7. Troubleshooting

There are likely a lot of bugs.  Email bug reports to me:
    Jason Woodward <woodwardj at jaos dot org>

or directly to the mailing lists:
    slapt-get-user at software dot jaos dot org
    slapt-get-devel at software dot jaos dot org

8. Thanks and contributions

Thanks to the guys from #gsb on freenode for ideas and conceptual discussions.

Thanks to Darren 'Tadgy' Austin and the sponsors File-away Limited
(http://www.file-away.co.uk) and UK2.NET (http://www.uk2.net) for
mirroring slackbuilds.org.
