]> git.pld-linux.org Git - packages/rpm-build-macros.git/blob - rpm-build.sh
- pass args in dist-verify
[packages/rpm-build-macros.git] / rpm-build.sh
1 # shell aliases and functions for PLD Developer
2 # $Id$
3
4 # set $dist, used by functions below
5 [ -n "$dist" ] || dist=$(awk '{print tolower($NF)}' /etc/pld-release 2>/dev/null | tr -d '()')
6
7 if [ "$dist" ]; then
8
9 alias $dist="poldek -q --sn $dist --cmd"
10 alias $dist-requires="$dist what-requires"
11 alias $dist-provides="$dist what-provides"
12 alias $dist-tag="./builder -cf -T $(echo $dist | tr '[a-z]' '[A-Z]')-branch -r HEAD"
13 alias $dist-verify=dist-verify
14
15 dist-verify() {
16         poldek --sn $dist --sn $dist-ready --up
17         poldek --sn $dist --sn $dist-ready --verify=deps "$@"
18 }
19
20 # displays latest used tag for a specfile
21 autotag() {
22         local out
23         for a in "$@"; do
24                 s=${a%.spec}.spec
25                 out=$(cvs status -v $s | awk "/auto-$dist-/{if (!a++) print \$1}")
26                 echo "$s:$out"
27         done
28 }
29
30 fi # no $dist set
31
32 alias cv='cvs status -v'
33 alias 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"
34 alias pclean="sed -i~ -e '/^\(?\|=\+$\|unchanged:\|diff\|only\|Only\|Files\|Common\|Index:\|RCS file\|retrieving\)/d'"
35
36 # makes diff from PLD CVS urls
37 # requires: cvs, tee
38 urldiff() {
39         local url="$1"
40         if [ -z "$url" ]; then
41                 echo >&2 "Reading STDIN"
42                 read url
43         fi
44
45         echo >&2 "Process $url"
46         local file="$url"
47         file=${file#*SPECS/}
48         file=${file#*SOURCES/}
49         file=${file##*/}
50         local r1=${file#*r1=}
51         local r2=${r1#*r2=}
52         r2=${r2%[&;]*}
53         r1=${r1%%[&;]*}
54         file=${file%\?*}
55         file=${file%.diff}
56
57         echo >&2 "$file: $r1 -> $r2"
58
59         if [ -t 1 ]; then
60                 cvs diff -u -r$r1 -r$r2 $file | tee m.patch | diffcol
61         else
62                 cvs diff -u -r$r1 -r$r2 $file
63         fi
64 }
65
66 # makes diff from kde svn path
67 # requires: wget, tee
68 kdediff() {
69         local url="$1"
70         # --- branches/KDE/3.5/kdepim/kpilot/conduits/vcalconduit/vcalRecord.cc #624744:624745
71         url=${url#*--- }
72         echo >&2 "Process $url"
73         r1=${url#*#}
74         r2=${r1#*:}
75         r1=${r1%:*}
76
77         #  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
78         url=http://websvn.kde.org/${url% *}
79         url="$url?r1=$r1&r2=$r2&makepatch=1&diff_format=u"
80
81         if [ -t 1 ]; then
82                 wget "$url" -O -| tee m.patch | diffcol
83         else
84                 wget "$url" -O -
85         fi
86 }
87
88 # merges two patches
89 # requires: patchutils
90 pmerge() {
91         combinediff -p1 $1 $2 > m.patch || return
92         pclean m.patch
93         dif $1 m.patch
94 }
95
96 # downloads sourceforge url from specific mirror
97 sfget() {
98         local url="$1"
99         url="${url%?download}"
100         url="http://dl.${url#http://prdownloads.}"
101         # use mirror
102         local mirror="http://nchc.dl.sourceforge.net"
103         url="$mirror/sourceforge/${url#http://dl.sourceforge.net/}"
104         wget -c "$url"
105 }
106
107 dif() {
108         if [ -t 1 ]; then
109                 diff -ur "$@" | diffcol | less -R
110         else
111                 diff -ur "$@"
112         fi
113 }
114
115 diffcol() {
116 sed -e '
117         s,\e,\e[44m^[\e[49m,g;
118         s,\a,\e[44m^G\e[49m,g;
119         s,^\(Index:\|diff\|---\|+++\) .*$,\e[32m&,;
120         s,^@@ ,\e[33m&,;
121         s,^-,\e[35m&,;
122         s,^+,\e[36m&,;
123         s,\r,\e[44m^M\e[49m,g;
124         s,      ,    ,g;
125         s,\([^[:space:]]\)\([[:space:]]\+\)$,\1\e[41m\2\e[49m,g;
126         s,$,\e[0m,
127 ' "$@"
128 }
129
130 # chdir to file location and do 'cvs log'
131 cvslog() {
132         local f="$1"
133         local d="${f%/*}"
134         [ "$d" = "$f" ] && d=.
135         (builtin cd $d && cvs log ${f##*/})
136 }
This page took 0.03356 seconds and 4 git commands to generate.