]> git.pld-linux.org Git - packages/rpm-build-tools.git/blame - rpm-build.sh
- add get-buildlog()
[packages/rpm-build-tools.git] / rpm-build.sh
CommitLineData
7e37b984 1# shell aliases and functions for PLD Developer
6657c577 2# $Id$
7e37b984 3
2e6b7800 4# set $dist, used by functions below
c8a54e84
ER
5[ -n "$dist" ] || dist=$(awk '/PLD Linux/ {print tolower($NF)}' /etc/pld-release 2>/dev/null | tr -d '()')
6
7case "$dist" in
15aa13b9 8ac|th|ti)
c8a54e84
ER
9 ;;
10*)
11 # invalid one ;)
12 dist=
13esac
2e6b7800 14
5e0caa68 15if [ "$dist" ]; then
7e37b984 16
d392508c 17alias ipoldek-$dist="poldek -q --sn $dist --cmd"
d392508c 18alias $dist-provides="ipoldek-$dist what-provides"
2e6b7800
ER
19alias $dist-tag="./builder -cf -T $(echo $dist | tr '[a-z]' '[A-Z]')-branch -r HEAD"
20alias $dist-verify=dist-verify
c48232ce 21alias $dist-requires=dist-requires
2e6b7800 22
6ebe30c9
ER
23# undo spec utf8
24# note: it will do it blindly, so any lang other than -pl is most likely broken
25specutfundo() {
26 local spec="$1"
27 iconv -futf8 -tlatin2 "$spec" > m
28 sed -e 's/\.UTF-8//' m > "$spec"
29 rm -f m
30}
31
c48232ce
ER
32dist-requires() {
33 local opts deps
34 while [ $# -gt 0 ]; do
35 case "$1" in
36 --sn)
37 opts="$opts $1 $2"
38 shift
39 ;;
40 -*)
41 opts="$opts $1"
42 ;;
43 *)
44 deps="$deps $1"
45 ;;
46 esac
47 shift
48 done
f43b3983
ER
49
50 case "$dist" in
51 ac)
52 opts="$opts --sn=$dist-updates"
53 ;;
54 esac
55
56 poldek -q -Q --sn $dist $opts --cmd what-requires $deps
c48232ce
ER
57}
58
37ae34a0 59dist-verify() {
70d18f4d
ER
60 local args sn
61 sn="--sn $dist"
3e963c20 62
b15006fb
ER
63 case "$dist" in
64 ac)
70d18f4d
ER
65 sn="$sn --sn $dist-updates"
66
bec0be2e 67 local a ignore
eaca9a85
ER
68 # typo
69 ignore="$ignore kdenetwork-kopete-tool-conectionstatus"
25fd7f1b 70 # obsoleted
eaca9a85
ER
71 ignore="$ignore gimp-plugin-swfdec wine-drv-arts ntp-ntptrace"
72 # quake2@MAIN is now quake2forge, original quake2 restored to quake2
73 ignore="$ignore quake2-3dfx quake2-sdl quake2-sgl quake2-snd-alsa quake2-snd-ao quake2-snd-oss quake2-snd-sdl quake2-static"
25fd7f1b
ER
74 # obsoleted
75 ignore="$ignore mozilla-firefox-lang-en apache1-mod_perl-devel libyasm-static"
eb06631a
ER
76 # renamed (courier-authlib.spec, r1.54)
77 ignore="$ignore courier-authlib-userdb courier-authlib-pipe"
4876f0af
ER
78 # obsoleted, squid 2.6
79 ignore="$ignore squid-winbind_acl squid-winbind_auth"
6bf0c9cd
ER
80 # obsoleted with 1.0.4
81 ignore="$ignore python-numpy-FFT python-numpy-MA python-numpy-RNG"
a7498178
ER
82 # subpkgs renamed
83 ignore="$ignore apache1-doc apache1-index"
0e1522d9
ER
84 # obsoleted by kadu-module-mediaplayer-amarok
85 ignore="$ignore kadu-module-amarok"
86 # obsoleted by kadu-module-mediaplayer-xmms
87 ignore="$ignore kadu-module-xmms"
88 # obsoleted by kadu 0.6.0
92a62be8 89 ignore="$ignore kadu-theme-icons-crystal16 kadu-theme-icons-crystal22 kadu-theme-icons-nuvola16 kadu-theme-icons-nuvola22 kadu-module-iwait4u"
77d1118e
ER
90 # obsoleted
91 ignore="$ignore php-pear-Net_Ping-tests"
3e963c20
ER
92 # renamed to vim-syntax-txt2tags
93 ignore="$ignore txt2tags-vim"
bec0be2e 94 for a in $ignore; do
eaca9a85
ER
95 args="$args --ignore=$a"
96 done
b15006fb
ER
97 ;;
98 esac
99
70d18f4d 100 poldek $sn --up --upa -q "$@"
6bf0c9cd 101 poldek $sn --uniq --noignore --verify=deps $args "$@"
2e6b7800 102}
a5ab8a8f 103
5e0caa68
ER
104# displays latest used tag for a specfile
105autotag() {
106 local out
107 for a in "$@"; do
108 s=${a%.spec}.spec
0d7f5939 109 out=$(cvs status -v $s | awk "!/Sticky/&&/auto-$dist-/{if (!a++) print \$1}")
5e0caa68
ER
110 echo "$s:$out"
111 done
7e37b984
ER
112}
113
3bc010e2
ER
114get-buildlog() {
115 local p=$1
116 if [ -z "$p" ]; then
117 echo >&2 "Usage: get-buildlog PACKAGE"
118 echo >&2 ""
119 echo >&2 "Grabs buildlogs from pld builder for all arch."
120 return
121 fi
122
123 local al
124 case "$dist" in
125 ac)
126 al='i686,i586,i386,athlon,alpha,sparc,amd64,ppc'
127 ;;
128 th)
129 al='x86_64,athlon,i486,i686,ppc'
130 ;;
131 *)
132 echo >&2 "get-buildlog: $dist buildlogs are /dev/null"
133 return
134 esac
135
136 local u a s=ftp://buildlogs.pld-linux.org
137 for u in `eval echo $s/$dist/{$al}/{OK,FAIL}/$p.bz2`; do
138 a=${u#$s/$dist/}; a=${a%%/*}
139 echo -n "Fetching $u... "
140 if wget -q $u -O .$p~; then
141 echo "OK"
142 mv -f .$p~ $p.$a.bz2
143 else
144 echo "SKIP"
145 rm -f .$p~
146 fi
147 done
148}
149
5e0caa68
ER
150fi # no $dist set
151
152alias cv='cvs status -v'
153alias adif="dif -x '*.m4' -x ltmain.sh -x install-sh -x depcomp -x 'Makefile.in' -x compile -x 'config.*' -x configure -x missing -x mkinstalldirs -x autom4te.cache"
154alias pclean="sed -i~ -e '/^\(?\|=\+$\|unchanged:\|diff\|only\|Only\|Files\|Common\|Index:\|RCS file\|retrieving\)/d'"
155
7e37b984 156# makes diff from PLD CVS urls
d29ef356 157# requires: cvs, tee
7e37b984
ER
158urldiff() {
159 local url="$1"
160 if [ -z "$url" ]; then
161 echo >&2 "Reading STDIN"
162 read url
163 fi
164
165 echo >&2 "Process $url"
166 local file="$url"
167 file=${file#*SPECS/}
168 file=${file#*SOURCES/}
169 file=${file##*/}
170 local r1=${file#*r1=}
171 local r2=${r1#*r2=}
8c550ffc 172 r2=${r2%%[&;]*}
7765da19 173 r1=${r1%%[&;]*}
7e37b984 174 file=${file%\?*}
7765da19 175 file=${file%.diff}
7e37b984
ER
176
177 echo >&2 "$file: $r1 -> $r2"
79aa1413
ER
178
179 if [ -t 1 ]; then
ce56ac3b
ER
180 cvs diff -u -r$r1 -r$r2 $file | tee m.patch | diffcol
181 else
182 cvs diff -u -r$r1 -r$r2 $file
79aa1413 183 fi
7e37b984
ER
184}
185
d29ef356
ER
186# makes diff from kde svn path
187# requires: wget, tee
188kdediff() {
189 local url="$1"
190 # --- branches/KDE/3.5/kdepim/kpilot/conduits/vcalconduit/vcalRecord.cc #624744:624745
191 url=${url#*--- }
192 echo >&2 "Process $url"
193 r1=${url#*#}
194 r2=${r1#*:}
195 r1=${r1%:*}
196
197 # http://websvn.kde.org/branches/KDE/3.5/kdepim/kpilot/conduits/vcalconduit/vcalRecord.cc?rev=624745&r1=612579&r2=624745&makepatch=1&diff_format=u
397a2489 198 # http://websvn.kde.org/branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/aim/aimcontact.cpp?r1=609808&r2=673027&view=patch
d29ef356 199 url=http://websvn.kde.org/${url% *}
397a2489 200 url="$url?r1=$r1&r2=$r2&view=patch"
d29ef356
ER
201
202 if [ -t 1 ]; then
203 wget "$url" -O -| tee m.patch | diffcol
204 else
205 wget "$url" -O -
206 fi
207}
208
5e0caa68
ER
209# merges two patches
210# requires: patchutils
211pmerge() {
212 combinediff -p1 $1 $2 > m.patch || return
213 pclean m.patch
214 dif $1 m.patch
215}
216
7e37b984
ER
217# downloads sourceforge url from specific mirror
218sfget() {
219 local url="$1"
220 url="${url%?download}"
54e1e1fd
ER
221 url="${url%?use_mirror=*}"
222 url="${url#http://downloads.}"
7e37b984
ER
223 url="http://dl.${url#http://prdownloads.}"
224 # use mirror
225 local mirror="http://nchc.dl.sourceforge.net"
226 url="$mirror/sourceforge/${url#http://dl.sourceforge.net/}"
227 wget -c "$url"
228}
229
88e7bbe5
ER
230dif() {
231 if [ -t 1 ]; then
232 diff -ur "$@" | diffcol | less -R
233 else
234 diff -ur "$@"
235 fi
236}
237
238diffcol() {
239sed -e '
240 s,\e,\e[44m^[\e[49m,g;
241 s,\a,\e[44m^G\e[49m,g;
242 s,^\(Index:\|diff\|---\|+++\) .*$,\e[32m&,;
243 s,^@@ ,\e[33m&,;
244 s,^-,\e[35m&,;
245 s,^+,\e[36m&,;
3bc010e2
ER
246 s,
247,\e[44m^M\e[49m,g;
88e7bbe5
ER
248 s, , ,g;
249 s,\([^[:space:]]\)\([[:space:]]\+\)$,\1\e[41m\2\e[49m,g;
250 s,$,\e[0m,
251' "$@"
252}
6ef19b16
ER
253
254# chdir to file location and do 'cvs log'
255cvslog() {
256 local f="$1"
0db4548a
ER
257 local d="${f%/*}"
258 [ "$d" = "$f" ] && d=.
259 (builtin cd $d && cvs log ${f##*/})
6ef19b16 260}
2d0b7430
ER
261
262# does diff between FILE and FILE~
924512bf 263# the diff can be applied with patch -p1
2d0b7430 264d() {
924512bf 265 local file="$1"
a0586a59 266 local dir
924512bf
ER
267 if [[ "$file" = /* ]]; then
268 # full path -- no idea where to strip
269 dir=.
270 diff=$file
271 else
272 # relative path -- keep one path component from current dir
273 dir=..
274 diff=${PWD##*/}/${file}
275 fi
276
277 (builtin cd "$dir"; dif $diff{~,})
2d0b7430 278}
This page took 0.074953 seconds and 4 git commands to generate.