summaryrefslogtreecommitdiffstats
path: root/build_tools/bin/mp
blob: 884fece385b91081e22bbaf78543a40872d590a7 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/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
SRCPKGHOME=/data/pkg_repo/src_packages
mydir=`pwd`
TOTALPKG="$pkgname"-"$pkgver"-"$pkgrel"-"$CARCH".pkg.tar.gz
SRCPKG="$pkgname"-"$pkgver"-"$pkgrel".src.tar.gz

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





function find_repo {
    dirname=`dirname $mydir`
    echo $dirname|grep -q "extra"
    if [ $? = 0 ]
    then
        REPO=extra${PFIX}
        else
        REPO=core${PFIX}
    fi
    echo $dirname|grep -q "chroot-devel"
    if [ $? = 0 ]
    then
	   REPO=chroot-devel
    fi

    echo $dirname|grep -q "mv-core"
    if [ $? = 0 ]
    then
       REPO=mv-core
    fi

    if [ x`basename $0` = xmpl ]
    then
	REPO="local"
    fi
    DOCROOT=/data/pkg_repo/$CARCH/$REPO
    if [ ! -e $DOCROOT ]
    then
	mkdir -p $DOCROOT
   fi

}


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 -

}


function update-src-pkg {
	DELPKG="$pkgname"-"$pkgver"-*.src.tar.gz
	echo "Removing old src pkg"
	if [ ! -d $PKGHOME/$REPO/$SRCPKG ]
	then
		echo "Creating src_pkg directory"
		 mkdir -p $SRCPKGHOME/$REPO
	fi 
		rm -vf  $SRCPKGHOME/$REPO/$DELPKG
		echo "copying src_pkg  to $SRCPKGHOME/$REPO"
	        cp -f $PKGHOME/$SRCPKG  $SRCPKGHOME/$REPO
}


#MAIN PROGRAM

find_repo

makepkg  --asroot  $@ || exit 1
echo "---------updating database ----------"
update-repo #&& pacman -Sy
echo "----------creating source package---------"
makepkg -f --holdver  --asroot  --source  &&  update-src-pkg