# $Id$
# set $dist, used by functions below
-[ -n "$dist" ] || dist=$(awk '{print tolower($NF)}' /etc/pld-release 2>/dev/null | tr -d '()')
+[ -n "$dist" ] || dist=$(awk '/PLD Linux/ {print tolower($NF)}' /etc/pld-release 2>/dev/null | tr -d '()')
+
+case "$dist" in
+ac|th)
+ ;;
+*)
+ # invalid one ;)
+ dist=
+esac
if [ "$dist" ]; then
-alias $dist="poldek -q --sn $dist --cmd"
-alias $dist-requires="$dist what-requires"
-alias $dist-provides="$dist what-provides"
+alias ipoldek-$dist="poldek -q --sn $dist --cmd"
+alias $dist-requires="ipoldek-$dist what-requires"
+alias $dist-provides="ipoldek-$dist what-provides"
alias $dist-tag="./builder -cf -T $(echo $dist | tr '[a-z]' '[A-Z]')-branch -r HEAD"
alias $dist-verify=dist-verify
+# undo spec utf8
+# note: it will do it blindly, so any lang other than -pl is most likely broken
+specutfundo() {
+ local spec="$1"
+ iconv -futf8 -tlatin2 "$spec" > m
+ sed -e 's/\.UTF-8//' m > "$spec"
+ rm -f m
+}
+
dist-verify() {
- poldek --sn $dist --sn $dist-ready --up
- poldek --sn $dist --sn $dist-ready --verify=deps "$@"
+ case "$dist" in
+ ac)
+ args='--ignore=kdenetwork-kopete-tool-conectionstatus --ignore=gimp-plugin-swfdec --ignore=wine-drv-arts'
+ ;;
+ esac
+
+ poldek --sn $dist --sn $dist-updates --up
+ poldek --sn $dist --sn $dist-updates --noignore --verify=deps $args "$@"
}
# displays latest used tag for a specfile
file=${file##*/}
local r1=${file#*r1=}
local r2=${r1#*r2=}
- r2=${r2%[&;]*}
+ r2=${r2%%[&;]*}
r1=${r1%%[&;]*}
file=${file%\?*}
file=${file%.diff}
sfget() {
local url="$1"
url="${url%?download}"
+ url="${url%?use_mirror=*}"
+ url="${url#http://downloads.}"
url="http://dl.${url#http://prdownloads.}"
# use mirror
local mirror="http://nchc.dl.sourceforge.net"
[ "$d" = "$f" ] && d=.
(builtin cd $d && cvs log ${f##*/})
}
+
+# does diff between FILE and FILE~
+# the diff can be applied with patch -p1
+d() {
+ local file="$1"
+ local dir
+ if [[ "$file" = /* ]]; then
+ # full path -- no idea where to strip
+ dir=.
+ diff=$file
+ else
+ # relative path -- keep one path component from current dir
+ dir=..
+ diff=${PWD##*/}/${file}
+ fi
+
+ (builtin cd "$dir"; dif $diff{~,})
+}