]> git.pld-linux.org Git - packages/rpm-build-tools.git/blame - rpm-build.sh
- add --sn ac-updates to ac-requires
[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"
b15006fb
ER
62 case "$dist" in
63 ac)
70d18f4d
ER
64 sn="$sn --sn $dist-updates"
65
bec0be2e 66 local a ignore
eaca9a85
ER
67 # typo
68 ignore="$ignore kdenetwork-kopete-tool-conectionstatus"
25fd7f1b 69 # obsoleted
eaca9a85
ER
70 ignore="$ignore gimp-plugin-swfdec wine-drv-arts ntp-ntptrace"
71 # quake2@MAIN is now quake2forge, original quake2 restored to quake2
72 ignore="$ignore quake2-3dfx quake2-sdl quake2-sgl quake2-snd-alsa quake2-snd-ao quake2-snd-oss quake2-snd-sdl quake2-static"
25fd7f1b
ER
73 # obsoleted
74 ignore="$ignore mozilla-firefox-lang-en apache1-mod_perl-devel libyasm-static"
eb06631a
ER
75 # renamed (courier-authlib.spec, r1.54)
76 ignore="$ignore courier-authlib-userdb courier-authlib-pipe"
4876f0af
ER
77 # obsoleted, squid 2.6
78 ignore="$ignore squid-winbind_acl squid-winbind_auth"
6bf0c9cd
ER
79 # obsoleted with 1.0.4
80 ignore="$ignore python-numpy-FFT python-numpy-MA python-numpy-RNG"
a7498178
ER
81 # subpkgs renamed
82 ignore="$ignore apache1-doc apache1-index"
0e1522d9
ER
83 # obsoleted by kadu-module-mediaplayer-amarok
84 ignore="$ignore kadu-module-amarok"
85 # obsoleted by kadu-module-mediaplayer-xmms
86 ignore="$ignore kadu-module-xmms"
87 # obsoleted by kadu 0.6.0
92a62be8 88 ignore="$ignore kadu-theme-icons-crystal16 kadu-theme-icons-crystal22 kadu-theme-icons-nuvola16 kadu-theme-icons-nuvola22 kadu-module-iwait4u"
77d1118e
ER
89 # obsoleted
90 ignore="$ignore php-pear-Net_Ping-tests"
bec0be2e 91 for a in $ignore; do
eaca9a85
ER
92 args="$args --ignore=$a"
93 done
b15006fb
ER
94 ;;
95 esac
96
70d18f4d 97 poldek $sn --up --upa -q "$@"
6bf0c9cd 98 poldek $sn --uniq --noignore --verify=deps $args "$@"
2e6b7800 99}
a5ab8a8f 100
5e0caa68
ER
101# displays latest used tag for a specfile
102autotag() {
103 local out
104 for a in "$@"; do
105 s=${a%.spec}.spec
0d7f5939 106 out=$(cvs status -v $s | awk "!/Sticky/&&/auto-$dist-/{if (!a++) print \$1}")
5e0caa68
ER
107 echo "$s:$out"
108 done
7e37b984
ER
109}
110
5e0caa68
ER
111fi # no $dist set
112
113alias cv='cvs status -v'
114alias 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"
115alias pclean="sed -i~ -e '/^\(?\|=\+$\|unchanged:\|diff\|only\|Only\|Files\|Common\|Index:\|RCS file\|retrieving\)/d'"
116
7e37b984 117# makes diff from PLD CVS urls
d29ef356 118# requires: cvs, tee
7e37b984
ER
119urldiff() {
120 local url="$1"
121 if [ -z "$url" ]; then
122 echo >&2 "Reading STDIN"
123 read url
124 fi
125
126 echo >&2 "Process $url"
127 local file="$url"
128 file=${file#*SPECS/}
129 file=${file#*SOURCES/}
130 file=${file##*/}
131 local r1=${file#*r1=}
132 local r2=${r1#*r2=}
8c550ffc 133 r2=${r2%%[&;]*}
7765da19 134 r1=${r1%%[&;]*}
7e37b984 135 file=${file%\?*}
7765da19 136 file=${file%.diff}
7e37b984
ER
137
138 echo >&2 "$file: $r1 -> $r2"
79aa1413
ER
139
140 if [ -t 1 ]; then
ce56ac3b
ER
141 cvs diff -u -r$r1 -r$r2 $file | tee m.patch | diffcol
142 else
143 cvs diff -u -r$r1 -r$r2 $file
79aa1413 144 fi
7e37b984
ER
145}
146
d29ef356
ER
147# makes diff from kde svn path
148# requires: wget, tee
149kdediff() {
150 local url="$1"
151 # --- branches/KDE/3.5/kdepim/kpilot/conduits/vcalconduit/vcalRecord.cc #624744:624745
152 url=${url#*--- }
153 echo >&2 "Process $url"
154 r1=${url#*#}
155 r2=${r1#*:}
156 r1=${r1%:*}
157
158 # 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 159 # http://websvn.kde.org/branches/KDE/3.5/kdenetwork/kopete/protocols/oscar/aim/aimcontact.cpp?r1=609808&r2=673027&view=patch
d29ef356 160 url=http://websvn.kde.org/${url% *}
397a2489 161 url="$url?r1=$r1&r2=$r2&view=patch"
d29ef356
ER
162
163 if [ -t 1 ]; then
164 wget "$url" -O -| tee m.patch | diffcol
165 else
166 wget "$url" -O -
167 fi
168}
169
5e0caa68
ER
170# merges two patches
171# requires: patchutils
172pmerge() {
173 combinediff -p1 $1 $2 > m.patch || return
174 pclean m.patch
175 dif $1 m.patch
176}
177
7e37b984
ER
178# downloads sourceforge url from specific mirror
179sfget() {
180 local url="$1"
181 url="${url%?download}"
54e1e1fd
ER
182 url="${url%?use_mirror=*}"
183 url="${url#http://downloads.}"
7e37b984
ER
184 url="http://dl.${url#http://prdownloads.}"
185 # use mirror
186 local mirror="http://nchc.dl.sourceforge.net"
187 url="$mirror/sourceforge/${url#http://dl.sourceforge.net/}"
188 wget -c "$url"
189}
190
88e7bbe5
ER
191dif() {
192 if [ -t 1 ]; then
193 diff -ur "$@" | diffcol | less -R
194 else
195 diff -ur "$@"
196 fi
197}
198
199diffcol() {
200sed -e '
201 s,\e,\e[44m^[\e[49m,g;
202 s,\a,\e[44m^G\e[49m,g;
203 s,^\(Index:\|diff\|---\|+++\) .*$,\e[32m&,;
204 s,^@@ ,\e[33m&,;
205 s,^-,\e[35m&,;
206 s,^+,\e[36m&,;
207 s,\r,\e[44m^M\e[49m,g;
208 s, , ,g;
209 s,\([^[:space:]]\)\([[:space:]]\+\)$,\1\e[41m\2\e[49m,g;
210 s,$,\e[0m,
211' "$@"
212}
6ef19b16
ER
213
214# chdir to file location and do 'cvs log'
215cvslog() {
216 local f="$1"
0db4548a
ER
217 local d="${f%/*}"
218 [ "$d" = "$f" ] && d=.
219 (builtin cd $d && cvs log ${f##*/})
6ef19b16 220}
2d0b7430
ER
221
222# does diff between FILE and FILE~
924512bf 223# the diff can be applied with patch -p1
2d0b7430 224d() {
924512bf 225 local file="$1"
a0586a59 226 local dir
924512bf
ER
227 if [[ "$file" = /* ]]; then
228 # full path -- no idea where to strip
229 dir=.
230 diff=$file
231 else
232 # relative path -- keep one path component from current dir
233 dir=..
234 diff=${PWD##*/}/${file}
235 fi
236
237 (builtin cd "$dir"; dif $diff{~,})
2d0b7430 238}
This page took 0.070852 seconds and 4 git commands to generate.