123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- #
- # Debian stuff
- #
- if [[ ! -r /etc/debian_version ]]; then
- return 0
- fi
- # specific aliases / functions
- alias lintian="lintian --color=auto -IE --pedantic"
- alias acp="apt-cache policy"
- alias acs="apt-cache search"
- alias acsh="apt-cache show"
- alias adg"sudo apt-get dist-upgrade"
- alias ag="sudo apt-get upgrade"
- alias agi="sudo apt-get install"
- alias au="sudo apt-get update"
- alias aug="sudo apt-get update && sudo apt-get upgrade"
- alias dbuild="time debuild -eDEB_BUILD_OPTIONS='parallel=9' -i -us -uc --lintian-opts --color=always -IE --pedantic"
- alias apt-show-obsolete="aptitude search '?obsolete'"
- alias apt-purge-obsolete="apt-get --purge remove $(aptitude search '?obsolete' -F '%p' | xargs)"
- apt-rbdepends() {
- grep-dctrl -F Build-Depends "$1" -s Package /var/lib/apt/lists/*_Sources
- }
- debdoc() {
- cd /usr/share/doc/$1 && ls
- }
- dbug() {
- if [[ $# -eq 1 ]]; then
- case "$1" in
- [0-9]*)
- xdg-open "http://bugs.debian.org/$1"
- ;;
- *@*)
- xdg-open "http://bugs.debian.org/cgi-bin/pkgreport.cgi?submitter=$1"
- ;;
- *)
- xdg-open "http://bugs.debian.org/src:$*"
- ;;
- esac
- else
- print "$0 needs one argument"
- return 1
- fi
- }
- # specific completions
- # rdebsign is a trivial shell script wrapper around debsign
- compdef rdebsign=scp
- # building environements
- cow-dist() {
- if [ $# -lt 2 ]; then
- echo "Error args."
- return
- fi
- DIST=${1}
- shift
- OPTS=
- if [ "$1" = "--update" ]; then
- OPTS="--no-cowdancer-update"
- elif [ "$1" = "--build" -a -z "$2" ]; then
- if [ -f debian/changelog ]; then
- dsc=$(egrep -v "^([[:space:]]+|$)" debian/changelog| \
- sed 's/\([^ ]*\) (\([^)]*\)).*/..\/\1_\2.dsc/'|head -1)
- if [ -f "$dsc" ]; then
- OPTS="$dsc"
- fi
- fi
- fi
- time sudo -E DIST=${DIST} cowbuilder $@ ${OPTS}
- return $?
- }
- cow-dist-update () {
- for dist in $@ ; do
- cow-dist ${dist} --update
- done
- }
- PBUILDER_PATH=/var/cache/pbuilder
- if [ -d "${PBUILDER_PATH}" ]; then
- PBUILDER_DISTS=
- for f in ${PBUILDER_PATH}/* ; do
- case "$f" in
- *-i386.cow|*-amd64.cow)
- dist=${f:t:r}
- PBUILDER_DISTS="${PBUILDER_DISTS} ${dist}"
- alias cow-${dist/-/}="cow-dist ${dist}"
- ;;
- esac
- done
- if [ -n "${PBUILDER_DISTS}" ]; then
- alias cow-update="cow-dist-update ${PBUILDER_DISTS}"
- fi
- unset PBUILDER_DISTS
- fi
- unset PBUILDER_PATH
- pdebdiff() {
- if [ ! -r debian/changelog ]; then
- echo "ERR: can't read debian/changelog"
- return
- fi
- egrep -v "^([[:space:]]+|$)" debian/changelog | \
- sed 's/[^ ]* (\([^)]*\)).*/\1/' | \
- head -n2 | tr '\n' $IFS | \
- read v1 v2
- if [ -z "$v1" -o -z "$v2" ]; then
- echo "ERR: can't find version \$n and \$n-1 of the package";
- return
- fi
- if [ ! -r debian/control ]; then
- echo "ERR: can't read debian/control"
- return
- fi
- egrep '^(Package|Architecture): ' debian/control | \
- while read line ; do
- pkg=$(echo $line|sed 's/Package: //')
- read line
- arch=$(echo $line|sed 's/Architecture: //')
- if [ $arch = 'any' ]; then
- arch=$(dpkg-architecture -qDEB_HOST_ARCH)
- fi
- (
- echo "*** DIFF ${pkg}_${v2} -> ${pkg}_${v1} ***"
- echo
- debdiff ../${pkg}_${v2}_${arch}.deb ../${pkg}_${v1}_${arch}.deb
- echo
- echo "# vim: wrap"
- ) | $PAGER
- done
- }
- pdeblint() {
- if [ ! -r debian/changelog ]; then
- echo "ERR: can't read debian/changelog"
- return
- fi
- v=$(egrep -v "^([[:space:]]+|$)" debian/changelog | \
- sed 's/[^ ]* (\([^)]*\)).*/\1/' | \
- head -n1)
- if [ ! -r debian/control ]; then
- echo "ERR: can't read debian/control"
- return
- fi
- pkg=$(grep '^Source: ' debian/control | sed 's/Source: //')
- arch=$(dpkg-architecture -qDEB_HOST_ARCH)
- changes="../${pkg}_${v}_${arch}.changes"
- if [ ! -r "$changes" ]; then
- echo "ERR: can't read changes file : ${changes}"
- return
- fi
- =lintian --color=auto -IE --pedantic $@ $changes
- }
|