summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--portato/backend/portage/package.py2
-rw-r--r--portato/backend/portage/system.py62
-rw-r--r--portato/backend/system_interface.py9
-rw-r--r--portato/gui/qt/windows.py47
-rw-r--r--portato/gui/templates/ui/MainWindow.ui8
-rw-r--r--portato/gui/templates/ui/UpdateDialog.ui93
6 files changed, 192 insertions, 29 deletions
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index d22d203..d819f2d 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -48,7 +48,7 @@ class PortagePackage (Package):
def is_overlay(self):
dir,ovl = self._settings.porttree.dbapi.findname2(self._cpv)
- return ovl != self._settings.settings["PORTDIR"]
+ return ovl != self._settings.settings["PORTDIR"] and str(ovl) != "0"
def get_overlay_path (self):
dir,ovl = self._settings.porttree.dbapi.findname2(self._cpv)
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index 50224a9..ecdab4d 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -188,8 +188,8 @@ class PortageSystem (SystemInterface):
if pkg:
resolved.append(pkg)
else:
- unresolved.append(cpv)
- return (resolved, self.geneticize_list(unresolved))
+ unresolved.append(self.find_best_match(cpv, True))
+ return (resolved, unresolved)
def find_system_packages (self):
pkglist = self.settings.settings.packages
@@ -263,6 +263,38 @@ class PortageSystem (SystemInterface):
def reload_settings (self):
self.settings.load()
+ def get_new_packages (self, packages):
+ """Gets a list of packages and returns the best choice for each in the portage tree.
+
+ @param packages: the list of packages
+ @type packages: string[]
+ @returns: the list of packages
+ @rtype: backend.Package[]"""
+
+ new_packages = []
+ for p in packages:
+ inst = self.find_installed_packages(p)
+ if len(inst) > 1:
+ myslots = set()
+ for i in inst: # get the slots of the installed packages
+ myslots.add(i.get_package_settings("SLOT"))
+
+ myslots.add(self.find_best_match(p).get_package_settings("SLOT")) # add the slot of the best package in portage
+ for slot in myslots:
+ new_packages.append(\
+ self.find_best(\
+ [x.get_cpv() for x in self.find_packages("%s:%s" % (i.get_cp(), slot))]\
+ ))
+ else:
+ new_packages.append(self.find_best_match(p))
+
+ return new_packages
+
+ def get_updated_packages (self):
+ packages = self.get_new_packages(self.find_all_installed_packages(withVersion = False))
+ packages = [x for x in packages if x is not None and not x.is_installed()]
+ return packages
+
def update_world (self, newuse = False, deep = False):
# read world file
world = open(portage.WORLD_FILE)
@@ -276,27 +308,7 @@ class PortageSystem (SystemInterface):
# append system packages
packages.extend(unique_array([p.get_cp() for p in self.find_all_system_packages()]))
-
- def get_new_packages (packages):
- new_packages = []
- for p in packages:
- inst = self.find_installed_packages(p)
- if len(inst) > 1:
- myslots = set()
- for i in inst: # get the slots of the installed packages
- myslots.add(i.get_package_settings("SLOT"))
-
- myslots.add(self.find_best_match(p).get_package_settings("SLOT")) # add the slot of the best package in portage
- for slot in myslots:
- new_packages.append(\
- self.find_best(\
- [x.get_cpv() for x in self.find_packages("%s:%s" % (i.get_cp(), slot))]\
- ))
- else:
- new_packages.append(self.find_best_match(p))
-
- return new_packages
-
+
checked = []
updating = []
raw_checked = []
@@ -354,7 +366,7 @@ class PortageSystem (SystemInterface):
for i in p.get_matched_dep_packages(state[0]):
if i not in raw_checked:
raw_checked.append(i)
- bm = get_new_packages([i])
+ bm = self.get_new_packages([i])
if not bm:
debug("Bug? No best match could be found:",i)
else:
@@ -362,7 +374,7 @@ class PortageSystem (SystemInterface):
if not pkg: continue
check(pkg, state[1])
- for p in get_new_packages(packages):
+ for p in self.get_new_packages(packages):
if not p: continue # if a masked package is installed we have "None" here
check(p, True)
diff --git a/portato/backend/system_interface.py b/portato/backend/system_interface.py
index 9af0b33..3ce401c 100644
--- a/portato/backend/system_interface.py
+++ b/portato/backend/system_interface.py
@@ -191,6 +191,15 @@ class SystemInterface:
raise NotImplementedError
+ def get_updated_packages (self):
+ """Returns the packages for which a newer package is available in the portage tree and installable (thus not masked).
+ This differs from update_world as it takes all installed packages into account but ignores changed useflags.
+
+ @returns: the list of new packages
+ @rtype: backend.Package[]"""
+
+ raise NotImplementedError
+
def get_use_desc (self, flag, package = None):
"""Returns the description of a specific useflag or None if no desc was found.
If a package is given (in the <cat>/<name> format) the local use descriptions are searched too.
diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py
index 9f91109..3996563 100644
--- a/portato/gui/qt/windows.py
+++ b/portato/gui/qt/windows.py
@@ -140,6 +140,45 @@ class SearchDialog (Window):
self.done(0)
self.jumpTo(s)
+class UpdateDialog (Window):
+ """Dialog showing updateble packages."""
+ __metaclass__ = WindowMeta
+
+ def __init__ (self, parent, packages, queue, jump_to):
+ Window.__init__(self, parent)
+
+ self.queue = queue
+ self.jump = jump_to
+
+ self.packages = system.sort_package_list(packages)
+ for p in self.packages:
+ Qt.QListWidgetItem(p.get_cpv(), self.packageList)
+
+ self.adjustSize()
+
+ @Qt.pyqtSignature("QListWidgetItem*, QListWidgetItem*")
+ def on_packageList_currentItemChanged (self, index, prev):
+ cpv = str(index.text())
+ pkg = system.new_package(cpv)
+ self.jump(pkg.get_cp(), pkg.get_version())
+
+ @Qt.pyqtSignature("")
+ def on_installAllBtn_clicked (self):
+ world = [x.get_cp() for x in system.find_all_world_packages()]
+ for p in self.packages:
+ not_in_world = p.get_cp() not in world
+ try:
+ try:
+ self.queue.append(p.get_cpv(), unmerge = False, oneshot = not_in_world)
+ except PackageNotFoundException, e:
+ if unmask_dialog(self, e[0]) == Qt.QMessageBox.Yes :
+ self.queue.append(p.get_cpv(), unmerge = False, unmask = True, oneshot = not_in_world)
+
+ except BlockedException, e:
+ blocked_dialog(self, e[0], e[1])
+
+ self.accept()
+
class EbuildDialog (Window):
"""Window showing an ebuild."""
__metaclass__ = WindowMeta
@@ -691,9 +730,9 @@ class MainWindow (Window):
self.tabWidget.setTabText(self.CONSOLE_PAGE, title)
- def jump_to (self, cp):
+ def jump_to (self, cp, version = None):
"""Is called when we want to jump to a specific package."""
- self.pkgDetails.update(cp, self.queue)
+ self.pkgDetails.update(cp, self.queue, version = version)
def fill_pkg_list (self, cat):
use_icons = self.cfg.get_boolean("pkgIcons", section = "QT")
@@ -787,6 +826,10 @@ class MainWindow (Window):
self.queue.sync()
@Qt.pyqtSignature("")
+ def on_updateListAction_triggered (self):
+ Window.watch_cursor(UpdateDialog)(self, system.get_updated_packages(), self.queue, self.jump_to).exec_()
+
+ @Qt.pyqtSignature("")
def on_oneshotAction_triggered (self):
current = self.queueList.currentItem()
diff --git a/portato/gui/templates/ui/MainWindow.ui b/portato/gui/templates/ui/MainWindow.ui
index cd7b40c..e2eb0dc 100644
--- a/portato/gui/templates/ui/MainWindow.ui
+++ b/portato/gui/templates/ui/MainWindow.ui
@@ -416,7 +416,7 @@ p, li { white-space: pre-wrap; }
<x>0</x>
<y>0</y>
<width>466</width>
- <height>27</height>
+ <height>31</height>
</rect>
</property>
<widget class="QMenu" name="fileMenu" >
@@ -441,6 +441,7 @@ p, li { white-space: pre-wrap; }
<addaction name="emergeAction" />
<addaction name="unmergeAction" />
<addaction name="updateAction" />
+ <addaction name="updateListAction" />
<addaction name="separator" />
<addaction name="syncAction" />
<addaction name="saveAction" />
@@ -534,6 +535,11 @@ p, li { white-space: pre-wrap; }
<string>Sort by Name</string>
</property>
</action>
+ <action name="updateListAction" >
+ <property name="text" >
+ <string>Show &amp;new packages</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>
diff --git a/portato/gui/templates/ui/UpdateDialog.ui b/portato/gui/templates/ui/UpdateDialog.ui
new file mode 100644
index 0000000..b783182
--- /dev/null
+++ b/portato/gui/templates/ui/UpdateDialog.ui
@@ -0,0 +1,93 @@
+<ui version="4.0" >
+ <class>UpdateDialog</class>
+ <widget class="QDialog" name="UpdateDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>372</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Update List</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QListWidget" name="packageList" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ <property name="horizontalScrollMode" >
+ <enum>QAbstractItemView::ScrollPerPixel</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="closeBtn" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="installAllBtn" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Install all</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>closeBtn</sender>
+ <signal>clicked()</signal>
+ <receiver>UpdateDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>117</x>
+ <y>352</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>140</x>
+ <y>368</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>