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