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