in order to protect against uninstallation of required libraries.
* Add support for generic package sets (also see RELEASE-NOTES)
+portage-2.1.8
+-------------
+* The top-level __init__.py for the portage python package has been split into
+ many smaller python modules, making the code easier to navigate and allowing
+ small parts of the portage api to be imported with less overhead.
+
portage-2.1.7
-------------
os.environ["PORTAGE_CALLER"]="fixpackages"
from portage import os
+from portage.output import EOutput
+from textwrap import wrap
from portage._global_updates import _global_updates
mysettings = portage.settings
mytrees = portage.db
mtimedb = portage.mtimedb
+if mysettings['ROOT'] != "/":
+ out = EOutput()
+ msg = "The fixpackages program is not intended for use with " + \
+ "ROOT != \"/\". Instead use `emaint --fix movebin` and/or " + \
+ "`emaint --fix moveinst."
+ for line in wrap(msg, 72):
+ out.eerror(line)
+ sys.exit(1)
+
try:
os.nice(int(mysettings.get("PORTAGE_NICENESS", "0")))
except (OSError, ValueError) as e:
if self._fetched_pkg:
self._bintree.inject(pkg.cpv, filename=pkg_path)
+ logfile = self.settings.get("PORTAGE_LOG_FILE")
+ if logfile is not None and os.path.isfile(logfile):
+ # Remove fetch log after successful fetch.
+ try:
+ os.unlink(logfile)
+ except OSError:
+ pass
+
if self.opts.fetchonly:
self._current_task = None
self.returncode = os.EX_OK
os.path.exists(fetcher.logfile):
self.settings["PORTAGE_LOG_FILE"] = fetcher.logfile
- if not fetch_failed and fetcher.logfile is not None:
- # Fetch was successful, so remove the fetch log.
- try:
- os.unlink(fetcher.logfile)
- except OSError:
- pass
-
if fetch_failed or opts.fetchonly:
self.wait()
return
settings = self.settings
log_file = settings.get('PORTAGE_LOG_FILE')
if log_file is not None and os.path.isfile(log_file):
- # Truncate rather than unlink, so tail -f still works.
try:
- open(log_file, 'wb')
+ os.unlink(log_file)
except OSError:
pass
def _global_updates(trees, prev_mtimes):
"""
Perform new global updates if they exist in $PORTDIR/profiles/updates/.
+ This simply returns if ROOT != "/" (when len(trees) != 1). If ROOT != "/"
+ then the user should instead use emaint --fix movebin and/or moveinst.
@param trees: A dictionary containing portage trees.
@type trees: dict
"""
# only do this if we're root and not running repoman/ebuild digest
- if secpass < 2 or "SANDBOX_ACTIVE" in os.environ:
- return
+ if secpass < 2 or \
+ "SANDBOX_ACTIVE" in os.environ or \
+ len(trees) != 1:
+ return 0
root = "/"
mysettings = trees["/"]["vartree"].settings
updpath = os.path.join(mysettings["PORTDIR"], "profiles", "updates")
except DirectoryNotFound:
writemsg(_("--- 'profiles/updates' is empty or "
"not available. Empty portage tree?\n"), noiselevel=1)
- return
+ return 0
myupd = None
if len(update_data) > 0:
do_upgrade_packagesmessage = 0