summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2015-05-31 05:21:16 -0400
committerMike Frysinger <vapier@google.com>2015-05-31 05:21:16 -0400
commit291fa97f75ff27f1b3365ec9b48abc3186d7dab9 (patch)
tree6a24263d99366f245a2c59f9c93a43aa1d39f894
parentd9226a111413cab5aa753306728e7c2851123d22 (diff)
downloadportage-291fa97f75ff27f1b3365ec9b48abc3186d7dab9.tar.gz
add a relocatable wrapper for the portage programs
BUG=b:20895978 Change-Id: I1707bd1ea61e3b939bd875613dcf1d8c116a215a
l---------usr/bin/ebuild2
l---------usr/bin/egencache2
l---------usr/bin/emerge2
l---------usr/bin/emerge-webrsync2
l---------usr/bin/emirrordist2
l---------usr/bin/portageq2
l---------usr/bin/quickpkg2
l---------usr/bin/repoman2
l---------usr/sbin/archive-conf2
l---------usr/sbin/dispatch-conf2
l---------usr/sbin/emaint2
l---------usr/sbin/env-update2
l---------usr/sbin/etc-update2
l---------usr/sbin/fixpackages2
l---------usr/sbin/readpecoff2
l---------usr/sbin/regenworld2
-rwxr-xr-xwrapper.py22
17 files changed, 38 insertions, 16 deletions
diff --git a/usr/bin/ebuild b/usr/bin/ebuild
index 96a259c..2836db5 120000
--- a/usr/bin/ebuild
+++ b/usr/bin/ebuild
@@ -1 +1 @@
-../lib/portage/bin/ebuild \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/bin/egencache b/usr/bin/egencache
index c8046fb..2836db5 120000
--- a/usr/bin/egencache
+++ b/usr/bin/egencache
@@ -1 +1 @@
-../lib/portage/bin/egencache \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/bin/emerge b/usr/bin/emerge
index 7f7fd9b..2836db5 120000
--- a/usr/bin/emerge
+++ b/usr/bin/emerge
@@ -1 +1 @@
-../lib/portage/bin/emerge \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/bin/emerge-webrsync b/usr/bin/emerge-webrsync
index a9cb41e..2836db5 120000
--- a/usr/bin/emerge-webrsync
+++ b/usr/bin/emerge-webrsync
@@ -1 +1 @@
-../lib/portage/bin/emerge-webrsync \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/bin/emirrordist b/usr/bin/emirrordist
index 6ac946d..2836db5 120000
--- a/usr/bin/emirrordist
+++ b/usr/bin/emirrordist
@@ -1 +1 @@
-../lib/portage/bin/emirrordist \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/bin/portageq b/usr/bin/portageq
index b9ffbca..2836db5 120000
--- a/usr/bin/portageq
+++ b/usr/bin/portageq
@@ -1 +1 @@
-../lib/portage/bin/portageq \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/bin/quickpkg b/usr/bin/quickpkg
index 85c54a7..2836db5 120000
--- a/usr/bin/quickpkg
+++ b/usr/bin/quickpkg
@@ -1 +1 @@
-../lib/portage/bin/quickpkg \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/bin/repoman b/usr/bin/repoman
index c45040b..2836db5 120000
--- a/usr/bin/repoman
+++ b/usr/bin/repoman
@@ -1 +1 @@
-../lib/portage/bin/repoman \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/sbin/archive-conf b/usr/sbin/archive-conf
index 940b11f..2836db5 120000
--- a/usr/sbin/archive-conf
+++ b/usr/sbin/archive-conf
@@ -1 +1 @@
-../lib/portage/bin/archive-conf \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/sbin/dispatch-conf b/usr/sbin/dispatch-conf
index fd991b5..2836db5 120000
--- a/usr/sbin/dispatch-conf
+++ b/usr/sbin/dispatch-conf
@@ -1 +1 @@
-../lib/portage/bin/dispatch-conf \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/sbin/emaint b/usr/sbin/emaint
index 3be9c5e..2836db5 120000
--- a/usr/sbin/emaint
+++ b/usr/sbin/emaint
@@ -1 +1 @@
-../lib/portage/bin/emaint \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/sbin/env-update b/usr/sbin/env-update
index dc7aca4..2836db5 120000
--- a/usr/sbin/env-update
+++ b/usr/sbin/env-update
@@ -1 +1 @@
-../lib/portage/bin/env-update \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/sbin/etc-update b/usr/sbin/etc-update
index 641afc6..2836db5 120000
--- a/usr/sbin/etc-update
+++ b/usr/sbin/etc-update
@@ -1 +1 @@
-../lib/portage/bin/etc-update \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/sbin/fixpackages b/usr/sbin/fixpackages
index f9d5976..2836db5 120000
--- a/usr/sbin/fixpackages
+++ b/usr/sbin/fixpackages
@@ -1 +1 @@
-../lib/portage/bin/fixpackages \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/sbin/readpecoff b/usr/sbin/readpecoff
index 0667013..2836db5 120000
--- a/usr/sbin/readpecoff
+++ b/usr/sbin/readpecoff
@@ -1 +1 @@
-../lib/portage/bin/readpecoff \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/usr/sbin/regenworld b/usr/sbin/regenworld
index 6316826..2836db5 120000
--- a/usr/sbin/regenworld
+++ b/usr/sbin/regenworld
@@ -1 +1 @@
-../lib/portage/bin/regenworld \ No newline at end of file
+../../wrapper.py \ No newline at end of file
diff --git a/wrapper.py b/wrapper.py
new file mode 100755
index 0000000..9b782c4
--- /dev/null
+++ b/wrapper.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Wrapper around the various portage programs.
+
+This enables the portage tools to be relocatable. The wrapper will dynamically
+detect the right paths and then execute the portage programs.
+"""
+
+from __future__ import print_function
+
+import os
+import sys
+
+
+base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+portage_path = os.path.join(base_path, 'lib', 'portage')
+sys.path.insert(0, os.path.join(portage_path, 'pym'))
+os.environ['PYTHONPATH'] = ':'.join(sys.path)
+os.execv(os.path.join(portage_path, 'bin', os.path.basename(__file__)), sys.argv)