2 # Copyright 1999-2014 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
5 from __future__ import print_function
10 from os import path as osp
11 pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
12 sys.path.insert(0, pym_path)
14 portage._internal_caller = True
15 from portage import os
16 from portage.output import EOutput
17 from portage.util._argparse import ArgumentParser
18 from textwrap import wrap
19 from portage._global_updates import _global_updates
20 mysettings = portage.settings
22 mtimedb = portage.mtimedb
24 description = """The fixpackages program performs package move updates on
25 configuration files, installed packages, and binary packages."""
26 description = " ".join(description.split())
28 parser = ArgumentParser(description=description)
31 if mysettings['ROOT'] != "/":
33 msg = "The fixpackages program is not intended for use with " + \
34 "ROOT != \"/\". Instead use `emaint --fix movebin` and/or " + \
35 "`emaint --fix moveinst."
36 for line in wrap(msg, 72):
41 os.nice(int(mysettings.get("PORTAGE_NICENESS", "0")))
42 except (OSError, ValueError) as e:
43 portage.writemsg("!!! Failed to change nice value to '%s'\n" % \
44 mysettings["PORTAGE_NICENESS"])
45 portage.writemsg("!!! %s\n" % str(e))
48 _global_updates(mytrees, mtimedb["updates"], if_mtime_changed=False)