On 05/03/2008, Junichi Uekawa <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  Thanks for the patch, it looks promising.

Now is final (well, as always, there can be minor improvements, if I
look  at the code again), but it fixes the points you raised and some
other stuff.

>  > >>  /usr/share/pbuilder/pbuilderrc, and newer configuration variables will
>  > >>  be taken from there, so upgrade cases shouldn't cause too much
>  > >>  problem.
>  > >
>  > > Does pbuilder work properly if pbuilderrc is minimalistic (i.e.
>  > > contains only MIRRORSITE=...)?
>  > >
>  > > Then generating a minimal /etc/pbuilderrc with the default sources it
>  > > all that it takes to fix this bug (in the light of my existing work),
>  > > right?
>  >
>  > Still waiting.
>
>
> Looking at the patch, MIRRORSITE=_ will confuse users, maybe something
>  like
>  MIRRORSITE=http://you-have-broken-debconf-configuration.example.com/
>  will be more helpful in finding out what's gone wrong.

Done that replace. Also I changed that to say
"http://ftp.debian.org/debian"; in the pbuilderrc that will be
installed as an example *and* in /usr/hare/pbuilder since with that
change pbuilder wouldn't have worked if there was no /etc/pbuilderrc
at all.

>  On the other hand, pbuilder will source /usr/share/pbuilder/pbuilderrc
>  before /etc/pbuilderrc, so you can actually leave /etc/pbuilderrc
>  mostly blank, and just fill in, say, MIRRORSITE only.

Done that change, too. Now also it detects and handles MIRRORSITE
specifications preceeded by spaces or tabs.

Also, the previous versions were replacing all MIRRORSITE entries at
once, including commented out entries, while if there were no active
entries, a configuration didn't result in a correct reconfiguration
that added one uncommented line.

All of these were corrected.

As usual, git repo at:
Web     http://git.debian.org/?p=users/eddyp-guest/pbuilder.git;a=summary
URL     git://git.debian.org/git/users/eddyp-guest/pbuilder.git
        http://git.debian.org/git/users/eddyp-guest/pbuilder.git

A summarizing patch is attached.


Thanks in advance and kudos for pbuilder.

-- 
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein
diff --git a/Makefile b/Makefile
index 945b0e0..e25c7e0 100644
--- a/Makefile
+++ b/Makefile
@@ -88,8 +88,8 @@ install:
 	$(INSTALL_EXECUTABLE) pbuilder-satisfydepends-checkparams $(DESTDIR)/usr/lib/pbuilder/
 	$(INSTALL_EXECUTABLE) pbuilder-satisfydepends-funcs $(DESTDIR)/usr/lib/pbuilder/
 	$(INSTALL_EXECUTABLE) pdebuild-internal $(DESTDIR)/usr/lib/pbuilder/
+	$(INSTALL_FILE) pbuilderrc $(DESTDIR)/usr/share/doc/pbuilder/examples
 	$(INSTALL_FILE) bash_completion.pbuilder $(DESTDIR)/etc/bash_completion.d/pbuilder
-	$(INSTALL_FILE) pbuilderrc $(DESTDIR)/etc
 	$(INSTALL_FILE) pbuilderrc $(DESTDIR)/usr/share/pbuilder
 	$(INSTALL_FILE) pbuilder-uml.conf $(DESTDIR)/etc/pbuilder
 	$(INSTALL_FILE) pbuilder-uml.conf $(DESTDIR)/usr/share/pbuilder
diff --git a/debian/changelog b/debian/changelog
index b76c51a..797b5df 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,7 +4,19 @@ pbuilder (0.179~1.gbpfaef96) UNRELEASED; urgency=low
 
   * UNRELEASED
 
