Browse Source

Improve pbuilder usage

Emmanuel Bouthenot 14 years ago
parent
commit
aa84b94080
5 changed files with 52 additions and 19 deletions
  1. 0 3
      .cowbuilder/sid
  2. 0 3
      .cowbuilder/stable
  3. 4 0
      .pbuilder/hooks.d/B90lintian
  4. 25 0
      .pbuilderrc
  5. 23 13
      .zsh.d/os.d/Debian.zsh

+ 0 - 3
.cowbuilder/sid

@@ -1,3 +0,0 @@
-DISTRIBUTION=sid
-BASEPATH=/var/cache/pbuilder/sid.cow
-MIRRORSITE=http://ftp.fr.debian.org/debian

+ 0 - 3
.cowbuilder/stable

@@ -1,3 +0,0 @@
-DISTRIBUTION=stable
-BASEPATH=/var/cache/pbuilder/stable.cow
-MIRRORSITE=http://ftp.fr.debian.org/debian

+ 4 - 0
.pbuilder/hooks.d/B90lintian

@@ -0,0 +1,4 @@
+#!/bin/sh
+
+apt-get install -y --force-yes lintian
+lintian /tmp/buildd/*.deb

+ 25 - 0
.pbuilderrc

@@ -0,0 +1,25 @@
+#!/bin/sh
+
+DIST=${DIST:-sid}
+DISTRIBUTION=${DIST}
+
+BASEPATH="/var/cache/pbuilder/${DIST}.cow"
+
+MIRRORSITE="http://ftp.de.debian.org/debian"
+COMPONENTS="main contrib non-free"
+HOOKDIR="${HOME}/.pbuilder/hooks.d/"
+
+REMOVEPACKAGES=""
+
+if [ "${DIST}" = "stable-bpo" ]; then
+	DISTRIBUTION=stable
+	EXTRAPACKAGES="${EXTRAPACKAGES} debian-backports-keyring lintian"
+	# OTHERMIRROR="deb http://security.debian.org/ lenny/updates main | deb http://www.backports.org/debian lenny-backports main"
+fi
+
+BUILDRESULT="${HOME}/tmp/pbuilder"
+
+if [ ! -d "${BUILDRESULT}" ]; then
+	mkdir -p "${BUILDRESULT}"
+fi
+

+ 23 - 13
.zsh.d/os.d/Debian.zsh

@@ -2,24 +2,34 @@
 # Debian stuff
 
 # specific aliases
-alias lintian="lintian --color=auto -IEm"
+alias lintian="lintian --color=auto -IEm --pedantic"
 
 # building environements
 cow-dist () {
-    [ $# -lt 2 ] \
-	&& echo "Error args." \
-	&& return
-    
-    dist=$1
-    shift
-    command=$1
-    shift
-    
-    cowbuilder $command --configfile ~/.cowbuilder/$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
+    sudo DIST=$DIST cowbuilder $@ $OPTS
     return $?
 }
 
 alias cow-stable="cow-dist stable"
+alias cow-stable-bpo="cow-dist stable-bpo"
 alias cow-sid="cow-dist sid"
 
 # tools
@@ -33,12 +43,12 @@ pdebdiff() {
         exit
     fi
 
-    egrep -v "^([[:space:]]+|$)" debian/changelog | \
+     egrep -v "^([[:space:]]+|$)" debian/changelog | \
         sed 's/[^ ]* (\([^)]*\)).*/\1/' | \
         head -n2|tr '\n' $IFS | \
         read v1 v2
 
-    if [ -z "$v1" -o -z "$v2" ]; then
+   if [ -z "$v1" -o -z "$v2" ]; then
         echo "ERR: can't find version \$n and \$n-1 of the package";
         exit
     fi