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