[pbuilder] Initial import

Sandro Mani smani at fedoraproject.org
Tue Oct 15 08:59:51 UTC 2013


commit e2fbd28b74411c8f7e8c3d8a1488b53219a5b207
Author: Sandro Mani <manisandro at gmail.com>
Date:   Tue Oct 15 10:59:47 2013 +0200

    Initial import

 .gitignore                |    1 +
 README.fedora             |   50 ++++++++++++++++
 pbuilder.spec             |  136 +++++++++++++++++++++++++++++++++++++++++++++
 pbuilder_no-chown.patch   |   29 ++++++++++
 pbuilder_pbuilderrc.patch |   36 ++++++++++++
 pbuilder_tempfile.patch   |   48 ++++++++++++++++
 pbuilder_test-arm.patch   |   29 ++++++++++
 sources                   |    1 +
 8 files changed, 330 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..0c67a21 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/pbuilder_0.215.tar.gz
diff --git a/README.fedora b/README.fedora
new file mode 100644
index 0000000..42551b1
--- /dev/null
+++ b/README.fedora
@@ -0,0 +1,50 @@
+Basic steps:
+------------
+
+1. To create a base tarball with the chroot environment, type
+
+    sudo pbuilder create --distribution <distro> --mirror <mirror> --debootstrapopts "--keyring=<keyring>"
+
+  - distro: a distro name, such as squeeze, sid, lucid, quantal, etc
+  - mirror: the package mirror.
+    * For Debian, use ftp://ftp.us.debian.org/debian/
+    * For Ubuntu, use http://archive.ubuntu.com/ubuntu/
+  - keyring: the archive keys for the mirror. Key for Debian and Ubuntu can be
+    found in the debian-keyring and ubuntu-keyring packages.
+    * For Debian, use /usr/share/keyrings/debian-archive-keyring.gpg
+    * For Ubuntu, use /usr/share/keyrings/ubuntu-archive-keyring.gpg
+
+2. To build a package:
+  - From within an extracted source tarball with a "debian" folder, in that folder just type
+
+      pdebuild
+
+  - Or by using a <package>.dsc file, type
+
+      pbuilder build <package>.dsc
+
+3. To update the chroot tarball, type
+
+      sudo pbuilder update
+
+
+Performance enhancements:
+-------------------------
+
+1. To build on tmpfs
+  - Add to /etc/fstab
+
+      tmpfs           /var/cache/pbuilder/build   tmpfs   defaults,auto           0   0
+
+  - Ensure the partition is mounted:
+
+      sudo mount /var/cache/pbuilder/build
+
+  - Set in /etc/pbuilderrc:
+
+      APTCACHEHARDLINK=no
+
+2. To use ccache
+  - Install ccache
+
+  - Uncomment the lines under #ccache in /etc/pbuilderrc
diff --git a/pbuilder.spec b/pbuilder.spec
new file mode 100644
index 0000000..a666ce3
--- /dev/null
+++ b/pbuilder.spec
@@ -0,0 +1,136 @@
+Name:           pbuilder
+Version:        0.215
+Release:        5%{?dist}
+Summary:        Personal package builder for Debian packages
+
+License:        GPLv2+
+URL:            http://packages.debian.org/unstable/admin/%{name}
+Source0:        http://ftp.debian.org/debian/pool/main/p/%{name}/%{name}_%{version}.tar.gz
+Source1:        README.fedora
+# Use portable mktemp instead of tempfile (upstreamable)
+Patch0:         pbuilder_tempfile.patch
+# Don't chown files to root when installing
+Patch1:         pbuilder_no-chown.patch
+# Don't hardcode pbuilder user id, add a ccache section
+Patch2:         pbuilder_pbuilderrc.patch
+# Don't test non-existing ubuntu arm-mirrors
+Patch3:         pbuilder_test-arm.patch
+
+BuildArch:      noarch
+
+BuildRequires:  dblatex
+BuildRequires:  dpkg-dev
+BuildRequires:  man-db
+Requires:       debootstrap
+Requires:       debconf
+Requires:       debhelper
+Requires:       devscripts
+Requires:       dpkg-dev
+Requires:       gnupg
+Requires:       wget
+Requires:       sudo
+Requires:       gcc
+Requires:       fakeroot
+
+%description
+pbuilder constructs a chroot system, and builds a package inside the chroot.
+It is an ideal system to use to check that a package has correct build-
+dependencies.
+
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+
+# Adjust ccache path
+sed -i 's|/usr/lib/ccache|%{_libdir}/ccache|g' pbuilderrc
+
+
+%build
+make %{?_smp_mflags}
+
+
+%install
+%make_install
+
+# Man pages
+install -Dpm 0644 debuild-pbuilder.1 %{buildroot}%{_mandir}/man1/debuild-pbuilder.1
+install -Dpm 0644 pdebuild.1 %{buildroot}%{_mandir}/man1/pdebuild.1
+install -Dpm 0644 pbuilderrc.5 %{buildroot}%{_mandir}/man5/pbuilderrc.5
+install -Dpm 0644 pbuilder.8 %{buildroot}%{_mandir}/man8/pbuilder.8
+
+# Install directories
+install -d %{buildroot}%{_localstatedir}/cache/%{name}
+install -d %{buildroot}%{_localstatedir}/cache/%{name}/build
+install -d %{buildroot}%{_localstatedir}/cache/%{name}/ccache
+
+# Configuration file
+install -Dpm 0644 pbuilderrc %{buildroot}%{_sysconfdir}/pbuilderrc
+
+# Copy README.fedora to root
+cp -a %{SOURCE1} README.fedora
+
+
+%pre
+getent group %{name} > /dev/null || groupadd -r %{name}
+getent passwd %{name} > /dev/null || \
+  useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \
+    -c "%{name}" %{name}
+exit 0
+
+
+%check
+make check
+
+
+%files
+%doc README AUTHORS THANKS debian/TODO README.fedora
+%{_sysconfdir}/bash_completion.d/
+%config(noreplace) %{_sysconfdir}/pbuilderrc
+%config(noreplace) %{_sysconfdir}/pbuilder/
+%{_bindir}/debuild-pbuilder
+%{_bindir}/pbuilder-user-mode-linux
+%{_bindir}/pdebuild
+%{_bindir}/pdebuild-user-mode-linux
+%{_sbindir}/pbuilder
+%{_prefix}/lib/pbuilder/
+%{_datadir}/pbuilder/
+%{_mandir}/man1/debuild-pbuilder.1*
+%{_mandir}/man1/pdebuild.1*
+%{_mandir}/man5/pbuilderrc.5*
+%{_mandir}/man8/pbuilder.8*
+%{_localstatedir}/cache/%{name}
+# The ccache folder needs to be owned by the pbuilder user
+%attr(0755,%{name},root) %{_localstatedir}/cache/%{name}/ccache
+
+# exclude user-mode-linux scripts
+%exclude %{_sysconfdir}/pbuilder/pbuilder-uml.conf
+%exclude %{_datadir}/pbuilder/pbuilder-uml.conf
+%exclude %{_bindir}/pbuilder-user-mode-linux
+%exclude %{_bindir}/pdebuild-user-mode-linux
+%exclude %{_prefix}/lib/pbuilder/pbuilder-uml-checkparams
+%exclude %{_prefix}/lib/pbuilder/pdebuild-uml-checkparams
+
+
+%changelog
+* Mon Oct 14 2013 Sandro Mani <manisandro at gmail.com> - 0.215-5
+- Package is noarch
+- Co-own %{_sysconfdir}/bash_completion.d/
+
+* Thu Oct 10 2013 Sandro Mani <manisandro at gmail.com> - 0.215-4
+- Improve README.fedora
+- Add some missing requires
+
+* Tue Oct 08 2013 Sandro Mani <manisandro at gmail.com> - 0.215-3
+- Don't test non-existing ubuntu arm mirrors
+
+* Thu Sep 19 2013 Sandro Mani <manisandro at gmail.com> - 0.215-2
+- Create build and ccache directories in /var/cache/pbuilder
+- Don't use hardcoded user id
+- Prepare pbuilderrc for ccache usage
+
+* Thu Sep 19 2013 Sandro Mani <manisandro at gmail.com> - 0.215-1
+- Initial package
diff --git a/pbuilder_no-chown.patch b/pbuilder_no-chown.patch
new file mode 100644
index 0000000..6a44918
--- /dev/null
+++ b/pbuilder_no-chown.patch
@@ -0,0 +1,29 @@
+diff -rupN pbuilder-0.215/Documentation/Makefile pbuilder-0.215-new/Documentation/Makefile
+--- pbuilder-0.215/Documentation/Makefile	2012-12-24 05:54:00.000000000 +0100
++++ pbuilder-0.215-new/Documentation/Makefile	2013-09-19 12:07:41.971284635 +0200
+@@ -28,9 +28,9 @@ pbuilder-doc.%.po: $(MASTERXML)
+ 	dblatex $<
+ 
+ install: $(HTMLDOCS) pbuilder-doc.pdf
+-	install -d -m 755 -o root -g root $(DESTDIR)/usr/share/doc/pbuilder/
+-	install -m 644 -o root -g root $(HTMLDOCS) $(DESTDIR)/usr/share/doc/pbuilder/
+-	install -m 644 -o root -g root pbuilder-doc.pdf $(DESTDIR)/usr/share/doc/pbuilder/
++	install -d -m 755 $(DESTDIR)/usr/share/doc/pbuilder/
++	install -m 644 $(HTMLDOCS) $(DESTDIR)/usr/share/doc/pbuilder/
++	install -m 644 pbuilder-doc.pdf $(DESTDIR)/usr/share/doc/pbuilder/
+ 
+ preview: pbuilder-doc.html
+ 	mozilla-firefox -remote "openfile($(PWD)/$<)"
+diff -rupN pbuilder-0.215/pbuildd/Makefile pbuilder-0.215-new/pbuildd/Makefile
+--- pbuilder-0.215/pbuildd/Makefile	2010-01-31 04:52:57.000000000 +0100
++++ pbuilder-0.215-new/pbuildd/Makefile	2013-09-19 12:07:50.723437129 +0200
+@@ -9,6 +9,6 @@ install:
+ 	install -d $(DESTDIR)$(PBUILDDDIR)
+ 	install -d $(DESTDIR)$(PBUILDDDIR)/hookdir
+ 	install -d $(DESTDIR)/var/cache/pbuilder/pbuildd
+-	install -m 755 -o root -g root buildd.sh $(DESTDIR)$(PBUILDDDIR)
+-	install -m 644 -o root -g root buildd-config.sh $(DESTDIR)/etc/pbuilder/
+-	install -m 755 -o root -g root hookdir/A10dpkg-l.sh $(DESTDIR)$(PBUILDDDIR)/hookdir
++	install -m 755 buildd.sh $(DESTDIR)$(PBUILDDDIR)
++	install -m 644 buildd-config.sh $(DESTDIR)/etc/pbuilder/
++	install -m 755 hookdir/A10dpkg-l.sh $(DESTDIR)$(PBUILDDDIR)/hookdir
diff --git a/pbuilder_pbuilderrc.patch b/pbuilder_pbuilderrc.patch
new file mode 100644
index 0000000..262db4f
--- /dev/null
+++ b/pbuilder_pbuilderrc.patch
@@ -0,0 +1,36 @@
+diff -rupN pbuilder-0.215/pbuilderrc pbuilder-0.215-new/pbuilderrc
+--- pbuilder-0.215/pbuilderrc	2013-03-26 09:49:45.000000000 +0100
++++ pbuilder-0.215-new/pbuilderrc	2013-09-20 13:55:28.842106778 +0200
+@@ -29,9 +29,6 @@ APTCACHEHARDLINK="yes"
+ REMOVEPACKAGES=""
+ #HOOKDIR="/usr/lib/pbuilder/hooks"
+ HOOKDIR=""
+-# NB: this var is private to pbuilder; ccache uses "CCACHE_DIR" instead
+-# CCACHEDIR="/var/cache/pbuilder/ccache"
+-CCACHEDIR=""
+ 
+ # make debconf not interact with user
+ export DEBIAN_FRONTEND="noninteractive"
+@@ -79,8 +76,8 @@ DEBBUILDOPTS=""
+ APTCONFDIR=""
+ 
+ # the username and ID used by pbuilder, inside chroot. Needs fakeroot, really
+-BUILDUSERID=1234
+ BUILDUSERNAME=pbuilder
++BUILDUSERID=$(grep $BUILDUSERNAME /etc/passwd | cut -d: -f3)
+ 
+ # BINDMOUNTS is a space separated list of things to mount
+ # inside the chroot.
+@@ -119,3 +116,12 @@ AUTOCLEANAPTCACHE=""
+ 
+ #default COMPRESSPROG
+ COMPRESSPROG="gzip"
++
++# ccache (make sure ccache is installed before uncommenting)
++CCACHEDIR=""
++# Note: CCACHEDIR is private to pbuilder, ccache uses "CCACHE_DIR"
++#CCACHEDIR="/var/cache/pbuilder/ccache"
++#export CCACHE_DIR="${CCACHEDIR}"
++#export PATH="/usr/lib/ccache:${PATH}"
++#EXTRAPACKAGES=ccache
++#BINDMOUNTS="${BINDMOUNTS} ${CCACHE_DIR}"
diff --git a/pbuilder_tempfile.patch b/pbuilder_tempfile.patch
new file mode 100644
index 0000000..acdffbc
--- /dev/null
+++ b/pbuilder_tempfile.patch
@@ -0,0 +1,48 @@
+diff -up ./pbuildd/buildd.sh.orig ./pbuildd/buildd.sh
+--- ./pbuildd/buildd.sh.orig	2013-06-01 18:07:28.728153005 -0400
++++ ./pbuildd/buildd.sh	2013-06-01 18:08:05.435152956 -0400
+@@ -65,7 +65,7 @@ function buildone() {
+ $ROOTCOMMAND dselect update
+ $ROOTCOMMAND pbuilder update 
+ 
+-tmpfile=$(tempfile)
++tmpfile=$(mktemp)
+ wget "${MIRROR}"/debian/dists/unstable/main/source/Sources.gz -O${tmpfile}
+ 
+ for A in $( zcat ${tmpfile} | awk "BEGIN { RS = \"\" }
+diff -up ./pbuildd/install-test.sh.orig ./pbuildd/install-test.sh
+--- ./pbuildd/install-test.sh.orig	2013-06-01 18:07:21.480170594 -0400
++++ ./pbuildd/install-test.sh	2013-06-01 18:08:02.617153002 -0400
+@@ -30,7 +30,7 @@ $ROOTCOMMAND dselect update
+ #$ROOTCOMMAND pbuilder update 
+ pbuilder-user-mode-linux update 
+ 
+-tmpfile=$(tempfile)
++tmpfile=$(mktemp)
+ wget "${MIRROR}"/debian/dists/unstable/main/binary-i386/Packages.gz -O${tmpfile}
+ 
+ for A in $( zcat ${tmpfile} | sed -n 's/^Package: //p' | bogosort -n ); do 
+diff -up ./pbuilder-user-mode-linux.orig ./pbuilder-user-mode-linux
+--- ./pbuilder-user-mode-linux.orig	2013-06-01 18:07:14.058154926 -0400
++++ ./pbuilder-user-mode-linux	2013-06-01 18:08:00.107153254 -0400
+@@ -50,7 +50,7 @@ function cleancow () {
+ function operate_uml () {
+     # opeartes on UML, and runs pbuilder $1
+     # use this script file to bootstrap the pbuilder inside the UML
+-    INSIDE_PBUILDER=$(tempfile)
++    INSIDE_PBUILDER=$(mktemp)
+     trap cleanup_function_trap exit sighup
+     UML_CHROOT_MOUNTPOINT=/var/cache/pbuilder/pbuilder-mnt
+     UML_CHROOT_BUILDRESULTMOUNTDIR=/var/cache/pbuilder/pbuilder-umlresult
+diff -up ./test_pbuilder-satisfydepends-funcs.orig ./test_pbuilder-satisfydepends-funcs
+--- ./test_pbuilder-satisfydepends-funcs.orig	2013-06-01 18:07:05.382169332 -0400
++++ ./test_pbuilder-satisfydepends-funcs	2013-06-01 18:07:56.798153794 -0400
+@@ -77,7 +77,7 @@ EOF
+ trap cleanup sigpipe sighup exit
+ 
+ # TODO move to build dir
+-DEBIAN_CONTROL="$(tempfile)"
++DEBIAN_CONTROL="$(mktemp)"
+ 
+ expect_output "autotools-dev (>= 1.2), debhelper, quilt (<< 12:0), libwxgtk2.8-dev, test [amd64 i386], test1, test2 [!i386 !amd64], test3 | test4, test5" \
+     test_get_build_deps "no"
diff --git a/pbuilder_test-arm.patch b/pbuilder_test-arm.patch
new file mode 100644
index 0000000..4658a44
--- /dev/null
+++ b/pbuilder_test-arm.patch
@@ -0,0 +1,29 @@
+diff -rupN pbuilder-0.215/test_pbuilder-apt-config pbuilder-0.215-new/test_pbuilder-apt-config
+--- pbuilder-0.215/test_pbuilder-apt-config	2012-05-29 01:16:55.000000000 +0200
++++ pbuilder-0.215-new/test_pbuilder-apt-config	2013-10-08 18:47:59.767111501 +0200
+@@ -142,6 +142,7 @@ deb squeeze/volatile comp1
+ deb squeeze-proposed-updates/volatile comp1" test_profile squeeze-proposed-updates/volatile
+ expect_output "deb bo comp1" test_profile bo
+ 
++if [[ "$(uname -m)" != "arm"* ]]; then
+ expect_output "deb lucid comp1" test_profile lucid
+ expect_output "deb lucid comp1
+ deb lucid-security comp1
+@@ -160,6 +161,7 @@ deb lucid-security comp1
+ deb lucid-updates comp1
+ deb lucid-proposed comp1
+ deb lucid-security comp1" test_profile lucid-proposed
++fi
+ 
+ expect_output "deb     mirror hamm component
+ deb-src mirror hamm component" run_suite_mode --with-sources=yes
+@@ -172,7 +174,9 @@ expect_output "deb mirror hamm component
+ expect_output "deb ubuntu-mirror hamm component" run_suite_mode --mirror "" --archive ubuntu
+ expect_output "deb ubuntu-ports-mirror hamm component" run_suite_mode --arch armel --mirror "" --archive ubuntu-ports
+ expect_fail run_hamm_mode --arch armel --mirror "" --archive otherarchive
++if [[ "$(uname -m)" != "arm"* ]]; then
+ expect_success run_suite_mode --mirror "" --suite lucid
++fi
+ expect_fail    run_suite_mode --mirror "" --suite suite
+ expect_success run_suite_mode --mirror "" --suite suite --archive ubuntu
+ expect_output "deb ppa-people-ppa suite component" run_suite_mode --mirror "" --suite suite --archive ppa:people
diff --git a/sources b/sources
index e69de29..5f323ee 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+6dbfa4780141acc91b0b69ec2caed92f  pbuilder_0.215.tar.gz


More information about the scm-commits mailing list