blob: 82f665daa33d363190b5fad2284a02b34445f946 (
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
#!/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`
repolist="core extra"
cmdline=$@
if [ x`basename $0` = xmpr ]
then
PFIX=""
else
PFIX="-testing"
fi
function bump {
echo x$cmdline | grep -q \\-b
if [ $? = 0 ]
then
cmdline=`echo $cmdline|sed -e "s/-b//g"`
i="PKGBUILD"
#getting pkgrel number after =
package_pkgrel=`cat $i | grep pkgrel= | cut -d'=' -f 2`
#extract number before dot in pkgrel
beforedot=`echo $package_pkgrel | cut -n -d'.' -f 1`
#add 1 to pkgrel
new_pkgrel=$[$beforedot+1]
#write it back to PKGBUILD
sed -i "s:pkgrel=${package_pkgrel}:pkgrel=${new_pkgrel}:g" $i
echo "bumped $pkgname release from $package_pkgrel to $new_pkgrel"
. PKGBUILD
fi
TOTALPKG="$pkgname"-"$pkgver"-"$pkgrel"-"$CARCH".pkg.tar.gz
SRCPKG="$pkgname"-"$pkgver"-"$pkgrel".src.tar.gz
}
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 $CARCH/$REPO:"
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
}
function dup_check {
if [ $REPO = "local" -o $REPO = "mv-core" ]
then
return
fi
for i in $repolist
do
if [ ! $i$PFIX = $REPO ]
then
out=`pacman -Sl $i$PFIX|cut -d" " -f2 |grep ^pkgname$`
if [ $? = 0 ]
then
echo "#######################################"
echo "$pkgname already exists in $i$PFIX"
echo " "$out
echo
echo x$cmdline|grep -q \\-f
if [ $? = 0 ]
then
echo "Force detected, making pkg anyhow"
echo "#######################################"
return
else
echo "#######################################"
exit 2
fi
fi
fi
done
}
#MAIN PROGRAM
find_repo
dup_check
bump
echo "---------------"
makepkg --asroot $cmdline || exit 1
echo "---------updating database ----------"
update-repo #&& pacman -Sy
echo "----------creating source package---------"
makepkg -f --holdver --asroot --source && update-src-pkg
|