[elbe-devel] [PATCH 1/2] pbuilder: add apt preference to local repository

Kory Maincent kory.maincent at bootlin.com
Wed Jan 20 18:40:26 CET 2021


Got an issue when I want to use a former version of a package from the
local repository as a dependency to build another package. It installs
the wrong version of the package.

Add apt-preference hook to prioritize the local working repository.

Signed-off-by: Kory Maincent <kory.maincent at bootlin.com>
---
 elbepack/pbuilder.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/elbepack/pbuilder.py b/elbepack/pbuilder.py
index 82cf43562..ac238b0fa 100644
--- a/elbepack/pbuilder.py
+++ b/elbepack/pbuilder.py
@@ -164,6 +164,12 @@ def pbuilder_write_repo_hook(builddir, xml, cross):
 
         f.write("apt-get update\n")
 
+    with open(os.path.join(pbuilder_hook_dir, "G20elbe_apt_preferences"), "w") as f:
+        f.write("#!/bin/sh\n")
+        f.write("echo 'Package: *' > /etc/apt/preferences\n")
+        f.write("echo 'Pin: origin 127.0.0.1' >> /etc/apt/preferences\n")
+        f.write("echo 'Pin-Priority: 1001' >> /etc/apt/preferences\n")
+
 def get_apt_keys(builddir, xml):
 
     if xml.prj is None:
-- 
2.17.1



More information about the elbe-devel mailing list