]> git.pld-linux.org Git - packages/rpm-build-tools.git/blame - rpm-build.sh
- skip functions,aliases when no $dist is set for ones that use it
[packages/rpm-build-tools.git] / rpm-build.sh
CommitLineData
7e37b984 1# shell aliases and functions for PLD Developer
6657c577 2# $Id$
7e37b984 3
2e6b7800
ER
4# set $dist, used by functions below
5[ -n "$dist" ] || dist=$(awk '{print tolower($NF)}' /etc/pld-release 2>/dev/null | tr -d '()')
6
5e0caa68 7if [ "$dist" ]; then
7e37b984 8
2e6b7800
ER
9alias $dist="poldek -q --sn $dist --cmd"
10alias $dist-requires="$dist what-requires"
11alias $dist-provides="$dist what-provides"
12alias $dist-tag="./builder -cf -T $(echo $dist | tr '[a-z]' '[A-Z]')-branch -r HEAD"
13alias $dist-verify=dist-verify
14
15function dist-verify() {
16 poldek --sn $dist --sn $dist-ready --up
17 poldek --sn $dist --sn $dist-ready --verify=deps
18}
a5ab8a8f 19
5e0caa68
ER
20# displays latest used tag for a specfile
21autotag() {
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
7e37b984
ER
28}
29
5e0caa68
ER
30fi # no $dist set
31
32alias cv='cvs status -v'
33alias 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"
34alias pclean="sed -i~ -e '/^\(?\|=\+$\|unchanged:\|diff\|only\|Only\|Files\|Common\|Index:\|RCS file\|retrieving\)/d'"
35
7e37b984
ER
36# makes diff from PLD CVS urls
37urldiff() {
38 local url="$1"
39 if [ -z "$url" ]; then
40 echo >&2 "Reading STDIN"
41 read url
42 fi
43
44 echo >&2 "Process $url"
45 local file="$url"
46 file=${file#*SPECS/}
47 file=${file#*SOURCES/}
48 file=${file##*/}
49 local r1=${file#*r1=}
50 local r2=${r1#*r2=}
7765da19
ER
51 r2=${r2%[&;]*}
52 r1=${r1%%[&;]*}
7e37b984 53 file=${file%\?*}
7765da19 54 file=${file%.diff}
7e37b984
ER
55
56 echo >&2 "$file: $r1 -> $r2"
79aa1413
ER
57
58 if [ -t 1 ]; then
ce56ac3b
ER
59 cvs diff -u -r$r1 -r$r2 $file | tee m.patch | diffcol
60 else
61 cvs diff -u -r$r1 -r$r2 $file
79aa1413 62 fi
7e37b984
ER
63}
64
5e0caa68
ER
65# merges two patches
66# requires: patchutils
67pmerge() {
68 combinediff -p1 $1 $2 > m.patch || return
69 pclean m.patch
70 dif $1 m.patch
71}
72
7e37b984
ER
73# downloads sourceforge url from specific mirror
74sfget() {
75 local url="$1"
76 url="${url%?download}"
77 url="http://dl.${url#http://prdownloads.}"
78 # use mirror
79 local mirror="http://nchc.dl.sourceforge.net"
80 url="$mirror/sourceforge/${url#http://dl.sourceforge.net/}"
81 wget -c "$url"
82}
83
88e7bbe5
ER
84dif() {
85 if [ -t 1 ]; then
86 diff -ur "$@" | diffcol | less -R
87 else
88 diff -ur "$@"
89 fi
90}
91
92diffcol() {
93sed -e '
94 s,\e,\e[44m^[\e[49m,g;
95 s,\a,\e[44m^G\e[49m,g;
96 s,^\(Index:\|diff\|---\|+++\) .*$,\e[32m&,;
97 s,^@@ ,\e[33m&,;
98 s,^-,\e[35m&,;
99 s,^+,\e[36m&,;
100 s,\r,\e[44m^M\e[49m,g;
101 s, , ,g;
102 s,\([^[:space:]]\)\([[:space:]]\+\)$,\1\e[41m\2\e[49m,g;
103 s,$,\e[0m,
104' "$@"
105}
6ef19b16
ER
106
107# chdir to file location and do 'cvs log'
108cvslog() {
109 local f="$1"
0db4548a
ER
110 local d="${f%/*}"
111 [ "$d" = "$f" ] && d=.
112 (builtin cd $d && cvs log ${f##*/})
6ef19b16 113}
This page took 0.138657 seconds and 4 git commands to generate.