瀏覽代碼

Improve pbuilder usage.

Emmanuel Bouthenot 13 年之前
父節點
當前提交
6255dddfac
共有 2 個文件被更改,包括 22 次插入15 次删除
  1. 3 1
      .pbuilderrc
  2. 19 14
      .zsh.d/os.d/Debian.zsh

+ 3 - 1
.pbuilderrc

@@ -18,8 +18,10 @@ fi
 
 REMOVEPACKAGES=""
 
+DISTDIR=$(echo ${DIST} | tr '-' '/')
+
 HOOKDIR="${HOME}/.pbuilder/hooks.d/"
-BUILDRESULT="${HOME}/tmp/pbuilder"
+BUILDRESULT="${HOME}/tmp/pbuilder/${DISTDIR}"
 
 if [ ! -d "${BUILDRESULT}" ]; then
     mkdir -p "${BUILDRESULT}"

+ 19 - 14
.zsh.d/os.d/Debian.zsh

@@ -25,23 +25,28 @@ cow-dist () {
             fi
         fi
     fi
-    WRAPPER=
-    if echo ${DIST} | grep -q \^sid ; then
-        if [ -x "$(which eatmydata)" ]; then
-            WRAPPER="eatmydata"
-        fi
-    fi
-    time sudo -E DIST=${DIST} ${WRAPPER} cowbuilder $@ ${OPTS}
+    time sudo -E DIST=${DIST} cowbuilder $@ ${OPTS}
     return $?
 }
 
-alias cow-sid32="cow-dist sid-32"
-alias cow-stable32="cow-dist stable-32"
-alias cow-exp64="cow-dist experimental-64"
-alias cow-sid64="cow-dist sid-64"
-alias cow-testing64="cow-dist testing-64"
-alias cow-stable64="cow-dist stable-64"
-alias cow-stablebpo="cow-dist stable-bpo-64"
+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 dist in ${PBUILDER_PATH}/*-{i386,amd64}.cow ; do
+        dist=${dist:t:r}
+        PBUILDER_DISTS="${PBUILDER_DISTS} ${dist}"
+        alias cow-${dist/-/}="cow-dist ${dist}"
+    done
+    alias cow-update="cow-dist-update ${PBUILDER_DISTS}"
+    unset PBUILDER_DISTS
+fi
+unset PBUILDER_PATH
 
 # tools
 apt-rbdepends () {