]> git.pld-linux.org Git - packages/rpm-build-macros.git/blame - rpm-build.sh
- 1.184 (only *.info* are compressed in %{_infodir}
[packages/rpm-build-macros.git] / rpm-build.sh
CommitLineData
c8e059d2 1# shell aliases and functions for PLD Developer
2b7ced4e 2# $Id$
c8e059d2 3
6fe6a2a4 4# set $dist, used by functions below
5c2093ec
ER
5[ -n "$dist" ] || dist=$(awk '/PLD Linux/ {print tolower($NF)}' /etc/pld-release 2>/dev/null | tr -d '()')
6
7case "$dist" in
8ac|th)
9 ;;
10*)
11 # invalid one ;)
12 dist=
13esac
6fe6a2a4 14
e85b9743 15if [ "$dist" ]; then
c8e059d2 16
289dcc48
ER
17alias ipoldek-$dist="poldek -q --sn $dist --cmd"
18alias $dist-requires="ipoldek-$dist what-requires"
19alias $dist-provides="ipoldek-$dist what-provides"
6fe6a2a4
ER
20alias $dist-tag="./builder -cf -T $(echo $dist | tr '[a-z]' '[A-Z]')-branch -r HEAD"
21alias $dist-verify=dist-verify
22
e847eeee
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
d2023b7e 32dist-verify() {
a908a907
ER
33 poldek --sn $dist --sn $dist-ready --sn $dist-updates --up
34 poldek --sn $dist --sn $dist-ready --sn $dist-updates --noignore --verify=deps "$@"
6fe6a2a4 35}
8a437893 36
e85b9743
ER
37# displays latest used tag for a specfile
38autotag() {
39 local out
40 for a in "$@"; do
41 s=${a%.spec}.spec
42 out=$(cvs status -v $s | awk "/auto-$dist-/{if (!a++) print \$1}")
43 echo "$s:$out"
44 done
c8e059d2
ER
45}
46
e85b9743
ER
47fi # no $dist set
48
49alias cv='cvs status -v'
50alias 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"
51alias pclean="sed -i~ -e '/^\(?\|=\+$\|unchanged:\|diff\|only\|Only\|Files\|Common\|Index:\|RCS file\|retrieving\)/d'"
52
c8e059d2 53# makes diff from PLD CVS urls
c29353a7 54# requires: cvs, tee
c8e059d2
ER
55urldiff() {
56 local url="$1"
57 if [ -z "$url" ]; then
58 echo >&2 "Reading STDIN"
59 read url
60 fi
61
62 echo >&2 "Process $url"
63 local file="$url"
64 file=${file#*SPECS/}
65 file=${file#*SOURCES/}
66 file=${file##*/}
67 local r1=${file#*r1=}
68 local r2=${r1#*r2=}
4e29310e 69 r2=${r2%%[&;]*}
d6b37e93 70 r1=${r1%%[&;]*}
c8e059d2 71 file=${file%\?*}
d6b37e93 72 file=${file%.diff}
c8e059d2
ER
73
74 echo >&2 "$file: $r1 -> $r2"
a5e372c8
ER
75
76 if [ -t 1 ]; then
adeebf51
ER
77 cvs diff -u -r$r1 -r$r2 $file | tee m.patch | diffcol
78 else
79 cvs diff -u -r$r1 -r$r2 $file
a5e372c8 80 fi
c8e059d2
ER
81}
82
c29353a7
ER
83# makes diff from kde svn path
84# requires: wget, tee
85kdediff() {
86 local url="$1"
87 # --- branches/KDE/3.5/kdepim/kpilot/conduits/vcalconduit/vcalRecord.cc #624744:624745
88 url=${url#*--- }
89 echo >&2 "Process $url"
90 r1=${url#*#}
91 r2=${r1#*:}
92 r1=${r1%:*}
93
94 # 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
95 url=http://websvn.kde.org/${url% *}
96 url="$url?r1=$r1&r2=$r2&makepatch=1&diff_format=u"
97
98 if [ -t 1 ]; then
99 wget "$url" -O -| tee m.patch | diffcol
100 else
101 wget "$url" -O -
102 fi
103}
104
e85b9743
ER
105# merges two patches
106# requires: patchutils
107pmerge() {
108 combinediff -p1 $1 $2 > m.patch || return
109 pclean m.patch
110 dif $1 m.patch
111}
112
c8e059d2
ER
113# downloads sourceforge url from specific mirror
114sfget() {
115 local url="$1"
116 url="${url%?download}"
117 url="http://dl.${url#http://prdownloads.}"
118 # use mirror
119 local mirror="http://nchc.dl.sourceforge.net"
120 url="$mirror/sourceforge/${url#http://dl.sourceforge.net/}"
121 wget -c "$url"
122}
123
aa560f74
ER
124dif() {
125 if [ -t 1 ]; then
126 diff -ur "$@" | diffcol | less -R
127 else
128 diff -ur "$@"
129 fi
130}
131
132diffcol() {
133sed -e '
134 s,\e,\e[44m^[\e[49m,g;
135 s,\a,\e[44m^G\e[49m,g;
136 s,^\(Index:\|diff\|---\|+++\) .*$,\e[32m&,;
137 s,^@@ ,\e[33m&,;
138 s,^-,\e[35m&,;
139 s,^+,\e[36m&,;
140 s,\r,\e[44m^M\e[49m,g;
141 s, , ,g;
142 s,\([^[:space:]]\)\([[:space:]]\+\)$,\1\e[41m\2\e[49m,g;
143 s,$,\e[0m,
144' "$@"
145}
bb13b717
ER
146
147# chdir to file location and do 'cvs log'
148cvslog() {
149 local f="$1"
1887ad1b
ER
150 local d="${f%/*}"
151 [ "$d" = "$f" ] && d=.
152 (builtin cd $d && cvs log ${f##*/})
bb13b717 153}
ed1023ef
ER
154
155# does diff between FILE and FILE~
524e21d9 156# the diff can be applied with patch -p1
ed1023ef 157d() {
524e21d9 158 local file="$1"
1ee5f614 159 local dir
524e21d9
ER
160 if [[ "$file" = /* ]]; then
161 # full path -- no idea where to strip
162 dir=.
163 diff=$file
164 else
165 # relative path -- keep one path component from current dir
166 dir=..
167 diff=${PWD##*/}/${file}
168 fi
169
170 (builtin cd "$dir"; dif $diff{~,})
ed1023ef 171}
This page took 0.057189 seconds and 4 git commands to generate.