aboutsummaryrefslogtreecommitdiff
blob: 21b1b673b1a27ccfae75dec85f6cb85fec667eb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

TARBALL=${1}
TMPDIR=${2:-/tmp/__octave}
CATEGORIES='main extra language'

CURRENTDIR=$(pwd)
RELEASE=$(sed -e 's/^.*\([0-9]\{8\}\).*$/\1/' <<< ${TARBALL})

mkdir -p ${TMPDIR}
tar -xvzf ${TARBALL} -C ${TMPDIR}

cd ${TMPDIR}/octave-forge*

for cat in ${CATEGORIES}; do
    mkdir -p ${TMPDIR}/{src,db}/${cat}
    for pkg in $(ls ${cat}); do
        mypkg=${pkg%.tar.gz}
        tar -xvzf ${cat}/${pkg} -C ${TMPDIR}/src/${cat}
        mkdir ${TMPDIR}/db/${cat}/${mypkg}
        cp ${TMPDIR}/{src,db}/${cat}/${mypkg}/DESCRIPTION
    done
done

mkdir ${TMPDIR}/octave-forge
cp -r ${TMPDIR}/db/* ${TMPDIR}/octave-forge/

cd ${TMPDIR} && tar -cvzf "${CURRENTDIR}/octave-forge-${RELEASE}.db.tar.gz" \
    octave-forge

rm -rf ${TMPDIR}