summaryrefslogtreecommitdiffstats
path: root/build_tools/bin/mp
blob: 6c1b68359ea556e1fb6060de245473b1b11ce082 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Used to compile a package and copy it to the correct repository location.
# all arguments are passed to makepkg
#
#
. /etc/makepkg.conf
. PKGBUILD
PKGHOME=/data/pkg_repo/packages
mydir=`pwd`
TOTALPKG="$pkgname"-"$pkgver"-"$pkgrel"-"$CARCH".pkg.tar.gz


if [ x`basename $0` = xmpr ]
then
    PFIX=""
else
    PFIX="-testing"
fi




function find_repo {
    echo $mydir|grep -q "extra"
    if [ $? = 0 ]
    then
        REPO=extra${PFIX}
        else
        REPO=core${PFIX}
    fi
    echo $mydir|grep -q "chroot-devel"
    if [ $? = 0 ]
    then
	REPO=chroot-devel
    fi
    DOCROOT=/data/pkg_repo/$CARCH/$REPO
}


function update-repo {


    cd $DOCROOT
    echo
    echo "DOCROOT=$DOCROOT"
    echo
    #remove old package from local copy
    DELPKG="$pkgname"-"$pkgver"-*-"$CARCH".pkg.tar.gz
    #echo $DOCROOT
    #echo $DELPKG
    echo "Removing old packages from:"
    rm -fvI $DELPKG
    #copy in new package
    echo
    echo "Updating $CARCH/$REPO with $TOTALPKG"
    cp  -f $PKGDEST/$TOTALPKG .
    repo-add $DOCROOT/$REPO.db.tar.gz $DOCROOT/$TOTALPKG
    cd -

}






find_repo

makepkg --holdver --asroot  $@ || exit 1
echo "---------updating database ----------"
update-repo #&& pacman -Sy