1 # shell aliases and functions for PLD Developer
3 # set $dist, used by functions below
4 [ -n "$dist" ] || dist=$(lsb_release -sc 2>/dev/null | tr 'A-Z' 'a-z')
5 [ -n "$dist" ] || dist=$(awk '/PLD Linux/ {print tolower($NF)}' /etc/pld-release 2>/dev/null | tr -d '()')
7 alias q='rpm -q --qf "%{N}-%|E?{%{E}:}|%{V}-%{R}.%{ARCH}\n"'
8 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"
9 alias pclean="sed -i~ -e '/^\(?\|=\+$\|unchanged:\|diff\|only\|Only\|Tylko\|Binary files\|Files\|Common\|index \|Index:\|RCS file\|retrieving\)/d'"
12 # note: it will do it blindly, so any lang other than -pl is most likely broken
15 iconv -futf8 -tlatin2 "$spec" > m
16 sed -e 's/\.UTF-8//' m > "$spec"
21 # requires: patchutils
23 combinediff -p1 $1 $2 > m.patch || return
28 # downloads sourceforge url from specific mirror
31 url="${url%?download}"
32 url="${url%?use_mirror=*}"
33 url="${url#http://downloads.}"
34 url="http://dl.${url#http://prdownloads.}"
36 local mirror="http://nchc.dl.sourceforge.net"
37 url="$mirror/sourceforge/${url#http://dl.sourceforge.net/}"
43 diff -ur -x .svn -x .git -x .bzr -x CVS "$@" | diffcol | less -R
45 diff -ur -x .svn -x .git -x .bzr -x CVS "$@"
51 s,
\e,
\e[44m^[
\e[49m,g;
52 s,
\a,
\e[44m^G
\e[49m,g;
53 s,^\(Index:\|diff\|---\|+++\) .*$,
\e[32m&,;
57 s,\r,
\e[44m^M
\e[49m,g;
59 s,\([^[:space:]]\)\([[:space:]]\+\)$,\1
\e[41m\2
\e[49m,g;
64 # does diff between FILE~ and FILE
65 # the diff can be applied with patch -p1
69 if [[ "$file" = /* ]]; then
70 # full path -- no idea where to strip
74 # relative path -- keep one path component from current dir
76 diff=${PWD##*/}/${file}
79 (builtin cd "$dir"; dif $diff{~,} "$@")
84 sed -re 's,^(.+)-[^-]+-[^-]+$,\1.spec,'
87 # move AC-branch tag to current checkout
88 # if AC-branch as branch exists, it is first removed
90 # see if remote has branch present
91 local branch=AC-branch
92 if git show-ref -q refs/remotes/origin/$branch; then
94 if [ -z "$(git tag --points-at origin/$branch 2>/dev/null)" ]; then
95 echo >&2 "There's no tag pointing to current $branch; refusing to delete branch"
98 # delete local branch if exists
99 git show-ref -q refs/heads/$branch && git branch -d $branch
102 git push --delete origin $branch
106 git push -f origin $branch
109 ###### functions/aliases below require $dist to be set ######
119 if [ -z "$dist" ]; then
123 alias ipoldek-$dist="poldek -q --sn $dist --cmd"
124 alias $dist-provides="ipoldek-$dist what-provides"
125 alias $dist-verify=dist-verify
126 alias $dist-requires=dist-requires
130 while [ $# -gt 0 ]; do
148 opts="$opts --sn=$dist-updates"
152 poldek -q -Q --sn $dist $opts --cmd what-requires $deps
161 sn="$sn --sn $dist-updates"
165 ignore="$ignore kdenetwork-kopete-tool-conectionstatus"
167 ignore="$ignore gimp-plugin-swfdec wine-drv-arts ntp-ntptrace"
168 # quake2@MAIN is now quake2forge, original quake2 restored to quake2
169 ignore="$ignore quake2-3dfx quake2-sdl quake2-sgl quake2-snd-alsa quake2-snd-ao quake2-snd-oss quake2-snd-sdl quake2-static"
171 ignore="$ignore mozilla-firefox-lang-en apache1-mod_perl-devel libyasm-static"
172 # renamed (courier-authlib.spec, r1.54)
173 ignore="$ignore courier-authlib-userdb courier-authlib-pipe"
174 # obsoleted, squid 2.6
175 ignore="$ignore squid-winbind_acl squid-winbind_auth"
176 # obsoleted with 1.0.4
177 ignore="$ignore python-numpy-FFT python-numpy-MA python-numpy-RNG"
179 ignore="$ignore apache1-doc apache1-index"
180 # obsoleted by kadu-module-mediaplayer-amarok
181 ignore="$ignore kadu-module-amarok"
182 # obsoleted by kadu-module-mediaplayer-xmms
183 ignore="$ignore kadu-module-xmms"
184 # obsoleted by kadu 0.6.0
185 ignore="$ignore kadu-theme-icons-crystal16 kadu-theme-icons-crystal22 kadu-theme-icons-nuvola16 kadu-theme-icons-nuvola22 kadu-module-iwait4u"
186 # obsoleted pear test packages
187 ignore="$ignore php-*-tests"
189 ignore="$ignore nmap-X11"
190 # mksd dependency not distributale
191 ignore="$ignore samba-vfs-vscan-mks"
192 # ibbackup is not distributale
193 ignore="$ignore innobackup"
195 ignore="$ignore ntp-client ntp"
196 # php4 only(php-pecl-tidy), for php<5.2(php-pecl-filter)
197 ignore="$ignore php-pecl-tidy php-pecl-filter"
199 # renamed to vim-syntax-txt2tags
200 ignore="$ignore txt2tags-vim"
203 args="$args --ignore=$a"
208 poldek $sn --up --upa -q "$@"
209 poldek $sn --uniq --noignore --verify=deps $args "$@"
212 # displays latest used tag for a specfile
218 # ensure package ends with .spec
221 out=$(git for-each-ref --count=1 --sort=-authordate refs/tags/auto/$dist \
222 --format='%(refname:short)')
230 echo >&2 "Usage: get-buildlog PACKAGE"
232 echo >&2 "Grabs buildlogs from pld builder for all arch."
239 archlist='i686 i586 i386 athlon alpha sparc amd64 ppc'
242 archlist='x86_64 i486 i686'
245 echo >&2 "get-buildlog: $dist buildlogs are /dev/null"
249 local url arch path ftp=ftp://buildlogs.pld-linux.org
250 for arch in $archlist; do
251 [ "$arch" ] || continue
253 echo -n "Checking $p.$arch... "
254 url=$(lftp -c "debug 0;open $ftp; cls --sort=date -r /$dist/$arch/OK/$p,*.bz2 /$dist/$arch/FAIL/$p,*.bz2 | tail -n1")
258 if wget -q $url -O .$p~; then
260 mv -f .$p~ $p.$arch.bz2