- -- Junichi Uekawa <[EMAIL PROTECTED]>  Sat, 02 Feb 2008 12:27:36 +0900
+  [ Eddy Petrișor ]
+  * added support for detection of the default mirror in postinst
+    (Closes: #333294)
+    - /etc/pbuilderrc is no longer a conffile
+    - detection of the default MIRRORSITE relies on the information from
+      /etc/apt/sources.list and /etc/apt/sources.list.d/
+  * bumped versioned dependency on debhelper to (>= 4.1.16) as indicated in
+    po-debconf manual
+
+  [ po-debconf translations ]
+  * iniatial Romanian translation (by Eddy Petrișor)
+
+ -- Eddy Petrișor <[EMAIL PROTECTED]>  Sun, 02 Mar 2008 08:50:48 +0200
 
 pbuilder (0.178) unstable; urgency=low
 
diff --git a/debian/control b/debian/control
index f943fb5..2110a71 100644
--- a/debian/control
+++ b/debian/control
@@ -3,14 +3,14 @@ Section: devel
 Priority: extra
 Maintainer: Debian pbuilder maintenance team <[EMAIL PROTECTED]>
 Uploaders: Junichi Uekawa <[EMAIL PROTECTED]>, Matt Kraai <[EMAIL PROTECTED]>
-Build-Depends: debhelper (>= 4.1.0), docbook-xsl, ldp-docbook-xsl (>= 0.0.20040321-0.1), xsltproc, dpkg-dev (>= 1.13.19), dblatex, rootstrap [i386 amd64]
+Build-Depends: debhelper (>= 4.1.16), docbook-xsl, ldp-docbook-xsl (>= 0.0.20040321-0.1), xsltproc, dpkg-dev (>= 1.13.19), dblatex, rootstrap [i386 amd64], debconf|debconf-2.0, po-debconf
 Standards-Version: 3.7.2
 Vcs-Git: git://git.debian.org/git/pbuilder/pbuilder.git
 Vcs-Browser: http://git.debian.org/?p=pbuilder/pbuilder.git
 
 Package: pbuilder
 Architecture: all
-Depends: cdebootstrap|debootstrap, wget, gcc, debianutils (>= 1.13.1), coreutils (>= 4.5.8-1)
+Depends: cdebootstrap|debootstrap, wget, gcc, debianutils (>= 1.13.1), coreutils (>= 4.5.8-1), ${misc:Depends}
 Recommends: fakeroot, sudo, devscripts, cowdancer
 Suggests: pbuilder-uml
 Description: personal package builder for Debian packages
diff --git a/debian/pbuilder.postinst b/debian/pbuilder.postinst
new file mode 100755
index 0000000..ae1cb3d
--- /dev/null
+++ b/debian/pbuilder.postinst
@@ -0,0 +1,106 @@
+#!/bin/sh
+# postinst script for pbuilder
+#
+# see: dh_installdeb(1)
+
+. /usr/share/debconf/confmodule
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+
+        CONFFILE=/etc/pbuilderrc
+        PLACEHOLDER='http://you-have-broken-debconf-configuration.example.com/'
+
+        # if there is a custom file, then we shouldn't touch it
+        if [ -f "$CONFFILE" ] ; then
+            CURRENTMIRROR=$(grep -E "^[ 	]*MIRRORSITE=" "$CONFFILE" | sed 's#MIRRORSITE=##g')
+            if [ "$CURRENTMIRROR" ] ; then
+                db_input low pbuilder/rewrite || [ $? = 30 ]
+                db_go
+
+                db_get pbuilder/rewrite
+                [ "$RET" = "true" ] || exit 0
+
+                # make sure latter calls do not overwrite stuff silently
+                db_set pbuilder/rewrite "false"
+            else
+                # no MIRRORSITE line found in the pbuilderrc file
+                echo "MIRRORSITE=$PLACEHOLDER" >> "$CONFFILE"
+                MIRRORSITE=""
+                db_set pbuilder/mirrorsite ""
+            fi
+        else
+            echo "MIRRORSITE=$PLACEHOLDER" > "$CONFFILE"
+            MIRRORSITE=""
+            db_set pbuilder/mirrorsite ""
+        fi
+
+        db_get pbuilder/mirrorsite
+        [ "$RET" = "$PLACEHOLDER" ] && db_set pbuilder/mirrorsite "" || true
+        db_input medium pbuilder/mirrorsite || [ $? = 30 ]
+        db_go
+
+        db_get pbuilder/mirrorsite
+        MIRRORSITE="$RET"
+
+        # the "$PLACEHOLDER" alternative is just a safety net,
+        # but that should really never happen
+        if [ -z "$MIRRORSITE" ] || [ "$MIRRORSITE" = "$PLACEHOLDER" ] ; then
+            SRCLISTDIR=/etc/apt/sources.list.d
+            MIRRORSITE=$(
+                ( [ -f /etc/apt/sources.list ] && cat /etc/apt/sources.list || true ;
+                  [ -f $SRCLISTDIR/*.sources.list ] && cat $SRCLISTDIR/*.sources.list || true ) \
+                | grep -E '^deb ' | head -n 1 | awk '{print $2;}'
+                )
+            while [ -z "$MIRRORSITE" ] ; do
+                db_input high pbuilder/nomirror || true
+                db_input high pbuilder/mirrorsite && RETCODE=$? || RETCODE=$?
+                db_go
+
+                # if the interface is non-interactive, still set a valid mirror
+                if [ $RETCODE = 30 ] ; then
+                    MIRRORSITE="http://ftp.debian.org/debian";
+                else
+                    db_get pbuilder/mirrorsite
+                    MIRRORSITE="$RET"
+                fi
+            done
+            db_set pbuilder/mirrorsite "$MIRRORSITE"
+        fi
+
+        sed -i "s#^\s*MIRRORSITE=.*\$#MIRRORSITE=$MIRRORSITE#" "$CONFFILE"
+
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff --git a/debian/pbuilder.templates b/debian/pbuilder.templates
new file mode 100644
index 0000000..e160b3d
--- /dev/null
+++ b/debian/pbuilder.templates
@@ -0,0 +1,26 @@
+Template: pbuilder/mirrorsite
+Type: string
+Default: http://you-have-broken-debconf-configuration.example.com/
+_Description: Default mirror site:
+ Please enter the default mirror you want to be used by pbuilder.
+ .
+ If you leave this field blank, there will be one attempt to autodetect
+ this information. If this attempt fails, you will be prompted again
+ to insert some valid mirror information.
+ .
+ Here is a valid mirror example: http://ftp.debian.org/debian
+
+Template: pbuilder/nomirror
+Type: error
+_Description: Default mirror not found
+ Mirror information detection failed and the user provided no mirror information.
+ .
+ Please enter valid mirror information.
+
+Template: pbuilder/rewrite
+Type: boolean
+Default: false
+_Description: Overwrite current configuration?
+ Your system seems to have already pbuilder configuration.
+ Proceeding might discard or overwrite part or the entire
+ pbuilder's configuration.
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
new file mode 100644
index 0000000..86d57fa
--- /dev/null
+++ b/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] pbuilder.templates
diff --git a/debian/po/ro.po b/debian/po/ro.po
new file mode 100644
index 0000000..bb52e2b
--- /dev/null
+++ b/debian/po/ro.po
@@ -0,0 +1,84 @@
+# translation of ro.po to Romanian
+# Romanian translations for PACKAGE package
+# Traducerea în limba română pentru pachetul PACKAGE.
+# Copyright (C) 2007 THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+#
+# Eddy Petrisor <[EMAIL PROTECTED]>, 2007.
+# Eddy Petrișor <[EMAIL PROTECTED]>, 2007, 2008.
+msgid ""
+msgstr ""
+"Project-Id-Version: ro\n"
+"Report-Msgid-Bugs-To: [EMAIL PROTECTED]"
+"POT-Creation-Date: 2008-03-02 08:23+0200\n"
+"PO-Revision-Date: 2008-03-02 08:50+0200\n"
+"Last-Translator: Eddy Petrișor <[EMAIL PROTECTED]>\n"
+"Language-Team: Romanian <[EMAIL PROTECTED]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms:  nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2;\n"
+"X-Generator: KBabel 1.11.4\n"
+
+#. Type: string
+#. Description
+#: ../pbuilder.templates:1001
+msgid "Default mirror site:"
+msgstr "Saitul oglindă implicit:"
+
+#. Type: string
+#. Description
+#: ../pbuilder.templates:1001
+msgid "Please enter the default mirror you want to be used by pbuilder."
+msgstr "Introduceți saitul oglindă implicit pe care doriți să-l folosească pbuilder."
+
+#. Type: string
+#. Description
+#: ../pbuilder.templates:1001
+msgid ""
+"If you leave this field blank, there will be one attempt to autodetect this "
+"information. If this attempt fails, you will be prompted again to insert "
+"some valid mirror information."
+msgstr "Dacă lăsați liber acest câmp, se va încerca o singură dată să se detecteze automat această informație. Dacă această încercare eșuează, vi se va cere, din nou să introduceți niște informații valide despre saitul-oglindă."
+
+#. Type: string
+#. Description
+#: ../pbuilder.templates:1001
+msgid "Here is a valid mirror example: http://ftp.debian.org/debian";
+msgstr "Iată un exemplu valid de sait-oglindă: http://ftp.ro.debian.org/debian";
+
+#. Type: error
+#. Description
+#: ../pbuilder.templates:2001
+#| msgid "Default mirror site:"
+msgid "Default mirror not found"
+msgstr "Saitul oglindă implicit nu a fost găsit"
+
+#. Type: error
+#. Description
+#: ../pbuilder.templates:2001
+msgid ""
+"Mirror information detection failed and the user provided no mirror "
+"information."
+msgstr "Detectarea informațiilor despre saitul-oglindă a eșuat și utilizatorul nu a furnizat nici o informație despre saitul-oglindă."
+
+#. Type: error
+#. Description
+#: ../pbuilder.templates:2001
+msgid "Please enter valid mirror information."
+msgstr "Introduceți informație validă referitoare la saituri ."
+
+#. Type: boolean
+#. Description
+#: ../pbuilder.templates:3001
+msgid "Overwrite current configuration?"
+msgstr "Se suprascrie actualul fișier de configurație?"
+
+#. Type: boolean
+#. Description
+#: ../pbuilder.templates:3001
+msgid ""
+"Your system seems to have already pbuilder configuration. Proceeding might "
+"discard or overwrite part or the entire pbuilder's configuration."
+msgstr "Sistemul pare să aibă deja o configurație pentru pbuilder. Continuarea cu această acțiune ar putea duce la ștergerea sau suprascrierea parțială sau totală a fișierului de configurare aparținând lui pbuilder."
+
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
new file mode 100644
index 0000000..ab08b04
--- /dev/null
+++ b/debian/po/templates.pot
@@ -0,0 +1,78 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <[EMAIL PROTECTED]>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: [EMAIL PROTECTED]"
+"POT-Creation-Date: 2008-03-02 08:23+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <[EMAIL PROTECTED]>\n"
+"Language-Team: LANGUAGE <[EMAIL PROTECTED]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: string
+#. Description
+#: ../pbuilder.templates:1001
+msgid "Default mirror site:"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../pbuilder.templates:1001
+msgid "Please enter the default mirror you want to be used by pbuilder."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../pbuilder.templates:1001
+msgid ""
+"If you leave this field blank, there will be one attempt to autodetect this "
+"information. If this attempt fails, you will be prompted again to insert "
+"some valid mirror information."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../pbuilder.templates:1001
+msgid "Here is a valid mirror example: http://ftp.debian.org/debian";
+msgstr ""
+
+#. Type: error
+#. Description
+#: ../pbuilder.templates:2001
+msgid "Default mirror not found"
+msgstr ""
+
+#. Type: error
+#. Description
+#: ../pbuilder.templates:2001
+msgid ""
+"Mirror information detection failed and the user provided no mirror "
+"information."
+msgstr ""
+
+#. Type: error
+#. Description
+#: ../pbuilder.templates:2001
+msgid "Please enter valid mirror information."
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../pbuilder.templates:3001
+msgid "Overwrite current configuration?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../pbuilder.templates:3001
+msgid ""
+"Your system seems to have already pbuilder configuration. Proceeding might "
+"discard or overwrite part or the entire pbuilder's configuration."
+msgstr ""
diff --git a/debian/rules b/debian/rules
index d69391d..40d082e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -49,6 +49,7 @@ binary-indep: build install
 	dh_installdocs -i
 	dh_installman pbuilder.8 pbuilderrc.5 pdebuild.1 debuild-pbuilder.1 
 	dh_installchangelogs -i
+	dh_installdebconf
 	dh_link -i
 	dh_compress -i -X.pdf
 	dh_fixperms -i
diff --git a/pbuilderrc b/pbuilderrc
index f97456e..821fb95 100755
--- a/pbuilderrc
+++ b/pbuilderrc
@@ -8,7 +8,7 @@ BASETGZ=/var/cache/pbuilder/base.tgz
 #EXTRAPACKAGES=gcc3.0-athlon-builder
 #export DEBIAN_BUILDARCH=athlon
 BUILDPLACE=/var/cache/pbuilder/build/
-MIRRORSITE=http://ftp.jp.debian.org/debian
+MIRRORSITE=http://ftp.debian.org/debian
 #OTHERMIRROR="deb http://www.home.com/updates/ ./"
 #export http_proxy=http://your-proxy:8080/
 USEPROC=yes

Reply via email to