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