[PackageKit-commit] packagekit: Branch 'master' - 87 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Apr 24 01:32:43 PDT 2012
NEWS | 72
RELEASE | 10
backends/apt/aptBackend.py | 59
backends/apt/tests/core.py | 8
backends/aptcc/20packagekit | 9
backends/aptcc/AptCacheFile.cpp | 367 +++
backends/aptcc/AptCacheFile.h | 120 +
backends/aptcc/Makefile.am | 34
backends/aptcc/OpPackageKitProgress.cpp | 49
backends/aptcc/OpPackageKitProgress.h | 45
backends/aptcc/PkgList.cpp | 74
backends/aptcc/PkgList.h | 49
backends/aptcc/acqpkitstatus.cpp | 258 ++
backends/aptcc/acqpkitstatus.h | 68
backends/aptcc/acqprogress.cpp | 261 --
backends/aptcc/acqprogress.h | 52
backends/aptcc/apt-intf.cpp | 2639 +++++++++++++++++++++++
backends/aptcc/apt-intf.h | 273 ++
backends/aptcc/apt-messages.cpp | 84
backends/aptcc/apt-messages.h | 44
backends/aptcc/apt-sourceslist.cpp | 607 +++++
backends/aptcc/apt-sourceslist.h | 114
backends/aptcc/apt-utils.cpp | 395 +--
backends/aptcc/apt-utils.h | 101
backends/aptcc/apt.cpp | 2194 -------------------
backends/aptcc/apt.h | 182 -
backends/aptcc/aptcc_show_broken.cpp | 144 -
backends/aptcc/aptcc_show_broken.h | 22
backends/aptcc/aptcc_show_error.cpp | 53
backends/aptcc/aptcc_show_error.h | 26
backends/aptcc/deb-file.cpp | 144 -
backends/aptcc/deb-file.h | 33
backends/aptcc/dpkgpm.cpp | 37
backends/aptcc/dpkgpm.h | 36
backends/aptcc/get-distro-upgrade.py | 2
backends/aptcc/gstMatcher.cpp | 102
backends/aptcc/gstMatcher.h | 37
backends/aptcc/matcher.cpp | 394 +--
backends/aptcc/matcher.h | 70
backends/aptcc/pk-backend-aptcc.cpp | 1984 +++++++----------
backends/aptcc/pkg_acqfile.cpp | 174 -
backends/aptcc/pkg_acqfile.h | 84
backends/aptcc/rsources.cpp | 563 ----
backends/aptcc/rsources.h | 115 -
backends/entropy/entropyBackend.py | 18
backends/portage/portageBackend.py | 75
backends/yum/yumBackend.py | 27
backends/zif/pk-backend-zif.c | 11
backends/zypp/pk-backend-zypp.cpp | 10
configure.ac | 11
contrib/PackageKit.spec.in | 7
contrib/pm-utils/95packagekit | 2
docs/Makefile.am | 3
docs/api/Makefile.am | 1
docs/api/PackageKit-docs.sgml | 1
docs/api/spec/pk-concepts.xml | 43
docs/api/spec/pk-transactions-auto-untrusted.png |binary
docs/api/spec/pk-transactions-trusted.png |binary
docs/api/spec/pk-transactions.svg | 1794 ++++++++++++++-
docs/html/Makefile.am | 28
docs/html/img/Makefile.am | 99
docs/html/pk-download.html | 1
docs/html/pk-matrix.html | 140 -
docs/html/videos/Makefile.am | 17
etc/PackageKit.conf.in | 2
lib/packagekit-glib2/Makefile.am | 27
lib/packagekit-glib2/packagekit.h | 2
lib/packagekit-glib2/pk-catalog.c | 15
lib/packagekit-glib2/pk-catalog.h | 1
lib/packagekit-glib2/pk-control.c | 2
lib/packagekit-glib2/pk-enum-types.c.template | 43
lib/packagekit-glib2/pk-enum-types.h.template | 28
lib/packagekit-glib2/pk-enum.c | 2
lib/packagekit-glib2/pk-enum.h | 4
lib/packagekit-glib2/pk-service-pack.c | 20
lib/packagekit-glib2/pk-service-pack.h | 1
lib/packagekit-glib2/pk-task-sync.c | 100
lib/packagekit-glib2/pk-task-sync.h | 4
lib/packagekit-glib2/pk-task.c | 36
lib/packagekit-qt2/transaction.cpp | 10
lib/packagekit-qt2/transaction.h | 20
lib/python/packagekit/filter.py | 13
po/POTFILES.skip | 1
po/de.po | 863 +++----
po/ko.po | 864 +++----
po/lv.po | 801 +++---
po/nl.po | 606 ++---
po/sk.po | 911 +++----
src/pk-backend.c | 12
src/pk-transaction.c | 7
90 files changed, 10587 insertions(+), 8284 deletions(-)
New commits:
commit 497c8df4ffc1e7f98c93a81d83e2b6de8f7620cd
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Apr 24 09:29:36 2012 +0100
Release version 0.7.4
diff --git a/NEWS b/NEWS
index c8c0e02..939bb70 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,75 @@
+Version 0.7.4
+~~~~~~~~~~~~~
+Released: 2012-04-24
+
+Libraries:
+ - packagekit-glib2: Add GType's for packagekit-glib2 enumerations (Stef Walter)
+ - packagekit-qt2: Add simulateRepairSystem and repairSystem(bool) to the Transaction API (Daniel Nicoletti)
+ - python: Speed up get_package_list (Tomáš Trnka)
+
+Backends:
+ - apt: apt.cache.Cache() now reuses the dpkg of the chroot (Sebastian Heinlein)
+ - apt: Fix modalias search on non-multi-arch systems (Sebastian Heinlein)
+ - apt: Replace use of depracted python-apt 0.7.x API (Sebastian Heinlein)
+ - aptcc: Add a new class to show cache opening progress (Daniel Nicoletti)
+ - aptcc: Add AptCacheFile to handle all pkg cache openings (Daniel Nicoletti)
+ - aptcc: Add SimulateRepairSystem and RepairSystem methods (Daniel Nicoletti)
+ - aptcc: Avoid crashing when error messages containing invalid utf8 is sent (Daniel Nicoletti)
+ - aptcc: Change the way we mark auto-installed packages (Daniel Nicoletti)
+ - aptcc: Correctly emit if a repo is enabled (Matthias Klumpp)
+ - aptcc: Create a PkgList class to provide convience methods (Daniel Nicoletti)
+ - aptcc: Don't emit error if repo is empty (Matthias Klumpp)
+ - aptcc: Don't emit untrusted packages when we are not simulating (Daniel Nicoletti)
+ - aptcc: Emit newly-installed local package information (Matthias Klumpp)
+ - aptcc: Emit packages that are untrusted with the PK_INFO_ENUM_UNTRUSTED enum (Daniel Nicoletti)
+ - aptcc: Emit UnfinishedTransaction when we were not able to fix the cache (Daniel Nicoletti)
+ - aptcc: Fix a multiarch bug that failed to resolve packages (Daniel Nicoletti)
+ - aptcc: Fix crash when a package for an invalid version (Daniel Nicoletti)
+ - aptcc: Fix INSTALLED filter (Daniel Nicoletti)
+ - aptcc: Fix resolving of gdebi packages when they have :arch field (Daniel Nicoletti)
+ - aptcc: Fix SUPPORTED check and component-finding code (Matthias Klumpp)
+ - aptcc: Implement basic support for InstallFiles() (Matthias Klumpp)
+ - aptcc: Implement SUPPORTED support (Matthias Klumpp)
+ - aptcc: Improve classes readability, and fix a crash caused by an invalid package (Daniel Nicoletti)
+ - aptcc: Improve the autoremove code (Daniel Nicoletti)
+ - aptcc: Make sure BuildPolicy is called when getting the dep cache (Daniel Nicoletti)
+ - aptcc: Make sure we discard errors when closing the cache (Daniel Nicoletti)
+ - aptcc: Mark dependencies of a file-installation as automatic (Matthias Klumpp)
+ - aptcc: Move cache related functions to pkgCacheFile subclass (Daniel Nicoletti)
+ - aptcc: Move ShowBroken to AptCacheFile, and added CheckDeps from apt-get (Daniel Nicoletti)
+ - aptcc: Refactored to use AptCacheFile (Daniel Nicoletti)
+ - aptcc: Reident the code and re-enforce KDElibs coding style (Daniel Nicoletti)
+ - aptcc: Remove a code duplication and emit proper RestartRequired signal (Daniel Nicoletti)
+ - aptcc: Reorganise parts of AptCC to make the code more readable (Matthias Klumpp)
+ - aptcc: Separate the try install/remove functions (Daniel Nicoletti)
+ - aptcc: Simplify code for checking trusted packages (Matthias Klumpp)
+ - aptcc: Some more stuff required for installFiles() (Matthias Klumpp)
+ - aptcc: Update license headers & fix some more indentation and typos (Matthias Klumpp)
+ - aptcc: use const_iterators to avoid mistakes (Daniel Nicoletti)
+ - aptcc: Use _exit() to quit the child process as synaptic does (Daniel Nicoletti)
+ - aptcc: We are not apt-get so remove "APT::Get::*" confs (Daniel Nicoletti)
+ - aptcc: When on multiarch some packages that should have the :arch appended to the installed list files (Daniel Nicoletti)
+ - entropy: Add support to ConfigurationUpdates (Fabio Erculiani)
+ - portage: Port code to new Layman API and fix usage with newer Portage API (Fabio Erculiani)
+ - yum: Always set GPG checking members if present (Nils Philippsen)
+ - yum: Convert all instances of Message(untrusted-package) to Package(untrusted) (Richard Hughes)
+ - zif: Do not use Message(untrusted-package) (Richard Hughes)
+ - zif: Fix segfault of the daemon when a program does Resolve with no arguments (Richard Hughes)
+ - zypp: Build pool before resolving (Vincent Untz)
+ - zypp: Do not set a PACKAGE_NOT_FOUND error when resolving packages (Vincent Untz)
+
+New Features:
+ - Deprecate Message(untrusted-package) from the API (Richard Hughes)
+ - Install pk-task-sync.h as part of the public API (Stef Walter)
+ - Add full integration so that UI can know when to repair the system (Daniel Nicoletti)
+
+Bugfixes:
+ - Add some documentation about the auto-untrusted logic (Richard Hughes)
+ - Add some documentation for the new RepairSystem transaction interaction (Richard Hughes)
+ - Do not allow an empty resolve call to be passed down to the backends (Richard Hughes)
+ - Do not include the website in the tarball (Richard Hughes)
+ - Drop --print-reply from dbus-send command used on suspend/resume (Adam Williamson)
+
Version 0.7.3
~~~~~~~~~~~~~
Released: 2012-03-01
diff --git a/configure.ac b/configure.ac
index bb18059..3c52f68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ AC_SUBST(PK_VERSION)
# AGE If libpackagekit can be linked into executables which can be
# built with previous versions of this library. Don't use.
LT_CURRENT=14
-LT_REVISION=12
+LT_REVISION=13
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
diff --git a/docs/html/pk-download.html b/docs/html/pk-download.html
index 2304c3e..5549cf9 100644
--- a/docs/html/pk-download.html
+++ b/docs/html/pk-download.html
@@ -72,6 +72,7 @@ Releases are normally on the first working Monday of each month.
</p>
<table>
<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
+<tr><td>0.7.4</td><td></td><td>2012-04-24</td></tr>
<tr><td>0.7.3</td><td></td><td>2012-03-01</td></tr>
<tr><td>0.7.2</td><td></td><td>2012-01-17</td></tr>
<tr><td>0.7.1</td><td></td><td>2011-11-10</td></tr>
diff --git a/po/de.po b/po/de.po
index 19f98cf..078303b 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1,7 +1,7 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
-#
+#
# Translators:
# Christian <Christian.Kirbach at googlemail.com>, 2011.
# Christian Kirbach <Christian.Kirbach at googlemail.com>, 2009, 2011.
@@ -10,6 +10,8 @@
# Hedda Peters <hpeters at redhat.com>, 2009.
# Holger Wansing <linux at wansing-online.de>, 2006.
# Marcus Nitzschke <kenda at fedoraproject.org>, 2009, 2010.
+# Mario Blättermann <mario.blaettermann at gmail.com>, 2012.
+# Matthias K. <matthias at tenstral.net>, 2012.
# Richard Hughes <richard at hughsie.com>, 2011.
# Stefan Posdzich <cheekyboinc at foresightlinux.org>, 2008.
# Thomas Spura <tomspur at fedoraproject.org>, 2008.
@@ -18,10 +20,10 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-10 19:50+0000\n"
-"PO-Revision-Date: 2011-11-10 19:50+0000\n"
-"Last-Translator: Richard Hughes <richard at hughsie.com>\n"
-"Language-Team: German (http://www.transifex.net/projects/p/freedesktop/team/de/)\n"
+"POT-Creation-Date: 2012-03-01 11:08+0000\n"
+"PO-Revision-Date: 2012-04-23 08:35+0000\n"
+"Last-Translator: Mario Blättermann <mario.blaettermann at gmail.com>\n"
+"Language-Team: German (http://www.transifex.net/projects/p/freedesktop/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -30,114 +32,114 @@ msgstr ""
#. TRANSLATORS: this is an atomic transaction
#. TRANSLATORS: the role is the point of the transaction, e.g. update-system
-#: ../client/pk-console.c:174 ../client/pk-console.c:596
+#: ../client/pk-console.c:173 ../client/pk-console.c:595
msgid "Transaction"
msgstr "Transaktion"
#. TRANSLATORS: this is the time the transaction was started in system
#. timezone
-#: ../client/pk-console.c:176
+#: ../client/pk-console.c:175
msgid "System time"
msgstr "Systemzeit"
#. TRANSLATORS: this is if the transaction succeeded or not
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "Succeeded"
msgstr "Erfolgreich"
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "True"
msgstr "Wahr"
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "False"
msgstr "Falsch"
#. TRANSLATORS: this is the transactions role, e.g. "update-system"
-#: ../client/pk-console.c:180
+#: ../client/pk-console.c:179
msgid "Role"
msgstr "Rolle"
#. TRANSLATORS: this is The duration of the transaction
-#: ../client/pk-console.c:185
+#: ../client/pk-console.c:184
msgid "Duration"
msgstr "Dauer"
-#: ../client/pk-console.c:185
+#: ../client/pk-console.c:184
msgid "(seconds)"
msgstr "(Sekunden)"
#. TRANSLATORS: this is The command line used to do the action
-#: ../client/pk-console.c:189
+#: ../client/pk-console.c:188
msgid "Command line"
msgstr "Befehlszeile"
#. TRANSLATORS: this is the user ID of the user that started the action
-#: ../client/pk-console.c:191
+#: ../client/pk-console.c:190
msgid "User ID"
msgstr "Benutzerkennung"
#. TRANSLATORS: this is the username, e.g. hughsie
-#: ../client/pk-console.c:198
+#: ../client/pk-console.c:197
msgid "Username"
msgstr "Benutzername"
#. TRANSLATORS: this is the users real name, e.g. "Richard Hughes"
-#: ../client/pk-console.c:202
+#: ../client/pk-console.c:201
msgid "Real name"
msgstr "Echter Name"
-#: ../client/pk-console.c:210
+#: ../client/pk-console.c:209
msgid "Affected packages:"
msgstr "Beteiligte Pakete:"
-#: ../client/pk-console.c:212
+#: ../client/pk-console.c:211
msgid "Affected packages: None"
-msgstr "Beteilige Pakete: Keine"
+msgstr "Beteiligte Pakete: Keine"
#. TRANSLATORS: this is the distro, e.g. Fedora 10
-#: ../client/pk-console.c:247
+#: ../client/pk-console.c:246
msgid "Distribution"
msgstr "Distribution"
#. TRANSLATORS: this is type of update, stable or testing
-#: ../client/pk-console.c:249
+#: ../client/pk-console.c:248
msgid "Type"
msgstr "Typ"
#. TRANSLATORS: this is any summary text describing the upgrade
#. TRANSLATORS: this is the summary of the group
-#: ../client/pk-console.c:251 ../client/pk-console.c:290
+#: ../client/pk-console.c:250 ../client/pk-console.c:289
msgid "Summary"
msgstr "Zusammenfassung"
#. TRANSLATORS: this is the group category name
-#: ../client/pk-console.c:279
+#: ../client/pk-console.c:278
msgid "Category"
msgstr "Kategorie"
#. TRANSLATORS: this is group identifier
-#: ../client/pk-console.c:281
+#: ../client/pk-console.c:280
msgid "ID"
msgstr "Kennung"
#. TRANSLATORS: this is the parent group
-#: ../client/pk-console.c:284
+#: ../client/pk-console.c:283
msgid "Parent"
msgstr "Elternteil"
#. TRANSLATORS: this is the name of the parent group
-#: ../client/pk-console.c:287
+#: ../client/pk-console.c:286
msgid "Name"
msgstr "Name"
#. TRANSLATORS: this is preferred icon for the group
-#: ../client/pk-console.c:293
+#: ../client/pk-console.c:292
msgid "Icon"
msgstr "Symbol"
#. TRANSLATORS: this is a header for the package that can be updated
-#: ../client/pk-console.c:339
+#: ../client/pk-console.c:338
msgid "Details about the update:"
msgstr "Details zur Aktualisierung:"
@@ -145,7 +147,7 @@ msgstr "Details zur Aktualisierung:"
#. TRANSLATORS: the package that is being processed
#. TRANSLATORS: the package that is not signed by a known key
#. TRANSLATORS: the package name that was trying to be installed
-#: ../client/pk-console.c:345 ../client/pk-console.c:615
+#: ../client/pk-console.c:344 ../client/pk-console.c:614
#: ../lib/packagekit-glib2/pk-task-text.c:124
#: ../lib/packagekit-glib2/pk-task-text.c:206
msgid "Package"
@@ -153,220 +155,212 @@ msgstr "Pakete"
#. TRANSLATORS: details about the update, any packages that this update
#. updates
-#: ../client/pk-console.c:348
+#: ../client/pk-console.c:347
msgid "Updates"
msgstr "Aktualisierungen"
#. TRANSLATORS: details about the update, any packages that this update
#. obsoletes
-#: ../client/pk-console.c:352
+#: ../client/pk-console.c:351
msgid "Obsoletes"
msgstr "Veraltete"
#. TRANSLATORS: details about the update, the vendor URLs
#. TRANSLATORS: the vendor (e.g. vmware) that is providing the EULA
-#: ../client/pk-console.c:356 ../lib/packagekit-glib2/pk-task-text.c:209
+#: ../client/pk-console.c:355 ../lib/packagekit-glib2/pk-task-text.c:209
msgid "Vendor"
msgstr "Hersteller"
#. TRANSLATORS: details about the update, the bugzilla URLs
-#: ../client/pk-console.c:360
+#: ../client/pk-console.c:359
msgid "Bugzilla"
msgstr "Bugzilla"
#. TRANSLATORS: details about the update, the CVE URLs
-#: ../client/pk-console.c:364
+#: ../client/pk-console.c:363
msgid "CVE"
msgstr "CVE"
#. TRANSLATORS: details about the update, if the package requires a restart
-#: ../client/pk-console.c:368
+#: ../client/pk-console.c:367
msgid "Restart"
msgstr "Neustart"
#. TRANSLATORS: details about the update, any description of the update
-#: ../client/pk-console.c:372
+#: ../client/pk-console.c:371
msgid "Update text"
msgstr "Text aktualisieren"
#. TRANSLATORS: details about the update, the changelog for the package
-#: ../client/pk-console.c:376
+#: ../client/pk-console.c:375
msgid "Changes"
msgstr "Ãnderungen"
#. TRANSLATORS: details about the update, the ongoing state of the update
-#: ../client/pk-console.c:380
+#: ../client/pk-console.c:379
msgid "State"
msgstr "Status"
#. TRANSLATORS: details about the update, date the update was issued
-#: ../client/pk-console.c:384
+#: ../client/pk-console.c:383
msgid "Issued"
msgstr "Veröffentlicht"
#. TRANSLATORS: details about the update, date the update was updated
#. TRANSLATORS: The action of the package, in past tense
-#: ../client/pk-console.c:388 ../lib/packagekit-glib2/pk-console-shared.c:559
+#: ../client/pk-console.c:387 ../lib/packagekit-glib2/pk-enum.c:1135
msgid "Updated"
msgstr "Aktualisiert"
#. TRANSLATORS: if the repo is enabled
-#: ../client/pk-console.c:424
+#: ../client/pk-console.c:423
msgid "Enabled"
msgstr "Aktiviert"
#. TRANSLATORS: if the repo is disabled
-#: ../client/pk-console.c:427
+#: ../client/pk-console.c:426
msgid "Disabled"
msgstr "Deaktiviert"
#. TRANSLATORS: a package requires the system to be restarted
-#: ../client/pk-console.c:459
+#: ../client/pk-console.c:458
msgid "System restart required by:"
msgstr "Ein Neustart wird erfordert von:"
#. TRANSLATORS: a package requires the session to be restarted
-#: ../client/pk-console.c:462
+#: ../client/pk-console.c:461
msgid "Session restart required:"
msgstr "Ein Neustart der Sitzung ist erforderlich:"
#. TRANSLATORS: a package requires the system to be restarted due to a
#. security update
-#: ../client/pk-console.c:465
+#: ../client/pk-console.c:464
msgid "System restart (security) required by:"
msgstr "Ein Neustart (zur Verbesserung der Sicherheit) wird erfordert von:"
#. TRANSLATORS: a package requires the session to be restarted due to a
#. security update
-#: ../client/pk-console.c:468
+#: ../client/pk-console.c:467
msgid "Session restart (security) required:"
-msgstr ""
-"Ein Neustart der Sitzung (zur Verbesserung der Sicherheit) ist erforderlich:"
+msgstr "Ein Neustart der Sitzung (zur Verbesserung der Sicherheit) ist erforderlich:"
#. TRANSLATORS: a package requires the application to be restarted
-#: ../client/pk-console.c:471
+#: ../client/pk-console.c:470
msgid "Application restart required by:"
msgstr "Ein Programm-Neustart wird benötigt von:"
#. TRANSLATORS: This a list of details about the package
-#: ../client/pk-console.c:506
+#: ../client/pk-console.c:505
msgid "Package description"
msgstr "Paketbeschreibung"
#. TRANSLATORS: This a message (like a little note that may be of interest)
#. from the transaction
-#: ../client/pk-console.c:537
+#: ../client/pk-console.c:536
msgid "Message:"
msgstr "Hinweis:"
#. TRANSLATORS: This where the package has no files
-#: ../client/pk-console.c:558
+#: ../client/pk-console.c:557
msgid "No files"
msgstr "Keine Dateien"
#. TRANSLATORS: This a list files contained in the package
-#: ../client/pk-console.c:563
+#: ../client/pk-console.c:562
msgid "Package files"
msgstr "Paketdateien"
#. TRANSLATORS: the percentage complete of the transaction
-#: ../client/pk-console.c:631
+#: ../client/pk-console.c:630
msgid "Percentage"
msgstr "Prozentsatz"
#. TRANSLATORS: the status of the transaction (e.g. downloading)
-#: ../client/pk-console.c:649
+#: ../client/pk-console.c:648
msgid "Status"
msgstr "Status"
#. TRANSLATORS: the results from the transaction
-#: ../client/pk-console.c:678
+#: ../client/pk-console.c:677
msgid "Results:"
msgstr "Ergebnisse:"
#. TRANSLATORS: we failed to get any results, which is pretty fatal in my book
-#: ../client/pk-console.c:685
+#: ../client/pk-console.c:684
msgid "Fatal error"
msgstr "Schwerwiegender Fehler"
#. TRANSLATORS: the user asked to update everything, but there is nothing that
#. can be updated
-#: ../client/pk-console.c:701
+#: ../client/pk-console.c:700
msgid "There are no packages to update."
msgstr "Es gibt keine Aktualisierungen für Pakete."
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../client/pk-console.c:704
+#: ../client/pk-console.c:703
#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr "Die Transaktion scheiterte"
#. TRANSLATORS: print a message when there are no updates
-#: ../client/pk-console.c:733
+#: ../client/pk-console.c:732
msgid "There are no updates available at this time."
msgstr "Derzeit sind keine Aktualisierungen verfügbar."
-#: ../client/pk-console.c:756
+#: ../client/pk-console.c:755
msgid "There are no upgrades available at this time."
msgstr "Derzeit sind keine Systemaktualisierungen verfügbar."
#. TRANSLATORS: a package needs to restart their system
-#: ../client/pk-console.c:823
+#: ../client/pk-console.c:822
msgid "Please restart the computer to complete the update."
-msgstr ""
-"Bitte starten Sie den Computer neu, um die Aktualisierung abzuschliessen."
+msgstr "Bitte starten Sie den Rechner neu, um die Aktualisierung abzuschlieÃen."
#. TRANSLATORS: a package needs to restart the session
-#: ../client/pk-console.c:826
+#: ../client/pk-console.c:825
msgid "Please logout and login to complete the update."
-msgstr "Bitte erneut anmelden, um die Aktualisierung abzuschliessen."
+msgstr "Bitte erneut anmelden, um die Aktualisierung abzuschlieÃen."
#. TRANSLATORS: a package needs to restart their system (due to security)
-#: ../client/pk-console.c:829
+#: ../client/pk-console.c:828
msgid ""
"Please restart the computer to complete the update as important security "
"updates have been installed."
-msgstr ""
-"Bitte starten Sie den Computer neu, um die Aktualisierung abzuschliessen, "
-"denn es sind wichtige Sicherheitsaktualisierungen installiert worden."
+msgstr "Bitte starten Sie den Rechner neu, um die Aktualisierung abzuschlieÃen, denn es sind wichtige Sicherheitsaktualisierungen installiert worden."
#. TRANSLATORS: a package needs to restart the session (due to security)
-#: ../client/pk-console.c:832
+#: ../client/pk-console.c:831
msgid ""
"Please logout and login to complete the update as important security updates"
" have been installed."
-msgstr ""
-"Bitte erneut anmelden, um die Aktualisierung abzuschliessen, denn es sind "
-"wichtige Sicherheitsaktualisierungen installiert worden."
+msgstr "Bitte erneut anmelden, um die Aktualisierung abzuschlieÃen, denn es sind wichtige Sicherheitsaktualisierungen installiert worden."
#. TRANSLATORS: The user used 'pkcon install dave.rpm' rather than 'pkcon
#. install-local dave.rpm'
-#: ../client/pk-console.c:858
+#: ../client/pk-console.c:857
#, c-format
msgid ""
"Expected package name, actually got file. Try using 'pkcon install-local %s'"
" instead."
-msgstr ""
-"Es wurde ein Paketname erwartet, aber tatsächlich eine Datei erhalten. "
-"Versuchen Sie stattdessen »pkcon install-local %s« zu verwenden."
+msgstr "Es wurde ein Paketname erwartet, aber tatsächlich eine Datei erhalten. Versuchen Sie stattdessen »pkcon install-local %s« zu verwenden."
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:871
+#: ../client/pk-console.c:870
#, c-format
msgid "This tool could not find any available package: %s"
msgstr "Dieses Werkzeug konnte keine verfügbaren Pakete finden: %s"
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:899
+#: ../client/pk-console.c:898
#, c-format
msgid "This tool could not find the installed package: %s"
msgstr "Dieses Werkzeug konnte das installierte Paket nicht finden: %s"
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:927 ../client/pk-console.c:955
+#: ../client/pk-console.c:926 ../client/pk-console.c:954
#, c-format
msgid "This tool could not find the package: %s"
msgstr "Dieses Werkzeug konnte das Paket nicht finden: %s"
@@ -379,258 +373,245 @@ msgstr "Dieses Werkzeug konnte das Paket nicht finden: %s"
#. detailed error follows
#. TRANSLATORS: The package name was not found in any software sources. The
#. detailed error follows
-#: ../client/pk-console.c:983 ../client/pk-console.c:1011
-#: ../client/pk-console.c:1039 ../client/pk-console.c:1067
-#: ../client/pk-console.c:1095
+#: ../client/pk-console.c:982 ../client/pk-console.c:1010
+#: ../client/pk-console.c:1038 ../client/pk-console.c:1066
+#: ../client/pk-console.c:1094
#, c-format
msgid "This tool could not find all the packages: %s"
msgstr "Dieses Werkzeug konnte nicht alle Pakete finden: %s"
#. TRANSLATORS: This is when the daemon crashed, and we are up shit creek
#. without a paddle
-#: ../client/pk-console.c:1124
+#: ../client/pk-console.c:1123
msgid "The daemon crashed mid-transaction!"
msgstr "Der Dämon stürzte während der Transaktion ab!"
#. TRANSLATORS: This is the header to the --help menu
-#: ../client/pk-console.c:1158
+#: ../client/pk-console.c:1157
msgid "PackageKit Console Interface"
msgstr "Schnittstelle zur PackageKit-Konsole"
#. these are commands we can use with pkcon
-#: ../client/pk-console.c:1160
+#: ../client/pk-console.c:1159
msgid "Subcommands:"
msgstr "Unterbefehle:"
#. TRANSLATORS: we keep a database updated with the time that an action was
#. last executed
-#: ../client/pk-console.c:1240
+#: ../client/pk-console.c:1241
msgid "Failed to get the time since this action was last completed"
-msgstr ""
-"Es war nicht möglich, die Zeit seit der letzten Fertigstellung festzustellen"
+msgstr "Es war nicht möglich, die Zeit seit der letzten Fertigstellung festzustellen"
#. TRANSLATORS: command line argument, just show the version string
-#: ../client/pk-console.c:1282 ../client/pk-monitor.c:371
+#: ../client/pk-console.c:1283 ../client/pk-monitor.c:370
msgid "Show the program version and exit"
msgstr "Programm-Version anzeigen und beenden"
#. TRANSLATORS: command line argument, use a filter to narrow down results
-#: ../client/pk-console.c:1285
+#: ../client/pk-console.c:1286
msgid "Set the filter, e.g. installed"
msgstr "Den Filter setzen, z.B. »installiert«"
#. TRANSLATORS: command line argument, use a non-standard install prefix
-#: ../client/pk-console.c:1288
+#: ../client/pk-console.c:1289
msgid "Set the install root, e.g. '/' or '/mnt/ltsp'"
msgstr "Das Installationsziel festlegen, z.B. »/« oder »/mnt/ltsp«"
#. TRANSLATORS: command line argument, work asynchronously
-#: ../client/pk-console.c:1291
+#: ../client/pk-console.c:1292
msgid "Exit without waiting for actions to complete"
msgstr "Beenden, ohne auf Beendigung der Aktionen zu warten"
#. command line argument, do we ask questions
-#: ../client/pk-console.c:1294
+#: ../client/pk-console.c:1295
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:525
msgid "Install the packages without asking for confirmation"
msgstr "Die Pakete ohne erneute Nachfrage installieren"
#. TRANSLATORS: command line argument, this command is not a priority
-#: ../client/pk-console.c:1297
+#: ../client/pk-console.c:1298
msgid "Run the command using idle network bandwidth and also using less power"
-msgstr ""
-"Befehl ausführen unter Verwendung ungenutzer Netzwerkbandbreite und wenig "
-"Energie"
+msgstr "Befehl ausführen unter Verwendung ungenutzer Netzwerkbandbreite und wenig Energie"
#. TRANSLATORS: command line argument, just output without fancy formatting
-#: ../client/pk-console.c:1300
+#: ../client/pk-console.c:1301
msgid ""
"Print to screen a machine readable output, rather than using animated "
"widgets"
-msgstr ""
-"Auf dem Bildschirm computerlesbare Ausgabe ausgeben, anstatt animierte "
-"Widgets zu verwenden"
+msgstr "Auf dem Bildschirm computerlesbare Ausgabe ausgeben, anstatt animierte Widgets zu verwenden"
#. TRANSLATORS: command line argument, just output without fancy formatting
-#: ../client/pk-console.c:1303
+#: ../client/pk-console.c:1304
msgid "The maximum metadata cache age. Use -1 for 'never'."
-msgstr ""
-"Das Höchstalter des Metadaten-Zwischenspeichers. Verwenden Sie -1 für "
-"»keines«."
+msgstr "Das Höchstalter des Metadaten-Zwischenspeichers. Verwenden Sie -1 für »keines«."
#. TRANSLATORS: command line argument, --help
-#: ../client/pk-console.c:1306
+#: ../client/pk-console.c:1307
msgid "Show help options."
msgstr "Hilfeoptionen anzeigen."
#. TRANSLATORS: we failed to contact the daemon
-#: ../client/pk-console.c:1336
+#: ../client/pk-console.c:1338
msgid "Failed to parse command line"
msgstr "Verarbeiten der Befehlszeile schlug fehl"
#. TRANSLATORS: we failed to contact the daemon
-#: ../client/pk-console.c:1346
+#: ../client/pk-console.c:1348
msgid "Failed to contact PackageKit"
msgstr "PackageKit konnte nicht kontaktiert werden"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1399
+#: ../client/pk-console.c:1401
msgid "The proxy could not be set"
msgstr "Der Proxy konnte nicht festgelegt werden"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1411
+#: ../client/pk-console.c:1413
msgid "The install root could not be set"
msgstr "Das Installationsziel konnte nicht festgelegt werden"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1423
+#: ../client/pk-console.c:1425
msgid "The filter specified was invalid"
msgstr "Der angegebene Filter war ungültig"
#. TRANSLATORS: a search type can be name, details, file, etc
-#: ../client/pk-console.c:1442
+#: ../client/pk-console.c:1444
msgid "A search type is required, e.g. name"
msgstr "Eine Suchart ist nötig, z.B. »Name«"
#. TRANSLATORS: the user needs to provide a search term
-#: ../client/pk-console.c:1449 ../client/pk-console.c:1461
-#: ../client/pk-console.c:1473 ../client/pk-console.c:1485
+#: ../client/pk-console.c:1451 ../client/pk-console.c:1463
+#: ../client/pk-console.c:1475 ../client/pk-console.c:1487
msgid "A search term is required"
msgstr "Ein Suchbegriff ist erforderlich"
#. TRANSLATORS: the search type was provided, but invalid
-#: ../client/pk-console.c:1495
+#: ../client/pk-console.c:1497
msgid "Invalid search type"
msgstr "Ungültige Suchart"
#. TRANSLATORS: the user did not specify what they wanted to install
-#: ../client/pk-console.c:1501
+#: ../client/pk-console.c:1503
msgid "A package name to install is required"
msgstr "Ein zu installierender Paketname ist erforderlich"
#. TRANSLATORS: the user did not specify what they wanted to install
-#: ../client/pk-console.c:1510
+#: ../client/pk-console.c:1512
msgid "A filename to install is required"
msgstr "Ein zu installierender Dateiname ist erforderlich"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1521
+#: ../client/pk-console.c:1523
msgid "A type, key_id and package_id are required"
msgstr "Ein Typ, Schlüsselkennung und Paketkennung sind erforderlich"
#. TRANSLATORS: the user did not specify what they wanted to remove
-#: ../client/pk-console.c:1532
+#: ../client/pk-console.c:1534
msgid "A package name to remove is required"
msgstr "Zum Entfernen ist ein Paketname erforderlich"
#. TRANSLATORS: the user did not specify anything about what to download or
#. where
-#: ../client/pk-console.c:1541
+#: ../client/pk-console.c:1543
msgid "A destination directory and the package names to download are required"
-msgstr ""
-"Ein Zielordner und die Namen der Pakete zum Herunterladen sind erforderlich"
+msgstr "Ein Zielordner und die Namen der Pakete zum Herunterladen sind erforderlich"
#. TRANSLATORS: the directory does not exist, so we can't continue
-#: ../client/pk-console.c:1548
+#: ../client/pk-console.c:1550
msgid "Directory not found"
msgstr "Ordner nicht gefunden"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1557
+#: ../client/pk-console.c:1559
msgid "A licence identifier (eula-id) is required"
msgstr "Eine Lizenzbezeichnung (eula-id) ist erforderlich"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1568
+#: ../client/pk-console.c:1570
msgid "A transaction identifier (tid) is required"
msgstr "Eine Transaktionsbezeichnung (tid) ist erforderlich"
#. TRANSLATORS: The user did not specify a package name
-#: ../client/pk-console.c:1589
+#: ../client/pk-console.c:1591
msgid "A package name to resolve is required"
msgstr "Ein Paketname ist zur Auflösung erforderlich"
#. TRANSLATORS: The user did not specify a repository (software source) name
-#: ../client/pk-console.c:1600 ../client/pk-console.c:1611
+#: ../client/pk-console.c:1602 ../client/pk-console.c:1613
msgid "A repository name is required"
msgstr "Ein Depotname wird benötigt"
#. TRANSLATORS: The user didn't provide any data
-#: ../client/pk-console.c:1622
+#: ../client/pk-console.c:1624
msgid "A repo name, parameter and value are required"
msgstr "Ein Depotname, Parameter und Wert sind erforderlich"
#. TRANSLATORS: The user didn't specify what action to use
-#: ../client/pk-console.c:1639
+#: ../client/pk-console.c:1641
msgid "An action, e.g. 'update-system' is required"
msgstr "Ein Vorgang, z.B. »update-system«, wird benötigt"
#. TRANSLATORS: The user specified an invalid action
-#: ../client/pk-console.c:1646
+#: ../client/pk-console.c:1648
msgid "A correct role is required"
msgstr "Eine korrekte Rolle wird benötigt"
#. TRANSLATORS: The user did not provide a package name
#. TRANSLATORS: This is when the user fails to supply the package name
-#: ../client/pk-console.c:1656 ../client/pk-console.c:1670
-#: ../client/pk-console.c:1679 ../client/pk-console.c:1699
-#: ../client/pk-console.c:1708 ../client/pk-generate-pack.c:314
+#: ../client/pk-console.c:1658 ../client/pk-console.c:1672
+#: ../client/pk-console.c:1681 ../client/pk-console.c:1701
+#: ../client/pk-console.c:1710 ../client/pk-generate-pack.c:314
msgid "A package name is required"
msgstr "Ein Paketname wird benötigt"
#. TRANSLATORS: each package "provides" certain things, e.g. mime(gstreamer-
#. decoder-mp3), the user didn't specify it
-#: ../client/pk-console.c:1688
+#: ../client/pk-console.c:1690
msgid "A package provide string is required"
msgstr "Die Zeichenkette »Stellt bereit« wird benötigt"
#. TRANSLATORS: The user did not provide a distro name
-#: ../client/pk-console.c:1732
+#: ../client/pk-console.c:1734
msgid "A distribution name is required"
msgstr "Ein Distributionsname ist notwendig"
#. TRANSLATORS: The user did not provide an upgrade type
-#: ../client/pk-console.c:1738
+#: ../client/pk-console.c:1740
msgid "An upgrade type is required, e.g. 'minimal', 'default' or 'complete'"
-msgstr ""
-"Ein Typ ist für eine Sytemaktualisierung erforderlich, wie z.B. »minimal«, "
-"»default« (Vorgabe) oder »complete« (vollständig)"
+msgstr "Ein Typ ist für eine Sytemaktualisierung erforderlich, wie z.B. »minimal«, »default« (Vorgabe) oder »complete« (vollständig)"
#. TRANSLATORS: The user tried to use an unsupported option on the command
#. line
-#: ../client/pk-console.c:1788
+#: ../client/pk-console.c:1795
#, c-format
msgid "Option '%s' is not supported"
msgstr "Option »%s« wird nicht unterstützt"
#. TRANSLATORS: Generic failure of what they asked to do
-#: ../client/pk-console.c:1798
+#: ../client/pk-console.c:1805
msgid "Command failed"
msgstr "Ausführung des Befehls fehlgeschlagen"
#. TRANSLATORS: we can exclude certain packages (glibc) when we know they'll
#. exist on the target
-#: ../client/pk-generate-pack.c:253
+#: ../client/pk-generate-pack.c:252
msgid "Set the file name of dependencies to be excluded"
-msgstr ""
-"Den Dateinamen der Abhängigkeiten festlegen, die ausgeschlossen werden"
+msgstr "Den Dateinamen der Abhängigkeiten festlegen, die ausgeschlossen werden"
#. TRANSLATORS: the output location
-#: ../client/pk-generate-pack.c:256
+#: ../client/pk-generate-pack.c:255
msgid ""
"The output file or directory (the current directory is used if omitted)"
-msgstr ""
-"Die Ausgabedatei oder der Ausgabeordner (der aktuelle Ordner wird bei "
-"Weglassen verwendet)"
+msgstr "Die Ausgabedatei oder der Ausgabeordner (der aktuelle Ordner wird bei Weglassen verwendet)"
#. TRANSLATORS: put a list of packages in the pack
-#: ../client/pk-generate-pack.c:259
+#: ../client/pk-generate-pack.c:258
msgid "The package to be put into the service pack"
msgstr "Das Paket zum Hinzufügen in das Service-Pack"
#. TRANSLATORS: put all pending updates in the pack
-#: ../client/pk-generate-pack.c:262
+#: ../client/pk-generate-pack.c:261
msgid "Put all updates available in the service pack"
msgstr "Alle verfügbaren Aktualisierungen zum Service-Pack hinzufügen"
@@ -669,23 +650,18 @@ msgstr "Die Paketverwaltung kann diesen Aufgabentyp nicht ausführen."
msgid ""
"Service packs cannot be created as PackageKit was not built with libarchive "
"support."
-msgstr ""
-"Service-Packs können nicht erstellt werden, weil PackageKit ohne "
-"Unterstützung für »libarchive« erstellt wurde."
+msgstr "Service-Packs können nicht erstellt werden, weil PackageKit ohne Unterstützung für »libarchive« erstellt wurde."
#. TRANSLATORS: the user specified an absolute path, but didn't get the
#. extension correct
#: ../client/pk-generate-pack.c:375
msgid "If specifying a file, the service pack name must end with"
-msgstr ""
-"Wenn Sie eine Datei angeben, dann muss der Name des Service-Packs enden mit"
+msgstr "Wenn Sie eine Datei angeben, dann muss der Name des Service-Packs enden mit"
#. TRANSLATORS: This is when file already exists
#: ../client/pk-generate-pack.c:391
msgid "A pack with the same name already exists, do you want to overwrite it?"
-msgstr ""
-"Ein Service-Pack mit dem selben Namen existiert bereits, soll es "
-"überschrieben werden?"
+msgstr "Ein Service-Pack mit dem selben Namen existiert bereits, soll es überschrieben werden?"
#. TRANSLATORS: This is when the pack was not overwritten
#: ../client/pk-generate-pack.c:394
@@ -734,11 +710,11 @@ msgstr "Service-Pack »%s« wurde erstellt"
msgid "Failed to create '%s': %s"
msgstr "Erzeugen von »%s« ist fehlgeschlagen: %s"
-#: ../client/pk-monitor.c:284
+#: ../client/pk-monitor.c:283
msgid "Failed to get daemon state"
msgstr "Daemon-Status konnte nicht abgerufen werden"
-#: ../client/pk-monitor.c:349
+#: ../client/pk-monitor.c:348
msgid "Failed to get properties"
msgstr "Ermitteln der Eigenschaften ist fehlgeschlagen"
@@ -844,60 +820,58 @@ msgstr "Die Pakete konnten nicht installiert werden"
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:723
+#: ../contrib/command-not-found/pk-command-not-found.c:725
msgid "command not found"
msgstr "Befehl nicht gefunden"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:743
msgid "Similar command is:"
msgstr "Ein ähnlicher Befehl lautet:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:755
+#: ../contrib/command-not-found/pk-command-not-found.c:757
msgid "Run similar command:"
msgstr "Ãhnlichen Befehl ausführen:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:769
-#: ../contrib/command-not-found/pk-command-not-found.c:778
+#: ../contrib/command-not-found/pk-command-not-found.c:771
+#: ../contrib/command-not-found/pk-command-not-found.c:780
msgid "Similar commands are:"
msgstr "Ãhnliche Befehle sind:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:785
+#: ../contrib/command-not-found/pk-command-not-found.c:787
msgid "Please choose a command to run"
msgstr "Bitte wählen Sie einen Befehl zum Ausführen"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:805
msgid "The package providing this file is:"
msgstr "Das folgende Paket stellt diese Datei bereit:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:810
+#: ../contrib/command-not-found/pk-command-not-found.c:812
#, c-format
msgid "Install package '%s' to provide command '%s'?"
-msgstr ""
-"Soll das Paket »%s« installiert werden, welches den Befehl »%s« "
-"bereitstellt?"
+msgstr "Soll das Paket »%s« installiert werden, welches den Befehl »%s« bereitstellt?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:837
+#: ../contrib/command-not-found/pk-command-not-found.c:839
msgid "Packages providing this file are:"
msgstr "Pakete, die diese Datei bereitstellen, sind:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:847
+#: ../contrib/command-not-found/pk-command-not-found.c:849
msgid "Suitable packages are:"
msgstr "Passende Pakete sind:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:856
+#: ../contrib/command-not-found/pk-command-not-found.c:858
msgid "Please choose a package to install"
msgstr "Bitte wählen Sie ein Paket zum Installieren"
@@ -910,18 +884,14 @@ msgstr "Installation wird begonnen"
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:407
#, c-format
msgid "Failed to find the package %s, or already installed: %s"
-msgstr ""
-"Das Paket »%s« konnte nicht gefunden werden, oder es ist bereits "
-"installiert: %s"
+msgstr "Das Paket »%s« konnte nicht gefunden werden, oder es ist bereits installiert: %s"
#. command line argument, simulate what would be done, but don't actually do
#. it
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:516
msgid ""
"Don't actually install any packages, only simulate what would be installed"
-msgstr ""
-"Keine Pakete tatsächlich installieren, sondern nur die Installation "
-"simulieren"
+msgstr "Keine Pakete tatsächlich installieren, sondern nur die Installation simulieren"
#. command line argument, do we skip packages that depend on the ones
#. specified
@@ -935,172 +905,172 @@ msgid "Do not display information or progress"
msgstr "Keine Informationen oder Fortschritt anzeigen"
#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:540
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:542
msgid "PackageKit Debuginfo Installer"
msgstr "PackageKit Fehlerdiagnose-Installation"
#. TRANSLATORS: the use needs to specify a list of package names on the
#. command line
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:554
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:556
#, c-format
msgid "ERROR: Specify package names to install."
msgstr "FEHLER: Sie müssen Paketnamen zum Installieren angeben."
#. TRANSLATORS: we are getting the list of repositories
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:590
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:592
#, c-format
msgid "Getting sources list"
msgstr "Quellenliste wird geholt"
#. TRANSLATORS: operation was not successful
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:600
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:675
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:759
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:803
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:870
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:914
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:602
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:677
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:761
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:805
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:872
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:916
msgid "FAILED."
msgstr "FEHLGESCHLAGEN."
#. TRANSLATORS: all completed 100%
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:615
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:655
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:690
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:774
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:818
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:885
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:929
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:617
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:657
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:692
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:776
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:820
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:887
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:931
#, c-format
msgid "OK."
msgstr "OK."
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:618
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:620
#, c-format
msgid "Found %i enabled and %i disabled sources."
msgstr "Es wurden %i aktivierte und %i deaktivierte Quellen gefunden."
#. TRANSLATORS: we're finding repositories that match out pattern
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:625
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:627
#, c-format
msgid "Finding debugging sources"
msgstr "Fehlerdiagnose-Quellen werden gesucht"
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:658
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:660
#, c-format
msgid "Found %i disabled debuginfo repos."
msgstr "Es wurden %i deaktivierte Fehlerdiagnose-Depots gefunden."
#. TRANSLATORS: we're now enabling all the debug sources we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:665
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:667
#, c-format
msgid "Enabling debugging sources"
msgstr "Fehlerdiagnose-Quellen werden aktiviert"
#. TRANSLATORS: tell the user how many we enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:693
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:695
#, c-format
msgid "Enabled %i debugging sources."
msgstr "%i Fehlerdiagnose-Quellen wurden aktiviert."
#. TRANSLATORS: we're now finding packages that match in all the repos
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:700
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:702
#, c-format
msgid "Finding debugging packages"
msgstr "Fehlerdiagnose-Pakete werden gesucht."
#. TRANSLATORS: we couldn't find the package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:712
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:714
#, c-format
msgid "Failed to find the package %s: %s"
msgstr "Das Paket »%s« konnte nicht gefunden werden: %s"
#. TRANSLATORS: we couldn't find the debuginfo package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:735
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:737
#, c-format
msgid "Failed to find the debuginfo package %s: %s"
msgstr "Das Fehlerdiagnose-Paket »%s« konnte nicht gefunden werden: %s"
#. TRANSLATORS: no debuginfo packages could be found to be installed
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:763
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:765
#, c-format
msgid "Found no packages to install."
msgstr "Es wurden keine Pakete zum Installieren gefunden."
#. TRANSLATORS: tell the user we found some packages, and then list them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:777
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:779
#, c-format
msgid "Found %i packages:"
msgstr "Es wurden %i Pakete gefunden:"
#. TRANSLATORS: tell the user we are searching for deps
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:793
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:795
#, c-format
msgid "Finding packages that depend on these packages"
msgstr "Es werden Pakete gesucht, die von diesen Paketen abhängen"
#. TRANSLATORS: could not install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:806
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:808
#, c-format
-msgid "Could not find dependant packages: %s"
-msgstr "Es konnten keine abhängigen Pakete gefunden werden: %s"
+msgid "Could not find dependent packages: %s"
+msgstr "Konnte abhängige Pakete nicht finden: %s"
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:822
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:824
#, c-format
msgid "Found %i extra packages."
msgstr "Es wurden %i zusätzliche Pakete gefunden."
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:826
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:828
#, c-format
msgid "No extra packages required."
msgstr "Es werden keine zusätzlichen Pakete benötigt."
#. TRANSLATORS: tell the user we found some packages (and deps), and then list
#. them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:835
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:837
#, c-format
msgid "Found %i packages to install:"
msgstr "Es wurden %i Pakete zum Installieren gefunden:"
#. TRANSLATORS: simulate mode is a testing mode where we quit before the
#. action
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:848
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:850
#, c-format
msgid "Not installing packages in simulate mode"
msgstr "Es werden im Simulationsmodus keine Pakete installiert"
#. TRANSLATORS: we are now installing the debuginfo packages we found earlier
#. TRANSLATORS: transaction state, installing packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:860
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:862
#: ../lib/packagekit-glib2/pk-console-shared.c:331
#, c-format
msgid "Installing packages"
msgstr "Pakete werden installiert"
#. TRANSLATORS: could not install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:873
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:875
#, c-format
msgid "Could not install packages: %s"
msgstr "Die Pakete konnten nicht installiert werden: %s"
#. TRANSLATORS: we are now disabling all debuginfo repos we previously enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:905
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:907
#, c-format
msgid "Disabling sources previously enabled"
msgstr "Zuvor aktivierte Quellen werden deaktiviert"
#. TRANSLATORS: no debuginfo packages could be found to be installed, detailed
#. error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:917
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:919
#, c-format
msgid "Could not disable the debugging sources: %s"
msgstr "Die Fehlerdiagnose-Quellen konnten nicht deaktiviert werden: %s"
#. TRANSLATORS: we disabled all the debugging repos that we enabled before
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:932
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:934
#, c-format
msgid "Disabled %i debugging sources."
msgstr "%i Fehlerdiagnose-Quellen wurden deaktiviert."
@@ -1154,9 +1124,7 @@ msgstr "Erweiterte Fehlerdiagnose-Informationen anzeigen"
#. it
#: ../contrib/device-rebind/pk-device-rebind.c:297
msgid "Don't actually touch the hardware, only simulate what would be done"
-msgstr ""
-"Keine Hardware tatsächlich anrühren, sondern nur simulieren, was gemacht "
-"wird"
+msgstr "Keine Hardware tatsächlich anrühren, sondern nur simulieren, was gemacht wird"
#. TRANSLATORS: command line option: a list of files to install
#: ../contrib/device-rebind/pk-device-rebind.c:300
@@ -1266,7 +1234,7 @@ msgstr "Pakete werden entfernt"
#. TRANSLATORS: transaction state, downloading package files
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:327
-#: ../lib/packagekit-glib2/pk-console-shared.c:705
+#: ../lib/packagekit-glib2/pk-enum.c:1288
msgid "Downloading packages"
msgstr "Pakete werden heruntergeladen"
@@ -1305,7 +1273,7 @@ msgstr "Signaturen werden überprüft"
#. TRANSLATORS: transaction state, when we return to a previous system state
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:359
-#: ../lib/packagekit-glib2/pk-console-shared.c:665
+#: ../lib/packagekit-glib2/pk-enum.c:1248
msgid "Rolling back"
msgstr "Zurücksetzen"
@@ -1373,12 +1341,12 @@ msgstr "Dateien werden neu verpackt"
#. TRANSLATORS: transaction state, loading databases
#: ../lib/packagekit-glib2/pk-console-shared.c:411
msgid "Loading cache"
-msgstr "Cache wird geladen"
+msgstr "Zwischenspeicher wird geladen"
#. TRANSLATORS: transaction state, scanning for running processes
#: ../lib/packagekit-glib2/pk-console-shared.c:415
msgid "Scanning applications"
-msgstr "Applikationen werden überprüft"
+msgstr "Anwenungen werden überprüft"
#. TRANSLATORS: transaction state, generating a list of packages installed on
#. the system
@@ -1395,7 +1363,7 @@ msgstr "Warten auf Sperre des Paketmanagers"
#. TRANSLATORS: transaction state, waiting for user to type in a password
#: ../lib/packagekit-glib2/pk-console-shared.c:427
msgid "Waiting for authentication"
-msgstr "Warten auf Authentifizierung"
+msgstr "Warten auf Legitimierung"
#. TRANSLATORS: transaction state, we are updating the list of processes
#: ../lib/packagekit-glib2/pk-console-shared.c:431
@@ -1420,281 +1388,281 @@ msgstr "Verwendete Bibliotheken werden überprüft"
msgid "Copying files"
msgstr "Dateien werden kopiert"
+#. TRANSLATORS: turn on all debugging
+#: ../lib/packagekit-glib2/pk-debug.c:133
+msgid "Show debugging information for all files"
+msgstr "Fehlerdiagnose-Informationen für alle Dateien anzeigen"
+
+#: ../lib/packagekit-glib2/pk-debug.c:201
+msgid "Debugging Options"
+msgstr "Optionen der Fehlerdiagnose"
+
+#: ../lib/packagekit-glib2/pk-debug.c:201
+msgid "Show debugging options"
+msgstr "Fehlerdiagnose-Optionen anzeigen"
+
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:461
+#: ../lib/packagekit-glib2/pk-enum.c:1023
msgid "Trivial"
msgstr "Trivial"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:465
+#: ../lib/packagekit-glib2/pk-enum.c:1027
msgid "Normal"
msgstr "Normal"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:469
+#: ../lib/packagekit-glib2/pk-enum.c:1031
msgid "Important"
msgstr "Wichtig"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:473
+#: ../lib/packagekit-glib2/pk-enum.c:1035
msgid "Security"
msgstr "Sicherheit"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:477
+#: ../lib/packagekit-glib2/pk-enum.c:1039
msgid "Bug fix "
-msgstr "Problembehebung"
+msgstr "Problembehebung "
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:481
+#: ../lib/packagekit-glib2/pk-enum.c:1043
msgid "Enhancement"
msgstr "Verbesserung"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:485
+#: ../lib/packagekit-glib2/pk-enum.c:1047
msgid "Blocked"
msgstr "Blockiert"
#. TRANSLATORS: The state of a package
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:490
-#: ../lib/packagekit-glib2/pk-console-shared.c:563
+#: ../lib/packagekit-glib2/pk-enum.c:1052
+#: ../lib/packagekit-glib2/pk-enum.c:1139
msgid "Installed"
msgstr "Installiert"
#. TRANSLATORS: The state of a package, i.e. not installed
-#: ../lib/packagekit-glib2/pk-console-shared.c:495
+#: ../lib/packagekit-glib2/pk-enum.c:1057
msgid "Available"
msgstr "Verfügbar"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:513
+#: ../lib/packagekit-glib2/pk-enum.c:1082
msgid "Downloading"
msgstr "Herunterladen ..."
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:517
+#: ../lib/packagekit-glib2/pk-enum.c:1086
msgid "Updating"
msgstr "Aktualisieren ..."
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:521
-#: ../lib/packagekit-glib2/pk-console-shared.c:641
+#: ../lib/packagekit-glib2/pk-enum.c:1090
+#: ../lib/packagekit-glib2/pk-enum.c:1224
msgid "Installing"
msgstr "Installieren ..."
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:525
-#: ../lib/packagekit-glib2/pk-console-shared.c:637
+#: ../lib/packagekit-glib2/pk-enum.c:1094
+#: ../lib/packagekit-glib2/pk-enum.c:1220
msgid "Removing"
msgstr "Entfernen ..."
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:529
+#: ../lib/packagekit-glib2/pk-enum.c:1098
msgid "Cleaning up"
msgstr "Bereinigen ..."
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:533
+#: ../lib/packagekit-glib2/pk-enum.c:1102
msgid "Obsoleting"
msgstr "Veraltetes bereinigen ..."
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:537
+#: ../lib/packagekit-glib2/pk-enum.c:1106
msgid "Reinstalling"
msgstr "Neu installieren â¦"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:555
+#: ../lib/packagekit-glib2/pk-enum.c:1131
msgid "Downloaded"
msgstr "Heruntergeladen"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:567
+#: ../lib/packagekit-glib2/pk-enum.c:1143
msgid "Removed"
msgstr "Entfernt"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:571
+#: ../lib/packagekit-glib2/pk-enum.c:1147
msgid "Cleaned up"
msgstr "Bereinigt"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:575
+#: ../lib/packagekit-glib2/pk-enum.c:1151
msgid "Obsoleted"
msgstr "Veraltetes bereinigt"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:579
+#: ../lib/packagekit-glib2/pk-enum.c:1155
msgid "Reinstalled"
msgstr "Neu installiert"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:597
+#: ../lib/packagekit-glib2/pk-enum.c:1180
msgid "Unknown role type"
msgstr "Unbekannter Rollentyp"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:601
+#: ../lib/packagekit-glib2/pk-enum.c:1184
msgid "Getting dependencies"
msgstr "Abhängigkeiten werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:605
+#: ../lib/packagekit-glib2/pk-enum.c:1188
msgid "Getting update details"
msgstr "Details der Aktualisierung werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:609
+#: ../lib/packagekit-glib2/pk-enum.c:1192
msgid "Getting details"
msgstr "Details werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:613
+#: ../lib/packagekit-glib2/pk-enum.c:1196
msgid "Getting requires"
msgstr "Anforderungen werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:617
+#: ../lib/packagekit-glib2/pk-enum.c:1200
msgid "Getting updates"
msgstr "Aktualisierungen werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:621
+#: ../lib/packagekit-glib2/pk-enum.c:1204
msgid "Searching by details"
msgstr "Suche nach Details"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:625
+#: ../lib/packagekit-glib2/pk-enum.c:1208
msgid "Searching by file"
msgstr "Suche nach Datei"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:629
+#: ../lib/packagekit-glib2/pk-enum.c:1212
msgid "Searching groups"
msgstr "Suche nach Gruppe"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:633
+#: ../lib/packagekit-glib2/pk-enum.c:1216
msgid "Searching by name"
msgstr "Suche nach Name"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:645
+#: ../lib/packagekit-glib2/pk-enum.c:1228
msgid "Installing files"
msgstr "Dateien werden installiert"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:649
+#: ../lib/packagekit-glib2/pk-enum.c:1232
msgid "Refreshing cache"
-msgstr "Cache wird aktualisiert"
+msgstr "Zwischenspeicher wird aktualisiert"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:653
+#: ../lib/packagekit-glib2/pk-enum.c:1236
msgid "Updating packages"
msgstr "Pakete werden aktualisiert"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:657
+#: ../lib/packagekit-glib2/pk-enum.c:1240
msgid "Updating system"
msgstr "System wird aktualisiert"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:661
+#: ../lib/packagekit-glib2/pk-enum.c:1244
msgid "Canceling"
msgstr "Abbruch"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:669
+#: ../lib/packagekit-glib2/pk-enum.c:1252
msgid "Getting repositories"
msgstr "Depots werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:673
+#: ../lib/packagekit-glib2/pk-enum.c:1256
msgid "Enabling repository"
msgstr "Depots werden aktiviert"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:677
+#: ../lib/packagekit-glib2/pk-enum.c:1260
msgid "Setting data"
msgstr "Daten werden festgelegt"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:681
+#: ../lib/packagekit-glib2/pk-enum.c:1264
msgid "Resolving"
msgstr "Auflösen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:685
+#: ../lib/packagekit-glib2/pk-enum.c:1268
msgid "Getting file list"
msgstr "Dateiliste wird abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:689
+#: ../lib/packagekit-glib2/pk-enum.c:1272
msgid "Getting provides"
msgstr "Anbieter werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:693
+#: ../lib/packagekit-glib2/pk-enum.c:1276
msgid "Installing signature"
msgstr "Signatur wird installiert"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:697
+#: ../lib/packagekit-glib2/pk-enum.c:1280
msgid "Getting packages"
msgstr "Pakete werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:701
+#: ../lib/packagekit-glib2/pk-enum.c:1284
msgid "Accepting EULA"
msgstr "EULA annehmen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:709
+#: ../lib/packagekit-glib2/pk-enum.c:1292
msgid "Getting upgrades"
msgstr "Systemaktualisierungen werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:713
+#: ../lib/packagekit-glib2/pk-enum.c:1296
msgid "Getting categories"
msgstr "Kategorien werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:717
+#: ../lib/packagekit-glib2/pk-enum.c:1300
msgid "Getting transactions"
msgstr "Transaktionen werden abgerufen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:721
-#: ../lib/packagekit-glib2/pk-console-shared.c:725
+#: ../lib/packagekit-glib2/pk-enum.c:1304
+#: ../lib/packagekit-glib2/pk-enum.c:1308
msgid "Simulating install"
msgstr "Installation wird simuliert"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:729
+#: ../lib/packagekit-glib2/pk-enum.c:1312
msgid "Simulating remove"
msgstr "Entfernen wird simuliert"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:733
+#: ../lib/packagekit-glib2/pk-enum.c:1316
msgid "Simulating update"
msgstr "Aktualisierung wird simuliert"
-#. TRANSLATORS: turn on all debugging
-#: ../lib/packagekit-glib2/pk-debug.c:133
-msgid "Show debugging information for all files"
-msgstr "Fehlerdiagnose-Informationen für alle Dateien anzeigen"
-
-#: ../lib/packagekit-glib2/pk-debug.c:201
-msgid "Debugging Options"
-msgstr "Optionen der Fehlerdiagnose"
-
-#: ../lib/packagekit-glib2/pk-debug.c:201
-msgid "Show debugging options"
-msgstr "Fehlerdiagnose-Optionen anzeigen"
-
#. TRANSLATORS: ask the user if they are comfortable installing insecure
#. packages
#: ../lib/packagekit-glib2/pk-task-text.c:67
@@ -1845,156 +1813,76 @@ msgid "The transaction did not proceed."
msgstr "Die Transaktion wurde nicht weitergeführt"
#. SECURITY:
-#. - Normal users do not require admin authentication to accept new
-#. licence agreements.
-#. - Change this to 'auth_admin' for environments where users should not
-#. be given the option to make legal decisions.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:7
-msgid "Accept EULA"
-msgstr "EULA annehmen"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:8
-msgid "Authentication is required to accept a EULA"
-msgstr "Legitimation ist zum Annehmen der EULA erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:9
-msgid ""
-"Authentication is required to cancel a task that was not started by yourself"
-msgstr ""
-"Legitimation ist zum Abbrechen einer Aufgabe erforderlich, die nicht von "
-"Ihnen initiiert wurde"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:10
-msgid "Authentication is required to change software source parameters"
-msgstr ""
-"Legitimation ist zur Ãnderung der Einstellungen zu den Softwarequellen "
-"erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:11
-msgid ""
-"Authentication is required to change the location used to decompress "
-"packages"
-msgstr ""
-"Legitimation ist zum Ãndern des Ortes zum Entpacken von Paketen erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:12
-msgid ""
-"Authentication is required to consider a key used for signing packages as "
-"trusted"
-msgstr ""
-"Legitimation ist zum Vertrauen eines Paketsignaturschlüssels erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:13
-msgid "Authentication is required to install a signed package"
-msgstr ""
-"Legitimation ist zum Installieren eines signierten Paketes erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:14
-msgid "Authentication is required to install an untrusted package"
-msgstr ""
-"Legitimation ist zum Installieren eines nicht vertrauenswürdigen Paketes "
-"erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:15
-msgid "Authentication is required to refresh the system sources"
-msgstr "Legitimation ist zum Aktualisieren der Systemressourcen erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:16
-msgid "Authentication is required to reload the device with a new driver"
-msgstr ""
-"Legitimation ist erforderlich, um das Gerät mit einem neuen Treiber zu laden"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:17
-msgid "Authentication is required to remove packages"
-msgstr "Legitimation ist zum Entfernen eines Paketes erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:18
-msgid "Authentication is required to rollback a transaction"
-msgstr "Legitimation ist zum Zurücknehmen einer Transaktion erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:19
-msgid ""
-"Authentication is required to set the network proxy used for downloading "
-"packages"
-msgstr ""
-"Legitimation ist zum Festlegen eines Netzwerk-Proxys zum Herunterladen von "
-"Paketen erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:20
-msgid "Authentication is required to update packages"
-msgstr "Legitimation ist zum Aktualisieren von Paketen erforderlich"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:21
-msgid "Authentication is required to upgrade the operating system"
-msgstr "Legitimation ist zum Aktualisieren des Betriebssystems erforderlich"
-
-#. SECURITY:
#. - Normal users are allowed to cancel their own task without
#. authentication, but a different user id needs the admin password
#. to cancel another users task.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:27
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:6
msgid "Cancel foreign task"
msgstr "Externe Aufgabe abbrechen"
-#. SECURITY:
-#. - This is used when users want to install to a different prefix, for
-#. instance to a LTSP image or a virtual machine.
-#. - This could be used to overwrite files not owned by the user using
-#. a carefully created package file.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:34
-msgid "Change location that packages are installed"
-msgstr "Wechseln Sie den Ort, auf den Pakete installiert werden sollen"
-
-#. SECURITY:
-#. - Normal users require admin authentication to enable or disable
-#. software sources as this can be used to enable new updates or
-#. install different versions of software.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:40
-msgid "Change software source parameters"
-msgstr "Einstellungen der Depotquelle ändern"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:7
+msgid ""
+"Authentication is required to cancel a task that was not started by yourself"
+msgstr "Legitimation ist zum Abbrechen einer Aufgabe erforderlich, die nicht von Ihnen initiiert wurde"
#. SECURITY:
#. - Normal users do not need authentication to install signed packages
#. from signed repositories, as this cannot exploit a system.
#. - Paranoid users (or parents!) can change this to 'auth_admin' or
#. 'auth_admin_keep'.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:47
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:14
msgid "Install signed package"
msgstr "Signierte Pakete installieren"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:15
+msgid "Authentication is required to install a signed package"
+msgstr "Legitimation ist zum Installieren eines signierten Paketes erforderlich"
+
#. SECURITY:
#. - Normal users require admin authentication to install untrusted or
#. unrecognised packages, as allowing users to do this without a
#. password would be a massive security hole.
#. - This is not retained as each package should be authenticated.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:54
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:22
msgid "Install untrusted local file"
msgstr "Nicht vertrauenswürdige lokale Datei installieren"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:23
+msgid "Authentication is required to install an untrusted package"
+msgstr "Legitimation ist zum Installieren eines nicht vertrauenswürdigen Paketes erforderlich"
+
#. SECURITY:
-#. - Normal users do not require admin authentication to refresh the
-#. cache, as this doesn't actually install or remove software.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:59
-msgid "Refresh system sources"
-msgstr "Systemressourcen aktualisieren"
+#. - Normal users require admin authentication to add signing keys.
+#. - This implies adding an explicit trust, and should not be granted
+#. without a secure authentication.
+#. - This is not kept as each package should be authenticated.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:30
+msgid "Trust a key used for signing packages"
+msgstr "Einem Schlüssel zum Signieren von Paketen vertrauen"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:31
+msgid ""
+"Authentication is required to consider a key used for signing packages as "
+"trusted"
+msgstr "Legitimation ist zum Vertrauen eines Paketsignaturschlüssels erforderlich"
#. SECURITY:
-#. - Normal users require admin authentication to rebind a driver
-#. so that it works after we install firmware.
-#. - This should not be set to 'yes' as unprivileged users could then
-#. try to rebind drivers in use, for instance security authentication
-#. devices.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:67
-msgid "Reload a device"
-msgstr "Ein Gerät neu laden"
+#. - Normal users do not require admin authentication to accept new
+#. licence agreements.
+#. - Change this to 'auth_admin' for environments where users should not
+#. be given the option to make legal decisions.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:38
+msgid "Accept EULA"
+msgstr "EULA annehmen"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:39
+msgid "Authentication is required to accept a EULA"
+msgstr "Legitimation ist zum Annehmen der EULA erforderlich"
#. SECURITY:
#. - Normal users require admin authentication to remove packages as
@@ -2004,58 +1892,139 @@ msgstr "Ein Gerät neu laden"
#. admin authentication has been obtained, otherwise packages can still
#. be removed. If this is not possible, change this authentication to
#. 'auth_admin'.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:77
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:49
msgid "Remove package"
msgstr "Paket entfernen"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:50
+msgid "Authentication is required to remove packages"
+msgstr "Legitimation ist zum Entfernen eines Paketes erforderlich"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update the
+#. system as the packages will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:58
+msgid "Update packages"
+msgstr "Pakete aktualisieren"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:59
+msgid "Authentication is required to update packages"
+msgstr "Legitimation ist zum Aktualisieren von Paketen erforderlich"
+
#. SECURITY:
#. - Normal users require admin authentication to rollback system state
#. as this will change a large number of packages, and could expose the
#. system to previously patched security vulnerabilities.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:83
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:65
msgid "Rollback to a previous transaction"
msgstr "Eine vorhergehende Transaktion zurücknehmen"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:66
+msgid "Authentication is required to rollback a transaction"
+msgstr "Legitimation ist zum Zurücknehmen einer Transaktion erforderlich"
+
+#. SECURITY:
+#. - Normal users require admin authentication to enable or disable
+#. software sources as this can be used to enable new updates or
+#. install different versions of software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:72
+msgid "Change software source parameters"
+msgstr "Einstellungen der Paketquelle ändern"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:73
+msgid "Authentication is required to change software source parameters"
+msgstr "Legitimation ist zur Ãnderung der Einstellungen zu den Softwarequellen erforderlich"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to refresh the
+#. cache, as this doesn't actually install or remove software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:78
+msgid "Refresh system sources"
+msgstr "Systemressourcen aktualisieren"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:79
+msgid "Authentication is required to refresh the system sources"
+msgstr "Legitimation ist zum Aktualisieren der Systemressourcen erforderlich"
+
#. SECURITY:
#. - Normal users do not require admin authentication to set the proxy
#. used for downloading packages.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:88
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:84
msgid "Set network proxy"
msgstr "Netwerk-Proxy festlegen"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:85
+msgid ""
+"Authentication is required to set the network proxy used for downloading "
+"packages"
+msgstr "Legitimation ist zum Festlegen eines Netzwerk-Proxys zum Herunterladen von Paketen erforderlich"
+
#. SECURITY:
-#. - Normal users require admin authentication to add signing keys.
-#. - This implies adding an explicit trust, and should not be granted
-#. without a secure authentication.
-#. - This is not kept as each package should be authenticated.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:95
-msgid "Trust a key used for signing packages"
-msgstr "Einem Schlüssel zum Signieren von Paketen vertrauen"
+#. - This is used when users want to install to a different prefix, for
+#. instance to a LTSP image or a virtual machine.
+#. - This could be used to overwrite files not owned by the user using
+#. a carefully created package file.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:92
+msgid "Change location that packages are installed"
+msgstr "Wechseln Sie den Ort, auf den Pakete installiert werden sollen"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:93
+msgid ""
+"Authentication is required to change the location used to decompress "
+"packages"
+msgstr "Legitimation ist zum Ãndern des Ortes zum Entpacken von Paketen erforderlich"
#. SECURITY:
-#. - Normal users do not require admin authentication to update the
-#. system as the packages will be signed, and the action is required
-#. to update the system when unattended.
-#. - Changing this to anything other than 'yes' will break unattended
-#. updates.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:103
-msgid "Update packages"
-msgstr "Pakete aktualisieren"
+#. - Normal users require admin authentication to rebind a driver
+#. so that it works after we install firmware.
+#. - This should not be set to 'yes' as unprivileged users could then
+#. try to rebind drivers in use, for instance security authentication
+#. devices.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:101
+msgid "Reload a device"
+msgstr "Ein Gerät neu laden"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:102
+msgid "Authentication is required to reload the device with a new driver"
+msgstr "Legitimation ist erforderlich, um das Gerät mit einem neuen Treiber zu laden"
#. SECURITY:
#. - Normal users require admin authentication to upgrade the disto as
#. this can make the system unbootable or stop other applications from
#. working.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:109
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:108
msgid "Upgrade System"
msgstr "Systemaktualisierung"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:109
+msgid "Authentication is required to upgrade the operating system"
+msgstr "Legitimation ist zum Aktualisieren des Betriebssystems erforderlich"
+
+#. SECURITY:
+#. - Normal users require admin authentication to repair the system
+#. since this can make the system unbootable or stop other
+#. applications from working.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:115
+msgid "Repair System"
+msgstr "System reparieren"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:116
+msgid "Authentication is required to repair the installed software"
+msgstr "Legitimierung ist erforderlich, um die installierte Software zu reparieren"
+
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
#: ../src/pk-main.c:149
msgid "Packaging backend to use, e.g. dummy"
@@ -2089,7 +2058,7 @@ msgstr "Nach Laden des Kerns beenden"
#. TRANSLATORS: don't unset environment variables, used for debugging
#: ../src/pk-main.c:167
msgid "Don't clear environment on startup"
-msgstr ""
+msgstr "Umgebung beim Start nicht bereinigen"
#. TRANSLATORS: describing the service that is running
#: ../src/pk-main.c:179
@@ -2101,26 +2070,22 @@ msgid "Failed to load any of the specified backends:"
msgstr "Das Laden von irgendeinem der angegebenen Backends schlug fehl:"
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2696
+#: ../src/pk-transaction.c:2972
msgid "The software is not from a trusted source."
msgstr "Die Software stammt nicht aus einer vertrauenswürdigen Quelle."
-#: ../src/pk-transaction.c:2704
+#: ../src/pk-transaction.c:2980
msgid "Do not update this package unless you are sure it is safe to do so."
-msgstr ""
-"Aktualisieren Sie dieses Paket nur, wenn Sie überzeugt sind, dass dies "
-"sicher ist."
+msgstr "Aktualisieren Sie dieses Paket nur, wenn Sie überzeugt sind, dass dies sicher ist."
-#: ../src/pk-transaction.c:2705
+#: ../src/pk-transaction.c:2981
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr "Aktualisieren Sie diese Pakete nur, wenn Sie dies für sicher halten."
-#: ../src/pk-transaction.c:2715
+#: ../src/pk-transaction.c:2991
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr "Installieren Sie dieses Paket nur, wenn Sie dies für sicher halten."
-#: ../src/pk-transaction.c:2716
+#: ../src/pk-transaction.c:2992
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr "Installieren Sie diese Pakete nur, wenn Sie dies für sicher halten."
-
-
diff --git a/po/ko.po b/po/ko.po
index 31f4999..70d53e3 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -4,14 +4,15 @@
#
# Translators:
# <darkcircle.0426 at gmail.com>, 2011.
+# Shinjo Park <kde at peremen.name>, 2012.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-10 19:50+0000\n"
-"PO-Revision-Date: 2011-11-10 19:50+0000\n"
-"Last-Translator: Richard Hughes <richard at hughsie.com>\n"
-"Language-Team: Korean (http://www.transifex.net/projects/p/freedesktop/team/ko/)\n"
+"POT-Creation-Date: 2012-03-01 11:08+0000\n"
+"PO-Revision-Date: 2012-04-14 16:39+0000\n"
+"Last-Translator: Shinjo Park <kde at peremen.name>\n"
+"Language-Team: Korean (http://www.transifex.net/projects/p/freedesktop/language/ko/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -20,122 +21,122 @@ msgstr ""
#. TRANSLATORS: this is an atomic transaction
#. TRANSLATORS: the role is the point of the transaction, e.g. update-system
-#: ../client/pk-console.c:174 ../client/pk-console.c:596
+#: ../client/pk-console.c:173 ../client/pk-console.c:595
msgid "Transaction"
msgstr "í¸ëìì
"
#. TRANSLATORS: this is the time the transaction was started in system
#. timezone
-#: ../client/pk-console.c:176
+#: ../client/pk-console.c:175
msgid "System time"
msgstr "ìì¤í
ìê°"
#. TRANSLATORS: this is if the transaction succeeded or not
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "Succeeded"
msgstr "ì±ê³µ"
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "True"
msgstr "ì°¸"
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "False"
msgstr "ê±°ì§"
#. TRANSLATORS: this is the transactions role, e.g. "update-system"
-#: ../client/pk-console.c:180
+#: ../client/pk-console.c:179
msgid "Role"
msgstr "ìí "
#. TRANSLATORS: this is The duration of the transaction
-#: ../client/pk-console.c:185
+#: ../client/pk-console.c:184
msgid "Duration"
-msgstr "ì¡´ì기ê°"
+msgstr "ì§ì 기ê°"
-#: ../client/pk-console.c:185
+#: ../client/pk-console.c:184
msgid "(seconds)"
msgstr "(ì´)"
#. TRANSLATORS: this is The command line used to do the action
-#: ../client/pk-console.c:189
+#: ../client/pk-console.c:188
msgid "Command line"
-msgstr "ëª
ë ¹ ì¤"
+msgstr "ëª
ë ¹ì¤"
#. TRANSLATORS: this is the user ID of the user that started the action
-#: ../client/pk-console.c:191
+#: ../client/pk-console.c:190
msgid "User ID"
msgstr "ì¬ì©ì ID"
#. TRANSLATORS: this is the username, e.g. hughsie
-#: ../client/pk-console.c:198
+#: ../client/pk-console.c:197
msgid "Username"
msgstr "ì¬ì©ì ì´ë¦"
#. TRANSLATORS: this is the users real name, e.g. "Richard Hughes"
-#: ../client/pk-console.c:202
+#: ../client/pk-console.c:201
msgid "Real name"
msgstr "ì¤ì ì´ë¦"
-#: ../client/pk-console.c:210
+#: ../client/pk-console.c:209
msgid "Affected packages:"
msgstr "ë°ìë í¨í¤ì§:"
-#: ../client/pk-console.c:212
+#: ../client/pk-console.c:211
msgid "Affected packages: None"
-msgstr "ë°ìë í¨í¤ì§: "
+msgstr "ë°ìë í¨í¤ì§: ìì"
#. TRANSLATORS: this is the distro, e.g. Fedora 10
-#: ../client/pk-console.c:247
+#: ../client/pk-console.c:246
msgid "Distribution"
msgstr "ë°°í¬í"
#. TRANSLATORS: this is type of update, stable or testing
-#: ../client/pk-console.c:249
+#: ../client/pk-console.c:248
msgid "Type"
msgstr "ì í"
#. TRANSLATORS: this is any summary text describing the upgrade
#. TRANSLATORS: this is the summary of the group
-#: ../client/pk-console.c:251 ../client/pk-console.c:290
+#: ../client/pk-console.c:250 ../client/pk-console.c:289
msgid "Summary"
msgstr "ìì½"
#. TRANSLATORS: this is the group category name
-#: ../client/pk-console.c:279
+#: ../client/pk-console.c:278
msgid "Category"
msgstr "ë¶ë¥"
#. TRANSLATORS: this is group identifier
-#: ../client/pk-console.c:281
+#: ../client/pk-console.c:280
msgid "ID"
msgstr "ID"
#. TRANSLATORS: this is the parent group
-#: ../client/pk-console.c:284
+#: ../client/pk-console.c:283
msgid "Parent"
msgstr "ë¶ëª¨"
#. TRANSLATORS: this is the name of the parent group
-#: ../client/pk-console.c:287
+#: ../client/pk-console.c:286
msgid "Name"
msgstr "ì´ë¦"
#. TRANSLATORS: this is preferred icon for the group
-#: ../client/pk-console.c:293
+#: ../client/pk-console.c:292
msgid "Icon"
msgstr "ìì´ì½"
#. TRANSLATORS: this is a header for the package that can be updated
-#: ../client/pk-console.c:339
+#: ../client/pk-console.c:338
msgid "Details about the update:"
-msgstr "ì
ë°ì´í¸ ì¸ë¶ì¬í:"
+msgstr "ìì¸í ì
ë°ì´í¸ ì ë³´:"
#. TRANSLATORS: details about the update, package name and version
#. TRANSLATORS: the package that is being processed
#. TRANSLATORS: the package that is not signed by a known key
#. TRANSLATORS: the package name that was trying to be installed
-#: ../client/pk-console.c:345 ../client/pk-console.c:615
+#: ../client/pk-console.c:344 ../client/pk-console.c:614
#: ../lib/packagekit-glib2/pk-task-text.c:124
#: ../lib/packagekit-glib2/pk-task-text.c:206
msgid "Package"
@@ -143,215 +144,215 @@ msgstr "í¨í¤ì§"
#. TRANSLATORS: details about the update, any packages that this update
#. updates
-#: ../client/pk-console.c:348
+#: ../client/pk-console.c:347
msgid "Updates"
msgstr "ê°±ì "
#. TRANSLATORS: details about the update, any packages that this update
#. obsoletes
-#: ../client/pk-console.c:352
+#: ../client/pk-console.c:351
msgid "Obsoletes"
msgstr "ì¤ëë í목"
#. TRANSLATORS: details about the update, the vendor URLs
#. TRANSLATORS: the vendor (e.g. vmware) that is providing the EULA
-#: ../client/pk-console.c:356 ../lib/packagekit-glib2/pk-task-text.c:209
+#: ../client/pk-console.c:355 ../lib/packagekit-glib2/pk-task-text.c:209
msgid "Vendor"
msgstr "ì ì¡°ì"
#. TRANSLATORS: details about the update, the bugzilla URLs
-#: ../client/pk-console.c:360
+#: ../client/pk-console.c:359
msgid "Bugzilla"
msgstr "ë²ê·¸ì§ë¼"
#. TRANSLATORS: details about the update, the CVE URLs
-#: ../client/pk-console.c:364
+#: ../client/pk-console.c:363
msgid "CVE"
msgstr "CVE"
#. TRANSLATORS: details about the update, if the package requires a restart
-#: ../client/pk-console.c:368
+#: ../client/pk-console.c:367
msgid "Restart"
msgstr "ì¬ìì"
#. TRANSLATORS: details about the update, any description of the update
-#: ../client/pk-console.c:372
+#: ../client/pk-console.c:371
msgid "Update text"
msgstr "í
ì¤í¸"
#. TRANSLATORS: details about the update, the changelog for the package
-#: ../client/pk-console.c:376
+#: ../client/pk-console.c:375
msgid "Changes"
msgstr "ë³ê²½"
#. TRANSLATORS: details about the update, the ongoing state of the update
-#: ../client/pk-console.c:380
+#: ../client/pk-console.c:379
msgid "State"
msgstr "ìí"
#. TRANSLATORS: details about the update, date the update was issued
-#: ../client/pk-console.c:384
+#: ../client/pk-console.c:383
msgid "Issued"
msgstr "ë±ë¡ë¨"
#. TRANSLATORS: details about the update, date the update was updated
#. TRANSLATORS: The action of the package, in past tense
-#: ../client/pk-console.c:388 ../lib/packagekit-glib2/pk-console-shared.c:559
+#: ../client/pk-console.c:387 ../lib/packagekit-glib2/pk-enum.c:1135
msgid "Updated"
msgstr "ê°±ì ë¨"
#. TRANSLATORS: if the repo is enabled
-#: ../client/pk-console.c:424
+#: ../client/pk-console.c:423
msgid "Enabled"
msgstr "íì±íë¨"
#. TRANSLATORS: if the repo is disabled
-#: ../client/pk-console.c:427
+#: ../client/pk-console.c:426
msgid "Disabled"
msgstr "ë¹íì±íë¨"
#. TRANSLATORS: a package requires the system to be restarted
-#: ../client/pk-console.c:459
+#: ../client/pk-console.c:458
msgid "System restart required by:"
-msgstr "ë¤ìì ìí´ ìì¤í
ì¬ììì´ ì구ë¨:"
+msgstr "ë¤ì í¨í¤ì§ìì ìì¤í
ì¬ììì ìì²í¨:"
#. TRANSLATORS: a package requires the session to be restarted
-#: ../client/pk-console.c:462
+#: ../client/pk-console.c:461
msgid "Session restart required:"
-msgstr "ì¸ì
ì¬ììì´ ì구íë ê²ë¤:"
+msgstr "ì¸ì
ì¬ììì ìì²í¨:"
#. TRANSLATORS: a package requires the system to be restarted due to a
#. security update
-#: ../client/pk-console.c:465
+#: ../client/pk-console.c:464
msgid "System restart (security) required by:"
-msgstr "ë¤ìì ìí´ (ë³´ìì±) ìì¤í
ì¬ììì´ ì구ë¨:"
+msgstr "ë¤ì í¨í¤ì§ìì (ë³´ìë) ìì¤í
ì¬ììì ìì²í¨:"
#. TRANSLATORS: a package requires the session to be restarted due to a
#. security update
-#: ../client/pk-console.c:468
+#: ../client/pk-console.c:467
msgid "Session restart (security) required:"
-msgstr "(ë³´ìì±) ì¸ì
ì¬ììì´ ì구íë ê²ë¤:"
+msgstr "(ë³´ìë) ìì¤í
ì¬ììì ìì²í¨:"
#. TRANSLATORS: a package requires the application to be restarted
-#: ../client/pk-console.c:471
+#: ../client/pk-console.c:470
msgid "Application restart required by:"
-msgstr "ë¤ìì ìí´ íë¡ê·¸ë¨ ì¬ììì´ ì구ë¨:"
+msgstr "íë¡ê·¸ë¨ ì¬ììì ìì²í¨:"
#. TRANSLATORS: This a list of details about the package
-#: ../client/pk-console.c:506
+#: ../client/pk-console.c:505
msgid "Package description"
msgstr "í¨í¤ì§ ì¤ëª
"
#. TRANSLATORS: This a message (like a little note that may be of interest)
#. from the transaction
-#: ../client/pk-console.c:537
+#: ../client/pk-console.c:536
msgid "Message:"
-msgstr "ë©ì¸ì§:"
+msgstr "ë©ìì§:"
#. TRANSLATORS: This where the package has no files
-#: ../client/pk-console.c:558
+#: ../client/pk-console.c:557
msgid "No files"
msgstr "íì¼ì´ ìì"
#. TRANSLATORS: This a list files contained in the package
-#: ../client/pk-console.c:563
+#: ../client/pk-console.c:562
msgid "Package files"
msgstr "í¨í¤ì§ íì¼"
#. TRANSLATORS: the percentage complete of the transaction
-#: ../client/pk-console.c:631
+#: ../client/pk-console.c:630
msgid "Percentage"
msgstr "ë°±ë¶ì¨"
#. TRANSLATORS: the status of the transaction (e.g. downloading)
-#: ../client/pk-console.c:649
+#: ../client/pk-console.c:648
msgid "Status"
msgstr "ìí"
#. TRANSLATORS: the results from the transaction
-#: ../client/pk-console.c:678
+#: ../client/pk-console.c:677
msgid "Results:"
msgstr "ê²°ê³¼:"
#. TRANSLATORS: we failed to get any results, which is pretty fatal in my book
-#: ../client/pk-console.c:685
+#: ../client/pk-console.c:684
msgid "Fatal error"
msgstr "ì¹ëª
ì ì¤ë¥"
#. TRANSLATORS: the user asked to update everything, but there is nothing that
#. can be updated
-#: ../client/pk-console.c:701
+#: ../client/pk-console.c:700
msgid "There are no packages to update."
msgstr "ì
ë°ì´í¸í í¨í¤ì§ê° ììµëë¤."
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../client/pk-console.c:704
+#: ../client/pk-console.c:703
#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr "í¸ëìì
ì ì¤í¨íìµëë¤."
#. TRANSLATORS: print a message when there are no updates
-#: ../client/pk-console.c:733
+#: ../client/pk-console.c:732
msgid "There are no updates available at this time."
-msgstr "ì§ê¸ ê°ë¥í ê°±ì ë´ì©ì´ ììµëë¤."
+msgstr "íì¬ ì¬ì© ê°ë¥í ì
ë°ì´í¸ê° ììµëë¤."
-#: ../client/pk-console.c:756
+#: ../client/pk-console.c:755
msgid "There are no upgrades available at this time."
-msgstr "ì§ê¸ ê°ë¥í ì
ê·¸ë ì´ëê° ììµëë¤."
+msgstr "íì¬ ì¬ì© ê°ë¥í ì
ê·¸ë ì´ëê° ììµëë¤."
#. TRANSLATORS: a package needs to restart their system
-#: ../client/pk-console.c:823
+#: ../client/pk-console.c:822
msgid "Please restart the computer to complete the update."
-msgstr "ê°±ì ì ìë£íë ¤ë©´ ì»´í¨í°ë¥¼ ì¬ììíì¬ ì£¼ì기 ë°ëëë¤."
+msgstr "ì
ë°ì´í¸ë¥¼ ìë£íë ¤ë©´ ì»´í¨í°ë¥¼ ë¤ì ììíììì¤."
#. TRANSLATORS: a package needs to restart the session
-#: ../client/pk-console.c:826
+#: ../client/pk-console.c:825
msgid "Please logout and login to complete the update."
-msgstr "ê°±ì ì ìë£íë ¤ë©´ ë¡ê·¸ììí ë¡ê·¸ì¸íì¬ ì£¼ì기 ë°ëëë¤."
+msgstr "ì
ë°ì´í¸ë¥¼ ìë£íë ¤ë©´ ë¡ê·¸ìì í ë¤ì ë¡ê·¸ì¸íììì¤."
#. TRANSLATORS: a package needs to restart their system (due to security)
-#: ../client/pk-console.c:829
+#: ../client/pk-console.c:828
msgid ""
"Please restart the computer to complete the update as important security "
"updates have been installed."
-msgstr "ì¤ì¹ë ì¤ìí ë³´ì ê°±ì ì ìë£íë ¤ë©´ ì»´í¨í°ë¥¼ ì¬ììíì¬ ì£¼ì기 ë°ëëë¤."
+msgstr "ì¤ìí ë³´ì ì
ë°ì´í¸ë¥¼ ìë£íë ¤ë©´ ì»´í¨í°ë¥¼ ë¤ì ììíììì¤."
#. TRANSLATORS: a package needs to restart the session (due to security)
-#: ../client/pk-console.c:832
+#: ../client/pk-console.c:831
msgid ""
"Please logout and login to complete the update as important security updates"
" have been installed."
-msgstr "ì¤ì¹ë ì¤ìí ë³´ì ê°±ì ì ìë£íë ¤ë©´ ë¡ê·¸ììí ë¡ê·¸ì¸íì¬ ì£¼ì기 ë°ëëë¤."
+msgstr "ì¤ìí ë³´ì ì
ë°ì´í¸ë¥¼ ìë£íë ¤ë©´ ë¡ê·¸ìì í ë¤ì ë¡ê·¸ì¸íììì¤."
#. TRANSLATORS: The user used 'pkcon install dave.rpm' rather than 'pkcon
#. install-local dave.rpm'
-#: ../client/pk-console.c:858
+#: ../client/pk-console.c:857
#, c-format
msgid ""
"Expected package name, actually got file. Try using 'pkcon install-local %s'"
" instead."
-msgstr "ììë í¨í¤ì§ ì´ë¦ì ì¤ì ë¡ íì¼ë¡ ì»ììµëë¤. 'pkcon install-local %s' ëª
ë ¹ì ëì ìëí´ ë³´ììì¤."
+msgstr "í¨í¤ì§ ì´ë¦ì ììíìì¼ë, íì¼ì ì§ì íììµëë¤. 'pkcon install-local %s' ëª
ë ¹ì ëì ìëí´ ë³´ììì¤."
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:871
+#: ../client/pk-console.c:870
#, c-format
msgid "This tool could not find any available package: %s"
-msgstr "ì´ ë구 ì´ë¤ ì¬ì©ê°ë¥í í¨í¤ì§ë ì°¾ì ì ììµëë¤: %s"
+msgstr "ì¬ì© ê°ë¥í í¨í¤ì§ë¥¼ ì°¾ì ì ìì: %s"
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:899
+#: ../client/pk-console.c:898
#, c-format
msgid "This tool could not find the installed package: %s"
-msgstr "ì´ ë구ë ì´ë¤ ì¤ì¹ë í¨í¤ì§ë ì°¾ì ì ììµëë¤: %s"
+msgstr "ì¤ì¹ë í¨í¤ì§ë¥¼ ì°¾ì ì ìì: %s"
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:927 ../client/pk-console.c:955
+#: ../client/pk-console.c:926 ../client/pk-console.c:954
#, c-format
msgid "This tool could not find the package: %s"
-msgstr "ì´ ë구ë í¨í¤ì§ë¥¼ ì°¾ì ì ììµëë¤: %s"
+msgstr "í¨í¤ì§ë¥¼ ì°¾ì ì ìì: %s"
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
@@ -361,245 +362,245 @@ msgstr "ì´ ë구ë í¨í¤ì§ë¥¼ ì°¾ì ì ììµëë¤: %s"
#. detailed error follows
#. TRANSLATORS: The package name was not found in any software sources. The
#. detailed error follows
-#: ../client/pk-console.c:983 ../client/pk-console.c:1011
-#: ../client/pk-console.c:1039 ../client/pk-console.c:1067
-#: ../client/pk-console.c:1095
+#: ../client/pk-console.c:982 ../client/pk-console.c:1010
+#: ../client/pk-console.c:1038 ../client/pk-console.c:1066
+#: ../client/pk-console.c:1094
#, c-format
msgid "This tool could not find all the packages: %s"
-msgstr "ì´ ë구ë 모ë í¨í¤ì§ë¥¼ ì°¾ì ì ììµëë¤: %s"
+msgstr "모ë í¨í¤ì§ë¥¼ ì°¾ì ì ìì: %s"
#. TRANSLATORS: This is when the daemon crashed, and we are up shit creek
#. without a paddle
-#: ../client/pk-console.c:1124
+#: ../client/pk-console.c:1123
msgid "The daemon crashed mid-transaction!"
msgstr "í¸ëìì
ëì¤ ë°ëª¬ì´ 충ëíììµëë¤!"
#. TRANSLATORS: This is the header to the --help menu
-#: ../client/pk-console.c:1158
+#: ../client/pk-console.c:1157
msgid "PackageKit Console Interface"
msgstr "PackageKit ì½ì ì¸í°íì´ì¤"
#. these are commands we can use with pkcon
-#: ../client/pk-console.c:1160
+#: ../client/pk-console.c:1159
msgid "Subcommands:"
-msgstr "íìëª
ë ¹:"
+msgstr "íì ëª
ë ¹:"
#. TRANSLATORS: we keep a database updated with the time that an action was
#. last executed
-#: ../client/pk-console.c:1240
+#: ../client/pk-console.c:1241
msgid "Failed to get the time since this action was last completed"
-msgstr "ìµê·¼ ê°±ì ë ì´ ëìì ìì ì ì»ëë° ì¤í¨íìµëë¤."
+msgstr "ë§ì§ë§ì¼ë¡ ì´ ëìì ì¤íí ìê°ì ì ì ìì"
#. TRANSLATORS: command line argument, just show the version string
-#: ../client/pk-console.c:1282 ../client/pk-monitor.c:371
+#: ../client/pk-console.c:1283 ../client/pk-monitor.c:370
msgid "Show the program version and exit"
-msgstr "íë¡ê·¸ë¨ ë²ì ì ë³´ì¬ì£¼ê³ ì¢
ë£"
+msgstr "íë¡ê·¸ë¨ ë²ì ì ë³´ì¬ ì£¼ê³ ì¢
ë£"
#. TRANSLATORS: command line argument, use a filter to narrow down results
-#: ../client/pk-console.c:1285
+#: ../client/pk-console.c:1286
msgid "Set the filter, e.g. installed"
msgstr "íí° ì¤ì , ì: ì¤ì¹ë¨"
#. TRANSLATORS: command line argument, use a non-standard install prefix
-#: ../client/pk-console.c:1288
+#: ../client/pk-console.c:1289
msgid "Set the install root, e.g. '/' or '/mnt/ltsp'"
msgstr "ì¤ì¹ ë£¨í¸ ì§ì , ì: '/' í¹ì '/mnt/ltsp'"
#. TRANSLATORS: command line argument, work asynchronously
-#: ../client/pk-console.c:1291
+#: ../client/pk-console.c:1292
msgid "Exit without waiting for actions to complete"
msgstr "ëìì´ ìë£ë ëê¹ì§ 기ë¤ë¦¬ì§ ìê³ ì¢
ë£"
#. command line argument, do we ask questions
-#: ../client/pk-console.c:1294
+#: ../client/pk-console.c:1295
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:525
msgid "Install the packages without asking for confirmation"
msgstr "íì¸ ì¬íì ë¬»ì§ ìê³ í¨í¤ì§ë¥¼ ì¤ì¹"
#. TRANSLATORS: command line argument, this command is not a priority
-#: ../client/pk-console.c:1297
+#: ../client/pk-console.c:1298
msgid "Run the command using idle network bandwidth and also using less power"
msgstr "ì í´ ë¤í¸ìí¬ ëìíê³¼ ì ì ì ìì ì¬ì©íì¬ ëª
ë ¹ ì¤í"
#. TRANSLATORS: command line argument, just output without fancy formatting
-#: ../client/pk-console.c:1300
+#: ../client/pk-console.c:1301
msgid ""
"Print to screen a machine readable output, rather than using animated "
"widgets"
-msgstr "ìì§ì´ë ìì ¯ì ì¬ì©í기보ë¤, 머ì ì´ íë
í ì ìë ì¶ë ¥ì íë©´ì ì¶ë ¥"
+msgstr "ì ëë©ì´ì
ìì ¯ ëì ì»´í¨í°ê° ì½ì ì ìë íìì¼ë¡ ì¶ë ¥"
#. TRANSLATORS: command line argument, just output without fancy formatting
-#: ../client/pk-console.c:1303
+#: ../client/pk-console.c:1304
msgid "The maximum metadata cache age. Use -1 for 'never'."
-msgstr "ë©íë°ì´í° ìºì ìµë 기ê°. -1ì ì¬ì©íë©´ 'ì¤ì íì§ ìì'."
+msgstr "ìµë ë©íë°ì´í° ìºì ìê°. -1ì ì¬ì©íë©´ 'ì¤ì íì§ ìì'."
#. TRANSLATORS: command line argument, --help
-#: ../client/pk-console.c:1306
+#: ../client/pk-console.c:1307
msgid "Show help options."
msgstr "ëìë§ ìµì
ë³´ì´ê¸°"
#. TRANSLATORS: we failed to contact the daemon
-#: ../client/pk-console.c:1336
+#: ../client/pk-console.c:1338
msgid "Failed to parse command line"
msgstr "ëª
ë ¹ ì¤ í´ìì ì¤í¨íìµëë¤"
#. TRANSLATORS: we failed to contact the daemon
-#: ../client/pk-console.c:1346
+#: ../client/pk-console.c:1348
msgid "Failed to contact PackageKit"
-msgstr "PackageKitê³¼ ì°ê²°íëë° ì¤í¨íìµëë¤."
+msgstr "PackageKitê³¼ ì°ê²°íë ë° ì¤í¨íìµëë¤."
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1399
+#: ../client/pk-console.c:1401
msgid "The proxy could not be set"
msgstr "íë¡ì를 ì¤ì í ì ììµëë¤"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1411
+#: ../client/pk-console.c:1413
msgid "The install root could not be set"
msgstr "ì¤ì¹ 루í¸ë¥¼ ì¤ì í ì ììµëë¤"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1423
+#: ../client/pk-console.c:1425
msgid "The filter specified was invalid"
msgstr "ì ìë íí°ê° ì¬ë°ë¥´ì§ ììµëë¤"
#. TRANSLATORS: a search type can be name, details, file, etc
-#: ../client/pk-console.c:1442
+#: ../client/pk-console.c:1444
msgid "A search type is required, e.g. name"
msgstr "ê²ì ì íì´ íìí©ëë¤. ì: ì´ë¦"
#. TRANSLATORS: the user needs to provide a search term
-#: ../client/pk-console.c:1449 ../client/pk-console.c:1461
-#: ../client/pk-console.c:1473 ../client/pk-console.c:1485
+#: ../client/pk-console.c:1451 ../client/pk-console.c:1463
+#: ../client/pk-console.c:1475 ../client/pk-console.c:1487
msgid "A search term is required"
msgstr "ê²ì ë¨ì´ê° íìí©ëë¤"
#. TRANSLATORS: the search type was provided, but invalid
-#: ../client/pk-console.c:1495
+#: ../client/pk-console.c:1497
msgid "Invalid search type"
msgstr "ì못ë ê²ì ì í"
#. TRANSLATORS: the user did not specify what they wanted to install
-#: ../client/pk-console.c:1501
+#: ../client/pk-console.c:1503
msgid "A package name to install is required"
msgstr "ì¤ì¹í í¨í¤ì§ ì´ë¦ì´ íìí©ëë¤"
#. TRANSLATORS: the user did not specify what they wanted to install
-#: ../client/pk-console.c:1510
+#: ../client/pk-console.c:1512
msgid "A filename to install is required"
-msgstr "ì¤ì¹í íì¼ì´ë¦ì´ íìí©ëë¤"
+msgstr "ì¤ì¹í íì¼ ì´ë¦ì´ íìí©ëë¤"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1521
+#: ../client/pk-console.c:1523
msgid "A type, key_id and package_id are required"
msgstr "ì í, key_id, package_idê° íìí©ëë¤"
#. TRANSLATORS: the user did not specify what they wanted to remove
-#: ../client/pk-console.c:1532
+#: ../client/pk-console.c:1534
msgid "A package name to remove is required"
msgstr "ì ê±°í í¨í¤ì§ ì´ë¦ì´ íìí©ëë¤"
#. TRANSLATORS: the user did not specify anything about what to download or
#. where
-#: ../client/pk-console.c:1541
+#: ../client/pk-console.c:1543
msgid "A destination directory and the package names to download are required"
-msgstr "ëì ëë í 리ì ë¤ì´ë¡ëí í¨í¤ì§ ì´ë¦ì´ íìí©ëë¤"
+msgstr "ëì ëë í°ë¦¬ì ë¤ì´ë¡ëí í¨í¤ì§ ì´ë¦ì´ íìí©ëë¤"
#. TRANSLATORS: the directory does not exist, so we can't continue
-#: ../client/pk-console.c:1548
+#: ../client/pk-console.c:1550
msgid "Directory not found"
-msgstr "ëë í 리를 ì°¾ì ì ììµëë¤"
+msgstr "ëë í°ë¦¬ë¥¼ ì°¾ì ì ììµëë¤"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1557
+#: ../client/pk-console.c:1559
msgid "A licence identifier (eula-id) is required"
-msgstr "ë¼ì´ì¼ì¤ ìë³ì(eula-id)ê° íìí©ëë¤"
+msgstr "ë¼ì´ì ì¤ ìë³ì(eula-id)ê° íìí©ëë¤"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1568
+#: ../client/pk-console.c:1570
msgid "A transaction identifier (tid) is required"
msgstr "í¸ëìì
ìë³ì (tid)ê° íìí©ëë¤"
#. TRANSLATORS: The user did not specify a package name
-#: ../client/pk-console.c:1589
+#: ../client/pk-console.c:1591
msgid "A package name to resolve is required"
msgstr "í´ìí í¨í¤ì§ ì´ë¦ì´ íìí©ëë¤"
#. TRANSLATORS: The user did not specify a repository (software source) name
-#: ../client/pk-console.c:1600 ../client/pk-console.c:1611
+#: ../client/pk-console.c:1602 ../client/pk-console.c:1613
msgid "A repository name is required"
msgstr "ì ì¥ì ì´ë¦ì´ íìí©ëë¤"
#. TRANSLATORS: The user didn't provide any data
-#: ../client/pk-console.c:1622
+#: ../client/pk-console.c:1624
msgid "A repo name, parameter and value are required"
msgstr "ì ì¥ì ì´ë¦, ì¸ì, ê°ì´ íìí©ëë¤"
#. TRANSLATORS: The user didn't specify what action to use
-#: ../client/pk-console.c:1639
+#: ../client/pk-console.c:1641
msgid "An action, e.g. 'update-system' is required"
msgstr " 'update-system' ê³¼ ê°ì ëìì´ íìí©ëë¤"
#. TRANSLATORS: The user specified an invalid action
-#: ../client/pk-console.c:1646
+#: ../client/pk-console.c:1648
msgid "A correct role is required"
msgstr "ì¬ë°ë¥¸ ê·ì¹ì´ íìí©ëë¤"
#. TRANSLATORS: The user did not provide a package name
#. TRANSLATORS: This is when the user fails to supply the package name
-#: ../client/pk-console.c:1656 ../client/pk-console.c:1670
-#: ../client/pk-console.c:1679 ../client/pk-console.c:1699
-#: ../client/pk-console.c:1708 ../client/pk-generate-pack.c:314
+#: ../client/pk-console.c:1658 ../client/pk-console.c:1672
+#: ../client/pk-console.c:1681 ../client/pk-console.c:1701
+#: ../client/pk-console.c:1710 ../client/pk-generate-pack.c:314
msgid "A package name is required"
msgstr "í¨í¤ì§ ì´ë¦ì´ íìí©ëë¤"
#. TRANSLATORS: each package "provides" certain things, e.g. mime(gstreamer-
#. decoder-mp3), the user didn't specify it
-#: ../client/pk-console.c:1688
+#: ../client/pk-console.c:1690
msgid "A package provide string is required"
msgstr "í¨í¤ì§ ì ê³µ 문ìì´ì´ íìí©ëë¤"
#. TRANSLATORS: The user did not provide a distro name
-#: ../client/pk-console.c:1732
+#: ../client/pk-console.c:1734
msgid "A distribution name is required"
msgstr "ë°°í¬í ì´ë¦ì´ íìí©ëë¤"
#. TRANSLATORS: The user did not provide an upgrade type
-#: ../client/pk-console.c:1738
+#: ../client/pk-console.c:1740
msgid "An upgrade type is required, e.g. 'minimal', 'default' or 'complete'"
msgstr "ì
ê·¸ë ì´ë ì íì´ íìí©ëë¤. ì: 'ìµì', '기본' í¹ì 'ì ì²´'"
#. TRANSLATORS: The user tried to use an unsupported option on the command
#. line
-#: ../client/pk-console.c:1788
+#: ../client/pk-console.c:1795
#, c-format
msgid "Option '%s' is not supported"
msgstr "ìµì
'%s'ì´(ê°) ì§ìëì§ ììµëë¤"
#. TRANSLATORS: Generic failure of what they asked to do
-#: ../client/pk-console.c:1798
+#: ../client/pk-console.c:1805
msgid "Command failed"
msgstr "ëª
ë ¹ì ì¤í¨íìµëë¤"
#. TRANSLATORS: we can exclude certain packages (glibc) when we know they'll
#. exist on the target
-#: ../client/pk-generate-pack.c:253
+#: ../client/pk-generate-pack.c:252
msgid "Set the file name of dependencies to be excluded"
-msgstr "ìì¡´ì ì¸ íì¼ ì´ë¦ ì¤ì ì´ ì ì¸ë©ëë¤"
+msgstr "ì ì¸í ìì¡´ì±ì´ ìë íì¼ ì´ë¦ì ì¤ì í©ëë¤"
#. TRANSLATORS: the output location
-#: ../client/pk-generate-pack.c:256
+#: ../client/pk-generate-pack.c:255
msgid ""
"The output file or directory (the current directory is used if omitted)"
-msgstr "ì¶ë ¥ íì¼ í¹ì ëë í 리 (ìëµëë©´ íì¬ ëë í ë¦¬ê° ì¬ì©ë©ëë¤)"
+msgstr "ì¶ë ¥ íì¼ í¹ì ëë í°ë¦¬ (ìëµíë©´ íì¬ ëë í°ë¦¬ ì¬ì©)"
#. TRANSLATORS: put a list of packages in the pack
-#: ../client/pk-generate-pack.c:259
+#: ../client/pk-generate-pack.c:258
msgid "The package to be put into the service pack"
msgstr "í¨í¤ì§ê° ìë¹ì¤ í©ì ëììµëë¤"
#. TRANSLATORS: put all pending updates in the pack
-#: ../client/pk-generate-pack.c:262
+#: ../client/pk-generate-pack.c:261
msgid "Put all updates available in the service pack"
msgstr "ì¬ì© ê°ë¥í ê°±ì ì´ ìë¹ì¤ í©ì ëììµëë¤"
@@ -616,7 +617,7 @@ msgstr "ë ìµì
ì´ ëª¨ë ì íëììµëë¤."
#. TRANSLATORS: This is when the user fails to supply the output
#: ../client/pk-generate-pack.c:322
msgid "A output directory or file name is required"
-msgstr "ì¶ë ¥ ëë í 리 í¹ì íì¼ ì´ë¦ì´ íìí©ëë¤"
+msgstr "ì¶ë ¥ ëë í°ë¦¬ í¹ì íì¼ ì´ë¦ì´ íìí©ëë¤"
#. TRANSLATORS: This is when the daemon is not-installed/broken and fails to
#. startup
@@ -638,7 +639,7 @@ msgstr "í¨í¤ì§ ê´ë¦¬ìê° ì´ë¬í ì íì ì²ë¦¬ë¥¼ ìíí ì ì
msgid ""
"Service packs cannot be created as PackageKit was not built with libarchive "
"support."
-msgstr "libarchive를 ì§ìíì§ ìëë¡ ë¹ëë PackageKit ì´ë¯ë¡ ìë¹ì¤ í©ì ìì±í ì ììµëë¤"
+msgstr "PackageKitì´ libarchive ì§ìì í¬í¨íì§ ìê³ ë¹ëëì기 ë문ì ìë¹ì¤ í©ì ìì±í ì ììµëë¤."
#. TRANSLATORS: the user specified an absolute path, but didn't get the
#. extension correct
@@ -654,19 +655,19 @@ msgstr "ëì¼í ì´ë¦ì ê°ì§ í©ì´ ì¡´ì¬í©ëë¤. ë®ì´ ì°ìê² ìµ
#. TRANSLATORS: This is when the pack was not overwritten
#: ../client/pk-generate-pack.c:394
msgid "The pack was not overwritten."
-msgstr "í©ì´ ë®ì´ì°ê¸° ë ì ìììµëë¤."
+msgstr "í©ì ë®ì´ì¸ ì ììµëë¤."
#. TRANSLATORS: This is when the temporary directory cannot be created, the
#. directory name follows
#: ../client/pk-generate-pack.c:407
msgid "Failed to create directory:"
-msgstr "ëë í 리 ìì±ì ì¤í¨íìµëë¤:"
+msgstr "ëë í°ë¦¬ë¥¼ ë§ë¤ ì ììµëë¤:"
#. TRANSLATORS: This is when the list of packages from the remote computer
#. cannot be opened
#: ../client/pk-generate-pack.c:419
msgid "Failed to open package list."
-msgstr "í¨í¤ì§ 목ë¡ì ì¬ëë° ì¤í¨íìµëë¤."
+msgstr "í¨í¤ì§ 목ë¡ì ì¬ë ë° ì¤í¨íìµëë¤."
#. TRANSLATORS: The package name is being matched up to available packages
#: ../client/pk-generate-pack.c:428
@@ -678,13 +679,13 @@ msgstr "í¨í¤ì§ ì´ë¦ì 찾기."
#: ../client/pk-generate-pack.c:432
#, c-format
msgid "Failed to find package '%s': %s"
-msgstr "í¨í¤ì§ '%s'를 ì°¾ëë° ì¤í¨íìµëë¤: %s"
+msgstr "í¨í¤ì§ '%s'ì(를) ì°¾ë ë° ì¤í¨íìµëë¤: %s"
#. TRANSLATORS: This is telling the user we are in the process of making the
#. pack
#: ../client/pk-generate-pack.c:440
msgid "Creating service pack..."
-msgstr "ìë¹ì¤ í© ìì±ì¤..."
+msgstr "ìë¹ì¤ í© ìì± ì¤..."
#. TRANSLATORS: we succeeded in making the file
#: ../client/pk-generate-pack.c:455
@@ -696,15 +697,15 @@ msgstr "ìë¹ì¤ í©ì´ '%s'ì(를) ìì±íìµëë¤"
#: ../client/pk-generate-pack.c:460
#, c-format
msgid "Failed to create '%s': %s"
-msgstr "'%s'ì(를) ìì±íëë° ì¤í¨íìµëë¤: %s"
+msgstr "'%s'ì(를) ìì±íë ë° ì¤í¨íìµëë¤: %s"
-#: ../client/pk-monitor.c:284
+#: ../client/pk-monitor.c:283
msgid "Failed to get daemon state"
-msgstr "ë°ëª¬ ìí를 ê°ì ¸ì¤ëë° ì¤í¨íìµëë¤"
+msgstr "ë°ëª¬ ìí를 ê°ì ¸ì¤ë ë° ì¤í¨íìµëë¤"
-#: ../client/pk-monitor.c:349
+#: ../client/pk-monitor.c:348
msgid "Failed to get properties"
-msgstr "íë¡í¼í°ë¥¼ ê°ì ¸ì¤ëë° ì¤í¨íìµëë¤"
+msgstr "ìì±ì ê°ì ¸ì¤ë ë° ì¤í¨íìµëë¤"
#. TRANSLATORS: this is a program that monitors PackageKit
#: ../client/pk-monitor.c:387
@@ -714,7 +715,7 @@ msgstr "PackageKit ê°ìì"
#. TRANSLATORS: when we are getting data from the daemon
#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
-msgstr "í¨í¤ì§ ì ë³´ ê°ì ¸ì¤ëì¤..."
+msgstr "í¨í¤ì§ ì ë³´ ê°ì ¸ì¤ë ì¤..."
#. TRANSLATORS: run an applicaiton
#: ../contrib/browser-plugin/pk-plugin-install.c:509
@@ -742,13 +743,13 @@ msgstr "ì§ê¸ ì¤í"
#: ../contrib/browser-plugin/pk-plugin-install.c:535
#, c-format
msgid "Update to version %s"
-msgstr "ë²ì %së¡ ê°±ì "
+msgstr "ë²ì %s(ì¼)ë¡ ì
ë°ì´í¸"
#. TRANSLATORS: To install a package
#: ../contrib/browser-plugin/pk-plugin-install.c:541
#, c-format
msgid "Install %s now"
-msgstr "%s "
+msgstr "ì§ê¸ %s ì¤ì¹"
#. TRANSLATORS: the version of the package
#: ../contrib/browser-plugin/pk-plugin-install.c:544
@@ -768,22 +769,22 @@ msgstr "ì¤ì¹ ì¤..."
#. TRANSLATORS: downloading repo data so we can search
#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
-msgstr "ìíí¸ì¨ì´ ì본ì ëí ì¸ë¶ë´ì© ë¤ì´ë¡ëì¤."
+msgstr "ìíí¸ì¨ì´ ì본ì ìì¸í ì ë³´ ë¤ì´ë¡ë ì¤."
#. TRANSLATORS: downloading file lists so we can search
#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
-msgstr "íì¼ ëª©ë¡ ë¤ì´ë¡ëì¤ (ìë£ëë ¤ë©´ ìê°ì´ ì¢ ê±¸ë¦½ëë¤)"
+msgstr "íì¼ ëª©ë¡ ë¤ì´ë¡ë ì¤ (ìë£ëë ¤ë©´ ìê°ì´ ì¢ ê±¸ë¦½ëë¤)"
#. TRANSLATORS: waiting for native lock
#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
-msgstr "í¨í¤ì§ ê´ë¦¬ì ì ê¸ í´ì ë기ì¤."
+msgstr "í¨í¤ì§ ê´ë¦¬ì ì ê¸ í´ì ë기 ì¤."
#. TRANSLATORS: loading package cache so we can search
#: ../contrib/command-not-found/pk-command-not-found.c:375
msgid "Loading list of packages."
-msgstr "í¨í¤ì§ ëª©ë¡ ì£ëì¤."
+msgstr "í¨í¤ì§ ëª©ë¡ ë¶ë¬ì¤ë ì¤."
#. TRANSLATORS: we failed to find the package, this shouldn't happen
#: ../contrib/command-not-found/pk-command-not-found.c:439
@@ -793,7 +794,7 @@ msgstr "íì¼ ê²ìì ì¤í¨íìµëë¤"
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
-msgstr "ì¤í¨í íì¼ ëª©ë¡ ê°ì ¸ì¤ëì¤"
+msgstr "ì¤í¨í íì¼ ëª©ë¡ ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: we failed to launch the executable, the error follows
#: ../contrib/command-not-found/pk-command-not-found.c:597
@@ -808,58 +809,58 @@ msgstr "í¨í¤ì§ ì¤ì¹ì ì¤í¨íìµëë¤"
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:723
+#: ../contrib/command-not-found/pk-command-not-found.c:725
msgid "command not found"
msgstr "ëª
ë ¹ì ì°¾ì ì ììµëë¤"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:743
msgid "Similar command is:"
msgstr "ì ì¬í ëª
ë ¹:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:755
+#: ../contrib/command-not-found/pk-command-not-found.c:757
msgid "Run similar command:"
msgstr "ì ì¬í ëª
ë ¹ ì¤í:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:769
-#: ../contrib/command-not-found/pk-command-not-found.c:778
+#: ../contrib/command-not-found/pk-command-not-found.c:771
+#: ../contrib/command-not-found/pk-command-not-found.c:780
msgid "Similar commands are:"
-msgstr "ì ì¬í ëª
ë ¹ë¤:"
+msgstr "ì ì¬í ëª
ë ¹:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:785
+#: ../contrib/command-not-found/pk-command-not-found.c:787
msgid "Please choose a command to run"
-msgstr "ì¤íí ëª
ë ¹ì ì ííì¬ ì£¼ì기 ë°ëëë¤"
+msgstr "ì¤íí ëª
ë ¹ì ì ííììì¤"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:805
msgid "The package providing this file is:"
msgstr "ì´ íì¼ì ì ê³µíë í¨í¤ì§:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:810
+#: ../contrib/command-not-found/pk-command-not-found.c:812
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "í¨í¤ì§ '%s'ì(를) ëª
ë ¹ '%s'ì(를) ì ê³µí기 ìí´ ì¤ì¹í©ëê¹?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:837
+#: ../contrib/command-not-found/pk-command-not-found.c:839
msgid "Packages providing this file are:"
msgstr "ì´ íì¼ë¤ì´ ì ê³µëë í¨í¤ì§ë¤:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:847
+#: ../contrib/command-not-found/pk-command-not-found.c:849
msgid "Suitable packages are:"
msgstr "ìë§ì í¨í¤ì§ë¤:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:856
+#: ../contrib/command-not-found/pk-command-not-found.c:858
msgid "Please choose a package to install"
msgstr "ì¤ì¹í기 ìí í¨í¤ì§ë¥¼ ì ííì¬ ì£¼ì기 ë°ëëë¤"
@@ -893,172 +894,172 @@ msgid "Do not display information or progress"
msgstr "ì ë³´ë ì§íê³¼ì ì íìíì§ ììµëë¤"
#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:540
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:542
msgid "PackageKit Debuginfo Installer"
msgstr "PackageKit Debuginfo ì¤ì¹ì"
#. TRANSLATORS: the use needs to specify a list of package names on the
#. command line
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:554
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:556
#, c-format
msgid "ERROR: Specify package names to install."
msgstr "ì¤ë¥: ì¤ì¹í í¨í¤ì§ ì´ë¦ì ì§ì íì¬ ì£¼ììì¤"
#. TRANSLATORS: we are getting the list of repositories
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:590
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:592
#, c-format
msgid "Getting sources list"
msgstr "ì본 ëª©ë¡ ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: operation was not successful
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:600
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:675
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:759
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:803
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:870
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:914
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:602
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:677
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:761
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:805
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:872
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:916
msgid "FAILED."
msgstr "ì¤í¨."
#. TRANSLATORS: all completed 100%
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:615
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:655
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:690
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:774
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:818
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:885
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:929
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:617
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:657
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:692
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:776
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:820
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:887
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:931
#, c-format
msgid "OK."
msgstr "ìë£."
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:618
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:620
#, c-format
msgid "Found %i enabled and %i disabled sources."
msgstr "%i ê°ì íì±í ë, %i ê°ì ë¹íì±íë ì본ì ì°¾ììµëë¤."
#. TRANSLATORS: we're finding repositories that match out pattern
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:625
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:627
#, c-format
msgid "Finding debugging sources"
msgstr "ëë²ê¹
ì본 ì°¾ë ì¤"
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:658
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:660
#, c-format
msgid "Found %i disabled debuginfo repos."
msgstr "%i ê°ì ë¹íì±íë ëë²ê·¸ ì ë³´ ì ì¥ì를 ì°¾ììµëë¤."
#. TRANSLATORS: we're now enabling all the debug sources we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:665
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:667
#, c-format
msgid "Enabling debugging sources"
msgstr "ëë²ê¹
ì본 íì±í ì¤"
#. TRANSLATORS: tell the user how many we enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:693
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:695
#, c-format
msgid "Enabled %i debugging sources."
msgstr "%i ê°ì ëë²ê¹
ìë³¸ì´ íì±í ëììµëë¤."
#. TRANSLATORS: we're now finding packages that match in all the repos
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:700
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:702
#, c-format
msgid "Finding debugging packages"
msgstr "ëë²ê¹
í¨í¤ì§ ì°¾ë ì¤"
#. TRANSLATORS: we couldn't find the package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:712
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:714
#, c-format
msgid "Failed to find the package %s: %s"
msgstr "í¨í¤ì§ %sì(를)ì°¾ëë° ì¤í¨íìµëë¤: %s"
#. TRANSLATORS: we couldn't find the debuginfo package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:735
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:737
#, c-format
msgid "Failed to find the debuginfo package %s: %s"
msgstr "ëë²ê·¸ ì ë³´ í¨í¤ì§ %sì(를) ì°¾ëë° ì¤í¨íìµëë¤: %s"
#. TRANSLATORS: no debuginfo packages could be found to be installed
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:763
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:765
#, c-format
msgid "Found no packages to install."
msgstr "ì¤ì¹í í¨í¤ì§ê° ì무ê²ë ììµëë¤."
#. TRANSLATORS: tell the user we found some packages, and then list them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:777
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:779
#, c-format
msgid "Found %i packages:"
msgstr "%iê°ì í¨í¤ì§ë¥¼ ì°¾ììµëë¤:"
#. TRANSLATORS: tell the user we are searching for deps
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:793
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:795
#, c-format
msgid "Finding packages that depend on these packages"
msgstr "ì´ í¨í¤ì§ì ìì¡´íë í¨í¤ì§ ì°¾ëì¤"
#. TRANSLATORS: could not install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:806
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:808
#, c-format
-msgid "Could not find dependant packages: %s"
-msgstr "ìì¡´ì± í¨í¤ì§ë¥¼ ì°¾ì ì ììµëë¤: %s"
+msgid "Could not find dependent packages: %s"
+msgstr "ìì¡´íë í¨í¤ì§ë¥¼ ì°¾ì ì ìì: %s"
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:822
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:824
#, c-format
msgid "Found %i extra packages."
msgstr "%iê°ì ì¶ê° í¨í¤ì§ë¥¼ ì°¾ììµëë¤."
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:826
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:828
#, c-format
msgid "No extra packages required."
msgstr "ì¶ê° í¨í¤ì§ê° íìíì§ ììµëë¤."
#. TRANSLATORS: tell the user we found some packages (and deps), and then list
#. them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:835
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:837
#, c-format
msgid "Found %i packages to install:"
msgstr "ì¤ì¹í %i ê°ì í¨í¤ì§ë¥¼ ì°¾ììµëë¤:"
#. TRANSLATORS: simulate mode is a testing mode where we quit before the
#. action
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:848
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:850
#, c-format
msgid "Not installing packages in simulate mode"
msgstr "ìì° ëª¨ëìì ì¤ì¹íë í¨í¤ì§ê° ììµëë¤"
#. TRANSLATORS: we are now installing the debuginfo packages we found earlier
#. TRANSLATORS: transaction state, installing packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:860
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:862
#: ../lib/packagekit-glib2/pk-console-shared.c:331
#, c-format
msgid "Installing packages"
msgstr "í¨í¤ì§ ì¤ì¹ ì¤"
#. TRANSLATORS: could not install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:873
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:875
#, c-format
msgid "Could not install packages: %s"
msgstr "í¨í¤ì§ë¥¼ ì¤ì¹í ì ììµëë¤: %s"
#. TRANSLATORS: we are now disabling all debuginfo repos we previously enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:905
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:907
#, c-format
msgid "Disabling sources previously enabled"
msgstr "ì´ì ì íì±íë ì본 ë¹íì±í ì¤"
#. TRANSLATORS: no debuginfo packages could be found to be installed, detailed
#. error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:917
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:919
#, c-format
msgid "Could not disable the debugging sources: %s"
msgstr "ëë²ê¹
ì본ì ë¹íì±í í ì ììµëë¤: %s"
#. TRANSLATORS: we disabled all the debugging repos that we enabled before
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:932
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:934
#, c-format
msgid "Disabled %i debugging sources."
msgstr "%i ê°ì ëë²ê¹
ì본ì ë¹íì±í íììµëë¤."
@@ -1222,7 +1223,7 @@ msgstr "í¨í¤ì§ ì ê±° ì¤"
#. TRANSLATORS: transaction state, downloading package files
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:327
-#: ../lib/packagekit-glib2/pk-console-shared.c:705
+#: ../lib/packagekit-glib2/pk-enum.c:1288
msgid "Downloading packages"
msgstr "í¨í¤ì§ ë¤ì´ë¡ë ì¤"
@@ -1261,7 +1262,7 @@ msgstr "ìëª
íì¸ ì¤"
#. TRANSLATORS: transaction state, when we return to a previous system state
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:359
-#: ../lib/packagekit-glib2/pk-console-shared.c:665
+#: ../lib/packagekit-glib2/pk-enum.c:1248
msgid "Rolling back"
msgstr "ëë리ë ì¤"
@@ -1376,281 +1377,281 @@ msgstr "ì¬ì© ì¤ì¸ ë¼ì´ë¸ë¬ë¦¬ ì ê² ì¤"
msgid "Copying files"
msgstr "íì¼ ë³µì¬ ì¤"
+#. TRANSLATORS: turn on all debugging
+#: ../lib/packagekit-glib2/pk-debug.c:133
+msgid "Show debugging information for all files"
+msgstr "모ë íì¼ì ëí ëë²ê¹
ì ë³´ ë³´ì´ê¸°"
+
+#: ../lib/packagekit-glib2/pk-debug.c:201
+msgid "Debugging Options"
+msgstr "ëë²ê¹
ìµì
"
+
+#: ../lib/packagekit-glib2/pk-debug.c:201
+msgid "Show debugging options"
+msgstr "ëë²ê¹
ìµì
ë³´ì´ê¸°"
+
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:461
+#: ../lib/packagekit-glib2/pk-enum.c:1023
msgid "Trivial"
msgstr "íì"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:465
+#: ../lib/packagekit-glib2/pk-enum.c:1027
msgid "Normal"
msgstr "ì¼ë°"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:469
+#: ../lib/packagekit-glib2/pk-enum.c:1031
msgid "Important"
msgstr "ì¤ì"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:473
+#: ../lib/packagekit-glib2/pk-enum.c:1035
msgid "Security"
msgstr "ë³´ì"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:477
+#: ../lib/packagekit-glib2/pk-enum.c:1039
msgid "Bug fix "
msgstr "ë²ê·¸ ìì "
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:481
+#: ../lib/packagekit-glib2/pk-enum.c:1043
msgid "Enhancement"
msgstr "í¥ì"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:485
+#: ../lib/packagekit-glib2/pk-enum.c:1047
msgid "Blocked"
msgstr "ì°¨ë¨ë¨"
#. TRANSLATORS: The state of a package
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:490
-#: ../lib/packagekit-glib2/pk-console-shared.c:563
+#: ../lib/packagekit-glib2/pk-enum.c:1052
+#: ../lib/packagekit-glib2/pk-enum.c:1139
msgid "Installed"
msgstr "ì¤ì¹ë¨"
#. TRANSLATORS: The state of a package, i.e. not installed
-#: ../lib/packagekit-glib2/pk-console-shared.c:495
+#: ../lib/packagekit-glib2/pk-enum.c:1057
msgid "Available"
msgstr "ì¬ì©ê°ë¥"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:513
+#: ../lib/packagekit-glib2/pk-enum.c:1082
msgid "Downloading"
msgstr "ë¤ì´ë¡ë ì¤"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:517
+#: ../lib/packagekit-glib2/pk-enum.c:1086
msgid "Updating"
msgstr "ê°±ì ì¤"
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:521
-#: ../lib/packagekit-glib2/pk-console-shared.c:641
+#: ../lib/packagekit-glib2/pk-enum.c:1090
+#: ../lib/packagekit-glib2/pk-enum.c:1224
msgid "Installing"
msgstr "ì¤ì¹ ì¤"
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:525
-#: ../lib/packagekit-glib2/pk-console-shared.c:637
+#: ../lib/packagekit-glib2/pk-enum.c:1094
+#: ../lib/packagekit-glib2/pk-enum.c:1220
msgid "Removing"
msgstr "ì ê±° ì¤"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:529
+#: ../lib/packagekit-glib2/pk-enum.c:1098
msgid "Cleaning up"
msgstr "ì²ì ì¤"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:533
+#: ../lib/packagekit-glib2/pk-enum.c:1102
msgid "Obsoleting"
msgstr "무í¨í ì¤"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:537
+#: ../lib/packagekit-glib2/pk-enum.c:1106
msgid "Reinstalling"
msgstr "ì¬ì¤ì¹ ì¤"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:555
+#: ../lib/packagekit-glib2/pk-enum.c:1131
msgid "Downloaded"
msgstr "ë¤ì´ë¡ë ë¨"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:567
+#: ../lib/packagekit-glib2/pk-enum.c:1143
msgid "Removed"
msgstr "ì ê±° ë¨"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:571
+#: ../lib/packagekit-glib2/pk-enum.c:1147
msgid "Cleaned up"
msgstr "ì²ì ë¨"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:575
+#: ../lib/packagekit-glib2/pk-enum.c:1151
msgid "Obsoleted"
msgstr "무í¨í ë¨"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:579
+#: ../lib/packagekit-glib2/pk-enum.c:1155
msgid "Reinstalled"
msgstr "ì¬ì¤ì¹ ë¨"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:597
+#: ../lib/packagekit-glib2/pk-enum.c:1180
msgid "Unknown role type"
msgstr "ì ì ìë ê·ì¹ ì í"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:601
+#: ../lib/packagekit-glib2/pk-enum.c:1184
msgid "Getting dependencies"
msgstr "ìì¡´ì± ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:605
+#: ../lib/packagekit-glib2/pk-enum.c:1188
msgid "Getting update details"
msgstr "ê°±ì ì¸ë¶ì¬í ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:609
+#: ../lib/packagekit-glib2/pk-enum.c:1192
msgid "Getting details"
msgstr "ì¸ë¶ì¬í ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:613
+#: ../lib/packagekit-glib2/pk-enum.c:1196
msgid "Getting requires"
msgstr "íììì ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:617
+#: ../lib/packagekit-glib2/pk-enum.c:1200
msgid "Getting updates"
msgstr "ê°±ì ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:621
+#: ../lib/packagekit-glib2/pk-enum.c:1204
msgid "Searching by details"
msgstr "ì¸ë¶ ì¬í ê²ì ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:625
+#: ../lib/packagekit-glib2/pk-enum.c:1208
msgid "Searching by file"
msgstr "íì¼ ê²ì ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:629
+#: ../lib/packagekit-glib2/pk-enum.c:1212
msgid "Searching groups"
msgstr "그룹 ê²ì ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:633
+#: ../lib/packagekit-glib2/pk-enum.c:1216
msgid "Searching by name"
msgstr "ì´ë¦ ê²ì ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:645
+#: ../lib/packagekit-glib2/pk-enum.c:1228
msgid "Installing files"
msgstr "íì¼ ì¤ì¹ ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:649
+#: ../lib/packagekit-glib2/pk-enum.c:1232
msgid "Refreshing cache"
msgstr "ìºì ìë¡ ê³ ì¹ë "
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:653
+#: ../lib/packagekit-glib2/pk-enum.c:1236
msgid "Updating packages"
msgstr "í¨í¤ì§ "
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:657
+#: ../lib/packagekit-glib2/pk-enum.c:1240
msgid "Updating system"
msgstr "ìì¤í
ê°±ì "
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:661
+#: ../lib/packagekit-glib2/pk-enum.c:1244
msgid "Canceling"
msgstr "ì·¨ì "
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:669
+#: ../lib/packagekit-glib2/pk-enum.c:1252
msgid "Getting repositories"
msgstr "ì ì¥ì ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:673
+#: ../lib/packagekit-glib2/pk-enum.c:1256
msgid "Enabling repository"
msgstr "ì ì¥ì íì±í ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:677
+#: ../lib/packagekit-glib2/pk-enum.c:1260
msgid "Setting data"
msgstr "ë°ì´í° "
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:681
+#: ../lib/packagekit-glib2/pk-enum.c:1264
msgid "Resolving"
msgstr "ë¶ì ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:685
+#: ../lib/packagekit-glib2/pk-enum.c:1268
msgid "Getting file list"
msgstr "íì¼ ëª©ë¡ ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:689
+#: ../lib/packagekit-glib2/pk-enum.c:1272
msgid "Getting provides"
msgstr "ì ê³µì ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:693
+#: ../lib/packagekit-glib2/pk-enum.c:1276
msgid "Installing signature"
msgstr "ìëª
ì¤ì¹ ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:697
+#: ../lib/packagekit-glib2/pk-enum.c:1280
msgid "Getting packages"
msgstr "í¨í¤ì§ ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:701
+#: ../lib/packagekit-glib2/pk-enum.c:1284
msgid "Accepting EULA"
msgstr "EULA ìë½ ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:709
+#: ../lib/packagekit-glib2/pk-enum.c:1292
msgid "Getting upgrades"
msgstr "ê°±ì ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:713
+#: ../lib/packagekit-glib2/pk-enum.c:1296
msgid "Getting categories"
msgstr "ëª©ë¡ ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:717
+#: ../lib/packagekit-glib2/pk-enum.c:1300
msgid "Getting transactions"
msgstr "í¸ëìì
ê°ì ¸ì¤ë ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:721
-#: ../lib/packagekit-glib2/pk-console-shared.c:725
+#: ../lib/packagekit-glib2/pk-enum.c:1304
+#: ../lib/packagekit-glib2/pk-enum.c:1308
msgid "Simulating install"
msgstr "ì¤ì¹ ìì° ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:729
+#: ../lib/packagekit-glib2/pk-enum.c:1312
msgid "Simulating remove"
msgstr "ì ê±° ìì° ì¤"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:733
+#: ../lib/packagekit-glib2/pk-enum.c:1316
msgid "Simulating update"
msgstr "ê°±ì ìì° ì¤"
-#. TRANSLATORS: turn on all debugging
-#: ../lib/packagekit-glib2/pk-debug.c:133
-msgid "Show debugging information for all files"
-msgstr "모ë íì¼ì ëí ëë²ê¹
ì ë³´ ë³´ì´ê¸°"
-
-#: ../lib/packagekit-glib2/pk-debug.c:201
-msgid "Debugging Options"
-msgstr "ëë²ê¹
ìµì
"
-
-#: ../lib/packagekit-glib2/pk-debug.c:201
-msgid "Show debugging options"
-msgstr "ëë²ê¹
ìµì
ë³´ì´ê¸°"
-
#. TRANSLATORS: ask the user if they are comfortable installing insecure
#. packages
#: ../lib/packagekit-glib2/pk-task-text.c:67
@@ -1788,7 +1789,7 @@ msgstr "ë¤ì í¨í¤ì§ê° ë¤ì´ê·¸ë ì´ëëì´ì¼ í©ëë¤:"
#. encountered
#: ../lib/packagekit-glib2/pk-task-text.c:325
msgid "The following packages are untrusted:"
-msgstr ""
+msgstr "ë¤ì í¨í¤ì§ë¥¼ ì 뢰í ì ììµëë¤:"
#. TRANSLATORS: ask the user if the proposed changes are okay
#: ../lib/packagekit-glib2/pk-task-text.c:385
@@ -1801,105 +1802,18 @@ msgid "The transaction did not proceed."
msgstr "í¸ëìì
ì´ ìíëì§ ìììµëë¤."
#. SECURITY:
-#. - Normal users do not require admin authentication to accept new
-#. licence agreements.
-#. - Change this to 'auth_admin' for environments where users should not
-#. be given the option to make legal decisions.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:7
-msgid "Accept EULA"
-msgstr "EULA ìë½"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:8
-msgid "Authentication is required to accept a EULA"
-msgstr "EULA를 ìë½í기 ìí´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:9
-msgid ""
-"Authentication is required to cancel a task that was not started by yourself"
-msgstr "ì§ì ììíì§ ìì ìì
ì ì·¨ìíë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤."
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:10
-msgid "Authentication is required to change software source parameters"
-msgstr "ìíí¸ì¨ì´ ì본 ì¸ì를 ë³ê²½íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:11
-msgid ""
-"Authentication is required to change the location used to decompress "
-"packages"
-msgstr "í¨í¤ì§ì ìì¶ì í´ì í ê²½ë¡ë¥¼ ë³ê²½íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:12
-msgid ""
-"Authentication is required to consider a key used for signing packages as "
-"trusted"
-msgstr "ì 뢰í ì ìë í¨í¤ì§ ìëª
ì ì¬ì©ë í¤ë¥¼ ê³ ë ¤ëìì ë£ì¼ë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:13
-msgid "Authentication is required to install a signed package"
-msgstr "ìëª
ë í¨í¤ì§ë¥¼ ì¤ì¹íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:14
-msgid "Authentication is required to install an untrusted package"
-msgstr "ì 뢰í ì ìë í¨í¤ì§ë¥¼ ì¤ì¹íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:15
-msgid "Authentication is required to refresh the system sources"
-msgstr "ìì¤í
ì본ì ìë¡ ê³ ì¹ë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:16
-msgid "Authentication is required to reload the device with a new driver"
-msgstr "ìë¡ì´ ëë¼ì´ë²ë¡ ì¥ì¹ë¥¼ ë¤ì ë¡ëíë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:17
-msgid "Authentication is required to remove packages"
-msgstr "í¨í¤ì§ë¥¼ ì ê±°íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:18
-msgid "Authentication is required to rollback a transaction"
-msgstr "í¸ëìì
ì ëëë¦¬ë ¤ë©´ ì¸ì¦ì´ "
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:19
-msgid ""
-"Authentication is required to set the network proxy used for downloading "
-"packages"
-msgstr "ë¤ì´ë¡ë ì¤ì¸ í¨í¤ì§ì ìí´ ì¬ì©ë ë¤í¸ìí¬ íë¡ì를 ì¤ì íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:20
-msgid "Authentication is required to update packages"
-msgstr "í¨í¤ì§ë¥¼ ê°±ì íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:21
-msgid "Authentication is required to upgrade the operating system"
-msgstr "ì´ìì²´ì 를 ì
ê·¸ë ì´ë íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
-
-#. SECURITY:
#. - Normal users are allowed to cancel their own task without
#. authentication, but a different user id needs the admin password
#. to cancel another users task.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:27
+#: ../policy/org.freedesktop.packagekit.policy.in.h:6
msgid "Cancel foreign task"
msgstr "ì¸ë¶ ìì
ì·¨ì"
-#. SECURITY:
-#. - This is used when users want to install to a different prefix, for
-#. instance to a LTSP image or a virtual machine.
-#. - This could be used to overwrite files not owned by the user using
-#. a carefully created package file.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:34
-msgid "Change location that packages are installed"
-msgstr "ì¤ì¹ë í¨í¤ì§ì ìì¹ ë³ê²½"
-
-#. SECURITY:
-#. - Normal users require admin authentication to enable or disable
-#. software sources as this can be used to enable new updates or
-#. install different versions of software.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:40
-msgid "Change software source parameters"
-msgstr "ìíí¸ì¨ì´ ì본 ì¸ì ë³ê²½"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:7
+msgid ""
+"Authentication is required to cancel a task that was not started by yourself"
+msgstr "ì§ì ììíì§ ìì ìì
ì ì·¨ìíë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤."
#. SECURITY:
#. - Normal users do not need authentication to install signed packages
@@ -1907,38 +1821,57 @@ msgstr "ìíí¸ì¨ì´ ì본 ì¸ì ë³ê²½"
#. - Paranoid users (or parents!) can change this to 'auth_admin' or
#. 'auth_admin_keep'.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:47
+#: ../policy/org.freedesktop.packagekit.policy.in.h:14
msgid "Install signed package"
msgstr "ìëª
ë í¨í¤ì§ ì¤ì¹"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:15
+msgid "Authentication is required to install a signed package"
+msgstr "ìëª
ë í¨í¤ì§ë¥¼ ì¤ì¹íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
+
#. SECURITY:
#. - Normal users require admin authentication to install untrusted or
#. unrecognised packages, as allowing users to do this without a
#. password would be a massive security hole.
#. - This is not retained as each package should be authenticated.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:54
+#: ../policy/org.freedesktop.packagekit.policy.in.h:22
msgid "Install untrusted local file"
msgstr "ì 뢰í ì ìë ë¡ì»¬ íì¼ ì¤ì¹"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:23
+msgid "Authentication is required to install an untrusted package"
+msgstr "ì 뢰í ì ìë í¨í¤ì§ë¥¼ ì¤ì¹íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
+
#. SECURITY:
-#. - Normal users do not require admin authentication to refresh the
-#. cache, as this doesn't actually install or remove software.
+#. - Normal users require admin authentication to add signing keys.
+#. - This implies adding an explicit trust, and should not be granted
+#. without a secure authentication.
+#. - This is not kept as each package should be authenticated.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:59
-msgid "Refresh system sources"
-msgstr "ìì¤í
ì본 ìë¡ ê³ ì¹¨"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:30
+msgid "Trust a key used for signing packages"
+msgstr "í¨í¤ì§ ìëª
ì ìí´ ì¬ì©ëë í¤ ì 뢰"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:31
+msgid ""
+"Authentication is required to consider a key used for signing packages as "
+"trusted"
+msgstr "ì 뢰í ì ìë í¨í¤ì§ ìëª
ì ì¬ì©ë í¤ë¥¼ ê³ ë ¤ëìì ë£ì¼ë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
#. SECURITY:
-#. - Normal users require admin authentication to rebind a driver
-#. so that it works after we install firmware.
-#. - This should not be set to 'yes' as unprivileged users could then
-#. try to rebind drivers in use, for instance security authentication
-#. devices.
+#. - Normal users do not require admin authentication to accept new
+#. licence agreements.
+#. - Change this to 'auth_admin' for environments where users should not
+#. be given the option to make legal decisions.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:67
-msgid "Reload a device"
-msgstr "ì¥ì¹ ë¤ì ë¡ë"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:38
+msgid "Accept EULA"
+msgstr "EULA ìë½"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:39
+msgid "Authentication is required to accept a EULA"
+msgstr "EULA를 ìë½í기 ìí´ ì¸ì¦ì´ íìí©ëë¤"
#. SECURITY:
#. - Normal users require admin authentication to remove packages as
@@ -1949,57 +1882,138 @@ msgstr "ì¥ì¹ ë¤ì ë¡ë"
#. be removed. If this is not possible, change this authentication to
#. 'auth_admin'.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:77
+#: ../policy/org.freedesktop.packagekit.policy.in.h:49
msgid "Remove package"
msgstr "í¨í¤ì§ ì ê±°"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:50
+msgid "Authentication is required to remove packages"
+msgstr "í¨í¤ì§ë¥¼ ì ê±°íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update the
+#. system as the packages will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:58
+msgid "Update packages"
+msgstr "í¨í¤ì§ ê°±ì "
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:59
+msgid "Authentication is required to update packages"
+msgstr "í¨í¤ì§ë¥¼ ê°±ì íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
+
#. SECURITY:
#. - Normal users require admin authentication to rollback system state
#. as this will change a large number of packages, and could expose the
#. system to previously patched security vulnerabilities.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:83
+#: ../policy/org.freedesktop.packagekit.policy.in.h:65
msgid "Rollback to a previous transaction"
msgstr "ì´ì í¸ëìì
ëë리기"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:66
+msgid "Authentication is required to rollback a transaction"
+msgstr "í¸ëìì
ì ëëë¦¬ë ¤ë©´ ì¸ì¦ì´ "
+
+#. SECURITY:
+#. - Normal users require admin authentication to enable or disable
+#. software sources as this can be used to enable new updates or
+#. install different versions of software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:72
+msgid "Change software source parameters"
+msgstr "ìíí¸ì¨ì´ ì본 ì¸ì ë³ê²½"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:73
+msgid "Authentication is required to change software source parameters"
+msgstr "ìíí¸ì¨ì´ ì본 ì¸ì를 ë³ê²½íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to refresh the
+#. cache, as this doesn't actually install or remove software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:78
+msgid "Refresh system sources"
+msgstr "ìì¤í
ì본 ìë¡ ê³ ì¹¨"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:79
+msgid "Authentication is required to refresh the system sources"
+msgstr "ìì¤í
ì본ì ìë¡ ê³ ì¹ë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
+
#. SECURITY:
#. - Normal users do not require admin authentication to set the proxy
#. used for downloading packages.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:88
+#: ../policy/org.freedesktop.packagekit.policy.in.h:84
msgid "Set network proxy"
msgstr "ë¤í¸ìí¬ íë¡ì ì¤ì "
+#: ../policy/org.freedesktop.packagekit.policy.in.h:85
+msgid ""
+"Authentication is required to set the network proxy used for downloading "
+"packages"
+msgstr "ë¤ì´ë¡ë ì¤ì¸ í¨í¤ì§ì ìí´ ì¬ì©ë ë¤í¸ìí¬ íë¡ì를 ì¤ì íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
+
#. SECURITY:
-#. - Normal users require admin authentication to add signing keys.
-#. - This implies adding an explicit trust, and should not be granted
-#. without a secure authentication.
-#. - This is not kept as each package should be authenticated.
+#. - This is used when users want to install to a different prefix, for
+#. instance to a LTSP image or a virtual machine.
+#. - This could be used to overwrite files not owned by the user using
+#. a carefully created package file.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:95
-msgid "Trust a key used for signing packages"
-msgstr "í¨í¤ì§ ìëª
ì ìí´ ì¬ì©ëë í¤ ì 뢰"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:92
+msgid "Change location that packages are installed"
+msgstr "ì¤ì¹ë í¨í¤ì§ì ìì¹ ë³ê²½"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:93
+msgid ""
+"Authentication is required to change the location used to decompress "
+"packages"
+msgstr "í¨í¤ì§ì ìì¶ì í´ì í ê²½ë¡ë¥¼ ë³ê²½íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
#. SECURITY:
-#. - Normal users do not require admin authentication to update the
-#. system as the packages will be signed, and the action is required
-#. to update the system when unattended.
-#. - Changing this to anything other than 'yes' will break unattended
-#. updates.
+#. - Normal users require admin authentication to rebind a driver
+#. so that it works after we install firmware.
+#. - This should not be set to 'yes' as unprivileged users could then
+#. try to rebind drivers in use, for instance security authentication
+#. devices.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:103
-msgid "Update packages"
-msgstr "í¨í¤ì§ ê°±ì "
+#: ../policy/org.freedesktop.packagekit.policy.in.h:101
+msgid "Reload a device"
+msgstr "ì¥ì¹ ë¤ì ë¡ë"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:102
+msgid "Authentication is required to reload the device with a new driver"
+msgstr "ìë¡ì´ ëë¼ì´ë²ë¡ ì¥ì¹ë¥¼ ë¤ì ë¡ëíë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
#. SECURITY:
#. - Normal users require admin authentication to upgrade the disto as
#. this can make the system unbootable or stop other applications from
#. working.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:109
+#: ../policy/org.freedesktop.packagekit.policy.in.h:108
msgid "Upgrade System"
msgstr "ìì¤í
ì
ê·¸ë ì´ë"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:109
+msgid "Authentication is required to upgrade the operating system"
+msgstr "ì´ìì²´ì 를 ì
ê·¸ë ì´ë íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
+
+#. SECURITY:
+#. - Normal users require admin authentication to repair the system
+#. since this can make the system unbootable or stop other
+#. applications from working.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:115
+msgid "Repair System"
+msgstr "ìì¤í
복구"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:116
+msgid "Authentication is required to repair the installed software"
+msgstr "ì¤ì¹ë ìíí¸ì¨ì´ë¥¼ 복구íë ¤ë©´ ì¸ì¦ì´ íìí©ëë¤"
+
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
#: ../src/pk-main.c:149
msgid "Packaging backend to use, e.g. dummy"
@@ -2033,7 +2047,7 @@ msgstr "ìì§ì´ ë¡ë ëê³ ëë©´ ì¢
ë£"
#. TRANSLATORS: don't unset environment variables, used for debugging
#: ../src/pk-main.c:167
msgid "Don't clear environment on startup"
-msgstr ""
+msgstr "ììí ë íê²½ ì¤ì ì´ê¸°ííì§ ì기"
#. TRANSLATORS: describing the service that is running
#: ../src/pk-main.c:179
@@ -2045,24 +2059,22 @@ msgid "Failed to load any of the specified backends:"
msgstr "ì´ë¤ ì§ì ë ë°±ìë를 ë¡ëíëë° ì¤í¨íìµëë¤"
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2696
+#: ../src/pk-transaction.c:2972
msgid "The software is not from a trusted source."
msgstr "ìíí¸ì¨ì´ê° ì 뢰í ì ìë ì본ì¼ë¡ë¶í° ì¨ ê²ì´ ìëëë¤"
-#: ../src/pk-transaction.c:2704
+#: ../src/pk-transaction.c:2980
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr "ìì íë¤ê³ íë¨ë기 ì ìë ì´ í¨í¤ì§ë¥¼ ê°±ì íì§ ë§ììì¤"
-#: ../src/pk-transaction.c:2705
+#: ../src/pk-transaction.c:2981
msgid "Do not update these packages unless you are sure it is safe to do so."
msgstr "ìì íë¤ê³ íë¨ë기 ì ìë ì´ í¨í¤ì§ë¤ì ê°±ì íì§ ë§ììì¤"
-#: ../src/pk-transaction.c:2715
+#: ../src/pk-transaction.c:2991
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr "ìì íë¤ê³ íë¨ë기 ì ìë ì´ í¨í¤ì§ë¥¼ ì¤ì¹íì§ "
-#: ../src/pk-transaction.c:2716
+#: ../src/pk-transaction.c:2992
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr "ìëíë¤ê³ íë¨ë기 ì ìë ì´ í¨í¤ì§ë¤ì ì¤ì¹íì§ ë§ììì¤"
-
-
diff --git a/po/lv.po b/po/lv.po
index 58d1bce..bae75cd 100644
--- a/po/lv.po
+++ b/po/lv.po
@@ -5,14 +5,15 @@
# Translators:
# RÅ«dofls Mazurs <rudolfs.mazurs at gmail.com>, 2011.
# <rudolfs.mazurs at gmail.com>, 2011.
+# RÅ«dolfs Mazurs <rudolfs.mazurs at gmail.com>, 2012.
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-11-10 19:50+0000\n"
-"PO-Revision-Date: 2011-11-10 19:50+0000\n"
-"Last-Translator: Richard Hughes <richard at hughsie.com>\n"
-"Language-Team: Latvian (http://www.transifex.net/projects/p/freedesktop/team/lv/)\n"
+"POT-Creation-Date: 2012-03-01 11:08+0000\n"
+"PO-Revision-Date: 2012-04-16 17:21+0000\n"
+"Last-Translator: RÅ«dolfs Mazurs <rudolfs.mazurs at gmail.com>\n"
+"Language-Team: Latvian (http://www.transifex.net/projects/p/freedesktop/language/lv/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -21,114 +22,114 @@ msgstr ""
#. TRANSLATORS: this is an atomic transaction
#. TRANSLATORS: the role is the point of the transaction, e.g. update-system
-#: ../client/pk-console.c:174 ../client/pk-console.c:596
+#: ../client/pk-console.c:173 ../client/pk-console.c:595
msgid "Transaction"
msgstr "Transakcija"
#. TRANSLATORS: this is the time the transaction was started in system
#. timezone
-#: ../client/pk-console.c:176
+#: ../client/pk-console.c:175
msgid "System time"
msgstr "SistÄmas laiks"
#. TRANSLATORS: this is if the transaction succeeded or not
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "Succeeded"
msgstr "IzdevÄs"
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "True"
msgstr "Patiess"
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "False"
msgstr "Aplams"
#. TRANSLATORS: this is the transactions role, e.g. "update-system"
-#: ../client/pk-console.c:180
+#: ../client/pk-console.c:179
msgid "Role"
msgstr "Loma"
#. TRANSLATORS: this is The duration of the transaction
-#: ../client/pk-console.c:185
+#: ../client/pk-console.c:184
msgid "Duration"
msgstr "Ilgums"
-#: ../client/pk-console.c:185
+#: ../client/pk-console.c:184
msgid "(seconds)"
msgstr "(sekundes)"
#. TRANSLATORS: this is The command line used to do the action
-#: ../client/pk-console.c:189
+#: ../client/pk-console.c:188
msgid "Command line"
msgstr "Komandrinda"
#. TRANSLATORS: this is the user ID of the user that started the action
-#: ../client/pk-console.c:191
+#: ../client/pk-console.c:190
msgid "User ID"
msgstr "LietotÄja ID"
#. TRANSLATORS: this is the username, e.g. hughsie
-#: ../client/pk-console.c:198
+#: ../client/pk-console.c:197
msgid "Username"
msgstr "LietotÄjvÄrds"
#. TRANSLATORS: this is the users real name, e.g. "Richard Hughes"
-#: ../client/pk-console.c:202
+#: ../client/pk-console.c:201
msgid "Real name"
msgstr "Īstais vÄrds"
-#: ../client/pk-console.c:210
+#: ../client/pk-console.c:209
msgid "Affected packages:"
msgstr "IetekmÄtÄs pakotnes:"
-#: ../client/pk-console.c:212
+#: ../client/pk-console.c:211
msgid "Affected packages: None"
msgstr "IetekmÄtÄs pakotnes: neviena"
#. TRANSLATORS: this is the distro, e.g. Fedora 10
-#: ../client/pk-console.c:247
+#: ../client/pk-console.c:246
msgid "Distribution"
msgstr "Distribūcija"
#. TRANSLATORS: this is type of update, stable or testing
-#: ../client/pk-console.c:249
+#: ../client/pk-console.c:248
msgid "Type"
msgstr "Tips"
#. TRANSLATORS: this is any summary text describing the upgrade
#. TRANSLATORS: this is the summary of the group
-#: ../client/pk-console.c:251 ../client/pk-console.c:290
+#: ../client/pk-console.c:250 ../client/pk-console.c:289
msgid "Summary"
msgstr "Kopsavilkums"
#. TRANSLATORS: this is the group category name
-#: ../client/pk-console.c:279
+#: ../client/pk-console.c:278
msgid "Category"
msgstr "Kategorija"
#. TRANSLATORS: this is group identifier
-#: ../client/pk-console.c:281
+#: ../client/pk-console.c:280
msgid "ID"
msgstr "ID"
#. TRANSLATORS: this is the parent group
-#: ../client/pk-console.c:284
+#: ../client/pk-console.c:283
msgid "Parent"
msgstr "VecÄks"
#. TRANSLATORS: this is the name of the parent group
-#: ../client/pk-console.c:287
+#: ../client/pk-console.c:286
msgid "Name"
msgstr "Nosaukums"
#. TRANSLATORS: this is preferred icon for the group
-#: ../client/pk-console.c:293
+#: ../client/pk-console.c:292
msgid "Icon"
msgstr "Ikona"
#. TRANSLATORS: this is a header for the package that can be updated
-#: ../client/pk-console.c:339
+#: ../client/pk-console.c:338
msgid "Details about the update:"
msgstr "SÄ«kÄka informÄcija par atjauninÄjumiem:"
@@ -136,7 +137,7 @@ msgstr "SÄ«kÄka informÄcija par atjauninÄjumiem:"
#. TRANSLATORS: the package that is being processed
#. TRANSLATORS: the package that is not signed by a known key
#. TRANSLATORS: the package name that was trying to be installed
-#: ../client/pk-console.c:345 ../client/pk-console.c:615
+#: ../client/pk-console.c:344 ../client/pk-console.c:614
#: ../lib/packagekit-glib2/pk-task-text.c:124
#: ../lib/packagekit-glib2/pk-task-text.c:206
msgid "Package"
@@ -144,218 +145,212 @@ msgstr "Pakotne"
#. TRANSLATORS: details about the update, any packages that this update
#. updates
-#: ../client/pk-console.c:348
+#: ../client/pk-console.c:347
msgid "Updates"
msgstr "AtjauninÄjumi"
#. TRANSLATORS: details about the update, any packages that this update
#. obsoletes
-#: ../client/pk-console.c:352
+#: ../client/pk-console.c:351
msgid "Obsoletes"
msgstr "Novecojušie"
#. TRANSLATORS: details about the update, the vendor URLs
#. TRANSLATORS: the vendor (e.g. vmware) that is providing the EULA
-#: ../client/pk-console.c:356 ../lib/packagekit-glib2/pk-task-text.c:209
+#: ../client/pk-console.c:355 ../lib/packagekit-glib2/pk-task-text.c:209
msgid "Vendor"
msgstr "RažotÄjs"
#. TRANSLATORS: details about the update, the bugzilla URLs
-#: ../client/pk-console.c:360
+#: ../client/pk-console.c:359
msgid "Bugzilla"
msgstr "Bugzilla"
#. TRANSLATORS: details about the update, the CVE URLs
-#: ../client/pk-console.c:364
+#: ../client/pk-console.c:363
msgid "CVE"
msgstr "CVE"
#. TRANSLATORS: details about the update, if the package requires a restart
-#: ../client/pk-console.c:368
+#: ../client/pk-console.c:367
msgid "Restart"
msgstr "PÄrstartÄt"
#. TRANSLATORS: details about the update, any description of the update
-#: ../client/pk-console.c:372
+#: ../client/pk-console.c:371
msgid "Update text"
msgstr "AtjauninÄt nÄkoÅ¡o"
#. TRANSLATORS: details about the update, the changelog for the package
-#: ../client/pk-console.c:376
+#: ../client/pk-console.c:375
msgid "Changes"
msgstr "IzmaiÅas"
#. TRANSLATORS: details about the update, the ongoing state of the update
-#: ../client/pk-console.c:380
+#: ../client/pk-console.c:379
msgid "State"
msgstr "StÄvoklis"
#. TRANSLATORS: details about the update, date the update was issued
-#: ../client/pk-console.c:384
+#: ../client/pk-console.c:383
msgid "Issued"
msgstr "Izdots"
#. TRANSLATORS: details about the update, date the update was updated
#. TRANSLATORS: The action of the package, in past tense
-#: ../client/pk-console.c:388 ../lib/packagekit-glib2/pk-console-shared.c:559
+#: ../client/pk-console.c:387 ../lib/packagekit-glib2/pk-enum.c:1135
msgid "Updated"
msgstr "AtjauninÄts"
#. TRANSLATORS: if the repo is enabled
-#: ../client/pk-console.c:424
+#: ../client/pk-console.c:423
msgid "Enabled"
msgstr "AktivÄts"
#. TRANSLATORS: if the repo is disabled
-#: ../client/pk-console.c:427
+#: ../client/pk-console.c:426
msgid "Disabled"
msgstr "DeaktivÄts"
#. TRANSLATORS: a package requires the system to be restarted
-#: ../client/pk-console.c:459
+#: ../client/pk-console.c:458
msgid "System restart required by:"
msgstr "SistÄmas pÄrstartÄÅ¡anu pieprasa:"
#. TRANSLATORS: a package requires the session to be restarted
-#: ../client/pk-console.c:462
+#: ../client/pk-console.c:461
msgid "Session restart required:"
msgstr "Sesijas pÄrstartÄÅ¡anu pieprasa:"
#. TRANSLATORS: a package requires the system to be restarted due to a
#. security update
-#: ../client/pk-console.c:465
+#: ../client/pk-console.c:464
msgid "System restart (security) required by:"
msgstr "SistÄmas pÄrstartÄÅ¡anu (droÅ¡Ä«bas dÄļ) pieprasa:"
#. TRANSLATORS: a package requires the session to be restarted due to a
#. security update
-#: ../client/pk-console.c:468
+#: ../client/pk-console.c:467
msgid "Session restart (security) required:"
msgstr "Sesijas pÄrstartÄÅ¡anu (droÅ¡Ä«bas dÄļ) pieprasa:"
#. TRANSLATORS: a package requires the application to be restarted
-#: ../client/pk-console.c:471
+#: ../client/pk-console.c:470
msgid "Application restart required by:"
msgstr "Lietotnes pÄrstartÄÅ¡anu pieprasa:"
#. TRANSLATORS: This a list of details about the package
-#: ../client/pk-console.c:506
+#: ../client/pk-console.c:505
msgid "Package description"
msgstr "Pakotnes apraksts"
#. TRANSLATORS: This a message (like a little note that may be of interest)
#. from the transaction
-#: ../client/pk-console.c:537
+#: ../client/pk-console.c:536
msgid "Message:"
msgstr "ZiÅojums:"
#. TRANSLATORS: This where the package has no files
-#: ../client/pk-console.c:558
+#: ../client/pk-console.c:557
msgid "No files"
msgstr "Nav failu"
#. TRANSLATORS: This a list files contained in the package
-#: ../client/pk-console.c:563
+#: ../client/pk-console.c:562
msgid "Package files"
msgstr "Pakotnes faili"
#. TRANSLATORS: the percentage complete of the transaction
-#: ../client/pk-console.c:631
+#: ../client/pk-console.c:630
msgid "Percentage"
msgstr "Procenti"
#. TRANSLATORS: the status of the transaction (e.g. downloading)
-#: ../client/pk-console.c:649
+#: ../client/pk-console.c:648
msgid "Status"
msgstr "Statuss"
#. TRANSLATORS: the results from the transaction
-#: ../client/pk-console.c:678
+#: ../client/pk-console.c:677
msgid "Results:"
msgstr "RezultÄts:"
#. TRANSLATORS: we failed to get any results, which is pretty fatal in my book
-#: ../client/pk-console.c:685
+#: ../client/pk-console.c:684
msgid "Fatal error"
msgstr "FatÄla kļūda"
#. TRANSLATORS: the user asked to update everything, but there is nothing that
#. can be updated
-#: ../client/pk-console.c:701
+#: ../client/pk-console.c:700
msgid "There are no packages to update."
msgstr "Nav pakotÅu, ko atjauninÄt."
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../client/pk-console.c:704
+#: ../client/pk-console.c:703
#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr "Transakcija neizdevÄs"
#. TRANSLATORS: print a message when there are no updates
-#: ../client/pk-console.c:733
+#: ../client/pk-console.c:732
msgid "There are no updates available at this time."
msgstr "Å obrÄ«d nav pieejamu atjauninÄjumu."
-#: ../client/pk-console.c:756
+#: ../client/pk-console.c:755
msgid "There are no upgrades available at this time."
msgstr "Šobrīd nav pieejamu uzlabojumu."
#. TRANSLATORS: a package needs to restart their system
-#: ../client/pk-console.c:823
+#: ../client/pk-console.c:822
msgid "Please restart the computer to complete the update."
msgstr "LÅ«dzu, pÄrstartÄjiet datoru, lai pabeigtu atjauninÄÅ¡anu."
#. TRANSLATORS: a package needs to restart the session
-#: ../client/pk-console.c:826
+#: ../client/pk-console.c:825
msgid "Please logout and login to complete the update."
msgstr "LÅ«dzu, izrakstieties, lai pabeigtu atjauninÄÅ¡anu."
#. TRANSLATORS: a package needs to restart their system (due to security)
-#: ../client/pk-console.c:829
+#: ../client/pk-console.c:828
msgid ""
"Please restart the computer to complete the update as important security "
"updates have been installed."
-msgstr ""
-"LÅ«dzu, pÄrstartÄjiet datoru, lai pabeigtu atjauninÄÅ¡anu, jo ir uzinstalÄti "
-"svarÄ«gi droÅ¡Ä«bas atjauninÄjumi."
+msgstr "LÅ«dzu, pÄrstartÄjiet datoru, lai pabeigtu atjauninÄÅ¡anu, jo ir uzinstalÄti svarÄ«gi droÅ¡Ä«bas atjauninÄjumi."
#. TRANSLATORS: a package needs to restart the session (due to security)
-#: ../client/pk-console.c:832
+#: ../client/pk-console.c:831
msgid ""
"Please logout and login to complete the update as important security updates"
" have been installed."
-msgstr ""
-"LÅ«dzu, izrakstieties, lai pabeigtu atjauninÄÅ¡anu, jo ir uzinstalÄti svarÄ«gi "
-"droÅ¡Ä«bas atjauninÄjumi."
+msgstr "LÅ«dzu, izrakstieties, lai pabeigtu atjauninÄÅ¡anu, jo ir uzinstalÄti svarÄ«gi droÅ¡Ä«bas atjauninÄjumi."
#. TRANSLATORS: The user used 'pkcon install dave.rpm' rather than 'pkcon
#. install-local dave.rpm'
-#: ../client/pk-console.c:858
+#: ../client/pk-console.c:857
#, c-format
msgid ""
"Expected package name, actually got file. Try using 'pkcon install-local %s'"
" instead."
-msgstr ""
-"GaidÄ«ja pakotnes nosaukumu, faktiski saÅÄma failu. MÄÄ£iniet tÄ vietÄ "
-"izmantot 'pkcon install-local %s'."
+msgstr "GaidÄ«ja pakotnes nosaukumu, faktiski saÅÄma failu. MÄÄ£iniet tÄ vietÄ izmantot 'pkcon install-local %s'."
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:871
+#: ../client/pk-console.c:870
#, c-format
msgid "This tool could not find any available package: %s"
msgstr "Å is rÄ«ks nevarÄju atrast nevienu pieejamu pakotni: %s"
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:899
+#: ../client/pk-console.c:898
#, c-format
msgid "This tool could not find the installed package: %s"
msgstr "Å is rÄ«ks nevarÄju atrast nevienu uzinstalÄtu pakotni: %s"
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:927 ../client/pk-console.c:955
+#: ../client/pk-console.c:926 ../client/pk-console.c:954
#, c-format
msgid "This tool could not find the package: %s"
msgstr "Å is rÄ«ks nevarÄju atrast nevienu pakotni: %s"
@@ -368,251 +363,245 @@ msgstr "Å is rÄ«ks nevarÄju atrast nevienu pakotni: %s"
#. detailed error follows
#. TRANSLATORS: The package name was not found in any software sources. The
#. detailed error follows
-#: ../client/pk-console.c:983 ../client/pk-console.c:1011
-#: ../client/pk-console.c:1039 ../client/pk-console.c:1067
-#: ../client/pk-console.c:1095
+#: ../client/pk-console.c:982 ../client/pk-console.c:1010
+#: ../client/pk-console.c:1038 ../client/pk-console.c:1066
+#: ../client/pk-console.c:1094
#, c-format
msgid "This tool could not find all the packages: %s"
msgstr "Å is rÄ«ks nevarÄja atrast visas pakotnes: %s"
#. TRANSLATORS: This is when the daemon crashed, and we are up shit creek
#. without a paddle
-#: ../client/pk-console.c:1124
+#: ../client/pk-console.c:1123
msgid "The daemon crashed mid-transaction!"
msgstr "DÄmons avarÄja transakcijas laikÄ!"
#. TRANSLATORS: This is the header to the --help menu
-#: ../client/pk-console.c:1158
+#: ../client/pk-console.c:1157
msgid "PackageKit Console Interface"
msgstr "PackageKit konsoles saskarne"
#. these are commands we can use with pkcon
-#: ../client/pk-console.c:1160
+#: ../client/pk-console.c:1159
msgid "Subcommands:"
msgstr "Apakškomandas:"
#. TRANSLATORS: we keep a database updated with the time that an action was
#. last executed
-#: ../client/pk-console.c:1240
+#: ../client/pk-console.c:1241
msgid "Failed to get the time since this action was last completed"
msgstr "NeizdevÄs iegÅ«t laiku, kopÅ¡ Å¡Ä« darbÄ«ba tika pÄdÄjo reizi izpildÄ«ta"
#. TRANSLATORS: command line argument, just show the version string
-#: ../client/pk-console.c:1282 ../client/pk-monitor.c:371
+#: ../client/pk-console.c:1283 ../client/pk-monitor.c:370
msgid "Show the program version and exit"
msgstr "RÄdÄ«t programmas versiju un iziet"
#. TRANSLATORS: command line argument, use a filter to narrow down results
-#: ../client/pk-console.c:1285
+#: ../client/pk-console.c:1286
msgid "Set the filter, e.g. installed"
msgstr "IestatÄ«t filtru, piemÄram, 'uzinstalÄts'"
#. TRANSLATORS: command line argument, use a non-standard install prefix
-#: ../client/pk-console.c:1288
+#: ../client/pk-console.c:1289
msgid "Set the install root, e.g. '/' or '/mnt/ltsp'"
msgstr "Iestatiet instalÄÅ¡anas sakni, piem. '/' vai '/mnt/ltsp'"
#. TRANSLATORS: command line argument, work asynchronously
-#: ../client/pk-console.c:1291
+#: ../client/pk-console.c:1292
msgid "Exit without waiting for actions to complete"
msgstr "Iziet negaidot darbību pabeigšanu"
#. command line argument, do we ask questions
-#: ../client/pk-console.c:1294
+#: ../client/pk-console.c:1295
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:525
msgid "Install the packages without asking for confirmation"
msgstr "InstalÄjiet pakotnes, neprasot apstiprinÄÅ¡anu"
#. TRANSLATORS: command line argument, this command is not a priority
-#: ../client/pk-console.c:1297
+#: ../client/pk-console.c:1298
msgid "Run the command using idle network bandwidth and also using less power"
-msgstr ""
-"IzpildÄ«t komandu, izmantojot dÄ«kstÄves tÄ«kla platjoslu, kÄ arÄ« izmantojot "
-"mazÄk enerÄ£ijas"
+msgstr "IzpildÄ«t komandu, izmantojot dÄ«kstÄves tÄ«kla platjoslu, kÄ arÄ« izmantojot mazÄk enerÄ£ijas"
#. TRANSLATORS: command line argument, just output without fancy formatting
-#: ../client/pk-console.c:1300
+#: ../client/pk-console.c:1301
msgid ""
"Print to screen a machine readable output, rather than using animated "
"widgets"
msgstr "Uz ekrÄna drukÄ maÅ¡Ä«nlasÄmu izvad, nevis izmanto animÄtas logdaļas"
#. TRANSLATORS: command line argument, just output without fancy formatting
-#: ../client/pk-console.c:1303
+#: ../client/pk-console.c:1304
msgid "The maximum metadata cache age. Use -1 for 'never'."
-msgstr ""
-"MaksimÄlais metadatu pieglabÄÅ¡anas laiks. Lietojiet -1 opcijai 'never' "
-"(nekad)."
+msgstr "MaksimÄlais metadatu pieglabÄÅ¡anas laiks. Lietojiet -1 opcijai 'never' (nekad)."
#. TRANSLATORS: command line argument, --help
-#: ../client/pk-console.c:1306
+#: ../client/pk-console.c:1307
msgid "Show help options."
msgstr "RÄdÄ«t palÄ«dzÄ«bas opcijas."
#. TRANSLATORS: we failed to contact the daemon
-#: ../client/pk-console.c:1336
+#: ../client/pk-console.c:1338
msgid "Failed to parse command line"
msgstr "NeizdevÄs apstrÄdÄt komandrindu"
#. TRANSLATORS: we failed to contact the daemon
-#: ../client/pk-console.c:1346
+#: ../client/pk-console.c:1348
msgid "Failed to contact PackageKit"
msgstr "NeizdevÄs sazinÄties ar PackageKit"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1399
+#: ../client/pk-console.c:1401
msgid "The proxy could not be set"
msgstr "NevarÄja iestatÄ«t starpnieku"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1411
+#: ../client/pk-console.c:1413
msgid "The install root could not be set"
msgstr "NevarÄja iestatÄ«t instalÄÅ¡anas sakni"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1423
+#: ../client/pk-console.c:1425
msgid "The filter specified was invalid"
msgstr "NorÄdÄ«tais filtrs nav derÄ«gs"
#. TRANSLATORS: a search type can be name, details, file, etc
-#: ../client/pk-console.c:1442
+#: ../client/pk-console.c:1444
msgid "A search type is required, e.g. name"
msgstr "TrÅ«kst meklÄÅ¡anas tips, piemÄram, nosaukums"
#. TRANSLATORS: the user needs to provide a search term
-#: ../client/pk-console.c:1449 ../client/pk-console.c:1461
-#: ../client/pk-console.c:1473 ../client/pk-console.c:1485
+#: ../client/pk-console.c:1451 ../client/pk-console.c:1463
+#: ../client/pk-console.c:1475 ../client/pk-console.c:1487
msgid "A search term is required"
msgstr "VajadzÄ«ga meklÄÅ¡anas frÄze"
#. TRANSLATORS: the search type was provided, but invalid
-#: ../client/pk-console.c:1495
+#: ../client/pk-console.c:1497
msgid "Invalid search type"
msgstr "NederÄ«gs meklÄÅ¡anas tips"
#. TRANSLATORS: the user did not specify what they wanted to install
-#: ../client/pk-console.c:1501
+#: ../client/pk-console.c:1503
msgid "A package name to install is required"
msgstr "JÄnorÄda instalÄjamÄs pakotnes nosaukums"
#. TRANSLATORS: the user did not specify what they wanted to install
-#: ../client/pk-console.c:1510
+#: ../client/pk-console.c:1512
msgid "A filename to install is required"
msgstr "JÄnorÄda instalÄjamÄ faila nosaukums"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1521
+#: ../client/pk-console.c:1523
msgid "A type, key_id and package_id are required"
msgstr "Nepieciešams tips, key_id un package_id"
#. TRANSLATORS: the user did not specify what they wanted to remove
-#: ../client/pk-console.c:1532
+#: ../client/pk-console.c:1534
msgid "A package name to remove is required"
msgstr "JÄnorÄda noÅemamÄs pakotnes nosaukums"
#. TRANSLATORS: the user did not specify anything about what to download or
#. where
-#: ../client/pk-console.c:1541
+#: ../client/pk-console.c:1543
msgid "A destination directory and the package names to download are required"
msgstr "JÄnorÄda mÄrÄ·a mape un lejupielÄdÄjamo pakotÅu nosaukumi"
#. TRANSLATORS: the directory does not exist, so we can't continue
-#: ../client/pk-console.c:1548
+#: ../client/pk-console.c:1550
msgid "Directory not found"
msgstr "Mape nav atrasta"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1557
+#: ../client/pk-console.c:1559
msgid "A licence identifier (eula-id) is required"
msgstr "Nepieciešams licences identifikators (eula-id)"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1568
+#: ../client/pk-console.c:1570
msgid "A transaction identifier (tid) is required"
msgstr "Nepieciešams transakcijas identifikators (tid)"
#. TRANSLATORS: The user did not specify a package name
-#: ../client/pk-console.c:1589
+#: ../client/pk-console.c:1591
msgid "A package name to resolve is required"
msgstr "JÄnorÄda atrodamÄs pakotnes nosaukums"
#. TRANSLATORS: The user did not specify a repository (software source) name
-#: ../client/pk-console.c:1600 ../client/pk-console.c:1611
+#: ../client/pk-console.c:1602 ../client/pk-console.c:1613
msgid "A repository name is required"
msgstr "JÄnorÄda krÄtuves nosaukums"
#. TRANSLATORS: The user didn't provide any data
-#: ../client/pk-console.c:1622
+#: ../client/pk-console.c:1624
msgid "A repo name, parameter and value are required"
msgstr "NepiecieÅ¡ams krÄtuves nosaukums, parametri un vÄrtÄ«bas"
#. TRANSLATORS: The user didn't specify what action to use
-#: ../client/pk-console.c:1639
+#: ../client/pk-console.c:1641
msgid "An action, e.g. 'update-system' is required"
msgstr "NepiecieÅ¡ama darbÄ«ba, piemÄram, 'update-system'"
#. TRANSLATORS: The user specified an invalid action
-#: ../client/pk-console.c:1646
+#: ../client/pk-console.c:1648
msgid "A correct role is required"
msgstr "Nepieciešama pareiza loma"
#. TRANSLATORS: The user did not provide a package name
#. TRANSLATORS: This is when the user fails to supply the package name
-#: ../client/pk-console.c:1656 ../client/pk-console.c:1670
-#: ../client/pk-console.c:1679 ../client/pk-console.c:1699
-#: ../client/pk-console.c:1708 ../client/pk-generate-pack.c:314
+#: ../client/pk-console.c:1658 ../client/pk-console.c:1672
+#: ../client/pk-console.c:1681 ../client/pk-console.c:1701
+#: ../client/pk-console.c:1710 ../client/pk-generate-pack.c:314
msgid "A package name is required"
msgstr "Nepieciešams pakotnes nosaukums"
#. TRANSLATORS: each package "provides" certain things, e.g. mime(gstreamer-
#. decoder-mp3), the user didn't specify it
-#: ../client/pk-console.c:1688
+#: ../client/pk-console.c:1690
msgid "A package provide string is required"
msgstr "NepiecieÅ¡ama pakotnes nodroÅ¡inÄjuma virkne"
#. TRANSLATORS: The user did not provide a distro name
-#: ../client/pk-console.c:1732
+#: ../client/pk-console.c:1734
msgid "A distribution name is required"
msgstr "JÄnorÄda distribÅ«cijas nosaukums"
#. TRANSLATORS: The user did not provide an upgrade type
-#: ../client/pk-console.c:1738
+#: ../client/pk-console.c:1740
msgid "An upgrade type is required, e.g. 'minimal', 'default' or 'complete'"
-msgstr ""
-"JÄnorÄda uzlaboÅ¡anas tips, piemÄram, 'minimal', 'default' vai 'complete'"
+msgstr "JÄnorÄda uzlaboÅ¡anas tips, piemÄram, 'minimal', 'default' vai 'complete'"
#. TRANSLATORS: The user tried to use an unsupported option on the command
#. line
-#: ../client/pk-console.c:1788
+#: ../client/pk-console.c:1795
#, c-format
msgid "Option '%s' is not supported"
msgstr "Opcija '%s' nav norÄdÄ«ta"
#. TRANSLATORS: Generic failure of what they asked to do
-#: ../client/pk-console.c:1798
+#: ../client/pk-console.c:1805
msgid "Command failed"
msgstr "Komanda neizdevÄs"
#. TRANSLATORS: we can exclude certain packages (glibc) when we know they'll
#. exist on the target
-#: ../client/pk-generate-pack.c:253
+#: ../client/pk-generate-pack.c:252
msgid "Set the file name of dependencies to be excluded"
msgstr "Iestatiet izslÄdzamo atkarÄ«bu failu nosaukumus"
#. TRANSLATORS: the output location
-#: ../client/pk-generate-pack.c:256
+#: ../client/pk-generate-pack.c:255
msgid ""
"The output file or directory (the current directory is used if omitted)"
-msgstr ""
-"Izvades fails vai mape (ja nav norÄdÄ«ts, tiks izmantota paÅ¡reizÄjÄ mape)"
+msgstr "Izvades fails vai mape (ja nav norÄdÄ«ts, tiks izmantota paÅ¡reizÄjÄ mape)"
#. TRANSLATORS: put a list of packages in the pack
-#: ../client/pk-generate-pack.c:259
+#: ../client/pk-generate-pack.c:258
msgid "The package to be put into the service pack"
msgstr "Pakotnes, ko iekļaut servisa pakÄ"
#. TRANSLATORS: put all pending updates in the pack
-#: ../client/pk-generate-pack.c:262
+#: ../client/pk-generate-pack.c:261
msgid "Put all updates available in the service pack"
msgstr "Ielikt visus pieejamos atjauninÄjumus servisa pakÄ"
@@ -651,9 +640,7 @@ msgstr "PakotÅu pÄrvaldnieks nevar veikt Å¡Äda veida darbÄ«bu."
msgid ""
"Service packs cannot be created as PackageKit was not built with libarchive "
"support."
-msgstr ""
-"Nevar izveidot servisa pakas, jo PackageKit netika uzbÅ«vÄts ar libarchive "
-"atbalstu."
+msgstr "Nevar izveidot servisa pakas, jo PackageKit netika uzbÅ«vÄts ar libarchive atbalstu."
#. TRANSLATORS: the user specified an absolute path, but didn't get the
#. extension correct
@@ -713,11 +700,11 @@ msgstr "Servisa paka izveidota '%s'"
msgid "Failed to create '%s': %s"
msgstr "NeizdevÄs izveidot '%s': %s"
-#: ../client/pk-monitor.c:284
+#: ../client/pk-monitor.c:283
msgid "Failed to get daemon state"
msgstr "NeizdevÄs saÅemt dÄmona stÄvokli"
-#: ../client/pk-monitor.c:349
+#: ../client/pk-monitor.c:348
msgid "Failed to get properties"
msgstr "NeizdevÄs saÅemt Ä«paÅ¡Ä«bas"
@@ -788,8 +775,7 @@ msgstr "LejupielÄdÄ informÄciju par programmatÅ«ras avotiem."
#. TRANSLATORS: downloading file lists so we can search
#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
-msgstr ""
-"LejupielÄdÄ failu sarakstus (lÄ«dz tÄ pabeigÅ¡anai var paiet kÄds laiciÅÅ¡)."
+msgstr "LejupielÄdÄ failu sarakstus (lÄ«dz tÄ pabeigÅ¡anai var paiet kÄds laiciÅÅ¡)."
#. TRANSLATORS: waiting for native lock
#: ../contrib/command-not-found/pk-command-not-found.c:371
@@ -824,58 +810,58 @@ msgstr "NeizdevÄs instalÄt pakotnes"
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:723
+#: ../contrib/command-not-found/pk-command-not-found.c:725
msgid "command not found"
msgstr "komanda nav atrasta"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:743
msgid "Similar command is:"
msgstr "Līdzīga komanda ir:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:755
+#: ../contrib/command-not-found/pk-command-not-found.c:757
msgid "Run similar command:"
msgstr "Palaist līdzīgu komandu:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:769
-#: ../contrib/command-not-found/pk-command-not-found.c:778
+#: ../contrib/command-not-found/pk-command-not-found.c:771
+#: ../contrib/command-not-found/pk-command-not-found.c:780
msgid "Similar commands are:"
msgstr "Līdzīgas komandas ir:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:785
+#: ../contrib/command-not-found/pk-command-not-found.c:787
msgid "Please choose a command to run"
msgstr "LÅ«dzu, izvÄlieties palaižamo komandu"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:805
msgid "The package providing this file is:"
msgstr "Pakotne, kura nodrošina šo failu:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:810
+#: ../contrib/command-not-found/pk-command-not-found.c:812
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "InstalÄt pakotni '%s', lai nodroÅ¡inÄtu komandu '%s'?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:837
+#: ../contrib/command-not-found/pk-command-not-found.c:839
msgid "Packages providing this file are:"
msgstr "Pakotnes, kas nodrošina šo failu ir:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:847
+#: ../contrib/command-not-found/pk-command-not-found.c:849
msgid "Suitable packages are:"
msgstr "PiemÄrotas pakotnes ir:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:856
+#: ../contrib/command-not-found/pk-command-not-found.c:858
msgid "Please choose a package to install"
msgstr "LÅ«dzu, izvÄlieties instalÄjamo pakotni"
@@ -909,172 +895,172 @@ msgid "Do not display information or progress"
msgstr "NerÄdÄ«t informÄciju par progresu"
#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:540
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:542
msgid "PackageKit Debuginfo Installer"
msgstr "PackageKit Debuginfo Installer"
#. TRANSLATORS: the use needs to specify a list of package names on the
#. command line
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:554
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:556
#, c-format
msgid "ERROR: Specify package names to install."
msgstr "KĻŪDA: NorÄdiet instalÄjamÄs pakotnes."
#. TRANSLATORS: we are getting the list of repositories
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:590
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:592
#, c-format
msgid "Getting sources list"
msgstr "Iegūst avotu sarakstu"
#. TRANSLATORS: operation was not successful
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:600
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:675
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:759
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:803
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:870
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:914
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:602
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:677
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:761
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:805
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:872
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:916
msgid "FAILED."
msgstr "NEIZDEVÄS."
#. TRANSLATORS: all completed 100%
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:615
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:655
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:690
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:774
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:818
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:885
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:929
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:617
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:657
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:692
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:776
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:820
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:887
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:931
#, c-format
msgid "OK."
msgstr "LABI."
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:618
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:620
#, c-format
msgid "Found %i enabled and %i disabled sources."
msgstr "Atrada %i aktivÄtu un %i deaktivÄtu avotu."
#. TRANSLATORS: we're finding repositories that match out pattern
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:625
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:627
#, c-format
msgid "Finding debugging sources"
msgstr "MeklÄ atkļūdoÅ¡anas avotus"
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:658
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:660
#, c-format
msgid "Found %i disabled debuginfo repos."
msgstr "Atrada %i deaktivÄtu atkļūdoÅ¡anas krÄtuvju."
#. TRANSLATORS: we're now enabling all the debug sources we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:665
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:667
#, c-format
msgid "Enabling debugging sources"
msgstr "AktivÄ atkļūdoÅ¡anas krÄtuves"
#. TRANSLATORS: tell the user how many we enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:693
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:695
#, c-format
msgid "Enabled %i debugging sources."
msgstr "AktivÄja %i atkļūdoÅ¡anas krÄtuves."
#. TRANSLATORS: we're now finding packages that match in all the repos
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:700
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:702
#, c-format
msgid "Finding debugging packages"
msgstr "MeklÄ atkļūdoÅ¡anas pakotnes"
#. TRANSLATORS: we couldn't find the package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:712
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:714
#, c-format
msgid "Failed to find the package %s: %s"
msgstr "NeizdevÄs atrast pakotni '%s': %s"
#. TRANSLATORS: we couldn't find the debuginfo package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:735
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:737
#, c-format
msgid "Failed to find the debuginfo package %s: %s"
msgstr "NeizdevÄs atrast atkļūdoÅ¡anas informÄcijas pakotni '%s': %s"
#. TRANSLATORS: no debuginfo packages could be found to be installed
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:763
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:765
#, c-format
msgid "Found no packages to install."
msgstr "Neatrada pakotnes, ko instalÄt."
#. TRANSLATORS: tell the user we found some packages, and then list them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:777
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:779
#, c-format
msgid "Found %i packages:"
msgstr "Atrada %i pakotnes:"
#. TRANSLATORS: tell the user we are searching for deps
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:793
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:795
#, c-format
msgid "Finding packages that depend on these packages"
msgstr "MeklÄ pakotnes, kas ir atkarÄ«gas no Å¡Ä«m pakotnÄm"
#. TRANSLATORS: could not install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:806
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:808
#, c-format
-msgid "Could not find dependant packages: %s"
-msgstr "NeizdevÄs atrast atkarÄ«gÄs pakotnes: %s"
+msgid "Could not find dependent packages: %s"
+msgstr "NevarÄja atrast atkarÄ«gÄs pakotnes: %s"
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:822
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:824
#, c-format
msgid "Found %i extra packages."
msgstr "Atrada %i papildu pakotnes."
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:826
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:828
#, c-format
msgid "No extra packages required."
msgstr "Nav nepiecieÅ¡amas papildu pakotÅu."
#. TRANSLATORS: tell the user we found some packages (and deps), and then list
#. them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:835
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:837
#, c-format
msgid "Found %i packages to install:"
msgstr "Neatrada %i pakotnes, ko instalÄt:"
#. TRANSLATORS: simulate mode is a testing mode where we quit before the
#. action
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:848
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:850
#, c-format
msgid "Not installing packages in simulate mode"
msgstr "NeinstalÄ pakotnes imitÄÅ¡anas režīmÄ"
#. TRANSLATORS: we are now installing the debuginfo packages we found earlier
#. TRANSLATORS: transaction state, installing packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:860
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:862
#: ../lib/packagekit-glib2/pk-console-shared.c:331
#, c-format
msgid "Installing packages"
msgstr "InstalÄ pakotnes"
#. TRANSLATORS: could not install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:873
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:875
#, c-format
msgid "Could not install packages: %s"
msgstr "NeizdevÄs instalÄt pakotnes: %s"
#. TRANSLATORS: we are now disabling all debuginfo repos we previously enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:905
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:907
#, c-format
msgid "Disabling sources previously enabled"
msgstr "DeaktivÄ pirmÄ«t aktivÄtos avotus"
#. TRANSLATORS: no debuginfo packages could be found to be installed, detailed
#. error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:917
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:919
#, c-format
msgid "Could not disable the debugging sources: %s"
msgstr "NeizdevÄs deaktivÄt atkļūdoÅ¡anas avotus: %s"
#. TRANSLATORS: we disabled all the debugging repos that we enabled before
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:932
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:934
#, c-format
msgid "Disabled %i debugging sources."
msgstr "DeaktivÄja %i atkļūdoÅ¡anas avotus."
@@ -1238,7 +1224,7 @@ msgstr "IzÅem pakotnes"
#. TRANSLATORS: transaction state, downloading package files
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:327
-#: ../lib/packagekit-glib2/pk-console-shared.c:705
+#: ../lib/packagekit-glib2/pk-enum.c:1288
msgid "Downloading packages"
msgstr "LejupielÄdÄ pakotnes"
@@ -1277,7 +1263,7 @@ msgstr "PÄrbauda parakstus"
#. TRANSLATORS: transaction state, when we return to a previous system state
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:359
-#: ../lib/packagekit-glib2/pk-console-shared.c:665
+#: ../lib/packagekit-glib2/pk-enum.c:1248
msgid "Rolling back"
msgstr "Atgriež atpakaļ"
@@ -1392,281 +1378,281 @@ msgstr "PÄrbauda izmantotÄs bibliotÄkas"
msgid "Copying files"
msgstr "KopÄ failus"
+#. TRANSLATORS: turn on all debugging
+#: ../lib/packagekit-glib2/pk-debug.c:133
+msgid "Show debugging information for all files"
+msgstr "RÄdÄ«t informÄciju par atkļūdoÅ¡anu visiem failiem"
+
+#: ../lib/packagekit-glib2/pk-debug.c:201
+msgid "Debugging Options"
+msgstr "Atkļūdošanas opcijas"
+
+#: ../lib/packagekit-glib2/pk-debug.c:201
+msgid "Show debugging options"
+msgstr "RÄdÄ«t atkļūdoÅ¡anas opcijas"
+
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:461
+#: ../lib/packagekit-glib2/pk-enum.c:1023
msgid "Trivial"
msgstr "TriviÄls"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:465
+#: ../lib/packagekit-glib2/pk-enum.c:1027
msgid "Normal"
msgstr "NormÄls"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:469
+#: ../lib/packagekit-glib2/pk-enum.c:1031
msgid "Important"
msgstr "Svarīgs"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:473
+#: ../lib/packagekit-glib2/pk-enum.c:1035
msgid "Security"
msgstr "Drošības"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:477
+#: ../lib/packagekit-glib2/pk-enum.c:1039
msgid "Bug fix "
msgstr "Kļūdas labojums "
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:481
+#: ../lib/packagekit-glib2/pk-enum.c:1043
msgid "Enhancement"
msgstr "Uzlabojums"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:485
+#: ../lib/packagekit-glib2/pk-enum.c:1047
msgid "Blocked"
msgstr "BloÄ·Äta"
#. TRANSLATORS: The state of a package
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:490
-#: ../lib/packagekit-glib2/pk-console-shared.c:563
+#: ../lib/packagekit-glib2/pk-enum.c:1052
+#: ../lib/packagekit-glib2/pk-enum.c:1139
msgid "Installed"
msgstr "InstalÄta"
#. TRANSLATORS: The state of a package, i.e. not installed
-#: ../lib/packagekit-glib2/pk-console-shared.c:495
+#: ../lib/packagekit-glib2/pk-enum.c:1057
msgid "Available"
msgstr "Pieejama"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:513
+#: ../lib/packagekit-glib2/pk-enum.c:1082
msgid "Downloading"
msgstr "LejupielÄdÄ"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:517
+#: ../lib/packagekit-glib2/pk-enum.c:1086
msgid "Updating"
msgstr "Atjaunina"
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:521
-#: ../lib/packagekit-glib2/pk-console-shared.c:641
+#: ../lib/packagekit-glib2/pk-enum.c:1090
+#: ../lib/packagekit-glib2/pk-enum.c:1224
msgid "Installing"
msgstr "InstalÄ"
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:525
-#: ../lib/packagekit-glib2/pk-console-shared.c:637
+#: ../lib/packagekit-glib2/pk-enum.c:1094
+#: ../lib/packagekit-glib2/pk-enum.c:1220
msgid "Removing"
msgstr "IzÅem"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:529
+#: ../lib/packagekit-glib2/pk-enum.c:1098
msgid "Cleaning up"
msgstr "Uzkopj"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:533
+#: ../lib/packagekit-glib2/pk-enum.c:1102
msgid "Obsoleting"
msgstr "AtzÄ«mÄ kÄ novecojuÅ¡as"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:537
+#: ../lib/packagekit-glib2/pk-enum.c:1106
msgid "Reinstalling"
msgstr "PÄrinstalÄ"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:555
+#: ../lib/packagekit-glib2/pk-enum.c:1131
msgid "Downloaded"
msgstr "LejupielÄdÄta"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:567
+#: ../lib/packagekit-glib2/pk-enum.c:1143
msgid "Removed"
msgstr "IzÅÄmta"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:571
+#: ../lib/packagekit-glib2/pk-enum.c:1147
msgid "Cleaned up"
msgstr "Satirīta"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:575
+#: ../lib/packagekit-glib2/pk-enum.c:1151
msgid "Obsoleted"
msgstr "AtzÄ«mÄta kÄ novecojuÅ¡a"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:579
+#: ../lib/packagekit-glib2/pk-enum.c:1155
msgid "Reinstalled"
msgstr "PÄrinstalÄta"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:597
+#: ../lib/packagekit-glib2/pk-enum.c:1180
msgid "Unknown role type"
msgstr "NezinÄms lomas tips"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:601
+#: ../lib/packagekit-glib2/pk-enum.c:1184
msgid "Getting dependencies"
msgstr "Iegūst atkarības"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:605
+#: ../lib/packagekit-glib2/pk-enum.c:1188
msgid "Getting update details"
msgstr "IegÅ«st sÄ«kÄku informÄciju par atjauninÄjumu"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:609
+#: ../lib/packagekit-glib2/pk-enum.c:1192
msgid "Getting details"
msgstr "IegÅ«st sÄ«kÄku informÄciju par pakotni"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:613
+#: ../lib/packagekit-glib2/pk-enum.c:1196
msgid "Getting requires"
msgstr "IegÅ«st pieprasÄ«tÄs pakotnes"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:617
+#: ../lib/packagekit-glib2/pk-enum.c:1200
msgid "Getting updates"
msgstr "IegÅ«st atjauninÄjumus"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:621
+#: ../lib/packagekit-glib2/pk-enum.c:1204
msgid "Searching by details"
msgstr "MeklÄ pÄc sÄ«kÄkas informÄcijas"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:625
+#: ../lib/packagekit-glib2/pk-enum.c:1208
msgid "Searching by file"
msgstr "MeklÄ pÄc faila"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:629
+#: ../lib/packagekit-glib2/pk-enum.c:1212
msgid "Searching groups"
msgstr "MeklÄ grupÄs"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:633
+#: ../lib/packagekit-glib2/pk-enum.c:1216
msgid "Searching by name"
msgstr "MeklÄ pÄc nosaukuma"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:645
+#: ../lib/packagekit-glib2/pk-enum.c:1228
msgid "Installing files"
msgstr "InstalÄ failus"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:649
+#: ../lib/packagekit-glib2/pk-enum.c:1232
msgid "Refreshing cache"
msgstr "Atsvaidzina kešu"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:653
+#: ../lib/packagekit-glib2/pk-enum.c:1236
msgid "Updating packages"
msgstr "Atjaunina pakotnes"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:657
+#: ../lib/packagekit-glib2/pk-enum.c:1240
msgid "Updating system"
msgstr "Atjaunina sistÄmu"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:661
+#: ../lib/packagekit-glib2/pk-enum.c:1244
msgid "Canceling"
msgstr "Atceļ"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:669
+#: ../lib/packagekit-glib2/pk-enum.c:1252
msgid "Getting repositories"
msgstr "IegÅ«st krÄtuves"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:673
+#: ../lib/packagekit-glib2/pk-enum.c:1256
msgid "Enabling repository"
msgstr "AktivÄ krÄtuvi"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:677
+#: ../lib/packagekit-glib2/pk-enum.c:1260
msgid "Setting data"
msgstr "Iestata datus"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:681
+#: ../lib/packagekit-glib2/pk-enum.c:1264
msgid "Resolving"
msgstr "Atrisina"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:685
+#: ../lib/packagekit-glib2/pk-enum.c:1268
msgid "Getting file list"
msgstr "Iegūst failu sarakstu"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:689
+#: ../lib/packagekit-glib2/pk-enum.c:1272
msgid "Getting provides"
msgstr "IegÅ«st nodroÅ¡inÄjumus"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:693
+#: ../lib/packagekit-glib2/pk-enum.c:1276
msgid "Installing signature"
msgstr "InstalÄ parakstu"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:697
+#: ../lib/packagekit-glib2/pk-enum.c:1280
msgid "Getting packages"
msgstr "Iegūst pakotnes"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:701
+#: ../lib/packagekit-glib2/pk-enum.c:1284
msgid "Accepting EULA"
msgstr "Apstiprina EULA"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:709
+#: ../lib/packagekit-glib2/pk-enum.c:1292
msgid "Getting upgrades"
msgstr "Iegūst uzlabojumus"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:713
+#: ../lib/packagekit-glib2/pk-enum.c:1296
msgid "Getting categories"
msgstr "Iegūst kategorijas"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:717
+#: ../lib/packagekit-glib2/pk-enum.c:1300
msgid "Getting transactions"
msgstr "Iegūst transakcijas"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:721
-#: ../lib/packagekit-glib2/pk-console-shared.c:725
+#: ../lib/packagekit-glib2/pk-enum.c:1304
+#: ../lib/packagekit-glib2/pk-enum.c:1308
msgid "Simulating install"
msgstr "ImitÄ instalÄÅ¡anu"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:729
+#: ../lib/packagekit-glib2/pk-enum.c:1312
msgid "Simulating remove"
msgstr "ImitÄ izÅemÅ¡anu"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:733
+#: ../lib/packagekit-glib2/pk-enum.c:1316
msgid "Simulating update"
msgstr "ImitÄ atjauninÄÅ¡anu"
-#. TRANSLATORS: turn on all debugging
-#: ../lib/packagekit-glib2/pk-debug.c:133
-msgid "Show debugging information for all files"
-msgstr "RÄdÄ«t informÄciju par atkļūdoÅ¡anu visiem failiem"
-
-#: ../lib/packagekit-glib2/pk-debug.c:201
-msgid "Debugging Options"
-msgstr "Atkļūdošanas opcijas"
-
-#: ../lib/packagekit-glib2/pk-debug.c:201
-msgid "Show debugging options"
-msgstr "RÄdÄ«t atkļūdoÅ¡anas opcijas"
-
#. TRANSLATORS: ask the user if they are comfortable installing insecure
#. packages
#: ../lib/packagekit-glib2/pk-task-text.c:67
@@ -1817,111 +1803,18 @@ msgid "The transaction did not proceed."
msgstr "Transakcija nenoritÄja."
#. SECURITY:
-#. - Normal users do not require admin authentication to accept new
-#. licence agreements.
-#. - Change this to 'auth_admin' for environments where users should not
-#. be given the option to make legal decisions.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:7
-msgid "Accept EULA"
-msgstr "PieÅemt licences lÄ«gumu"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:8
-msgid "Authentication is required to accept a EULA"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai pieÅemtu licences lÄ«gumu"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:9
-msgid ""
-"Authentication is required to cancel a task that was not started by yourself"
-msgstr ""
-"NepiecieÅ¡ama autentifikÄcija, lai apturÄtu uzdevumu, kuru jÅ«s neesat uzdevis"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:10
-msgid "Authentication is required to change software source parameters"
-msgstr ""
-"NepiecieÅ¡ama autentifikÄcija, lai mainÄ«tu programmatÅ«ras avotu parametrus"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:11
-msgid ""
-"Authentication is required to change the location used to decompress "
-"packages"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai mainÄ«tu vietu, kur atspiež pakotnes"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:12
-msgid ""
-"Authentication is required to consider a key used for signing packages as "
-"trusted"
-msgstr ""
-"NepiecieÅ¡ama autentifikÄcija, lai atslÄgu uzskatÄ«tu par derÄ«gu pakotÅu "
-"parakstÄ«Å¡anai ka derÄ«gÄm"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:13
-msgid "Authentication is required to install a signed package"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai instalÄtu parakstÄ«tas pakotnes"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:14
-msgid "Authentication is required to install an untrusted package"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai instalÄtu neuzticamas pakotnes"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:15
-msgid "Authentication is required to refresh the system sources"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai atsvaidzinÄtu sistÄmas resursus"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:16
-msgid "Authentication is required to reload the device with a new driver"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai pÄrlÄdÄtu ierÄ«ci ar jaunu draiveri"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:17
-msgid "Authentication is required to remove packages"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai izÅemtu pakotnes"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:18
-msgid "Authentication is required to rollback a transaction"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai atritinÄtu transakciju"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:19
-msgid ""
-"Authentication is required to set the network proxy used for downloading "
-"packages"
-msgstr ""
-"NepiecieÅ¡ama autentifikÄcija, lai iestatÄ«tu tÄ«kla starpnieku, ko izmantot "
-"pakotÅu lejupielÄdÄÅ¡anai"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:20
-msgid "Authentication is required to update packages"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai uzlabotu pakotnes"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:21
-msgid "Authentication is required to upgrade the operating system"
-msgstr "NepiecieÅ¡ama autentifikÄcija, lai uzlabotu operÄtÄjsistÄmu"
-
-#. SECURITY:
#. - Normal users are allowed to cancel their own task without
#. authentication, but a different user id needs the admin password
#. to cancel another users task.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:27
+#: ../policy/org.freedesktop.packagekit.policy.in.h:6
msgid "Cancel foreign task"
msgstr "Atcelt ÄrÄjo uzdevumu"
-#. SECURITY:
-#. - This is used when users want to install to a different prefix, for
-#. instance to a LTSP image or a virtual machine.
-#. - This could be used to overwrite files not owned by the user using
-#. a carefully created package file.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:34
-msgid "Change location that packages are installed"
-msgstr "MainÄ«t vietu, kur instalÄt pakotnes"
-
-#. SECURITY:
-#. - Normal users require admin authentication to enable or disable
-#. software sources as this can be used to enable new updates or
-#. install different versions of software.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:40
-msgid "Change software source parameters"
-msgstr "Mainītu programmatūras avotu parametrus"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:7
+msgid ""
+"Authentication is required to cancel a task that was not started by yourself"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai apturÄtu uzdevumu, kuru jÅ«s neesat uzdevis"
#. SECURITY:
#. - Normal users do not need authentication to install signed packages
@@ -1929,38 +1822,57 @@ msgstr "Mainītu programmatūras avotu parametrus"
#. - Paranoid users (or parents!) can change this to 'auth_admin' or
#. 'auth_admin_keep'.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:47
+#: ../policy/org.freedesktop.packagekit.policy.in.h:14
msgid "Install signed package"
msgstr "InstalÄt parakstÄ«tu pakotni"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:15
+msgid "Authentication is required to install a signed package"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai instalÄtu parakstÄ«tas pakotnes"
+
#. SECURITY:
#. - Normal users require admin authentication to install untrusted or
#. unrecognised packages, as allowing users to do this without a
#. password would be a massive security hole.
#. - This is not retained as each package should be authenticated.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:54
+#: ../policy/org.freedesktop.packagekit.policy.in.h:22
msgid "Install untrusted local file"
msgstr "InstalÄt neuzticamu vietÄjo failu"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:23
+msgid "Authentication is required to install an untrusted package"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai instalÄtu neuzticamas pakotnes"
+
#. SECURITY:
-#. - Normal users do not require admin authentication to refresh the
-#. cache, as this doesn't actually install or remove software.
+#. - Normal users require admin authentication to add signing keys.
+#. - This implies adding an explicit trust, and should not be granted
+#. without a secure authentication.
+#. - This is not kept as each package should be authenticated.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:59
-msgid "Refresh system sources"
-msgstr "AtsvaidzinÄt sistÄmas avotus"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:30
+msgid "Trust a key used for signing packages"
+msgstr "AtslÄga, ko izmantot pakotÅu parakstÄ«Å¡anai"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:31
+msgid ""
+"Authentication is required to consider a key used for signing packages as "
+"trusted"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai atslÄgu uzskatÄ«tu par derÄ«gu pakotÅu parakstÄ«Å¡anai ka derÄ«gÄm"
#. SECURITY:
-#. - Normal users require admin authentication to rebind a driver
-#. so that it works after we install firmware.
-#. - This should not be set to 'yes' as unprivileged users could then
-#. try to rebind drivers in use, for instance security authentication
-#. devices.
+#. - Normal users do not require admin authentication to accept new
+#. licence agreements.
+#. - Change this to 'auth_admin' for environments where users should not
+#. be given the option to make legal decisions.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:67
-msgid "Reload a device"
-msgstr "PÄrlÄdÄt ierÄ«ci"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:38
+msgid "Accept EULA"
+msgstr "PieÅemt licences lÄ«gumu"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:39
+msgid "Authentication is required to accept a EULA"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai pieÅemtu licences lÄ«gumu"
#. SECURITY:
#. - Normal users require admin authentication to remove packages as
@@ -1971,57 +1883,138 @@ msgstr "PÄrlÄdÄt ierÄ«ci"
#. be removed. If this is not possible, change this authentication to
#. 'auth_admin'.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:77
+#: ../policy/org.freedesktop.packagekit.policy.in.h:49
msgid "Remove package"
msgstr "IzÅemt pakotni"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:50
+msgid "Authentication is required to remove packages"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai izÅemtu pakotnes"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update the
+#. system as the packages will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:58
+msgid "Update packages"
+msgstr "AtjauninÄt pakotnes"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:59
+msgid "Authentication is required to update packages"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai uzlabotu pakotnes"
+
#. SECURITY:
#. - Normal users require admin authentication to rollback system state
#. as this will change a large number of packages, and could expose the
#. system to previously patched security vulnerabilities.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:83
+#: ../policy/org.freedesktop.packagekit.policy.in.h:65
msgid "Rollback to a previous transaction"
msgstr "AtritinÄt uz iepriekÅ¡Äjo transakciju"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:66
+msgid "Authentication is required to rollback a transaction"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai atritinÄtu transakciju"
+
+#. SECURITY:
+#. - Normal users require admin authentication to enable or disable
+#. software sources as this can be used to enable new updates or
+#. install different versions of software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:72
+msgid "Change software source parameters"
+msgstr "Mainītu programmatūras avotu parametrus"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:73
+msgid "Authentication is required to change software source parameters"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai mainÄ«tu programmatÅ«ras avotu parametrus"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to refresh the
+#. cache, as this doesn't actually install or remove software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:78
+msgid "Refresh system sources"
+msgstr "AtsvaidzinÄt sistÄmas avotus"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:79
+msgid "Authentication is required to refresh the system sources"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai atsvaidzinÄtu sistÄmas resursus"
+
#. SECURITY:
#. - Normal users do not require admin authentication to set the proxy
#. used for downloading packages.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:88
+#: ../policy/org.freedesktop.packagekit.policy.in.h:84
msgid "Set network proxy"
msgstr "Iestatīt tīkla starpniekserveri"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:85
+msgid ""
+"Authentication is required to set the network proxy used for downloading "
+"packages"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai iestatÄ«tu tÄ«kla starpnieku, ko izmantot pakotÅu lejupielÄdÄÅ¡anai"
+
#. SECURITY:
-#. - Normal users require admin authentication to add signing keys.
-#. - This implies adding an explicit trust, and should not be granted
-#. without a secure authentication.
-#. - This is not kept as each package should be authenticated.
+#. - This is used when users want to install to a different prefix, for
+#. instance to a LTSP image or a virtual machine.
+#. - This could be used to overwrite files not owned by the user using
+#. a carefully created package file.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:95
-msgid "Trust a key used for signing packages"
-msgstr "AtslÄga, ko izmantot pakotÅu parakstÄ«Å¡anai"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:92
+msgid "Change location that packages are installed"
+msgstr "MainÄ«t vietu, kur instalÄt pakotnes"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:93
+msgid ""
+"Authentication is required to change the location used to decompress "
+"packages"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai mainÄ«tu vietu, kur atspiež pakotnes"
#. SECURITY:
-#. - Normal users do not require admin authentication to update the
-#. system as the packages will be signed, and the action is required
-#. to update the system when unattended.
-#. - Changing this to anything other than 'yes' will break unattended
-#. updates.
+#. - Normal users require admin authentication to rebind a driver
+#. so that it works after we install firmware.
+#. - This should not be set to 'yes' as unprivileged users could then
+#. try to rebind drivers in use, for instance security authentication
+#. devices.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:103
-msgid "Update packages"
-msgstr "AtjauninÄt pakotnes"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:101
+msgid "Reload a device"
+msgstr "PÄrlÄdÄt ierÄ«ci"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:102
+msgid "Authentication is required to reload the device with a new driver"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai pÄrlÄdÄtu ierÄ«ci ar jaunu draiveri"
#. SECURITY:
#. - Normal users require admin authentication to upgrade the disto as
#. this can make the system unbootable or stop other applications from
#. working.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:109
+#: ../policy/org.freedesktop.packagekit.policy.in.h:108
msgid "Upgrade System"
msgstr "Uzlabot pakotnes"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:109
+msgid "Authentication is required to upgrade the operating system"
+msgstr "NepiecieÅ¡ama autentifikÄcija, lai uzlabotu operÄtÄjsistÄmu"
+
+#. SECURITY:
+#. - Normal users require admin authentication to repair the system
+#. since this can make the system unbootable or stop other
+#. applications from working.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:115
+msgid "Repair System"
+msgstr "Salabot sistÄmu"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:116
+msgid "Authentication is required to repair the installed software"
+msgstr "Vajag autentificÄties, lai salabotu un instalÄtu programmatÅ«ru"
+
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
#: ../src/pk-main.c:149
msgid "Packaging backend to use, e.g. dummy"
@@ -2055,7 +2048,7 @@ msgstr "Iziet pÄc dziÅa ielÄdes"
#. TRANSLATORS: don't unset environment variables, used for debugging
#: ../src/pk-main.c:167
msgid "Don't clear environment on startup"
-msgstr ""
+msgstr "StartÄjoties nevar attÄ«rÄ«t vidi"
#. TRANSLATORS: describing the service that is running
#: ../src/pk-main.c:179
@@ -2067,26 +2060,22 @@ msgid "Failed to load any of the specified backends:"
msgstr "NeizdevÄs ielÄdÄt nevienu no norÄdÄ«tajÄm aizmugurÄm:"
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2696
+#: ../src/pk-transaction.c:2972
msgid "The software is not from a trusted source."
msgstr "Programma nav no uzticama avota."
-#: ../src/pk-transaction.c:2704
+#: ../src/pk-transaction.c:2980
msgid "Do not update this package unless you are sure it is safe to do so."
msgstr "Neatjauniniet šo pakotni, ja vien jūs esat droši, ka to var darīt."
-#: ../src/pk-transaction.c:2705
+#: ../src/pk-transaction.c:2981
msgid "Do not update these packages unless you are sure it is safe to do so."
-msgstr ""
-"Neatjauniniet šīs pakotnes, ja vien esat droši, ka to var droši darīt."
+msgstr "Neatjauniniet šīs pakotnes, ja vien esat droši, ka to var droši darīt."
-#: ../src/pk-transaction.c:2715
+#: ../src/pk-transaction.c:2991
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr "NeinstalÄjiet Å¡o pakotni, ja vien jÅ«s esat droÅ¡i, ka to var darÄ«t."
-#: ../src/pk-transaction.c:2716
+#: ../src/pk-transaction.c:2992
msgid "Do not install these packages unless you are sure it is safe to do so."
-msgstr ""
-"NeinstalÄjiet Å¡Ä«s pakotnes, ja vien esat droÅ¡i, ka to var droÅ¡i darÄ«t."
-
-
+msgstr "NeinstalÄjiet Å¡Ä«s pakotnes, ja vien esat droÅ¡i, ka to var droÅ¡i darÄ«t."
diff --git a/po/nl.po b/po/nl.po
index 3dbd153..8e588e9 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -11,8 +11,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-01-17 12:15+0000\n"
-"PO-Revision-Date: 2012-02-29 09:16+0000\n"
+"POT-Creation-Date: 2012-03-01 11:08+0000\n"
+"PO-Revision-Date: 2012-04-18 17:05+0000\n"
"Last-Translator: Richard E. van der Luit <nippur at fedoraproject.org>\n"
"Language-Team: Dutch (http://www.transifex.net/projects/p/freedesktop/language/nl/)\n"
"MIME-Version: 1.0\n"
@@ -199,7 +199,7 @@ msgstr "Uitgegeven"
#. TRANSLATORS: details about the update, date the update was updated
#. TRANSLATORS: The action of the package, in past tense
-#: ../client/pk-console.c:387 ../lib/packagekit-glib2/pk-enum.c:1134
+#: ../client/pk-console.c:387 ../lib/packagekit-glib2/pk-enum.c:1135
msgid "Updated"
msgstr "Vernieuwd"
@@ -296,7 +296,7 @@ msgstr "De transactie faalde"
#. TRANSLATORS: print a message when there are no updates
#: ../client/pk-console.c:732
msgid "There are no updates available at this time."
-msgstr "Er zijn op dit moment geen vernieuwingen beschikbaar."
+msgstr "Er zijn op dit moment geen updates beschikbaar."
#: ../client/pk-console.c:755
msgid "There are no upgrades available at this time."
@@ -305,26 +305,26 @@ msgstr "Er zijn op dit moment geen upgrades beschikbaar."
#. TRANSLATORS: a package needs to restart their system
#: ../client/pk-console.c:822
msgid "Please restart the computer to complete the update."
-msgstr "Herstart de computer om de vernieuwing af te maken."
+msgstr "Herstart de computer om de update af te maken."
#. TRANSLATORS: a package needs to restart the session
#: ../client/pk-console.c:825
msgid "Please logout and login to complete the update."
-msgstr "Log uit en weer in om de vernieuwing af te maken."
+msgstr "Log uit en weer in om de update af te maken."
#. TRANSLATORS: a package needs to restart their system (due to security)
#: ../client/pk-console.c:828
msgid ""
"Please restart the computer to complete the update as important security "
"updates have been installed."
-msgstr "Herstart de computer om de vernieuwing af te maken omdat belangrijke beveiliging vernieuwingen geïnstalleerd zijn."
+msgstr "Herstart de computer om de update af te maken omdat belangrijke beveiligingsupdates geïnstalleerd zijn."
#. TRANSLATORS: a package needs to restart the session (due to security)
#: ../client/pk-console.c:831
msgid ""
"Please logout and login to complete the update as important security updates"
" have been installed."
-msgstr "Log uit en weer in om de vernieuwing af te maken omdat belangrijke beveiliging vernieuwingen geïnstalleerd zijn."
+msgstr "Log uit en weer in om de update af te maken omdat belangrijke beveiliging vernieuwingen geïnstalleerd zijn."
#. TRANSLATORS: The user used 'pkcon install dave.rpm' rather than 'pkcon
#. install-local dave.rpm'
@@ -333,7 +333,7 @@ msgstr "Log uit en weer in om de vernieuwing af te maken omdat belangrijke bevei
msgid ""
"Expected package name, actually got file. Try using 'pkcon install-local %s'"
" instead."
-msgstr "Verwachtte pakket naam, maar kreeg een bestand. Probeer in plaats daarvan 'pkcon install-local %s' te gebruiken."
+msgstr "Verwachtte pakketnaam, maar kreeg een bestand. Probeer in plaats daarvan 'pkcon install-local %s' te gebruiken."
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
@@ -380,7 +380,7 @@ msgstr "De daemon is midden in de transactie gecrasht!"
#. TRANSLATORS: This is the header to the --help menu
#: ../client/pk-console.c:1157
msgid "PackageKit Console Interface"
-msgstr "PackageKit console interface"
+msgstr "PackageKit console-interface"
#. these are commands we can use with pkcon
#: ../client/pk-console.c:1159
@@ -391,27 +391,27 @@ msgstr "Sub-opdrachten:"
#. last executed
#: ../client/pk-console.c:1241
msgid "Failed to get the time since this action was last completed"
-msgstr "Verkrijgen van de tijd sinds deze actie voor het laatst afgemaakt is faalde"
+msgstr "Verkrijgen van de tijd die verlopen is sinds deze actie voor het laatst werd afgerond faalde"
#. TRANSLATORS: command line argument, just show the version string
#: ../client/pk-console.c:1283 ../client/pk-monitor.c:370
msgid "Show the program version and exit"
-msgstr "Programma versie tonen en afsluiten"
+msgstr "Programmaversie tonen en afsluiten"
#. TRANSLATORS: command line argument, use a filter to narrow down results
#: ../client/pk-console.c:1286
msgid "Set the filter, e.g. installed"
-msgstr "Filter instellen, bijvoorbeeld geïnstalleerd"
+msgstr "Filter instellen, bijvoorbeeld 'geïnstalleerd'"
#. TRANSLATORS: command line argument, use a non-standard install prefix
#: ../client/pk-console.c:1289
msgid "Set the install root, e.g. '/' or '/mnt/ltsp'"
-msgstr "Stel de installeer root in, b.v. '/' of '/mnt/ltsp'"
+msgstr "Stel de root voor installatie in, b.v. '/' of '/mnt/ltsp'"
#. TRANSLATORS: command line argument, work asynchronously
#: ../client/pk-console.c:1292
msgid "Exit without waiting for actions to complete"
-msgstr "Afsluiten zonder te wachten tot transacties zijn afgerond"
+msgstr "Afsluiten zonder wachten tot transacties zijn afgerond"
#. command line argument, do we ask questions
#: ../client/pk-console.c:1295
@@ -422,7 +422,7 @@ msgstr "Installeer het pakket zonder goedkeuring te vragen"
#. TRANSLATORS: command line argument, this command is not a priority
#: ../client/pk-console.c:1298
msgid "Run the command using idle network bandwidth and also using less power"
-msgstr "Voer het commando uit met gebruik van onbenutte netwerk bandbreedte en ook om minder vermogen te gebruiken"
+msgstr "Voer het commando uit met gebruik van onbenutte netwerkbandbreedte en ook met minder stroomverbruik"
#. TRANSLATORS: command line argument, just output without fancy formatting
#: ../client/pk-console.c:1301
@@ -434,17 +434,17 @@ msgstr "Print op het scherm een machine-leesbare output, in plaats van geanimeer
#. TRANSLATORS: command line argument, just output without fancy formatting
#: ../client/pk-console.c:1304
msgid "The maximum metadata cache age. Use -1 for 'never'."
-msgstr "De maximum metadata cache leeftijd. Gebruik -1 voor 'nooit'."
+msgstr "De maximum leeftijd van de metadata-cache. Gebruik -1 voor 'nooit'."
#. TRANSLATORS: command line argument, --help
#: ../client/pk-console.c:1307
msgid "Show help options."
-msgstr "Toon help opties."
+msgstr "Toon hulp-opties."
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1338
msgid "Failed to parse command line"
-msgstr "Parsen command line mislukt"
+msgstr "Parsen commandoregel mislukt"
#. TRANSLATORS: we failed to contact the daemon
#: ../client/pk-console.c:1348
@@ -459,7 +459,7 @@ msgstr "De proxy kon niet ingesteld worden"
#. TRANSLATORS: The user specified an incorrect filter
#: ../client/pk-console.c:1413
msgid "The install root could not be set"
-msgstr "De installeer root kon niet ingesteld worden"
+msgstr "De installatieroot kon niet ingesteld worden"
#. TRANSLATORS: The user specified an incorrect filter
#: ../client/pk-console.c:1425
@@ -469,7 +469,7 @@ msgstr "Het opgegeven filter was ongeldig"
#. TRANSLATORS: a search type can be name, details, file, etc
#: ../client/pk-console.c:1444
msgid "A search type is required, e.g. name"
-msgstr "Een zoek type is verplicht, b.v. naam"
+msgstr "Een zoektype is verplicht, b.v. naam"
#. TRANSLATORS: the user needs to provide a search term
#: ../client/pk-console.c:1451 ../client/pk-console.c:1463
@@ -480,12 +480,12 @@ msgstr "Een zoekterm is vereist"
#. TRANSLATORS: the search type was provided, but invalid
#: ../client/pk-console.c:1497
msgid "Invalid search type"
-msgstr "Ongeldig zoek type"
+msgstr "Ongeldig zoektype"
#. TRANSLATORS: the user did not specify what they wanted to install
#: ../client/pk-console.c:1503
msgid "A package name to install is required"
-msgstr "Een pakket naam om te installeren is vereist"
+msgstr "Een pakketnaam om te installeren is vereist"
#. TRANSLATORS: the user did not specify what they wanted to install
#: ../client/pk-console.c:1512
@@ -500,13 +500,13 @@ msgstr "Er moet een type worden opgegeven, key_id of package_id"
#. TRANSLATORS: the user did not specify what they wanted to remove
#: ../client/pk-console.c:1534
msgid "A package name to remove is required"
-msgstr "Een te verwijderen pakket naam is vereist"
+msgstr "Een te verwijderen pakketnaam is vereist"
#. TRANSLATORS: the user did not specify anything about what to download or
#. where
#: ../client/pk-console.c:1543
msgid "A destination directory and the package names to download are required"
-msgstr "Een doel map en de namen van te downloaden pakketten zijn vereist"
+msgstr "Een doelmap en de namen van te downloaden pakketten zijn vereist"
#. TRANSLATORS: the directory does not exist, so we can't continue
#: ../client/pk-console.c:1550
@@ -516,17 +516,17 @@ msgstr "Map niet gevonden"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
#: ../client/pk-console.c:1559
msgid "A licence identifier (eula-id) is required"
-msgstr "Een licentie identificatie (eula-id) is vereist"
+msgstr "Een licentie-identificatie (eula-id) is vereist"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
#: ../client/pk-console.c:1570
msgid "A transaction identifier (tid) is required"
-msgstr "Een transactie identificatie (tid) is vereist"
+msgstr "Een transactie-identificatie (tid) is vereist"
#. TRANSLATORS: The user did not specify a package name
#: ../client/pk-console.c:1591
msgid "A package name to resolve is required"
-msgstr "Een pakket naam om op te lossen is vereist"
+msgstr "Een pakketnaam om op te lossen is vereist"
#. TRANSLATORS: The user did not specify a repository (software source) name
#: ../client/pk-console.c:1602 ../client/pk-console.c:1613
@@ -536,7 +536,7 @@ msgstr "Een naam van een repository is vereist"
#. TRANSLATORS: The user didn't provide any data
#: ../client/pk-console.c:1624
msgid "A repo name, parameter and value are required"
-msgstr "Een repo naam, parameter en waarde zijn vereist"
+msgstr "Een repo-naam, parameter en waarde zijn vereist"
#. TRANSLATORS: The user didn't specify what action to use
#: ../client/pk-console.c:1641
@@ -554,13 +554,13 @@ msgstr "Een correcte rol is vereist"
#: ../client/pk-console.c:1681 ../client/pk-console.c:1701
#: ../client/pk-console.c:1710 ../client/pk-generate-pack.c:314
msgid "A package name is required"
-msgstr "Een pakket naam is vereist"
+msgstr "Een pakketnaam is vereist"
#. TRANSLATORS: each package "provides" certain things, e.g. mime(gstreamer-
#. decoder-mp3), the user didn't specify it
#: ../client/pk-console.c:1690
msgid "A package provide string is required"
-msgstr "Een pakket geleverd string is vereist"
+msgstr "Een 'pakket levert' string is vereist"
#. TRANSLATORS: The user did not provide a distro name
#: ../client/pk-console.c:1734
@@ -582,34 +582,34 @@ msgstr "Optie '%s' wordt niet ondersteund"
#. TRANSLATORS: Generic failure of what they asked to do
#: ../client/pk-console.c:1805
msgid "Command failed"
-msgstr "Opdracht mislukt"
+msgstr "Opdracht is niet gelukt"
#. TRANSLATORS: we can exclude certain packages (glibc) when we know they'll
#. exist on the target
#: ../client/pk-generate-pack.c:252
msgid "Set the file name of dependencies to be excluded"
-msgstr "Stel de bestandsnamen van afhankelijkheden in die moeten worden uitgesloten"
+msgstr "Bepaal de bestandsnamen van afhankelijkheden die moeten worden uitgesloten"
#. TRANSLATORS: the output location
#: ../client/pk-generate-pack.c:255
msgid ""
"The output file or directory (the current directory is used if omitted)"
-msgstr "Het doel bestand of map (de huidige map wordt gebruikt als dit niet wordt opgegeven)"
+msgstr "Het doelbestand of map (de huidige map wordt gebruikt als dit niet wordt opgegeven)"
#. TRANSLATORS: put a list of packages in the pack
#: ../client/pk-generate-pack.c:258
msgid "The package to be put into the service pack"
-msgstr "Het pakket dat in het service pack zal worden opgenomen"
+msgstr "Het pakket dat in het servicepack zal worden opgenomen"
#. TRANSLATORS: put all pending updates in the pack
#: ../client/pk-generate-pack.c:261
msgid "Put all updates available in the service pack"
-msgstr "Plaats alle beschikbare vernieuwingen in het service pack"
+msgstr "Plaats alle beschikbare vernieuwingen in het servicepack"
#. TRANSLATORS: This is when the user fails to supply the correct arguments
#: ../client/pk-generate-pack.c:298
msgid "Neither --package or --updates option selected."
-msgstr "--package noch --updates als optie geselecteerd."
+msgstr "Geen --package of --updates als optie geselecteerd."
#. TRANSLATORS: This is when the user fails to supply just one argument
#: ../client/pk-generate-pack.c:306
@@ -619,13 +619,13 @@ msgstr "Beide opties geselecteerd."
#. TRANSLATORS: This is when the user fails to supply the output
#: ../client/pk-generate-pack.c:322
msgid "A output directory or file name is required"
-msgstr "Een output map of bestandsnaam is vereist"
+msgstr "Een outputmap of bestandsnaam is vereist"
#. TRANSLATORS: This is when the daemon is not-installed/broken and fails to
#. startup
#: ../client/pk-generate-pack.c:340
msgid "The daemon failed to startup"
-msgstr "De daemon faalde om op te starten"
+msgstr "De daemon faalde op te starten"
#. TRANSLATORS: This is when the backend doesn't have the capability to get-
#. depends
@@ -633,7 +633,7 @@ msgstr "De daemon faalde om op te starten"
#. download
#: ../client/pk-generate-pack.c:351 ../client/pk-generate-pack.c:357
msgid "The package manager cannot perform this type of operation."
-msgstr "De pakket beheerder kan dit type operatie niet uitvoeren."
+msgstr "De pakketbeheerder kan dit type operatie niet uitvoeren."
#. TRANSLATORS: This is when the distro didn't include libarchive support into
#. PK
@@ -641,13 +641,13 @@ msgstr "De pakket beheerder kan dit type operatie niet uitvoeren."
msgid ""
"Service packs cannot be created as PackageKit was not built with libarchive "
"support."
-msgstr "Service packs kon niet worden gecreëerd omdat PackageKit niet met libarchive ondersteuning is gebouwd."
+msgstr "Servicepacks kon niet worden gecreëerd omdat PackageKit niet met libarchive-ondersteuning is gebouwd."
#. TRANSLATORS: the user specified an absolute path, but didn't get the
#. extension correct
#: ../client/pk-generate-pack.c:375
msgid "If specifying a file, the service pack name must end with"
-msgstr "Bij het specificeren van een bestand moet de service pack naam eindigen op"
+msgstr "Bij het specificeren van een bestand moet de servicepacknaam eindigen op"
#. TRANSLATORS: This is when file already exists
#: ../client/pk-generate-pack.c:391
@@ -669,12 +669,12 @@ msgstr "Aanmaken map mislukt:"
#. cannot be opened
#: ../client/pk-generate-pack.c:419
msgid "Failed to open package list."
-msgstr "Pakket lijst openen is niet gelukt."
+msgstr "Pakketlijst openen is niet gelukt."
#. TRANSLATORS: The package name is being matched up to available packages
#: ../client/pk-generate-pack.c:428
msgid "Finding package name."
-msgstr "Pakket naam wordt opgezocht."
+msgstr "Pakketnaam wordt opgezocht."
#. TRANSLATORS: This is when the package cannot be found in any software
#. source. The detailed error follows
@@ -687,13 +687,13 @@ msgstr "Pakket '%s' werd niet gevonden: %s"
#. pack
#: ../client/pk-generate-pack.c:440
msgid "Creating service pack..."
-msgstr "Service pack wordt aangemaakt...."
+msgstr "Servicepack wordt aangemaakt...."
#. TRANSLATORS: we succeeded in making the file
#: ../client/pk-generate-pack.c:455
#, c-format
msgid "Service pack created '%s'"
-msgstr "Service pack aangemaakt '%s'"
+msgstr "Servicepack aangemaakt '%s'"
#. TRANSLATORS: we failed to make te file
#: ../client/pk-generate-pack.c:460
@@ -703,7 +703,7 @@ msgstr "'%s' aanmaken niet gelukt: %s"
#: ../client/pk-monitor.c:283
msgid "Failed to get daemon state"
-msgstr "Daemon status verkrijgen mislukte."
+msgstr "Daemonstatus verkrijgen mislukte."
#: ../client/pk-monitor.c:348
msgid "Failed to get properties"
@@ -717,7 +717,7 @@ msgstr "PackageKit monitor"
#. TRANSLATORS: when we are getting data from the daemon
#: ../contrib/browser-plugin/pk-plugin-install.c:503
msgid "Getting package information..."
-msgstr "Pakket informatie verkrijgen......"
+msgstr "Pakketinformatie verkrijgen......"
#. TRANSLATORS: run an applicaiton
#: ../contrib/browser-plugin/pk-plugin-install.c:509
@@ -761,7 +761,7 @@ msgstr "Versie"
#. TRANSLATORS: noting found, so can't install
#: ../contrib/browser-plugin/pk-plugin-install.c:549
msgid "No packages found for your system"
-msgstr "Geen pakketten voor jouw systeem gevonden"
+msgstr "Geen pakketten voor dit systeem gevonden"
#. TRANSLATORS: package is being installed
#: ../contrib/browser-plugin/pk-plugin-install.c:554
@@ -771,17 +771,17 @@ msgstr "Bezig met installeren..."
#. TRANSLATORS: downloading repo data so we can search
#: ../contrib/command-not-found/pk-command-not-found.c:363
msgid "Downloading details about the software sources."
-msgstr "Download details over de software bronnen."
+msgstr "Downloaddetails over de softwarebronnen."
#. TRANSLATORS: downloading file lists so we can search
#: ../contrib/command-not-found/pk-command-not-found.c:367
msgid "Downloading filelists (this may take some time to complete)."
-msgstr "Bestand lijsten downloaden (dit kan enige tijd duren)."
+msgstr "Bestandslijsten downloaden (dit kan enige tijd duren)."
#. TRANSLATORS: waiting for native lock
#: ../contrib/command-not-found/pk-command-not-found.c:371
msgid "Waiting for package manager lock."
-msgstr "Wachten op pakket beheerder blokkering."
+msgstr "Wachten op vergrendeling door pakketmanager."
#. TRANSLATORS: loading package cache so we can search
#: ../contrib/command-not-found/pk-command-not-found.c:375
@@ -796,7 +796,7 @@ msgstr "Zoeken naar bestand mislukte"
#. TRANSLATORS: the transaction failed in a way we could not expect
#: ../contrib/command-not-found/pk-command-not-found.c:451
msgid "Getting the list of files failed"
-msgstr "Ophalen bestandenlijst niet gelukt"
+msgstr "Ophalen bestandslijst niet gelukt"
#. TRANSLATORS: we failed to launch the executable, the error follows
#: ../contrib/command-not-found/pk-command-not-found.c:597
@@ -823,7 +823,7 @@ msgstr "Een vergelijkbaar commando is:"
#. TRANSLATORS: Ask the user if we should run the similar command
#: ../contrib/command-not-found/pk-command-not-found.c:757
msgid "Run similar command:"
-msgstr "Draai vergelijkbaar commando:"
+msgstr "Voer vergelijkbaar commando uit:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
@@ -835,7 +835,7 @@ msgstr "Vergelijkbare commando's zijn:"
#. TRANSLATORS: ask the user to choose a file to run
#: ../contrib/command-not-found/pk-command-not-found.c:787
msgid "Please choose a command to run"
-msgstr "Kies een commando om te draaien"
+msgstr "Kies een commando om uit te voeren"
#. TRANSLATORS: tell the user what package provides the command
#: ../contrib/command-not-found/pk-command-not-found.c:805
@@ -875,20 +875,20 @@ msgstr "Starten met installeren"
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:407
#, c-format
msgid "Failed to find the package %s, or already installed: %s"
-msgstr "Pakket %s vinden misluktu, of is reeds geïnstalleerd: %s"
+msgstr "Pakket %s vinden mislukte, of is reeds geïnstalleerd: %s"
#. command line argument, simulate what would be done, but don't actually do
#. it
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:516
msgid ""
"Don't actually install any packages, only simulate what would be installed"
-msgstr "Er worden geen pakketten geïnstalleerd, alleen een simulatie van wat geïnstalleerd moet worden"
+msgstr "Er worden geen pakketten geïnstalleerd, alleen een simulatie van wat geïnstalleerd zou worden"
#. command line argument, do we skip packages that depend on the ones
#. specified
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:519
msgid "Do not install dependencies of the core packages"
-msgstr "Installeer geen afhankelijkheden van de kern pakketten"
+msgstr "Installeer geen afhankelijkheden van de kernpakketten"
#. command line argument, do we operate quietly
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:522
@@ -898,20 +898,20 @@ msgstr "Laat geen informatie of voortgang zien"
#. TRANSLATORS: tool that gets called when the command is not found
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:542
msgid "PackageKit Debuginfo Installer"
-msgstr "PackageKit debuginfo installer"
+msgstr "PackageKit Debuginfo Installer"
#. TRANSLATORS: the use needs to specify a list of package names on the
#. command line
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:556
#, c-format
msgid "ERROR: Specify package names to install."
-msgstr "FOUT: Specificeer de te installeren pakket namen."
+msgstr "FOUT: Specificeer de te installeren pakketnamen."
#. TRANSLATORS: we are getting the list of repositories
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:592
#, c-format
msgid "Getting sources list"
-msgstr "Ophalen bronnen lijst"
+msgstr "Ophalen bronnenlijst"
#. TRANSLATORS: operation was not successful
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:602
@@ -945,7 +945,7 @@ msgstr "Vond %i aangezette en %i uitgezette bronnen."
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:627
#, c-format
msgid "Finding debugging sources"
-msgstr "Zoeken naar debug bronnen"
+msgstr "Zoeken naar debugbronnen"
#. TRANSLATORS: tell the user what we found
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:660
@@ -963,13 +963,13 @@ msgstr "Debug bronnen aanzetten"
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:695
#, c-format
msgid "Enabled %i debugging sources."
-msgstr "%i debug bronnen aangezet."
+msgstr "%i debugbronnen aangezet."
#. TRANSLATORS: we're now finding packages that match in all the repos
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:702
#, c-format
msgid "Finding debugging packages"
-msgstr "Zoeken naar debug pakketten"
+msgstr "Zoeken naar debugpakketten"
#. TRANSLATORS: we couldn't find the package name, non-fatal
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:714
@@ -981,7 +981,7 @@ msgstr "Pakket %s vinden mislukte: %s"
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:737
#, c-format
msgid "Failed to find the debuginfo package %s: %s"
-msgstr "Debug info pakket %s niet gevonden: %s"
+msgstr "Debuginfo-pakket %s niet gevonden: %s"
#. TRANSLATORS: no debuginfo packages could be found to be installed
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:765
@@ -1005,7 +1005,7 @@ msgstr "Zoeken naar pakketten die afhangen van deze pakketten"
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:808
#, c-format
msgid "Could not find dependent packages: %s"
-msgstr "Kon afhankelijke paketten niet vinden: %s"
+msgstr "Kon afhankelijke pakketten niet vinden: %s"
#. TRANSLATORS: tell the user we found some more packages
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:824
@@ -1031,7 +1031,7 @@ msgstr "Vond %i pakketten om te installeren:"
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:850
#, c-format
msgid "Not installing packages in simulate mode"
-msgstr "Pakketten niet installeren in de simulatie mode"
+msgstr "In simulatiemodus worden pakketten niet geïnstalleerd"
#. TRANSLATORS: we are now installing the debuginfo packages we found earlier
#. TRANSLATORS: transaction state, installing packages
@@ -1058,13 +1058,13 @@ msgstr "Uitzetten van bronnen die eerst aangezet waren"
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:919
#, c-format
msgid "Could not disable the debugging sources: %s"
-msgstr "Kon de debug bronnen %s niet uitzetten"
+msgstr "Kon de debugbronnen %s niet uitzetten"
#. TRANSLATORS: we disabled all the debugging repos that we enabled before
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:934
#, c-format
msgid "Disabled %i debugging sources."
-msgstr "%i debug bronnen uitgezet."
+msgstr "%i debugbronnen uitgezet."
#. TRANSLATORS: couldn't open device to write
#: ../contrib/device-rebind/pk-device-rebind.c:62
@@ -1090,63 +1090,63 @@ msgstr "Schijf kon niet gevonden worden"
#. TRANSLATORS: we failed to release the current driver
#: ../contrib/device-rebind/pk-device-rebind.c:203
msgid "Failed to unregister driver"
-msgstr "Driver uitschrijven mislukte"
+msgstr "Stuurprogramma uitschrijven mislukte"
#. TRANSLATORS: we failed to bind the old driver
#: ../contrib/device-rebind/pk-device-rebind.c:212
msgid "Failed to register driver"
-msgstr "Driver inschrijven mislukte"
+msgstr "Stuurprogramma registreren mislukte"
#. TRANSLATORS: user did not specify a device sysfs path that exists
#: ../contrib/device-rebind/pk-device-rebind.c:261
msgid "Device path not found"
-msgstr "Apparaat pad niet gevonden"
+msgstr "Apparaatpad niet gevonden"
#. TRANSLATORS: user did not specify a valid device sysfs path
#: ../contrib/device-rebind/pk-device-rebind.c:269
msgid "Incorrect device path specified"
-msgstr "Onjuist apparaat pad opgegeven"
+msgstr "Onjuist apparaatpad opgegeven"
#: ../contrib/device-rebind/pk-device-rebind.c:294
msgid "Show extra debugging information"
-msgstr "Extra debug informatie tonen"
+msgstr "Extra debuginformatie tonen"
#. command line argument, simulate what would be done, but don't actually do
#. it
#: ../contrib/device-rebind/pk-device-rebind.c:297
msgid "Don't actually touch the hardware, only simulate what would be done"
-msgstr "De hardware wordt niet aangeraakt, alleen een simulatie van wat er zal gebeuren"
+msgstr "Hardware niet benaderen, alleen simuleren wat er zal gebeuren"
#. TRANSLATORS: command line option: a list of files to install
#: ../contrib/device-rebind/pk-device-rebind.c:300
msgid "Device paths"
-msgstr "Apparaat paden"
+msgstr "Apparaatpaden"
#. TRANSLATORS: tool that gets called when the device needs reloading after
#. installing firmware
#: ../contrib/device-rebind/pk-device-rebind.c:315
msgid "PackageKit Device Reloader"
-msgstr "PackageKit apparaat her-lader"
+msgstr "PackageKit Device Reloader"
#. TRANSLATORS: user did not specify a valid device sysfs path
#: ../contrib/device-rebind/pk-device-rebind.c:323
msgid "You need to specify at least one valid device path"
-msgstr "Je moet tenminste een geldig apparaat pad opgeven"
+msgstr "Je moet tenminste een geldig apparaatpad opgeven"
#. TRANSLATORS: user did not specify a valid device sysfs path
#: ../contrib/device-rebind/pk-device-rebind.c:333
msgid "This script can only be used by the root user"
-msgstr "Dit script kan alleen door de root gebruiker gebruikt worden"
+msgstr "Dit script kan alleen door de rootgebruiker gebruikt worden"
#. TRANSLATORS: we're going to verify the path first
#: ../contrib/device-rebind/pk-device-rebind.c:342
msgid "Verifying device path"
-msgstr "Verifiëren van apparaat pad"
+msgstr "Verifiëren van apparaatpad"
#. TRANSLATORS: user did not specify a device sysfs path that exists
#: ../contrib/device-rebind/pk-device-rebind.c:347
msgid "Failed to verify device path"
-msgstr "Apparaat pad verifiëren mislukte"
+msgstr "Apparaatpad verifiëren mislukte"
#. TRANSLATORS: we're going to try
#: ../contrib/device-rebind/pk-device-rebind.c:361
@@ -1164,11 +1164,11 @@ msgstr "PackageKit catalogus"
#: ../data/packagekit-package-list.xml.in.h:1
msgid "PackageKit Package List"
-msgstr "PackageKit pakket lijst"
+msgstr "PackageKit pakketlijst"
#: ../data/packagekit-servicepack.xml.in.h:1
msgid "PackageKit Service Pack"
-msgstr "PackageKit service pack"
+msgstr "PackageKit servicepack"
#: ../lib/packagekit-glib2/pk-console-shared.c:65
#, c-format
@@ -1225,7 +1225,7 @@ msgstr "Pakketten verwijderen"
#. TRANSLATORS: transaction state, downloading package files
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:327
-#: ../lib/packagekit-glib2/pk-enum.c:1287
+#: ../lib/packagekit-glib2/pk-enum.c:1288
msgid "Downloading packages"
msgstr "Pakketten aan het downloaden"
@@ -1264,7 +1264,7 @@ msgstr "Ondertekeningen controleren"
#. TRANSLATORS: transaction state, when we return to a previous system state
#. TRANSLATORS: The role of the transaction, in present tense
#: ../lib/packagekit-glib2/pk-console-shared.c:359
-#: ../lib/packagekit-glib2/pk-enum.c:1247
+#: ../lib/packagekit-glib2/pk-enum.c:1248
msgid "Rolling back"
msgstr "Terug draaien"
@@ -1297,7 +1297,7 @@ msgstr "Afbreken"
#. TRANSLATORS: transaction state, downloading metadata
#: ../lib/packagekit-glib2/pk-console-shared.c:383
msgid "Downloading repository information"
-msgstr "Repository informatie downloaden"
+msgstr "Repository-informatie downloaden"
#. TRANSLATORS: transaction state, downloading metadata
#: ../lib/packagekit-glib2/pk-console-shared.c:387
@@ -1307,7 +1307,7 @@ msgstr "Lijst van pakketten downloaden"
#. TRANSLATORS: transaction state, downloading metadata
#: ../lib/packagekit-glib2/pk-console-shared.c:391
msgid "Downloading file lists"
-msgstr "Bestand lijsten downloaden"
+msgstr "Bestandslijsten downloaden"
#. TRANSLATORS: transaction state, downloading metadata
#: ../lib/packagekit-glib2/pk-console-shared.c:395
@@ -1322,7 +1322,7 @@ msgstr "Groepen downloaden"
#. TRANSLATORS: transaction state, downloading metadata
#: ../lib/packagekit-glib2/pk-console-shared.c:403
msgid "Downloading update information"
-msgstr "Pakket informatie downloaden"
+msgstr "Pakketinformatie downloaden"
#. TRANSLATORS: transaction state, repackaging delta files
#: ../lib/packagekit-glib2/pk-console-shared.c:407
@@ -1343,13 +1343,13 @@ msgstr "Toepassingen doorzoeken"
#. the system
#: ../lib/packagekit-glib2/pk-console-shared.c:419
msgid "Generating package lists"
-msgstr "Pakket lijst aanmaken"
+msgstr "Pakketlijst aanmaken"
#. TRANSLATORS: transaction state, when we're waiting for the native tools to
#. exit
#: ../lib/packagekit-glib2/pk-console-shared.c:423
msgid "Waiting for package manager lock"
-msgstr "Wachten op pakket beheerder blokkering"
+msgstr "Wachten op vergrendeling door pakketmanager"
#. TRANSLATORS: transaction state, waiting for user to type in a password
#: ../lib/packagekit-glib2/pk-console-shared.c:427
@@ -1386,271 +1386,271 @@ msgstr "Toon debug informatie voor alle bestanden"
#: ../lib/packagekit-glib2/pk-debug.c:201
msgid "Debugging Options"
-msgstr "Debug opties"
+msgstr "Debugopties"
#: ../lib/packagekit-glib2/pk-debug.c:201
msgid "Show debugging options"
-msgstr "Laat debug opties zien"
+msgstr "Laat debugopties zien"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-enum.c:1022
+#: ../lib/packagekit-glib2/pk-enum.c:1023
msgid "Trivial"
msgstr "Triviaal"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-enum.c:1026
+#: ../lib/packagekit-glib2/pk-enum.c:1027
msgid "Normal"
msgstr "Normaal"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-enum.c:1030
+#: ../lib/packagekit-glib2/pk-enum.c:1031
msgid "Important"
msgstr "Belangrijk"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-enum.c:1034
+#: ../lib/packagekit-glib2/pk-enum.c:1035
msgid "Security"
msgstr "Beveiliging"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-enum.c:1038
+#: ../lib/packagekit-glib2/pk-enum.c:1039
msgid "Bug fix "
msgstr "Fout reparatie"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-enum.c:1042
+#: ../lib/packagekit-glib2/pk-enum.c:1043
msgid "Enhancement"
msgstr "Verbetering"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-enum.c:1046
+#: ../lib/packagekit-glib2/pk-enum.c:1047
msgid "Blocked"
msgstr "Geblokkeerd"
#. TRANSLATORS: The state of a package
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-enum.c:1051
-#: ../lib/packagekit-glib2/pk-enum.c:1138
+#: ../lib/packagekit-glib2/pk-enum.c:1052
+#: ../lib/packagekit-glib2/pk-enum.c:1139
msgid "Installed"
msgstr "Geïnstalleerd"
#. TRANSLATORS: The state of a package, i.e. not installed
-#: ../lib/packagekit-glib2/pk-enum.c:1056
+#: ../lib/packagekit-glib2/pk-enum.c:1057
msgid "Available"
msgstr "Beschikbaar"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1081
+#: ../lib/packagekit-glib2/pk-enum.c:1082
msgid "Downloading"
msgstr "Downloaden"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1085
+#: ../lib/packagekit-glib2/pk-enum.c:1086
msgid "Updating"
msgstr "Vernieuwen"
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1089
-#: ../lib/packagekit-glib2/pk-enum.c:1223
+#: ../lib/packagekit-glib2/pk-enum.c:1090
+#: ../lib/packagekit-glib2/pk-enum.c:1224
msgid "Installing"
msgstr "Installeren"
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1093
-#: ../lib/packagekit-glib2/pk-enum.c:1219
+#: ../lib/packagekit-glib2/pk-enum.c:1094
+#: ../lib/packagekit-glib2/pk-enum.c:1220
msgid "Removing"
msgstr "Verwijderen"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1097
+#: ../lib/packagekit-glib2/pk-enum.c:1098
msgid "Cleaning up"
msgstr "Opschonen"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1101
+#: ../lib/packagekit-glib2/pk-enum.c:1102
msgid "Obsoleting"
-msgstr "Verouderd maken"
+msgstr "Als obsolete aanmerken"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1105
+#: ../lib/packagekit-glib2/pk-enum.c:1106
msgid "Reinstalling"
msgstr "Opnieuw installeren"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-enum.c:1130
+#: ../lib/packagekit-glib2/pk-enum.c:1131
msgid "Downloaded"
msgstr "Gedownload "
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-enum.c:1142
+#: ../lib/packagekit-glib2/pk-enum.c:1143
msgid "Removed"
msgstr "Verwijderd"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-enum.c:1146
+#: ../lib/packagekit-glib2/pk-enum.c:1147
msgid "Cleaned up"
msgstr "Opgeschoond"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-enum.c:1150
+#: ../lib/packagekit-glib2/pk-enum.c:1151
msgid "Obsoleted"
-msgstr "Verouderd"
+msgstr "Als obsolete aangemerkt"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-enum.c:1154
+#: ../lib/packagekit-glib2/pk-enum.c:1155
msgid "Reinstalled"
msgstr "Opnieuw geïnstalleerd"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1179
+#: ../lib/packagekit-glib2/pk-enum.c:1180
msgid "Unknown role type"
-msgstr "Onbekend rol type"
+msgstr "Onbekend roltype"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1183
+#: ../lib/packagekit-glib2/pk-enum.c:1184
msgid "Getting dependencies"
msgstr "Afhankelijkheden ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1187
+#: ../lib/packagekit-glib2/pk-enum.c:1188
msgid "Getting update details"
-msgstr "Vernieuwing details ophalen"
+msgstr "Updatedetails ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1191
+#: ../lib/packagekit-glib2/pk-enum.c:1192
msgid "Getting details"
msgstr "Details ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1195
+#: ../lib/packagekit-glib2/pk-enum.c:1196
msgid "Getting requires"
msgstr "Vereisten ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1199
+#: ../lib/packagekit-glib2/pk-enum.c:1200
msgid "Getting updates"
-msgstr "Vernieuwingen ophalen"
+msgstr "Updates ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1203
+#: ../lib/packagekit-glib2/pk-enum.c:1204
msgid "Searching by details"
msgstr "Opzoeken volgens details"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1207
+#: ../lib/packagekit-glib2/pk-enum.c:1208
msgid "Searching by file"
msgstr "Opzoeken volgens bestand"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1211
+#: ../lib/packagekit-glib2/pk-enum.c:1212
msgid "Searching groups"
msgstr "Opzoeken volgens groepen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1215
+#: ../lib/packagekit-glib2/pk-enum.c:1216
msgid "Searching by name"
msgstr "Opzoeken volgens naam"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1227
+#: ../lib/packagekit-glib2/pk-enum.c:1228
msgid "Installing files"
msgstr "Bestanden installeren"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1231
+#: ../lib/packagekit-glib2/pk-enum.c:1232
msgid "Refreshing cache"
msgstr "Cache verversen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1235
+#: ../lib/packagekit-glib2/pk-enum.c:1236
msgid "Updating packages"
msgstr "Pakketten vernieuwen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1239
+#: ../lib/packagekit-glib2/pk-enum.c:1240
msgid "Updating system"
msgstr "Systeem vernieuwen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1243
+#: ../lib/packagekit-glib2/pk-enum.c:1244
msgid "Canceling"
msgstr "Afbreken"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1251
+#: ../lib/packagekit-glib2/pk-enum.c:1252
msgid "Getting repositories"
msgstr "Repositories ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1255
+#: ../lib/packagekit-glib2/pk-enum.c:1256
msgid "Enabling repository"
msgstr "Repository aanzetten"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1259
+#: ../lib/packagekit-glib2/pk-enum.c:1260
msgid "Setting data"
msgstr "Data instellen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1263
+#: ../lib/packagekit-glib2/pk-enum.c:1264
msgid "Resolving"
msgstr "Oplossen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1267
+#: ../lib/packagekit-glib2/pk-enum.c:1268
msgid "Getting file list"
-msgstr "Bestand lijst ophalen"
+msgstr "Bestandslijst ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1271
+#: ../lib/packagekit-glib2/pk-enum.c:1272
msgid "Getting provides"
msgstr "Voorzieningen ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1275
+#: ../lib/packagekit-glib2/pk-enum.c:1276
msgid "Installing signature"
msgstr "Ondertekening installeren"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1279
+#: ../lib/packagekit-glib2/pk-enum.c:1280
msgid "Getting packages"
msgstr "Pakketten ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1283
+#: ../lib/packagekit-glib2/pk-enum.c:1284
msgid "Accepting EULA"
msgstr "EULA accepteren"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1291
+#: ../lib/packagekit-glib2/pk-enum.c:1292
msgid "Getting upgrades"
-msgstr "Vernieuwingen ophalen"
+msgstr "Updates ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1295
+#: ../lib/packagekit-glib2/pk-enum.c:1296
msgid "Getting categories"
msgstr "Categorieën ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1299
+#: ../lib/packagekit-glib2/pk-enum.c:1300
msgid "Getting transactions"
msgstr "Transacties ophalen"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1303
-#: ../lib/packagekit-glib2/pk-enum.c:1307
+#: ../lib/packagekit-glib2/pk-enum.c:1304
+#: ../lib/packagekit-glib2/pk-enum.c:1308
msgid "Simulating install"
msgstr "Installatie simuleren"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1311
+#: ../lib/packagekit-glib2/pk-enum.c:1312
msgid "Simulating remove"
msgstr "Verwijdering simuleren"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-enum.c:1315
+#: ../lib/packagekit-glib2/pk-enum.c:1316
msgid "Simulating update"
msgstr "Vernieuwing simuleren"
@@ -1669,12 +1669,12 @@ msgstr "De niet-ondertekende software wordt niet geïnstalleerd."
#. recognised
#: ../lib/packagekit-glib2/pk-task-text.c:121
msgid "Software source signature required"
-msgstr "Software bron ondertekening vereist"
+msgstr "Softwarebronondertekening vereist"
#. TRANSLATORS: the package repository name
#: ../lib/packagekit-glib2/pk-task-text.c:127
msgid "Software source name"
-msgstr "Software bron naam"
+msgstr "Softwarebronnaam"
#. TRANSLATORS: the key URL
#: ../lib/packagekit-glib2/pk-task-text.c:130
@@ -1715,7 +1715,7 @@ msgstr "De ondertekening werd niet geaccepteerd"
#. read before installing
#: ../lib/packagekit-glib2/pk-task-text.c:203
msgid "End user licence agreement required"
-msgstr "Eindgebruiker licentie overeenkomst vereist"
+msgstr "Eindgebruikerlicentie-overeenkomst vereist"
#. TRANSLATORS: the EULA text itself (long and boring)
#: ../lib/packagekit-glib2/pk-task-text.c:212
@@ -1735,7 +1735,7 @@ msgstr "De overeenkomst werd niet geaccepteerd"
#. TRANSLATORS: the user needs to change media inserted into the computer
#: ../lib/packagekit-glib2/pk-task-text.c:265
msgid "Media change required"
-msgstr "Media verandering vereist."
+msgstr "Media wisseling vereist."
#. TRANSLATORS: the type, e.g. DVD, CD, etc
#: ../lib/packagekit-glib2/pk-task-text.c:268
@@ -1770,7 +1770,7 @@ msgstr "De volgende pakketten moeten worden verwijderd:"
#. TRANSLATORS: When processing, we might have to install other dependencies
#: ../lib/packagekit-glib2/pk-task-text.c:305
msgid "The following packages have to be installed:"
-msgstr "De volgende pakketten moeten worden geïnstalleerd"
+msgstr "De volgende pakketten moeten worden geïnstalleerd:"
#. TRANSLATORS: When processing, we might have to update other dependencies
#: ../lib/packagekit-glib2/pk-task-text.c:310
@@ -1780,12 +1780,12 @@ msgstr "De volgende pakketten moeten worden vernieuwd:"
#. TRANSLATORS: When processing, we might have to reinstall other dependencies
#: ../lib/packagekit-glib2/pk-task-text.c:315
msgid "The following packages have to be reinstalled:"
-msgstr "De volgende pakketten moeten opnieuw geïnstalleerd worden:"
+msgstr "De volgende pakketten moeten opnieuw worden geïnstalleerd:"
#. TRANSLATORS: When processing, we might have to downgrade other dependencies
#: ../lib/packagekit-glib2/pk-task-text.c:320
msgid "The following packages have to be downgraded:"
-msgstr "De volgende pakketten moeten gedegradeerd worden:"
+msgstr "De volgende pakketten moeten gedowngrade worden:"
#. TRANSLATORS: When processing, untrusted and non-verified packages may be
#. encountered
@@ -1804,109 +1804,18 @@ msgid "The transaction did not proceed."
msgstr "De transactie ging niet verder."
#. SECURITY:
-#. - Normal users do not require admin authentication to accept new
-#. licence agreements.
-#. - Change this to 'auth_admin' for environments where users should not
-#. be given the option to make legal decisions.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:7
-msgid "Accept EULA"
-msgstr "EULA accepteren"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:8
-msgid "Authentication is required to accept a EULA"
-msgstr "Authenticatie wordt vereist om een EULA te accepteren"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:9
-msgid ""
-"Authentication is required to cancel a task that was not started by yourself"
-msgstr "Authenticatie wordt vereist om een taak af te breken die niet door jou is gestart"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:10
-msgid "Authentication is required to change software source parameters"
-msgstr "Authenticatie wordt vereist om parameters van de software bronnen te wijzigen"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:11
-msgid ""
-"Authentication is required to change the location used to decompress "
-"packages"
-msgstr "Authenticatie wordt vereist om de om de locatie waar pakketten gedecomprimeerd worden te veranderen"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:12
-msgid ""
-"Authentication is required to consider a key used for signing packages as "
-"trusted"
-msgstr "Authenticatie wordt vereist om een sleutel te overwegen die gebruikt wordt om een pakket als vertrouwd te ondertekenen "
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:13
-msgid "Authentication is required to install a signed package"
-msgstr "Authenticatie wordt vereist om een ondertekend pakket te installeren"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:14
-msgid "Authentication is required to install an untrusted package"
-msgstr "Authenticatie wordt vereist om een niet-vertrouwd pakket te installeren"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:15
-msgid "Authentication is required to refresh the system sources"
-msgstr "Authenticatie wordt vereist om de systeem bronnen te verversen"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:16
-msgid "Authentication is required to reload the device with a new driver"
-msgstr "Authenticatie wordt vereist om het apparaat te herladen met een nieuwe driver"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:17
-msgid "Authentication is required to remove packages"
-msgstr "Authenticatie wordt vereist om pakketten te verwijderen"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:18
-msgid "Authentication is required to repair the installed software"
-msgstr "Authenticatie is vereist om de geïnstalleerde software te kunnen repareren"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:19
-msgid "Authentication is required to rollback a transaction"
-msgstr "Authenticatie wordt vereist om een transactie terug te draaien"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:20
-msgid ""
-"Authentication is required to set the network proxy used for downloading "
-"packages"
-msgstr "Authenticatie wordt vereist voor het instellen van de netwerk proxy die gebruikt wordt om pakketten te installeren"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:21
-msgid "Authentication is required to update packages"
-msgstr "Authenticatie wordt vereist om pakketten te vernieuwen"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:22
-msgid "Authentication is required to upgrade the operating system"
-msgstr "Authenticatie is vereist om het operating system te mogen upgraden"
-
-#. SECURITY:
#. - Normal users are allowed to cancel their own task without
#. authentication, but a different user id needs the admin password
#. to cancel another users task.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:28
+#: ../policy/org.freedesktop.packagekit.policy.in.h:6
msgid "Cancel foreign task"
msgstr "Breek taak van anderen af"
-#. SECURITY:
-#. - This is used when users want to install to a different prefix, for
-#. instance to a LTSP image or a virtual machine.
-#. - This could be used to overwrite files not owned by the user using
-#. a carefully created package file.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:35
-msgid "Change location that packages are installed"
-msgstr "Verander de locatie waar pakketten geïnstalleerd worden"
-
-#. SECURITY:
-#. - Normal users require admin authentication to enable or disable
-#. software sources as this can be used to enable new updates or
-#. install different versions of software.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:41
-msgid "Change software source parameters"
-msgstr "Parameters van de software bronnen wijzigen"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:7
+msgid ""
+"Authentication is required to cancel a task that was not started by yourself"
+msgstr "Authenticatie wordt vereist om een taak af te breken die niet door jou is gestart"
#. SECURITY:
#. - Normal users do not need authentication to install signed packages
@@ -1914,38 +1823,57 @@ msgstr "Parameters van de software bronnen wijzigen"
#. - Paranoid users (or parents!) can change this to 'auth_admin' or
#. 'auth_admin_keep'.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:48
+#: ../policy/org.freedesktop.packagekit.policy.in.h:14
msgid "Install signed package"
msgstr "Ondertekend pakket installeren"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:15
+msgid "Authentication is required to install a signed package"
+msgstr "Authenticatie wordt vereist om een ondertekend pakket te installeren"
+
#. SECURITY:
#. - Normal users require admin authentication to install untrusted or
#. unrecognised packages, as allowing users to do this without a
#. password would be a massive security hole.
#. - This is not retained as each package should be authenticated.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:55
+#: ../policy/org.freedesktop.packagekit.policy.in.h:22
msgid "Install untrusted local file"
msgstr "Lokaal niet-vertrouwd bestand installeren"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:23
+msgid "Authentication is required to install an untrusted package"
+msgstr "Authenticatie wordt vereist om een niet-vertrouwd pakket te installeren"
+
#. SECURITY:
-#. - Normal users do not require admin authentication to refresh the
-#. cache, as this doesn't actually install or remove software.
+#. - Normal users require admin authentication to add signing keys.
+#. - This implies adding an explicit trust, and should not be granted
+#. without a secure authentication.
+#. - This is not kept as each package should be authenticated.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:60
-msgid "Refresh system sources"
-msgstr "Ververs systeem bronnen"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:30
+msgid "Trust a key used for signing packages"
+msgstr "Vertrouw een sleutel die gebruikt wordt voor het ondertekenen van pakketten"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:31
+msgid ""
+"Authentication is required to consider a key used for signing packages as "
+"trusted"
+msgstr "Authenticatie wordt vereist om een sleutel te kiezen die gebruikt wordt om een pakket als vertrouwd te ondertekenen "
#. SECURITY:
-#. - Normal users require admin authentication to rebind a driver
-#. so that it works after we install firmware.
-#. - This should not be set to 'yes' as unprivileged users could then
-#. try to rebind drivers in use, for instance security authentication
-#. devices.
+#. - Normal users do not require admin authentication to accept new
+#. licence agreements.
+#. - Change this to 'auth_admin' for environments where users should not
+#. be given the option to make legal decisions.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:68
-msgid "Reload a device"
-msgstr "Een apparaat opnieuw laden"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:38
+msgid "Accept EULA"
+msgstr "EULA accepteren"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:39
+msgid "Authentication is required to accept a EULA"
+msgstr "Authenticatie wordt vereist om een EULA te accepteren"
#. SECURITY:
#. - Normal users require admin authentication to remove packages as
@@ -1956,70 +1884,142 @@ msgstr "Een apparaat opnieuw laden"
#. be removed. If this is not possible, change this authentication to
#. 'auth_admin'.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:78
+#: ../policy/org.freedesktop.packagekit.policy.in.h:49
msgid "Remove package"
msgstr "Pakket verwijderen"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:50
+msgid "Authentication is required to remove packages"
+msgstr "Authenticatie wordt vereist om pakketten te verwijderen"
+
#. SECURITY:
-#. - Normal users require admin authentication to repair the system
-#. since this can make the system unbootable or stop other
-#. applications from working.
+#. - Normal users do not require admin authentication to update the
+#. system as the packages will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:84
-msgid "Repair System"
-msgstr "Repareer Systeem"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:58
+msgid "Update packages"
+msgstr "Pakketten vernieuwen"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:59
+msgid "Authentication is required to update packages"
+msgstr "Authenticatie wordt vereist om pakketten te vernieuwen"
#. SECURITY:
#. - Normal users require admin authentication to rollback system state
#. as this will change a large number of packages, and could expose the
#. system to previously patched security vulnerabilities.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:90
+#: ../policy/org.freedesktop.packagekit.policy.in.h:65
msgid "Rollback to a previous transaction"
msgstr "Terugdraaien naar een voorgaande transactie"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:66
+msgid "Authentication is required to rollback a transaction"
+msgstr "Authenticatie wordt vereist om een transactie terug te draaien"
+
+#. SECURITY:
+#. - Normal users require admin authentication to enable or disable
+#. software sources as this can be used to enable new updates or
+#. install different versions of software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:72
+msgid "Change software source parameters"
+msgstr "Parameters van de softwarebronnen wijzigen"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:73
+msgid "Authentication is required to change software source parameters"
+msgstr "Authenticatie wordt vereist om parameters van de softwarebronnen te wijzigen"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to refresh the
+#. cache, as this doesn't actually install or remove software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:78
+msgid "Refresh system sources"
+msgstr "Ververs systeembronnen"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:79
+msgid "Authentication is required to refresh the system sources"
+msgstr "Authenticatie wordt vereist om de systeem bronnen te verversen"
+
#. SECURITY:
#. - Normal users do not require admin authentication to set the proxy
#. used for downloading packages.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:95
+#: ../policy/org.freedesktop.packagekit.policy.in.h:84
msgid "Set network proxy"
-msgstr "Stel netwerk proxy in"
+msgstr "Stel netwerkproxy in"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:85
+msgid ""
+"Authentication is required to set the network proxy used for downloading "
+"packages"
+msgstr "Authenticatie wordt vereist voor het instellen van de netwerkproxy die gebruikt wordt om pakketten te installeren"
#. SECURITY:
-#. - Normal users require admin authentication to add signing keys.
-#. - This implies adding an explicit trust, and should not be granted
-#. without a secure authentication.
-#. - This is not kept as each package should be authenticated.
+#. - This is used when users want to install to a different prefix, for
+#. instance to a LTSP image or a virtual machine.
+#. - This could be used to overwrite files not owned by the user using
+#. a carefully created package file.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:102
-msgid "Trust a key used for signing packages"
-msgstr "Vertrouw een sleutel die gebruikt wordt voor het ondertekenen van pakketten"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:92
+msgid "Change location that packages are installed"
+msgstr "Verander de locatie waar pakketten worden geïnstalleerd"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:93
+msgid ""
+"Authentication is required to change the location used to decompress "
+"packages"
+msgstr "Authenticatie wordt vereist om de om de locatie waar pakketten gedecomprimeerd worden te veranderen"
#. SECURITY:
-#. - Normal users do not require admin authentication to update the
-#. system as the packages will be signed, and the action is required
-#. to update the system when unattended.
-#. - Changing this to anything other than 'yes' will break unattended
-#. updates.
+#. - Normal users require admin authentication to rebind a driver
+#. so that it works after we install firmware.
+#. - This should not be set to 'yes' as unprivileged users could then
+#. try to rebind drivers in use, for instance security authentication
+#. devices.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:110
-msgid "Update packages"
-msgstr "Pakketten vernieuwen"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:101
+msgid "Reload a device"
+msgstr "Een apparaat opnieuw laden"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:102
+msgid "Authentication is required to reload the device with a new driver"
+msgstr "Authenticatie wordt vereist om het apparaat te herladen met een nieuw stuurprogramma"
#. SECURITY:
#. - Normal users require admin authentication to upgrade the disto as
#. this can make the system unbootable or stop other applications from
#. working.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:116
+#: ../policy/org.freedesktop.packagekit.policy.in.h:108
msgid "Upgrade System"
msgstr "Upgrade Systeem"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:109
+msgid "Authentication is required to upgrade the operating system"
+msgstr "Authenticatie is vereist om het besturingssystem te mogen upgraden"
+
+#. SECURITY:
+#. - Normal users require admin authentication to repair the system
+#. since this can make the system unbootable or stop other
+#. applications from working.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:115
+msgid "Repair System"
+msgstr "Repareer Systeem"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:116
+msgid "Authentication is required to repair the installed software"
+msgstr "Authenticatie is vereist om de geïnstalleerde software te kunnen repareren"
+
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
#: ../src/pk-main.c:149
msgid "Packaging backend to use, e.g. dummy"
-msgstr "Te gebruiken pakket backend, b.v. dummy"
+msgstr "Te gebruiken pakketbackend, b.v. dummy"
#. TRANSLATORS: if we should run in the background
#: ../src/pk-main.c:152
@@ -2029,7 +2029,7 @@ msgstr "Als daemon starten en van de terminal loskoppelen"
#. TRANSLATORS: if we should not monitor how long we are inactive for
#: ../src/pk-main.c:155
msgid "Disable the idle timer"
-msgstr "De idle timer uitschakelen"
+msgstr "De idle-timer uitschakelen"
#. TRANSLATORS: show version
#: ../src/pk-main.c:158
@@ -2067,15 +2067,15 @@ msgstr "De software is niet van een vertrouwde bron."
#: ../src/pk-transaction.c:2980
msgid "Do not update this package unless you are sure it is safe to do so."
-msgstr "Vernieuw dit pakket niet behalve als je zeker weet dat het veilig is om te doen."
+msgstr "Update dit pakket niet behalve als je zeker weet dat het veilig is om dat te doen."
#: ../src/pk-transaction.c:2981
msgid "Do not update these packages unless you are sure it is safe to do so."
-msgstr "Vernieuw deze pakketten niet behalve als je zeker weet dat het veilig is om te doen."
+msgstr "Update deze pakketten niet behalve als je zeker weet dat het veilig is om dat te doen."
#: ../src/pk-transaction.c:2991
msgid "Do not install this package unless you are sure it is safe to do so."
-msgstr "Installeer dit pakket niet behalve als je zeker weet dat het veilig is om te doen."
+msgstr "Installeer dit pakket niet behalve als je zeker weet dat het veilig is om dat te doen."
#: ../src/pk-transaction.c:2992
msgid "Do not install these packages unless you are sure it is safe to do so."
diff --git a/po/sk.po b/po/sk.po
index 2b2e84d..ee84cf5 100644
--- a/po/sk.po
+++ b/po/sk.po
@@ -4,7 +4,7 @@
#
# Translators:
# helix84 <helix84 at centrum.sk>, 2011.
-# Ivan Masár <helix84 at centrum.sk>, 2010, 2011.
+# Ivan Masár <helix84 at centrum.sk>, 2010, 2011, 2012.
# Lubomir Kundrak <lkundrak at redhat.com>, 2008.
# Pavol Å imo <palo.simo at gmail.com>, 2008.
# Richard Hughes <richard at hughsie.com>, 2011.
@@ -12,10 +12,10 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-09-05 16:58+0100\n"
-"PO-Revision-Date: 2011-10-16 20:39+0000\n"
-"Last-Translator: palos <palo.simo at gmail.com>\n"
-"Language-Team: Slovak (http://www.transifex.net/projects/p/freedesktop/team/sk/)\n"
+"POT-Creation-Date: 2012-03-01 11:08+0000\n"
+"PO-Revision-Date: 2012-04-16 11:10+0000\n"
+"Last-Translator: Pavol Å imo <palo.simo at gmail.com>\n"
+"Language-Team: Slovak (http://www.transifex.net/projects/p/freedesktop/language/sk/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -24,114 +24,114 @@ msgstr ""
#. TRANSLATORS: this is an atomic transaction
#. TRANSLATORS: the role is the point of the transaction, e.g. update-system
-#: ../client/pk-console.c:174 ../client/pk-console.c:596
+#: ../client/pk-console.c:173 ../client/pk-console.c:595
msgid "Transaction"
msgstr "Transakcia"
#. TRANSLATORS: this is the time the transaction was started in system
#. timezone
-#: ../client/pk-console.c:176
+#: ../client/pk-console.c:175
msgid "System time"
msgstr "Äas systému"
#. TRANSLATORS: this is if the transaction succeeded or not
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "Succeeded"
msgstr "ÃspeÅ¡ná"
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "True"
msgstr "Ãno"
-#: ../client/pk-console.c:178
+#: ../client/pk-console.c:177
msgid "False"
msgstr "Nie"
#. TRANSLATORS: this is the transactions role, e.g. "update-system"
-#: ../client/pk-console.c:180
+#: ../client/pk-console.c:179
msgid "Role"
msgstr "Rola"
#. TRANSLATORS: this is The duration of the transaction
-#: ../client/pk-console.c:185
+#: ../client/pk-console.c:184
msgid "Duration"
msgstr "Trvanie"
-#: ../client/pk-console.c:185
+#: ../client/pk-console.c:184
msgid "(seconds)"
msgstr "(sekúnd)"
#. TRANSLATORS: this is The command line used to do the action
-#: ../client/pk-console.c:189
+#: ../client/pk-console.c:188
msgid "Command line"
msgstr "PrÃkazový riadok"
#. TRANSLATORS: this is the user ID of the user that started the action
-#: ../client/pk-console.c:191
+#: ../client/pk-console.c:190
msgid "User ID"
msgstr "ID použÃvateľa"
#. TRANSLATORS: this is the username, e.g. hughsie
-#: ../client/pk-console.c:198
+#: ../client/pk-console.c:197
msgid "Username"
msgstr "PoužÃvateľské meno"
#. TRANSLATORS: this is the users real name, e.g. "Richard Hughes"
-#: ../client/pk-console.c:202
+#: ../client/pk-console.c:201
msgid "Real name"
msgstr "Plné meno"
-#: ../client/pk-console.c:210
+#: ../client/pk-console.c:209
msgid "Affected packages:"
msgstr "Ovplyvnené balÃky:"
-#: ../client/pk-console.c:212
+#: ../client/pk-console.c:211
msgid "Affected packages: None"
msgstr "Ovplyvnené balÃky: Žiadne"
#. TRANSLATORS: this is the distro, e.g. Fedora 10
-#: ../client/pk-console.c:247
+#: ../client/pk-console.c:246
msgid "Distribution"
msgstr "Distribúcia"
#. TRANSLATORS: this is type of update, stable or testing
-#: ../client/pk-console.c:249
+#: ../client/pk-console.c:248
msgid "Type"
msgstr "Typ"
#. TRANSLATORS: this is any summary text describing the upgrade
#. TRANSLATORS: this is the summary of the group
-#: ../client/pk-console.c:251 ../client/pk-console.c:290
+#: ../client/pk-console.c:250 ../client/pk-console.c:289
msgid "Summary"
msgstr "Zhrnutie"
#. TRANSLATORS: this is the group category name
-#: ../client/pk-console.c:279
+#: ../client/pk-console.c:278
msgid "Category"
msgstr "Kategória"
#. TRANSLATORS: this is group identifier
-#: ../client/pk-console.c:281
+#: ../client/pk-console.c:280
msgid "ID"
msgstr "ID"
#. TRANSLATORS: this is the parent group
-#: ../client/pk-console.c:284
+#: ../client/pk-console.c:283
msgid "Parent"
msgstr "RodiÄ"
#. TRANSLATORS: this is the name of the parent group
-#: ../client/pk-console.c:287
+#: ../client/pk-console.c:286
msgid "Name"
msgstr "Názov"
#. TRANSLATORS: this is preferred icon for the group
-#: ../client/pk-console.c:293
+#: ../client/pk-console.c:292
msgid "Icon"
msgstr "Ikona"
#. TRANSLATORS: this is a header for the package that can be updated
-#: ../client/pk-console.c:339
+#: ../client/pk-console.c:338
msgid "Details about the update:"
msgstr "Podrobnosti o aktualizácii:"
@@ -139,7 +139,7 @@ msgstr "Podrobnosti o aktualizácii:"
#. TRANSLATORS: the package that is being processed
#. TRANSLATORS: the package that is not signed by a known key
#. TRANSLATORS: the package name that was trying to be installed
-#: ../client/pk-console.c:345 ../client/pk-console.c:615
+#: ../client/pk-console.c:344 ../client/pk-console.c:614
#: ../lib/packagekit-glib2/pk-task-text.c:124
#: ../lib/packagekit-glib2/pk-task-text.c:206
msgid "Package"
@@ -147,218 +147,212 @@ msgstr "BalÃk"
#. TRANSLATORS: details about the update, any packages that this update
#. updates
-#: ../client/pk-console.c:348
+#: ../client/pk-console.c:347
msgid "Updates"
msgstr "Aktualizuje"
#. TRANSLATORS: details about the update, any packages that this update
#. obsoletes
-#: ../client/pk-console.c:352
+#: ../client/pk-console.c:351
msgid "Obsoletes"
msgstr "Nahrádza"
#. TRANSLATORS: details about the update, the vendor URLs
#. TRANSLATORS: the vendor (e.g. vmware) that is providing the EULA
-#: ../client/pk-console.c:356 ../lib/packagekit-glib2/pk-task-text.c:209
+#: ../client/pk-console.c:355 ../lib/packagekit-glib2/pk-task-text.c:209
msgid "Vendor"
msgstr "Dodávateľ"
#. TRANSLATORS: details about the update, the bugzilla URLs
-#: ../client/pk-console.c:360
+#: ../client/pk-console.c:359
msgid "Bugzilla"
msgstr "Bugzilla"
#. TRANSLATORS: details about the update, the CVE URLs
-#: ../client/pk-console.c:364
+#: ../client/pk-console.c:363
msgid "CVE"
msgstr "CVE"
#. TRANSLATORS: details about the update, if the package requires a restart
-#: ../client/pk-console.c:368
+#: ../client/pk-console.c:367
msgid "Restart"
msgstr "Reštart"
#. TRANSLATORS: details about the update, any description of the update
-#: ../client/pk-console.c:372
+#: ../client/pk-console.c:371
msgid "Update text"
msgstr "Text aktualizácie"
#. TRANSLATORS: details about the update, the changelog for the package
-#: ../client/pk-console.c:376
+#: ../client/pk-console.c:375
msgid "Changes"
msgstr "Zmeny"
#. TRANSLATORS: details about the update, the ongoing state of the update
-#: ../client/pk-console.c:380
+#: ../client/pk-console.c:379
msgid "State"
msgstr "Stav"
#. TRANSLATORS: details about the update, date the update was issued
-#: ../client/pk-console.c:384
+#: ../client/pk-console.c:383
msgid "Issued"
msgstr "Vydané"
#. TRANSLATORS: details about the update, date the update was updated
#. TRANSLATORS: The action of the package, in past tense
-#: ../client/pk-console.c:388 ../lib/packagekit-glib2/pk-console-shared.c:524
+#: ../client/pk-console.c:387 ../lib/packagekit-glib2/pk-enum.c:1135
msgid "Updated"
msgstr "Aktualizované"
#. TRANSLATORS: if the repo is enabled
-#: ../client/pk-console.c:424
+#: ../client/pk-console.c:423
msgid "Enabled"
msgstr "Povolený"
#. TRANSLATORS: if the repo is disabled
-#: ../client/pk-console.c:427
+#: ../client/pk-console.c:426
msgid "Disabled"
msgstr "Zakázaný"
#. TRANSLATORS: a package requires the system to be restarted
-#: ../client/pk-console.c:459
+#: ../client/pk-console.c:458
msgid "System restart required by:"
msgstr "Reštart systému vyžaduje:"
#. TRANSLATORS: a package requires the session to be restarted
-#: ../client/pk-console.c:462
+#: ../client/pk-console.c:461
msgid "Session restart required:"
msgstr "Reštart relácie vyžaduje:"
#. TRANSLATORS: a package requires the system to be restarted due to a
#. security update
-#: ../client/pk-console.c:465
+#: ../client/pk-console.c:464
msgid "System restart (security) required by:"
msgstr "ReÅ¡tart systému (kvôli bezpeÄnosti) vyžaduje:"
#. TRANSLATORS: a package requires the session to be restarted due to a
#. security update
-#: ../client/pk-console.c:468
+#: ../client/pk-console.c:467
msgid "Session restart (security) required:"
msgstr "ReÅ¡tart relácie (kvôli bezpeÄnosti) vyžaduje:"
#. TRANSLATORS: a package requires the application to be restarted
-#: ../client/pk-console.c:471
+#: ../client/pk-console.c:470
msgid "Application restart required by:"
msgstr "Reštart aplikácie vyžaduje:"
#. TRANSLATORS: This a list of details about the package
-#: ../client/pk-console.c:506
+#: ../client/pk-console.c:505
msgid "Package description"
msgstr "Popis balÃka"
#. TRANSLATORS: This a message (like a little note that may be of interest)
#. from the transaction
-#: ../client/pk-console.c:537
+#: ../client/pk-console.c:536
msgid "Message:"
msgstr "Správa:"
#. TRANSLATORS: This where the package has no files
-#: ../client/pk-console.c:558
+#: ../client/pk-console.c:557
msgid "No files"
msgstr "Žiadne súbory"
#. TRANSLATORS: This a list files contained in the package
-#: ../client/pk-console.c:563
+#: ../client/pk-console.c:562
msgid "Package files"
msgstr "Zonam súborov v balÃku"
#. TRANSLATORS: the percentage complete of the transaction
-#: ../client/pk-console.c:631
+#: ../client/pk-console.c:630
msgid "Percentage"
msgstr "PoÄet percent"
#. TRANSLATORS: the status of the transaction (e.g. downloading)
-#: ../client/pk-console.c:649
+#: ../client/pk-console.c:648
msgid "Status"
msgstr "Stav"
#. TRANSLATORS: the results from the transaction
-#: ../client/pk-console.c:678
+#: ../client/pk-console.c:677
msgid "Results:"
msgstr "Výsledky:"
#. TRANSLATORS: we failed to get any results, which is pretty fatal in my book
-#: ../client/pk-console.c:685
+#: ../client/pk-console.c:684
msgid "Fatal error"
msgstr "Kritická chyba"
#. TRANSLATORS: the user asked to update everything, but there is nothing that
#. can be updated
-#: ../client/pk-console.c:701
+#: ../client/pk-console.c:700
msgid "There are no packages to update."
msgstr "Nie sú dostupné aktualizácie žiadnych balÃkov."
#. TRANSLATORS: the transaction failed in a way we could not expect
-#: ../client/pk-console.c:704
+#: ../client/pk-console.c:703
#: ../contrib/command-not-found/pk-command-not-found.c:634
msgid "The transaction failed"
msgstr "Transakcia zlyhala"
#. TRANSLATORS: print a message when there are no updates
-#: ../client/pk-console.c:733
+#: ../client/pk-console.c:732
msgid "There are no updates available at this time."
msgstr "Momentálne nie sú dostupné žiadne aktualizácie."
-#: ../client/pk-console.c:756
+#: ../client/pk-console.c:755
msgid "There are no upgrades available at this time."
msgstr "Momentálne nie sú dostupné žiadne aktualizácie systému."
#. TRANSLATORS: a package needs to restart their system
-#: ../client/pk-console.c:823
+#: ../client/pk-console.c:822
msgid "Please restart the computer to complete the update."
msgstr "Aktualizáciu dokonÄÃte reÅ¡tartovanÃm poÄÃtaÄa."
#. TRANSLATORS: a package needs to restart the session
-#: ../client/pk-console.c:826
+#: ../client/pk-console.c:825
msgid "Please logout and login to complete the update."
msgstr "Aktualizáciu dokonÄÃte odhlásenÃm a opätovným prihlásenÃm sa."
#. TRANSLATORS: a package needs to restart their system (due to security)
-#: ../client/pk-console.c:829
+#: ../client/pk-console.c:828
msgid ""
"Please restart the computer to complete the update as important security "
"updates have been installed."
-msgstr ""
-"ProsÃm, reÅ¡tartujte poÄÃtaÄ aby sa dokonÄila aktualizácia, pretože boli "
-"nainÅ¡talované dôležité bezpeÄnostné aktualizácie."
+msgstr "ProsÃm, reÅ¡tartujte poÄÃtaÄ aby sa dokonÄila aktualizácia, pretože boli nainÅ¡talované dôležité bezpeÄnostné aktualizácie."
#. TRANSLATORS: a package needs to restart the session (due to security)
-#: ../client/pk-console.c:832
+#: ../client/pk-console.c:831
msgid ""
"Please logout and login to complete the update as important security updates"
" have been installed."
-msgstr ""
-"ProsÃm odhláste sa a znovu sa prihláste, aby sa dokonÄila aktualizácia, "
-"pretože boli nainÅ¡talované dôležité bezpeÄnostné aktualizácie."
+msgstr "ProsÃm odhláste sa a znovu sa prihláste, aby sa dokonÄila aktualizácia, pretože boli nainÅ¡talované dôležité bezpeÄnostné aktualizácie."
#. TRANSLATORS: The user used 'pkcon install dave.rpm' rather than 'pkcon
#. install-local dave.rpm'
-#: ../client/pk-console.c:858
+#: ../client/pk-console.c:857
#, c-format
msgid ""
"Expected package name, actually got file. Try using 'pkcon install-local %s'"
" instead."
-msgstr ""
-"OÄakával sa názov balÃka, dostali sme súbor. Skúste namiesto toho použiÅ¥ "
-"âpkcon install-local %sâ."
+msgstr "OÄakával sa názov balÃka, dostali sme súbor. Skúste namiesto toho použiÅ¥ âpkcon install-local %sâ."
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:866
+#: ../client/pk-console.c:870
#, c-format
msgid "This tool could not find any available package: %s"
msgstr "Tomuto nástroju sa nepodarilo násjÅ¥ žiadne dostupné balÃky: %s"
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:894
+#: ../client/pk-console.c:898
#, c-format
msgid "This tool could not find the installed package: %s"
msgstr "Nepodarilo sa nájsÅ¥ nainÅ¡talovaný balÃk: %s"
#. TRANSLATORS: There was an error getting the list of files for the package.
#. The detailed error follows
-#: ../client/pk-console.c:922 ../client/pk-console.c:950
+#: ../client/pk-console.c:926 ../client/pk-console.c:954
#, c-format
msgid "This tool could not find the package: %s"
msgstr "Nepodarilo sa nájsÅ¥ balÃk: %s"
@@ -371,255 +365,245 @@ msgstr "Nepodarilo sa nájsÅ¥ balÃk: %s"
#. detailed error follows
#. TRANSLATORS: The package name was not found in any software sources. The
#. detailed error follows
-#: ../client/pk-console.c:978 ../client/pk-console.c:1006
-#: ../client/pk-console.c:1034 ../client/pk-console.c:1062
-#: ../client/pk-console.c:1090
+#: ../client/pk-console.c:982 ../client/pk-console.c:1010
+#: ../client/pk-console.c:1038 ../client/pk-console.c:1066
+#: ../client/pk-console.c:1094
#, c-format
msgid "This tool could not find all the packages: %s"
msgstr "Nepodarilo sa nájsÅ¥ vÅ¡etky balÃky: %s"
#. TRANSLATORS: This is when the daemon crashed, and we are up shit creek
#. without a paddle
-#: ../client/pk-console.c:1119
+#: ../client/pk-console.c:1123
msgid "The daemon crashed mid-transaction!"
msgstr "Služba na pozadà neoÄakávne skonÄila poÄas transakcie!"
#. TRANSLATORS: This is the header to the --help menu
-#: ../client/pk-console.c:1153
+#: ../client/pk-console.c:1157
msgid "PackageKit Console Interface"
msgstr "Konzola PackageKit"
#. these are commands we can use with pkcon
-#: ../client/pk-console.c:1155
+#: ../client/pk-console.c:1159
msgid "Subcommands:"
msgstr "PodprÃkazy:"
#. TRANSLATORS: we keep a database updated with the time that an action was
#. last executed
-#: ../client/pk-console.c:1235
+#: ../client/pk-console.c:1241
msgid "Failed to get the time since this action was last completed"
msgstr "Nepodarilo sa zistiÅ¥ Äas od posledného dokonÄenia tejto operácie"
#. TRANSLATORS: command line argument, just show the version string
-#: ../client/pk-console.c:1277 ../client/pk-monitor.c:371
+#: ../client/pk-console.c:1283 ../client/pk-monitor.c:370
msgid "Show the program version and exit"
msgstr "ZobraziÅ¥ verziu programu a skonÄiÅ¥"
#. TRANSLATORS: command line argument, use a filter to narrow down results
-#: ../client/pk-console.c:1280
+#: ../client/pk-console.c:1286
msgid "Set the filter, e.g. installed"
msgstr "NastaviÅ¥ filter, naprÃklad ânainÅ¡talovanéâ"
#. TRANSLATORS: command line argument, use a non-standard install prefix
-#: ../client/pk-console.c:1283
+#: ../client/pk-console.c:1289
msgid "Set the install root, e.g. '/' or '/mnt/ltsp'"
msgstr "Nastavte koreÅ inÅ¡talácie, napr. â/â alebo â/mnt/ltspâ"
#. TRANSLATORS: command line argument, work asynchronously
-#: ../client/pk-console.c:1286
+#: ../client/pk-console.c:1292
msgid "Exit without waiting for actions to complete"
msgstr "NeÄakaÅ¥ na dokonÄenie úloh a skonÄiÅ¥"
#. command line argument, do we ask questions
-#: ../client/pk-console.c:1289
+#: ../client/pk-console.c:1295
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:525
msgid "Install the packages without asking for confirmation"
msgstr "InÅ¡talovaÅ¥ balÃky bez potvrdzovania"
#. TRANSLATORS: command line argument, this command is not a priority
-#: ../client/pk-console.c:1292
+#: ../client/pk-console.c:1298
msgid "Run the command using idle network bandwidth and also using less power"
-msgstr ""
-"SpustiÅ¥ prÃkaz tak, aby využÃval len nevuyžitú Å¡Ãrku pásma a tiež menej "
-"energie"
+msgstr "SpustiÅ¥ prÃkaz tak, aby využÃval len nevuyžitú Å¡Ãrku pásma a tiež menej energie"
#. TRANSLATORS: command line argument, just output without fancy formatting
-#: ../client/pk-console.c:1295
+#: ../client/pk-console.c:1301
msgid ""
"Print to screen a machine readable output, rather than using animated "
"widgets"
-msgstr ""
-"VypÃsaÅ¥ na obrazovku strojovo Äitateľný výstup namiesto animovaných "
-"ovládacÃch prvkov"
+msgstr "VypÃsaÅ¥ na obrazovku strojovo Äitateľný výstup namiesto animovaných ovládacÃch prvkov"
#. TRANSLATORS: command line argument, just output without fancy formatting
-#: ../client/pk-console.c:1298
+#: ../client/pk-console.c:1304
msgid "The maximum metadata cache age. Use -1 for 'never'."
-msgstr ""
-"Maximálny vek metadát vo vyrovnávacej pamäti. -1 znamená nepoužÃvaÅ¥ "
-"vyrovnávaciu pamäť."
+msgstr "Maximálny vek metadát vo vyrovnávacej pamäti. -1 znamená nepoužÃvaÅ¥ vyrovnávaciu pamäť."
#. TRANSLATORS: command line argument, --help
-#: ../client/pk-console.c:1301
+#: ../client/pk-console.c:1307
msgid "Show help options."
msgstr "ZobraziÅ¥ voľby pomocnÃka."
#. TRANSLATORS: we failed to contact the daemon
-#: ../client/pk-console.c:1331
+#: ../client/pk-console.c:1338
msgid "Failed to parse command line"
msgstr "Nepodarilo sa analyzovaÅ¥ parametre prÃkazového riadka"
#. TRANSLATORS: we failed to contact the daemon
-#: ../client/pk-console.c:1341
+#: ../client/pk-console.c:1348
msgid "Failed to contact PackageKit"
msgstr "Nepodarilo sa kontaktovať PackageKit"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1394
+#: ../client/pk-console.c:1401
msgid "The proxy could not be set"
msgstr "Proxy server nebolo možné nastaviť"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1406
+#: ../client/pk-console.c:1413
msgid "The install root could not be set"
msgstr "KoreŠinštalácie nebolo možné nastaviť"
#. TRANSLATORS: The user specified an incorrect filter
-#: ../client/pk-console.c:1418
+#: ../client/pk-console.c:1425
msgid "The filter specified was invalid"
msgstr "Zadaný filter nebol platný"
#. TRANSLATORS: a search type can be name, details, file, etc
-#: ../client/pk-console.c:1437
+#: ../client/pk-console.c:1444
msgid "A search type is required, e.g. name"
msgstr "Je potrebný typ hľadania, napr. názov"
#. TRANSLATORS: the user needs to provide a search term
-#: ../client/pk-console.c:1444 ../client/pk-console.c:1456
-#: ../client/pk-console.c:1468 ../client/pk-console.c:1480
+#: ../client/pk-console.c:1451 ../client/pk-console.c:1463
+#: ../client/pk-console.c:1475 ../client/pk-console.c:1487
msgid "A search term is required"
msgstr "Je potrebný vyhľadávacà reťazec"
#. TRANSLATORS: the search type was provided, but invalid
-#: ../client/pk-console.c:1490
+#: ../client/pk-console.c:1497
msgid "Invalid search type"
msgstr "Neplatný typ vyhľadávania"
#. TRANSLATORS: the user did not specify what they wanted to install
-#: ../client/pk-console.c:1496
+#: ../client/pk-console.c:1503
msgid "A package name to install is required"
msgstr "Je potrebný názov balÃka, ktorý sa má inÅ¡talovaÅ¥"
#. TRANSLATORS: the user did not specify what they wanted to install
-#: ../client/pk-console.c:1505
+#: ../client/pk-console.c:1512
msgid "A filename to install is required"
msgstr "Je potrebný názov súboru, ktorý sa má inštalovať"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1516
+#: ../client/pk-console.c:1523
msgid "A type, key_id and package_id are required"
msgstr "Je potrebné urÄiÅ¥ typ, key_id a package_id"
#. TRANSLATORS: the user did not specify what they wanted to remove
-#: ../client/pk-console.c:1527
+#: ../client/pk-console.c:1534
msgid "A package name to remove is required"
msgstr "Je potrebný názov balÃka, ktorý sa má odstrániÅ¥"
#. TRANSLATORS: the user did not specify anything about what to download or
#. where
-#: ../client/pk-console.c:1536
+#: ../client/pk-console.c:1543
msgid "A destination directory and the package names to download are required"
-msgstr ""
-"Je potrebné urÄiÅ¥ cieľový prieÄinok a názvy balÃkov, ktoré sa majú stiahnuÅ¥"
+msgstr "Je potrebné urÄiÅ¥ cieľový prieÄinok a názvy balÃkov, ktoré sa majú stiahnuÅ¥"
#. TRANSLATORS: the directory does not exist, so we can't continue
-#: ../client/pk-console.c:1543
+#: ../client/pk-console.c:1550
msgid "Directory not found"
msgstr "PrieÄinok nenájdený"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1552
+#: ../client/pk-console.c:1559
msgid "A licence identifier (eula-id) is required"
msgstr "Je potrebný identifikátor licencie (eula-id)"
#. TRANSLATORS: geeky error, 99.9999% of users won't see this
-#: ../client/pk-console.c:1563
+#: ../client/pk-console.c:1570
msgid "A transaction identifier (tid) is required"
msgstr "Je potrebný identifikátor transakcie (tid)"
#. TRANSLATORS: The user did not specify a package name
-#: ../client/pk-console.c:1584
+#: ../client/pk-console.c:1591
msgid "A package name to resolve is required"
msgstr "Je potrebný názov balÃka, ktorý sa má vyrieÅ¡iÅ¥"
#. TRANSLATORS: The user did not specify a repository (software source) name
-#: ../client/pk-console.c:1595 ../client/pk-console.c:1606
+#: ../client/pk-console.c:1602 ../client/pk-console.c:1613
msgid "A repository name is required"
msgstr "Je potrebný názov zdroja softvéru"
#. TRANSLATORS: The user didn't provide any data
-#: ../client/pk-console.c:1617
+#: ../client/pk-console.c:1624
msgid "A repo name, parameter and value are required"
msgstr "Je potrebné urÄiÅ¥ názov repozitára, parameter a hodnotu"
#. TRANSLATORS: The user didn't specify what action to use
-#: ../client/pk-console.c:1634
+#: ../client/pk-console.c:1641
msgid "An action, e.g. 'update-system' is required"
msgstr "MusÃte zadaÅ¥ operáciu, napr. âupdate-systemâ"
#. TRANSLATORS: The user specified an invalid action
-#: ../client/pk-console.c:1641
+#: ../client/pk-console.c:1648
msgid "A correct role is required"
msgstr "Je potrebná správna rola"
#. TRANSLATORS: The user did not provide a package name
#. TRANSLATORS: This is when the user fails to supply the package name
-#: ../client/pk-console.c:1651 ../client/pk-console.c:1665
-#: ../client/pk-console.c:1674 ../client/pk-console.c:1694
-#: ../client/pk-console.c:1703 ../client/pk-generate-pack.c:314
+#: ../client/pk-console.c:1658 ../client/pk-console.c:1672
+#: ../client/pk-console.c:1681 ../client/pk-console.c:1701
+#: ../client/pk-console.c:1710 ../client/pk-generate-pack.c:314
msgid "A package name is required"
msgstr "Je potrebný názov balÃka"
#. TRANSLATORS: each package "provides" certain things, e.g. mime(gstreamer-
#. decoder-mp3), the user didn't specify it
-#: ../client/pk-console.c:1683
+#: ../client/pk-console.c:1690
msgid "A package provide string is required"
msgstr "Je potrebný reťazec poskytovania"
#. TRANSLATORS: The user did not provide a distro name
-#: ../client/pk-console.c:1727
+#: ../client/pk-console.c:1734
msgid "A distribution name is required"
msgstr "Vyžaduje sa názov distribúcie"
#. TRANSLATORS: The user did not provide an upgrade type
-#: ../client/pk-console.c:1733
+#: ../client/pk-console.c:1740
msgid "An upgrade type is required, e.g. 'minimal', 'default' or 'complete'"
-msgstr ""
-"Vyžaduje sa typ aktualizácie, napr. âminimalâ, âdefaultâ alebo âcompleteâ"
+msgstr "Vyžaduje sa typ aktualizácie, napr. âminimalâ, âdefaultâ alebo âcompleteâ"
#. TRANSLATORS: The user tried to use an unsupported option on the command
#. line
-#: ../client/pk-console.c:1783
+#: ../client/pk-console.c:1795
#, c-format
msgid "Option '%s' is not supported"
msgstr "Voľba â%sâ nie je podporovaná"
#. TRANSLATORS: Generic failure of what they asked to do
-#: ../client/pk-console.c:1793
+#: ../client/pk-console.c:1805
msgid "Command failed"
msgstr "PrÃkaz zlyhal"
#. TRANSLATORS: we can exclude certain packages (glibc) when we know they'll
#. exist on the target
-#: ../client/pk-generate-pack.c:253
+#: ../client/pk-generate-pack.c:252
msgid "Set the file name of dependencies to be excluded"
msgstr "Nastavte názov súboru so závislosťami, ktoré sa majú vynechať"
#. TRANSLATORS: the output location
-#: ../client/pk-generate-pack.c:256
+#: ../client/pk-generate-pack.c:255
msgid ""
"The output file or directory (the current directory is used if omitted)"
-msgstr ""
-"Výstupný súbor alebo adresár (ak voľbu vynecháte, použije sa aktuálny "
-"adresár)"
+msgstr "Výstupný súbor alebo adresár (ak voľbu vynecháte, použije sa aktuálny adresár)"
#. TRANSLATORS: put a list of packages in the pack
-#: ../client/pk-generate-pack.c:259
+#: ../client/pk-generate-pack.c:258
msgid "The package to be put into the service pack"
msgstr "BalÃk, ktorý sa má uložiÅ¥ do servisného archÃvu"
#. TRANSLATORS: put all pending updates in the pack
-#: ../client/pk-generate-pack.c:262
+#: ../client/pk-generate-pack.c:261
msgid "Put all updates available in the service pack"
msgstr "VložiÅ¥ do servisného archÃvu vÅ¡etky dostupné aktualizácie"
@@ -658,9 +642,7 @@ msgstr "Správca balÃkov nemôže vykonaÅ¥ tento druh operácie."
msgid ""
"Service packs cannot be created as PackageKit was not built with libarchive "
"support."
-msgstr ""
-"Nie je možné vytváraÅ¥ servisné archÃvy, pretože PackageKit nebol zostavený s"
-" podporou libarchive."
+msgstr "Nie je možné vytváraÅ¥ servisné archÃvy, pretože PackageKit nebol zostavený s podporou libarchive."
#. TRANSLATORS: the user specified an absolute path, but didn't get the
#. extension correct
@@ -720,11 +702,11 @@ msgstr "Vytvorený servisný archÃv â%sâ"
msgid "Failed to create '%s': %s"
msgstr "Nepodarilo sa vytvoriÅ¥ â%sâ: %s"
-#: ../client/pk-monitor.c:284
+#: ../client/pk-monitor.c:283
msgid "Failed to get daemon state"
msgstr "Nepodarilo sa zistiť stav démona"
-#: ../client/pk-monitor.c:349
+#: ../client/pk-monitor.c:348
msgid "Failed to get properties"
msgstr "Nepodarilo sa zÃskaÅ¥ vlastnosti"
@@ -830,58 +812,58 @@ msgstr "Nepodarilo sa nainÅ¡talovaÅ¥ balÃky"
#. TRANSLATORS: the prefix of all the output telling the user
#. * why it's not executing. NOTE: this is lowercase to mimic
#. * the style of bash itself -- apologies
-#: ../contrib/command-not-found/pk-command-not-found.c:723
+#: ../contrib/command-not-found/pk-command-not-found.c:725
msgid "command not found"
msgstr "prÃkaz nenájdený"
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:741
+#: ../contrib/command-not-found/pk-command-not-found.c:743
msgid "Similar command is:"
msgstr "Podobný prÃkaz je:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:755
+#: ../contrib/command-not-found/pk-command-not-found.c:757
msgid "Run similar command:"
msgstr "SpustiÅ¥ podobný prÃkaz:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:769
-#: ../contrib/command-not-found/pk-command-not-found.c:778
+#: ../contrib/command-not-found/pk-command-not-found.c:771
+#: ../contrib/command-not-found/pk-command-not-found.c:780
msgid "Similar commands are:"
msgstr "Podobné prÃkazy sú:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:785
+#: ../contrib/command-not-found/pk-command-not-found.c:787
msgid "Please choose a command to run"
msgstr "ProsÃm, zvoľte prÃkaz, ktorý chcete spustiÅ¥"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:803
+#: ../contrib/command-not-found/pk-command-not-found.c:805
msgid "The package providing this file is:"
msgstr "BalÃk poskytujúci tento súbor je:"
#. TRANSLATORS: as the user if we want to install a package to provide the
#. command
-#: ../contrib/command-not-found/pk-command-not-found.c:810
+#: ../contrib/command-not-found/pk-command-not-found.c:812
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "NainÅ¡talovaÅ¥ balÃk â%sâ poskytujúci prÃkaz â%sâ?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:837
+#: ../contrib/command-not-found/pk-command-not-found.c:839
msgid "Packages providing this file are:"
msgstr "BalÃky poskytujúce tento súbor sú:"
#. TRANSLATORS: Show the user a list of packages that they can install to
#. provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:847
+#: ../contrib/command-not-found/pk-command-not-found.c:849
msgid "Suitable packages are:"
msgstr "Vhodné balÃky sú:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:856
+#: ../contrib/command-not-found/pk-command-not-found.c:858
msgid "Please choose a package to install"
msgstr "ProsÃm, zvoľte balÃk, ktorý sa má inÅ¡talovaÅ¥"
@@ -901,9 +883,7 @@ msgstr "BalÃk %s sa nenaÅ¡iel alebo už je nainÅ¡talovaný: %s"
#: ../contrib/debuginfo-install/pk-debuginfo-install.c:516
msgid ""
"Don't actually install any packages, only simulate what would be installed"
-msgstr ""
-"V skutoÄnosti neinÅ¡talovaÅ¥ žiadne balÃky, len simulovaÅ¥, Äo by sa "
-"nainštalovalo"
+msgstr "V skutoÄnosti neinÅ¡talovaÅ¥ žiadne balÃky, len simulovaÅ¥, Äo by sa nainÅ¡talovalo"
#. command line argument, do we skip packages that depend on the ones
#. specified
@@ -917,172 +897,172 @@ msgid "Do not display information or progress"
msgstr "Nezobrazovať informácie ani priebeh"
#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:540
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:542
msgid "PackageKit Debuginfo Installer"
msgstr "Inštalátor PackageKit pre debuginfo"
#. TRANSLATORS: the use needs to specify a list of package names on the
#. command line
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:554
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:556
#, c-format
msgid "ERROR: Specify package names to install."
msgstr "CHYBA: Zajdajte názvy balÃkov, ktoré sa majú inÅ¡talovaÅ¥."
#. TRANSLATORS: we are getting the list of repositories
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:590
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:592
#, c-format
msgid "Getting sources list"
msgstr "ZÃskava sa zoznam zdrojov"
#. TRANSLATORS: operation was not successful
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:600
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:675
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:759
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:803
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:870
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:914
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:602
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:677
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:761
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:805
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:872
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:916
msgid "FAILED."
msgstr "ZLYHALO."
#. TRANSLATORS: all completed 100%
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:615
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:655
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:690
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:774
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:818
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:885
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:929
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:617
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:657
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:692
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:776
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:820
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:887
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:931
#, c-format
msgid "OK."
msgstr "Ok."
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:618
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:620
#, c-format
msgid "Found %i enabled and %i disabled sources."
msgstr "Nájdených %i povolených a %i zakázaných zdrojov."
#. TRANSLATORS: we're finding repositories that match out pattern
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:625
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:627
#, c-format
msgid "Finding debugging sources"
msgstr "Hľadajú sa ladiace zdroje"
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:658
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:660
#, c-format
msgid "Found %i disabled debuginfo repos."
msgstr "Nájdených %i zakázaných debuginfo zdrojov."
#. TRANSLATORS: we're now enabling all the debug sources we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:665
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:667
#, c-format
msgid "Enabling debugging sources"
msgstr "Povoľujú sa ladiace zdroje"
#. TRANSLATORS: tell the user how many we enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:693
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:695
#, c-format
msgid "Enabled %i debugging sources."
msgstr "Povolených %i ladiacich zdrojov."
#. TRANSLATORS: we're now finding packages that match in all the repos
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:700
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:702
#, c-format
msgid "Finding debugging packages"
msgstr "Hľadajú sa ladiace balÃky"
#. TRANSLATORS: we couldn't find the package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:712
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:714
#, c-format
msgid "Failed to find the package %s: %s"
msgstr "Nepodarilo sa nájsÅ¥ balÃk â%sâ: %s"
#. TRANSLATORS: we couldn't find the debuginfo package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:735
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:737
#, c-format
msgid "Failed to find the debuginfo package %s: %s"
msgstr "Nepodarilo sa nájsÅ¥ ladiaci balÃk '%s': %s"
#. TRANSLATORS: no debuginfo packages could be found to be installed
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:763
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:765
#, c-format
msgid "Found no packages to install."
msgstr "Žiadne balÃky na inÅ¡talovanie."
#. TRANSLATORS: tell the user we found some packages, and then list them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:777
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:779
#, c-format
msgid "Found %i packages:"
msgstr "Nájdených %i balÃkov:"
#. TRANSLATORS: tell the user we are searching for deps
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:793
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:795
#, c-format
msgid "Finding packages that depend on these packages"
msgstr "Hľadajú sa balÃky závisiace na týchto balÃkoch"
#. TRANSLATORS: could not install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:806
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:808
#, c-format
-msgid "Could not find dependant packages: %s"
+msgid "Could not find dependent packages: %s"
msgstr "Nebolo možné nájsÅ¥ závisiace balÃky: %s"
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:822
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:824
#, c-format
msgid "Found %i extra packages."
msgstr "Nájdených %i extra balÃkov."
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:826
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:828
#, c-format
msgid "No extra packages required."
msgstr "Nie sú potrebné žiadne extra balÃky."
#. TRANSLATORS: tell the user we found some packages (and deps), and then list
#. them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:835
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:837
#, c-format
msgid "Found %i packages to install:"
msgstr "Nájdených %i balÃkov na inÅ¡talovanie:"
#. TRANSLATORS: simulate mode is a testing mode where we quit before the
#. action
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:848
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:850
#, c-format
msgid "Not installing packages in simulate mode"
msgstr "V režime simulácie sa balÃky nebudú inÅ¡talovaÅ¥"
#. TRANSLATORS: we are now installing the debuginfo packages we found earlier
#. TRANSLATORS: transaction state, installing packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:860
-#: ../lib/packagekit-glib2/pk-console-shared.c:296
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:862
+#: ../lib/packagekit-glib2/pk-console-shared.c:331
#, c-format
msgid "Installing packages"
msgstr "InÅ¡talujú sa balÃky"
#. TRANSLATORS: could not install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:873
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:875
#, c-format
msgid "Could not install packages: %s"
msgstr "Nepodarilo sa nainÅ¡talovaÅ¥ balÃky: %s"
#. TRANSLATORS: we are now disabling all debuginfo repos we previously enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:905
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:907
#, c-format
msgid "Disabling sources previously enabled"
msgstr "Zakazujú sa predtým povolené zdroje"
#. TRANSLATORS: no debuginfo packages could be found to be installed, detailed
#. error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:917
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:919
#, c-format
msgid "Could not disable the debugging sources: %s"
msgstr "Nepodarilo sa zakázať ladiace zdroje: %s"
#. TRANSLATORS: we disabled all the debugging repos that we enabled before
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:932
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:934
#, c-format
msgid "Disabled %i debugging sources."
msgstr "Zakázaných %i ladiacich zdrojov."
@@ -1191,490 +1171,490 @@ msgstr "Zoznam balÃkov PackageKit"
msgid "PackageKit Service Pack"
msgstr "Servisný archÃv PackageKit"
-#: ../lib/packagekit-glib2/pk-console-shared.c:64
+#: ../lib/packagekit-glib2/pk-console-shared.c:65
#, c-format
msgid "Please enter a number from 1 to %i: "
msgstr "ProsÃm, zadajte ÄÃslo od 1 do %i: "
#. TRANSLATORS: more than one package could be found that matched, to follow
#. is a list of possible packages
-#: ../lib/packagekit-glib2/pk-console-shared.c:198
+#: ../lib/packagekit-glib2/pk-console-shared.c:233
msgid "More than one package matches:"
msgstr "Vyhovuje viac ako jeden balÃk:"
#. TRANSLATORS: This finds out which package in the list to use
-#: ../lib/packagekit-glib2/pk-console-shared.c:209
+#: ../lib/packagekit-glib2/pk-console-shared.c:244
msgid "Please choose the correct package: "
msgstr "ProsÃm, zadajte správny balÃk: "
#. TRANSLATORS: This is when the transaction status is not known
-#: ../lib/packagekit-glib2/pk-console-shared.c:264
+#: ../lib/packagekit-glib2/pk-console-shared.c:299
msgid "Unknown state"
msgstr "Neznámy stav"
#. TRANSLATORS: transaction state, the daemon is in the process of starting
-#: ../lib/packagekit-glib2/pk-console-shared.c:268
+#: ../lib/packagekit-glib2/pk-console-shared.c:303
msgid "Starting"
msgstr "Spúšťa sa"
#. TRANSLATORS: transaction state, the transaction is waiting for another to
#. complete
-#: ../lib/packagekit-glib2/pk-console-shared.c:272
+#: ../lib/packagekit-glib2/pk-console-shared.c:307
msgid "Waiting in queue"
msgstr "Äaká vo fronte"
#. TRANSLATORS: transaction state, just started
-#: ../lib/packagekit-glib2/pk-console-shared.c:276
+#: ../lib/packagekit-glib2/pk-console-shared.c:311
msgid "Running"
msgstr "BežÃ"
#. TRANSLATORS: transaction state, is querying data
-#: ../lib/packagekit-glib2/pk-console-shared.c:280
+#: ../lib/packagekit-glib2/pk-console-shared.c:315
msgid "Querying"
msgstr "Zisťuje sa"
#. TRANSLATORS: transaction state, getting data from a server
-#: ../lib/packagekit-glib2/pk-console-shared.c:284
+#: ../lib/packagekit-glib2/pk-console-shared.c:319
msgid "Getting information"
msgstr "ZÃskavajú sa informácie"
#. TRANSLATORS: transaction state, removing packages
-#: ../lib/packagekit-glib2/pk-console-shared.c:288
+#: ../lib/packagekit-glib2/pk-console-shared.c:323
msgid "Removing packages"
msgstr "OdstraÅujú sa balÃky"
#. TRANSLATORS: transaction state, downloading package files
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:292
-#: ../lib/packagekit-glib2/pk-console-shared.c:670
+#: ../lib/packagekit-glib2/pk-console-shared.c:327
+#: ../lib/packagekit-glib2/pk-enum.c:1288
msgid "Downloading packages"
msgstr "SÅ¥ahujú sa balÃky"
#. TRANSLATORS: transaction state, refreshing internal lists
-#: ../lib/packagekit-glib2/pk-console-shared.c:300
+#: ../lib/packagekit-glib2/pk-console-shared.c:335
msgid "Refreshing software list"
msgstr "Obnovuje sa zoznam softvéru"
#. TRANSLATORS: transaction state, installing updates
-#: ../lib/packagekit-glib2/pk-console-shared.c:304
+#: ../lib/packagekit-glib2/pk-console-shared.c:339
msgid "Installing updates"
msgstr "Inštalujú sa aktualizácie"
#. TRANSLATORS: transaction state, removing old packages, and cleaning config
#. files
-#: ../lib/packagekit-glib2/pk-console-shared.c:308
+#: ../lib/packagekit-glib2/pk-console-shared.c:343
msgid "Cleaning up packages"
msgstr "Äistia sa balÃky"
#. TRANSLATORS: transaction state, obsoleting old packages
-#: ../lib/packagekit-glib2/pk-console-shared.c:312
+#: ../lib/packagekit-glib2/pk-console-shared.c:347
msgid "Obsoleting packages"
msgstr "OznaÄujú sa zastaralé balÃky"
#. TRANSLATORS: transaction state, checking the transaction before we do it
-#: ../lib/packagekit-glib2/pk-console-shared.c:316
+#: ../lib/packagekit-glib2/pk-console-shared.c:351
msgid "Resolving dependencies"
msgstr "Riešia sa závislosti"
#. TRANSLATORS: transaction state, checking if we have all the security keys
#. for the operation
-#: ../lib/packagekit-glib2/pk-console-shared.c:320
+#: ../lib/packagekit-glib2/pk-console-shared.c:355
msgid "Checking signatures"
msgstr "Kontrolujú sa podpisy"
#. TRANSLATORS: transaction state, when we return to a previous system state
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:324
-#: ../lib/packagekit-glib2/pk-console-shared.c:630
+#: ../lib/packagekit-glib2/pk-console-shared.c:359
+#: ../lib/packagekit-glib2/pk-enum.c:1248
msgid "Rolling back"
msgstr "Vracajú sa zmeny"
#. TRANSLATORS: transaction state, when we're doing a test transaction
-#: ../lib/packagekit-glib2/pk-console-shared.c:328
+#: ../lib/packagekit-glib2/pk-console-shared.c:363
msgid "Testing changes"
msgstr "Testujú sa zmeny"
#. TRANSLATORS: transaction state, when we're writing to the system package
#. database
-#: ../lib/packagekit-glib2/pk-console-shared.c:332
+#: ../lib/packagekit-glib2/pk-console-shared.c:367
msgid "Committing changes"
msgstr "Vykonávajú sa zmeny"
#. TRANSLATORS: transaction state, requesting data from a server
-#: ../lib/packagekit-glib2/pk-console-shared.c:336
+#: ../lib/packagekit-glib2/pk-console-shared.c:371
msgid "Requesting data"
msgstr "Žiada sa o dáta"
#. TRANSLATORS: transaction state, all done!
-#: ../lib/packagekit-glib2/pk-console-shared.c:340
+#: ../lib/packagekit-glib2/pk-console-shared.c:375
msgid "Finished"
msgstr "Hotovo"
#. TRANSLATORS: transaction state, in the process of cancelling
-#: ../lib/packagekit-glib2/pk-console-shared.c:344
+#: ../lib/packagekit-glib2/pk-console-shared.c:379
msgid "Cancelling"
msgstr "Prerušuje sa"
#. TRANSLATORS: transaction state, downloading metadata
-#: ../lib/packagekit-glib2/pk-console-shared.c:348
+#: ../lib/packagekit-glib2/pk-console-shared.c:383
msgid "Downloading repository information"
msgstr "Sťahujú sa informácie o zdroji softvéru"
#. TRANSLATORS: transaction state, downloading metadata
-#: ../lib/packagekit-glib2/pk-console-shared.c:352
+#: ../lib/packagekit-glib2/pk-console-shared.c:387
msgid "Downloading list of packages"
msgstr "SÅ¥ahuje sa zoznam balÃkov"
#. TRANSLATORS: transaction state, downloading metadata
-#: ../lib/packagekit-glib2/pk-console-shared.c:356
+#: ../lib/packagekit-glib2/pk-console-shared.c:391
msgid "Downloading file lists"
msgstr "Sťahujú sa zoznamy súborov"
#. TRANSLATORS: transaction state, downloading metadata
-#: ../lib/packagekit-glib2/pk-console-shared.c:360
+#: ../lib/packagekit-glib2/pk-console-shared.c:395
msgid "Downloading lists of changes"
msgstr "Sťahujú sa záznamy zmien"
#. TRANSLATORS: transaction state, downloading metadata
-#: ../lib/packagekit-glib2/pk-console-shared.c:364
+#: ../lib/packagekit-glib2/pk-console-shared.c:399
msgid "Downloading groups"
msgstr "Sťahujú sa skupiny"
#. TRANSLATORS: transaction state, downloading metadata
-#: ../lib/packagekit-glib2/pk-console-shared.c:368
+#: ../lib/packagekit-glib2/pk-console-shared.c:403
msgid "Downloading update information"
msgstr "SÅ¥ahujú sa aktualizaÄné informácie"
#. TRANSLATORS: transaction state, repackaging delta files
-#: ../lib/packagekit-glib2/pk-console-shared.c:372
+#: ../lib/packagekit-glib2/pk-console-shared.c:407
msgid "Repackaging files"
msgstr "Prebaľujú sa súbory"
#. TRANSLATORS: transaction state, loading databases
-#: ../lib/packagekit-glib2/pk-console-shared.c:376
+#: ../lib/packagekit-glib2/pk-console-shared.c:411
msgid "Loading cache"
msgstr "NaÄÃtava sa vyrovnávacia pamäť"
#. TRANSLATORS: transaction state, scanning for running processes
-#: ../lib/packagekit-glib2/pk-console-shared.c:380
+#: ../lib/packagekit-glib2/pk-console-shared.c:415
msgid "Scanning applications"
msgstr "Hľadajú sa aplikácie"
#. TRANSLATORS: transaction state, generating a list of packages installed on
#. the system
-#: ../lib/packagekit-glib2/pk-console-shared.c:384
+#: ../lib/packagekit-glib2/pk-console-shared.c:419
msgid "Generating package lists"
msgstr "Vytvárajú sa zoznamy balÃkov"
#. TRANSLATORS: transaction state, when we're waiting for the native tools to
#. exit
-#: ../lib/packagekit-glib2/pk-console-shared.c:388
+#: ../lib/packagekit-glib2/pk-console-shared.c:423
msgid "Waiting for package manager lock"
msgstr "Äaká sa na zámok správcu balÃkov"
#. TRANSLATORS: transaction state, waiting for user to type in a password
-#: ../lib/packagekit-glib2/pk-console-shared.c:392
+#: ../lib/packagekit-glib2/pk-console-shared.c:427
msgid "Waiting for authentication"
msgstr "Äaká sa na overenie totožnosti"
#. TRANSLATORS: transaction state, we are updating the list of processes
-#: ../lib/packagekit-glib2/pk-console-shared.c:396
+#: ../lib/packagekit-glib2/pk-console-shared.c:431
msgid "Updating running applications"
msgstr "Aktualizujú sa bežiace aplikácie"
#. TRANSLATORS: transaction state, we are checking executable files currently
#. in use
-#: ../lib/packagekit-glib2/pk-console-shared.c:400
+#: ../lib/packagekit-glib2/pk-console-shared.c:435
msgid "Checking applications in use"
msgstr "Kontrolujú sa použÃvané aplikácie"
#. TRANSLATORS: transaction state, we are checking for libraries currently in
#. use
-#: ../lib/packagekit-glib2/pk-console-shared.c:404
+#: ../lib/packagekit-glib2/pk-console-shared.c:439
msgid "Checking libraries in use"
msgstr "Kontrolujú sa použÃvané knižnice"
#. TRANSLATORS: transaction state, we are copying package files before or
#. after the transaction
-#: ../lib/packagekit-glib2/pk-console-shared.c:408
+#: ../lib/packagekit-glib2/pk-console-shared.c:443
msgid "Copying files"
msgstr "KopÃrujú sa súbory"
+#. TRANSLATORS: turn on all debugging
+#: ../lib/packagekit-glib2/pk-debug.c:133
+msgid "Show debugging information for all files"
+msgstr "Zobraziť ladiace informácie všetkých súborov"
+
+#: ../lib/packagekit-glib2/pk-debug.c:201
+msgid "Debugging Options"
+msgstr "Možnosti ladenia"
+
+#: ../lib/packagekit-glib2/pk-debug.c:201
+msgid "Show debugging options"
+msgstr "Zobraziť možnosti ladenia"
+
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:426
+#: ../lib/packagekit-glib2/pk-enum.c:1023
msgid "Trivial"
msgstr "Triviálna"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:430
+#: ../lib/packagekit-glib2/pk-enum.c:1027
msgid "Normal"
msgstr "Bežná"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:434
+#: ../lib/packagekit-glib2/pk-enum.c:1031
msgid "Important"
msgstr "Dôležitá"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:438
+#: ../lib/packagekit-glib2/pk-enum.c:1035
msgid "Security"
msgstr "BezpeÄnostná"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:442
+#: ../lib/packagekit-glib2/pk-enum.c:1039
msgid "Bug fix "
msgstr "Oprava chýb"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:446
+#: ../lib/packagekit-glib2/pk-enum.c:1043
msgid "Enhancement"
msgstr "Vylepšenia"
#. TRANSLATORS: The type of update
-#: ../lib/packagekit-glib2/pk-console-shared.c:450
+#: ../lib/packagekit-glib2/pk-enum.c:1047
msgid "Blocked"
msgstr "Zablokovaná"
#. TRANSLATORS: The state of a package
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:455
-#: ../lib/packagekit-glib2/pk-console-shared.c:528
+#: ../lib/packagekit-glib2/pk-enum.c:1052
+#: ../lib/packagekit-glib2/pk-enum.c:1139
msgid "Installed"
msgstr "Nainštalované"
#. TRANSLATORS: The state of a package, i.e. not installed
-#: ../lib/packagekit-glib2/pk-console-shared.c:460
+#: ../lib/packagekit-glib2/pk-enum.c:1057
msgid "Available"
msgstr "Dostupné"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:478
+#: ../lib/packagekit-glib2/pk-enum.c:1082
msgid "Downloading"
msgstr "SÅ¥ahuje sa"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:482
+#: ../lib/packagekit-glib2/pk-enum.c:1086
msgid "Updating"
msgstr "Aktualizuje sa"
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:486
-#: ../lib/packagekit-glib2/pk-console-shared.c:606
+#: ../lib/packagekit-glib2/pk-enum.c:1090
+#: ../lib/packagekit-glib2/pk-enum.c:1224
msgid "Installing"
msgstr "Inštaluje sa"
#. TRANSLATORS: The action of the package, in present tense
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:490
-#: ../lib/packagekit-glib2/pk-console-shared.c:602
+#: ../lib/packagekit-glib2/pk-enum.c:1094
+#: ../lib/packagekit-glib2/pk-enum.c:1220
msgid "Removing"
msgstr "OdstraÅuje sa"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:494
+#: ../lib/packagekit-glib2/pk-enum.c:1098
msgid "Cleaning up"
msgstr "Äistà sa"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:498
+#: ../lib/packagekit-glib2/pk-enum.c:1102
msgid "Obsoleting"
msgstr "OznaÄuje sa ako zastaralé"
#. TRANSLATORS: The action of the package, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:502
+#: ../lib/packagekit-glib2/pk-enum.c:1106
msgid "Reinstalling"
msgstr "Znovu sa inštaluje"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:520
+#: ../lib/packagekit-glib2/pk-enum.c:1131
msgid "Downloaded"
msgstr "Stiahnuté"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:532
+#: ../lib/packagekit-glib2/pk-enum.c:1143
msgid "Removed"
msgstr "Odstránené"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:536
+#: ../lib/packagekit-glib2/pk-enum.c:1147
msgid "Cleaned up"
msgstr "VyÄistené"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:540
+#: ../lib/packagekit-glib2/pk-enum.c:1151
msgid "Obsoleted"
msgstr "OznaÄené ako zastarané"
#. TRANSLATORS: The action of the package, in past tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:544
+#: ../lib/packagekit-glib2/pk-enum.c:1155
msgid "Reinstalled"
msgstr "Znovu nainštalované"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:562
+#: ../lib/packagekit-glib2/pk-enum.c:1180
msgid "Unknown role type"
msgstr "Neznámy typ role"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:566
+#: ../lib/packagekit-glib2/pk-enum.c:1184
msgid "Getting dependencies"
msgstr "Zisťujú sa závislosti"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:570
+#: ../lib/packagekit-glib2/pk-enum.c:1188
msgid "Getting update details"
msgstr "Zisťujú sa podrobnosti aktualizácie"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:574
+#: ../lib/packagekit-glib2/pk-enum.c:1192
msgid "Getting details"
msgstr "Zisťujú sa podrobnosti"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:578
+#: ../lib/packagekit-glib2/pk-enum.c:1196
msgid "Getting requires"
msgstr "Zisťujú sa závislosti"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:582
+#: ../lib/packagekit-glib2/pk-enum.c:1200
msgid "Getting updates"
msgstr "ZÃskavajú sa aktualizácie"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:586
+#: ../lib/packagekit-glib2/pk-enum.c:1204
msgid "Searching by details"
msgstr "Hľadá sa podľa podrobnostÃ"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:590
+#: ../lib/packagekit-glib2/pk-enum.c:1208
msgid "Searching by file"
msgstr "Hľadá sa podľa súboru"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:594
+#: ../lib/packagekit-glib2/pk-enum.c:1212
msgid "Searching groups"
msgstr "Hľadá sa podľa skupÃn"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:598
+#: ../lib/packagekit-glib2/pk-enum.c:1216
msgid "Searching by name"
msgstr "Hľadá sa podľa názvu"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:610
+#: ../lib/packagekit-glib2/pk-enum.c:1228
msgid "Installing files"
msgstr "Inštalujú sa súbory"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:614
+#: ../lib/packagekit-glib2/pk-enum.c:1232
msgid "Refreshing cache"
msgstr "Obnovuje sa vyrovnávacia pamäť"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:618
+#: ../lib/packagekit-glib2/pk-enum.c:1236
msgid "Updating packages"
msgstr "Aktualizujú sa balÃky"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:622
+#: ../lib/packagekit-glib2/pk-enum.c:1240
msgid "Updating system"
msgstr "Aktualizuje sa systém"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:626
+#: ../lib/packagekit-glib2/pk-enum.c:1244
msgid "Canceling"
msgstr "Prerušuje sa"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:634
+#: ../lib/packagekit-glib2/pk-enum.c:1252
msgid "Getting repositories"
msgstr "ZÃskavajú sa zdroje softvéru"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:638
+#: ../lib/packagekit-glib2/pk-enum.c:1256
msgid "Enabling repository"
msgstr "Povoľuje sa zdroj softvéru"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:642
+#: ../lib/packagekit-glib2/pk-enum.c:1260
msgid "Setting data"
msgstr "Nastavujú sa údaje"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:646
+#: ../lib/packagekit-glib2/pk-enum.c:1264
msgid "Resolving"
msgstr "Rieši sa"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:650
+#: ../lib/packagekit-glib2/pk-enum.c:1268
msgid "Getting file list"
msgstr "ZÃskava sa zoznam súborov"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:654
+#: ../lib/packagekit-glib2/pk-enum.c:1272
msgid "Getting provides"
msgstr "ZÃskava sa zoznam poskytovaných"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:658
+#: ../lib/packagekit-glib2/pk-enum.c:1276
msgid "Installing signature"
msgstr "Inštaluje sa podpis"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:662
+#: ../lib/packagekit-glib2/pk-enum.c:1280
msgid "Getting packages"
msgstr "ZÃskavajú sa balÃky"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:666
+#: ../lib/packagekit-glib2/pk-enum.c:1284
msgid "Accepting EULA"
msgstr "PrijÃma sa EULA"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:674
+#: ../lib/packagekit-glib2/pk-enum.c:1292
msgid "Getting upgrades"
msgstr "ZÃskavajú sa aktualizácie systému"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:678
+#: ../lib/packagekit-glib2/pk-enum.c:1296
msgid "Getting categories"
msgstr "ZÃskavajú sa kategórie"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:682
+#: ../lib/packagekit-glib2/pk-enum.c:1300
msgid "Getting transactions"
msgstr "ZÃskavajú sa transakcie"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:686
-#: ../lib/packagekit-glib2/pk-console-shared.c:690
+#: ../lib/packagekit-glib2/pk-enum.c:1304
+#: ../lib/packagekit-glib2/pk-enum.c:1308
msgid "Simulating install"
msgstr "Simuluje sa inštalácia"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:694
+#: ../lib/packagekit-glib2/pk-enum.c:1312
msgid "Simulating remove"
msgstr "Simuluje sa odstránenie"
#. TRANSLATORS: The role of the transaction, in present tense
-#: ../lib/packagekit-glib2/pk-console-shared.c:698
+#: ../lib/packagekit-glib2/pk-enum.c:1316
msgid "Simulating update"
msgstr "Simuluje sa aktualizácia"
-#. TRANSLATORS: turn on all debugging
-#: ../lib/packagekit-glib2/pk-debug.c:133
-msgid "Show debugging information for all files"
-msgstr "Zobraziť ladiace informácie všetkých súborov"
-
-#: ../lib/packagekit-glib2/pk-debug.c:201
-msgid "Debugging Options"
-msgstr "Možnosti ladenia"
-
-#: ../lib/packagekit-glib2/pk-debug.c:201
-msgid "Show debugging options"
-msgstr "Zobraziť možnosti ladenia"
-
#. TRANSLATORS: ask the user if they are comfortable installing insecure
#. packages
#: ../lib/packagekit-glib2/pk-task-text.c:67
@@ -1825,114 +1805,18 @@ msgid "The transaction did not proceed."
msgstr "Transakcia neprebehla."
#. SECURITY:
-#. - Normal users do not require admin authentication to accept new
-#. licence agreements.
-#. - Change this to 'auth_admin' for environments where users should not
-#. be given the option to make legal decisions.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:7
-msgid "Accept EULA"
-msgstr "PrijaÅ¥ licenÄné podmienky"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:8
-msgid "Authentication is required to accept a EULA"
-msgstr "Na prijatie licenÄných podmienok je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:9
-msgid ""
-"Authentication is required to cancel a task that was not started by yourself"
-msgstr ""
-"Na zrušenie úlohy, ktorú ste sami nespustili, je potrebné overenie "
-"totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:10
-msgid "Authentication is required to change software source parameters"
-msgstr ""
-"Na zmenu parametrov softvérového zdroja je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:11
-msgid ""
-"Authentication is required to change the location used to decompress "
-"packages"
-msgstr ""
-"Na zmenu adresára, kam sa rozbaľujú balÃky, je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:12
-msgid ""
-"Authentication is required to consider a key used for signing packages as "
-"trusted"
-msgstr ""
-"Na vyjadrenie dôvery kľúÄu použÃvaného na podpisovanie balÃkov je potrebné "
-"overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:13
-msgid "Authentication is required to install a signed package"
-msgstr "Na inÅ¡talovanie podpÃsaného balÃka je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:14
-msgid "Authentication is required to install an untrusted package"
-msgstr "Na inÅ¡taláciu nedôveryhodného balÃka je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:15
-msgid "Authentication is required to refresh the system sources"
-msgstr "Na obnovenie zdrojov systému je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:16
-msgid "Authentication is required to reload the device with a new driver"
-msgstr ""
-"Na naÄÃtanie nového ovládaÄa zariadenia je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:17
-msgid "Authentication is required to remove packages"
-msgstr "Na odstránenie balÃkov je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:18
-msgid "Authentication is required to rollback a transaction"
-msgstr "Na vrátenie transakcie je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:19
-msgid ""
-"Authentication is required to set the network proxy used for downloading "
-"packages"
-msgstr ""
-"Na nastavenie proxy servera na zÃskavanie balÃkov je potrebné overenie "
-"totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:20
-msgid "Authentication is required to update packages"
-msgstr "Na aktualizáciu balÃkov je potrebné overenie totožnosti"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:21
-msgid "Authentication is required to upgrade the operating system"
-msgstr "Na aktualizáciu operaÄného systému je potrebné overenie totožnosti"
-
-#. SECURITY:
#. - Normal users are allowed to cancel their own task without
#. authentication, but a different user id needs the admin password
#. to cancel another users task.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:27
+#: ../policy/org.freedesktop.packagekit.policy.in.h:6
msgid "Cancel foreign task"
msgstr "Zrušiť cudziu úlohu"
-#. SECURITY:
-#. - This is used when users want to install to a different prefix, for
-#. instance to a LTSP image or a virtual machine.
-#. - This could be used to overwrite files not owned by the user using
-#. a carefully created package file.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:34
-msgid "Change location that packages are installed"
-msgstr "ZmeniÅ¥ miesto, kam sa inÅ¡talujú balÃky"
-
-#. SECURITY:
-#. - Normal users require admin authentication to enable or disable
-#. software sources as this can be used to enable new updates or
-#. install different versions of software.
-#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:40
-msgid "Change software source parameters"
-msgstr "Zmeniť parametre zdrojov softvéru"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:7
+msgid ""
+"Authentication is required to cancel a task that was not started by yourself"
+msgstr "Na zrušenie úlohy, ktorú ste sami nespustili, je potrebné overenie totožnosti"
#. SECURITY:
#. - Normal users do not need authentication to install signed packages
@@ -1940,38 +1824,57 @@ msgstr "Zmeniť parametre zdrojov softvéru"
#. - Paranoid users (or parents!) can change this to 'auth_admin' or
#. 'auth_admin_keep'.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:47
+#: ../policy/org.freedesktop.packagekit.policy.in.h:14
msgid "Install signed package"
msgstr "InÅ¡talovaÅ¥ podpÃsaný balÃk"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:15
+msgid "Authentication is required to install a signed package"
+msgstr "Na inÅ¡talovanie podpÃsaného balÃka je potrebné overenie totožnosti"
+
#. SECURITY:
#. - Normal users require admin authentication to install untrusted or
#. unrecognised packages, as allowing users to do this without a
#. password would be a massive security hole.
#. - This is not retained as each package should be authenticated.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:54
+#: ../policy/org.freedesktop.packagekit.policy.in.h:22
msgid "Install untrusted local file"
msgstr "Inštalovať nedôveryhodný lokálny súbor"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:23
+msgid "Authentication is required to install an untrusted package"
+msgstr "Na inÅ¡taláciu nedôveryhodného balÃka je potrebné overenie totožnosti"
+
#. SECURITY:
-#. - Normal users do not require admin authentication to refresh the
-#. cache, as this doesn't actually install or remove software.
+#. - Normal users require admin authentication to add signing keys.
+#. - This implies adding an explicit trust, and should not be granted
+#. without a secure authentication.
+#. - This is not kept as each package should be authenticated.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:59
-msgid "Refresh system sources"
-msgstr "Obnoviť zdroje pre systém"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:30
+msgid "Trust a key used for signing packages"
+msgstr "DôverovaÅ¥ kľúÄu na podpisovanie balÃkov"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:31
+msgid ""
+"Authentication is required to consider a key used for signing packages as "
+"trusted"
+msgstr "Na vyjadrenie dôvery kľúÄu použÃvaného na podpisovanie balÃkov je potrebné overenie totožnosti"
#. SECURITY:
-#. - Normal users require admin authentication to rebind a driver
-#. so that it works after we install firmware.
-#. - This should not be set to 'yes' as unprivileged users could then
-#. try to rebind drivers in use, for instance security authentication
-#. devices.
+#. - Normal users do not require admin authentication to accept new
+#. licence agreements.
+#. - Change this to 'auth_admin' for environments where users should not
+#. be given the option to make legal decisions.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:67
-msgid "Reload a device"
-msgstr "Obnoviť zariadenie"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:38
+msgid "Accept EULA"
+msgstr "PrijaÅ¥ licenÄné podmienky"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:39
+msgid "Authentication is required to accept a EULA"
+msgstr "Na prijatie licenÄných podmienok je potrebné overenie totožnosti"
#. SECURITY:
#. - Normal users require admin authentication to remove packages as
@@ -1982,117 +1885,199 @@ msgstr "Obnoviť zariadenie"
#. be removed. If this is not possible, change this authentication to
#. 'auth_admin'.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:77
+#: ../policy/org.freedesktop.packagekit.policy.in.h:49
msgid "Remove package"
msgstr "OdstrániÅ¥ balÃk"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:50
+msgid "Authentication is required to remove packages"
+msgstr "Na odstránenie balÃkov je potrebné overenie totožnosti"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to update the
+#. system as the packages will be signed, and the action is required
+#. to update the system when unattended.
+#. - Changing this to anything other than 'yes' will break unattended
+#. updates.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:58
+msgid "Update packages"
+msgstr "AktualizovaÅ¥ balÃky"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:59
+msgid "Authentication is required to update packages"
+msgstr "Na aktualizáciu balÃkov je potrebné overenie totožnosti"
+
#. SECURITY:
#. - Normal users require admin authentication to rollback system state
#. as this will change a large number of packages, and could expose the
#. system to previously patched security vulnerabilities.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:83
+#: ../policy/org.freedesktop.packagekit.policy.in.h:65
msgid "Rollback to a previous transaction"
msgstr "Navrátiť sa k stavu pred transakciou"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:66
+msgid "Authentication is required to rollback a transaction"
+msgstr "Na vrátenie transakcie je potrebné overenie totožnosti"
+
+#. SECURITY:
+#. - Normal users require admin authentication to enable or disable
+#. software sources as this can be used to enable new updates or
+#. install different versions of software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:72
+msgid "Change software source parameters"
+msgstr "Zmeniť parametre zdrojov softvéru"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:73
+msgid "Authentication is required to change software source parameters"
+msgstr "Na zmenu parametrov softvérového zdroja je potrebné overenie totožnosti"
+
+#. SECURITY:
+#. - Normal users do not require admin authentication to refresh the
+#. cache, as this doesn't actually install or remove software.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:78
+msgid "Refresh system sources"
+msgstr "Obnoviť zdroje pre systém"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:79
+msgid "Authentication is required to refresh the system sources"
+msgstr "Na obnovenie zdrojov systému je potrebné overenie totožnosti"
+
#. SECURITY:
#. - Normal users do not require admin authentication to set the proxy
#. used for downloading packages.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:88
+#: ../policy/org.freedesktop.packagekit.policy.in.h:84
msgid "Set network proxy"
msgstr "Nastaviť proxy server"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:85
+msgid ""
+"Authentication is required to set the network proxy used for downloading "
+"packages"
+msgstr "Na nastavenie proxy servera na zÃskavanie balÃkov je potrebné overenie totožnosti"
+
#. SECURITY:
-#. - Normal users require admin authentication to add signing keys.
-#. - This implies adding an explicit trust, and should not be granted
-#. without a secure authentication.
-#. - This is not kept as each package should be authenticated.
+#. - This is used when users want to install to a different prefix, for
+#. instance to a LTSP image or a virtual machine.
+#. - This could be used to overwrite files not owned by the user using
+#. a carefully created package file.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:95
-msgid "Trust a key used for signing packages"
-msgstr "DôverovaÅ¥ kľúÄu na podpisovanie balÃkov"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:92
+msgid "Change location that packages are installed"
+msgstr "ZmeniÅ¥ miesto, kam sa inÅ¡talujú balÃky"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:93
+msgid ""
+"Authentication is required to change the location used to decompress "
+"packages"
+msgstr "Na zmenu adresára, kam sa rozbaľujú balÃky, je potrebné overenie totožnosti"
#. SECURITY:
-#. - Normal users do not require admin authentication to update the
-#. system as the packages will be signed, and the action is required
-#. to update the system when unattended.
-#. - Changing this to anything other than 'yes' will break unattended
-#. updates.
+#. - Normal users require admin authentication to rebind a driver
+#. so that it works after we install firmware.
+#. - This should not be set to 'yes' as unprivileged users could then
+#. try to rebind drivers in use, for instance security authentication
+#. devices.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:103
-msgid "Update packages"
-msgstr "AktualizovaÅ¥ balÃky"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:101
+msgid "Reload a device"
+msgstr "Obnoviť zariadenie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:102
+msgid "Authentication is required to reload the device with a new driver"
+msgstr "Na naÄÃtanie nového ovládaÄa zariadenia je potrebné overenie totožnosti"
#. SECURITY:
#. - Normal users require admin authentication to upgrade the disto as
#. this can make the system unbootable or stop other applications from
#. working.
#.
-#: ../policy/org.freedesktop.packagekit.policy.in.h:109
+#: ../policy/org.freedesktop.packagekit.policy.in.h:108
msgid "Upgrade System"
msgstr "Aktualizovať systém"
+#: ../policy/org.freedesktop.packagekit.policy.in.h:109
+msgid "Authentication is required to upgrade the operating system"
+msgstr "Na aktualizáciu operaÄného systému je potrebné overenie totožnosti"
+
+#. SECURITY:
+#. - Normal users require admin authentication to repair the system
+#. since this can make the system unbootable or stop other
+#. applications from working.
+#.
+#: ../policy/org.freedesktop.packagekit.policy.in.h:115
+msgid "Repair System"
+msgstr "Opraviť systém"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:116
+msgid "Authentication is required to repair the installed software"
+msgstr "Na opravenie nainštalovaného softvéru je potrebné overenie totožnosti"
+
#. TRANSLATORS: a backend is the system package tool, e.g. yum, apt
-#: ../src/pk-main.c:148
+#: ../src/pk-main.c:149
msgid "Packaging backend to use, e.g. dummy"
msgstr "Rozhranie balÃkového systému, ktoré sa má použiÅ¥, naprÃklad âdummyâ"
#. TRANSLATORS: if we should run in the background
-#: ../src/pk-main.c:151
+#: ../src/pk-main.c:152
msgid "Daemonize and detach from the terminal"
msgstr "Uvoľniť terminál a presunúť sa na pozadie"
#. TRANSLATORS: if we should not monitor how long we are inactive for
-#: ../src/pk-main.c:154
+#: ../src/pk-main.c:155
msgid "Disable the idle timer"
msgstr "Vypnúť poÄÃtadlo Äasu neÄinnosti"
#. TRANSLATORS: show version
-#: ../src/pk-main.c:157
+#: ../src/pk-main.c:158
msgid "Show version and exit"
msgstr "ZobraziÅ¥ verziu a skonÄiÅ¥"
#. TRANSLATORS: exit after we've started up, used for user profiling
-#: ../src/pk-main.c:160
+#: ../src/pk-main.c:161
msgid "Exit after a small delay"
msgstr "SkonÄiÅ¥ po krátkej prestávke"
#. TRANSLATORS: exit straight away, used for automatic profiling
-#: ../src/pk-main.c:163
+#: ../src/pk-main.c:164
msgid "Exit after the engine has loaded"
msgstr "SkonÄiÅ¥ po naÄÃtanà jadra"
+#. TRANSLATORS: don't unset environment variables, used for debugging
+#: ../src/pk-main.c:167
+msgid "Don't clear environment on startup"
+msgstr "NeÄistiÅ¥ prostredie poÄas Å¡tartu"
+
#. TRANSLATORS: describing the service that is running
-#: ../src/pk-main.c:177
+#: ../src/pk-main.c:179
msgid "PackageKit service"
msgstr "Služba PackageKit"
-#: ../src/pk-main.c:249
+#: ../src/pk-main.c:253
msgid "Failed to load any of the specified backends:"
msgstr "Nepodarilo sa naÄÃtaÅ¥ žiadne z uvedených rozhranÃ:"
#. TRANSLATORS: is not GPG signed
-#: ../src/pk-transaction.c:2659
+#: ../src/pk-transaction.c:2972
msgid "The software is not from a trusted source."
msgstr "Tento softvér nepochádza z dôveryhodného zdroja."
-#: ../src/pk-transaction.c:2667
+#: ../src/pk-transaction.c:2980
msgid "Do not update this package unless you are sure it is safe to do so."
-msgstr ""
-"Neaktualizujte tento balÃk, pokiaľ si nie ste istý, že to je bezpeÄné."
+msgstr "Neaktualizujte tento balÃk, pokiaľ si nie ste istý, že to je bezpeÄné."
-#: ../src/pk-transaction.c:2668
+#: ../src/pk-transaction.c:2981
msgid "Do not update these packages unless you are sure it is safe to do so."
-msgstr ""
-"Neaktualizujte tieto balÃky, pokiaľ si nie ste istý, že to je bezpeÄné."
+msgstr "Neaktualizujte tieto balÃky, pokiaľ si nie ste istý, že to je bezpeÄné."
-#: ../src/pk-transaction.c:2678
+#: ../src/pk-transaction.c:2991
msgid "Do not install this package unless you are sure it is safe to do so."
msgstr "NeinÅ¡talujte tento balÃk, pokiaľ si nie ste istý, že to je bezpeÄné."
-#: ../src/pk-transaction.c:2679
+#: ../src/pk-transaction.c:2992
msgid "Do not install these packages unless you are sure it is safe to do so."
msgstr "NeinÅ¡talujte tieto balÃky, pokiaľ si nie ste istý, že to je bezpeÄné."
-
-
commit 79545c4c40b20c2380c18971122efb7c72b7dd0a
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Mon Apr 23 18:23:10 2012 -0300
packagekit-qt2: Since new methods and enums where added let's change the version number to 2.0.1
diff --git a/configure.ac b/configure.ac
index 792a858..bb18059 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,7 +55,7 @@ AC_SUBST(LT_AGE)
#
LT_QT_CURRENT=2
LT_QT_REVISION=0
-LT_QT_AGE=0
+LT_QT_AGE=1
AC_SUBST(LT_QT_CURRENT)
AC_SUBST(LT_QT_REVISION)
AC_SUBST(LT_QT_AGE)
commit 6c76071f88a17ddaf0aa8e02fb71f5403cef8b75
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 22 13:07:14 2012 -0300
aptcc: Create a PkgList class to provide convience methods and remove uneeded apt-intf.h includes
diff --git a/backends/aptcc/Makefile.am b/backends/aptcc/Makefile.am
index e84a0d4..3357936 100644
--- a/backends/aptcc/Makefile.am
+++ b/backends/aptcc/Makefile.am
@@ -4,7 +4,8 @@ INCLUDES = \
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_aptcc.la
-libpk_backend_aptcc_la_SOURCES = pkg_acqfile.cpp \
+libpk_backend_aptcc_la_SOURCES = PkgList.cpp \
+ pkg_acqfile.cpp \
acqpkitstatus.cpp \
deb-file.cpp \
matcher.cpp \
@@ -25,6 +26,7 @@ aptconfdir = ${SYSCONFDIR}/apt/apt.conf.d
aptconf_DATA = 20packagekit
EXTRA_DIST = 20packagekit \
+ PkgList.h \
apt-intf.h \
apt-utils.h \
apt-sourceslist.h \
diff --git a/backends/aptcc/PkgList.cpp b/backends/aptcc/PkgList.cpp
new file mode 100644
index 0000000..b688675
--- /dev/null
+++ b/backends/aptcc/PkgList.cpp
@@ -0,0 +1,74 @@
+/* PkgList.cpp
+ *
+ * Copyright (c) 2012 Daniel Nicoletti <dantti12 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "PkgList.h"
+
+#include <algorithm>
+
+// compare...uses the candidate version of each package.
+class compare
+{
+public:
+ compare() {}
+
+ bool operator()(const pkgCache::VerIterator &a,
+ const pkgCache::VerIterator &b) {
+ int ret = strcmp(a.ParentPkg().Name(), b.ParentPkg().Name());
+ if (ret == 0) {
+ return strcmp(a.VerStr(), b.VerStr()) < 0;
+ }
+ return ret < 0;
+ }
+};
+
+/** \brief operator== for match results. */
+class result_equality
+{
+public:
+ result_equality() {}
+
+ bool operator() (const pkgCache::VerIterator &a, const pkgCache::VerIterator &b) {
+ return strcmp(a.ParentPkg().Name(), b.ParentPkg().Name()) == 0 &&
+ strcmp(a.VerStr(), b.VerStr()) == 0 &&
+ strcmp(a.Arch(), b.Arch()) == 0;
+ }
+};
+
+bool PkgList::contains(const pkgCache::PkgIterator &pkg)
+{
+ for (PkgList::const_iterator it = begin(); it != end(); ++it) {
+ if (it->ParentPkg() == pkg) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void PkgList::sort()
+{
+ // Sort so we can remove the duplicated entries
+ std::sort(begin(), end(), compare());
+}
+
+void PkgList::removeDuplicates()
+{
+ // Remove the duplicated entries
+ erase(unique(begin(), end(), result_equality()), end());
+}
diff --git a/backends/aptcc/PkgList.h b/backends/aptcc/PkgList.h
new file mode 100644
index 0000000..103a64e
--- /dev/null
+++ b/backends/aptcc/PkgList.h
@@ -0,0 +1,49 @@
+/* PkgList.h
+ *
+ * Copyright (c) 2012 Daniel Nicoletti <dantti12 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef PKG_LIST_H
+#define PKG_LIST_H
+
+#include <apt-pkg/pkgcache.h>
+
+using std::vector;
+
+/**
+ * This class is maent to show Operation Progress using PackageKit
+ */
+class PkgList : public vector<pkgCache::VerIterator>
+{
+public:
+ /**
+ * Return if the given vector contain a package
+ */
+ bool contains(const pkgCache::PkgIterator &pkg);
+
+ /**
+ * Sort the package list
+ */
+ void sort();
+
+ /**
+ * Remove duplicated packages (it's recommended to sort() first)
+ */
+ void removeDuplicates();
+};
+
+#endif // PKG_LIST_H
diff --git a/backends/aptcc/acqpkitstatus.cpp b/backends/aptcc/acqpkitstatus.cpp
index e95b8ac..cdaa36d 100644
--- a/backends/aptcc/acqpkitstatus.cpp
+++ b/backends/aptcc/acqpkitstatus.cpp
@@ -20,6 +20,8 @@
#include "acqpkitstatus.h"
+#include "apt-intf.h"
+
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
diff --git a/backends/aptcc/acqpkitstatus.h b/backends/aptcc/acqpkitstatus.h
index 7d09a1a..0977f44 100644
--- a/backends/aptcc/acqpkitstatus.h
+++ b/backends/aptcc/acqpkitstatus.h
@@ -24,8 +24,13 @@
#include <apt-pkg/acquire.h>
#include <pk-backend.h>
-#include "apt-intf.h"
+#include "PkgList.h"
+#include <set>
+
+using std::set;
+
+class AptIntf;
class AcqPackageKitStatus : public pkgAcquireStatus
{
public:
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 60aa488..edd4589 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -349,13 +349,10 @@ void AptIntf::emitPackage(const pkgCache::VerIterator &ver, PkInfoEnum state)
void AptIntf::emitPackages(PkgList &output, PkBitfield filters, PkInfoEnum state)
{
// Sort so we can remove the duplicated entries
- sort(output.begin(), output.end(), compare());
+ output.sort();
// Remove the duplicated entries
- output.erase(unique(output.begin(),
- output.end(),
- result_equality()),
- output.end());
+ output.removeDuplicates();
for (PkgList::const_iterator it = output.begin(); it != output.end(); ++it) {
if (m_cancel) {
@@ -371,13 +368,10 @@ void AptIntf::emitPackages(PkgList &output, PkBitfield filters, PkInfoEnum state
void AptIntf::emitRequireRestart(PkgList &output)
{
// Sort so we can remove the duplicated entries
- sort(output.begin(), output.end(), compare());
-
+ output.sort();
+
// Remove the duplicated entries
- output.erase(unique(output.begin(),
- output.end(),
- result_equality()),
- output.end());
+ output.removeDuplicates();
for (PkgList::const_iterator it = output.begin(); it != output.end(); ++it) {
gchar *package_id;
@@ -391,12 +385,10 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
{
PkInfoEnum state;
// Sort so we can remove the duplicated entries
- sort(output.begin(), output.end(), compare());
+ output.sort();
+
// Remove the duplicated entries
- output.erase(unique(output.begin(),
- output.end(),
- result_equality()),
- output.end());
+ output.removeDuplicates();
for (PkgList::const_iterator i = output.begin(); i != output.end(); ++i) {
if (m_cancel) {
@@ -673,10 +665,10 @@ void AptIntf::emitPackageDetail(const pkgCache::VerIterator &ver)
void AptIntf::emitDetails(PkgList &pkgs)
{
// Sort so we can remove the duplicated entries
- sort(pkgs.begin(), pkgs.end(), compare());
+ pkgs.sort();
+
// Remove the duplicated entries
- pkgs.erase(unique(pkgs.begin(), pkgs.end(), result_equality()),
- pkgs.end());
+ pkgs.removeDuplicates();
for (PkgList::const_iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
if (m_cancel) {
@@ -946,7 +938,7 @@ void AptIntf::getDepends(PkgList &output,
continue;
} else if (dep->Type == pkgCache::Dep::Depends) {
if (recursive) {
- if (!contains(output, dep.TargetPkg())) {
+ if (!output.contains(dep.TargetPkg())) {
output.push_back(ver);
getDepends(output, ver, recursive);
}
@@ -980,7 +972,7 @@ void AptIntf::getRequires(PkgList &output,
for (PkgList::const_iterator it = deps.begin(); it != deps.end(); ++it) {
if (*it == ver) {
if (recursive) {
- if (!contains(output, parentPkg)) {
+ if (!output.contains(parentPkg)) {
output.push_back(parentVer);
getRequires(output, parentVer, recursive);
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 1d80b06..1fafc51 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -31,14 +31,12 @@
#include <pk-backend.h>
+#include "PkgList.h"
+
#define PREUPGRADE_BINARY "/usr/bin/do-release-upgrade"
#define GDEBI_BINARY "/usr/bin/gdebi"
#define REBOOT_REQUIRED "/var/run/reboot-required"
-using namespace std;
-
-typedef vector<pkgCache::VerIterator> PkgList;
-
class pkgProblemResolver;
class Matcher;
class AptCacheFile;
diff --git a/backends/aptcc/apt-messages.cpp b/backends/aptcc/apt-messages.cpp
index 4c38d06..d011bee 100644
--- a/backends/aptcc/apt-messages.cpp
+++ b/backends/aptcc/apt-messages.cpp
@@ -24,6 +24,8 @@
#include "apt-utils.h"
+#include <apt-pkg/error.h>
+
#include <sstream>
using namespace std;
diff --git a/backends/aptcc/apt-sourceslist.cpp b/backends/aptcc/apt-sourceslist.cpp
index a984493..36d1db5 100644
--- a/backends/aptcc/apt-sourceslist.cpp
+++ b/backends/aptcc/apt-sourceslist.cpp
@@ -37,7 +37,6 @@
#include <fstream>
#include "config.h"
-#include "apt-intf.h"
SourcesList::~SourcesList()
{
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 6fea1ac..9d22a19 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -22,6 +22,8 @@
#include "pkg_acqfile.h"
+#include <glib/gstdio.h>
+
#include <fstream>
PkGroupEnum get_enum_group(string group)
@@ -242,16 +244,6 @@ string getBugzillaUrls(const string &changelog)
return ret;
}
-bool contains(const PkgList &packages, const pkgCache::PkgIterator &pkg)
-{
- for (PkgList::const_iterator it = packages.begin(); it != packages.end(); ++it) {
- if (it->ParentPkg() == pkg) {
- return true;
- }
- }
- return false;
-}
-
bool ends_with(const string &str, const char *end)
{
size_t endSize = strlen(end);
diff --git a/backends/aptcc/apt-utils.h b/backends/aptcc/apt-utils.h
index 3297e16..0102fde 100644
--- a/backends/aptcc/apt-utils.h
+++ b/backends/aptcc/apt-utils.h
@@ -25,36 +25,11 @@
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/acquire.h>
-#include "apt-intf.h"
+#include <glib.h>
-// compare...uses the candidate version of each package.
-class compare
-{
-public:
- compare() {}
+#include <pk-backend.h>
- bool operator()(const pkgCache::VerIterator &a,
- const pkgCache::VerIterator &b) {
- int ret = strcmp(a.ParentPkg().Name(), b.ParentPkg().Name());
- if (ret == 0) {
- return strcmp(a.VerStr(), b.VerStr()) < 0;
- }
- return ret < 0;
- }
-};
-
-/** \brief operator== for match results. */
-class result_equality
-{
-public:
- result_equality() {}
-
- bool operator() (const pkgCache::VerIterator &a, const pkgCache::VerIterator &b) {
- return strcmp(a.ParentPkg().Name(), b.ParentPkg().Name()) == 0 &&
- strcmp(a.VerStr(), b.VerStr()) == 0 &&
- strcmp(a.Arch(), b.Arch()) == 0;
- }
-};
+using namespace std;
/**
* Return the PkEnumGroup of the give group string.
@@ -82,11 +57,6 @@ string getCVEUrls(const string &changelog);
string getBugzillaUrls(const string &changelog);
/**
- * Return if the given vector contain a package
- */
-bool contains(const PkgList &packages, const pkgCache::PkgIterator &pkg);
-
-/**
* Return if the given string ends with the other
*/
bool ends_with(const string &str, const char *end);
commit 311255d4a62678bd35b21304b3793ff8e4bbe8bc
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 22 12:15:22 2012 -0300
aptcc: Cleanup includes
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index 7753a99..9ce31e4 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -98,6 +98,11 @@ bool AptCacheFile::CheckDeps(bool FixBroken)
return true;
}
+bool AptCacheFile::DistUpgrade()
+{
+ return pkgDistUpgrade(*this);
+}
+
void AptCacheFile::ShowBroken(bool Now, PkErrorEnum error)
{
std::stringstream out;
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
index 49a5e31..b8fe04d 100644
--- a/backends/aptcc/AptCacheFile.h
+++ b/backends/aptcc/AptCacheFile.h
@@ -53,6 +53,11 @@ public:
*/
bool CheckDeps(bool FixBroken = false);
+ /**
+ * Mark Cache for dist-upgrade
+ */
+ bool DistUpgrade();
+
/** Shows a list of all broken packages together with their
* dependencies. Similar to and based on the equivalent routine in
* apt-get.
diff --git a/backends/aptcc/acqpkitstatus.cpp b/backends/aptcc/acqpkitstatus.cpp
index 3e30687..e95b8ac 100644
--- a/backends/aptcc/acqpkitstatus.cpp
+++ b/backends/aptcc/acqpkitstatus.cpp
@@ -1,6 +1,6 @@
/* acqpkitstatus.cpp
*
- * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009 Daniel Nicoletti <dantti at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,18 +20,8 @@
#include "acqpkitstatus.h"
-#include "pkg_acqfile.h"
-
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/error.h>
-
-#include <stdio.h>
-#include <signal.h>
-#include <iostream>
-
-using namespace std;
// AcqPackageKitStatus::AcqPackageKitStatus - Constructor
// ---------------------------------------------------------------------
diff --git a/backends/aptcc/acqpkitstatus.h b/backends/aptcc/acqpkitstatus.h
index b338809..7d09a1a 100644
--- a/backends/aptcc/acqpkitstatus.h
+++ b/backends/aptcc/acqpkitstatus.h
@@ -1,6 +1,6 @@
/* acqpkitstatus.h
*
- * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009 Daniel Nicoletti <dantti12 at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 2b26cb9..60aa488 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -2,7 +2,7 @@
*
* Copyright (c) 1999-2008 Daniel Burrows
* Copyright (c) 2004 Michael Vogt <mvo at debian.org>
- * 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2009 Daniel Nicoletti <dantti12 at gmail.com>
* 2012 Matthias Klumpp <matthias at tenstral.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -24,13 +24,10 @@
#include "apt-intf.h"
#include <apt-pkg/error.h>
-#include <apt-pkg/tagfile.h>
#include <apt-pkg/algorithms.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/sptr.h>
#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/sptr.h>
#include <apt-pkg/version.h>
-#include <apt-pkg/aptconfiguration.h>
#include <sys/statvfs.h>
#include <sys/statfs.h>
@@ -40,9 +37,8 @@
#include <fstream>
#include <dirent.h>
-#include <assert.h>
-#include <regex.h>
+#include "AptCacheFile.h"
#include "apt-utils.h"
#include "matcher.h"
#include "gstMatcher.h"
@@ -54,7 +50,6 @@
#define RAMFS_MAGIC 0x858458f6
AptIntf::AptIntf(PkBackend *backend, bool &cancel) :
- m_cache(backend),
m_backend(backend),
m_cancel(cancel),
m_terminalTimeout(120),
@@ -64,6 +59,8 @@ AptIntf::AptIntf(PkBackend *backend, bool &cancel) :
// Make sure initial m_time is 0
m_restartStat.st_mtime = 0;
+
+ m_cache = new AptCacheFile(backend);
}
bool AptIntf::init()
@@ -98,7 +95,7 @@ bool AptIntf::init()
// Tries to open the cache
bool ret;
- ret = m_cache.Open();
+ ret = m_cache->Open();
// Prepare for the restart thing
if (g_file_test(REBOOT_REQUIRED, G_FILE_TEST_EXISTS)) {
@@ -129,6 +126,8 @@ AptIntf::~AptIntf()
}
}
+ delete m_cache;
+
pk_backend_finished(m_backend);
}
@@ -150,7 +149,7 @@ pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
pkgCache::PkgIterator pkg;
parts = pk_package_id_split(packageId);
- pkg = m_cache->FindPkg(parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
+ pkg = (*m_cache)->FindPkg(parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg.end() || (pkg.VersionList().end() && pkg.ProvidesList().end())) {
@@ -166,7 +165,7 @@ pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
return ver;
}
- const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache->findCandidateVer(pkg);
// check to see if the provided package isn't virtual too
if (candidateVer.end() == false &&
strcmp(candidateVer.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0) {
@@ -187,7 +186,7 @@ pkgCache::VerIterator AptIntf::findVer(const pkgCache::PkgIterator &pkg)
}
// Else get the candidate version iterator
- const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache->findCandidateVer(pkg);
if (!candidateVer.end()) {
return candidateVer;
}
@@ -343,7 +342,7 @@ void AptIntf::emitPackage(const pkgCache::VerIterator &ver, PkInfoEnum state)
pk_backend_package(m_backend,
state,
package_id,
- m_cache.getShortDescription(ver).c_str());
+ m_cache->getShortDescription(ver).c_str());
g_free(package_id);
}
@@ -443,7 +442,7 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
return;
}
- for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ for (pkgCache::PkgIterator pkg = m_cache->GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
if (m_cancel) {
delete matcher;
break;
@@ -458,14 +457,14 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
// Ignore virtual packages
pkgCache::VerIterator ver = findVer(pkg);
if (ver.end() == true) {
- ver = m_cache.findCandidateVer(pkg);
+ ver = m_cache->findCandidateVer(pkg);
if (ver.end() == true) {
continue;
}
}
pkgCache::VerFileIterator vf = ver.FileList();
- pkgRecords::Parser &rec = m_cache.GetPkgRecords()->Lookup(vf);
+ pkgRecords::Parser &rec = m_cache->GetPkgRecords()->Lookup(vf);
const char *start, *stop;
rec.GetRec(start, stop);
string record(start, stop - start);
@@ -521,7 +520,7 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
g_debug ("pkg-name: %s", libPkgName.c_str ());
- for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ for (pkgCache::PkgIterator pkg = m_cache->GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
// Ignore packages that exist only due to dependencies.
if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
continue;
@@ -530,7 +529,7 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
// TODO: Ignore virtual packages
pkgCache::VerIterator ver = findVer (pkg);
if (ver.end()) {
- ver = m_cache.findCandidateVer(pkg);
+ ver = m_cache->findCandidateVer(pkg);
if (ver.end()) {
continue;
}
@@ -577,7 +576,7 @@ bool AptIntf::getArchive(pkgAcquire *Owner,
// Does not really matter here.. we are going to fail out below
if (Vf.end() != true) {
// If this fails to get a file name we will bomb out below.
- pkgRecords::Parser &Parse = m_cache.GetPkgRecords()->Lookup(Vf);
+ pkgRecords::Parser &Parse = m_cache->GetPkgRecords()->Lookup(Vf);
if (_error->PendingError() == true) {
return false;
}
@@ -597,12 +596,12 @@ bool AptIntf::getArchive(pkgAcquire *Owner,
// Try to cross match against the source list
pkgIndexFile *Index;
- if (m_cache.GetSourceList()->FindIndex(Vf.File(),Index) == false) {
+ if (m_cache->GetSourceList()->FindIndex(Vf.File(),Index) == false) {
continue;
}
// Grab the text package record
- pkgRecords::Parser &Parse = m_cache.GetPkgRecords()->Lookup(Vf);
+ pkgRecords::Parser &Parse = m_cache->GetPkgRecords()->Lookup(Vf);
if (_error->PendingError() == true) {
return false;
}
@@ -648,7 +647,7 @@ void AptIntf::emitPackageDetail(const pkgCache::VerIterator &ver)
section = section.substr(found + 1);
pkgCache::VerFileIterator vf = ver.FileList();
- pkgRecords::Parser &rec = m_cache.GetPkgRecords()->Lookup(vf);
+ pkgRecords::Parser &rec = m_cache->GetPkgRecords()->Lookup(vf);
long size;
if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
@@ -664,7 +663,7 @@ void AptIntf::emitPackageDetail(const pkgCache::VerIterator &ver)
package_id,
"unknown",
get_enum_group(section),
- m_cache.getLongDescriptionParsed(ver).c_str(),
+ m_cache->getLongDescriptionParsed(ver).c_str(),
rec.Homepage().c_str(),
size);
@@ -708,7 +707,7 @@ void AptIntf::emitUpdateDetail(const pkgCache::VerIterator &candver)
pkgCache::VerFileIterator vf = candver.FileList();
string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
- pkgRecords::Parser &rec = m_cache.GetPkgRecords()->Lookup(candver.FileList());
+ pkgRecords::Parser &rec = m_cache->GetPkgRecords()->Lookup(candver.FileList());
// Build the changelogURI
char uri[512];
@@ -963,7 +962,7 @@ void AptIntf::getRequires(PkgList &output,
const pkgCache::VerIterator &ver,
bool recursive)
{
- for (pkgCache::PkgIterator parentPkg = m_cache.GetPkgCache()->PkgBegin(); !parentPkg.end(); ++parentPkg) {
+ for (pkgCache::PkgIterator parentPkg = m_cache->GetPkgCache()->PkgBegin(); !parentPkg.end(); ++parentPkg) {
if (m_cancel) {
break;
}
@@ -998,8 +997,8 @@ void AptIntf::getRequires(PkgList &output,
PkgList AptIntf::getPackages()
{
PkgList output;
- output.reserve(m_cache.GetPkgCache()->HeaderP->PackageCount);
- for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ output.reserve(m_cache->GetPkgCache()->HeaderP->PackageCount);
+ for (pkgCache::PkgIterator pkg = m_cache->GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
if (m_cancel) {
break;
}
@@ -1038,7 +1037,7 @@ PkgList AptIntf::getPackagesFromGroup(gchar **values)
pk_backend_set_allow_cancel(m_backend, true);
- for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ for (pkgCache::PkgIterator pkg = m_cache->GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
if (m_cancel) {
break;
}
@@ -1070,10 +1069,18 @@ PkgList AptIntf::getPackagesFromGroup(gchar **values)
return output;
}
-PkgList AptIntf::searchPackageName(Matcher *matcher)
+PkgList AptIntf::searchPackageName(gchar *search)
{
PkgList output;
- for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+
+ Matcher *matcher = new Matcher(search);
+ if (matcher->hasError()) {
+ g_debug("Regex compilation error");
+ delete matcher;
+ return output;
+ }
+
+ for (pkgCache::PkgIterator pkg = m_cache->GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
if (m_cancel) {
break;
}
@@ -1105,10 +1112,18 @@ PkgList AptIntf::searchPackageName(Matcher *matcher)
return output;
}
-PkgList AptIntf::searchPackageDetails(Matcher *matcher)
+PkgList AptIntf::searchPackageDetails(gchar *search)
{
PkgList output;
- for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+
+ Matcher *matcher = new Matcher(search);
+ if (matcher->hasError()) {
+ g_debug("Regex compilation error");
+ delete matcher;
+ return output;
+ }
+
+ for (pkgCache::PkgIterator pkg = m_cache->GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
if (m_cancel) {
break;
}
@@ -1120,7 +1135,7 @@ PkgList AptIntf::searchPackageDetails(Matcher *matcher)
const pkgCache::VerIterator &ver = findVer(pkg);
if (ver.end() == false) {
if (matcher->matches(pkg.Name()) ||
- matcher->matches(m_cache.getLongDescription(ver))) {
+ matcher->matches((*m_cache).getLongDescription(ver))) {
// The package matched
output.push_back(ver);
}
@@ -1202,7 +1217,7 @@ PkgList AptIntf::searchPackageFiles(gchar **values)
if (m_cancel) {
break;
}
- const pkgCache::PkgIterator &pkg = m_cache->FindPkg(*it);
+ const pkgCache::PkgIterator &pkg = (*m_cache)->FindPkg(*it);
if (pkg.end() == true) {
continue;
}
@@ -1283,7 +1298,7 @@ void AptIntf::providesMimeType(PkgList &output, gchar **values)
if (m_cancel) {
break;
}
- const pkgCache::PkgIterator &pkg = m_cache->FindPkg(*it);
+ const pkgCache::PkgIterator &pkg = (*m_cache)->FindPkg(*it);
if (pkg.end() == true) {
continue;
}
@@ -1298,7 +1313,7 @@ void AptIntf::providesMimeType(PkgList &output, gchar **values)
if (output.empty()) {
// check if app-install-data is installed
pkgCache::PkgIterator pkg;
- pkg = m_cache->FindPkg("app-install-data");
+ pkg = (*m_cache)->FindPkg("app-install-data");
if (pkg->CurrentState != pkgCache::State::Installed) {
pk_backend_error_code(m_backend,
PK_ERROR_ENUM_INTERNAL_ERROR,
@@ -1574,7 +1589,7 @@ PkgList AptIntf::checkChangedPackages(AptCacheFile &cache, bool emitChanged)
for (pkgCache::PkgIterator pkg = cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (cache[pkg].NewInstall() == true) {
// installing;
- const pkgCache::VerIterator &ver = m_cache.findCandidateVer(pkg);
+ const pkgCache::VerIterator &ver = m_cache->findCandidateVer(pkg);
if (!ver.end()) {
ret.push_back(ver);
installing.push_back(ver);
@@ -1598,7 +1613,7 @@ PkgList AptIntf::checkChangedPackages(AptCacheFile &cache, bool emitChanged)
}
} else if (cache[pkg].Upgrade() == true) {
// updating
- const pkgCache::VerIterator &ver = m_cache.findCandidateVer(pkg);
+ const pkgCache::VerIterator &ver = m_cache->findCandidateVer(pkg);
if (!ver.end()) {
ret.push_back(ver);
updating.push_back(ver);
@@ -1643,7 +1658,7 @@ void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
}
}
- const pkgCache::PkgIterator &pkg = m_cache->FindPkg(name);
+ const pkgCache::PkgIterator &pkg = (*m_cache)->FindPkg(name);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg.end() == true ||
(pkg.VersionList().end() && pkg.ProvidesList().end())) {
@@ -1656,7 +1671,7 @@ void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
emitPackage(ver, state);
}
- const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache->findCandidateVer(pkg);
// check to see if we found the package
if (candidateVer.end() == false) {
emitPackage(candidateVer, state);
@@ -2005,7 +2020,7 @@ PkgList AptIntf::resolvePackageIds(gchar **package_ids, PkBitfield filters)
// it can only return one package in this case we need to
// search the whole package cache and match the package
// name manually
- for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ for (pkgCache::PkgIterator pkg = m_cache->GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
if (m_cancel) {
break;
}
@@ -2026,14 +2041,14 @@ PkgList AptIntf::resolvePackageIds(gchar **package_ids, PkBitfield filters)
ret.push_back(ver);
}
- const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache->findCandidateVer(pkg);
// check to see if the provided package isn't virtual too
if (candidateVer.end() == false) {
ret.push_back(candidateVer);
}
}
} else {
- const pkgCache::PkgIterator &pkg = m_cache->FindPkg(pi);
+ const pkgCache::PkgIterator &pkg = (*m_cache)->FindPkg(pi);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg.end() == true || (pkg.VersionList().end() && pkg.ProvidesList().end())) {
continue;
@@ -2045,7 +2060,7 @@ PkgList AptIntf::resolvePackageIds(gchar **package_ids, PkBitfield filters)
ret.push_back(ver);
}
- const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache->findCandidateVer(pkg);
// check to see if the provided package isn't virtual too
if (candidateVer.end() == false) {
ret.push_back(candidateVer);
@@ -2069,7 +2084,7 @@ void AptIntf::refreshCache()
AcqPackageKitStatus Stat(this, m_backend, m_cancel);
// do the work
- ListUpdate(Stat, *m_cache.GetSourceList());
+ ListUpdate(Stat, *m_cache->GetSourceList());
}
void AptIntf::markAutoInstalled(AptCacheFile &cache, const PkgList &pkgs)
@@ -2414,7 +2429,7 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
// Create the package manager and prepare to download
SPtr<pkgPackageManager> PM = _system->CreatePM(cache);
- if (PM->GetArchives(&fetcher, m_cache.GetSourceList(), &Recs) == false ||
+ if (PM->GetArchives(&fetcher, m_cache->GetSourceList(), &Recs) == false ||
_error->PendingError() == true) {
return false;
}
@@ -2437,7 +2452,7 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
}
pkgCache::VerIterator ver = cache[pkg].InstVerIter(cache);
- if (ver.end() && (ver = m_cache.findCandidateVer(pkg))) {
+ if (ver.end() && (ver = m_cache->findCandidateVer(pkg))) {
// Ignore invalid versions
continue;
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index bbebbfd..1d80b06 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -1,7 +1,7 @@
/* apt-intf.h - Interface to APT
*
* Copyright (c) 1999-2002, 2004-2005, 2007-2008 Daniel Burrows
- * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009 Daniel Nicoletti <dantti12 at gmail.com>
* 2012 Matthias Klumpp <matthias at tenstral.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -26,9 +26,10 @@
#include <glib.h>
#include <glib/gstdio.h>
-#include <pk-backend.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/acquire.h>
-#include "AptCacheFile.h"
+#include <pk-backend.h>
#define PREUPGRADE_BINARY "/usr/bin/do-release-upgrade"
#define GDEBI_BINARY "/usr/bin/gdebi"
@@ -40,6 +41,7 @@ typedef vector<pkgCache::VerIterator> PkgList;
class pkgProblemResolver;
class Matcher;
+class AptCacheFile;
class AptIntf
{
public:
@@ -128,12 +130,12 @@ public:
/**
* Returns a list of all packages that matched their names with matcher
*/
- PkgList searchPackageName(Matcher *matcher);
+ PkgList searchPackageName(gchar *search);
/**
* Returns a list of all packages that matched their description with matcher
*/
- PkgList searchPackageDetails(Matcher *matcher);
+ PkgList searchPackageDetails(gchar *search);
/**
* Returns a list of all packages that matched contains the given files
@@ -251,7 +253,7 @@ private:
PkgList checkChangedPackages(AptCacheFile &cache, bool emitChanged);
void emitTransactionPackage(string name, PkInfoEnum state);
- AptCacheFile m_cache;
+ AptCacheFile *m_cache;
PkBackend *m_backend;
bool &m_cancel;
struct stat m_restartStat;
diff --git a/backends/aptcc/apt-messages.cpp b/backends/aptcc/apt-messages.cpp
index b95c0de..4c38d06 100644
--- a/backends/aptcc/apt-messages.cpp
+++ b/backends/aptcc/apt-messages.cpp
@@ -1,7 +1,7 @@
/* apt-messages.cpp
*
* Copyright (c) 2004 Daniel Burrows
- * Copyright (c) 2009-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009-2011 Daniel Nicoletti <dantti12 at gmail.com>
* 2011-2012 Matthias Klumpp <matthias at tenstral.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -24,9 +24,7 @@
#include "apt-utils.h"
-#include <string>
#include <sstream>
-#include <cstdio>
using namespace std;
diff --git a/backends/aptcc/apt-messages.h b/backends/aptcc/apt-messages.h
index bdd04d0..5cdf69b 100644
--- a/backends/aptcc/apt-messages.h
+++ b/backends/aptcc/apt-messages.h
@@ -1,7 +1,7 @@
/* apt-messages.h
*
* Copyright (c) 2004 Daniel Burrows
- * Copyright (c) 2009-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009-2011 Daniel Nicoletti <dantti12 at gmail.com>
* 2011-2012 Matthias Klumpp <matthias at tenstral.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -24,7 +24,6 @@
#define APT_MESSAGES_H
#include <pk-backend.h>
-#include <apt-pkg/cachefile.h>
/** \file apt-messages.h
*/
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 65f699c..6fea1ac 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009 Daniel Nicoletti <dantti12 at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,9 +20,9 @@
#include "apt-utils.h"
-#include <iostream>
+#include "pkg_acqfile.h"
+
#include <fstream>
-#include <sys/stat.h>
PkGroupEnum get_enum_group(string group)
{
diff --git a/backends/aptcc/apt-utils.h b/backends/aptcc/apt-utils.h
index 5147374..3297e16 100644
--- a/backends/aptcc/apt-utils.h
+++ b/backends/aptcc/apt-utils.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (c) 2001, 2005 Daniel Burrows (aptitude)
- * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009 Daniel Nicoletti <dantti12 at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,15 +23,9 @@
#define APT_UTILS_H
#include <apt-pkg/pkgrecords.h>
-
-#include <string.h>
-#include <set>
-#include <pk-backend.h>
+#include <apt-pkg/acquire.h>
#include "apt-intf.h"
-#include "pkg_acqfile.h"
-
-using namespace std;
// compare...uses the candidate version of each package.
class compare
diff --git a/backends/aptcc/deb-file.cpp b/backends/aptcc/deb-file.cpp
index aebe974..a7d3452 100644
--- a/backends/aptcc/deb-file.cpp
+++ b/backends/aptcc/deb-file.cpp
@@ -1,6 +1,6 @@
/* deb-file.cpp
*
- * Copyright (c) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2011 Daniel Nicoletti <dantti12 at gmail.com>
* 2012 Matthias Klumpp <matthias at tenstral.net>
*
* Licensed under the GNU General Public License Version 2
@@ -22,13 +22,9 @@
#include "deb-file.h"
-#include <apt-pkg/fileutl.h>
-#include <apt-pkg/tagfile.h>
#include <apt-pkg/init.h>
-#include <iostream>
-
-DebFile::DebFile(const std::string &filename) :
+DebFile::DebFile(const string &filename) :
m_filePath(filename)
{
FileFd in(filename, FileFd::ReadOnly);
@@ -51,45 +47,45 @@ bool DebFile::isValid() const
return m_isValid;
}
-std::string DebFile::filePath() const
+string DebFile::filePath() const
{
return m_filePath;
}
-std::string DebFile::packageName() const
+string DebFile::packageName() const
{
return m_controlData.FindS("Package");
}
-std::string DebFile::sourcePackage() const
+string DebFile::sourcePackage() const
{
return m_controlData.FindS("Source");
}
-std::string DebFile::version() const
+string DebFile::version() const
{
return m_controlData.FindS("Version");
}
-std::string DebFile::architecture() const
+string DebFile::architecture() const
{
return m_controlData.FindS("Architecture");
}
-std::string DebFile::conflicts() const
+string DebFile::conflicts() const
{
return m_controlData.FindS("Conflicts");
}
-std::string DebFile::summary() const
+string DebFile::summary() const
{
- std::string longDesc = description ();
+ string longDesc = description ();
longDesc.resize (longDesc.find_first_of ("\n"));
return longDesc;
}
-std::string DebFile::description() const
+string DebFile::description() const
{
return m_controlData.FindS("Description");
}
@@ -156,7 +152,7 @@ bool DebFile::check()
return true;
}
-std::string DebFile::errorMsg() const
+string DebFile::errorMsg() const
{
return m_errorMsg;
}
diff --git a/backends/aptcc/deb-file.h b/backends/aptcc/deb-file.h
index 187c4b6..6c81b90 100644
--- a/backends/aptcc/deb-file.h
+++ b/backends/aptcc/deb-file.h
@@ -1,6 +1,6 @@
/* deb-file.h
*
- * Copyright (c) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2011 Daniel Nicoletti <dantti12 at gmail.com>
* 2012 Matthias Klumpp <matthias at tenstral.net>
*
* Licensed under the GNU General Public License Version 2
@@ -23,34 +23,35 @@
#ifndef DEB_FILE_H
#define DEB_FILE_H
-#include <string>
#include <apt-pkg/debfile.h>
+using std::string;
+
class DebFile
{
// typedef int user_tag_reference;
public:
- DebFile(const std::string &filename);
+ DebFile(const string &filename);
bool isValid() const;
- std::string filePath() const;
- std::string packageName() const;
- std::string sourcePackage() const;
- std::string version() const;
- std::string architecture() const;
- std::string summary() const;
- std::string description() const;
- std::string conflicts() const;
+ string filePath() const;
+ string packageName() const;
+ string sourcePackage() const;
+ string version() const;
+ string architecture() const;
+ string summary() const;
+ string description() const;
+ string conflicts() const;
// THIS should be moved to AptIntf class
bool check();
- std::string errorMsg() const;
+ string errorMsg() const;
private:
- std::string m_filePath;
+ string m_filePath;
debDebFile::MemControlExtract *m_extractor;
pkgTagSection m_controlData;
- std::string m_errorMsg;
+ string m_errorMsg;
bool m_isValid;
};
diff --git a/backends/aptcc/get-distro-upgrade.py b/backends/aptcc/get-distro-upgrade.py
index 8c96368..d4b27c2 100755
--- a/backends/aptcc/get-distro-upgrade.py
+++ b/backends/aptcc/get-distro-upgrade.py
@@ -6,7 +6,7 @@ Provides an apt backend to PackageKit
Copyright (C) 2007 Ali Sabil <ali.sabil at gmail.com>
Copyright (C) 2007 Tom Parker <palfrey at tevp.net>
Copyright (C) 2008-2009 Sebastian Heinlein <glatzor at ubuntu.com>
-Copyright (C) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+Copyright (C) 2010 Daniel Nicoletti <dantti12 at gmail.com>
Licensed under the GNU General Public License Version 2
diff --git a/backends/aptcc/gstMatcher.cpp b/backends/aptcc/gstMatcher.cpp
index 43a42d6..7819b74 100644
--- a/backends/aptcc/gstMatcher.cpp
+++ b/backends/aptcc/gstMatcher.cpp
@@ -1,6 +1,6 @@
/* gstMatcher.cpp - Match GStreamer packages
*
- * Copyright (c) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2010 Daniel Nicoletti <dantti12 at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@
#include <regex.h>
#include <gst/gst.h>
-#include <iostream>
GstMatcher::GstMatcher(gchar **values)
{
diff --git a/backends/aptcc/gstMatcher.h b/backends/aptcc/gstMatcher.h
index d6e18d7..a8894e1 100644
--- a/backends/aptcc/gstMatcher.h
+++ b/backends/aptcc/gstMatcher.h
@@ -1,6 +1,6 @@
/* gstMatcher.h - Match GStreamer package names
*
- * Copyright (c) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2010 Daniel Nicoletti <dantti12 at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/backends/aptcc/matcher.cpp b/backends/aptcc/matcher.cpp
index de4c27a..d0b70ef 100644
--- a/backends/aptcc/matcher.cpp
+++ b/backends/aptcc/matcher.cpp
@@ -1,7 +1,7 @@
/* matcher.cpp
*
* Copyright (c) 1999-2008 Daniel Burrows
- * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009 Daniel Nicoletti <dantti12 at gmail.com>
* 2012 Matthias Klumpp <matthias at tenstral.net>
*
* This program is free software; you can redistribute it and/or modify
diff --git a/backends/aptcc/matcher.h b/backends/aptcc/matcher.h
index 23c97ab..33e871e 100644
--- a/backends/aptcc/matcher.h
+++ b/backends/aptcc/matcher.h
@@ -1,7 +1,7 @@
/* matcher.h
*
* Copyright (c) 1999-2008 Daniel Burrows
- * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009 Daniel Nicoletti <dantti12 at gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ private:
bool m_hasError;
string m_error;
bool parse_pattern(string::const_iterator &start,
- const std::string::const_iterator &end);
+ const string::const_iterator &end);
string parse_substr(string::const_iterator &start,
const string::const_iterator &end);
string parse_literal_string_tail(string::const_iterator &start,
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 1a8b208..932b82a 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -1,7 +1,6 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
+/*
* Copyright (C) 2007-2008 Richard Hughes <richard at hughsie.com>
- * Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (C) 2009-2012 Daniel Nicoletti <dantti12 at gmail.com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -22,8 +21,6 @@
#include <stdio.h>
#include <apt-pkg/init.h>
-#include <apt-pkg/algorithms.h>
-#include <apt-pkg/aptconfiguration.h>
#include <config.h>
#include <pk-backend.h>
@@ -31,8 +28,6 @@
#include "apt-intf.h"
#include "AptCacheFile.h"
-#include "apt-utils.h"
-#include "matcher.h"
#include "apt-messages.h"
#include "acqpkitstatus.h"
#include "pkg_acqfile.h"
@@ -394,7 +389,7 @@ static gboolean backend_get_or_update_system_thread(PkBackend *backend)
}
pk_backend_set_status(backend, PK_STATUS_ENUM_RUNNING);
- if (pkgDistUpgrade(*cache) == false) {
+ if (cache.DistUpgrade() == false) {
cache.ShowBroken(false);
g_debug("Internal error, DistUpgrade broke stuff");
delete apt;
@@ -822,45 +817,36 @@ static gboolean backend_search_package_thread(PkBackend *backend)
search = g_strjoinv("|", values);
filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
- pk_backend_set_percentage(backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_allow_cancel(backend, true);
-
- Matcher *matcher = new Matcher(search);
- g_free(search);
- if (matcher->hasError()) {
- g_debug("Regex compilation error");
- delete matcher;
- pk_backend_finished(backend);
- return false;
- }
-
AptIntf *apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", apt);
if (apt->init()) {
g_debug("Failed to create apt cache");
- delete matcher;
+ g_free(search);
delete apt;
return false;
}
if (_error->PendingError() == true) {
- delete matcher;
+ g_free(search);
delete apt;
return false;
}
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_percentage(backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_allow_cancel(backend, true);
+
PkgList output;
if (pk_backend_get_bool(backend, "search_details")) {
- output = apt->searchPackageDetails(matcher);
+ output = apt->searchPackageDetails(search);
} else {
- output = apt->searchPackageName(matcher);
+ output = apt->searchPackageName(search);
}
+ g_free(search);
// It's faster to emmit the packages here than in the matching part
apt->emitPackages(output, filters);
- delete matcher;
pk_backend_set_percentage(backend, 100);
delete apt;
return true;
diff --git a/backends/aptcc/pkg_acqfile.cpp b/backends/aptcc/pkg_acqfile.cpp
index b8f24e1..c30d380 100644
--- a/backends/aptcc/pkg_acqfile.cpp
+++ b/backends/aptcc/pkg_acqfile.cpp
@@ -1,7 +1,7 @@
/* pkg_acqfile.cpp
*
* Copyright (c) 2002, 2005 Daniel Burrows
- * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009 Daniel Nicoletti <dantti12 at gmail.com>
* 2012 Matthias Klumpp <matthias at tenstral.net>
*
* This program is free software; you can redistribute it and/or modify
@@ -28,17 +28,7 @@
#include <config.h>
#endif
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include <apt-pkg/error.h>
#include <apt-pkg/configuration.h>
-#include <apt-pkg/acquire-item.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/strutl.h>
// Let's all sing a song about apt-pkg's brokenness..
diff --git a/backends/aptcc/pkg_acqfile.h b/backends/aptcc/pkg_acqfile.h
index 3c48a9a..cb3cbb7 100644
--- a/backends/aptcc/pkg_acqfile.h
+++ b/backends/aptcc/pkg_acqfile.h
@@ -1,7 +1,7 @@
/* pkg_acqfile.h
*
* Copyright (c) 2002, 2005 Daniel Burrows
- * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2009 Daniel Nicoletti <dantti at gmail.com>
* 2012 Matthias Klumpp <matthias at tenstral.net>
*
* This program is free software; you can redistribute it and/or modify
commit 4b529d627b1d133b81f766296fe8ad6ce78ab380
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 22 11:17:02 2012 -0300
aptcc: Add a new class to show cache openning progress
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index ddba16a..7753a99 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -20,6 +20,7 @@
#include "AptCacheFile.h"
#include "apt-utils.h"
+#include "OpPackageKitProgress.h"
#include <apt-pkg/algorithms.h>
#include <sstream>
@@ -38,7 +39,8 @@ AptCacheFile::~AptCacheFile()
bool AptCacheFile::Open(bool withLock)
{
- return pkgCacheFile::Open(NULL, withLock);
+ OpPackageKitProgress progress(m_backend);
+ return pkgCacheFile::Open(&progress, withLock);
}
void AptCacheFile::Close()
@@ -56,7 +58,8 @@ void AptCacheFile::Close()
bool AptCacheFile::BuildCaches(bool withLock)
{
- return pkgCacheFile::BuildCaches(NULL, withLock);
+ OpPackageKitProgress progress(m_backend);
+ return pkgCacheFile::BuildCaches(&progress, withLock);
}
bool AptCacheFile::CheckDeps(bool FixBroken)
diff --git a/backends/aptcc/OpPackageKitProgress.cpp b/backends/aptcc/OpPackageKitProgress.cpp
new file mode 100644
index 0000000..8c64fa3
--- /dev/null
+++ b/backends/aptcc/OpPackageKitProgress.cpp
@@ -0,0 +1,49 @@
+/* OpPackageKitProgress.cpp
+ *
+ * Copyright (c) 2012 Daniel Nicoletti <dantti12 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "OpPackageKitProgress.h"
+
+OpPackageKitProgress::OpPackageKitProgress(PkBackend *backend) :
+ m_backend(backend)
+{
+ // Set PackageKit status
+ pk_backend_set_status(m_backend, PK_STATUS_ENUM_LOADING_CACHE);
+}
+
+OpPackageKitProgress::~OpPackageKitProgress()
+{
+ Done();
+}
+
+void OpPackageKitProgress::Done()
+{
+ pk_backend_set_percentage(m_backend, 100);
+}
+
+void OpPackageKitProgress::Update()
+{
+ if (CheckChange() == false) {
+ // No change has happened skip
+ return;
+ }
+
+ // Set the new percent
+ pk_backend_set_percentage(m_backend, static_cast<unsigned int>(Percent));
+}
diff --git a/backends/aptcc/OpPackageKitProgress.h b/backends/aptcc/OpPackageKitProgress.h
new file mode 100644
index 0000000..4ecf9b8
--- /dev/null
+++ b/backends/aptcc/OpPackageKitProgress.h
@@ -0,0 +1,45 @@
+/* OpPackageKitProgress.h
+ *
+ * Copyright (c) 2012 Daniel Nicoletti <dantti12 at gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef OP_PACKAGEKIT_PROGRESS_H
+#define OP_PACKAGEKIT_PROGRESS_H
+
+#include <apt-pkg/progress.h>
+
+#include <pk-backend.h>
+
+/**
+ * This class is maent to show Operation Progress using PackageKit
+ */
+class OpPackageKitProgress : public OpProgress
+{
+public:
+ OpPackageKitProgress(PkBackend *backend);
+ virtual ~OpPackageKitProgress();
+
+ virtual void Done();
+
+protected:
+ virtual void Update();
+
+private:
+ PkBackend *m_backend;
+};
+
+#endif // OP_PACKAGEKIT_PROGRESS_H
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 4389c8c..2b26cb9 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -74,9 +74,6 @@ bool AptIntf::init()
m_isMultiArch = APT::Configuration::getArchitectures(false).size() > 1;
- // Set PackageKit status
- pk_backend_set_status(m_backend, PK_STATUS_ENUM_LOADING_CACHE);
-
// set locale
if (locale = pk_backend_get_locale(m_backend)) {
setlocale(LC_ALL, locale);
commit 8440e54ff81f2fc22df5615bf2db16c8485d2b44
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 22 10:49:19 2012 -0300
aptcc: Fix possible crash as PkBackend was not inited
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index c4d5877..ddba16a 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -26,7 +26,8 @@
#include <cstdio>
AptCacheFile::AptCacheFile(PkBackend *backend) :
- m_packageRecords(0)
+ m_packageRecords(0),
+ m_backend(backend)
{
}
diff --git a/backends/aptcc/Makefile.am b/backends/aptcc/Makefile.am
index b510b05..e84a0d4 100644
--- a/backends/aptcc/Makefile.am
+++ b/backends/aptcc/Makefile.am
@@ -12,6 +12,7 @@ libpk_backend_aptcc_la_SOURCES = pkg_acqfile.cpp \
apt-messages.cpp \
apt-utils.cpp \
apt-sourceslist.cpp \
+ OpPackageKitProgress.cpp \
AptCacheFile.cpp \
apt-intf.cpp \
pk-backend-aptcc.cpp
@@ -32,6 +33,7 @@ EXTRA_DIST = 20packagekit \
deb-file.h \
apt-messages.h \
acqpkitstatus.h \
+ OpPackageKitProgress.h \
AptCacheFile.h \
pkg_acqfile.h
commit 1a1852173d376ede81f2d873e53342232a32ce9c
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Fri Apr 20 03:18:02 2012 -0300
aptcc: Avoid crashing when error messages containing invalid utf8 is sent
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index f354803..c4d5877 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -19,6 +19,8 @@
*/
#include "AptCacheFile.h"
+#include "apt-utils.h"
+
#include <apt-pkg/algorithms.h>
#include <sstream>
#include <cstdio>
@@ -219,7 +221,7 @@ void AptCacheFile::ShowBroken(bool Now, PkErrorEnum error)
}
}
}
- pk_backend_error_code(m_backend, error, out.str().c_str());
+ pk_backend_error_code(m_backend, error, utf8(out.str().c_str()));
}
void AptCacheFile::buildPkgRecords()
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 2217a69..4389c8c 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -102,6 +102,12 @@ bool AptIntf::init()
// Tries to open the cache
bool ret;
ret = m_cache.Open();
+
+ // Prepare for the restart thing
+ if (g_file_test(REBOOT_REQUIRED, G_FILE_TEST_EXISTS)) {
+ g_stat(REBOOT_REQUIRED, &m_restartStat);
+ }
+
return !ret;
}
@@ -2505,11 +2511,6 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
// Store the packages that are going to change
// so we can emit them as we process it
m_pkgs = checkChangedPackages(cache, false);
-
- // Prepare for the restart thing
- if (g_file_test(REBOOT_REQUIRED, G_FILE_TEST_EXISTS)) {
- g_stat(REBOOT_REQUIRED, &m_restartStat);
- }
}
pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
diff --git a/backends/aptcc/apt-messages.cpp b/backends/aptcc/apt-messages.cpp
index 15e548e..b95c0de 100644
--- a/backends/aptcc/apt-messages.cpp
+++ b/backends/aptcc/apt-messages.cpp
@@ -22,6 +22,8 @@
#include "apt-messages.h"
+#include "apt-utils.h"
+
#include <string>
#include <sstream>
#include <cstdio>
@@ -54,12 +56,11 @@ bool show_errors(PkBackend *backend, PkErrorEnum errorCode, bool errModify)
}
if (!errors.str().empty()) {
- pk_backend_error_code(backend, errorCode, errors.str().c_str());
+ pk_backend_error_code(backend, errorCode, utf8(errors.str().c_str()));
}
if ((errModify) && (!messages.str().empty())) {
- cout << "Emitting backend message:" << messages.str() << endl;
- pk_backend_message(backend, messageCode, messages.str().c_str());
+ pk_backend_message(backend, messageCode, utf8(messages.str().c_str()));
}
}
@@ -78,6 +79,6 @@ bool show_warnings(PkBackend *backend, PkMessageEnum message)
}
if (!warnings.str().empty()) {
- pk_backend_message(backend, message, warnings.str().c_str());
+ pk_backend_message(backend, message, utf8(warnings.str().c_str()));
}
}
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 9c19005..1a8b208 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -681,11 +681,10 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
return false;
}
- // missing gpg signature would appear here
- // TODO we need a better enum
+ // missing repo gpg signature would appear here
if (_error->PendingError() == false && _error->empty() == false) {
- //show_warnings(backend, PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE);
- //TODO: emit a package with PK_INFO_ENUM_UNTRUSTED
+ // TODO we need a repo warning
+ show_warnings(backend, PK_MESSAGE_ENUM_BROKEN_MIRROR);
}
delete apt;
commit eda735a08ac4e406b25bde278438382b2b92245f
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Thu Apr 19 21:59:53 2012 -0300
aptcc: separate the try install/remove functions
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 2ed6865..2217a69 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1429,33 +1429,42 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher, bool simulating)
return false;
}
-bool AptIntf::tryToInstall(const pkgCache::PkgIterator &constPkg,
+void AptIntf::tryToRemove(const pkgCache::VerIterator &ver,
+ pkgDepCache &Cache,
+ pkgProblemResolver &Fix)
+{
+ pkgCache::PkgIterator Pkg = ver.ParentPkg();
+
+ // The package is not installed
+ if (Pkg->CurrentVer == 0) {
+ Fix.Clear(Pkg);
+ Fix.Protect(Pkg);
+ Fix.Remove(Pkg);
+
+ return;
+ }
+
+ Fix.Clear(Pkg);
+ Fix.Protect(Pkg);
+ Fix.Remove(Pkg);
+ // TODO this is false since PackageKit can't
+ // tell it want's o purge
+ Cache.MarkDelete(Pkg, false);
+}
+
+
+bool AptIntf::tryToInstall(const pkgCache::VerIterator &ver,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
- bool Remove,
bool BrokenFix,
unsigned int &ExpectedInst)
{
- pkgCache::PkgIterator Pkg = constPkg;
- // This is a pure virtual package and there is a single available provides
- if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
- Pkg.ProvidesList()->NextProvides == 0) {
- pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
- // TODO this is UGLY!!! create a local PkgIterator for this
- Pkg = Tmp;
- }
+ pkgCache::PkgIterator Pkg = ver.ParentPkg();
// Check if there is something at all to install
pkgDepCache::StateCache &State = Cache[Pkg];
- if (Remove == true && Pkg->CurrentVer == 0) {
- Fix.Clear(Pkg);
- Fix.Protect(Pkg);
- Fix.Remove(Pkg);
-
- return true;
- }
- if (State.CandidateVer == 0 && Remove == false) {
+ if (State.CandidateVer == 0) {
_error->Error("Package %s is virtual and has no installation candidate", Pkg.Name());
pk_backend_error_code(m_backend,
@@ -1468,13 +1477,6 @@ bool AptIntf::tryToInstall(const pkgCache::PkgIterator &constPkg,
Fix.Clear(Pkg);
Fix.Protect(Pkg);
- if (Remove == true) {
- Fix.Remove(Pkg);
- // TODO this is false since PackageKit can't
- // tell it want's o purge
- Cache.MarkDelete(Pkg, false);
- return true;
- }
// Install it
Cache.MarkInstall(Pkg, false);
@@ -2309,10 +2311,9 @@ bool AptIntf::runTransaction(const PkgList &install, const PkgList &remove, bool
break;
}
- if (tryToInstall(it->ParentPkg(),
+ if (tryToInstall(*it,
cache,
Fix,
- false, // remove
BrokenFix,
ExpectedInst) == false) {
return false;
@@ -2329,14 +2330,7 @@ bool AptIntf::runTransaction(const PkgList &install, const PkgList &remove, bool
break;
}
- if (tryToInstall(it->ParentPkg(),
- cache,
- Fix,
- true, // remove
- BrokenFix,
- ExpectedInst) == false) {
- return false;
- }
+ tryToRemove(*it, cache, Fix);
}
// Call the scored problem resolver
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 8c64851..bbebbfd 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -233,10 +233,12 @@ public:
private:
bool checkTrusted(pkgAcquire &fetcher, bool simulating);
bool packageIsSupported(const pkgCache::VerIterator &verIter, string component);
- bool tryToInstall(const pkgCache::PkgIterator &constPkg,
+ void tryToRemove(const pkgCache::VerIterator &ver,
+ pkgDepCache &Cache,
+ pkgProblemResolver &Fix);
+ bool tryToInstall(const pkgCache::VerIterator &ver,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
- bool Remove,
bool BrokenFix,
unsigned int &ExpectedInst);
commit e5c505f909ebabd0744bf82cd1cf637f5eb6510d
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Thu Apr 19 21:09:13 2012 -0300
aptcc: change the way we mark auto-installed packages
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index bd471de..2ed6865 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -2067,19 +2067,16 @@ void AptIntf::refreshCache()
ListUpdate(Stat, *m_cache.GetSourceList());
}
-bool AptIntf::markAutoInstalled(AptCacheFile &cache, const PkgList &pkgs, bool flag)
+void AptIntf::markAutoInstalled(AptCacheFile &cache, const PkgList &pkgs)
{
- bool ret;
- for(PkgList::const_iterator it = pkgs.begin(); it != pkgs.end(); ++it) {
+ for (PkgList::const_iterator it = pkgs.begin(); it != pkgs.end(); ++it) {
if (m_cancel) {
break;
}
// Mark package as auto-installed
- cache->MarkAuto(it->ParentPkg(), flag);
+ cache->MarkAuto(it->ParentPkg(), true);
}
-
- return true;
}
bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
@@ -2322,8 +2319,9 @@ bool AptIntf::runTransaction(const PkgList &install, const PkgList &remove, bool
}
}
- if (!simulate) {
- markAutoInstalled(cache, install, markAuto);
+ // Mark package dependencies of a local file as auto-installed
+ if (!simulate && markAuto) {
+ markAutoInstalled(cache, install);
}
for (PkgList::const_iterator it = remove.begin(); it != remove.end(); ++it) {
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 0f906c0..8c64851 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -85,7 +85,7 @@ public:
/**
* Marks the given packages as auto installed
*/
- bool markAutoInstalled(AptCacheFile &cache, const PkgList &pkgs, bool flag);
+ void markAutoInstalled(AptCacheFile &cache, const PkgList &pkgs);
/**
* runs a transaction to install/remove/update packages
commit 7ad2637a0b617e2c0381524e0e1160cacac28bd3
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Thu Apr 19 15:32:11 2012 -0300
aptcc: Use _exit() to quit the child process as synaptic does
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 47b01e9..bd471de 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -2609,10 +2609,9 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
// dump errors into cerr (pass it to the parent process)
_error->DumpErrors();
- close(readFromChildFD[1]);
- close(pty_master);
-
- return res == 0;
+ // finishes the child process, _exit is used to not
+ // close some parent file descriptors
+ _exit(res);
}
cout << "PARENT proccess running..." << endl;
@@ -2635,6 +2634,8 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
}
close(readFromChildFD[0]);
+ close(readFromChildFD[1]);
+ close(pty_master);
cout << "Parent finished..." << endl;
return true;
commit 0638db8613a4ecf8b0ef1da1bd625f9b5732d4e9
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Thu Apr 19 14:24:03 2012 -0300
aptcc: possibly fix "hang" on the end of DoInstall()
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 88d93e1..47b01e9 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -2610,6 +2610,7 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
_error->DumpErrors();
close(readFromChildFD[1]);
+ close(pty_master);
return res == 0;
}
@@ -2634,8 +2635,6 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
}
close(readFromChildFD[0]);
- close(readFromChildFD[1]);
- close(pty_master);
cout << "Parent finished..." << endl;
return true;
commit bc2638b3f7fdd6a4dabd25352e05ea3697d1e9fc
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Thu Apr 19 12:07:05 2012 -0300
aptcc: Fix symbol failure
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index c24734a..65f699c 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -242,7 +242,7 @@ string getBugzillaUrls(const string &changelog)
return ret;
}
-bool contains(const PkgList packages, const pkgCache::PkgIterator &pkg)
+bool contains(const PkgList &packages, const pkgCache::PkgIterator &pkg)
{
for (PkgList::const_iterator it = packages.begin(); it != packages.end(); ++it) {
if (it->ParentPkg() == pkg) {
commit 9faddb39f59c04ce66aa09923e63b412b83e0d15
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Thu Apr 19 11:11:44 2012 -0300
aptcc: use const_iterators to avoid mistakes
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 4f22a88..88d93e1 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -305,11 +305,11 @@ bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
return true;
}
-PkgList AptIntf::filterPackages(PkgList &packages, PkBitfield filters)
+PkgList AptIntf::filterPackages(const PkgList &packages, PkBitfield filters)
{
if (filters != 0) {
PkgList ret;
- for (PkgList::iterator i = packages.begin(); i != packages.end(); ++i) {
+ for (PkgList::const_iterator i = packages.begin(); i != packages.end(); ++i) {
if (matchPackage(*i, filters)) {
ret.push_back(*i);
}
@@ -355,7 +355,7 @@ void AptIntf::emitPackages(PkgList &output, PkBitfield filters, PkInfoEnum state
result_equality()),
output.end());
- for (PkgList::iterator it = output.begin(); it != output.end(); ++it) {
+ for (PkgList::const_iterator it = output.begin(); it != output.end(); ++it) {
if (m_cancel) {
break;
}
@@ -377,7 +377,7 @@ void AptIntf::emitRequireRestart(PkgList &output)
result_equality()),
output.end());
- for (PkgList::iterator it = output.begin(); it != output.end(); ++it) {
+ for (PkgList::const_iterator it = output.begin(); it != output.end(); ++it) {
gchar *package_id;
package_id = utilBuildPackageId(*it);
pk_backend_require_restart(m_backend, PK_RESTART_ENUM_SYSTEM, package_id);
@@ -396,7 +396,7 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
result_equality()),
output.end());
- for (PkgList::iterator i = output.begin(); i != output.end(); ++i) {
+ for (PkgList::const_iterator i = output.begin(); i != output.end(); ++i) {
if (m_cancel) {
break;
}
@@ -676,7 +676,7 @@ void AptIntf::emitDetails(PkgList &pkgs)
pkgs.erase(unique(pkgs.begin(), pkgs.end(), result_equality()),
pkgs.end());
- for (PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
+ for (PkgList::const_iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
if (m_cancel) {
break;
}
@@ -916,9 +916,9 @@ void AptIntf::emitUpdateDetail(const pkgCache::VerIterator &candver)
g_free(package_id);
}
-void AptIntf::emitUpdateDetails(PkgList &pkgs)
+void AptIntf::emitUpdateDetails(const PkgList &pkgs)
{
- for (PkgList::iterator it = pkgs.begin(); it != pkgs.end(); ++it) {
+ for (PkgList::const_iterator it = pkgs.begin(); it != pkgs.end(); ++it) {
if (m_cancel) {
break;
}
@@ -975,7 +975,7 @@ void AptIntf::getRequires(PkgList &output,
if (parentVer.end() == false) {
PkgList deps;
getDepends(deps, parentVer, false);
- for (PkgList::iterator it = deps.begin(); it != deps.end(); ++it) {
+ for (PkgList::const_iterator it = deps.begin(); it != deps.end(); ++it) {
if (*it == ver) {
if (recursive) {
if (!contains(output, parentPkg)) {
@@ -1054,7 +1054,7 @@ PkgList AptIntf::getPackagesFromGroup(gchar **values)
section = section.substr(found + 1);
// Don't insert virtual packages instead add what it provides
- for (vector<PkGroupEnum>::iterator it = groups.begin();
+ for (vector<PkGroupEnum>::const_iterator it = groups.begin();
it != groups.end();
++it) {
if (*it == get_enum_group(section)) {
@@ -1194,7 +1194,7 @@ PkgList AptIntf::searchPackageFiles(gchar **values)
regfree(&re);
// Resolve the package names now
- for (vector<string>::iterator it = packages.begin();
+ for (vector<string>::const_iterator it = packages.begin();
it != packages.end(); ++it) {
if (m_cancel) {
break;
@@ -1275,7 +1275,7 @@ void AptIntf::providesMimeType(PkgList &output, gchar **values)
regfree(&re);
// resolve the package names
- for (vector<string>::iterator it = packages.begin();
+ for (vector<string>::const_iterator it = packages.begin();
it != packages.end(); ++it) {
if (m_cancel) {
break;
@@ -1631,7 +1631,7 @@ PkgList AptIntf::checkChangedPackages(AptCacheFile &cache, bool emitChanged)
void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
{
- for (PkgList::iterator it = m_pkgs.begin(); it != m_pkgs.end(); ++it) {
+ for (PkgList::const_iterator it = m_pkgs.begin(); it != m_pkgs.end(); ++it) {
if (it->ParentPkg().Name() == name) {
emitPackage(*it, state);
return;
@@ -2067,10 +2067,10 @@ void AptIntf::refreshCache()
ListUpdate(Stat, *m_cache.GetSourceList());
}
-bool AptIntf::markAutoInstalled(AptCacheFile &cache, PkgList &pkgs, bool flag)
+bool AptIntf::markAutoInstalled(AptCacheFile &cache, const PkgList &pkgs, bool flag)
{
bool ret;
- for(PkgList::iterator it = pkgs.begin(); it != pkgs.end(); ++it) {
+ for(PkgList::const_iterator it = pkgs.begin(); it != pkgs.end(); ++it) {
if (m_cancel) {
break;
}
@@ -2263,7 +2263,7 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
return true;
}
-bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto, bool fixBroken)
+bool AptIntf::runTransaction(const PkgList &install, const PkgList &remove, bool simulate, bool markAuto, bool fixBroken)
{
//cout << "runTransaction" << simulate << remove << endl;
bool withLock = !simulate; // Check to see if we are just simulating,
@@ -2307,7 +2307,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
// new scope for the ActionGroup
{
pkgDepCache::ActionGroup group(cache);
- for (PkgList::iterator it = install.begin(); it != install.end(); ++it) {
+ for (PkgList::const_iterator it = install.begin(); it != install.end(); ++it) {
if (m_cancel) {
break;
}
@@ -2326,7 +2326,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
markAutoInstalled(cache, install, markAuto);
}
- for (PkgList::iterator it = remove.begin(); it != remove.end(); ++it) {
+ for (PkgList::const_iterator it = remove.begin(); it != remove.end(); ++it) {
if (m_cancel) {
break;
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 4d80840..0f906c0 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -85,7 +85,7 @@ public:
/**
* Marks the given packages as auto installed
*/
- bool markAutoInstalled(AptCacheFile &cache, PkgList &pkgs, bool flag);
+ bool markAutoInstalled(AptCacheFile &cache, const PkgList &pkgs, bool flag);
/**
* runs a transaction to install/remove/update packages
@@ -95,8 +95,8 @@ public:
* \p simulate should be true, in this case packages with
* what's going to happen will be emitted.
*/
- bool runTransaction(PkgList &install,
- PkgList &remove,
+ bool runTransaction(const PkgList &install,
+ const PkgList &remove,
bool simulate,
bool markAuto,
bool fixBroken);
@@ -168,7 +168,7 @@ public:
/**
* Returns the list of packages with the ones that passed the given filters
*/
- PkgList filterPackages(PkgList &packages, PkBitfield filters);
+ PkgList filterPackages(const PkgList &packages, PkBitfield filters);
/**
* Emits details of the given package
@@ -188,7 +188,7 @@ public:
/**
* Emits update datails for the given list
*/
- void emitUpdateDetails(PkgList &pkgs);
+ void emitUpdateDetails(const PkgList &pkgs);
/**
* Emits the files of a package
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 3c5e252..c24734a 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -242,9 +242,9 @@ string getBugzillaUrls(const string &changelog)
return ret;
}
-bool contains(PkgList packages, const pkgCache::PkgIterator &pkg)
+bool contains(const PkgList packages, const pkgCache::PkgIterator &pkg)
{
- for (PkgList::iterator it = packages.begin(); it != packages.end(); ++it) {
+ for (PkgList::const_iterator it = packages.begin(); it != packages.end(); ++it) {
if (it->ParentPkg() == pkg) {
return true;
}
diff --git a/backends/aptcc/apt-utils.h b/backends/aptcc/apt-utils.h
index 1dd00c9..5147374 100644
--- a/backends/aptcc/apt-utils.h
+++ b/backends/aptcc/apt-utils.h
@@ -90,7 +90,7 @@ string getBugzillaUrls(const string &changelog);
/**
* Return if the given vector contain a package
*/
-bool contains(PkgList packages, const pkgCache::PkgIterator &pkg);
+bool contains(const PkgList &packages, const pkgCache::PkgIterator &pkg);
/**
* Return if the given string ends with the other
commit adafa8447cd9b9326ee0e18a4561c056539fdd6c
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Wed Apr 18 13:19:47 2012 -0300
aptcc: we are not apt-get so remove "APT::Get::*" confs
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 87ff230..4f22a88 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1415,8 +1415,7 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher, bool simulating)
emitPackages(untrusted, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UNTRUSTED);
}
- if (pk_backend_get_bool(m_backend, "only_trusted") == false ||
- _config->FindB("APT::Get::AllowUnauthenticated", false) == true) {
+ if (pk_backend_get_bool(m_backend, "only_trusted") == false) {
g_debug ("Authentication warning overridden.\n");
return true;
}
@@ -1471,27 +1470,15 @@ bool AptIntf::tryToInstall(const pkgCache::PkgIterator &constPkg,
Fix.Protect(Pkg);
if (Remove == true) {
Fix.Remove(Pkg);
- Cache.MarkDelete(Pkg,_config->FindB("APT::Get::Purge", false));
+ // TODO this is false since PackageKit can't
+ // tell it want's o purge
+ Cache.MarkDelete(Pkg, false);
return true;
}
// Install it
- Cache.MarkInstall(Pkg,false);
- if (State.Install() == false) {
- if (_config->FindB("APT::Get::ReInstall",false) == true) {
- if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false) {
- // ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
- // Pkg.Name());
- ;
- } else {
- Cache.SetReInstall(Pkg,true);
- }
- } else {
- // if (AllowFail == true)
- // ioprintf(c1out,_("%s is already the newest version.\n"),
- // Pkg.Name());
- }
- } else {
+ Cache.MarkInstall(Pkg, false);
+ if (State.Install() == true) {
ExpectedInst++;
}
@@ -1955,29 +1942,18 @@ void AptIntf::updateInterface(int fd, int writeFd)
*/
bool AptIntf::doAutomaticRemove(AptCacheFile &cache)
{
- bool doAutoRemove;
- if (pk_backend_get_bool(m_backend, "autoremove")) {
- doAutoRemove = true;
- } else {
- doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
- }
- pkgDepCache::ActionGroup group(*cache);
+ bool doAutoRemove = pk_backend_get_bool(m_backend, "autoremove");
- if (_config->FindB("APT::Get::Remove",true) == false &&
- doAutoRemove == true) {
- cout << "We are not supposed to delete stuff, can't start "
- "AutoRemover" << endl;
- doAutoRemove = false;
- }
+ pkgDepCache::ActionGroup group(*cache);
if (doAutoRemove) {
- bool purge = _config->FindB("APT::Get::Purge", false);
// look over the cache to see what can be removed
for (pkgCache::PkgIterator Pkg = cache->PkgBegin(); ! Pkg.end(); ++Pkg) {
if (cache[Pkg].Garbage) {
if (Pkg.CurrentVer() != 0 &&
Pkg->CurrentState != pkgCache::State::ConfigFiles) {
- cache->MarkDelete(Pkg, purge);
+ // TODO, packagekit could provide a way to purge
+ cache->MarkDelete(Pkg, false);
} else {
cache->MarkKeep(Pkg, false, false);
}
@@ -2394,22 +2370,13 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
*/
bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
{
+ //cout << "installPackages() called" << endl;
// Try to auto-remove packages
if (!doAutomaticRemove(cache)) {
// TODO
return false;
}
- //cout << "installPackages() called" << endl;
- if (_config->FindB("APT::Get::Purge",false) == true) {
- pkgCache::PkgIterator I = cache->PkgBegin();
- for (; I.end() == false; ++I) {
- if (I.Purge() == false && cache[I].Mode == pkgDepCache::ModeDelete) {
- cache->MarkDelete(I,true);
- }
- }
- }
-
// check for essential packages!!!
if (removingEssentialPackages(cache)) {
return false;
@@ -2428,14 +2395,6 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
return true;
}
- // No remove flag
- if (cache->DelCount() != 0 && _config->FindB("APT::Get::Remove", true) == false) {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE,
- "Packages need to be removed but remove is disabled.");
- return false;
- }
-
// Create the text record parser
pkgRecords Recs(cache);
if (_error->PendingError() == true) {
commit efdab8f65f65b90b38e8143f7b25fc0d60adf3c7
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Wed Apr 18 13:10:16 2012 -0300
aptcc: Emit UnfinishedTransaction when we were not able to fix the cache
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index a6d05c0..f354803 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -69,19 +69,7 @@ bool AptCacheFile::CheckDeps(bool FixBroken)
// Apply corrections for half-installed packages
if (pkgApplyStatus(*DCache) == false) {
- return false;
- }
-
- if (_config->FindB("APT::Get::Fix-Policy-Broken",false) == true) {
- FixBroken = true;
- if ((DCache->PolicyBrokenCount() > 0)) {
- // upgrade all policy-broken packages with ForceImportantDeps=True
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); !I.end(); ++I) {
- if ((*DCache)[I].NowPolicyBroken() == true) {
- DCache->MarkInstall(I,true,0, false, true);
- }
- }
- }
+ return _error->Error("Unable to apply corrections for half-installed packages");;
}
// Nothing is broken or we don't want to try fixing it
@@ -104,7 +92,7 @@ bool AptCacheFile::CheckDeps(bool FixBroken)
return true;
}
-void AptCacheFile::ShowBroken(bool Now)
+void AptCacheFile::ShowBroken(bool Now, PkErrorEnum error)
{
std::stringstream out;
@@ -231,7 +219,7 @@ void AptCacheFile::ShowBroken(bool Now)
}
}
}
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, out.str().c_str());
+ pk_backend_error_code(m_backend, error, out.str().c_str());
}
void AptCacheFile::buildPkgRecords()
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
index 577c740..49a5e31 100644
--- a/backends/aptcc/AptCacheFile.h
+++ b/backends/aptcc/AptCacheFile.h
@@ -57,7 +57,7 @@ public:
* dependencies. Similar to and based on the equivalent routine in
* apt-get.
*/
- void ShowBroken(bool Now);
+ void ShowBroken(bool Now, PkErrorEnum error = PK_ERROR_ENUM_DEP_RESOLUTION_FAILED);
inline pkgRecords* GetPkgRecords() { buildPkgRecords(); return m_packageRecords; }
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index e31ccb2..87ff230 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -2296,7 +2296,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
AptCacheFile cache(m_backend);
int timeout = 10;
// TODO test this
- while (cache.Open(withLock) == false || cache.CheckDeps(fixBroken) == false) {
+ while (cache.Open(withLock) == false) {
if (withLock == false || (timeout <= 0)) {
show_errors(m_backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
return false;
@@ -2309,6 +2309,13 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
// Close the cache if we are going to try again
cache.Close();
}
+
+ // Check if there are half-installed packages and if we can fix them
+ if (cache.CheckDeps(fixBroken) == false) {
+ show_errors(m_backend, PK_ERROR_ENUM_INTERNAL_ERROR);
+ return false;
+ }
+
pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
// Enter the special broken fixing mode if the user specified arguments
@@ -2367,8 +2374,9 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
// Now we check the state of the packages,
if (cache->BrokenCount() != 0) {
// if the problem resolver could not fix all broken things
- // show what is broken
- cache.ShowBroken(false);
+ // suggest to run RepairSystem by saing that the last transaction
+ // did not finish well
+ cache.ShowBroken(false, PK_ERROR_ENUM_UNFINISHED_TRANSACTION);
return false;
}
}
commit ae7ec444b041bfc81cc97d8aa522c99a91d443e9
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Apr 18 16:11:30 2012 +0100
Add some documentation for the new RepairSystem transaction interaction
diff --git a/docs/api/spec/pk-concepts.xml b/docs/api/spec/pk-concepts.xml
index 632594e..6283723 100644
--- a/docs/api/spec/pk-concepts.xml
+++ b/docs/api/spec/pk-concepts.xml
@@ -1003,6 +1003,26 @@
</para>
</sect2>
+ <sect2 id="introduction-ideas-transactions-repair">
+ <title>Transaction example: Repair</title>
+ <mediaobject id="pk-transactions-repair">
+ <imageobject>
+ <imagedata format="PNG" fileref="pk-transactions-repair-required.png" align="center"/>
+ </imageobject>
+ </mediaobject>
+ <para>
+ If the package management system is damaged, a repair may be required.
+ This is not automatically done befor each transaction as the user
+ may have to verify destructive package actions or make manual changes to
+ configuration files.
+ </para>
+ <para>
+ This transaction sequence is not common and is not supported on
+ many backends.
+ It may be completely implemented in the frontend or not at all.
+ </para>
+ </sect2>
+
</sect1>
<sect1 id="introduction-ideas-transactionid">
diff --git a/docs/api/spec/pk-transactions.svg b/docs/api/spec/pk-transactions.svg
index 152e121..c567813 100644
--- a/docs/api/spec/pk-transactions.svg
+++ b/docs/api/spec/pk-transactions.svg
@@ -277,6 +277,370 @@
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
transform="scale(0.6,0.6)" />
</marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-8"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-1"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3281"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3283"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3285"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3287"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3289"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3291"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3293"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3295"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3297"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3299"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3301"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3303"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3305"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3307"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3309"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3311"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3313"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3315"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3317"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3319"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-81"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-5"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3508"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3510"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3512"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3514"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-6"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-11"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3581"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3583"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3585"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3587"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-85"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-9"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3654"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3656"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3658"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3660"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-78"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-55"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3727"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3729"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-95"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-8"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3727-2"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3729-7"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-4"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-45"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3727-4"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3729-2"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
</defs>
<sodipodi:namedview
id="base"
@@ -288,18 +652,18 @@
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="1.979899"
- inkscape:cx="147.99934"
- inkscape:cy="-520.13479"
+ inkscape:zoom="0.70000001"
+ inkscape:cx="298.68235"
+ inkscape:cy="-1009.317"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
borderlayer="true"
inkscape:showpageshadow="false"
- inkscape:window-width="1920"
- inkscape:window-height="1172"
- inkscape:window-x="0"
- inkscape:window-y="0"
+ inkscape:window-width="1600"
+ inkscape:window-height="845"
+ inkscape:window-x="1920"
+ inkscape:window-y="542"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
@@ -319,7 +683,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
+ <dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@@ -2240,5 +2604,697 @@
x="407.90588"
y="1479.3473"
style="font-size:11.32614231px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(success)</tspan></text>
+ <rect
+ style="fill:none;stroke:#000000;stroke-width:0.55129081;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect6503-7-4"
+ width="475"
+ height="310"
+ x="29.943062"
+ y="1732.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <rect
+ style="opacity:0.76146785;fill:#8d5fd3;fill-opacity:1"
+ id="rect6269-2-6"
+ width="35"
+ height="110"
+ x="464.94305"
+ y="1757.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <rect
+ style="opacity:0.76146785;fill:#ff8080;fill-opacity:1"
+ id="rect2405-2-7"
+ width="35"
+ height="654.99988"
+ x="249.94305"
+ y="1737.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <rect
+ style="opacity:0.76146785;fill:#5fd38d;fill-opacity:1"
+ id="rect2407-6-5"
+ width="35"
+ height="654.99988"
+ x="34.943062"
+ y="1737.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-2032.4951"
+ y="59.943062"
+ id="text2413-0-6"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan2415-6-1"
+ x="-2032.4951"
+ y="59.943062"
+ style="font-size:20px;text-align:center;text-anchor:middle">Manager</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-1807.3622"
+ y="490"
+ id="text2417-1-8"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan2419-5-6"
+ x="-1807.3622"
+ y="490"
+ style="font-size:20px;text-align:center;text-anchor:middle">Tran #1</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-2032.417"
+ y="274.94305"
+ id="text2421-9-2"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan2423-4-9"
+ x="-2032.417"
+ y="274.94305"
+ style="font-size:20px;text-align:center;text-anchor:middle">Client</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 459.88612,1772.3622 -174.94306,0"
+ id="path6109-9-6"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.75172305;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 74.94306,1752.3622 174.87186,0"
+ id="path6113-0-7"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="164.2829"
+ y="1747.3622"
+ id="text6115-9-0"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6117-1-9"
+ x="164.2829"
+ y="1747.3622"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">GetTid()</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.39060569;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 244.91322,1762.3691 -125.38794,0 -9.6421,-10.035"
+ id="path6119-7-3"
+ sodipodi:nodetypes="ccc"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="362.2829"
+ y="1767.3622"
+ id="text6121-7-0"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6123-1-5"
+ x="362.2829"
+ y="1767.3622"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">SimulateInstallPkg(p)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.71419,1812.3621 174.94306,0"
+ id="path6239-8-6"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:37.75381088px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="410.02487"
+ y="1705.8701"
+ id="text6241-1-1"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"
+ transform="scale(0.94384518,1.0594958)"><tspan
+ sodipodi:role="line"
+ id="tspan6243-2-0"
+ x="410.02487"
+ y="1705.8701"
+ style="font-size:11.32614231px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::ErrorCode(unfinished)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.75172305;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 75.02985,1872.3553 174.87185,0"
+ id="path6253-9-9"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="164.36969"
+ y="1867.3552"
+ id="text6255-3-7"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6257-9-6"
+ x="164.36969"
+ y="1867.3552"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">GetTid()</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.39060569;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 245,1882.3622 -125.38793,0 -9.6421,-10.035"
+ id="path6259-0-9"
+ sodipodi:nodetypes="ccc"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <rect
+ style="opacity:0.76146785;fill:#8d5fd3;fill-opacity:1"
+ id="rect2411-1-3-2"
+ width="35"
+ height="115"
+ x="465"
+ y="2141.542"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 459.53741,2161.5419 -174.94306,0"
+ id="path6131-7-8-4"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="362.90131"
+ y="2156.542"
+ id="text6133-7-5-9"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6135-6-6-5"
+ x="362.90131"
+ y="2156.542"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">SimulateInstallPkg(p)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.05694,2201.5419 174.94306,0"
+ id="path6159-7-1-0"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="380.66016"
+ y="2196.542"
+ id="text6161-3-1-7"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6163-6-5-2"
+ x="380.66016"
+ y="2196.542"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Package(installing)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.05694,2241.5419 174.94306,0"
+ id="path6165-5-9-5"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="380.66016"
+ y="2236.542"
+ id="text6167-6-8-3"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6169-3-4-4"
+ x="380.66016"
+ y="2236.542"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(success)</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-2202.3623"
+ y="490"
+ id="text6265-8-8-6"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6267-8-1-1"
+ x="-2202.3623"
+ y="490"
+ style="font-size:20px;text-align:center;text-anchor:middle">Tran #4</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 289.48535,1852.362 174.94306,0"
+ id="path6239-8-8-8"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:37.75381088px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="408.72293"
+ y="1743.6239"
+ id="text6241-1-8-7"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"
+ transform="scale(0.94384518,1.0594958)"><tspan
+ sodipodi:role="line"
+ id="tspan6243-2-8-7"
+ x="408.72293"
+ y="1743.6239"
+ style="font-size:11.32614231px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(repair-required)</tspan></text>
+ <rect
+ style="opacity:0.76146785;fill:#8d5fd3;fill-opacity:1"
+ id="rect2411-1-3-2-7"
+ width="35"
+ height="115"
+ x="465.46259"
+ y="1882.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 460,1902.3622 -174.94306,0"
+ id="path6131-7-8-4-6"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="363.36389"
+ y="1897.3621"
+ id="text6133-7-5-9-7"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6135-6-6-5-0"
+ x="363.36389"
+ y="1897.3621"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">SimulateRepairSystem(p)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.51953,1942.3622 174.94306,0"
+ id="path6159-7-1-0-1"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="381.12274"
+ y="1937.3621"
+ id="text6161-3-1-7-7"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6163-6-5-2-7"
+ x="381.12274"
+ y="1937.3621"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Package(cleaning)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.51953,1982.3622 174.94306,0"
+ id="path6165-5-9-5-7"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="381.12274"
+ y="1977.3621"
+ id="text6167-6-8-3-5"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6169-3-4-4-6"
+ x="381.12274"
+ y="1977.3621"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(success)</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-1943.1824"
+ y="490.46259"
+ id="text6265-8-8-6-1"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6267-8-1-1-0"
+ x="-1943.1824"
+ y="490.46259"
+ style="font-size:20px;text-align:center;text-anchor:middle">Tran #2</tspan></text>
+ <rect
+ style="opacity:0.76146785;fill:#8d5fd3;fill-opacity:1"
+ id="rect2411-1-3-2-7-7"
+ width="35"
+ height="115"
+ x="465"
+ y="2011.542"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 459.53741,2031.542 -174.94306,0"
+ id="path6131-7-8-4-6-0"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="362.90131"
+ y="2026.5419"
+ id="text6133-7-5-9-7-0"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6135-6-6-5-0-6"
+ x="362.90131"
+ y="2026.5419"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">RepairSystem(p)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.05694,2071.542 174.94306,0"
+ id="path6159-7-1-0-1-6"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="380.66016"
+ y="2066.542"
+ id="text6161-3-1-7-7-6"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6163-6-5-2-7-9"
+ x="380.66016"
+ y="2066.542"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Package(cleaning)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.05694,2111.542 174.94306,0"
+ id="path6165-5-9-5-7-6"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="380.66016"
+ y="2106.542"
+ id="text6167-6-8-3-5-6"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6169-3-4-4-6-6"
+ x="380.66016"
+ y="2106.542"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(success)</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-2072.3623"
+ y="490"
+ id="text6265-8-8-6-1-5"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6267-8-1-1-0-7"
+ x="-2072.3623"
+ y="490"
+ style="font-size:20px;text-align:center;text-anchor:middle">Tran #3</tspan></text>
+ <rect
+ style="opacity:0.76146785;fill:#8d5fd3;fill-opacity:1"
+ id="rect2411-1-3-2-6"
+ width="35"
+ height="115"
+ x="465"
+ y="2271.542"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 459.53741,2291.5418 -174.94306,0"
+ id="path6131-7-8-4-3"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="362.90131"
+ y="2286.542"
+ id="text6133-7-5-9-8"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6135-6-6-5-2"
+ x="362.90131"
+ y="2286.542"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">SimulateInstallPkg(p)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.05694,2331.5418 174.94306,0"
+ id="path6159-7-1-0-9"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="380.66016"
+ y="2326.542"
+ id="text6161-3-1-7-5"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6163-6-5-2-9"
+ x="380.66016"
+ y="2326.542"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Package(installing)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.05694,2371.5418 174.94306,0"
+ id="path6165-5-9-5-76"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="380.66016"
+ y="2366.542"
+ id="text6167-6-8-3-1"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6169-3-4-4-7"
+ x="380.66016"
+ y="2366.542"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(success)</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-2332.3623"
+ y="490"
+ id="text6265-8-8-6-5"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6267-8-1-1-3"
+ x="-2332.3623"
+ y="490"
+ style="font-size:20px;text-align:center;text-anchor:middle">Tran #5</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.75172305;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 75.02985,2002.3553 174.87185,0"
+ id="path6253-9-9-1"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="164.36969"
+ y="1997.3552"
+ id="text6255-3-7-3"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6257-9-6-2"
+ x="164.36969"
+ y="1997.3552"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">GetTid()</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.39060569;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 245,2012.3622 -125.38793,0 -9.6421,-10.035"
+ id="path6259-0-9-6"
+ sodipodi:nodetypes="ccc"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.75172305;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 75.02985,2132.3553 174.87185,0"
+ id="path6253-9-9-8"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="164.36969"
+ y="2127.3552"
+ id="text6255-3-7-5"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6257-9-6-9"
+ x="164.36969"
+ y="2127.3552"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">GetTid()</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.39060569;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 245,2142.3622 -125.38793,0 -9.6421,-10.035"
+ id="path6259-0-9-5"
+ sodipodi:nodetypes="ccc"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.75172305;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 75.02985,2262.3553 174.87185,0"
+ id="path6253-9-9-84"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="164.36969"
+ y="2257.3552"
+ id="text6255-3-7-7"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6257-9-6-20"
+ x="164.36969"
+ y="2257.3552"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">GetTid()</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.39060569;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 245,2272.3622 -125.38793,0 -9.6421,-10.035"
+ id="path6259-0-9-4"
+ sodipodi:nodetypes="ccc"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
</g>
</svg>
commit 21aef7cf7f39e5ca47c95e323732acd105b37446
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Wed Apr 18 11:50:05 2012 -0300
packagekit: Add PK_ERROR_ENUM_UNFINISHED_TRANSACTION and PK_EXIT_ENUM_REPAIR_REQUIRED so that UI can know when to repair the system
diff --git a/lib/packagekit-glib2/pk-enum.c b/lib/packagekit-glib2/pk-enum.c
index 903ca9e..e84b54f 100644
--- a/lib/packagekit-glib2/pk-enum.c
+++ b/lib/packagekit-glib2/pk-enum.c
@@ -47,6 +47,7 @@ static const PkEnumMatch enum_exit[] = {
{PK_EXIT_ENUM_NEED_UNTRUSTED, "need-untrusted"},
{PK_EXIT_ENUM_CANCELLED_PRIORITY, "cancelled-priority"},
{PK_EXIT_ENUM_SKIP_TRANSACTION, "skip-transaction"},
+ {PK_EXIT_ENUM_REPAIR_REQUIRED, "repair-required"},
{0, NULL}
};
@@ -200,6 +201,7 @@ static const PkEnumMatch enum_error[] = {
{PK_ERROR_ENUM_INSTALL_ROOT_INVALID, "install-root-invalid"},
{PK_ERROR_ENUM_CANNOT_FETCH_SOURCES, "cannot-fetch-sources"},
{PK_ERROR_ENUM_CANCELLED_PRIORITY, "cancelled-priority"},
+ {PK_ERROR_ENUM_UNFINISHED_TRANSACTION, "unfinished-transaction"},
{0, NULL}
};
diff --git a/lib/packagekit-glib2/pk-enum.h b/lib/packagekit-glib2/pk-enum.h
index 7c96d8a..92c91e4 100644
--- a/lib/packagekit-glib2/pk-enum.h
+++ b/lib/packagekit-glib2/pk-enum.h
@@ -168,6 +168,7 @@ typedef enum {
PK_EXIT_ENUM_NEED_UNTRUSTED,
PK_EXIT_ENUM_CANCELLED_PRIORITY,
PK_EXIT_ENUM_SKIP_TRANSACTION,
+ PK_EXIT_ENUM_REPAIR_REQUIRED,
PK_EXIT_ENUM_LAST
} PkExitEnum;
@@ -333,6 +334,7 @@ typedef enum {
PK_ERROR_ENUM_INSTALL_ROOT_INVALID,
PK_ERROR_ENUM_CANNOT_FETCH_SOURCES,
PK_ERROR_ENUM_CANCELLED_PRIORITY,
+ PK_ERROR_ENUM_UNFINISHED_TRANSACTION,
PK_ERROR_ENUM_LAST
} PkErrorEnum;
diff --git a/lib/packagekit-qt2/transaction.h b/lib/packagekit-qt2/transaction.h
index 2d0ffb4..9692012 100644
--- a/lib/packagekit-qt2/transaction.h
+++ b/lib/packagekit-qt2/transaction.h
@@ -194,7 +194,8 @@ public:
ErrorProvideTypeNotSupported,
ErrorInstallRootInvalid,
ErrorCannotFetchSources,
- ErrorCancelledPriority
+ ErrorCancelledPriority,
+ ErrorUnfinishedTransaction
} Error;
/**
@@ -211,7 +212,8 @@ public:
ExitKilled, /* when we forced the cancel, but had to sigkill */
ExitMediaChangeRequired,
ExitNeedUntrusted,
- ExitCancelledPriority
+ ExitCancelledPriority,
+ ExitRepairRequired
} Exit;
/**
diff --git a/src/pk-backend.c b/src/pk-backend.c
index bacd07b..652497a 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -2195,6 +2195,11 @@ pk_backend_error_code (PkBackend *backend, PkErrorEnum error_code, const gchar *
else
pk_backend_set_exit_code (backend, PK_EXIT_ENUM_FAILED);
+ /* set the hint that RepairSystem is needed */
+ if (error_code == PK_ERROR_ENUM_UNFINISHED_TRANSACTION) {
+ pk_backend_set_exit_code (backend, PK_EXIT_ENUM_REPAIR_REQUIRED);
+ }
+
/* form PkError struct */
item = pk_error_new ();
g_object_set (item,
commit 9f893b55bc932a9be22dd194be33b3f657135108
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Wed Apr 18 10:52:18 2012 -0300
pk-qt2: Add simulateRepairSystem and repairSystem(bool) to the Transaction API
diff --git a/lib/packagekit-qt2/transaction.cpp b/lib/packagekit-qt2/transaction.cpp
index 6ea12cf..5b2390d 100644
--- a/lib/packagekit-qt2/transaction.cpp
+++ b/lib/packagekit-qt2/transaction.cpp
@@ -479,6 +479,11 @@ void Transaction::removePackage(const Package &package, bool allowDeps, bool aut
removePackages(QList<Package>() << package, allowDeps, autoremove);
}
+void Transaction::repairSystem(bool onlyTrusted)
+{
+ RUN_TRANSACTION(RepairSystem(onlyTrusted))
+}
+
void Transaction::repoEnable(const QString &repoId, bool enable)
{
RUN_TRANSACTION(RepoEnable(repoId, enable))
@@ -594,6 +599,11 @@ void Transaction::simulateUpdatePackage(const Package &package)
simulateUpdatePackages(QList<Package>() << package);
}
+void Transaction::simulateRepairSystem()
+{
+ RUN_TRANSACTION(SimulateRepairSystem())
+}
+
void Transaction::updatePackages(const QList<Package> &packages, bool onlyTrusted)
{
RUN_TRANSACTION(UpdatePackages(onlyTrusted, Util::packageListToPids(packages)))
diff --git a/lib/packagekit-qt2/transaction.h b/lib/packagekit-qt2/transaction.h
index b819771..2d0ffb4 100644
--- a/lib/packagekit-qt2/transaction.h
+++ b/lib/packagekit-qt2/transaction.h
@@ -756,6 +756,12 @@ public:
void removePackage(const Package &package, bool allowDeps = false, bool autoRemove = false);
/**
+ * Repairs a broken system
+ * \sa simulateRepairSystem();
+ */
+ void repairSystem(bool onlyTrusted = true);
+
+ /**
* Activates or disables a repository
*/
void repoEnable(const QString &repoId, bool enable = true);
@@ -930,6 +936,14 @@ public:
void simulateUpdatePackage(const Package &package);
/**
+ * Tries to fix a broken system
+ * \note this function will emit packages that describe the actions
+ * the backend will take
+ * \sa repairSystem(bool);
+ */
+ void simulateRepairSystem();
+
+ /**
* Update the given \p packages
*
* \p onlyTrusted indicates if this transaction is only allowed to install trusted packages
commit 3e1c648c2844eab3ddf457f02cf0adae44602d21
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Wed Apr 18 09:09:50 2012 -0300
aptcc: remove a code duplication and emit proper RestartRequired signal
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 701fc75..e31ccb2 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -61,6 +61,9 @@ AptIntf::AptIntf(PkBackend *backend, bool &cancel) :
m_lastSubProgress(0)
{
m_cancel = false;
+
+ // Make sure initial m_time is 0
+ m_restartStat.st_mtime = 0;
}
bool AptIntf::init()
@@ -104,6 +107,25 @@ bool AptIntf::init()
AptIntf::~AptIntf()
{
+ // Check the restart thing
+ if (g_file_test(REBOOT_REQUIRED, G_FILE_TEST_EXISTS)) {
+ struct stat restartStat;
+ g_stat(REBOOT_REQUIRED, &restartStat);
+
+ if (restartStat.st_mtime > m_restartStat.st_mtime) {
+ // Emit the packages that caused the restart
+ if (!m_restartPackages.empty()) {
+ emitRequireRestart(m_restartPackages);
+ } else if (!m_pkgs.empty()) {
+ // Assume all of them
+ emitRequireRestart(m_pkgs);
+ } else {
+ // Emit a foo require restart
+ pk_backend_require_restart(m_backend, PK_RESTART_ENUM_SYSTEM, "aptcc;;;");
+ }
+ }
+ }
+
pk_backend_finished(m_backend);
}
@@ -113,6 +135,7 @@ void AptIntf::cancel()
m_cancel = true;
pk_backend_set_status(m_backend, PK_STATUS_ENUM_CANCEL);
}
+
if (m_child_pid > 0) {
kill(m_child_pid, SIGTERM);
}
@@ -298,13 +321,12 @@ PkgList AptIntf::filterPackages(PkgList &packages, PkBitfield filters)
}
// used to emit packages it collects all the needed info
-void AptIntf::emitPackage(const pkgCache::VerIterator &ver,
- PkInfoEnum state)
+void AptIntf::emitPackage(const pkgCache::VerIterator &ver, PkInfoEnum state)
{
- const pkgCache::PkgIterator &pkg = ver.ParentPkg();
-
// check the state enum to see if it was not set.
if (state == PK_INFO_ENUM_UNKNOWN) {
+ const pkgCache::PkgIterator &pkg = ver.ParentPkg();
+
if (pkg->CurrentState == pkgCache::State::Installed &&
pkg.CurrentVer() == ver) {
state = PK_INFO_ENUM_INSTALLED;
@@ -313,13 +335,8 @@ void AptIntf::emitPackage(const pkgCache::VerIterator &ver,
}
}
- pkgCache::VerFileIterator vf = ver.FileList();
-
gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- ver.VerStr(),
- ver.Arch(),
- vf.File().Archive() == NULL ? "" : vf.File().Archive());
+ package_id = utilBuildPackageId(ver);
pk_backend_package(m_backend,
state,
package_id,
@@ -349,6 +366,25 @@ void AptIntf::emitPackages(PkgList &output, PkBitfield filters, PkInfoEnum state
}
}
+void AptIntf::emitRequireRestart(PkgList &output)
+{
+ // Sort so we can remove the duplicated entries
+ sort(output.begin(), output.end(), compare());
+
+ // Remove the duplicated entries
+ output.erase(unique(output.begin(),
+ output.end(),
+ result_equality()),
+ output.end());
+
+ for (PkgList::iterator it = output.begin(); it != output.end(); ++it) {
+ gchar *package_id;
+ package_id = utilBuildPackageId(*it);
+ pk_backend_require_restart(m_backend, PK_RESTART_ENUM_SYSTEM, package_id);
+ g_free(package_id);
+ }
+}
+
void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
{
PkInfoEnum state;
@@ -620,11 +656,7 @@ void AptIntf::emitPackageDetail(const pkgCache::VerIterator &ver)
}
gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- ver.VerStr(),
- ver.Arch(),
- vf.File().Archive() == NULL ? "" : vf.File().Archive());
-
+ package_id = utilBuildPackageId(ver);
pk_backend_details(m_backend,
package_id,
"unknown",
@@ -666,13 +698,10 @@ void AptIntf::emitUpdateDetail(const pkgCache::VerIterator &candver)
// Get the version of the current package
const pkgCache::VerIterator &currver = findVer(pkg);
- const pkgCache::VerFileIterator &currvf = currver.FileList();
+
// Build a package_id from the current version
gchar *current_package_id;
- current_package_id = pk_package_id_build(pkg.Name(),
- currver.VerStr(),
- currver.Arch(),
- currvf.File().Archive() == NULL ? "" : currvf.File().Archive());
+ current_package_id = utilBuildPackageId(currver);
pkgCache::VerFileIterator vf = candver.FileList();
string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
@@ -852,10 +881,7 @@ void AptIntf::emitUpdateDetail(const pkgCache::VerIterator &candver)
// Build a package_id from the update version
string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- candver.VerStr(),
- candver.Arch(),
- archive.c_str());
+ package_id = utilBuildPackageId(candver);
PkUpdateStateEnum updateState = PK_UPDATE_STATE_ENUM_UNKNOWN;
if (archive.compare("stable") == 0) {
@@ -868,10 +894,7 @@ void AptIntf::emitUpdateDetail(const pkgCache::VerIterator &candver)
}
PkRestartEnum restart = PK_RESTART_ENUM_NONE;
- if (starts_with(pkg.Name(), "linux-image-") ||
- starts_with(pkg.Name(), "nvidia-") ||
- strcmp(pkg.Name(), "libc6") == 0 ||
- strcmp(pkg.Name(), "dbus") == 0) {
+ if (utilRestartRequired(pkg.Name())) {
restart = PK_RESTART_ENUM_SYSTEM;
}
@@ -1546,68 +1569,77 @@ bool AptIntf::removingEssentialPackages(AptCacheFile &cache)
}
/**
- * emitChangedPackages - Show packages to newly install
+ * checkChangedPackages - Check whas is goind to happen to the packages
*/
-void AptIntf::emitChangedPackages(AptCacheFile &cache)
+PkgList AptIntf::checkChangedPackages(AptCacheFile &cache, bool emitChanged)
{
+ PkgList ret;
PkgList installing;
PkgList removing;
PkgList updating;
PkgList downgrading;
- for (pkgCache::PkgIterator pkg = cache->PkgBegin(); ! pkg.end(); ++pkg) {
+ for (pkgCache::PkgIterator pkg = cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (cache[pkg].NewInstall() == true) {
// installing;
const pkgCache::VerIterator &ver = m_cache.findCandidateVer(pkg);
if (!ver.end()) {
+ ret.push_back(ver);
installing.push_back(ver);
+
+ // append to the restart required list
+ if (utilRestartRequired(pkg.Name())) {
+ m_restartPackages.push_back(ver);
+ }
}
} else if (cache[pkg].Delete() == true) {
// removing
const pkgCache::VerIterator &ver = findVer(pkg);
if (!ver.end()) {
+ ret.push_back(ver);
removing.push_back(ver);
+
+ // append to the restart required list
+ if (utilRestartRequired(pkg.Name())) {
+ m_restartPackages.push_back(ver);
+ }
}
} else if (cache[pkg].Upgrade() == true) {
// updating
const pkgCache::VerIterator &ver = m_cache.findCandidateVer(pkg);
if (!ver.end()) {
+ ret.push_back(ver);
updating.push_back(ver);
+
+ // append to the restart required list
+ if (utilRestartRequired(pkg.Name())) {
+ m_restartPackages.push_back(ver);
+ }
}
} else if (cache[pkg].Downgrade() == true) {
// downgrading
const pkgCache::VerIterator &ver = findVer(pkg);
if (!ver.end()) {
+ ret.push_back(ver);
downgrading.push_back(ver);
+
+ // append to the restart required list
+ if (utilRestartRequired(pkg.Name())) {
+ m_restartPackages.push_back(ver);
+ }
}
}
}
- // emit packages that have changes
- emitPackages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
- emitPackages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
- emitPackages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
- emitPackages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
-}
-
-void AptIntf::populateInternalPackages(AptCacheFile &cache)
-{
- for (pkgCache::PkgIterator pkg = cache->PkgBegin(); ! pkg.end(); ++pkg) {
- if (cache[pkg].NewInstall() == true) {
- // installing
- m_pkgs.push_back(m_cache.findCandidateVer(pkg));
- } else if (cache[pkg].Delete() == true) {
- // removing
- m_pkgs.push_back(findVer(pkg));
- } else if (cache[pkg].Upgrade() == true) {
- // updating
- m_pkgs.push_back(m_cache.findCandidateVer(pkg));
- } else if (cache[pkg].Downgrade() == true) {
- // downgrading
- // TODO shouldn't be the current version?
- m_pkgs.push_back(m_cache.findCandidateVer(pkg));
- }
+ if (emitChanged) {
+ // emit packages that have changes
+ emitPackages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
+ emitPackages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
+ emitPackages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+ emitPackages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
}
+
+ return ret;
}
void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
@@ -2189,10 +2221,10 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
}
// Build package-id for the new package
- gchar *deb_package_id = pk_package_id_build (deb.packageName ().c_str (),
- deb.version ().c_str (),
- deb.architecture ().c_str (),
- "local");
+ gchar *deb_package_id = pk_package_id_build(deb.packageName ().c_str (),
+ deb.version ().c_str (),
+ deb.architecture ().c_str (),
+ "local");
const gchar *deb_summary = deb.summary ().c_str ();
gint status;
@@ -2508,8 +2540,17 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
if (simulating) {
// Print out a list of packages that are going to be installed extra
- emitChangedPackages(cache);
+ checkChangedPackages(cache, true);
return true;
+ } else {
+ // Store the packages that are going to change
+ // so we can emit them as we process it
+ m_pkgs = checkChangedPackages(cache, false);
+
+ // Prepare for the restart thing
+ if (g_file_test(REBOOT_REQUIRED, G_FILE_TEST_EXISTS)) {
+ g_stat(REBOOT_REQUIRED, &m_restartStat);
+ }
}
pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
@@ -2528,10 +2569,6 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
return false;
}
- // Store the packages that are going to change
- // so we can emit them as we process it.
- populateInternalPackages(cache);
-
// Check if the user canceled
if (m_cancel) {
return true;
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 23ea056..4d80840 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -23,10 +23,8 @@
#ifndef APTINTF_H
#define APTINTF_H
-#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/pkgcachegen.h>
-#include <apt-pkg/cachefile.h>
-#include <apt-pkg/policy.h>
+#include <glib.h>
+#include <glib/gstdio.h>
#include <pk-backend.h>
@@ -34,6 +32,7 @@
#define PREUPGRADE_BINARY "/usr/bin/do-release-upgrade"
#define GDEBI_BINARY "/usr/bin/gdebi"
+#define REBOOT_REQUIRED "/var/run/reboot-required"
using namespace std;
@@ -144,8 +143,7 @@ public:
/**
* Emits a package with the given state
*/
- void emitPackage(const pkgCache::VerIterator &ver,
- PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+ void emitPackage(const pkgCache::VerIterator &ver, PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
/**
* Emits a list of packages that matches the given filters
@@ -154,6 +152,8 @@ public:
PkBitfield filters = PK_FILTER_ENUM_NONE,
PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+ void emitRequireRestart(PkgList &output);
+
/**
* Emits a list of updates that matches the given filters
*/
@@ -231,10 +231,6 @@ public:
std::string directory, std::string &StoreFilename);
private:
- AptCacheFile m_cache;
- PkBackend *m_backend;
- bool &m_cancel;
-
bool checkTrusted(pkgAcquire &fetcher, bool simulating);
bool packageIsSupported(const pkgCache::VerIterator &verIter, string component);
bool tryToInstall(const pkgCache::PkgIterator &constPkg,
@@ -246,16 +242,22 @@ private:
/**
* interprets dpkg status fd
- */
+ */
void updateInterface(int readFd, int writeFd);
bool doAutomaticRemove(AptCacheFile &cache);
- void emitChangedPackages(AptCacheFile &cache);
bool removingEssentialPackages(AptCacheFile &cache);
+ PkgList checkChangedPackages(AptCacheFile &cache, bool emitChanged);
+ void emitTransactionPackage(string name, PkInfoEnum state);
+
+ AptCacheFile m_cache;
+ PkBackend *m_backend;
+ bool &m_cancel;
+ struct stat m_restartStat;
bool m_isMultiArch;
PkgList m_pkgs;
- void populateInternalPackages(AptCacheFile &cache);
- void emitTransactionPackage(string name, PkInfoEnum state);
+ PkgList m_restartPackages;
+
time_t m_lastTermAction;
string m_lastPackage;
uint m_lastSubProgress;
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 5f784b7..3c5e252 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -264,6 +264,28 @@ bool starts_with(const string &str, const char *start)
return str.size() >= startSize && (strncmp(str.data(), start, startSize) == 0);
}
+bool utilRestartRequired(const string &packageName)
+{
+ if (starts_with(packageName, "linux-image-") ||
+ starts_with(packageName, "nvidia-") ||
+ packageName == "libc6" ||
+ packageName == "dbus") {
+ return true;
+ }
+ return false;
+}
+
+gchar* utilBuildPackageId(const pkgCache::VerIterator &ver)
+{
+ gchar *package_id;
+ pkgCache::VerFileIterator vf = ver.FileList();
+ package_id = pk_package_id_build(ver.ParentPkg().Name(),
+ ver.VerStr(),
+ ver.Arch(),
+ vf.File().Archive() == NULL ? "" : vf.File().Archive());
+ return package_id;
+}
+
const char *utf8(const char *str)
{
static char *_str = NULL;
diff --git a/backends/aptcc/apt-utils.h b/backends/aptcc/apt-utils.h
index 4b07d56..1dd00c9 100644
--- a/backends/aptcc/apt-utils.h
+++ b/backends/aptcc/apt-utils.h
@@ -103,6 +103,17 @@ bool ends_with(const string &str, const char *end);
bool starts_with(const string &str, const char *end);
/**
+ * Return true if the given package name is on the list of packages that require a restart
+ */
+bool utilRestartRequired(const string &packageName);
+
+/**
+ * Build a package id from the given package version
+ * The caller must g_free the returned value
+ */
+gchar* utilBuildPackageId(const pkgCache::VerIterator &ver);
+
+/**
* Return an utf8 string
*/
const char *utf8(const char *str);
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index f9fd856..9c19005 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -47,7 +47,7 @@ static PkBackendSpawn *spawn;
*/
gchar* pk_backend_get_description(PkBackend *backend)
{
- return g_strdup ("APTcc");
+ return g_strdup("APTcc");
}
/**
@@ -55,7 +55,7 @@ gchar* pk_backend_get_description(PkBackend *backend)
*/
gchar* pk_backend_get_author(PkBackend *backend)
{
- return g_strdup ("Daniel Nicoletti <dantti12 at gmail.com>");
+ return g_strdup("Daniel Nicoletti <dantti12 at gmail.com>");
}
/**
@@ -63,18 +63,18 @@ gchar* pk_backend_get_author(PkBackend *backend)
*/
void pk_backend_initialize(PkBackend *backend)
{
- g_debug ("APTcc Initializing");
+ g_debug("APTcc Initializing");
if (pkgInitConfig(*_config) == false ||
pkgInitSystem(*_config, _system) == false) {
- g_debug ("ERROR initializing backend");
+ g_debug("ERROR initializing backend");
}
// Disable apt-listbugs as it freezes PK
setenv("APT_LISTBUGS_FRONTEND", "none", 1);
- spawn = pk_backend_spawn_new ();
- pk_backend_spawn_set_name (spawn, "aptcc");
+ spawn = pk_backend_spawn_new();
+ pk_backend_spawn_set_name(spawn, "aptcc");
}
/**
@@ -82,7 +82,7 @@ void pk_backend_initialize(PkBackend *backend)
*/
void pk_backend_destroy(PkBackend *backend)
{
- g_debug ("APTcc being destroyed");
+ g_debug("APTcc being destroyed");
}
/**
@@ -90,7 +90,7 @@ void pk_backend_destroy(PkBackend *backend)
*/
PkBitfield pk_backend_get_groups(PkBackend *backend)
{
- return pk_bitfield_from_enums (
+ return pk_bitfield_from_enums(
PK_GROUP_ENUM_ACCESSORIES,
PK_GROUP_ENUM_ADMIN_TOOLS,
PK_GROUP_ENUM_COMMUNICATION,
@@ -121,7 +121,7 @@ PkBitfield pk_backend_get_groups(PkBackend *backend)
PkBitfield pk_backend_get_filters(PkBackend *backend)
{
PkBitfield filters;
- filters = pk_bitfield_from_enums (
+ filters = pk_bitfield_from_enums(
PK_FILTER_ENUM_GUI,
PK_FILTER_ENUM_INSTALLED,
PK_FILTER_ENUM_DEVELOPMENT,
@@ -142,7 +142,7 @@ PkBitfield pk_backend_get_filters(PkBackend *backend)
*/
gchar* pk_backend_get_mime_types(PkBackend *backend)
{
- return g_strdup ("application/x-deb");
+ return g_strdup("application/x-deb");
}
/**
@@ -150,9 +150,9 @@ gchar* pk_backend_get_mime_types(PkBackend *backend)
*/
void pk_backend_cancel(PkBackend *backend)
{
- AptIntf *m_apt = (AptIntf*) pk_backend_get_pointer(backend, "aptcc_obj");
- if (m_apt) {
- m_apt->cancel();
+ AptIntf *apt = (AptIntf*) pk_backend_get_pointer(backend, "aptcc_obj");
+ if (apt) {
+ apt->cancel();
}
}
@@ -163,17 +163,17 @@ static gboolean backend_get_depends_or_requires_thread(PkBackend *backend)
gchar *pi;
bool recursive;
- package_ids = pk_backend_get_strv (backend, "package_ids");
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
- recursive = pk_backend_get_bool (backend, "recursive");
+ package_ids = pk_backend_get_strv(backend, "package_ids");
+ filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
+ recursive = pk_backend_get_bool(backend, "recursive");
- pk_backend_set_allow_cancel (backend, true);
+ pk_backend_set_allow_cancel(backend, true);
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
@@ -187,33 +187,33 @@ static gboolean backend_get_depends_or_requires_thread(PkBackend *backend)
}
pi = package_ids[i];
if (pk_package_id_check(pi) == false) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_ID_INVALID,
- pi);
- delete m_apt;
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_PACKAGE_ID_INVALID,
+ pi);
+ delete apt;
return false;
}
- const pkgCache::VerIterator &ver = m_apt->findPackageId(pi);
+ const pkgCache::VerIterator &ver = apt->findPackageId(pi);
if (ver.end()) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Couldn't find package");
- delete m_apt;
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
+ "Couldn't find package");
+ delete apt;
return false;
}
if (depends) {
- m_apt->getDepends(output, ver, recursive);
+ apt->getDepends(output, ver, recursive);
} else {
- m_apt->getRequires(output, ver, recursive);
+ apt->getRequires(output, ver, recursive);
}
}
// It's faster to emmit the packages here than in the matching part
- m_apt->emitPackages(output, filters);
+ apt->emitPackages(output, filters);
- delete m_apt;
+ delete apt;
return true;
}
@@ -222,9 +222,9 @@ static gboolean backend_get_depends_or_requires_thread(PkBackend *backend)
*/
void pk_backend_get_depends(PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
- pk_backend_set_bool (backend, "get_depends", true);
- pk_backend_set_bool (backend, "recursive", recursive);
- pk_backend_thread_create (backend, backend_get_depends_or_requires_thread);
+ pk_backend_set_bool(backend, "get_depends", true);
+ pk_backend_set_bool(backend, "recursive", recursive);
+ pk_backend_thread_create(backend, backend_get_depends_or_requires_thread);
}
/**
@@ -232,9 +232,9 @@ void pk_backend_get_depends(PkBackend *backend, PkBitfield filters, gchar **pack
*/
void pk_backend_get_requires(PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
- pk_backend_set_bool (backend, "get_depends", false);
- pk_backend_set_bool (backend, "recursive", recursive);
- pk_backend_thread_create (backend, backend_get_depends_or_requires_thread);
+ pk_backend_set_bool(backend, "get_depends", false);
+ pk_backend_set_bool(backend, "recursive", recursive);
+ pk_backend_thread_create(backend, backend_get_depends_or_requires_thread);
}
/**
@@ -242,7 +242,7 @@ void pk_backend_get_requires(PkBackend *backend, PkBitfield filters, gchar **pac
*/
void pk_backend_get_distro_upgrades(PkBackend *backend)
{
- pk_backend_spawn_helper (spawn, "get-distro-upgrade.py", "get-distro-upgrades", NULL);
+ pk_backend_spawn_helper(spawn, "get-distro-upgrade.py", "get-distro-upgrades", NULL);
}
static gboolean backend_get_files_thread(PkBackend *backend)
@@ -250,7 +250,7 @@ static gboolean backend_get_files_thread(PkBackend *backend)
gchar **package_ids;
gchar *pi;
- package_ids = pk_backend_get_strv (backend, "package_ids");
+ package_ids = pk_backend_get_strv(backend, "package_ids");
if (package_ids == NULL) {
pk_backend_error_code(backend,
PK_ERROR_ENUM_PACKAGE_ID_INVALID,
@@ -259,11 +259,11 @@ static gboolean backend_get_files_thread(PkBackend *backend)
return false;
}
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
@@ -274,21 +274,21 @@ static gboolean backend_get_files_thread(PkBackend *backend)
pk_backend_error_code(backend,
PK_ERROR_ENUM_PACKAGE_ID_INVALID,
pi);
- delete m_apt;
+ delete apt;
return false;
}
- const pkgCache::VerIterator &ver = m_apt->findPackageId(pi);
+ const pkgCache::VerIterator &ver = apt->findPackageId(pi);
if (ver.end()) {
pk_backend_error_code(backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "Couldn't find package");
- delete m_apt;
+ delete apt;
return false;
}
- m_apt->emitPackageFiles(pi);
+ apt->emitPackageFiles(pi);
}
- delete m_apt;
+ delete apt;
return true;
}
@@ -304,22 +304,22 @@ static gboolean backend_get_details_thread(PkBackend *backend)
{
gchar **package_ids;
- PkRoleEnum role = pk_backend_get_role (backend);
+ PkRoleEnum role = pk_backend_get_role(backend);
bool updateDetail = role == PK_ROLE_ENUM_GET_UPDATE_DETAIL ? true : false;
package_ids = pk_backend_get_strv(backend, "package_ids");
if (package_ids == NULL) {
pk_backend_error_code(backend,
PK_ERROR_ENUM_PACKAGE_ID_INVALID,
"Invalid package id");
- pk_backend_finished (backend);
+ pk_backend_finished(backend);
return false;
}
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
g_debug ("Failed to create apt cache");
- delete m_apt;
+ delete apt;
return false;
}
@@ -330,15 +330,15 @@ static gboolean backend_get_details_thread(PkBackend *backend)
}
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
- PkgList pkgs = m_apt->resolvePackageIds(package_ids);
+ PkgList pkgs = apt->resolvePackageIds(package_ids);
if (updateDetail) {
- m_apt->emitUpdateDetails(pkgs);
+ apt->emitUpdateDetails(pkgs);
} else {
- m_apt->emitDetails(pkgs);
+ apt->emitDetails(pkgs);
}
- delete m_apt;
+ delete apt;
return true;
}
@@ -358,7 +358,7 @@ void pk_backend_get_details(PkBackend *backend, gchar **package_ids)
pk_backend_thread_create(backend, backend_get_details_thread);
}
-static gboolean backend_get_or_update_system_thread (PkBackend *backend)
+static gboolean backend_get_or_update_system_thread(PkBackend *backend)
{
PkBitfield filters;
bool getUpdates;
@@ -366,11 +366,11 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
getUpdates = pk_backend_get_bool(backend, "getUpdates");
pk_backend_set_allow_cancel(backend, true);
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
@@ -384,7 +384,7 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
pk_backend_error_code(backend,
PK_ERROR_ENUM_NO_CACHE,
"Could not open package cache.");
- delete m_apt;
+ delete apt;
return false;
} else {
pk_backend_set_status(backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
@@ -396,8 +396,8 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
if (pkgDistUpgrade(*cache) == false) {
cache.ShowBroken(false);
- g_debug ("Internal error, DistUpgrade broke stuff");
- delete m_apt;
+ g_debug("Internal error, DistUpgrade broke stuff");
+ delete apt;
return false;
}
@@ -424,15 +424,15 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
}
}
- m_apt->emitUpdates(updates, filters);
- m_apt->emitPackages(kept, filters, PK_INFO_ENUM_BLOCKED);
+ apt->emitUpdates(updates, filters);
+ apt->emitPackages(kept, filters, PK_INFO_ENUM_BLOCKED);
} else {
// TODO there should be a simulate upgrade system,
// tho afaik Apper and GPK don't use this
- res = m_apt->installPackages(cache, false);
+ res = apt->installPackages(cache, false);
}
- delete m_apt;
+ delete apt;
return res;
}
@@ -473,35 +473,35 @@ static gboolean backend_what_provides_thread(PkBackend *backend)
provides == PK_PROVIDES_ENUM_MIMETYPE ||
provides == PK_PROVIDES_ENUM_CODEC ||
provides == PK_PROVIDES_ENUM_ANY) {
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- g_strfreev (values);
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ g_strfreev(values);
+ delete apt;
return false;
}
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
PkgList output;
if (provides == PK_PROVIDES_ENUM_SHARED_LIB) {
- m_apt->providesLibrary(output, values);
+ apt->providesLibrary(output, values);
} else if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
- m_apt->providesMimeType(output, values);
+ apt->providesMimeType(output, values);
} else if (provides == PK_PROVIDES_ENUM_CODEC) {
- m_apt->providesCodec(output, values);
+ apt->providesCodec(output, values);
} else {
// PK_PROVIDES_ENUM_ANY, just search for everything a package can provide
- m_apt->providesLibrary(output, values);
- m_apt->providesCodec(output, values);
- m_apt->providesMimeType(output, values);
+ apt->providesLibrary(output, values);
+ apt->providesCodec(output, values);
+ apt->providesMimeType(output, values);
}
// It's faster to emit the packages here rather than in the matching part
- m_apt->emitPackages(output, filters);
+ apt->emitPackages(output, filters);
- delete m_apt;
+ delete apt;
} else {
provides_text = pk_provides_enum_to_string(provides);
pk_backend_error_code(backend,
@@ -537,17 +537,17 @@ static gboolean pk_backend_download_packages_thread(PkBackend *backend)
directory = _config->FindDir("Dir::Cache::archives") + "partial/";
pk_backend_set_allow_cancel(backend, true);
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
// Create the progress
- AcqPackageKitStatus Stat(m_apt, backend, _cancel);
+ AcqPackageKitStatus Stat(apt, backend, _cancel);
// get a fetcher
pkgAcquire fetcher;
@@ -581,7 +581,7 @@ static gboolean pk_backend_download_packages_thread(PkBackend *backend)
pk_backend_error_code(backend,
PK_ERROR_ENUM_PACKAGE_ID_INVALID,
pi);
- delete m_apt;
+ delete apt;
return false;
}
@@ -589,7 +589,7 @@ static gboolean pk_backend_download_packages_thread(PkBackend *backend)
break;
}
- const pkgCache::VerIterator &ver = m_apt->findPackageId(pi);
+ const pkgCache::VerIterator &ver = apt->findPackageId(pi);
// Ignore packages that could not be found or that exist only due to dependencies.
if (ver.end()) {
_error->Error("Can't find this package id \"%s\".", pi);
@@ -603,7 +603,7 @@ static gboolean pk_backend_download_packages_thread(PkBackend *backend)
}
string storeFileName;
- if (m_apt->getArchive(&fetcher,
+ if (apt->getArchive(&fetcher,
ver,
directory,
storeFileName)) {
@@ -622,14 +622,14 @@ static gboolean pk_backend_download_packages_thread(PkBackend *backend)
&& _cancel == false) {
// We failed and we did not cancel
show_errors(backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
- delete m_apt;
+ delete apt;
return _cancel;
}
// send the filelist
pk_backend_files(backend, NULL, filelist.c_str());
- delete m_apt;
+ delete apt;
return true;
}
@@ -648,11 +648,11 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
{
pk_backend_set_allow_cancel(backend, true);
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
@@ -662,14 +662,14 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
if (_config->FindB("Debug::NoLocking", false) == false) {
Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock"));
if (_error->PendingError() == true) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_CANNOT_GET_LOCK, "Unable to lock the list directory");
- delete m_apt;
+ pk_backend_error_code(backend, PK_ERROR_ENUM_CANNOT_GET_LOCK, "Unable to lock the list directory");
+ delete apt;
return false;
// return _error->Error(_("Unable to lock the list directory"));
}
}
- m_apt->refreshCache();
+ apt->refreshCache();
// Rebuild the cache.
AptCacheFile cache(backend);
@@ -677,7 +677,7 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
if (_error->PendingError() == true) {
show_errors(backend, PK_ERROR_ENUM_CANNOT_FETCH_SOURCES, true);
}
- delete m_apt;
+ delete apt;
return false;
}
@@ -688,7 +688,7 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
//TODO: emit a package with PK_INFO_ENUM_UNTRUSTED
}
- delete m_apt;
+ delete apt;
return true;
}
@@ -705,24 +705,24 @@ static gboolean pk_backend_resolve_thread(PkBackend *backend)
gchar **package_ids;
PkBitfield filters;
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
- package_ids = pk_backend_get_strv (backend, "package_ids");
- pk_backend_set_allow_cancel (backend, true);
+ filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
+ package_ids = pk_backend_get_strv(backend, "package_ids");
+ pk_backend_set_allow_cancel(backend, true);
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
- PkgList pkgs = m_apt->resolvePackageIds(package_ids);
+ PkgList pkgs = apt->resolvePackageIds(package_ids);
// It's faster to emmit the packages here rather than in the matching part
- m_apt->emitPackages(pkgs, filters);
+ apt->emitPackages(pkgs, filters);
- delete m_apt;
+ delete apt;
return true;
}
@@ -746,22 +746,22 @@ static gboolean pk_backend_search_files_thread(PkBackend *backend)
// as we can only search for installed files lets avoid the opposite
if (!pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
PkgList output;
- output = m_apt->searchPackageFiles(values);
+ output = apt->searchPackageFiles(values);
// It's faster to emit the packages here rather than in the matching part
- m_apt->emitPackages(output, filters);
+ apt->emitPackages(output, filters);
- delete m_apt;
+ delete apt;
} else {
pk_backend_finished(backend);
}
@@ -777,7 +777,7 @@ void pk_backend_search_files(PkBackend *backend, PkBitfield filters, gchar **val
pk_backend_thread_create(backend, pk_backend_search_files_thread);
}
-static gboolean backend_search_groups_thread (PkBackend *backend)
+static gboolean backend_search_groups_thread(PkBackend *backend)
{
gchar **values;
PkBitfield filters;
@@ -785,11 +785,11 @@ static gboolean backend_search_groups_thread (PkBackend *backend)
values = pk_backend_get_strv(backend, "search");
filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
@@ -797,11 +797,11 @@ static gboolean backend_search_groups_thread (PkBackend *backend)
// It's faster to emmit the packages here rather than in the matching part
PkgList output;
- output = m_apt->getPackagesFromGroup(values);
- m_apt->emitPackages(output, filters);
+ output = apt->getPackagesFromGroup(values);
+ apt->emitPackages(output, filters);
pk_backend_set_percentage(backend, 100);
- delete m_apt;
+ delete apt;
return true;
}
@@ -831,39 +831,39 @@ static gboolean backend_search_package_thread(PkBackend *backend)
if (matcher->hasError()) {
g_debug("Regex compilation error");
delete matcher;
- pk_backend_finished (backend);
+ pk_backend_finished(backend);
return false;
}
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
delete matcher;
- delete m_apt;
+ delete apt;
return false;
}
if (_error->PendingError() == true) {
delete matcher;
- delete m_apt;
+ delete apt;
return false;
}
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
PkgList output;
if (pk_backend_get_bool(backend, "search_details")) {
- output = m_apt->searchPackageDetails(matcher);
+ output = apt->searchPackageDetails(matcher);
} else {
- output = m_apt->searchPackageName(matcher);
+ output = apt->searchPackageName(matcher);
}
// It's faster to emmit the packages here than in the matching part
- m_apt->emitPackages(output, filters);
+ apt->emitPackages(output, filters);
delete matcher;
pk_backend_set_percentage(backend, 100);
- delete m_apt;
+ delete apt;
return true;
}
@@ -894,7 +894,7 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
bool fixBroken = false;
gchar **full_paths = NULL;
- PkRoleEnum role = pk_backend_get_role (backend);
+ PkRoleEnum role = pk_backend_get_role(backend);
if (role == PK_ROLE_ENUM_SIMULATE_INSTALL_FILES ||
role == PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES ||
role == PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES ||
@@ -920,18 +920,18 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
// On fix broken mode no package to remove/install is allowed
fixBroken = true;
}
- g_debug ("FILE INSTALL: %i", fileInstall);
+ g_debug("FILE INSTALL: %i", fileInstall);
pk_backend_set_allow_cancel(backend, true);
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
PkgList installPkgs, removePkgs;
if (fileInstall) {
@@ -942,13 +942,13 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
pk_backend_error_code(backend,
PK_ERROR_ENUM_NOT_SUPPORTED,
"The backend can only proccess one file at time.");
- delete m_apt;
+ delete apt;
return false;
}
// get the list of packages to install
- if (!m_apt->markFileForInstall(full_paths[0], installPkgs, removePkgs)) {
- delete m_apt;
+ if (!apt->markFileForInstall(full_paths[0], installPkgs, removePkgs)) {
+ delete apt;
return false;
}
@@ -959,25 +959,25 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
// Resolve the given packages
gchar **package_ids = pk_backend_get_strv(backend, "package_ids");
if (remove) {
- removePkgs = m_apt->resolvePackageIds(package_ids);
+ removePkgs = apt->resolvePackageIds(package_ids);
} else {
- installPkgs = m_apt->resolvePackageIds(package_ids);
+ installPkgs = apt->resolvePackageIds(package_ids);
}
if (removePkgs.size() == 0 && installPkgs.size() == 0) {
pk_backend_error_code(backend,
PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
"Could not find package(s)");
- delete m_apt;
+ delete apt;
return false;
}
}
// Install/Update/Remove packages, or just simulate
- if (!m_apt->runTransaction(installPkgs, removePkgs, simulate, markAuto, fixBroken)) {
+ if (!apt->runTransaction(installPkgs, removePkgs, simulate, markAuto, fixBroken)) {
// Print transaction errors
- cout << "runTransaction failed" << endl;
- delete m_apt;
+ g_debug("AptIntf::runTransaction() failed: ", _error->PendingError());
+ delete apt;
return false;
}
@@ -990,15 +990,15 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
}
path = full_paths[i];
- if (!m_apt->installFile(path, simulate)) {
+ if (!apt->installFile(path, simulate)) {
cout << "Installation of DEB file " << path << " failed." << endl;
- delete m_apt;
+ delete apt;
return false;
}
}
}
- delete m_apt;
+ delete apt;
return true;
}
@@ -1096,11 +1096,11 @@ static gboolean backend_repo_manager_thread(PkBackend *backend)
bool list = pk_backend_get_bool(backend, "list");
if (list) {
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
notDevelopment = pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_DEVELOPMENT);
} else {
- pk_backend_set_status (backend, PK_STATUS_ENUM_REQUEST);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_REQUEST);
repo_id = pk_backend_get_string(backend, "repo_id");
enabled = pk_backend_get_bool(backend, "enabled");
}
@@ -1115,7 +1115,7 @@ static gboolean backend_repo_manager_thread(PkBackend *backend)
if (_lst.ReadVendors() == false) {
_error->Error("Cannot read vendors.list file");
show_errors(backend, PK_ERROR_ENUM_FAILED_CONFIG_PARSING);
- pk_backend_finished (backend);
+ pk_backend_finished(backend);
return false;
}
@@ -1205,24 +1205,24 @@ static gboolean backend_get_packages_thread(PkBackend *backend)
{
PkBitfield filters;
filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
- pk_backend_set_allow_cancel (backend, true);
+ pk_backend_set_allow_cancel(backend, true);
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
+ AptIntf *apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", apt);
+ if (apt->init()) {
+ g_debug("Failed to create apt cache");
+ delete apt;
return false;
}
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
PkgList output;
- output = m_apt->getPackages();
+ output = apt->getPackages();
// It's faster to emmit the packages rather here than in the matching part
- m_apt->emitPackages(output, filters);
+ apt->emitPackages(output, filters);
- delete m_apt;
+ delete apt;
return true;
}
@@ -1282,12 +1282,12 @@ PkBitfield pk_backend_get_roles(PkBackend *backend)
-1);
// only add GetDistroUpgrades if the binary is present
- if (g_file_test (PREUPGRADE_BINARY, G_FILE_TEST_EXISTS)) {
+ if (g_file_test(PREUPGRADE_BINARY, G_FILE_TEST_EXISTS)) {
pk_bitfield_add(roles, PK_ROLE_ENUM_GET_DISTRO_UPGRADES);
}
// only add GetDistroUpgrades if the binary is present
- if (g_file_test (GDEBI_BINARY, G_FILE_TEST_EXISTS)) {
+ if (g_file_test(GDEBI_BINARY, G_FILE_TEST_EXISTS)) {
pk_bitfield_add(roles, PK_ROLE_ENUM_SIMULATE_INSTALL_FILES);
pk_bitfield_add(roles, PK_ROLE_ENUM_INSTALL_FILES);
}
commit b14f939d8ed867ea9ad91af7562ed012c08e8c00
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Wed Apr 18 02:06:35 2012 -0300
aptcc: Add SimulateRepairSystem and RepairSystem methods, and update the feature matrix
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index ca20f67..a6d05c0 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -56,10 +56,8 @@ bool AptCacheFile::BuildCaches(bool withLock)
return pkgCacheFile::BuildCaches(NULL, withLock);
}
-bool AptCacheFile::CheckDeps(bool AllowBroken)
+bool AptCacheFile::CheckDeps(bool FixBroken)
{
- bool FixBroken = _config->FindB("APT::Get::Fix-Broken",false);
-
if (_error->PendingError() == true) {
return false;
}
@@ -86,32 +84,23 @@ bool AptCacheFile::CheckDeps(bool AllowBroken)
}
}
- // Nothing is broken
- if (DCache->BrokenCount() == 0 || AllowBroken == true) {
+ // Nothing is broken or we don't want to try fixing it
+ if (DCache->BrokenCount() == 0 || FixBroken == false) {
return true;
}
// Attempt to fix broken things
- if (FixBroken == true) {
-// c1out << _("Correcting dependencies...") << flush;
- if (pkgFixBroken(*DCache) == false || DCache->BrokenCount() != 0) {
-// c1out << _(" failed.") << endl;
- ShowBroken(true);
-
- return _error->Error("Unable to correct dependencies");
- }
- if (pkgMinimizeUpgrade(*DCache) == false) {
- return _error->Error("Unable to minimize the upgrade set");
- }
-
-// c1out << _(" Done") << endl;
- } else {
-// c1out << _("You might want to run 'apt-get -f install' to correct these.") << endl;
+ if (pkgFixBroken(*DCache) == false || DCache->BrokenCount() != 0) {
+ // We failed to fix the cache
ShowBroken(true);
- return _error->Error("Unmet dependencies. Try using -f.");
+ return _error->Error("Unable to correct dependencies");
+ }
+ if (pkgMinimizeUpgrade(*DCache) == false) {
+ return _error->Error("Unable to minimize the upgrade set");
}
+ // Fixing the cache is DONE no errors were found
return true;
}
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
index e04cebd..577c740 100644
--- a/backends/aptcc/AptCacheFile.h
+++ b/backends/aptcc/AptCacheFile.h
@@ -44,10 +44,14 @@ public:
*/
bool BuildCaches(bool withLock = false);
- /** This routine generates the caches and then opens the dependency cache
+ /**
+ * This routine generates the caches and then opens the dependency cache
* and verifies that the system is OK.
+ * @param FixBroken when true it will try to perform the instalation
+ * even if we have broken packages, when false it will try to fix
+ * the current situation
*/
- bool CheckDeps(bool AllowBroken = false);
+ bool CheckDeps(bool FixBroken = false);
/** Shows a list of all broken packages together with their
* dependencies. Similar to and based on the equivalent routine in
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 43ef949..701fc75 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -2255,7 +2255,7 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
return true;
}
-bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto)
+bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto, bool fixBroken)
{
//cout << "runTransaction" << simulate << remove << endl;
bool withLock = !simulate; // Check to see if we are just simulating,
@@ -2264,9 +2264,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
AptCacheFile cache(m_backend);
int timeout = 10;
// TODO test this
- while (cache.Open(withLock) == false) {
- // failed to open cache, try checkDeps then..
- // || cache.CheckDeps(CmdL.FileSize() != 1) == false
+ while (cache.Open(withLock) == false || cache.CheckDeps(fixBroken) == false) {
if (withLock == false || (timeout <= 0)) {
show_errors(m_backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
return false;
@@ -2276,10 +2274,13 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
sleep(1);
timeout--;
}
+ // Close the cache if we are going to try again
+ cache.Close();
}
pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
// Enter the special broken fixing mode if the user specified arguments
+ // THIS mode will run if fixBroken is false and the cache has broken packages
bool BrokenFix = false;
if (cache->BrokenCount() != 0) {
BrokenFix = true;
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 7594272..23ea056 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -96,7 +96,11 @@ public:
* \p simulate should be true, in this case packages with
* what's going to happen will be emitted.
*/
- bool runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto = false);
+ bool runTransaction(PkgList &install,
+ PkgList &remove,
+ bool simulate,
+ bool markAuto,
+ bool fixBroken);
/**
* Get package depends
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 209cb32..f9fd856 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -891,13 +891,15 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
bool remove = false;
bool fileInstall = false;
bool markAuto = false;
+ bool fixBroken = false;
gchar **full_paths = NULL;
PkRoleEnum role = pk_backend_get_role (backend);
if (role == PK_ROLE_ENUM_SIMULATE_INSTALL_FILES ||
role == PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES ||
role == PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES ||
- role == PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES) {
+ role == PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES ||
+ role == PK_ROLE_ENUM_SIMULATE_REPAIR_SYSTEM) {
simulate = true;
}
if (role == PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES ||
@@ -906,11 +908,20 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
}
if (role == PK_ROLE_ENUM_SIMULATE_INSTALL_FILES ||
role == PK_ROLE_ENUM_INSTALL_FILES) {
- full_paths = pk_backend_get_strv (backend, "full_paths");
+ full_paths = pk_backend_get_strv(backend, "full_paths");
fileInstall = true;
+
+ // Mark newly installed packages as auto-installed
+ // (they're dependencies of the new local package)
+ markAuto = true;
+ }
+ if (role == PK_ROLE_ENUM_SIMULATE_REPAIR_SYSTEM ||
+ role == PK_ROLE_ENUM_REPAIR_SYSTEM) {
+ // On fix broken mode no package to remove/install is allowed
+ fixBroken = true;
}
g_debug ("FILE INSTALL: %i", fileInstall);
- pk_backend_set_allow_cancel (backend, true);
+ pk_backend_set_allow_cancel(backend, true);
AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
@@ -941,14 +952,10 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
return false;
}
- // Mark newly installed packages as auto-installed
- // (they're dependencies of the new local package)
- markAuto = true;
-
cout << "installPkgs.size: " << installPkgs.size() << endl;
cout << "removePkgs.size: " << removePkgs.size() << endl;
- } else {
+ } else if (!fixBroken) {
// Resolve the given packages
gchar **package_ids = pk_backend_get_strv(backend, "package_ids");
if (remove) {
@@ -967,7 +974,7 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
}
// Install/Update/Remove packages, or just simulate
- if (!m_apt->runTransaction(installPkgs, removePkgs, simulate, markAuto)) {
+ if (!m_apt->runTransaction(installPkgs, removePkgs, simulate, markAuto, fixBroken)) {
// Print transaction errors
cout << "runTransaction failed" << endl;
delete m_apt;
@@ -1059,6 +1066,22 @@ void pk_backend_remove_packages(PkBackend *backend, gchar **package_ids, gboolea
pk_backend_thread_create(backend, backend_manage_packages_thread);
}
+/**
+ * pk_backend_repair_system:
+ */
+void pk_backend_repair_system(PkBackend *backend, gboolean only_trusted)
+{
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
+}
+
+/**
+ * pk_backend_simulate_repair_system:
+ */
+void pk_backend_simulate_repair_system(PkBackend *backend)
+{
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
+}
+
static gboolean backend_repo_manager_thread(PkBackend *backend)
{
// list
diff --git a/docs/html/pk-matrix.html b/docs/html/pk-matrix.html
index 397588e..bdc05e1 100644
--- a/docs/html/pk-matrix.html
+++ b/docs/html/pk-matrix.html
@@ -630,7 +630,7 @@
<tr>
<td><b>RepairSystem</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- aptcc -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
@@ -649,7 +649,7 @@
<tr>
<td><b>SimulateRepairSystem</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- aptcc -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
@@ -786,7 +786,7 @@
<tr>
<td><b>Supported</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- aptcc -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
@@ -843,7 +843,7 @@
<tr>
<td><b>Arch</b></td>
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- aptcc -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
commit bc6908dd81c54aa56923b6d461efafcc4fb81b26
Author: Vincent Untz <vuntz at gnome.org>
Date: Thu Feb 16 09:36:34 2012 +0100
zypp: build pool before resolving
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 78a195a..5b30bee 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1321,10 +1321,10 @@ backend_resolve_thread (PkBackend *backend)
return FALSE;
}
- zypp->getTarget()->load();
-
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ zypp_build_pool (backend, TRUE);
+
for (uint i = 0; package_ids[i]; i++) {
vector<sat::Solvable> v;
commit db797cf7e1e4a8adac47b5809476d7ba235fff3d
Author: Vincent Untz <vuntz at gnome.org>
Date: Wed Feb 15 18:41:56 2012 +0100
zypp: Do not set a PACKAGE_NOT_FOUND error when resolving packages
If there's no result when resolving packages, then we just return
nothing; we don't need an error. That's how other backends deal with
this, as far as I can tell.
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 27c04dd..78a195a 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1370,12 +1370,6 @@ backend_resolve_thread (PkBackend *backend)
}
zypp_emit_filtered_packages_in_list (backend, pkgs);
-
- if (pkgs.size() < 1) {
- return zypp_backend_finished_error (
- backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "couldn't find package");
- }
}
pk_backend_finished (backend);
commit d06d7f591dc49a70ededff9e28cac9066796409c
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Tue Apr 17 05:40:11 2012 -0300
aptcc: Fix supported filter
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index cbcbfcb..43ef949 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -243,24 +243,29 @@ bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
}
}
- // TODO add Ubuntu handling
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_FREE)) {
- if (!component.compare("contrib") ||
- !component.compare("non-free")) {
+ if (component.compare("main") != 0 &&
+ component.compare("universe") != 0) {
+ // Must be in main and universe to be free
return false;
}
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_FREE)) {
- if (component.compare("contrib") &&
- component.compare("non-free")) {
+ if (component.compare("main") == 0 ||
+ component.compare("universe") == 0) {
+ // Must not be in main or universe to be free
return false;
}
}
// Check for supported packages
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_SUPPORTED)) {
- return packageIsSupported(pkg, component);
+ if (!packageIsSupported(ver, component)) {
+ return false;
+ }
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_SUPPORTED)) {
- return !packageIsSupported(pkg, component);
+ if (packageIsSupported(ver, component)) {
+ return false;
+ }
}
// TODO test this one..
@@ -1334,17 +1339,17 @@ void AptIntf::emitPackageFiles(const gchar *pi)
/**
* Check if package is officially supported by the current distribution
*/
-bool AptIntf::packageIsSupported(const pkgCache::PkgIterator &pkgIter, string component)
+bool AptIntf::packageIsSupported(const pkgCache::VerIterator &verIter, string component)
{
- const pkgCache::VerIterator &verIter = pkgIter.VersionList();
string origin;
- if(!verIter.end()) {
+ if (!verIter.end()) {
pkgCache::VerFileIterator vf = verIter.FileList();
origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
}
- if (component.empty())
+ if (component.empty()) {
component = "main";
+ }
// Get a fetcher
AcqPackageKitStatus Stat(this, m_backend, m_cancel);
@@ -1354,11 +1359,11 @@ bool AptIntf::packageIsSupported(const pkgCache::PkgIterator &pkgIter, string co
bool trusted = checkTrusted(fetcher, false);
- if ((origin.compare ("Debian") == 0) || (origin.compare ("Ubuntu") == 0)) {
- if ((component.compare ("main") == 0 ||
- component.compare ("restricted") == 0 ||
- component.compare ("unstable") == 0 ||
- component.compare ("testing") == 0) && trusted) {
+ if ((origin.compare("Debian") == 0) || (origin.compare("Ubuntu") == 0)) {
+ if ((component.compare("main") == 0 ||
+ component.compare("restricted") == 0 ||
+ component.compare("unstable") == 0 ||
+ component.compare("testing") == 0) && trusted) {
return true;
}
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index a2edd58..7594272 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -232,7 +232,7 @@ private:
bool &m_cancel;
bool checkTrusted(pkgAcquire &fetcher, bool simulating);
- bool packageIsSupported(const pkgCache::PkgIterator &pkgIter, string component);
+ bool packageIsSupported(const pkgCache::VerIterator &verIter, string component);
bool tryToInstall(const pkgCache::PkgIterator &constPkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
commit 8acfcf399aa9fb1acea1732f6872ea4dc2af4cfd
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Tue Apr 17 05:25:03 2012 -0300
aptcc: Fix a few mem leaks
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 76d31ef..cbcbfcb 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -84,14 +84,17 @@ bool AptIntf::init()
// _locale.erase(found);
// _config->Set("APT::Acquire::Translation", _locale);
}
+ g_free(locale);
// set http proxy
http_proxy = pk_backend_get_proxy_http(m_backend);
setenv("http_proxy", http_proxy, 1);
+ g_free(http_proxy);
// set ftp proxy
ftp_proxy = pk_backend_get_proxy_ftp(m_backend);
setenv("ftp_proxy", ftp_proxy, 1);
+ g_free(ftp_proxy);
// Tries to open the cache
bool ret;
@@ -2579,6 +2582,7 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
// we don't have a socket set, let's fallback to noninteractive
setenv("DEBIAN_FRONTEND", "noninteractive", 1);
}
+ g_free(socket);
gchar *locale;
// Set the LANGUAGE so debconf messages get localization
@@ -2587,6 +2591,7 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
setenv("LANG", locale, 1);
//setenv("LANG", "C", 1);
}
+ g_free(locale);
// Pass the write end of the pipe to the install function
res = PM->DoInstallPostFork(readFromChildFD[1]);
commit 0e5f551fd3bd930e1d31b376cd576a0f36a85c94
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Tue Apr 17 05:01:49 2012 -0300
aptcc: Move cache related functions to pkgCacheFile subclass
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index 556323a..ca20f67 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -254,3 +254,126 @@ void AptCacheFile::buildPkgRecords()
// Create the text record parser
m_packageRecords = new pkgRecords(*this);
}
+
+pkgCache::VerIterator AptCacheFile::findCandidateVer(const pkgCache::PkgIterator &pkg)
+{
+ // get the candidate version iterator
+ return (*this)[pkg].CandidateVerIter(*this);
+}
+
+std::string AptCacheFile::getDefaultShortDescription(const pkgCache::VerIterator &ver)
+{
+ if (ver.end() || ver.FileList().end() || GetPkgRecords() == 0) {
+ return string();
+ }
+
+ pkgCache::VerFileIterator vf = ver.FileList();
+ return m_packageRecords->Lookup(vf).ShortDesc();
+}
+
+std::string AptCacheFile::getShortDescription(const pkgCache::VerIterator &ver)
+{
+ if (ver.end() || ver.FileList().end() || GetPkgRecords() == 0) {
+ return string();
+ }
+
+ pkgCache::DescIterator d = ver.TranslatedDescription();
+ if (d.end()) {
+ return string();
+ }
+
+ pkgCache::DescFileIterator df = d.FileList();
+ if (df.end()) {
+ return string();
+ } else {
+ return m_packageRecords->Lookup(df).ShortDesc();
+ }
+}
+
+std::string AptCacheFile::getDefaultLongDescription(const pkgCache::VerIterator &ver)
+{
+ if(ver.end() || ver.FileList().end() || GetPkgRecords() == 0) {
+ return string();
+ }
+
+ pkgCache::VerFileIterator vf = ver.FileList();
+
+ if (vf.end()) {
+ return string();
+ } else {
+ return m_packageRecords->Lookup(vf).LongDesc();
+ }
+}
+
+std::string AptCacheFile::getLongDescription(const pkgCache::VerIterator &ver)
+{
+ if (ver.end() || ver.FileList().end() || GetPkgRecords() == 0) {
+ return string();
+ }
+
+ pkgCache::DescIterator d = ver.TranslatedDescription();
+ if (d.end()) {
+ return string();
+ }
+
+ pkgCache::DescFileIterator df = d.FileList();
+ if (df.end()) {
+ return string();
+ } else {
+ return m_packageRecords->Lookup(df).LongDesc();
+ }
+}
+
+std::string AptCacheFile::getLongDescriptionParsed(const pkgCache::VerIterator &ver)
+{
+ return debParser(getLongDescription(ver));
+}
+
+std::string AptCacheFile::debParser(std::string descr)
+{
+ // Policy page on package descriptions
+ // http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
+ unsigned int i;
+ string::size_type nlpos=0;
+
+ nlpos = descr.find('\n');
+ // delete first line
+ if (nlpos != string::npos) {
+ descr.erase(0, nlpos + 2); // del "\n " too
+ }
+
+ // avoid replacing '\n' for a ' ' after a '.\n' is found
+ bool removedFullStop = false;
+ while (nlpos < descr.length()) {
+ // find the new line position
+ nlpos = descr.find('\n', nlpos);
+ if (nlpos == string::npos) {
+ // if it could not find the new line
+ // get out of the loop
+ break;
+ }
+
+ i = nlpos;
+ // erase the char after '\n' which is always " "
+ descr.erase(++i, 1);
+
+ // remove lines likes this: " .", making it a \n
+ if (descr[i] == '.') {
+ descr.erase(i, 1);
+ nlpos = i;
+ // don't permit the next round to replace a '\n' to a ' '
+ removedFullStop = true;
+ continue;
+ } else if (descr[i] != ' ' && removedFullStop == false) {
+ // it's not a line to be verbatim displayed
+ // So it's a paragraph let's replace '\n' with a ' '
+ // replace new line with " "
+ descr.replace(nlpos, 1, " ");
+ }
+
+ removedFullStop = false;
+ nlpos++;
+ }
+
+ return descr;
+}
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
index 620b568..e04cebd 100644
--- a/backends/aptcc/AptCacheFile.h
+++ b/backends/aptcc/AptCacheFile.h
@@ -69,8 +69,40 @@ public:
*/
inline pkgDepCache* GetDepCache() { BuildCaches(); BuildPolicy(); BuildDepCache(); return DCache; }
+ /**
+ * Tries to find the candidate version of a package
+ * @returns pkgCache::VerIterator, if .end() is true the version could not be found
+ */
+ pkgCache::VerIterator findCandidateVer(const pkgCache::PkgIterator &pkg);
+
+ /** \return a short description string corresponding to the given
+ * version.
+ */
+ std::string getDefaultShortDescription(const pkgCache::VerIterator &ver);
+
+ /** \return a short description string corresponding to the given
+ * version.
+ */
+ std::string getShortDescription(const pkgCache::VerIterator &ver);
+
+ /** \return a short description string corresponding to the given
+ * version.
+ */
+ std::string getDefaultLongDescription(const pkgCache::VerIterator &ver);
+
+ /** \return a short description string corresponding to the given
+ * version.
+ */
+ std::string getLongDescription(const pkgCache::VerIterator &ver);
+
+ /** \return a short description string corresponding to the given
+ * version.
+ */
+ std::string getLongDescriptionParsed(const pkgCache::VerIterator &ver);
+
private:
void buildPkgRecords();
+ static std::string debParser(std::string descr);
pkgRecords *m_packageRecords;
PkBackend *m_backend;
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 055487b..76d31ef 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -137,7 +137,7 @@ pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
return ver;
}
- const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
// check to see if the provided package isn't virtual too
if (candidateVer.end() == false &&
strcmp(candidateVer.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0) {
@@ -158,7 +158,7 @@ pkgCache::VerIterator AptIntf::findVer(const pkgCache::PkgIterator &pkg)
}
// Else get the candidate version iterator
- const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
if (!candidateVer.end()) {
return candidateVer;
}
@@ -167,12 +167,6 @@ pkgCache::VerIterator AptIntf::findVer(const pkgCache::PkgIterator &pkg)
return pkg.VersionList();
}
-pkgCache::VerIterator AptIntf::findCandidateVer(const pkgCache::PkgIterator &pkg)
-{
- // get the candidate version iterator
- return (*m_cache.GetDepCache())[pkg].CandidateVerIter(m_cache);
-}
-
bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
{
if (filters != 0) {
@@ -321,7 +315,7 @@ void AptIntf::emitPackage(const pkgCache::VerIterator &ver,
pk_backend_package(m_backend,
state,
package_id,
- get_short_description(ver, m_cache.GetPkgRecords()).c_str());
+ m_cache.getShortDescription(ver).c_str());
g_free(package_id);
}
@@ -417,7 +411,7 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
// Ignore virtual packages
pkgCache::VerIterator ver = findVer(pkg);
if (ver.end() == true) {
- ver = findCandidateVer(pkg);
+ ver = m_cache.findCandidateVer(pkg);
if (ver.end() == true) {
continue;
}
@@ -489,7 +483,7 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
// TODO: Ignore virtual packages
pkgCache::VerIterator ver = findVer (pkg);
if (ver.end()) {
- ver = findCandidateVer(pkg);
+ ver = m_cache.findCandidateVer(pkg);
if (ver.end()) {
continue;
}
@@ -627,7 +621,7 @@ void AptIntf::emitPackageDetail(const pkgCache::VerIterator &ver)
package_id,
"unknown",
get_enum_group(section),
- get_long_description_parsed(ver, m_cache.GetPkgRecords()).c_str(),
+ m_cache.getLongDescriptionParsed(ver).c_str(),
rec.Homepage().c_str(),
size);
@@ -1092,7 +1086,7 @@ PkgList AptIntf::searchPackageDetails(Matcher *matcher)
const pkgCache::VerIterator &ver = findVer(pkg);
if (ver.end() == false) {
if (matcher->matches(pkg.Name()) ||
- matcher->matches(get_long_description(ver, m_cache.GetPkgRecords()))) {
+ matcher->matches(m_cache.getLongDescription(ver))) {
// The package matched
output.push_back(ver);
}
@@ -1556,7 +1550,7 @@ void AptIntf::emitChangedPackages(AptCacheFile &cache)
for (pkgCache::PkgIterator pkg = cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (cache[pkg].NewInstall() == true) {
// installing;
- const pkgCache::VerIterator &ver = findCandidateVer(pkg);
+ const pkgCache::VerIterator &ver = m_cache.findCandidateVer(pkg);
if (!ver.end()) {
installing.push_back(ver);
}
@@ -1568,7 +1562,7 @@ void AptIntf::emitChangedPackages(AptCacheFile &cache)
}
} else if (cache[pkg].Upgrade() == true) {
// updating
- const pkgCache::VerIterator &ver = findCandidateVer(pkg);
+ const pkgCache::VerIterator &ver = m_cache.findCandidateVer(pkg);
if (!ver.end()) {
updating.push_back(ver);
}
@@ -1593,16 +1587,17 @@ void AptIntf::populateInternalPackages(AptCacheFile &cache)
for (pkgCache::PkgIterator pkg = cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (cache[pkg].NewInstall() == true) {
// installing
- m_pkgs.push_back(findCandidateVer(pkg));
+ m_pkgs.push_back(m_cache.findCandidateVer(pkg));
} else if (cache[pkg].Delete() == true) {
// removing
m_pkgs.push_back(findVer(pkg));
} else if (cache[pkg].Upgrade() == true) {
// updating
- m_pkgs.push_back(findCandidateVer(pkg));
+ m_pkgs.push_back(m_cache.findCandidateVer(pkg));
} else if (cache[pkg].Downgrade() == true) {
// downgrading
- m_pkgs.push_back(findCandidateVer(pkg));
+ // TODO shouldn't be the current version?
+ m_pkgs.push_back(m_cache.findCandidateVer(pkg));
}
}
}
@@ -1629,7 +1624,7 @@ void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
emitPackage(ver, state);
}
- const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
// check to see if we found the package
if (candidateVer.end() == false) {
emitPackage(candidateVer, state);
@@ -2010,7 +2005,7 @@ PkgList AptIntf::resolvePackageIds(gchar **package_ids, PkBitfield filters)
ret.push_back(ver);
}
- const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
// check to see if the provided package isn't virtual too
if (candidateVer.end() == false) {
ret.push_back(candidateVer);
@@ -2029,7 +2024,7 @@ PkgList AptIntf::resolvePackageIds(gchar **package_ids, PkBitfield filters)
ret.push_back(ver);
}
- const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
+ const pkgCache::VerIterator &candidateVer = m_cache.findCandidateVer(pkg);
// check to see if the provided package isn't virtual too
if (candidateVer.end() == false) {
ret.push_back(candidateVer);
@@ -2439,7 +2434,7 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
}
pkgCache::VerIterator ver = cache[pkg].InstVerIter(cache);
- if (ver.end() && (ver = findCandidateVer(pkg))) {
+ if (ver.end() && (ver = m_cache.findCandidateVer(pkg))) {
// Ignore invalid versions
continue;
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 4883998..a2edd58 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -65,12 +65,6 @@ public:
pkgCache::VerIterator findVer(const pkgCache::PkgIterator &pkg);
/**
- * Tries to find the candidate version of a package
- * @returns pkgCache::VerIterator, if .end() is true the version could not be found
- */
- pkgCache::VerIterator findCandidateVer(const pkgCache::PkgIterator &pkg);
-
- /**
* Tries to find a list of packages mathing the package ids
* @returns a list of pkgCache::VerIterator, if the list is empty no package was found
*/
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 497e593..5f784b7 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -24,139 +24,6 @@
#include <fstream>
#include <sys/stat.h>
-static string debParser(string descr);
-
-string get_default_short_description(const pkgCache::VerIterator &ver,
- pkgRecords *records)
-{
- if(ver.end() || ver.FileList().end() || records == NULL) {
- return string();
- }
-
- pkgCache::VerFileIterator vf = ver.FileList();
-
- if (vf.end()) {
- return string();
- } else {
- return records->Lookup(vf).ShortDesc();
- }
-}
-
-string get_short_description(const pkgCache::VerIterator &ver,
- pkgRecords *records)
-{
- if (ver.end() || ver.FileList().end() || records == NULL) {
- return string();
- }
-
- pkgCache::DescIterator d = ver.TranslatedDescription();
-
- if (d.end()) {
- return string();
- }
-
- pkgCache::DescFileIterator df = d.FileList();
-
- if (df.end()) {
- return string();
- } else {
- return records->Lookup(df).ShortDesc();
- }
-}
-
-string get_long_description(const pkgCache::VerIterator &ver,
- pkgRecords *records)
-{
- if (ver.end() || ver.FileList().end() || records == NULL) {
- return string();
- }
-
- pkgCache::DescIterator d = ver.TranslatedDescription();
-
- if (d.end()) {
- return string();
- }
-
- pkgCache::DescFileIterator df = d.FileList();
-
- if (df.end()) {
- return string();
- } else {
- return records->Lookup(df).LongDesc();
- }
-}
-
-string get_long_description_parsed(const pkgCache::VerIterator &ver,
- pkgRecords *records)
-{
- return debParser(get_long_description(ver, records));
-}
-
-string get_default_long_description(const pkgCache::VerIterator &ver,
- pkgRecords *records)
-{
- if(ver.end() || ver.FileList().end() || records == NULL) {
- return string();
- }
-
- pkgCache::VerFileIterator vf = ver.FileList();
-
- if (vf.end()) {
- return string();
- } else {
- return records->Lookup(vf).LongDesc();
- }
-}
-
-static string debParser(string descr)
-{
- // Policy page on package descriptions
- // http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
- unsigned int i;
- string::size_type nlpos=0;
-
- nlpos = descr.find('\n');
- // delete first line
- if (nlpos != string::npos) {
- descr.erase(0, nlpos + 2); // del "\n " too
- }
-
- // avoid replacing '\n' for a ' ' after a '.\n' is found
- bool removedFullStop = false;
- while (nlpos < descr.length()) {
- // find the new line position
- nlpos = descr.find('\n', nlpos);
- if (nlpos == string::npos) {
- // if it could not find the new line
- // get out of the loop
- break;
- }
-
- i = nlpos;
- // erase the char after '\n' which is always " "
- descr.erase(++i, 1);
-
- // remove lines likes this: " .", making it a \n
- if (descr[i] == '.') {
- descr.erase(i, 1);
- nlpos = i;
- // don't permit the next round to replace a '\n' to a ' '
- removedFullStop = true;
- continue;
- } else if (descr[i] != ' ' && removedFullStop == false) {
- // it's not a line to be verbatim displayed
- // So it's a paragraph let's replace '\n' with a ' '
- // replace new line with " "
- descr.replace(nlpos, 1, " ");
- }
-
- removedFullStop = false;
- nlpos++;
- }
-
- return descr;
-}
-
PkGroupEnum get_enum_group(string group)
{
if (group.compare ("admin") == 0) {
diff --git a/backends/aptcc/apt-utils.h b/backends/aptcc/apt-utils.h
index 122f32d..4b07d56 100644
--- a/backends/aptcc/apt-utils.h
+++ b/backends/aptcc/apt-utils.h
@@ -62,37 +62,6 @@ public:
}
};
-/** \return a short description string corresponding to the given
- * version.
- */
-string get_default_short_description(const pkgCache::VerIterator &ver,
- pkgRecords *records);
-
-/** \return a short description string corresponding to the given
- * version.
- */
-string get_short_description(const pkgCache::VerIterator &ver,
- pkgRecords *records);
-
-
-/** \return a short description string corresponding to the given
- * version.
- */
-string get_default_long_description(const pkgCache::VerIterator &ver,
- pkgRecords *records);
-
-/** \return a short description string corresponding to the given
- * version.
- */
-string get_long_description(const pkgCache::VerIterator &ver,
- pkgRecords *records);
-
-/** \return a short description string corresponding to the given
- * version.
- */
-string get_long_description_parsed(const pkgCache::VerIterator &ver,
- pkgRecords *records);
-
/**
* Return the PkEnumGroup of the give group string.
*/
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index c43ac88..209cb32 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -405,19 +405,19 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
if (getUpdates) {
PkgList updates;
PkgList kept;
- for (pkgCache::PkgIterator pkg = cache.GetPkgCache()->PkgBegin();
+ for (pkgCache::PkgIterator pkg = cache->PkgBegin();
!pkg.end();
++pkg) {
if (cache[pkg].Upgrade() == true &&
cache[pkg].NewInstall() == false) {
- const pkgCache::VerIterator &ver = m_apt->findCandidateVer(pkg);
+ const pkgCache::VerIterator &ver = cache.findCandidateVer(pkg);
if (!ver.end()) {
updates.push_back(ver);
}
} else if (cache[pkg].Upgradable() == true &&
pkg->CurrentVer != 0 &&
cache[pkg].Delete() == false) {
- const pkgCache::VerIterator &ver = m_apt->findCandidateVer(pkg);
+ const pkgCache::VerIterator &ver = cache.findCandidateVer(pkg);
if (!ver.end()) {
kept.push_back(ver);
}
commit aca0b4b143e071f4b4390c89c86d62ba5741d088
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Tue Apr 17 04:32:42 2012 -0300
aptcc: Make direct use of cache->FindPkg
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 3bcba8a..055487b 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -115,31 +115,13 @@ void AptIntf::cancel()
}
}
-pkgCache::PkgIterator AptIntf::findPackage(const std::string &name)
-{
- // This is needed otherwise we get random crashes
-// if (!m_cache.open()) {
-// return pkgCache::PkgIterator();
-// }
- return m_cache->FindPkg(name);
-}
-
-pkgCache::PkgIterator AptIntf::findPackageArch(const std::string &name, const std::string &arch)
-{
- // This is needed otherwise we get random crashes
-// if (!m_cache.open()) {
-// return pkgCache::PkgIterator();
-// }
- return m_cache->FindPkg(name, arch);
-}
-
pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
{
gchar **parts;
pkgCache::PkgIterator pkg;
parts = pk_package_id_split(packageId);
- pkg = findPackageArch(parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
+ pkg = m_cache->FindPkg(parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg.end() || (pkg.VersionList().end() && pkg.ProvidesList().end())) {
@@ -1192,7 +1174,7 @@ PkgList AptIntf::searchPackageFiles(gchar **values)
if (m_cancel) {
break;
}
- const pkgCache::PkgIterator &pkg = findPackage(*it);
+ const pkgCache::PkgIterator &pkg = m_cache->FindPkg(*it);
if (pkg.end() == true) {
continue;
}
@@ -1273,7 +1255,7 @@ void AptIntf::providesMimeType(PkgList &output, gchar **values)
if (m_cancel) {
break;
}
- const pkgCache::PkgIterator &pkg = findPackage(*it);
+ const pkgCache::PkgIterator &pkg = m_cache->FindPkg(*it);
if (pkg.end() == true) {
continue;
}
@@ -1283,6 +1265,21 @@ void AptIntf::providesMimeType(PkgList &output, gchar **values)
}
output.push_back(ver);
}
+
+ // Check if app-install-data is installed
+ if (output.empty()) {
+ // check if app-install-data is installed
+ pkgCache::PkgIterator pkg;
+ pkg = m_cache->FindPkg("app-install-data");
+ if (pkg->CurrentState != pkgCache::State::Installed) {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_INTERNAL_ERROR,
+ "You need the app-install-data "
+ "package to be able to look for "
+ "applications that can handle "
+ "this kind of file");
+ }
+ }
}
// used to emit files it reads the info directly from the files
@@ -1619,7 +1616,7 @@ void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
}
}
- const pkgCache::PkgIterator &pkg = findPackage(name);
+ const pkgCache::PkgIterator &pkg = m_cache->FindPkg(name);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg.end() == true ||
(pkg.VersionList().end() && pkg.ProvidesList().end())) {
@@ -2020,7 +2017,7 @@ PkgList AptIntf::resolvePackageIds(gchar **package_ids, PkBitfield filters)
}
}
} else {
- const pkgCache::PkgIterator &pkg = findPackage(pi);
+ const pkgCache::PkgIterator &pkg = m_cache->FindPkg(pi);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg.end() == true || (pkg.VersionList().end() && pkg.ProvidesList().end())) {
continue;
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 4da7ba9..4883998 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -51,18 +51,6 @@ public:
void cancel();
/**
- * Tries to find a package with the given package name
- * @returns pkgCache::VerIterator, if .end() is true the package could not be found
- */
- pkgCache::PkgIterator findPackage(const std::string &name);
-
- /**
- * Tries to find a package with the given package name and arch
- * @returns pkgCache::VerIterator, if .end() is true the package could not be found
- */
- pkgCache::PkgIterator findPackageArch(const std::string &name, const std::string &arch = std::string());
-
- /**
* Tries to find a package with the given packageId
* @returns pkgCache::VerIterator, if .end() is true the package could not be found
*/
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 4a4b8c3..c43ac88 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -498,22 +498,8 @@ static gboolean backend_what_provides_thread(PkBackend *backend)
m_apt->providesMimeType(output, values);
}
- if (output.empty() && provides == PK_PROVIDES_ENUM_MIMETYPE) {
- // check if app-install-data is installed
- pkgCache::PkgIterator pkg;
- pkg = m_apt->findPackage("app-install-data");
- if (pkg->CurrentState != pkgCache::State::Installed) {
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_INTERNAL_ERROR,
- "You need the app-install-data "
- "package to be able to look for "
- "applications that can handle "
- "this kind of file");
- }
- } else {
- // It's faster to emit the packages here rather than in the matching part
- m_apt->emitPackages(output, filters);
- }
+ // It's faster to emit the packages here rather than in the matching part
+ m_apt->emitPackages(output, filters);
delete m_apt;
} else {
commit 687775d5d4adc777939e5fe87e753a2d61f64faf
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Tue Apr 17 04:25:36 2012 -0300
aptcc: Make sure we discard errors when closing the cache
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index fcab43a..556323a 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -26,15 +26,11 @@
AptCacheFile::AptCacheFile(PkBackend *backend) :
m_packageRecords(0)
{
- std::cout << "AptCacheFile::AptCacheFile()" << std::endl;
}
AptCacheFile::~AptCacheFile()
{
- std::cout << "AptCacheFile::~AptCacheFile()" << std::endl;
-
- delete m_packageRecords;
- pkgCacheFile::Close();
+ Close();
}
bool AptCacheFile::Open(bool withLock)
@@ -44,12 +40,15 @@ bool AptCacheFile::Open(bool withLock)
void AptCacheFile::Close()
{
- if (m_packageRecords) {
- delete m_packageRecords;
- }
+ delete m_packageRecords;
+
m_packageRecords = 0;
pkgCacheFile::Close();
+
+ // Discard all errors to avoid a future failure when opening
+ // the package cache
+ _error->Discard();
}
bool AptCacheFile::BuildCaches(bool withLock)
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index aa2bc3e..3bcba8a 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -96,7 +96,6 @@ bool AptIntf::init()
// Tries to open the cache
bool ret;
ret = m_cache.Open();
- cout << "AptIntf::init() " << ret << endl;
return !ret;
}
commit cfb310be151e667359bd4fcf78081e53764da00e
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Mon Apr 16 16:24:39 2012 -0300
aptcc: Move ShowBroken to AptCacheFile, and added CheckDeps from apt-get
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index 94bff86..fcab43a 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -19,13 +19,20 @@
*/
#include "AptCacheFile.h"
-AptCacheFile::AptCacheFile() :
+#include <apt-pkg/algorithms.h>
+#include <sstream>
+#include <cstdio>
+
+AptCacheFile::AptCacheFile(PkBackend *backend) :
m_packageRecords(0)
{
+ std::cout << "AptCacheFile::AptCacheFile()" << std::endl;
}
AptCacheFile::~AptCacheFile()
{
+ std::cout << "AptCacheFile::~AptCacheFile()" << std::endl;
+
delete m_packageRecords;
pkgCacheFile::Close();
}
@@ -50,6 +57,195 @@ bool AptCacheFile::BuildCaches(bool withLock)
return pkgCacheFile::BuildCaches(NULL, withLock);
}
+bool AptCacheFile::CheckDeps(bool AllowBroken)
+{
+ bool FixBroken = _config->FindB("APT::Get::Fix-Broken",false);
+
+ if (_error->PendingError() == true) {
+ return false;
+ }
+
+ // Check that the system is OK
+ if (DCache->DelCount() != 0 || DCache->InstCount() != 0) {
+ return _error->Error("Internal error, non-zero counts");
+ }
+
+ // Apply corrections for half-installed packages
+ if (pkgApplyStatus(*DCache) == false) {
+ return false;
+ }
+
+ if (_config->FindB("APT::Get::Fix-Policy-Broken",false) == true) {
+ FixBroken = true;
+ if ((DCache->PolicyBrokenCount() > 0)) {
+ // upgrade all policy-broken packages with ForceImportantDeps=True
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); !I.end(); ++I) {
+ if ((*DCache)[I].NowPolicyBroken() == true) {
+ DCache->MarkInstall(I,true,0, false, true);
+ }
+ }
+ }
+ }
+
+ // Nothing is broken
+ if (DCache->BrokenCount() == 0 || AllowBroken == true) {
+ return true;
+ }
+
+ // Attempt to fix broken things
+ if (FixBroken == true) {
+// c1out << _("Correcting dependencies...") << flush;
+ if (pkgFixBroken(*DCache) == false || DCache->BrokenCount() != 0) {
+// c1out << _(" failed.") << endl;
+ ShowBroken(true);
+
+ return _error->Error("Unable to correct dependencies");
+ }
+ if (pkgMinimizeUpgrade(*DCache) == false) {
+ return _error->Error("Unable to minimize the upgrade set");
+ }
+
+// c1out << _(" Done") << endl;
+ } else {
+// c1out << _("You might want to run 'apt-get -f install' to correct these.") << endl;
+ ShowBroken(true);
+
+ return _error->Error("Unmet dependencies. Try using -f.");
+ }
+
+ return true;
+}
+
+void AptCacheFile::ShowBroken(bool Now)
+{
+ std::stringstream out;
+
+ out << "The following packages have unmet dependencies:" << std::endl;
+ for (pkgCache::PkgIterator I = (*this)->PkgBegin(); ! I.end(); ++I) {
+ if (Now == true) {
+ if ((*this)[I].NowBroken() == false) {
+ continue;
+ }
+ } else {
+ if ((*this)[I].InstBroken() == false){
+ continue;
+ }
+ }
+
+ // Print out each package and the failed dependencies
+ out << " " << I.Name() << ":";
+ unsigned Indent = strlen(I.Name()) + 3;
+ bool First = true;
+ pkgCache::VerIterator Ver;
+
+ if (Now == true) {
+ Ver = I.CurrentVer();
+ } else {
+ Ver = (*this)[I].InstVerIter(*this);
+ }
+
+ if (Ver.end() == true) {
+ out << std::endl;
+ continue;
+ }
+
+ for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;) {
+ // Compute a single dependency element (glob or)
+ pkgCache::DepIterator Start;
+ pkgCache::DepIterator End;
+ D.GlobOr(Start,End); // advances D
+
+ if ((*this)->IsImportantDep(End) == false){
+ continue;
+ }
+
+ if (Now == true) {
+ if (((*this)[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow){
+ continue;
+ }
+ } else {
+ if (((*this)[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) {
+ continue;
+ }
+ }
+
+ bool FirstOr = true;
+ while (1) {
+ if (First == false){
+ for (unsigned J = 0; J != Indent; J++) {
+ out << ' ';
+ }
+ }
+ First = false;
+
+ if (FirstOr == false) {
+ for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++) {
+ out << ' ';
+ }
+ } else {
+ out << ' ' << End.DepType() << ": ";
+ }
+ FirstOr = false;
+
+ out << Start.TargetPkg().Name();
+
+ // Show a quick summary of the version requirements
+ if (Start.TargetVer() != 0) {
+ out << " (" << Start.CompType() << " " << Start.TargetVer() << ")";
+ }
+
+ /* Show a summary of the target package if possible. In the case
+ of virtual packages we show nothing */
+ pkgCache::PkgIterator Targ = Start.TargetPkg();
+ if (Targ->ProvidesList == 0) {
+ out << ' ';
+ pkgCache::VerIterator Ver = (*this)[Targ].InstVerIter(*this);
+ if (Now == true) {
+ Ver = Targ.CurrentVer();
+ }
+
+ if (Ver.end() == false)
+ {
+ char buffer[1024];
+ if (Now == true) {
+ sprintf(buffer, "but %s is installed", Ver.VerStr());
+ } else {
+ sprintf(buffer, "but %s is to be installed", Ver.VerStr());
+ }
+
+ out << buffer;
+ } else {
+ if ((*this)[Targ].CandidateVerIter(*this).end() == true) {
+ if (Targ->ProvidesList == 0) {
+ out << "but it is not installable";
+ } else {
+ out << "but it is a virtual package";
+ }
+ } else {
+ if (Now) {
+ out << "but it is not installed";
+ } else {
+ out << "but it is not going to be installed";
+ }
+ }
+ }
+ }
+
+ if (Start != End) {
+ out << " or";
+ }
+ out << std::endl;
+
+ if (Start == End){
+ break;
+ }
+ Start++;
+ }
+ }
+ }
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, out.str().c_str());
+}
+
void AptCacheFile::buildPkgRecords()
{
if (m_packageRecords) {
@@ -57,5 +253,5 @@ void AptCacheFile::buildPkgRecords()
}
// Create the text record parser
- m_packageRecords = new pkgRecords(*this->GetPkgCache());
+ m_packageRecords = new pkgRecords(*this);
}
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
index bb265be..620b568 100644
--- a/backends/aptcc/AptCacheFile.h
+++ b/backends/aptcc/AptCacheFile.h
@@ -21,11 +21,12 @@
#define APTCACHEFILE_H
#include <apt-pkg/cachefile.h>
+#include <pk-backend.h>
class AptCacheFile : public pkgCacheFile
{
public:
- AptCacheFile();
+ AptCacheFile(PkBackend *backend);
~AptCacheFile();
/**
@@ -43,6 +44,17 @@ public:
*/
bool BuildCaches(bool withLock = false);
+ /** This routine generates the caches and then opens the dependency cache
+ * and verifies that the system is OK.
+ */
+ bool CheckDeps(bool AllowBroken = false);
+
+ /** Shows a list of all broken packages together with their
+ * dependencies. Similar to and based on the equivalent routine in
+ * apt-get.
+ */
+ void ShowBroken(bool Now);
+
inline pkgRecords* GetPkgRecords() { buildPkgRecords(); return m_packageRecords; }
/**
@@ -61,6 +73,7 @@ private:
void buildPkgRecords();
pkgRecords *m_packageRecords;
+ PkBackend *m_backend;
};
#endif // APTCACHEFILE_H
diff --git a/backends/aptcc/Makefile.am b/backends/aptcc/Makefile.am
index 25b36a5..b510b05 100644
--- a/backends/aptcc/Makefile.am
+++ b/backends/aptcc/Makefile.am
@@ -12,8 +12,8 @@ libpk_backend_aptcc_la_SOURCES = pkg_acqfile.cpp \
apt-messages.cpp \
apt-utils.cpp \
apt-sourceslist.cpp \
- apt-intf.cpp \
AptCacheFile.cpp \
+ apt-intf.cpp \
pk-backend-aptcc.cpp
libpk_backend_aptcc_la_LIBADD = -lcrypt -lapt-pkg -lapt-inst $(PK_PLUGIN_LIBS)
libpk_backend_aptcc_la_LDFLAGS = -module -avoid-version $(APTCC_LIBS) $(GSTREAMER_LIBS)
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 11d13af..aa2bc3e 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -54,6 +54,7 @@
#define RAMFS_MAGIC 0x858458f6
AptIntf::AptIntf(PkBackend *backend, bool &cancel) :
+ m_cache(backend),
m_backend(backend),
m_cancel(cancel),
m_terminalTimeout(120),
@@ -93,7 +94,10 @@ bool AptIntf::init()
setenv("ftp_proxy", ftp_proxy, 1);
// Tries to open the cache
- return !m_cache.Open();
+ bool ret;
+ ret = m_cache.Open();
+ cout << "AptIntf::init() " << ret << endl;
+ return !ret;
}
AptIntf::~AptIntf()
@@ -2258,7 +2262,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
bool withLock = !simulate; // Check to see if we are just simulating,
//since for that no lock is needed
- AptCacheFile cache;
+ AptCacheFile cache(m_backend);
int timeout = 10;
// TODO test this
while (cache.Open(withLock) == false) {
@@ -2332,7 +2336,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
if (cache->BrokenCount() != 0) {
// if the problem resolver could not fix all broken things
// show what is broken
- show_broken(m_backend, cache, false);
+ cache.ShowBroken(false);
return false;
}
}
@@ -2374,7 +2378,7 @@ bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
// Sanity check
if (cache->BrokenCount() != 0) {
// TODO
- show_broken(m_backend, cache, false);
+ cache.ShowBroken(false);
_error->Error("Internal error, InstallPackages was called with broken packages!");
return false;
}
diff --git a/backends/aptcc/apt-messages.cpp b/backends/aptcc/apt-messages.cpp
index c02bfcd..15e548e 100644
--- a/backends/aptcc/apt-messages.cpp
+++ b/backends/aptcc/apt-messages.cpp
@@ -81,134 +81,3 @@ bool show_warnings(PkBackend *backend, PkMessageEnum message)
pk_backend_message(backend, message, warnings.str().c_str());
}
}
-
-/** Shows broken dependencies for a single package */
-void show_broken(PkBackend *backend, pkgCacheFile &Cache, bool Now)
-{
- stringstream out;
-
- out << "The following packages have unmet dependencies:" << endl;
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
- if (Now == true) {
- if (Cache[I].NowBroken() == false) {
- continue;
- }
- } else {
- if (Cache[I].InstBroken() == false){
- continue;
- }
- }
-
- // Print out each package and the failed dependencies
- out << " " << I.Name() << ":";
- unsigned Indent = strlen(I.Name()) + 3;
- bool First = true;
- pkgCache::VerIterator Ver;
-
- if (Now == true) {
- Ver = I.CurrentVer();
- } else {
- Ver = Cache[I].InstVerIter(Cache);
- }
-
- if (Ver.end() == true) {
- out << endl;
- continue;
- }
-
- for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;) {
- // Compute a single dependency element (glob or)
- pkgCache::DepIterator Start;
- pkgCache::DepIterator End;
- D.GlobOr(Start,End); // advances D
-
- if (Cache->IsImportantDep(End) == false){
- continue;
- }
-
- if (Now == true) {
- if ((Cache[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow){
- continue;
- }
- } else {
- if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) {
- continue;
- }
- }
-
- bool FirstOr = true;
- while (1) {
- if (First == false){
- for (unsigned J = 0; J != Indent; J++) {
- out << ' ';
- }
- }
- First = false;
-
- if (FirstOr == false) {
- for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++) {
- out << ' ';
- }
- } else {
- out << ' ' << End.DepType() << ": ";
- }
- FirstOr = false;
-
- out << Start.TargetPkg().Name();
-
- // Show a quick summary of the version requirements
- if (Start.TargetVer() != 0) {
- out << " (" << Start.CompType() << " " << Start.TargetVer() << ")";
- }
-
- /* Show a summary of the target package if possible. In the case
- of virtual packages we show nothing */
- pkgCache::PkgIterator Targ = Start.TargetPkg();
- if (Targ->ProvidesList == 0) {
- out << ' ';
- pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
- if (Now == true) {
- Ver = Targ.CurrentVer();
- }
-
- if (Ver.end() == false)
- {
- char buffer[1024];
- if (Now == true) {
- sprintf(buffer, "but %s is installed", Ver.VerStr());
- } else {
- sprintf(buffer, "but %s is to be installed", Ver.VerStr());
- }
-
- out << buffer;
- } else {
- if (Cache[Targ].CandidateVerIter(Cache).end() == true) {
- if (Targ->ProvidesList == 0) {
- out << "but it is not installable";
- } else {
- out << "but it is a virtual package";
- }
- } else {
- if (Now) {
- out << "but it is not installed";
- } else {
- out << "but it is not going to be installed";
- }
- }
- }
- }
-
- if (Start != End) {
- out << " or";
- }
- out << endl;
-
- if (Start == End){
- break;
- }
- Start++;
- }
- }
- }
- pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, out.str().c_str());
-}
diff --git a/backends/aptcc/apt-messages.h b/backends/aptcc/apt-messages.h
index 8c49988..bdd04d0 100644
--- a/backends/aptcc/apt-messages.h
+++ b/backends/aptcc/apt-messages.h
@@ -42,10 +42,4 @@ bool show_errors(PkBackend *backend,
bool show_warnings(PkBackend *backend,
PkMessageEnum message = PK_MESSAGE_ENUM_UNKNOWN);
-/** Shows a list of all broken packages together with their
- * dependencies. Similar to and based on the equivalent routine in
- * apt-get.
- */
-void show_broken(PkBackend *backend, pkgCacheFile &cache, bool Now);
-
#endif // AAPT_BACKEND_MESSAGES_H
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 68cee84..4a4b8c3 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -376,16 +376,15 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
- AptCacheFile cache;
+ AptCacheFile cache(backend);
int timeout = 10;
// TODO test this
- while (cache.Open(!getUpdates) == false) {
- // failed to open cache, try checkDeps then..
- // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
+ while (cache.Open(!getUpdates) == false || cache.CheckDeps() == false) {
if (getUpdates == true || (timeout <= 0)) {
pk_backend_error_code(backend,
PK_ERROR_ENUM_NO_CACHE,
"Could not open package cache.");
+ delete m_apt;
return false;
} else {
pk_backend_set_status(backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
@@ -396,7 +395,7 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
pk_backend_set_status(backend, PK_STATUS_ENUM_RUNNING);
if (pkgDistUpgrade(*cache) == false) {
- show_broken(backend, cache, false);
+ cache.ShowBroken(false);
g_debug ("Internal error, DistUpgrade broke stuff");
delete m_apt;
return false;
@@ -687,7 +686,7 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
m_apt->refreshCache();
// Rebuild the cache.
- AptCacheFile cache;
+ AptCacheFile cache(backend);
if (cache.BuildCaches(true) == false) {
if (_error->PendingError() == true) {
show_errors(backend, PK_ERROR_ENUM_CANNOT_FETCH_SOURCES, true);
commit 2a5d5124f987281de8ad7bede501175e4ec0b848
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Mon Apr 16 02:26:21 2012 -0300
aptcc: A few more fixes aptcc does not crash anymore but it sort of start failing after a while
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index 2aa66f6..94bff86 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -26,19 +26,28 @@ AptCacheFile::AptCacheFile() :
AptCacheFile::~AptCacheFile()
{
+ delete m_packageRecords;
+ pkgCacheFile::Close();
+}
+
+bool AptCacheFile::Open(bool withLock)
+{
+ return pkgCacheFile::Open(NULL, withLock);
+}
+
+void AptCacheFile::Close()
+{
if (m_packageRecords) {
delete m_packageRecords;
}
-}
+ m_packageRecords = 0;
-bool AptCacheFile::open(bool withLock)
-{
- return Open(NULL, withLock);
+ pkgCacheFile::Close();
}
-bool AptCacheFile::buildCaches(bool withLock)
+bool AptCacheFile::BuildCaches(bool withLock)
{
- return BuildCaches(NULL, withLock);
+ return pkgCacheFile::BuildCaches(NULL, withLock);
}
void AptCacheFile::buildPkgRecords()
@@ -50,5 +59,3 @@ void AptCacheFile::buildPkgRecords()
// Create the text record parser
m_packageRecords = new pkgRecords(*this->GetPkgCache());
}
-
-
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
index dc88464..bb265be 100644
--- a/backends/aptcc/AptCacheFile.h
+++ b/backends/aptcc/AptCacheFile.h
@@ -31,12 +31,17 @@ public:
/**
* Inits the package cache returning false if it can't open
*/
- bool open(bool withLock = false);
+ bool Open(bool withLock = false);
+
+ /**
+ * Closes the package cache
+ */
+ void Close();
/**
* Build caches
*/
- bool buildCaches(bool withLock = false);
+ bool BuildCaches(bool withLock = false);
inline pkgRecords* GetPkgRecords() { buildPkgRecords(); return m_packageRecords; }
@@ -44,13 +49,13 @@ public:
* GetPolicy will build the policy object if needed and return it
* @note This override if because the cache should be built before the policy
*/
- inline pkgPolicy* GetPolicy() { BuildCaches(NULL, false); BuildPolicy(); return Policy; }
+ inline pkgPolicy* GetPolicy() { BuildCaches(); BuildPolicy(); return Policy; }
/**
* GetDepCache will build the dependency cache if needed and return it
* @note This override if because the policy should be built before the dependency cache
*/
- inline pkgDepCache* GetDepCache() { BuildCaches(NULL, false); BuildPolicy(); BuildDepCache(); return DCache; }
+ inline pkgDepCache* GetDepCache() { BuildCaches(); BuildPolicy(); BuildDepCache(); return DCache; }
private:
void buildPkgRecords();
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 2b27262..11d13af 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -93,8 +93,7 @@ bool AptIntf::init()
setenv("ftp_proxy", ftp_proxy, 1);
// Tries to open the cache
-// return !m_cache.open();
- return false; // WTF why it was expecting this?
+ return !m_cache.Open();
}
AptIntf::~AptIntf()
@@ -115,12 +114,20 @@ void AptIntf::cancel()
pkgCache::PkgIterator AptIntf::findPackage(const std::string &name)
{
- return m_cache.GetDepCache()->FindPkg(name);
+ // This is needed otherwise we get random crashes
+// if (!m_cache.open()) {
+// return pkgCache::PkgIterator();
+// }
+ return m_cache->FindPkg(name);
}
pkgCache::PkgIterator AptIntf::findPackageArch(const std::string &name, const std::string &arch)
{
- return m_cache.GetDepCache()->FindPkg(name, arch);
+ // This is needed otherwise we get random crashes
+// if (!m_cache.open()) {
+// return pkgCache::PkgIterator();
+// }
+ return m_cache->FindPkg(name, arch);
}
pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
@@ -1963,8 +1970,9 @@ PkgList AptIntf::resolvePackageIds(gchar **package_ids, PkBitfield filters)
pk_backend_set_status (m_backend, PK_STATUS_ENUM_QUERY);
// Don't fail if package list is empty
- if (package_ids == NULL)
+ if (package_ids == NULL) {
return ret;
+ }
for (uint i = 0; i < g_strv_length(package_ids); ++i) {
if (m_cancel) {
@@ -2253,7 +2261,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
AptCacheFile cache;
int timeout = 10;
// TODO test this
- while (cache.open(withLock) == false) {
+ while (cache.Open(withLock) == false) {
// failed to open cache, try checkDeps then..
// || cache.CheckDeps(CmdL.FileSize() != 1) == false
if (withLock == false || (timeout <= 0)) {
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 99a31ac..68cee84 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -379,7 +379,7 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
AptCacheFile cache;
int timeout = 10;
// TODO test this
- while (cache.open(!getUpdates) == false) {
+ while (cache.Open(!getUpdates) == false) {
// failed to open cache, try checkDeps then..
// || Cache.CheckDeps(CmdL.FileSize() != 1) == false
if (getUpdates == true || (timeout <= 0)) {
@@ -688,7 +688,7 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
// Rebuild the cache.
AptCacheFile cache;
- if (cache.buildCaches(true) == false) {
+ if (cache.BuildCaches(true) == false) {
if (_error->PendingError() == true) {
show_errors(backend, PK_ERROR_ENUM_CANNOT_FETCH_SOURCES, true);
}
commit 6e57f354aeca30538351acdc2fca7ddd76c0b8ad
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Mon Apr 16 01:43:36 2012 -0300
aptcc: Improve classes readability, and fix a crash caused by an invalid package
diff --git a/backends/aptcc/acqpkitstatus.cpp b/backends/aptcc/acqpkitstatus.cpp
index fb6a47c..3e30687 100644
--- a/backends/aptcc/acqpkitstatus.cpp
+++ b/backends/aptcc/acqpkitstatus.cpp
@@ -20,6 +20,8 @@
#include "acqpkitstatus.h"
+#include "pkg_acqfile.h"
+
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire-worker.h>
#include <apt-pkg/strutl.h>
@@ -248,9 +250,7 @@ void AcqPackageKitStatus::emit_package(const string &name, bool finished)
// try to see if any package matches
if (name.compare(it->ParentPkg().Name()) == 0) {
- m_apt->emitPackage(*it,
- PK_INFO_ENUM_UNKNOWN,
- finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
+ m_apt->emitPackage(*it, finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
last_package_name = name;
// Find the downloading item
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index d6a030b..2b27262 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -178,11 +178,7 @@ pkgCache::VerIterator AptIntf::findVer(const pkgCache::PkgIterator &pkg)
pkgCache::VerIterator AptIntf::findCandidateVer(const pkgCache::PkgIterator &pkg)
{
// get the candidate version iterator
- pkgCache::VerIterator ret;
- if (m_cache.open()) {
- ret = m_cache[pkg].CandidateVerIter(m_cache);
- }
- return ret;
+ return (*m_cache.GetDepCache())[pkg].CandidateVerIter(m_cache);
}
bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
@@ -309,14 +305,8 @@ PkgList AptIntf::filterPackages(PkgList &packages, PkBitfield filters)
// used to emit packages it collects all the needed info
void AptIntf::emitPackage(const pkgCache::VerIterator &ver,
- PkBitfield filters,
PkInfoEnum state)
{
- // Check if the filters match the package
- if (!matchPackage(ver, filters)) {
- return;
- }
-
const pkgCache::PkgIterator &pkg = ver.ParentPkg();
// check the state enum to see if it was not set.
@@ -343,9 +333,7 @@ void AptIntf::emitPackage(const pkgCache::VerIterator &ver,
g_free(package_id);
}
-void AptIntf::emit_packages(PkgList &output,
- PkBitfield filters,
- PkInfoEnum state)
+void AptIntf::emitPackages(PkgList &output, PkBitfield filters, PkInfoEnum state)
{
// Sort so we can remove the duplicated entries
sort(output.begin(), output.end(), compare());
@@ -361,7 +349,9 @@ void AptIntf::emit_packages(PkgList &output,
break;
}
- emitPackage(*it, filters, state);
+ if (matchPackage(*it, filters)) {
+ emitPackage(*it, state);
+ }
}
}
@@ -381,6 +371,10 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
break;
}
+ if (!matchPackage(*i, filters)) {
+ continue;
+ }
+
// the default update info
state = PK_INFO_ENUM_NORMAL;
@@ -404,7 +398,7 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
state = PK_INFO_ENUM_ENHANCEMENT;
}
- emitPackage(*i, filters, state);
+ emitPackage(*i, state);
}
}
@@ -456,7 +450,7 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
bool ret = false;
// Quick-check for library names
for (uint i = 0; i < g_strv_length(values); i++) {
- if (g_str_has_prefix (values[i], "lib")) {
+ if (g_str_has_prefix(values[i], "lib")) {
ret = true;
break;
}
@@ -502,9 +496,9 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
// TODO: Ignore virtual packages
pkgCache::VerIterator ver = findVer (pkg);
- if (ver.end() == true) {
+ if (ver.end()) {
ver = findCandidateVer(pkg);
- if (ver.end() == true) {
+ if (ver.end()) {
continue;
}
}
@@ -607,12 +601,13 @@ bool AptIntf::getArchive(pkgAcquire *Owner,
}
// used to emit packages it collects all the needed info
-void AptIntf::emitDetails(const pkgCache::VerIterator &ver)
+void AptIntf::emitPackageDetail(const pkgCache::VerIterator &ver)
{
- const pkgCache::PkgIterator &pkg = ver.ParentPkg();
if (ver.end() == true) {
return;
}
+
+ const pkgCache::PkgIterator &pkg = ver.ParentPkg();
std::string section = ver.Section() == NULL ? "" : ver.Section();
size_t found;
@@ -655,19 +650,26 @@ void AptIntf::emitDetails(PkgList &pkgs)
pkgs.erase(unique(pkgs.begin(), pkgs.end(), result_equality()),
pkgs.end());
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
+ for (PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
if (m_cancel) {
break;
}
- emitDetails(*i);
+ emitPackageDetail(*i);
}
}
// used to emit packages it collects all the needed info
-void AptIntf::emitUpdateDetails(const pkgCache::VerIterator &version)
+void AptIntf::emitUpdateDetail(const pkgCache::VerIterator &candver)
{
- const pkgCache::PkgIterator &pkg = version.ParentPkg();
+ // Verify if our update version is valid
+ if (candver.end()) {
+ // No candidate version was provided
+ return;
+ }
+
+ const pkgCache::PkgIterator &pkg = candver.ParentPkg();
+
// Get the version of the current package
const pkgCache::VerIterator &currver = findVer(pkg);
const pkgCache::VerFileIterator &currvf = currver.FileList();
@@ -678,14 +680,6 @@ void AptIntf::emitUpdateDetails(const pkgCache::VerIterator &version)
currver.Arch(),
currvf.File().Archive() == NULL ? "" : currvf.File().Archive());
- // Get the update version
- pkgCache::VerIterator candver;
- if (version.end() == false) {
- candver = version;
- } else {
- candver = findCandidateVer(pkg);
- }
-
pkgCache::VerFileIterator vf = candver.FileList();
string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
pkgRecords::Parser &rec = m_cache.GetPkgRecords()->Lookup(candver.FileList());
@@ -907,12 +901,12 @@ void AptIntf::emitUpdateDetails(const pkgCache::VerIterator &version)
void AptIntf::emitUpdateDetails(PkgList &pkgs)
{
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
+ for (PkgList::iterator it = pkgs.begin(); it != pkgs.end(); ++it) {
if (m_cancel) {
break;
}
- emitUpdateDetails(*i);
+ emitUpdateDetail(*it);
}
}
@@ -934,13 +928,10 @@ void AptIntf::getDepends(PkgList &output,
} else if (dep->Type == pkgCache::Dep::Depends) {
if (recursive) {
if (!contains(output, dep.TargetPkg())) {
- // TODO is this still working
- // output.push_back(PkgPair(dep.TargetPkg(), ver));
output.push_back(ver);
getDepends(output, ver, recursive);
}
} else {
- // output.push_back(PkgPair(dep.TargetPkg(), ver));
output.push_back(ver);
}
}
@@ -968,16 +959,13 @@ void AptIntf::getRequires(PkgList &output,
PkgList deps;
getDepends(deps, parentVer, false);
for (PkgList::iterator it = deps.begin(); it != deps.end(); ++it) {
- // if (i->ParentPkg() == ver) { TODO make sure this works!!!!
if (*it == ver) {
if (recursive) {
if (!contains(output, parentPkg)) {
- // output.push_back(PkgPair(parentPkg, ver));
output.push_back(parentVer);
getRequires(output, parentVer, recursive);
}
} else {
- // output.push_back(PkgPair(parentPkg, ver));
output.push_back(parentVer);
}
break;
@@ -1010,9 +998,26 @@ PkgList AptIntf::getPackages()
return output;
}
-PkgList AptIntf::getPackagesFromGroup(vector<PkGroupEnum> &groups)
+PkgList AptIntf::getPackagesFromGroup(gchar **values)
{
PkgList output;
+ vector<PkGroupEnum> groups;
+
+ int len = g_strv_length(values);
+ for (uint i = 0; i < len; i++) {
+ if (values[i] == NULL) {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_GROUP_NOT_FOUND,
+ values[i]);
+ pk_backend_finished(m_backend);
+ return output;
+ } else {
+ groups.push_back(pk_group_enum_from_string(values[i]));
+ }
+ }
+
+ pk_backend_set_allow_cancel(m_backend, true);
+
for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
if (m_cancel) {
break;
@@ -1095,7 +1100,7 @@ PkgList AptIntf::searchPackageDetails(Matcher *matcher)
const pkgCache::VerIterator &ver = findVer(pkg);
if (ver.end() == false) {
if (matcher->matches(pkg.Name()) ||
- matcher->matches(getPackageLongDescription(ver))) {
+ matcher->matches(get_long_description(ver, m_cache.GetPkgRecords()))) {
// The package matched
output.push_back(ver);
}
@@ -1119,15 +1124,11 @@ PkgList AptIntf::searchPackageDetails(Matcher *matcher)
return output;
}
-string AptIntf::getPackageLongDescription(const pkgCache::VerIterator &ver)
-{
- return get_long_description(ver, m_cache.GetPkgRecords());
-}
-
// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
-vector<string> search_files (PkBackend *backend, gchar **values, bool &m_cancel)
+PkgList AptIntf::searchPackageFiles(gchar **values)
{
- vector<string> packageList;
+ PkgList output;
+ vector<string> packages;
regex_t re;
gchar *search;
gchar *values_str;
@@ -1139,7 +1140,7 @@ vector<string> search_files (PkBackend *backend, gchar **values, bool &m_cancel)
if(regcomp(&re, search, REG_NOSUB) != 0) {
g_debug("Regex compilation error");
g_free(search);
- return vector<string>();
+ return output;
}
g_free(search);
@@ -1148,7 +1149,7 @@ vector<string> search_files (PkBackend *backend, gchar **values, bool &m_cancel)
if (!(dp = opendir("/var/lib/dpkg/info/"))) {
g_debug ("Error opening /var/lib/dpkg/info/\n");
regfree(&re);
- return vector<string>();
+ return output;
}
string line;
@@ -1166,7 +1167,7 @@ vector<string> search_files (PkBackend *backend, gchar **values, bool &m_cancel)
getline(in, line);
if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
string file(dirp->d_name);
- packageList.push_back(file.erase(file.size() - 5, file.size()));
+ packages.push_back(file.erase(file.size() - 5, file.size()));
break;
}
}
@@ -1174,13 +1175,30 @@ vector<string> search_files (PkBackend *backend, gchar **values, bool &m_cancel)
}
closedir(dp);
regfree(&re);
- return packageList;
+
+ // Resolve the package names now
+ for (vector<string>::iterator it = packages.begin();
+ it != packages.end(); ++it) {
+ if (m_cancel) {
+ break;
+ }
+ const pkgCache::PkgIterator &pkg = findPackage(*it);
+ if (pkg.end() == true) {
+ continue;
+ }
+ const pkgCache::VerIterator &ver = findVer(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ output.push_back(ver);
+ }
+
+ return output;
}
// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
-vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &m_cancel)
+void AptIntf::providesMimeType(PkgList &output, gchar **values)
{
- vector<string> packageList;
regex_t re;
gchar *value;
gchar *values_str;
@@ -1193,7 +1211,7 @@ vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error,
if(regcomp(&re, value, REG_NOSUB) != 0) {
g_debug("Regex compilation error");
g_free(value);
- return vector<string>();
+ return;
}
g_free(value);
@@ -1202,10 +1220,10 @@ vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error,
if (!(dp = opendir("/usr/share/app-install/desktop/"))) {
g_debug ("Error opening /usr/share/app-install/desktop/\n");
regfree(&re);
- error = true;
- return vector<string>();
+ return;
}
+ vector<string> packages;
string line;
while ((dirp = readdir(dp)) != NULL) {
if (m_cancel) {
@@ -1223,7 +1241,7 @@ vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error,
if (getName) {
if (starts_with(line, "X-AppInstall-Package=")) {
// Remove the X-AppInstall-Package=
- packageList.push_back(line.substr(21));
+ packages.push_back(line.substr(21));
break;
}
} else {
@@ -1238,17 +1256,33 @@ vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error,
closedir(dp);
regfree(&re);
- return packageList;
+
+ // resolve the package names
+ for (vector<string>::iterator it = packages.begin();
+ it != packages.end(); ++it) {
+ if (m_cancel) {
+ break;
+ }
+ const pkgCache::PkgIterator &pkg = findPackage(*it);
+ if (pkg.end() == true) {
+ continue;
+ }
+ const pkgCache::VerIterator &ver = findVer(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ output.push_back(ver);
+ }
}
// used to emit files it reads the info directly from the files
-void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
+void AptIntf::emitPackageFiles(const gchar *pi)
{
static string filelist;
string line;
gchar **parts;
- parts = pk_package_id_split (pi);
+ parts = pk_package_id_split(pi);
filelist.erase(filelist.begin(), filelist.end());
string fName;
@@ -1288,7 +1322,7 @@ void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
}
if (!filelist.empty()) {
- pk_backend_files (backend, pi, filelist.c_str());
+ pk_backend_files(m_backend, pi, filelist.c_str());
}
}
}
@@ -1346,7 +1380,7 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher, bool simulating)
if (untrusted.empty()) {
return true;
} else if (simulating) {
- emit_packages(untrusted, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UNTRUSTED);
+ emitPackages(untrusted, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UNTRUSTED);
}
if (pk_backend_get_bool(m_backend, "only_trusted") == false ||
@@ -1512,28 +1546,39 @@ void AptIntf::emitChangedPackages(AptCacheFile &cache)
PkgList updating;
PkgList downgrading;
- string VersionsList;
for (pkgCache::PkgIterator pkg = cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (cache[pkg].NewInstall() == true) {
- // installing
- installing.push_back(findCandidateVer(pkg));
+ // installing;
+ const pkgCache::VerIterator &ver = findCandidateVer(pkg);
+ if (!ver.end()) {
+ installing.push_back(ver);
+ }
} else if (cache[pkg].Delete() == true) {
// removing
- removing.push_back(findVer(pkg));
+ const pkgCache::VerIterator &ver = findVer(pkg);
+ if (!ver.end()) {
+ removing.push_back(ver);
+ }
} else if (cache[pkg].Upgrade() == true) {
// updating
- updating.push_back(findCandidateVer(pkg));
+ const pkgCache::VerIterator &ver = findCandidateVer(pkg);
+ if (!ver.end()) {
+ updating.push_back(ver);
+ }
} else if (cache[pkg].Downgrade() == true) {
// downgrading
- downgrading.push_back(findCandidateVer(pkg));
+ const pkgCache::VerIterator &ver = findVer(pkg);
+ if (!ver.end()) {
+ downgrading.push_back(ver);
+ }
}
}
// emit packages that have changes
- emit_packages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
- emit_packages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
- emit_packages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
- emit_packages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
+ emitPackages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
+ emitPackages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
+ emitPackages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+ emitPackages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
}
void AptIntf::populateInternalPackages(AptCacheFile &cache)
@@ -1557,9 +1602,9 @@ void AptIntf::populateInternalPackages(AptCacheFile &cache)
void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
{
- for (PkgList::iterator i = m_pkgs.begin(); i != m_pkgs.end(); ++i) {
- if (i->ParentPkg().Name() == name) {
- emitPackage(*i, PK_FILTER_ENUM_NONE, state);
+ for (PkgList::iterator it = m_pkgs.begin(); it != m_pkgs.end(); ++it) {
+ if (it->ParentPkg().Name() == name) {
+ emitPackage(*it, state);
return;
}
}
@@ -1574,13 +1619,13 @@ void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
const pkgCache::VerIterator &ver = findVer(pkg);
// check to see if the provided package isn't virtual too
if (ver.end() == false) {
- emitPackage(ver, PK_FILTER_ENUM_NONE, state);
+ emitPackage(ver, state);
}
const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
// check to see if we found the package
if (candidateVer.end() == false) {
- emitPackage(candidateVer, PK_FILTER_ENUM_NONE, state);
+ emitPackage(candidateVer, state);
}
}
@@ -1718,6 +1763,7 @@ void AptIntf::updateInterface(int fd, int writeFd)
// TODO we need a DPKG patch to use debconf
g_debug("Failed to write");
}
+ g_free(confmsg);
}
} else if (strstr(status, "pmstatus") != NULL) {
// INSTALL & UPDATE
@@ -1909,7 +1955,7 @@ bool AptIntf::doAutomaticRemove(AptCacheFile &cache)
return true;
}
-PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
+PkgList AptIntf::resolvePackageIds(gchar **package_ids, PkBitfield filters)
{
gchar *pi;
PkgList ret;
@@ -2079,7 +2125,7 @@ bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &r
PK_FILTER_ENUM_NOT_INSTALLED,
PK_FILTER_ENUM_ARCH,
-1);
- install = resolvePI(installPkgs, intallFilters);
+ install = resolvePackageIds(installPkgs, intallFilters);
// Resolve the packages to remove
PkBitfield removeFilters;
@@ -2087,8 +2133,7 @@ bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &r
PK_FILTER_ENUM_INSTALLED,
PK_FILTER_ENUM_ARCH,
-1);
- remove = resolvePI(removePkgs, removeFilters);
- m_localDebFile = file;
+ remove = resolvePackageIds(removePkgs, removeFilters);
g_strfreev(lines);
g_strfreev(installPkgs);
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index add4f7d..4da7ba9 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -37,23 +37,12 @@
using namespace std;
-/**
- * returns a list of packages names
- */
-vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel);
-
-/**
- * returns a list of packages names
- */
-vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel);
-
typedef vector<pkgCache::VerIterator> PkgList;
class pkgProblemResolver;
class Matcher;
class AptIntf
{
-
public:
AptIntf(PkBackend *backend, bool &cancel);
~AptIntf();
@@ -62,20 +51,20 @@ public:
void cancel();
/**
- * Tries to find a package with the given packageId
- * @returns pkgCache::VerIterator that if .end() is true the package could not be found
+ * Tries to find a package with the given package name
+ * @returns pkgCache::VerIterator, if .end() is true the package could not be found
*/
pkgCache::PkgIterator findPackage(const std::string &name);
/**
- * Tries to find a package with the given packageId
- * @returns pkgCache::VerIterator that if .end() is true the package could not be found
+ * Tries to find a package with the given package name and arch
+ * @returns pkgCache::VerIterator, if .end() is true the package could not be found
*/
pkgCache::PkgIterator findPackageArch(const std::string &name, const std::string &arch = std::string());
/**
* Tries to find a package with the given packageId
- * @returns pkgCache::VerIterator that if .end() is true the package could not be found
+ * @returns pkgCache::VerIterator, if .end() is true the package could not be found
*/
pkgCache::VerIterator findPackageId(const gchar *packageId);
@@ -83,22 +72,38 @@ public:
* Tries to find the current version of a package
* if it can't find it will return the candidate
* TODO check if we really need the candidate version
- * @returns pkgCache::VerIterator that if .end() is true the version could not be found
+ * @returns pkgCache::VerIterator, if .end() is true the version could not be found
*/
pkgCache::VerIterator findVer(const pkgCache::PkgIterator &pkg);
/**
* Tries to find the candidate version of a package
- * @returns pkgCache::VerIterator that if .end() is true the version could not be found
+ * @returns pkgCache::VerIterator, if .end() is true the version could not be found
*/
pkgCache::VerIterator findCandidateVer(const pkgCache::PkgIterator &pkg);
- PkgList resolvePI(gchar **package_ids, PkBitfield filters = PK_FILTER_ENUM_NONE);
+ /**
+ * Tries to find a list of packages mathing the package ids
+ * @returns a list of pkgCache::VerIterator, if the list is empty no package was found
+ */
+ PkgList resolvePackageIds(gchar **package_ids, PkBitfield filters = PK_FILTER_ENUM_NONE);
+ /**
+ * Refreshes the sources of packages
+ */
void refreshCache();
+ /**
+ * Tries to resolve a pkg file installation of the given \sa file
+ * @param install is where the packages to be installed will be stored
+ * @param remove is where the packages to be removed will be stored
+ * @returns true if the package can be installed
+ */
bool markFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
+ /**
+ * Marks the given packages as auto installed
+ */
bool markAutoInstalled(AptCacheFile &cache, PkgList &pkgs, bool flag);
/**
@@ -112,65 +117,101 @@ public:
bool runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto = false);
/**
- * Get depends
+ * Get package depends
*/
void getDepends(PkgList &output,
const pkgCache::VerIterator &ver,
bool recursive);
/**
- * Get requires
+ * Get package requires
*/
void getRequires(PkgList &output,
const pkgCache::VerIterator &ver,
bool recursive);
+ /**
+ * Returns a list of all packages in the cache
+ */
PkgList getPackages();
- PkgList getPackagesFromGroup(vector<PkGroupEnum> &groups);
+
+ /**
+ * Returns a list of all packages in the given groups
+ */
+ PkgList getPackagesFromGroup(gchar **values);
+
+ /**
+ * Returns a list of all packages that matched their names with matcher
+ */
PkgList searchPackageName(Matcher *matcher);
+
+ /**
+ * Returns a list of all packages that matched their description with matcher
+ */
PkgList searchPackageDetails(Matcher *matcher);
/**
- * Get the long description of a package
+ * Returns a list of all packages that matched contains the given files
*/
- string getPackageLongDescription(const pkgCache::VerIterator &ver);
+ PkgList searchPackageFiles(gchar **values);
/**
- * Emits a package if it match the filters
+ * Emits a package with the given state
*/
void emitPackage(const pkgCache::VerIterator &ver,
- PkBitfield filters = PK_FILTER_ENUM_NONE,
PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+ /**
+ * Emits a list of packages that matches the given filters
+ */
+ void emitPackages(PkgList &output,
+ PkBitfield filters = PK_FILTER_ENUM_NONE,
+ PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+
+ /**
+ * Emits a list of updates that matches the given filters
+ */
+ void emitUpdates(PkgList &output, PkBitfield filters = PK_FILTER_ENUM_NONE);
+
+ /**
+ * Checks if a given package matches the filters
+ * @returns true if it passed the filters
+ */
bool matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters);
- PkgList filterPackages(PkgList &packages, PkBitfield filters);
- void emit_packages(PkgList &output,
- PkBitfield filters = PK_FILTER_ENUM_NONE,
- PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+ /**
+ * Returns the list of packages with the ones that passed the given filters
+ */
+ PkgList filterPackages(PkgList &packages, PkBitfield filters);
- void emitUpdates(PkgList &output, PkBitfield filters = PK_FILTER_ENUM_NONE);
+ /**
+ * Emits details of the given package
+ */
+ void emitPackageDetail(const pkgCache::VerIterator &ver);
/**
- * Emits details
- */
- void emitDetails(const pkgCache::VerIterator &ver);
+ * Emits details of the given package list
+ */
void emitDetails(PkgList &pkgs);
/**
- * Emits update detail
- */
- void emitUpdateDetails(const pkgCache::VerIterator &version);
+ * Emits update detail
+ */
+ void emitUpdateDetail(const pkgCache::VerIterator &candver);
+
+ /**
+ * Emits update datails for the given list
+ */
void emitUpdateDetails(PkgList &pkgs);
/**
- * Emits files of packages
- */
- void emitFiles(PkBackend *backend, const gchar *pi);
+ * Emits the files of a package
+ */
+ void emitPackageFiles(const gchar *pi);
/**
- * Download and install packages
- */
+ * Download and install packages
+ */
bool installPackages(AptCacheFile &cache, bool simulating);
/**
@@ -192,6 +233,11 @@ public:
*/
void providesLibrary(PkgList &output, gchar **values);
+ /**
+ * returns a list of packages names
+ */
+ void providesMimeType(PkgList &output, gchar **values);
+
/** Like pkgAcqArchive, but uses generic File objects to download to
* the cwd (and copies from file:/ URLs).
*/
@@ -222,13 +268,11 @@ private:
bool m_isMultiArch;
PkgList m_pkgs;
- string m_localDebFile;
void populateInternalPackages(AptCacheFile &cache);
void emitTransactionPackage(string name, PkInfoEnum state);
time_t m_lastTermAction;
string m_lastPackage;
uint m_lastSubProgress;
- PkInfoEnum m_state;
bool m_startCounting;
// when the internal terminal timesout after no activity
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 154e3d0..99a31ac 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -211,7 +211,7 @@ static gboolean backend_get_depends_or_requires_thread(PkBackend *backend)
}
// It's faster to emmit the packages here than in the matching part
- m_apt->emit_packages(output, filters);
+ m_apt->emitPackages(output, filters);
delete m_apt;
return true;
@@ -285,7 +285,7 @@ static gboolean backend_get_files_thread(PkBackend *backend)
return false;
}
- m_apt->emitFiles(backend, pi);
+ m_apt->emitPackageFiles(pi);
}
delete m_apt;
@@ -306,11 +306,11 @@ static gboolean backend_get_details_thread(PkBackend *backend)
PkRoleEnum role = pk_backend_get_role (backend);
bool updateDetail = role == PK_ROLE_ENUM_GET_UPDATE_DETAIL ? true : false;
- package_ids = pk_backend_get_strv (backend, "package_ids");
+ package_ids = pk_backend_get_strv(backend, "package_ids");
if (package_ids == NULL) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_ID_INVALID,
- "Invalid package id");
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_PACKAGE_ID_INVALID,
+ "Invalid package id");
pk_backend_finished (backend);
return false;
}
@@ -329,8 +329,8 @@ static gboolean backend_get_details_thread(PkBackend *backend)
pkgInitSystem(*_config, _system);
}
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- PkgList pkgs = m_apt->resolvePI(package_ids);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
+ PkgList pkgs = m_apt->resolvePackageIds(package_ids);
if (updateDetail) {
m_apt->emitUpdateDetails(pkgs);
@@ -404,24 +404,29 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
bool res = true;
if (getUpdates) {
- PkgList update;
+ PkgList updates;
PkgList kept;
-
for (pkgCache::PkgIterator pkg = cache.GetPkgCache()->PkgBegin();
!pkg.end();
++pkg) {
- if ((*cache)[pkg].Upgrade() == true &&
- (*cache)[pkg].NewInstall() == false) {
- update.push_back(m_apt->findCandidateVer(pkg));
- } else if ((*cache)[pkg].Upgradable() == true &&
+ if (cache[pkg].Upgrade() == true &&
+ cache[pkg].NewInstall() == false) {
+ const pkgCache::VerIterator &ver = m_apt->findCandidateVer(pkg);
+ if (!ver.end()) {
+ updates.push_back(ver);
+ }
+ } else if (cache[pkg].Upgradable() == true &&
pkg->CurrentVer != 0 &&
- (*cache)[pkg].Delete() == false) {
- kept.push_back(m_apt->findCandidateVer(pkg));
+ cache[pkg].Delete() == false) {
+ const pkgCache::VerIterator &ver = m_apt->findCandidateVer(pkg);
+ if (!ver.end()) {
+ kept.push_back(ver);
+ }
}
}
- m_apt->emitUpdates(update, filters);
- m_apt->emit_packages(kept, filters, PK_INFO_ENUM_BLOCKED);
+ m_apt->emitUpdates(updates, filters);
+ m_apt->emitPackages(kept, filters, PK_INFO_ENUM_BLOCKED);
} else {
// TODO there should be a simulate upgrade system,
// tho afaik Apper and GPK don't use this
@@ -479,64 +484,46 @@ static gboolean backend_what_provides_thread(PkBackend *backend)
}
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- vector<string> packages;
- PkgList output;
+ PkgList output;
if (provides == PK_PROVIDES_ENUM_SHARED_LIB) {
m_apt->providesLibrary(output, values);
} else if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
- packages = searchMimeType(backend, values, error, _cancel);
+ m_apt->providesMimeType(output, values);
} else if (provides == PK_PROVIDES_ENUM_CODEC) {
m_apt->providesCodec(output, values);
} else {
// PK_PROVIDES_ENUM_ANY, just search for everything a package can provide
m_apt->providesLibrary(output, values);
m_apt->providesCodec(output, values);
- packages = searchMimeType(backend, values, error, _cancel);
+ m_apt->providesMimeType(output, values);
}
- for (vector<string>::iterator it = packages.begin();
- it != packages.end(); ++it) {
- if (_cancel) {
- break;
- }
- const pkgCache::PkgIterator &pkg = m_apt->findPackage(*it);
- if (pkg.end() == true) {
- continue;
- }
- const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
- if (ver.end() == true) {
- continue;
- }
- output.push_back(ver);
- }
-
- if (error && provides == PK_PROVIDES_ENUM_MIMETYPE) {
+ if (output.empty() && provides == PK_PROVIDES_ENUM_MIMETYPE) {
// check if app-install-data is installed
pkgCache::PkgIterator pkg;
pkg = m_apt->findPackage("app-install-data");
if (pkg->CurrentState != pkgCache::State::Installed) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_INTERNAL_ERROR,
- "You need the app-install-data "
- "package to be able to look for "
- "applications that can handle "
- "this kind of file");
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_INTERNAL_ERROR,
+ "You need the app-install-data "
+ "package to be able to look for "
+ "applications that can handle "
+ "this kind of file");
}
} else {
- // It's faster to emmit the packages here rather than in the matching part
- m_apt->emit_packages(output, filters);
+ // It's faster to emit the packages here rather than in the matching part
+ m_apt->emitPackages(output, filters);
}
delete m_apt;
-
} else {
- provides_text = pk_provides_enum_to_string (provides);
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_NOT_SUPPORTED,
- "Provides %s not supported",
- provides_text);
- pk_backend_finished (backend);
+ provides_text = pk_provides_enum_to_string(provides);
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_NOT_SUPPORTED,
+ "Provides %s not supported",
+ provides_text);
+ pk_backend_finished(backend);
}
return true;
@@ -745,10 +732,10 @@ static gboolean pk_backend_resolve_thread(PkBackend *backend)
return false;
}
- PkgList pkgs = m_apt->resolvePI(package_ids);
+ PkgList pkgs = m_apt->resolvePackageIds(package_ids);
// It's faster to emmit the packages here rather than in the matching part
- m_apt->emit_packages(pkgs, filters);
+ m_apt->emitPackages(pkgs, filters);
delete m_apt;
return true;
@@ -783,29 +770,15 @@ static gboolean pk_backend_search_files_thread(PkBackend *backend)
}
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
- vector<string> packages = search_files(backend, values, _cancel);
PkgList output;
- for(vector<string>::iterator it = packages.begin();
- it != packages.end(); ++it) {
- if (_cancel) {
- break;
- }
- const pkgCache::PkgIterator &pkg = m_apt->findPackage(*it);
- if (pkg.end() == true) {
- continue;
- }
- const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
- if (ver.end() == true) {
- continue;
- }
- output.push_back(ver);
- }
- // It's faster to emmit the packages here rather than in the matching part
- m_apt->emit_packages(output, filters);
+ output = m_apt->searchPackageFiles(values);
+
+ // It's faster to emit the packages here rather than in the matching part
+ m_apt->emitPackages(output, filters);
delete m_apt;
} else {
- pk_backend_finished (backend);
+ pk_backend_finished(backend);
}
return true;
@@ -823,24 +796,9 @@ static gboolean backend_search_groups_thread (PkBackend *backend)
{
gchar **values;
PkBitfield filters;
- vector<PkGroupEnum> groups;
values = pk_backend_get_strv(backend, "search");
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
- pk_backend_set_allow_cancel(backend, true);
-
- int len = g_strv_length(values);
- for (uint i = 0; i < len; i++) {
- if (values[i] == NULL) {
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_GROUP_NOT_FOUND,
- values[i]);
- pk_backend_finished(backend);
- return false;
- } else {
- groups.push_back(pk_group_enum_from_string(values[i]));
- }
- }
+ filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
@@ -850,14 +808,14 @@ static gboolean backend_search_groups_thread (PkBackend *backend)
return false;
}
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
// It's faster to emmit the packages here rather than in the matching part
PkgList output;
- output = m_apt->getPackagesFromGroup(groups);
- m_apt->emit_packages(output, filters);
+ output = m_apt->getPackagesFromGroup(values);
+ m_apt->emitPackages(output, filters);
- pk_backend_set_percentage (backend, 100);
+ pk_backend_set_percentage(backend, 100);
delete m_apt;
return true;
}
@@ -916,7 +874,7 @@ static gboolean backend_search_package_thread(PkBackend *backend)
}
// It's faster to emmit the packages here than in the matching part
- m_apt->emit_packages(output, filters);
+ m_apt->emitPackages(output, filters);
delete matcher;
pk_backend_set_percentage(backend, 100);
@@ -1009,9 +967,9 @@ static gboolean backend_manage_packages_thread(PkBackend *backend)
// Resolve the given packages
gchar **package_ids = pk_backend_get_strv(backend, "package_ids");
if (remove) {
- removePkgs = m_apt->resolvePI(package_ids);
+ removePkgs = m_apt->resolvePackageIds(package_ids);
} else {
- installPkgs = m_apt->resolvePI(package_ids);
+ installPkgs = m_apt->resolvePackageIds(package_ids);
}
if (removePkgs.size() == 0 && installPkgs.size() == 0) {
@@ -1254,7 +1212,7 @@ static gboolean backend_get_packages_thread(PkBackend *backend)
output = m_apt->getPackages();
// It's faster to emmit the packages rather here than in the matching part
- m_apt->emit_packages(output, filters);
+ m_apt->emitPackages(output, filters);
delete m_apt;
return true;
commit 3edfc7d9c81df85e1244781abb1890ad9332877d
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 15 15:48:32 2012 -0300
aptcc: Forgot to return the package found
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
index 809283b..dc88464 100644
--- a/backends/aptcc/AptCacheFile.h
+++ b/backends/aptcc/AptCacheFile.h
@@ -39,11 +39,18 @@ public:
bool buildCaches(bool withLock = false);
inline pkgRecords* GetPkgRecords() { buildPkgRecords(); return m_packageRecords; }
+
+ /**
+ * GetPolicy will build the policy object if needed and return it
+ * @note This override if because the cache should be built before the policy
+ */
+ inline pkgPolicy* GetPolicy() { BuildCaches(NULL, false); BuildPolicy(); return Policy; }
+
/**
* GetDepCache will build the dependency cache if needed and return it
- * @note This override if because the policy should be built before the cache
+ * @note This override if because the policy should be built before the dependency cache
*/
- inline pkgDepCache* GetDepCache() { BuildPolicy(); BuildDepCache(); return DCache; }
+ inline pkgDepCache* GetDepCache() { BuildCaches(NULL, false); BuildPolicy(); BuildDepCache(); return DCache; }
private:
void buildPkgRecords();
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 414e9fc..d6a030b 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -93,9 +93,8 @@ bool AptIntf::init()
setenv("ftp_proxy", ftp_proxy, 1);
// Tries to open the cache
-// if (!m_cache.open()) {
-// return false;
-// }
+// return !m_cache.open();
+ return false; // WTF why it was expecting this?
}
AptIntf::~AptIntf()
@@ -114,9 +113,14 @@ void AptIntf::cancel()
}
}
-pkgCache::PkgIterator AptIntf::findPackage(const std::string &packageName)
+pkgCache::PkgIterator AptIntf::findPackage(const std::string &name)
{
- m_cache.GetPkgCache()->FindPkg(packageName);
+ return m_cache.GetDepCache()->FindPkg(name);
+}
+
+pkgCache::PkgIterator AptIntf::findPackageArch(const std::string &name, const std::string &arch)
+{
+ return m_cache.GetDepCache()->FindPkg(name, arch);
}
pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
@@ -125,14 +129,10 @@ pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
pkgCache::PkgIterator pkg;
parts = pk_package_id_split(packageId);
- gchar *pkgNameArch;
- pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
- pkg = findPackage(pkgNameArch);
- g_free(pkgNameArch);
+ pkg = findPackageArch(parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
// Ignore packages that could not be found or that exist only due to dependencies.
- if (pkg.end() == true ||
- (pkg.VersionList().end() && pkg.ProvidesList().end())) {
+ if (pkg.end() || (pkg.VersionList().end() && pkg.ProvidesList().end())) {
g_strfreev(parts);
return pkgCache::VerIterator();
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index ec6e5de..add4f7d 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -65,7 +65,13 @@ public:
* Tries to find a package with the given packageId
* @returns pkgCache::VerIterator that if .end() is true the package could not be found
*/
- pkgCache::PkgIterator findPackage(const std::string &packageName);
+ pkgCache::PkgIterator findPackage(const std::string &name);
+
+ /**
+ * Tries to find a package with the given packageId
+ * @returns pkgCache::VerIterator that if .end() is true the package could not be found
+ */
+ pkgCache::PkgIterator findPackageArch(const std::string &name, const std::string &arch = std::string());
/**
* Tries to find a package with the given packageId
commit ae6b2c8725c979e6e3bab9b2756fc46c6ebeab90
Merge: 5932c31... e1dc4cc...
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 15 14:41:11 2012 -0300
Merge branch 'master' of gitorious.org:packagekit/packagekit
commit 5932c3134af684025bcba91a05b0012050afee9f
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 15 14:40:30 2012 -0300
aptcc: Make sure BuildPolicy is called when getting the dep cache
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index a199bd0..2aa66f6 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -33,15 +33,12 @@ AptCacheFile::~AptCacheFile()
bool AptCacheFile::open(bool withLock)
{
- // TODO maybe subclass this to show more info when opening
- OpTextProgress opTextProgress(*_config);
- return Open(&opTextProgress, withLock);
+ return Open(NULL, withLock);
}
bool AptCacheFile::buildCaches(bool withLock)
{
- OpTextProgress opTextProgress(*_config);
- return BuildCaches(&opTextProgress, withLock);
+ return BuildCaches(NULL, withLock);
}
void AptCacheFile::buildPkgRecords()
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
index 71dae3a..809283b 100644
--- a/backends/aptcc/AptCacheFile.h
+++ b/backends/aptcc/AptCacheFile.h
@@ -39,6 +39,11 @@ public:
bool buildCaches(bool withLock = false);
inline pkgRecords* GetPkgRecords() { buildPkgRecords(); return m_packageRecords; }
+ /**
+ * GetDepCache will build the dependency cache if needed and return it
+ * @note This override if because the policy should be built before the cache
+ */
+ inline pkgDepCache* GetDepCache() { BuildPolicy(); BuildDepCache(); return DCache; }
private:
void buildPkgRecords();
commit e1dc4ccb363667cae980b86420782d02d17ecddc
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Sun Apr 15 19:03:09 2012 +0200
aptcc: Correctly emit if a repo is enabled
diff --git a/backends/aptcc/acqpkitstatus.cpp b/backends/aptcc/acqpkitstatus.cpp
index 4a5fc66..fb6a47c 100644
--- a/backends/aptcc/acqpkitstatus.cpp
+++ b/backends/aptcc/acqpkitstatus.cpp
@@ -58,7 +58,7 @@ void AcqPackageKitStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
pk_backend_repo_detail(m_backend,
"",
Itm.Description.c_str(),
- false);
+ true);
}
Update = true;
}
diff --git a/po/de.po b/po/de.po
index 663e263..19f98cf 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1,7 +1,7 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
-#
+#
# Translators:
# Christian <Christian.Kirbach at googlemail.com>, 2011.
# Christian Kirbach <Christian.Kirbach at googlemail.com>, 2009, 2011.
@@ -213,7 +213,7 @@ msgstr "Aktualisiert"
#. TRANSLATORS: if the repo is enabled
#: ../client/pk-console.c:424
msgid "Enabled"
-msgstr "Aktiviertakti"
+msgstr "Aktiviert"
#. TRANSLATORS: if the repo is disabled
#: ../client/pk-console.c:427
@@ -1849,7 +1849,7 @@ msgstr "Die Transaktion wurde nicht weitergeführt"
#. licence agreements.
#. - Change this to 'auth_admin' for environments where users should not
#. be given the option to make legal decisions.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:7
msgid "Accept EULA"
msgstr "EULA annehmen"
@@ -1933,7 +1933,7 @@ msgstr "Legitimation ist zum Aktualisieren des Betriebssystems erforderlich"
#. - Normal users are allowed to cancel their own task without
#. authentication, but a different user id needs the admin password
#. to cancel another users task.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:27
msgid "Cancel foreign task"
msgstr "Externe Aufgabe abbrechen"
@@ -1943,7 +1943,7 @@ msgstr "Externe Aufgabe abbrechen"
#. instance to a LTSP image or a virtual machine.
#. - This could be used to overwrite files not owned by the user using
#. a carefully created package file.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:34
msgid "Change location that packages are installed"
msgstr "Wechseln Sie den Ort, auf den Pakete installiert werden sollen"
@@ -1952,7 +1952,7 @@ msgstr "Wechseln Sie den Ort, auf den Pakete installiert werden sollen"
#. - Normal users require admin authentication to enable or disable
#. software sources as this can be used to enable new updates or
#. install different versions of software.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:40
msgid "Change software source parameters"
msgstr "Einstellungen der Depotquelle ändern"
@@ -1962,7 +1962,7 @@ msgstr "Einstellungen der Depotquelle ändern"
#. from signed repositories, as this cannot exploit a system.
#. - Paranoid users (or parents!) can change this to 'auth_admin' or
#. 'auth_admin_keep'.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:47
msgid "Install signed package"
msgstr "Signierte Pakete installieren"
@@ -1972,7 +1972,7 @@ msgstr "Signierte Pakete installieren"
#. unrecognised packages, as allowing users to do this without a
#. password would be a massive security hole.
#. - This is not retained as each package should be authenticated.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:54
msgid "Install untrusted local file"
msgstr "Nicht vertrauenswürdige lokale Datei installieren"
@@ -1980,7 +1980,7 @@ msgstr "Nicht vertrauenswürdige lokale Datei installieren"
#. SECURITY:
#. - Normal users do not require admin authentication to refresh the
#. cache, as this doesn't actually install or remove software.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:59
msgid "Refresh system sources"
msgstr "Systemressourcen aktualisieren"
@@ -1991,7 +1991,7 @@ msgstr "Systemressourcen aktualisieren"
#. - This should not be set to 'yes' as unprivileged users could then
#. try to rebind drivers in use, for instance security authentication
#. devices.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:67
msgid "Reload a device"
msgstr "Ein Gerät neu laden"
@@ -2004,7 +2004,7 @@ msgstr "Ein Gerät neu laden"
#. admin authentication has been obtained, otherwise packages can still
#. be removed. If this is not possible, change this authentication to
#. 'auth_admin'.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:77
msgid "Remove package"
msgstr "Paket entfernen"
@@ -2013,7 +2013,7 @@ msgstr "Paket entfernen"
#. - Normal users require admin authentication to rollback system state
#. as this will change a large number of packages, and could expose the
#. system to previously patched security vulnerabilities.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:83
msgid "Rollback to a previous transaction"
msgstr "Eine vorhergehende Transaktion zurücknehmen"
@@ -2021,7 +2021,7 @@ msgstr "Eine vorhergehende Transaktion zurücknehmen"
#. SECURITY:
#. - Normal users do not require admin authentication to set the proxy
#. used for downloading packages.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:88
msgid "Set network proxy"
msgstr "Netwerk-Proxy festlegen"
@@ -2031,7 +2031,7 @@ msgstr "Netwerk-Proxy festlegen"
#. - This implies adding an explicit trust, and should not be granted
#. without a secure authentication.
#. - This is not kept as each package should be authenticated.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:95
msgid "Trust a key used for signing packages"
msgstr "Einem Schlüssel zum Signieren von Paketen vertrauen"
@@ -2042,7 +2042,7 @@ msgstr "Einem Schlüssel zum Signieren von Paketen vertrauen"
#. to update the system when unattended.
#. - Changing this to anything other than 'yes' will break unattended
#. updates.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:103
msgid "Update packages"
msgstr "Pakete aktualisieren"
@@ -2051,7 +2051,7 @@ msgstr "Pakete aktualisieren"
#. - Normal users require admin authentication to upgrade the disto as
#. this can make the system unbootable or stop other applications from
#. working.
-#.
+#.
#: ../policy/org.freedesktop.packagekit.policy.in.h:109
msgid "Upgrade System"
msgstr "Systemaktualisierung"
commit c0d6d71b5ae1dc1e4771fa6ac88fb6ec2d581903
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 15 13:37:24 2012 -0300
aptcc: Refactored to use AptCacheFile
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
index 17e40cf..a199bd0 100644
--- a/backends/aptcc/AptCacheFile.cpp
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -19,29 +19,39 @@
*/
#include "AptCacheFile.h"
-AptCacheFile::AptCacheFile()
+AptCacheFile::AptCacheFile() :
+ m_packageRecords(0)
{
}
+AptCacheFile::~AptCacheFile()
+{
+ if (m_packageRecords) {
+ delete m_packageRecords;
+ }
+}
+
bool AptCacheFile::open(bool withLock)
{
// TODO maybe subclass this to show more info when opening
OpTextProgress opTextProgress(*_config);
- if (pkgCacheFile::Open(&opTextProgress, withLock) == false) {
- return false;
- }
+ return Open(&opTextProgress, withLock);
+}
- // Generate it and map it
- // TODO for what we need this???
-// bool Res = pkgMakeStatusCache(GetSourceList(), opTextProgress, &Map, true);
-// Progress.Done();
-// if(!Res) {
-// return false;
-// //"The package lists or status file could not be parsed or opened."
-// }
+bool AptCacheFile::buildCaches(bool withLock)
+{
+ OpTextProgress opTextProgress(*_config);
+ return BuildCaches(&opTextProgress, withLock);
+}
+
+void AptCacheFile::buildPkgRecords()
+{
+ if (m_packageRecords) {
+ return;
+ }
// Create the text record parser
- m_packageRecords = new pkgRecords(*this);
+ m_packageRecords = new pkgRecords(*this->GetPkgCache());
}
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
index f782551..71dae3a 100644
--- a/backends/aptcc/AptCacheFile.h
+++ b/backends/aptcc/AptCacheFile.h
@@ -26,15 +26,23 @@ class AptCacheFile : public pkgCacheFile
{
public:
AptCacheFile();
+ ~AptCacheFile();
/**
* Inits the package cache returning false if it can't open
*/
bool open(bool withLock = false);
- inline pkgRecords* GetPkgRecords() { BuildDepCache(); return m_packageRecords; }
+ /**
+ * Build caches
+ */
+ bool buildCaches(bool withLock = false);
+
+ inline pkgRecords* GetPkgRecords() { buildPkgRecords(); return m_packageRecords; }
private:
+ void buildPkgRecords();
+
pkgRecords *m_packageRecords;
};
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 2a781b5..414e9fc 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -54,18 +54,12 @@
#define RAMFS_MAGIC 0x858458f6
AptIntf::AptIntf(PkBackend *backend, bool &cancel) :
- packageRecords(0),
- packageCache(0),
- packageDepCache(0),
- packageSourceList(0),
- Map(0),
- Policy(0),
m_backend(backend),
- _cancel(cancel),
+ m_cancel(cancel),
m_terminalTimeout(120),
m_lastSubProgress(0)
{
- _cancel = false;
+ m_cancel = false;
}
bool AptIntf::init()
@@ -98,83 +92,21 @@ bool AptIntf::init()
ftp_proxy = pk_backend_get_proxy_ftp(m_backend);
setenv("ftp_proxy", ftp_proxy, 1);
- packageSourceList = new pkgSourceList;
- // Read the source list
- packageSourceList->ReadMainList();
-
- // Generate it and map it
- bool Res = pkgMakeStatusCache(*packageSourceList, Progress, &Map, true);
- Progress.Done();
- if(!Res) {
- return false;
- //"The package lists or status file could not be parsed or opened."
- }
-
- packageCache = new pkgCache(Map);
- if (_error->PendingError()) {
- return false;
- }
-
- // create depcache
- Policy = new pkgPolicy(packageCache);
- if (_error->PendingError()) {
- return false;
- }
-
- if (!ReadPinFile(*Policy)) {
- return false;
- }
-
- packageDepCache = new pkgDepCache(packageCache, Policy);
- if (_error->PendingError()) {
- return false;
- }
-
- packageDepCache->Init(&Progress);
- Progress.Done();
- if (_error->PendingError()) {
- return false;
- }
-
- // Create the text record parser
- packageRecords = new pkgRecords(*packageDepCache);
+ // Tries to open the cache
+// if (!m_cache.open()) {
+// return false;
+// }
}
AptIntf::~AptIntf()
{
- if (packageRecords) {
- g_debug ("~apt_init packageRecords");
- delete packageRecords;
- }
-
- if (packageCache) {
- g_debug ("~apt_init packageCache");
- delete packageCache;
- }
-
- if (packageDepCache) {
- g_debug ("~apt_init packageDepCache");
- delete packageDepCache;
- }
-
- if (Policy) {
- g_debug ("~apt_init Policy");
- delete Policy;
- }
-
- if (packageSourceList) {
- delete packageSourceList;
- }
-
pk_backend_finished(m_backend);
-
- delete Map;
}
void AptIntf::cancel()
{
- if (!_cancel) {
- _cancel = true;
+ if (!m_cancel) {
+ m_cancel = true;
pk_backend_set_status(m_backend, PK_STATUS_ENUM_CANCEL);
}
if (m_child_pid > 0) {
@@ -182,6 +114,11 @@ void AptIntf::cancel()
}
}
+pkgCache::PkgIterator AptIntf::findPackage(const std::string &packageName)
+{
+ m_cache.GetPkgCache()->FindPkg(packageName);
+}
+
pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
{
gchar **parts;
@@ -190,7 +127,7 @@ pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
parts = pk_package_id_split(packageId);
gchar *pkgNameArch;
pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
- pkg = packageCache->FindPkg(pkgNameArch);
+ pkg = findPackage(pkgNameArch);
g_free(pkgNameArch);
// Ignore packages that could not be found or that exist only due to dependencies.
@@ -241,7 +178,11 @@ pkgCache::VerIterator AptIntf::findVer(const pkgCache::PkgIterator &pkg)
pkgCache::VerIterator AptIntf::findCandidateVer(const pkgCache::PkgIterator &pkg)
{
// get the candidate version iterator
- return (*packageDepCache)[pkg].CandidateVerIter(*packageDepCache);
+ pkgCache::VerIterator ret;
+ if (m_cache.open()) {
+ ret = m_cache[pkg].CandidateVerIter(m_cache);
+ }
+ return ret;
}
bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
@@ -398,7 +339,7 @@ void AptIntf::emitPackage(const pkgCache::VerIterator &ver,
pk_backend_package(m_backend,
state,
package_id,
- get_short_description(ver, packageRecords).c_str());
+ get_short_description(ver, m_cache.GetPkgRecords()).c_str());
g_free(package_id);
}
@@ -416,7 +357,7 @@ void AptIntf::emit_packages(PkgList &output,
output.end());
for (PkgList::iterator it = output.begin(); it != output.end(); ++it) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
@@ -436,7 +377,7 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
output.end());
for (PkgList::iterator i = output.begin(); i != output.end(); ++i) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
@@ -475,8 +416,8 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
return;
}
- for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- if (_cancel) {
+ for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ if (m_cancel) {
delete matcher;
break;
}
@@ -497,7 +438,7 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
}
pkgCache::VerFileIterator vf = ver.FileList();
- pkgRecords::Parser &rec = packageRecords->Lookup(vf);
+ pkgRecords::Parser &rec = m_cache.GetPkgRecords()->Lookup(vf);
const char *start, *stop;
rec.GetRec(start, stop);
string record(start, stop - start);
@@ -553,7 +494,7 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
g_debug ("pkg-name: %s", libPkgName.c_str ());
- for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
+ for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
// Ignore packages that exist only due to dependencies.
if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
continue;
@@ -581,6 +522,90 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
}
}
+// Mostly copied from pkgAcqArchive.
+bool AptIntf::getArchive(pkgAcquire *Owner,
+ const pkgCache::VerIterator &Version,
+ std::string directory,
+ std::string &StoreFilename)
+{
+ pkgCache::VerFileIterator Vf=Version.FileList();
+
+ if (Version.Arch() == 0) {
+ return _error->Error("I wasn't able to locate a file for the %s package. "
+ "This might mean you need to manually fix this package. (due to missing arch)",
+ Version.ParentPkg().Name());
+ }
+
+ /* We need to find a filename to determine the extension. We make the
+ assumption here that all the available sources for this version share
+ the same extension.. */
+ // Skip not source sources, they do not have file fields.
+ for (; Vf.end() == false; Vf++) {
+ if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0) {
+ continue;
+ }
+ break;
+ }
+
+ // Does not really matter here.. we are going to fail out below
+ if (Vf.end() != true) {
+ // If this fails to get a file name we will bomb out below.
+ pkgRecords::Parser &Parse = m_cache.GetPkgRecords()->Lookup(Vf);
+ if (_error->PendingError() == true) {
+ return false;
+ }
+
+ // Generate the final file name as: package_version_arch.foo
+ StoreFilename = QuoteString(Version.ParentPkg().Name(),"_:") + '_' +
+ QuoteString(Version.VerStr(),"_:") + '_' +
+ QuoteString(Version.Arch(),"_:.") +
+ "." + flExtension(Parse.FileName());
+ }
+
+ for (; Vf.end() == false; Vf++) {
+ // Ignore not source sources
+ if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0) {
+ continue;
+ }
+
+ // Try to cross match against the source list
+ pkgIndexFile *Index;
+ if (m_cache.GetSourceList()->FindIndex(Vf.File(),Index) == false) {
+ continue;
+ }
+
+ // Grab the text package record
+ pkgRecords::Parser &Parse = m_cache.GetPkgRecords()->Lookup(Vf);
+ if (_error->PendingError() == true) {
+ return false;
+ }
+
+ const string PkgFile = Parse.FileName();
+ const string MD5 = Parse.MD5Hash();
+ if (PkgFile.empty() == true) {
+ return _error->Error("The package index files are corrupted. No Filename: "
+ "field for package %s.",
+ Version.ParentPkg().Name());
+ }
+
+ string DestFile = directory + "/" + flNotDir(StoreFilename);
+
+ // Create the item
+ new pkgAcqFile(Owner,
+ Index->ArchiveURI(PkgFile),
+ MD5,
+ Version->Size,
+ Index->ArchiveInfo(Version),
+ Version.ParentPkg().Name(),
+ "",
+ DestFile);
+
+ Vf++;
+ return true;
+ }
+ return false;
+}
+
// used to emit packages it collects all the needed info
void AptIntf::emitDetails(const pkgCache::VerIterator &ver)
{
@@ -595,7 +620,7 @@ void AptIntf::emitDetails(const pkgCache::VerIterator &ver)
section = section.substr(found + 1);
pkgCache::VerFileIterator vf = ver.FileList();
- pkgRecords::Parser &rec = packageRecords->Lookup(vf);
+ pkgRecords::Parser &rec = m_cache.GetPkgRecords()->Lookup(vf);
long size;
if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
@@ -615,7 +640,7 @@ void AptIntf::emitDetails(const pkgCache::VerIterator &ver)
package_id,
"unknown",
get_enum_group(section),
- get_long_description_parsed(ver, packageRecords).c_str(),
+ get_long_description_parsed(ver, m_cache.GetPkgRecords()).c_str(),
rec.Homepage().c_str(),
size);
@@ -631,7 +656,7 @@ void AptIntf::emitDetails(PkgList &pkgs)
pkgs.end());
for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
@@ -663,7 +688,7 @@ void AptIntf::emitUpdateDetails(const pkgCache::VerIterator &version)
pkgCache::VerFileIterator vf = candver.FileList();
string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
- pkgRecords::Parser &rec = packageRecords->Lookup(candver.FileList());
+ pkgRecords::Parser &rec = m_cache.GetPkgRecords()->Lookup(candver.FileList());
// Build the changelogURI
char uri[512];
@@ -739,7 +764,7 @@ void AptIntf::emitUpdateDetails(const pkgCache::VerIterator &version)
pkgfilename.c_str());
}
// Create the download object
- AcqPackageKitStatus Stat(this, m_backend, _cancel);
+ AcqPackageKitStatus Stat(this, m_backend, m_cancel);
// get a fetcher
pkgAcquire fetcher;
@@ -883,7 +908,7 @@ void AptIntf::emitUpdateDetails(const pkgCache::VerIterator &version)
void AptIntf::emitUpdateDetails(PkgList &pkgs)
{
for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
@@ -897,7 +922,7 @@ void AptIntf::getDepends(PkgList &output,
{
pkgCache::DepIterator dep = ver.DependsList();
while (!dep.end()) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
@@ -927,8 +952,8 @@ void AptIntf::getRequires(PkgList &output,
const pkgCache::VerIterator &ver,
bool recursive)
{
- for (pkgCache::PkgIterator parentPkg = packageCache->PkgBegin(); !parentPkg.end(); ++parentPkg) {
- if (_cancel) {
+ for (pkgCache::PkgIterator parentPkg = m_cache.GetPkgCache()->PkgBegin(); !parentPkg.end(); ++parentPkg) {
+ if (m_cancel) {
break;
}
@@ -962,8 +987,145 @@ void AptIntf::getRequires(PkgList &output,
}
}
+PkgList AptIntf::getPackages()
+{
+ PkgList output;
+ output.reserve(m_cache.GetPkgCache()->HeaderP->PackageCount);
+ for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ if (m_cancel) {
+ break;
+ }
+
+ // Ignore packages that exist only due to dependencies.
+ if(pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // Don't insert virtual packages as they don't have all kinds of info
+ const pkgCache::VerIterator &ver = findVer(pkg);
+ if (ver.end() == false) {
+ output.push_back(ver);
+ }
+ }
+ return output;
+}
+
+PkgList AptIntf::getPackagesFromGroup(vector<PkGroupEnum> &groups)
+{
+ PkgList output;
+ for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ if (m_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // Ignore virtual packages
+ const pkgCache::VerIterator &ver = findVer(pkg);
+ if (ver.end() == false) {
+ string section = pkg.VersionList().Section() == NULL ? "" : pkg.VersionList().Section();
+
+ size_t found;
+ found = section.find_last_of("/");
+ section = section.substr(found + 1);
+
+ // Don't insert virtual packages instead add what it provides
+ for (vector<PkGroupEnum>::iterator it = groups.begin();
+ it != groups.end();
+ ++it) {
+ if (*it == get_enum_group(section)) {
+ output.push_back(ver);
+ break;
+ }
+ }
+ }
+ }
+ return output;
+}
+
+PkgList AptIntf::searchPackageName(Matcher *matcher)
+{
+ PkgList output;
+ for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ if (m_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ if (matcher->matches(pkg.Name())) {
+ // Don't insert virtual packages instead add what it provides
+ const pkgCache::VerIterator &ver = findVer(pkg);
+ if (ver.end() == false) {
+ output.push_back(ver);
+ } else {
+ // iterate over the provides list
+ for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
+ const pkgCache::VerIterator &ownerVer = findVer(Prv.OwnerPkg());
+
+ // check to see if the provided package isn't virtual too
+ if (ownerVer.end() == false) {
+ // we add the package now because we will need to
+ // remove duplicates later anyway
+ output.push_back(ownerVer);
+ }
+ }
+ }
+ }
+ }
+ return output;
+}
+
+PkgList AptIntf::searchPackageDetails(Matcher *matcher)
+{
+ PkgList output;
+ for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ if (m_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ const pkgCache::VerIterator &ver = findVer(pkg);
+ if (ver.end() == false) {
+ if (matcher->matches(pkg.Name()) ||
+ matcher->matches(getPackageLongDescription(ver))) {
+ // The package matched
+ output.push_back(ver);
+ }
+ } else if (matcher->matches(pkg.Name())) {
+ // The package is virtual and MATCHED the name
+ // Don't insert virtual packages instead add what it provides
+
+ // iterate over the provides list
+ for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
+ const pkgCache::VerIterator &ownerVer = findVer(Prv.OwnerPkg());
+
+ // check to see if the provided package isn't virtual too
+ if (ownerVer.end() == false) {
+ // we add the package now because we will need to
+ // remove duplicates later anyway
+ output.push_back(ownerVer);
+ }
+ }
+ }
+ }
+ return output;
+}
+
+string AptIntf::getPackageLongDescription(const pkgCache::VerIterator &ver)
+{
+ return get_long_description(ver, m_cache.GetPkgRecords());
+}
+
// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
-vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel)
+vector<string> search_files (PkBackend *backend, gchar **values, bool &m_cancel)
{
vector<string> packageList;
regex_t re;
@@ -991,7 +1153,7 @@ vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel)
string line;
while ((dirp = readdir(dp)) != NULL) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
if (ends_with(dirp->d_name, ".list")) {
@@ -1016,7 +1178,7 @@ vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel)
}
// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
-vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel)
+vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &m_cancel)
{
vector<string> packageList;
regex_t re;
@@ -1046,7 +1208,7 @@ vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error,
string line;
while ((dirp = readdir(dp)) != NULL) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
if (ends_with(dirp->d_name, ".desktop")) {
@@ -1147,7 +1309,7 @@ bool AptIntf::packageIsSupported(const pkgCache::PkgIterator &pkgIter, string co
component = "main";
// Get a fetcher
- AcqPackageKitStatus Stat(this, m_backend, _cancel);
+ AcqPackageKitStatus Stat(this, m_backend, m_cancel);
Stat.addPackage(verIter);
pkgAcquire fetcher;
fetcher.Setup(&Stat);
@@ -1279,21 +1441,21 @@ bool AptIntf::tryToInstall(const pkgCache::PkgIterator &constPkg,
}
// checks if there are Essential packages being removed
-bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
+bool AptIntf::removingEssentialPackages(AptCacheFile &cache)
{
string List;
- bool *Added = new bool[Cache->Head().PackageCount];
- for (unsigned int I = 0; I != Cache->Head().PackageCount; ++I) {
+ bool *Added = new bool[cache->Head().PackageCount];
+ for (unsigned int I = 0; I != cache->Head().PackageCount; ++I) {
Added[I] = false;
}
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
+ for (pkgCache::PkgIterator I = cache->PkgBegin(); ! I.end(); ++I) {
if ((I->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
(I->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important) {
continue;
}
- if (Cache[I].Delete() == true) {
+ if (cache[I].Delete() == true) {
if (Added[I->ID] == false) {
Added[I->ID] = true;
List += string(I.Name()) + " ";
@@ -1313,7 +1475,7 @@ bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
}
pkgCache::PkgIterator P = D.SmartTargetPkg();
- if (Cache[P].Delete() == true)
+ if (cache[P].Delete() == true)
{
if (Added[P->ID] == true){
continue;
@@ -1343,7 +1505,7 @@ bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
/**
* emitChangedPackages - Show packages to newly install
*/
-void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
+void AptIntf::emitChangedPackages(AptCacheFile &cache)
{
PkgList installing;
PkgList removing;
@@ -1351,17 +1513,17 @@ void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
PkgList downgrading;
string VersionsList;
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
- if (Cache[pkg].NewInstall() == true) {
+ for (pkgCache::PkgIterator pkg = cache->PkgBegin(); ! pkg.end(); ++pkg) {
+ if (cache[pkg].NewInstall() == true) {
// installing
installing.push_back(findCandidateVer(pkg));
- } else if (Cache[pkg].Delete() == true) {
+ } else if (cache[pkg].Delete() == true) {
// removing
removing.push_back(findVer(pkg));
- } else if (Cache[pkg].Upgrade() == true) {
+ } else if (cache[pkg].Upgrade() == true) {
// updating
updating.push_back(findCandidateVer(pkg));
- } else if (Cache[pkg].Downgrade() == true) {
+ } else if (cache[pkg].Downgrade() == true) {
// downgrading
downgrading.push_back(findCandidateVer(pkg));
}
@@ -1374,19 +1536,19 @@ void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
emit_packages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
}
-void AptIntf::populateInternalPackages(pkgCacheFile &Cache)
+void AptIntf::populateInternalPackages(AptCacheFile &cache)
{
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
- if (Cache[pkg].NewInstall() == true) {
+ for (pkgCache::PkgIterator pkg = cache->PkgBegin(); ! pkg.end(); ++pkg) {
+ if (cache[pkg].NewInstall() == true) {
// installing
m_pkgs.push_back(findCandidateVer(pkg));
- } else if (Cache[pkg].Delete() == true) {
+ } else if (cache[pkg].Delete() == true) {
// removing
m_pkgs.push_back(findVer(pkg));
- } else if (Cache[pkg].Upgrade() == true) {
+ } else if (cache[pkg].Upgrade() == true) {
// updating
m_pkgs.push_back(findCandidateVer(pkg));
- } else if (Cache[pkg].Downgrade() == true) {
+ } else if (cache[pkg].Downgrade() == true) {
// downgrading
m_pkgs.push_back(findCandidateVer(pkg));
}
@@ -1402,7 +1564,7 @@ void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
}
}
- const pkgCache::PkgIterator &pkg = packageCache->FindPkg(name);
+ const pkgCache::PkgIterator &pkg = findPackage(name);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg.end() == true ||
(pkg.VersionList().end() && pkg.ProvidesList().end())) {
@@ -1440,7 +1602,7 @@ void AptIntf::updateInterface(int fd, int writeFd)
m_lastTermAction = time(NULL);
if( buf[0] == '\n') {
- if (_cancel) {
+ if (m_cancel) {
kill(m_child_pid, SIGTERM);
}
//cout << "got line: " << line << endl;
@@ -1703,7 +1865,7 @@ void AptIntf::updateInterface(int fd, int writeFd)
*
* Remove unused automatic packages
*/
-bool AptIntf::doAutomaticRemove(pkgCacheFile &Cache)
+bool AptIntf::doAutomaticRemove(AptCacheFile &cache)
{
bool doAutoRemove;
if (pk_backend_get_bool(m_backend, "autoremove")) {
@@ -1711,7 +1873,7 @@ bool AptIntf::doAutomaticRemove(pkgCacheFile &Cache)
} else {
doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
}
- pkgDepCache::ActionGroup group(*Cache);
+ pkgDepCache::ActionGroup group(*cache);
if (_config->FindB("APT::Get::Remove",true) == false &&
doAutoRemove == true) {
@@ -1723,23 +1885,23 @@ bool AptIntf::doAutomaticRemove(pkgCacheFile &Cache)
if (doAutoRemove) {
bool purge = _config->FindB("APT::Get::Purge", false);
// look over the cache to see what can be removed
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg) {
- if (Cache[Pkg].Garbage) {
+ for (pkgCache::PkgIterator Pkg = cache->PkgBegin(); ! Pkg.end(); ++Pkg) {
+ if (cache[Pkg].Garbage) {
if (Pkg.CurrentVer() != 0 &&
Pkg->CurrentState != pkgCache::State::ConfigFiles) {
- Cache->MarkDelete(Pkg, purge);
+ cache->MarkDelete(Pkg, purge);
} else {
- Cache->MarkKeep(Pkg, false, false);
+ cache->MarkKeep(Pkg, false, false);
}
}
}
// Now see if we destroyed anything
- if (Cache->BrokenCount() != 0) {
+ if (cache->BrokenCount() != 0) {
cout << "Hmm, seems like the AutoRemover destroyed something which really\n"
"shouldn't happen. Please file a bug report against apt." << endl;
// TODO call show_broken
- // ShowBroken(c1out,Cache,false);
+ // ShowBroken(c1out,cache,false);
return _error->Error("Internal Error, AutoRemover broke stuff");
}
}
@@ -1759,7 +1921,7 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
return ret;
for (uint i = 0; i < g_strv_length(package_ids); ++i) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
@@ -1769,12 +1931,12 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
if (pk_package_id_check(pi) == false) {
// Check if we are on multiarch AND if the package name didn't contains the arch field (GDEBI for instance)
if (m_isMultiArch && strstr(pi, ":") == NULL) {
- // OK FindPkg is not suitable for muitarch
+ // OK FindPkg is not suitable on muitarch without ":arch"
// it can only return one package in this case we need to
// search the whole package cache and match the package
// name manually
- for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- if (_cancel) {
+ for (pkgCache::PkgIterator pkg = m_cache.GetPkgCache()->PkgBegin(); !pkg.end(); ++pkg) {
+ if (m_cancel) {
break;
}
@@ -1801,7 +1963,7 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
}
}
} else {
- const pkgCache::PkgIterator &pkg = packageCache->FindPkg(pi);
+ const pkgCache::PkgIterator &pkg = findPackage(pi);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg.end() == true || (pkg.VersionList().end() && pkg.ProvidesList().end())) {
continue;
@@ -1831,11 +1993,20 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
return filterPackages(ret, filters);
}
-bool AptIntf::markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag)
+void AptIntf::refreshCache()
+{
+ // Create the progress
+ AcqPackageKitStatus Stat(this, m_backend, m_cancel);
+
+ // do the work
+ ListUpdate(Stat, *m_cache.GetSourceList());
+}
+
+bool AptIntf::markAutoInstalled(AptCacheFile &cache, PkgList &pkgs, bool flag)
{
bool ret;
for(PkgList::iterator it = pkgs.begin(); it != pkgs.end(); ++it) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
@@ -2031,17 +2202,16 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto)
{
//cout << "runTransaction" << simulate << remove << endl;
- bool WithLock = !simulate; // Check to see if we are just simulating,
+ bool withLock = !simulate; // Check to see if we are just simulating,
//since for that no lock is needed
- pkgCacheFile Cache;
- OpTextProgress Prog(*_config);
+ AptCacheFile cache;
int timeout = 10;
// TODO test this
- while (Cache.Open(&Prog, WithLock) == false) {
+ while (cache.open(withLock) == false) {
// failed to open cache, try checkDeps then..
- // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
- if (WithLock == false || (timeout <= 0)) {
+ // || cache.CheckDeps(CmdL.FileSize() != 1) == false
+ if (withLock == false || (timeout <= 0)) {
show_errors(m_backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
return false;
} else {
@@ -2055,23 +2225,23 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
// Enter the special broken fixing mode if the user specified arguments
bool BrokenFix = false;
- if (Cache->BrokenCount() != 0) {
+ if (cache->BrokenCount() != 0) {
BrokenFix = true;
}
unsigned int ExpectedInst = 0;
- pkgProblemResolver Fix(Cache);
+ pkgProblemResolver Fix(cache);
// new scope for the ActionGroup
{
- pkgDepCache::ActionGroup group(Cache);
+ pkgDepCache::ActionGroup group(cache);
for (PkgList::iterator it = install.begin(); it != install.end(); ++it) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
if (tryToInstall(it->ParentPkg(),
- Cache,
+ cache,
Fix,
false, // remove
BrokenFix,
@@ -2081,16 +2251,16 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
}
if (!simulate) {
- markAutoInstalled(Cache, install, markAuto);
+ markAutoInstalled(cache, install, markAuto);
}
for (PkgList::iterator it = remove.begin(); it != remove.end(); ++it) {
- if (_cancel) {
+ if (m_cancel) {
break;
}
if (tryToInstall(it->ParentPkg(),
- Cache,
+ cache,
Fix,
true, // remove
BrokenFix,
@@ -2106,17 +2276,17 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
}
// Now we check the state of the packages,
- if (Cache->BrokenCount() != 0) {
+ if (cache->BrokenCount() != 0) {
// if the problem resolver could not fix all broken things
// show what is broken
- show_broken(m_backend, Cache, false);
+ show_broken(m_backend, cache, false);
return false;
}
}
// If we are simulating the install packages
// will just calculate the trusted packages
- return installPackages(Cache, simulate);
+ return installPackages(cache, simulate);
}
/**
@@ -2125,44 +2295,44 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
* This displays the informative messages describing what is going to
* happen and then calls the download routines
*/
-bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
+bool AptIntf::installPackages(AptCacheFile &cache, bool simulating)
{
// Try to auto-remove packages
- if (!doAutomaticRemove(Cache)) {
+ if (!doAutomaticRemove(cache)) {
// TODO
return false;
}
//cout << "installPackages() called" << endl;
if (_config->FindB("APT::Get::Purge",false) == true) {
- pkgCache::PkgIterator I = Cache->PkgBegin();
+ pkgCache::PkgIterator I = cache->PkgBegin();
for (; I.end() == false; ++I) {
- if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete) {
- Cache->MarkDelete(I,true);
+ if (I.Purge() == false && cache[I].Mode == pkgDepCache::ModeDelete) {
+ cache->MarkDelete(I,true);
}
}
}
// check for essential packages!!!
- if (removingEssentialPackages(Cache)) {
+ if (removingEssentialPackages(cache)) {
return false;
}
// Sanity check
- if (Cache->BrokenCount() != 0) {
+ if (cache->BrokenCount() != 0) {
// TODO
- show_broken(m_backend, Cache, false);
+ show_broken(m_backend, cache, false);
_error->Error("Internal error, InstallPackages was called with broken packages!");
return false;
}
- if (Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
- Cache->BadCount() == 0) {
+ if (cache->DelCount() == 0 && cache->InstCount() == 0 &&
+ cache->BadCount() == 0) {
return true;
}
// No remove flag
- if (Cache->DelCount() != 0 && _config->FindB("APT::Get::Remove", true) == false) {
+ if (cache->DelCount() != 0 && _config->FindB("APT::Get::Remove", true) == false) {
pk_backend_error_code(m_backend,
PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE,
"Packages need to be removed but remove is disabled.");
@@ -2170,7 +2340,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
}
// Create the text record parser
- pkgRecords Recs(Cache);
+ pkgRecords Recs(cache);
if (_error->PendingError() == true) {
return false;
}
@@ -2185,37 +2355,37 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
}
// Create the download object
- AcqPackageKitStatus Stat(this, m_backend, _cancel);
+ AcqPackageKitStatus Stat(this, m_backend, m_cancel);
// get a fetcher
pkgAcquire fetcher;
fetcher.Setup(&Stat);
// Create the package manager and prepare to download
- SPtr<pkgPackageManager> PM = _system->CreatePM(Cache);
- if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
+ SPtr<pkgPackageManager> PM = _system->CreatePM(cache);
+ if (PM->GetArchives(&fetcher, m_cache.GetSourceList(), &Recs) == false ||
_error->PendingError() == true) {
return false;
}
// Generate the list of affected packages
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); pkg.end() == false; ++pkg) {
+ for (pkgCache::PkgIterator pkg = cache->PkgBegin(); pkg.end() == false; ++pkg) {
// Ignore no-version packages
if (pkg->VersionList == 0) {
continue;
}
// Not interesting
- if ((Cache[pkg].Keep() == true ||
- Cache[pkg].InstVerIter(Cache) == pkg.CurrentVer()) &&
+ if ((cache[pkg].Keep() == true ||
+ cache[pkg].InstVerIter(cache) == pkg.CurrentVer()) &&
pkg.State() == pkgCache::PkgIterator::NeedsNothing &&
- (Cache[pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
- (pkg.Purge() != false || Cache[pkg].Mode != pkgDepCache::ModeDelete ||
- (Cache[pkg].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge)) {
+ (cache[pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
+ (pkg.Purge() != false || cache[pkg].Mode != pkgDepCache::ModeDelete ||
+ (cache[pkg].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge)) {
continue;
}
- pkgCache::VerIterator ver = Cache[pkg].InstVerIter(Cache);
+ pkgCache::VerIterator ver = cache[pkg].InstVerIter(cache);
if (ver.end() && (ver = findCandidateVer(pkg))) {
// Ignore invalid versions
continue;
@@ -2229,8 +2399,8 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
double FetchBytes = fetcher.FetchNeeded();
double FetchPBytes = fetcher.PartialPresent();
double DebBytes = fetcher.TotalNeeded();
- if (DebBytes != Cache->DebSize()) {
- cout << DebBytes << ',' << Cache->DebSize() << endl;
+ if (DebBytes != cache->DebSize()) {
+ cout << DebBytes << ',' << cache->DebSize() << endl;
cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
}
@@ -2281,7 +2451,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
if (simulating) {
// Print out a list of packages that are going to be installed extra
- emitChangedPackages(Cache);
+ emitChangedPackages(cache);
return true;
}
@@ -2289,7 +2459,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
pk_backend_set_simultaneous_mode(m_backend, true);
// Download and check if we can continue
if (fetcher.Run() != pkgAcquire::Continue
- && _cancel == false) {
+ && m_cancel == false) {
// We failed and we did not cancel
show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
return false;
@@ -2303,10 +2473,10 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
// Store the packages that are going to change
// so we can emit them as we process it.
- populateInternalPackages(Cache);
+ populateInternalPackages(cache);
// Check if the user canceled
- if (_cancel) {
+ if (m_cancel) {
return true;
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index f373560..ec6e5de 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -30,6 +30,8 @@
#include <pk-backend.h>
+#include "AptCacheFile.h"
+
#define PREUPGRADE_BINARY "/usr/bin/do-release-upgrade"
#define GDEBI_BINARY "/usr/bin/gdebi"
@@ -48,7 +50,7 @@ vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error,
typedef vector<pkgCache::VerIterator> PkgList;
class pkgProblemResolver;
-
+class Matcher;
class AptIntf
{
@@ -63,6 +65,12 @@ public:
* Tries to find a package with the given packageId
* @returns pkgCache::VerIterator that if .end() is true the package could not be found
*/
+ pkgCache::PkgIterator findPackage(const std::string &packageName);
+
+ /**
+ * Tries to find a package with the given packageId
+ * @returns pkgCache::VerIterator that if .end() is true the package could not be found
+ */
pkgCache::VerIterator findPackageId(const gchar *packageId);
/**
@@ -80,9 +88,12 @@ public:
pkgCache::VerIterator findCandidateVer(const pkgCache::PkgIterator &pkg);
PkgList resolvePI(gchar **package_ids, PkBitfield filters = PK_FILTER_ENUM_NONE);
+
+ void refreshCache();
+
bool markFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
- bool markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag);
+ bool markAutoInstalled(AptCacheFile &cache, PkgList &pkgs, bool flag);
/**
* runs a transaction to install/remove/update packages
@@ -108,6 +119,16 @@ public:
const pkgCache::VerIterator &ver,
bool recursive);
+ PkgList getPackages();
+ PkgList getPackagesFromGroup(vector<PkGroupEnum> &groups);
+ PkgList searchPackageName(Matcher *matcher);
+ PkgList searchPackageDetails(Matcher *matcher);
+
+ /**
+ * Get the long description of a package
+ */
+ string getPackageLongDescription(const pkgCache::VerIterator &ver);
+
/**
* Emits a package if it match the filters
*/
@@ -144,7 +165,7 @@ public:
/**
* Download and install packages
*/
- bool installPackages(pkgCacheFile &Cache, bool simulating);
+ bool installPackages(AptCacheFile &cache, bool simulating);
/**
* Install a DEB file
@@ -165,17 +186,16 @@ public:
*/
void providesLibrary(PkgList &output, gchar **values);
- pkgRecords *packageRecords;
- pkgCache *packageCache;
- pkgDepCache *packageDepCache;
- pkgSourceList *packageSourceList;
+ /** Like pkgAcqArchive, but uses generic File objects to download to
+ * the cwd (and copies from file:/ URLs).
+ */
+ bool getArchive(pkgAcquire *Owner, pkgCache::VerIterator const &Version,
+ std::string directory, std::string &StoreFilename);
private:
- MMap *Map;
- OpProgress Progress;
- pkgPolicy *Policy;
+ AptCacheFile m_cache;
PkBackend *m_backend;
- bool &_cancel;
+ bool &m_cancel;
bool checkTrusted(pkgAcquire &fetcher, bool simulating);
bool packageIsSupported(const pkgCache::PkgIterator &pkgIter, string component);
@@ -190,14 +210,14 @@ private:
* interprets dpkg status fd
*/
void updateInterface(int readFd, int writeFd);
- bool doAutomaticRemove(pkgCacheFile &Cache);
- void emitChangedPackages(pkgCacheFile &Cache);
- bool removingEssentialPackages(pkgCacheFile &Cache);
+ bool doAutomaticRemove(AptCacheFile &cache);
+ void emitChangedPackages(AptCacheFile &cache);
+ bool removingEssentialPackages(AptCacheFile &cache);
bool m_isMultiArch;
PkgList m_pkgs;
string m_localDebFile;
- void populateInternalPackages(pkgCacheFile &Cache);
+ void populateInternalPackages(AptCacheFile &cache);
void emitTransactionPackage(string name, PkInfoEnum state);
time_t m_lastTermAction;
string m_lastPackage;
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index f66cdf1..154e3d0 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -376,11 +376,10 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
- pkgCacheFile Cache;
- OpTextProgress Prog(*_config);
+ AptCacheFile cache;
int timeout = 10;
// TODO test this
- while (Cache.Open(&Prog, !getUpdates) == false) {
+ while (cache.open(!getUpdates) == false) {
// failed to open cache, try checkDeps then..
// || Cache.CheckDeps(CmdL.FileSize() != 1) == false
if (getUpdates == true || (timeout <= 0)) {
@@ -389,15 +388,15 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
"Could not open package cache.");
return false;
} else {
- pk_backend_set_status (backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
sleep(1);
timeout--;
}
}
- pk_backend_set_status (backend, PK_STATUS_ENUM_RUNNING);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_RUNNING);
- if (pkgDistUpgrade(*Cache) == false) {
- show_broken(backend, Cache, false);
+ if (pkgDistUpgrade(*cache) == false) {
+ show_broken(backend, cache, false);
g_debug ("Internal error, DistUpgrade broke stuff");
delete m_apt;
return false;
@@ -408,15 +407,15 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
PkgList update;
PkgList kept;
- for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin();
+ for (pkgCache::PkgIterator pkg = cache.GetPkgCache()->PkgBegin();
!pkg.end();
++pkg) {
- if ((*Cache)[pkg].Upgrade() == true &&
- (*Cache)[pkg].NewInstall() == false) {
+ if ((*cache)[pkg].Upgrade() == true &&
+ (*cache)[pkg].NewInstall() == false) {
update.push_back(m_apt->findCandidateVer(pkg));
- } else if ((*Cache)[pkg].Upgradable() == true &&
+ } else if ((*cache)[pkg].Upgradable() == true &&
pkg->CurrentVer != 0 &&
- (*Cache)[pkg].Delete() == false) {
+ (*cache)[pkg].Delete() == false) {
kept.push_back(m_apt->findCandidateVer(pkg));
}
}
@@ -426,7 +425,7 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
} else {
// TODO there should be a simulate upgrade system,
// tho afaik Apper and GPK don't use this
- res = m_apt->installPackages(Cache, false);
+ res = m_apt->installPackages(cache, false);
}
delete m_apt;
@@ -484,24 +483,24 @@ static gboolean backend_what_provides_thread(PkBackend *backend)
PkgList output;
if (provides == PK_PROVIDES_ENUM_SHARED_LIB) {
- m_apt->providesLibrary (output, values);
+ m_apt->providesLibrary(output, values);
} else if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
- packages = searchMimeType (backend, values, error, _cancel);
+ packages = searchMimeType(backend, values, error, _cancel);
} else if (provides == PK_PROVIDES_ENUM_CODEC) {
- m_apt->providesCodec (output, values);
+ m_apt->providesCodec(output, values);
} else {
// PK_PROVIDES_ENUM_ANY, just search for everything a package can provide
- m_apt->providesLibrary (output, values);
- m_apt->providesCodec (output, values);
- packages = searchMimeType (backend, values, error, _cancel);
+ m_apt->providesLibrary(output, values);
+ m_apt->providesCodec(output, values);
+ packages = searchMimeType(backend, values, error, _cancel);
}
- for (vector<string>::iterator i = packages.begin();
- i != packages.end(); ++i) {
+ for (vector<string>::iterator it = packages.begin();
+ it != packages.end(); ++it) {
if (_cancel) {
break;
}
- const pkgCache::PkgIterator &pkg = m_apt->packageCache->FindPkg(i->c_str());
+ const pkgCache::PkgIterator &pkg = m_apt->findPackage(*it);
if (pkg.end() == true) {
continue;
}
@@ -515,7 +514,7 @@ static gboolean backend_what_provides_thread(PkBackend *backend)
if (error && provides == PK_PROVIDES_ENUM_MIMETYPE) {
// check if app-install-data is installed
pkgCache::PkgIterator pkg;
- pkg = m_apt->packageCache->FindPkg("app-install-data");
+ pkg = m_apt->findPackage("app-install-data");
if (pkg->CurrentState != pkgCache::State::Installed) {
pk_backend_error_code (backend,
PK_ERROR_ENUM_INTERNAL_ERROR,
@@ -632,12 +631,10 @@ static gboolean pk_backend_download_packages_thread(PkBackend *backend)
}
string storeFileName;
- if (get_archive(&fetcher,
- m_apt->packageSourceList,
- m_apt->packageRecords,
- ver,
- directory,
- storeFileName)) {
+ if (m_apt->getArchive(&fetcher,
+ ver,
+ directory,
+ storeFileName)) {
Stat.addPackage(ver);
}
string destFile = directory + "/" + flNotDir(storeFileName);
@@ -687,7 +684,7 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
return false;
}
- pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_REFRESH_CACHE);
// Lock the list directory
FileFd Lock;
if (_config->FindB("Debug::NoLocking", false) == false) {
@@ -699,16 +696,12 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
// return _error->Error(_("Unable to lock the list directory"));
}
}
- // Create the progress
- AcqPackageKitStatus Stat(m_apt, backend, _cancel);
- // do the work
- ListUpdate(Stat, *m_apt->packageSourceList);
+ m_apt->refreshCache();
// Rebuild the cache.
- pkgCacheFile Cache;
- OpTextProgress Prog(*_config);
- if (Cache.BuildCaches(&Prog, true) == false) {
+ AptCacheFile cache;
+ if (cache.buildCaches(true) == false) {
if (_error->PendingError() == true) {
show_errors(backend, PK_ERROR_ENUM_CANNOT_FETCH_SOURCES, true);
}
@@ -792,12 +785,12 @@ static gboolean pk_backend_search_files_thread(PkBackend *backend)
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
vector<string> packages = search_files(backend, values, _cancel);
PkgList output;
- for(vector<string>::iterator i = packages.begin();
- i != packages.end(); ++i) {
+ for(vector<string>::iterator it = packages.begin();
+ it != packages.end(); ++it) {
if (_cancel) {
break;
}
- const pkgCache::PkgIterator &pkg = m_apt->packageCache->FindPkg(i->c_str());
+ const pkgCache::PkgIterator &pkg = m_apt->findPackage(*it);
if (pkg.end() == true) {
continue;
}
@@ -858,38 +851,10 @@ static gboolean backend_search_groups_thread (PkBackend *backend)
}
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- PkgList output;
- for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- // Ignore virtual packages
- const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
- if (ver.end() == false) {
- string section = pkg.VersionList().Section() == NULL ? "" : pkg.VersionList().Section();
-
- size_t found;
- found = section.find_last_of("/");
- section = section.substr(found + 1);
-
- // Don't insert virtual packages instead add what it provides
- for (vector<PkGroupEnum>::iterator i = groups.begin();
- i != groups.end();
- ++i) {
- if (*i == get_enum_group(section)) {
- output.push_back(ver);
- break;
- }
- }
- }
- }
// It's faster to emmit the packages here rather than in the matching part
+ PkgList output;
+ output = m_apt->getPackagesFromGroup(groups);
m_apt->emit_packages(output, filters);
pk_backend_set_percentage (backend, 100);
@@ -918,11 +883,11 @@ static gboolean backend_search_package_thread(PkBackend *backend)
pk_backend_set_percentage(backend, PK_BACKEND_PERCENTAGE_INVALID);
pk_backend_set_allow_cancel(backend, true);
- Matcher *m_matcher = new Matcher(search);
+ Matcher *matcher = new Matcher(search);
g_free(search);
- if (m_matcher->hasError()) {
+ if (matcher->hasError()) {
g_debug("Regex compilation error");
- delete m_matcher;
+ delete matcher;
pk_backend_finished (backend);
return false;
}
@@ -931,92 +896,30 @@ static gboolean backend_search_package_thread(PkBackend *backend)
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
- delete m_matcher;
+ delete matcher;
delete m_apt;
return false;
}
if (_error->PendingError() == true) {
- delete m_matcher;
+ delete matcher;
delete m_apt;
return false;
}
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
- pkgDepCache::Policy Plcy;
PkgList output;
if (pk_backend_get_bool(backend, "search_details")) {
- for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
- if (ver.end() == false) {
- if (m_matcher->matches(pkg.Name()) ||
- m_matcher->matches(get_long_description(ver, m_apt->packageRecords))) {
- // The package matched
- output.push_back(ver);
- }
- } else if (m_matcher->matches(pkg.Name())) {
- // The package is virtual and MATCHED the name
- // Don't insert virtual packages instead add what it provides
-
- // iterate over the provides list
- for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
- const pkgCache::VerIterator &ownerVer = m_apt->findVer(Prv.OwnerPkg());
-
- // check to see if the provided package isn't virtual too
- if (ownerVer.end() == false) {
- // we add the package now because we will need to
- // remove duplicates later anyway
- output.push_back(ownerVer);
- }
- }
- }
- }
+ output = m_apt->searchPackageDetails(matcher);
} else {
- for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- if (m_matcher->matches(pkg.Name())) {
- // Don't insert virtual packages instead add what it provides
- const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
- if (ver.end() == false) {
- output.push_back(ver);
- } else {
- // iterate over the provides list
- for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
- const pkgCache::VerIterator &ownerVer = m_apt->findVer(Prv.OwnerPkg());
-
- // check to see if the provided package isn't virtual too
- if (ownerVer.end() == false)
- {
- // we add the package now because we will need to
- // remove duplicates later anyway
- output.push_back(ownerVer);
- }
- }
- }
- }
- }
+ output = m_apt->searchPackageName(matcher);
}
// It's faster to emmit the packages here than in the matching part
m_apt->emit_packages(output, filters);
- delete m_matcher;
- pk_backend_set_percentage (backend, 100);
+ delete matcher;
+ pk_backend_set_percentage(backend, 100);
delete m_apt;
return true;
}
@@ -1348,23 +1251,7 @@ static gboolean backend_get_packages_thread(PkBackend *backend)
pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
PkgList output;
- output.reserve(m_apt->packageCache->HeaderP->PackageCount);
- for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin();
- !pkg.end(); ++pkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if(pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- // Don't insert virtual packages as they don't have all kinds of info
- const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
- if (ver.end() == false) {
- output.push_back(ver);
- }
- }
+ output = m_apt->getPackages();
// It's faster to emmit the packages rather here than in the matching part
m_apt->emit_packages(output, filters);
diff --git a/backends/aptcc/pkg_acqfile.cpp b/backends/aptcc/pkg_acqfile.cpp
index 94ffe0b..b8f24e1 100644
--- a/backends/aptcc/pkg_acqfile.cpp
+++ b/backends/aptcc/pkg_acqfile.cpp
@@ -75,86 +75,3 @@ void pkgAcqFileSane::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
Item::Failed(Message,Cnf);
}
-
-// Mostly copied from pkgAcqArchive.
-bool get_archive(pkgAcquire *Owner, pkgSourceList *Sources,
- pkgRecords *Recs, pkgCache::VerIterator const &Version,
- string directory, string &StoreFilename)
-{
- pkgCache::VerFileIterator Vf=Version.FileList();
-
- if (Version.Arch() == 0) {
- return _error->Error("I wasn't able to locate a file for the %s package. "
- "This might mean you need to manually fix this package. (due to missing arch)",
- Version.ParentPkg().Name());
- }
-
- /* We need to find a filename to determine the extension. We make the
- assumption here that all the available sources for this version share
- the same extension.. */
- // Skip not source sources, they do not have file fields.
- for (; Vf.end() == false; Vf++) {
- if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0) {
- continue;
- }
- break;
- }
-
- // Does not really matter here.. we are going to fail out below
- if (Vf.end() != true) {
- // If this fails to get a file name we will bomb out below.
- pkgRecords::Parser &Parse = Recs->Lookup(Vf);
- if (_error->PendingError() == true) {
- return false;
- }
-
- // Generate the final file name as: package_version_arch.foo
- StoreFilename = QuoteString(Version.ParentPkg().Name(),"_:") + '_' +
- QuoteString(Version.VerStr(),"_:") + '_' +
- QuoteString(Version.Arch(),"_:.") +
- "." + flExtension(Parse.FileName());
- }
-
- for (; Vf.end() == false; Vf++) {
- // Ignore not source sources
- if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0) {
- continue;
- }
-
- // Try to cross match against the source list
- pkgIndexFile *Index;
- if (Sources->FindIndex(Vf.File(),Index) == false) {
- continue;
- }
-
- // Grab the text package record
- pkgRecords::Parser &Parse = Recs->Lookup(Vf);
- if (_error->PendingError() == true) {
- return false;
- }
-
- const string PkgFile = Parse.FileName();
- const string MD5 = Parse.MD5Hash();
- if (PkgFile.empty() == true) {
- return _error->Error("The package index files are corrupted. No Filename: "
- "field for package %s.",
- Version.ParentPkg().Name());
- }
-
- string DestFile = directory + "/" + flNotDir(StoreFilename);
-
- // Create the item
- new pkgAcqFile(Owner,
- Index->ArchiveURI(PkgFile),
- MD5,
- Version->Size,
- Index->ArchiveInfo(Version),
- Version.ParentPkg().Name(),
- "",
- DestFile);
-
- Vf++;
- return true;
- }
- return false;
-}
diff --git a/backends/aptcc/pkg_acqfile.h b/backends/aptcc/pkg_acqfile.h
index 01d13cd..3c48a9a 100644
--- a/backends/aptcc/pkg_acqfile.h
+++ b/backends/aptcc/pkg_acqfile.h
@@ -55,11 +55,4 @@ public:
pkgCache::VerIterator version() { return Version; }
};
-/** Like pkgAcqArchive, but uses generic File objects to download to
- * the cwd (and copies from file:/ URLs).
- */
-bool get_archive(pkgAcquire *Owner, pkgSourceList *Sources,
- pkgRecords *Recs, pkgCache::VerIterator const &Version,
- std::string directory, std::string &StoreFilename);
-
#endif
commit 851c7b33506481884ef958f4250dda5dc17d7219
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 15 11:50:12 2012 -0300
aptcc: Add AptCacheFile to handle all pkg cache openings
diff --git a/backends/aptcc/AptCacheFile.cpp b/backends/aptcc/AptCacheFile.cpp
new file mode 100644
index 0000000..17e40cf
--- /dev/null
+++ b/backends/aptcc/AptCacheFile.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012 Daniel Nicoletti <dantti12 at gmail.com>
+ * Copyright (c) 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "AptCacheFile.h"
+
+AptCacheFile::AptCacheFile()
+{
+}
+
+bool AptCacheFile::open(bool withLock)
+{
+ // TODO maybe subclass this to show more info when opening
+ OpTextProgress opTextProgress(*_config);
+ if (pkgCacheFile::Open(&opTextProgress, withLock) == false) {
+ return false;
+ }
+
+ // Generate it and map it
+ // TODO for what we need this???
+// bool Res = pkgMakeStatusCache(GetSourceList(), opTextProgress, &Map, true);
+// Progress.Done();
+// if(!Res) {
+// return false;
+// //"The package lists or status file could not be parsed or opened."
+// }
+
+ // Create the text record parser
+ m_packageRecords = new pkgRecords(*this);
+}
+
+
diff --git a/backends/aptcc/AptCacheFile.h b/backends/aptcc/AptCacheFile.h
new file mode 100644
index 0000000..f782551
--- /dev/null
+++ b/backends/aptcc/AptCacheFile.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012 Daniel Nicoletti <dantti12 at gmail.com>
+ * Copyright (c) 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef APTCACHEFILE_H
+#define APTCACHEFILE_H
+
+#include <apt-pkg/cachefile.h>
+
+class AptCacheFile : public pkgCacheFile
+{
+public:
+ AptCacheFile();
+
+ /**
+ * Inits the package cache returning false if it can't open
+ */
+ bool open(bool withLock = false);
+
+ inline pkgRecords* GetPkgRecords() { BuildDepCache(); return m_packageRecords; }
+
+private:
+ pkgRecords *m_packageRecords;
+};
+
+#endif // APTCACHEFILE_H
diff --git a/backends/aptcc/Makefile.am b/backends/aptcc/Makefile.am
index 0a4f5cd..25b36a5 100644
--- a/backends/aptcc/Makefile.am
+++ b/backends/aptcc/Makefile.am
@@ -13,6 +13,7 @@ libpk_backend_aptcc_la_SOURCES = pkg_acqfile.cpp \
apt-utils.cpp \
apt-sourceslist.cpp \
apt-intf.cpp \
+ AptCacheFile.cpp \
pk-backend-aptcc.cpp
libpk_backend_aptcc_la_LIBADD = -lcrypt -lapt-pkg -lapt-inst $(PK_PLUGIN_LIBS)
libpk_backend_aptcc_la_LDFLAGS = -module -avoid-version $(APTCC_LIBS) $(GSTREAMER_LIBS)
@@ -31,7 +32,7 @@ EXTRA_DIST = 20packagekit \
deb-file.h \
apt-messages.h \
acqpkitstatus.h \
- pkg_dpkgpm.h \
+ AptCacheFile.h \
pkg_acqfile.h
helperdir = $(datadir)/PackageKit/helpers/aptcc
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index bd36613..2a781b5 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -182,14 +182,12 @@ void AptIntf::cancel()
}
}
-pkgCache::VerIterator AptIntf::findPackageId(const gchar *package_id, bool &found)
+pkgCache::VerIterator AptIntf::findPackageId(const gchar *packageId)
{
gchar **parts;
pkgCache::PkgIterator pkg;
- found = true;
-
- parts = pk_package_id_split (package_id);
+ parts = pk_package_id_split(packageId);
gchar *pkgNameArch;
pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
pkg = packageCache->FindPkg(pkgNameArch);
@@ -202,7 +200,7 @@ pkgCache::VerIterator AptIntf::findPackageId(const gchar *package_id, bool &foun
return pkgCache::VerIterator();
}
- const pkgCache::VerIterator &ver = find_ver(pkg);
+ const pkgCache::VerIterator &ver = findVer(pkg);
// check to see if the provided package isn't virtual too
if (ver.end() == false &&
strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0) {
@@ -210,7 +208,7 @@ pkgCache::VerIterator AptIntf::findPackageId(const gchar *package_id, bool &foun
return ver;
}
- const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
+ const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
// check to see if the provided package isn't virtual too
if (candidateVer.end() == false &&
strcmp(candidateVer.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0) {
@@ -218,19 +216,12 @@ pkgCache::VerIterator AptIntf::findPackageId(const gchar *package_id, bool &foun
return candidateVer;
}
- found = false;
g_strfreev (parts);
return ver;
}
-pkgCache::VerIterator AptIntf::find_candidate_ver(const pkgCache::PkgIterator &pkg)
-{
- // get the candidate version iterator
- return (*packageDepCache)[pkg].CandidateVerIter(*packageDepCache);
-}
-
-pkgCache::VerIterator AptIntf::find_ver(const pkgCache::PkgIterator &pkg)
+pkgCache::VerIterator AptIntf::findVer(const pkgCache::PkgIterator &pkg)
{
// if the package is installed return the current version
if (!pkg.CurrentVer().end()) {
@@ -238,7 +229,7 @@ pkgCache::VerIterator AptIntf::find_ver(const pkgCache::PkgIterator &pkg)
}
// Else get the candidate version iterator
- const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
+ const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
if (!candidateVer.end()) {
return candidateVer;
}
@@ -247,6 +238,12 @@ pkgCache::VerIterator AptIntf::find_ver(const pkgCache::PkgIterator &pkg)
return pkg.VersionList();
}
+pkgCache::VerIterator AptIntf::findCandidateVer(const pkgCache::PkgIterator &pkg)
+{
+ // get the candidate version iterator
+ return (*packageDepCache)[pkg].CandidateVerIter(*packageDepCache);
+}
+
bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
{
if (filters != 0) {
@@ -491,9 +488,9 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
// TODO search in updates packages
// Ignore virtual packages
- pkgCache::VerIterator ver = find_ver(pkg);
+ pkgCache::VerIterator ver = findVer(pkg);
if (ver.end() == true) {
- ver = find_candidate_ver(pkg);
+ ver = findCandidateVer(pkg);
if (ver.end() == true) {
continue;
}
@@ -563,9 +560,9 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
}
// TODO: Ignore virtual packages
- pkgCache::VerIterator ver = find_ver (pkg);
+ pkgCache::VerIterator ver = findVer (pkg);
if (ver.end() == true) {
- ver = find_candidate_ver(pkg);
+ ver = findCandidateVer(pkg);
if (ver.end() == true) {
continue;
}
@@ -647,7 +644,7 @@ void AptIntf::emitUpdateDetails(const pkgCache::VerIterator &version)
{
const pkgCache::PkgIterator &pkg = version.ParentPkg();
// Get the version of the current package
- const pkgCache::VerIterator &currver = find_ver(pkg);
+ const pkgCache::VerIterator &currver = findVer(pkg);
const pkgCache::VerFileIterator &currvf = currver.FileList();
// Build a package_id from the current version
gchar *current_package_id;
@@ -661,7 +658,7 @@ void AptIntf::emitUpdateDetails(const pkgCache::VerIterator &version)
if (version.end() == false) {
candver = version;
} else {
- candver = find_candidate_ver(pkg);
+ candver = findCandidateVer(pkg);
}
pkgCache::VerFileIterator vf = candver.FileList();
@@ -904,7 +901,7 @@ void AptIntf::getDepends(PkgList &output,
break;
}
- const pkgCache::VerIterator &ver = find_ver(dep.TargetPkg());
+ const pkgCache::VerIterator &ver = findVer(dep.TargetPkg());
// Ignore packages that exist only due to dependencies.
if (ver.end()) {
dep++;
@@ -941,7 +938,7 @@ void AptIntf::getRequires(PkgList &output,
}
// Don't insert virtual packages instead add what it provides
- const pkgCache::VerIterator &parentVer = find_ver(parentPkg);
+ const pkgCache::VerIterator &parentVer = findVer(parentPkg);
if (parentVer.end() == false) {
PkgList deps;
getDepends(deps, parentVer, false);
@@ -1357,16 +1354,16 @@ void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (Cache[pkg].NewInstall() == true) {
// installing
- installing.push_back(find_candidate_ver(pkg));
+ installing.push_back(findCandidateVer(pkg));
} else if (Cache[pkg].Delete() == true) {
// removing
- removing.push_back(find_ver(pkg));
+ removing.push_back(findVer(pkg));
} else if (Cache[pkg].Upgrade() == true) {
// updating
- updating.push_back(find_candidate_ver(pkg));
+ updating.push_back(findCandidateVer(pkg));
} else if (Cache[pkg].Downgrade() == true) {
// downgrading
- downgrading.push_back(find_candidate_ver(pkg));
+ downgrading.push_back(findCandidateVer(pkg));
}
}
@@ -1382,16 +1379,16 @@ void AptIntf::populateInternalPackages(pkgCacheFile &Cache)
for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (Cache[pkg].NewInstall() == true) {
// installing
- m_pkgs.push_back(find_candidate_ver(pkg));
+ m_pkgs.push_back(findCandidateVer(pkg));
} else if (Cache[pkg].Delete() == true) {
// removing
- m_pkgs.push_back(find_ver(pkg));
+ m_pkgs.push_back(findVer(pkg));
} else if (Cache[pkg].Upgrade() == true) {
// updating
- m_pkgs.push_back(find_candidate_ver(pkg));
+ m_pkgs.push_back(findCandidateVer(pkg));
} else if (Cache[pkg].Downgrade() == true) {
// downgrading
- m_pkgs.push_back(find_candidate_ver(pkg));
+ m_pkgs.push_back(findCandidateVer(pkg));
}
}
}
@@ -1412,13 +1409,13 @@ void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
return;
}
- const pkgCache::VerIterator &ver = find_ver(pkg);
+ const pkgCache::VerIterator &ver = findVer(pkg);
// check to see if the provided package isn't virtual too
if (ver.end() == false) {
emitPackage(ver, PK_FILTER_ENUM_NONE, state);
}
- const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
+ const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
// check to see if we found the package
if (candidateVer.end() == false) {
emitPackage(candidateVer, PK_FILTER_ENUM_NONE, state);
@@ -1791,13 +1788,13 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
continue;
}
- const pkgCache::VerIterator &ver = find_ver(pkg);
+ const pkgCache::VerIterator &ver = findVer(pkg);
// check to see if the provided package isn't virtual too
if (ver.end() == false) {
ret.push_back(ver);
}
- const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
+ const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
// check to see if the provided package isn't virtual too
if (candidateVer.end() == false) {
ret.push_back(candidateVer);
@@ -1810,23 +1807,22 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
continue;
}
- const pkgCache::VerIterator &ver = find_ver(pkg);
+ const pkgCache::VerIterator &ver = findVer(pkg);
// check to see if the provided package isn't virtual too
if (ver.end() == false) {
ret.push_back(ver);
}
- const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
+ const pkgCache::VerIterator &candidateVer = findCandidateVer(pkg);
// check to see if the provided package isn't virtual too
if (candidateVer.end() == false) {
ret.push_back(candidateVer);
}
}
} else {
- bool found;
- const pkgCache::VerIterator &ver = findPackageId(pi, found);
+ const pkgCache::VerIterator &ver = findPackageId(pi);
// check to see if we found the package
- if (found) {
+ if (!ver.end()) {
ret.push_back(ver);
}
}
@@ -2220,7 +2216,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
}
pkgCache::VerIterator ver = Cache[pkg].InstVerIter(Cache);
- if (ver.end() && (ver = find_candidate_ver(pkg))) {
+ if (ver.end() && (ver = findCandidateVer(pkg))) {
// Ignore invalid versions
continue;
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index d4feae1..f373560 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -59,11 +59,25 @@ public:
bool init();
void cancel();
- // Check the returned VerIterator.end()
- // if it's true we could not find it
- pkgCache::VerIterator findPackageId(const gchar *package_id, bool &found);
- pkgCache::VerIterator find_ver(const pkgCache::PkgIterator &pkg);
- pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
+ /**
+ * Tries to find a package with the given packageId
+ * @returns pkgCache::VerIterator that if .end() is true the package could not be found
+ */
+ pkgCache::VerIterator findPackageId(const gchar *packageId);
+
+ /**
+ * Tries to find the current version of a package
+ * if it can't find it will return the candidate
+ * TODO check if we really need the candidate version
+ * @returns pkgCache::VerIterator that if .end() is true the version could not be found
+ */
+ pkgCache::VerIterator findVer(const pkgCache::PkgIterator &pkg);
+
+ /**
+ * Tries to find the candidate version of a package
+ * @returns pkgCache::VerIterator that if .end() is true the version could not be found
+ */
+ pkgCache::VerIterator findCandidateVer(const pkgCache::PkgIterator &pkg);
PkgList resolvePI(gchar **package_ids, PkBitfield filters = PK_FILTER_ENUM_NONE);
bool markFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 2d38dea..f66cdf1 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -30,6 +30,7 @@
#include <pk-backend-spawn.h>
#include "apt-intf.h"
+#include "AptCacheFile.h"
#include "apt-utils.h"
#include "matcher.h"
#include "apt-messages.h"
@@ -178,7 +179,7 @@ static gboolean backend_get_depends_or_requires_thread(PkBackend *backend)
bool depends = pk_backend_get_bool(backend, "get_depends");
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
PkgList output;
for (uint i = 0; i < g_strv_length(package_ids); ++i) {
if (_cancel) {
@@ -193,9 +194,8 @@ static gboolean backend_get_depends_or_requires_thread(PkBackend *backend)
return false;
}
- bool found;
- const pkgCache::VerIterator &ver = m_apt->findPackageId(pi, found);
- if (!found) {
+ const pkgCache::VerIterator &ver = m_apt->findPackageId(pi);
+ if (ver.end()) {
pk_backend_error_code (backend,
PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
"Couldn't find package");
@@ -278,9 +278,8 @@ static gboolean backend_get_files_thread(PkBackend *backend)
return false;
}
- bool found;
- m_apt->findPackageId(pi, found);
- if (!found) {
+ const pkgCache::VerIterator &ver = m_apt->findPackageId(pi);
+ if (ver.end()) {
pk_backend_error_code(backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "Couldn't find package");
delete m_apt;
return false;
@@ -414,11 +413,11 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
++pkg) {
if ((*Cache)[pkg].Upgrade() == true &&
(*Cache)[pkg].NewInstall() == false) {
- update.push_back(m_apt->find_candidate_ver(pkg));
+ update.push_back(m_apt->findCandidateVer(pkg));
} else if ((*Cache)[pkg].Upgradable() == true &&
pkg->CurrentVer != 0 &&
(*Cache)[pkg].Delete() == false) {
- kept.push_back(m_apt->find_candidate_ver(pkg));
+ kept.push_back(m_apt->findCandidateVer(pkg));
}
}
@@ -506,7 +505,7 @@ static gboolean backend_what_provides_thread(PkBackend *backend)
if (pkg.end() == true) {
continue;
}
- const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
if (ver.end() == true) {
continue;
}
@@ -619,10 +618,9 @@ static gboolean pk_backend_download_packages_thread(PkBackend *backend)
break;
}
- bool found;
- const pkgCache::VerIterator &ver = m_apt->findPackageId(pi, found);
+ const pkgCache::VerIterator &ver = m_apt->findPackageId(pi);
// Ignore packages that could not be found or that exist only due to dependencies.
- if (!found) {
+ if (ver.end()) {
_error->Error("Can't find this package id \"%s\".", pi);
continue;
} else {
@@ -803,7 +801,7 @@ static gboolean pk_backend_search_files_thread(PkBackend *backend)
if (pkg.end() == true) {
continue;
}
- const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
if (ver.end() == true) {
continue;
}
@@ -871,7 +869,7 @@ static gboolean backend_search_groups_thread (PkBackend *backend)
}
// Ignore virtual packages
- const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
if (ver.end() == false) {
string section = pkg.VersionList().Section() == NULL ? "" : pkg.VersionList().Section();
@@ -957,7 +955,7 @@ static gboolean backend_search_package_thread(PkBackend *backend)
continue;
}
- const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
if (ver.end() == false) {
if (m_matcher->matches(pkg.Name()) ||
m_matcher->matches(get_long_description(ver, m_apt->packageRecords))) {
@@ -970,7 +968,7 @@ static gboolean backend_search_package_thread(PkBackend *backend)
// iterate over the provides list
for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
- const pkgCache::VerIterator &ownerVer = m_apt->find_ver(Prv.OwnerPkg());
+ const pkgCache::VerIterator &ownerVer = m_apt->findVer(Prv.OwnerPkg());
// check to see if the provided package isn't virtual too
if (ownerVer.end() == false) {
@@ -993,13 +991,13 @@ static gboolean backend_search_package_thread(PkBackend *backend)
if (m_matcher->matches(pkg.Name())) {
// Don't insert virtual packages instead add what it provides
- const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
if (ver.end() == false) {
output.push_back(ver);
} else {
// iterate over the provides list
for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
- const pkgCache::VerIterator &ownerVer = m_apt->find_ver(Prv.OwnerPkg());
+ const pkgCache::VerIterator &ownerVer = m_apt->findVer(Prv.OwnerPkg());
// check to see if the provided package isn't virtual too
if (ownerVer.end() == false)
@@ -1362,7 +1360,7 @@ static gboolean backend_get_packages_thread(PkBackend *backend)
}
// Don't insert virtual packages as they don't have all kinds of info
- const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->findVer(pkg);
if (ver.end() == false) {
output.push_back(ver);
}
commit cfe98c7ac7033feafa2fb4bc5e73b36fb9c2d188
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Sun Apr 15 16:44:06 2012 +0200
aptcc: Fix SUPPORTED check and component-finding code
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index ea91abd..bd36613 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -269,12 +269,16 @@ bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
}
std::string str = ver.Section() == NULL ? "" : ver.Section();
- std::string section, repo_section;
+ std::string section, component;
size_t found;
found = str.find_last_of("/");
section = str.substr(found + 1);
- repo_section = str.substr(0, found);
+ if(found == str.npos) {
+ component = "main";
+ } else {
+ component = str.substr(0, found);
+ }
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_INSTALLED) && installed) {
return false;
@@ -318,31 +322,31 @@ bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
// TODO add Ubuntu handling
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_FREE)) {
- if (!repo_section.compare("contrib") ||
- !repo_section.compare("non-free")) {
+ if (!component.compare("contrib") ||
+ !component.compare("non-free")) {
return false;
}
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_FREE)) {
- if (repo_section.compare("contrib") &&
- repo_section.compare("non-free")) {
+ if (component.compare("contrib") &&
+ component.compare("non-free")) {
return false;
}
}
// Check for supported packages
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_SUPPORTED)) {
- return packageIsSupported(pkg);
+ return packageIsSupported(pkg, component);
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_SUPPORTED)) {
- return !packageIsSupported(pkg);
+ return !packageIsSupported(pkg, component);
}
// TODO test this one..
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_COLLECTIONS)) {
- if (!repo_section.compare("metapackages")) {
+ if (!component.compare("metapackages")) {
return false;
}
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_COLLECTIONS)) {
- if (repo_section.compare("metapackages")) {
+ if (component.compare("metapackages")) {
return false;
}
}
@@ -909,12 +913,12 @@ void AptIntf::getDepends(PkgList &output,
if (recursive) {
if (!contains(output, dep.TargetPkg())) {
// TODO is this still working
-// output.push_back(PkgPair(dep.TargetPkg(), ver));
+ // output.push_back(PkgPair(dep.TargetPkg(), ver));
output.push_back(ver);
getDepends(output, ver, recursive);
}
} else {
-// output.push_back(PkgPair(dep.TargetPkg(), ver));
+ // output.push_back(PkgPair(dep.TargetPkg(), ver));
output.push_back(ver);
}
}
@@ -942,16 +946,16 @@ void AptIntf::getRequires(PkgList &output,
PkgList deps;
getDepends(deps, parentVer, false);
for (PkgList::iterator it = deps.begin(); it != deps.end(); ++it) {
-// if (i->ParentPkg() == ver) { TODO make sure this works!!!!
+ // if (i->ParentPkg() == ver) { TODO make sure this works!!!!
if (*it == ver) {
if (recursive) {
if (!contains(output, parentPkg)) {
-// output.push_back(PkgPair(parentPkg, ver));
+ // output.push_back(PkgPair(parentPkg, ver));
output.push_back(parentVer);
getRequires(output, parentVer, recursive);
}
} else {
-// output.push_back(PkgPair(parentPkg, ver));
+ // output.push_back(PkgPair(parentPkg, ver));
output.push_back(parentVer);
}
break;
@@ -1133,20 +1137,17 @@ void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
/**
* Check if package is officially supported by the current distribution
*/
-bool AptIntf::packageIsSupported(const pkgCache::PkgIterator &pkgIter)
+bool AptIntf::packageIsSupported(const pkgCache::PkgIterator &pkgIter, string component)
{
const pkgCache::VerIterator &verIter = pkgIter.VersionList();
- string origin = "";
+ string origin;
if(!verIter.end()) {
- pkgCache::VerFileIterator VF = verIter.FileList();
- origin = VF.File().Origin();
+ pkgCache::VerFileIterator vf = verIter.FileList();
+ origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
}
- string str = verIter.Section() == NULL ? "" : verIter.Section();
- size_t j = str.find_last_of("/");
- string section = str.substr(j + 1);
- if (section == "")
- section = "main";
+ if (component.empty())
+ component = "main";
// Get a fetcher
AcqPackageKitStatus Stat(this, m_backend, _cancel);
@@ -1156,9 +1157,11 @@ bool AptIntf::packageIsSupported(const pkgCache::PkgIterator &pkgIter)
bool trusted = checkTrusted(fetcher, false);
- if ((origin == "Debian") || (origin == "Ubuntu")) {
- if ((section == "main" ||
- section == "restricted") && trusted) {
+ if ((origin.compare ("Debian") == 0) || (origin.compare ("Ubuntu") == 0)) {
+ if ((component.compare ("main") == 0 ||
+ component.compare ("restricted") == 0 ||
+ component.compare ("unstable") == 0 ||
+ component.compare ("testing") == 0) && trusted) {
return true;
}
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index a553992..d4feae1 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -164,7 +164,7 @@ private:
bool &_cancel;
bool checkTrusted(pkgAcquire &fetcher, bool simulating);
- bool packageIsSupported(const pkgCache::PkgIterator &pkgIter);
+ bool packageIsSupported(const pkgCache::PkgIterator &pkgIter, string component);
bool tryToInstall(const pkgCache::PkgIterator &constPkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
commit c9c72949e6fbae0d22fa60a8709dfdc600aba2d7
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sun Apr 15 02:11:20 2012 -0300
aptcc: When on multiarch some packages that should have the :arch appended to the installed list files aren't present so check if the :arch file exist and if not fallback to the old behavior
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index bc84327..ea91abd 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1095,6 +1095,12 @@ void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
":" +
string(parts[PK_PACKAGE_ID_ARCH]) +
".list";
+ if (!FileExists(fName)) {
+ // if the file was not found try without the arch field
+ fName = "/var/lib/dpkg/info/" +
+ string(parts[PK_PACKAGE_ID_NAME]) +
+ ".list";
+ }
} else {
fName = "/var/lib/dpkg/info/" +
string(parts[PK_PACKAGE_ID_NAME]) +
commit f60d34b7b1da681f2838d70b67597b0a63e6a283
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Sat Apr 14 18:23:05 2012 +0200
aptcc: Don't emit error if repo is empty
Closes LP: #879938
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index db67aa8..bc84327 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -248,7 +248,7 @@ pkgCache::VerIterator AptIntf::find_ver(const pkgCache::PkgIterator &pkg)
}
bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
-{
+{
if (filters != 0) {
const pkgCache::PkgIterator &pkg = ver.ParentPkg();
bool installed = false;
@@ -257,7 +257,7 @@ bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
installed = true;
}
-
+
// if we are on multiarch check also the arch filter
if (m_isMultiArch && pk_bitfield_contain(filters, PK_FILTER_ENUM_ARCH)/* && !installed*/) {
// don't emit the package if it does not match
@@ -270,12 +270,12 @@ bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
std::string str = ver.Section() == NULL ? "" : ver.Section();
std::string section, repo_section;
-
+
size_t found;
found = str.find_last_of("/");
section = str.substr(found + 1);
repo_section = str.substr(0, found);
-
+
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_INSTALLED) && installed) {
return false;
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_INSTALLED) && !installed) {
diff --git a/backends/aptcc/apt-messages.cpp b/backends/aptcc/apt-messages.cpp
index 3363857..c02bfcd 100644
--- a/backends/aptcc/apt-messages.cpp
+++ b/backends/aptcc/apt-messages.cpp
@@ -28,23 +28,39 @@
using namespace std;
-bool show_errors(PkBackend *backend, PkErrorEnum errorCode)
+bool show_errors(PkBackend *backend, PkErrorEnum errorCode, bool errModify)
{
stringstream errors;
+ stringstream messages;
+
+ PkMessageEnum messageCode = PK_MESSAGE_ENUM_UNKNOWN;
+ if (errorCode == PK_ERROR_ENUM_CANNOT_FETCH_SOURCES)
+ messageCode = PK_MESSAGE_ENUM_REPO_METADATA_DOWNLOAD_FAILED;
string Err;
while (_error->empty() == false) {
bool Type = _error->PopMessage(Err);
- if (Type == true) {
- errors << "E: " << Err << endl;
+
+ // Ugly workaround to demote the "repo not found" error message to a simple message
+ if ((errModify) && (Err.find("404 Not Found") != string::npos)) {
+ messages << "E: " << Err << endl;
} else {
- errors << "W: " << Err << endl;
+ if (Type == true) {
+ errors << "E: " << Err << endl;
+ } else {
+ errors << "W: " << Err << endl;
+ }
}
}
if (!errors.str().empty()) {
pk_backend_error_code(backend, errorCode, errors.str().c_str());
}
+
+ if ((errModify) && (!messages.str().empty())) {
+ cout << "Emitting backend message:" << messages.str() << endl;
+ pk_backend_message(backend, messageCode, messages.str().c_str());
+ }
}
bool show_warnings(PkBackend *backend, PkMessageEnum message)
diff --git a/backends/aptcc/apt-messages.h b/backends/aptcc/apt-messages.h
index 95666f3..8c49988 100644
--- a/backends/aptcc/apt-messages.h
+++ b/backends/aptcc/apt-messages.h
@@ -33,7 +33,8 @@
* Call the Packagekit error dialog
*/
bool show_errors(PkBackend *backend,
- PkErrorEnum errorCode = PK_ERROR_ENUM_UNKNOWN);
+ PkErrorEnum errorCode = PK_ERROR_ENUM_UNKNOWN,
+ bool errModify = false);
/**
* Call the Packagekit message dialog
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index e6d51c6..2d38dea 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -712,7 +712,7 @@ static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
OpTextProgress Prog(*_config);
if (Cache.BuildCaches(&Prog, true) == false) {
if (_error->PendingError() == true) {
- show_errors(backend, PK_ERROR_ENUM_CANNOT_FETCH_SOURCES);
+ show_errors(backend, PK_ERROR_ENUM_CANNOT_FETCH_SOURCES, true);
}
delete m_apt;
return false;
commit d7830866a5ec17cacfafd680f431f47fa73975d5
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Sat Apr 14 17:30:26 2012 +0200
aptcc: Implement SUPPORTED support
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index a5ef7df..db67aa8 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -329,6 +329,13 @@ bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
}
}
+ // Check for supported packages
+ if (pk_bitfield_contain(filters, PK_FILTER_ENUM_SUPPORTED)) {
+ return packageIsSupported(pkg);
+ } else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_SUPPORTED)) {
+ return !packageIsSupported(pkg);
+ }
+
// TODO test this one..
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_COLLECTIONS)) {
if (!repo_section.compare("metapackages")) {
@@ -1117,6 +1124,42 @@ void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
}
}
+/**
+ * Check if package is officially supported by the current distribution
+ */
+bool AptIntf::packageIsSupported(const pkgCache::PkgIterator &pkgIter)
+{
+ const pkgCache::VerIterator &verIter = pkgIter.VersionList();
+ string origin = "";
+ if(!verIter.end()) {
+ pkgCache::VerFileIterator VF = verIter.FileList();
+ origin = VF.File().Origin();
+ }
+
+ string str = verIter.Section() == NULL ? "" : verIter.Section();
+ size_t j = str.find_last_of("/");
+ string section = str.substr(j + 1);
+ if (section == "")
+ section = "main";
+
+ // Get a fetcher
+ AcqPackageKitStatus Stat(this, m_backend, _cancel);
+ Stat.addPackage(verIter);
+ pkgAcquire fetcher;
+ fetcher.Setup(&Stat);
+
+ bool trusted = checkTrusted(fetcher, false);
+
+ if ((origin == "Debian") || (origin == "Ubuntu")) {
+ if ((section == "main" ||
+ section == "restricted") && trusted) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
bool AptIntf::checkTrusted(pkgAcquire &fetcher, bool simulating)
{
string UntrustedList;
@@ -1153,7 +1196,7 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher, bool simulating)
return false;
}
-bool AptIntf::TryToInstall(const pkgCache::PkgIterator &constPkg,
+bool AptIntf::tryToInstall(const pkgCache::PkgIterator &constPkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
bool Remove,
@@ -1654,7 +1697,7 @@ void AptIntf::updateInterface(int fd, int writeFd)
*
* Remove unused automatic packages
*/
-bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
+bool AptIntf::doAutomaticRemove(pkgCacheFile &Cache)
{
bool doAutoRemove;
if (pk_backend_get_bool(m_backend, "autoremove")) {
@@ -2022,7 +2065,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
break;
}
- if (TryToInstall(it->ParentPkg(),
+ if (tryToInstall(it->ParentPkg(),
Cache,
Fix,
false, // remove
@@ -2041,7 +2084,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
break;
}
- if (TryToInstall(it->ParentPkg(),
+ if (tryToInstall(it->ParentPkg(),
Cache,
Fix,
true, // remove
@@ -2080,7 +2123,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
{
// Try to auto-remove packages
- if (!DoAutomaticRemove(Cache)) {
+ if (!doAutomaticRemove(Cache)) {
// TODO
return false;
}
@@ -2184,7 +2227,6 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
if (DebBytes != Cache->DebSize()) {
cout << DebBytes << ',' << Cache->DebSize() << endl;
cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
- /* _error->Warning("How odd.. The sizes didn't match, email apt at packages.debian.org");*/
}
// Number of bytes
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index e8c85b0..a553992 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -164,7 +164,8 @@ private:
bool &_cancel;
bool checkTrusted(pkgAcquire &fetcher, bool simulating);
- bool TryToInstall(const pkgCache::PkgIterator &constPkg,
+ bool packageIsSupported(const pkgCache::PkgIterator &pkgIter);
+ bool tryToInstall(const pkgCache::PkgIterator &constPkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
bool Remove,
@@ -175,7 +176,7 @@ private:
* interprets dpkg status fd
*/
void updateInterface(int readFd, int writeFd);
- bool DoAutomaticRemove(pkgCacheFile &Cache);
+ bool doAutomaticRemove(pkgCacheFile &Cache);
void emitChangedPackages(pkgCacheFile &Cache);
bool removingEssentialPackages(pkgCacheFile &Cache);
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index e55e859..e6d51c6 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -54,7 +54,7 @@ gchar* pk_backend_get_description(PkBackend *backend)
*/
gchar* pk_backend_get_author(PkBackend *backend)
{
- return g_strdup ("Daniel Nicoletti <dantti85-pk at yahoo.com.br>");
+ return g_strdup ("Daniel Nicoletti <dantti12 at gmail.com>");
}
/**
@@ -124,6 +124,7 @@ PkBitfield pk_backend_get_filters(PkBackend *backend)
PK_FILTER_ENUM_GUI,
PK_FILTER_ENUM_INSTALLED,
PK_FILTER_ENUM_DEVELOPMENT,
+ PK_FILTER_ENUM_SUPPORTED,
PK_FILTER_ENUM_FREE,
-1);
commit d5f576c34dd53ad6147e19a1975fbb63e7d74c2f
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Sat Apr 14 14:44:06 2012 +0200
trivial: Correct mistakes from previous commit
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 636e7f4..a5ef7df 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1117,7 +1117,7 @@ void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
}
}
-bool AptIntf::checkTrusted(pkgAcquire &fetcher)
+bool AptIntf::checkTrusted(pkgAcquire &fetcher, bool simulating)
{
string UntrustedList;
PkgList untrusted;
@@ -1134,7 +1134,7 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher)
if (untrusted.empty()) {
return true;
- } else {
+ } else if (simulating) {
emit_packages(untrusted, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UNTRUSTED);
}
@@ -1653,7 +1653,7 @@ void AptIntf::updateInterface(int fd, int writeFd)
* DoAutomaticRemove - Remove all automatic unused packages
*
* Remove unused automatic packages
-*/
+ */
bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
{
bool doAutoRemove;
@@ -2228,7 +2228,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
}
}
- if ((simulating) && (!checkTrusted(fetcher))) {
+ if ((!checkTrusted(fetcher, simulating)) && (!simulating)) {
return false;
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index f23fec1..e8c85b0 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -163,7 +163,7 @@ private:
PkBackend *m_backend;
bool &_cancel;
- bool checkTrusted(pkgAcquire &fetcher);
+ bool checkTrusted(pkgAcquire &fetcher, bool simulating);
bool TryToInstall(const pkgCache::PkgIterator &constPkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
commit ebf0153aa8ef019efa08e1a69dfe91d6f83ce733
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Sat Apr 14 14:30:33 2012 +0200
aptcc: Simplify code for checking trusted packages
Trivial change.
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index e70a340..636e7f4 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1117,7 +1117,7 @@ void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
}
}
-bool AptIntf::checkTrusted(pkgAcquire &fetcher, bool simulating)
+bool AptIntf::checkTrusted(pkgAcquire &fetcher)
{
string UntrustedList;
PkgList untrusted;
@@ -1134,9 +1134,7 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher, bool simulating)
if (untrusted.empty()) {
return true;
- } else if (simulating) {
- // TODO does it make sense to emit packages
- // when not simulating?
+ } else {
emit_packages(untrusted, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UNTRUSTED);
}
@@ -1293,9 +1291,9 @@ bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
return false;
}
-// emitChangedPackages - Show packages to newly install
-// ---------------------------------------------------------------------
-/* */
+/**
+ * emitChangedPackages - Show packages to newly install
+ */
void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
{
PkgList installing;
@@ -1651,9 +1649,11 @@ void AptIntf::updateInterface(int fd, int writeFd)
usleep(5000);
}
-// DoAutomaticRemove - Remove all automatic unused packages
-// ---------------------------------------------------------------------
-/* Remove unused automatic packages */
+/**
+ * DoAutomaticRemove - Remove all automatic unused packages
+ *
+ * Remove unused automatic packages
+*/
bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
{
bool doAutoRemove;
@@ -2071,10 +2071,12 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
return installPackages(Cache, simulate);
}
-// InstallPackages - Download and install the packages
-// ---------------------------------------------------------------------
-/* This displays the informative messages describing what is going to
- happen and then calls the download routines */
+/**
+ * InstallPackages - Download and install the packages
+ *
+ * This displays the informative messages describing what is going to
+ * happen and then calls the download routines
+ */
bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
{
// Try to auto-remove packages
@@ -2226,7 +2228,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
}
}
- if (!checkTrusted(fetcher, simulating) && !simulating) {
+ if ((simulating) && (!checkTrusted(fetcher))) {
return false;
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index e8c85b0..f23fec1 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -163,7 +163,7 @@ private:
PkBackend *m_backend;
bool &_cancel;
- bool checkTrusted(pkgAcquire &fetcher, bool simulating);
+ bool checkTrusted(pkgAcquire &fetcher);
bool TryToInstall(const pkgCache::PkgIterator &constPkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
commit e35edab6d36269ffd57371a7a1e18089dc743fcf
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sat Apr 14 09:14:17 2012 -0300
aptcc: Don't emit untrusted packages when we are not simulating
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 81566b1..e70a340 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1117,7 +1117,7 @@ void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
}
}
-bool AptIntf::checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
+bool AptIntf::checkTrusted(pkgAcquire &fetcher, bool simulating)
{
string UntrustedList;
PkgList untrusted;
@@ -1134,13 +1134,13 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
if (untrusted.empty()) {
return true;
- } else {
+ } else if (simulating) {
// TODO does it make sense to emit packages
// when not simulating?
emit_packages(untrusted, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UNTRUSTED);
}
- if (pk_backend_get_bool(backend, "only_trusted") == false ||
+ if (pk_backend_get_bool(m_backend, "only_trusted") == false ||
_config->FindB("APT::Get::AllowUnauthenticated", false) == true) {
g_debug ("Authentication warning overridden.\n");
return true;
@@ -1148,7 +1148,7 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
string warning("The following packages cannot be authenticated:\n");
warning += UntrustedList;
- pk_backend_error_code(backend,
+ pk_backend_error_code(m_backend,
PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED,
warning.c_str());
_error->Discard();
@@ -2226,7 +2226,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
}
}
- if (!checkTrusted(fetcher, m_backend) && !simulating) {
+ if (!checkTrusted(fetcher, simulating) && !simulating) {
return false;
}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 15cf8ee..e8c85b0 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -163,7 +163,7 @@ private:
PkBackend *m_backend;
bool &_cancel;
- bool checkTrusted(pkgAcquire &fetcher, PkBackend *backend);
+ bool checkTrusted(pkgAcquire &fetcher, bool simulating);
bool TryToInstall(const pkgCache::PkgIterator &constPkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
commit 2bb0ed3633dbfa1dd69d1acfff557fd6075725e5
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sat Apr 14 08:40:32 2012 -0300
aptcc: Fix INSTALLED filter
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 77c2028..81566b1 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -255,7 +255,7 @@ bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
// Check if the package is installed
if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
- installed = false;
+ installed = true;
}
// if we are on multiarch check also the arch filter
@@ -363,6 +363,11 @@ void AptIntf::emitPackage(const pkgCache::VerIterator &ver,
PkBitfield filters,
PkInfoEnum state)
{
+ // Check if the filters match the package
+ if (!matchPackage(ver, filters)) {
+ return;
+ }
+
const pkgCache::PkgIterator &pkg = ver.ParentPkg();
// check the state enum to see if it was not set.
@@ -375,11 +380,6 @@ void AptIntf::emitPackage(const pkgCache::VerIterator &ver,
}
}
- // Check if the filters match the package
- if (!matchPackage(ver, filters)) {
- return;
- }
-
pkgCache::VerFileIterator vf = ver.FileList();
gchar *package_id;
@@ -407,12 +407,12 @@ void AptIntf::emit_packages(PkgList &output,
result_equality()),
output.end());
- for (PkgList::iterator i = output.begin(); i != output.end(); ++i) {
+ for (PkgList::iterator it = output.begin(); it != output.end(); ++it) {
if (_cancel) {
break;
}
- emitPackage(*i, filters, state);
+ emitPackage(*it, filters, state);
}
}
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 80c1b27..e55e859 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -1347,7 +1347,7 @@ static gboolean backend_get_packages_thread(PkBackend *backend)
return false;
}
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
PkgList output;
output.reserve(m_apt->packageCache->HeaderP->PackageCount);
for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin();
commit 9afd0c563fd36cf49eb94b6227a27ba86e85cc4f
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sat Apr 14 02:17:55 2012 -0300
aptcc: Managed to get rid of pair container it should become faster but needs testing, seems that the packages emitted in simulate aren't ok
diff --git a/backends/aptcc/acqpkitstatus.cpp b/backends/aptcc/acqpkitstatus.cpp
index 262bc60..4a5fc66 100644
--- a/backends/aptcc/acqpkitstatus.cpp
+++ b/backends/aptcc/acqpkitstatus.cpp
@@ -232,9 +232,9 @@ bool AcqPackageKitStatus::MediaChange(string Media, string Drive)
}
-void AcqPackageKitStatus::addPackagePair(PkgPair packagePair)
+void AcqPackageKitStatus::addPackage(const pkgCache::VerIterator &ver)
{
- packages.push_back(packagePair);
+ packages.push_back(ver);
}
void AcqPackageKitStatus::emit_package(const string &name, bool finished)
@@ -247,10 +247,10 @@ void AcqPackageKitStatus::emit_package(const string &name, bool finished)
}
// try to see if any package matches
- if (name.compare(it->first.Name()) == 0) {
- m_apt->emit_package(*it,
- PK_INFO_ENUM_UNKNOWN,
- finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
+ if (name.compare(it->ParentPkg().Name()) == 0) {
+ m_apt->emitPackage(*it,
+ PK_INFO_ENUM_UNKNOWN,
+ finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
last_package_name = name;
// Find the downloading item
diff --git a/backends/aptcc/acqpkitstatus.h b/backends/aptcc/acqpkitstatus.h
index 4e01886..b338809 100644
--- a/backends/aptcc/acqpkitstatus.h
+++ b/backends/aptcc/acqpkitstatus.h
@@ -41,7 +41,7 @@ public:
bool Pulse(pkgAcquire *Owner);
- void addPackagePair(PkgPair packagePair);
+ void addPackage(const pkgCache::VerIterator &ver);
private:
PkBackend *m_backend;
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 7b8bd52..77c2028 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -182,49 +182,46 @@ void AptIntf::cancel()
}
}
-PkgPair AptIntf::find_package_id(const gchar *package_id, bool &found)
+pkgCache::VerIterator AptIntf::findPackageId(const gchar *package_id, bool &found)
{
gchar **parts;
- pkgCache::VerIterator ver;
- PkgPair pkg_ver;
+ pkgCache::PkgIterator pkg;
found = true;
parts = pk_package_id_split (package_id);
gchar *pkgNameArch;
pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
- pkg_ver.first = packageCache->FindPkg(pkgNameArch);
+ pkg = packageCache->FindPkg(pkgNameArch);
g_free(pkgNameArch);
// Ignore packages that could not be found or that exist only due to dependencies.
- if (pkg_ver.first.end() == true ||
- (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end())) {
+ if (pkg.end() == true ||
+ (pkg.VersionList().end() && pkg.ProvidesList().end())) {
g_strfreev(parts);
- return pkg_ver;
+ return pkgCache::VerIterator();
}
- ver = find_ver(pkg_ver.first);
+ const pkgCache::VerIterator &ver = find_ver(pkg);
// check to see if the provided package isn't virtual too
if (ver.end() == false &&
strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0) {
g_strfreev(parts);
- pkg_ver.second = ver;
- return pkg_ver;
+ return ver;
}
- ver = find_candidate_ver(pkg_ver.first);
+ const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
// check to see if the provided package isn't virtual too
- if (ver.end() == false &&
- strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0) {
+ if (candidateVer.end() == false &&
+ strcmp(candidateVer.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0) {
g_strfreev(parts);
- pkg_ver.second = ver;
- return pkg_ver;
+ return candidateVer;
}
found = false;
g_strfreev (parts);
- return pkg_ver;
+ return ver;
}
pkgCache::VerIterator AptIntf::find_candidate_ver(const pkgCache::PkgIterator &pkg)
@@ -236,25 +233,24 @@ pkgCache::VerIterator AptIntf::find_candidate_ver(const pkgCache::PkgIterator &p
pkgCache::VerIterator AptIntf::find_ver(const pkgCache::PkgIterator &pkg)
{
// if the package is installed return the current version
- if(!pkg.CurrentVer().end()) {
+ if (!pkg.CurrentVer().end()) {
return pkg.CurrentVer();
}
// Else get the candidate version iterator
- pkgCache::VerIterator candver = find_candidate_ver(pkg);
- if(!candver.end()) {
- return candver;
+ const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
+ if (!candidateVer.end()) {
+ return candidateVer;
}
// return the version list as a last resource
return pkg.VersionList();
}
-bool AptIntf::matchPackage(const PkgPair &pair, PkBitfield filters)
+bool AptIntf::matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters)
{
if (filters != 0) {
- const pkgCache::PkgIterator &pkg = pair.first;
- const pkgCache::VerIterator &ver = pair.second;
+ const pkgCache::PkgIterator &pkg = ver.ParentPkg();
bool installed = false;
// Check if the package is installed
@@ -363,12 +359,11 @@ PkgList AptIntf::filterPackages(PkgList &packages, PkBitfield filters)
}
// used to emit packages it collects all the needed info
-void AptIntf::emit_package(const PkgPair &pair,
- PkBitfield filters,
- PkInfoEnum state)
+void AptIntf::emitPackage(const pkgCache::VerIterator &ver,
+ PkBitfield filters,
+ PkInfoEnum state)
{
- const pkgCache::PkgIterator &pkg = pair.first;
- const pkgCache::VerIterator &ver = pair.second;
+ const pkgCache::PkgIterator &pkg = ver.ParentPkg();
// check the state enum to see if it was not set.
if (state == PK_INFO_ENUM_UNKNOWN) {
@@ -381,7 +376,7 @@ void AptIntf::emit_package(const PkgPair &pair,
}
// Check if the filters match the package
- if (!matchPackage(pair, filters)) {
+ if (!matchPackage(ver, filters)) {
return;
}
@@ -417,7 +412,7 @@ void AptIntf::emit_packages(PkgList &output,
break;
}
- emit_package(*i, filters, state);
+ emitPackage(*i, filters, state);
}
}
@@ -441,7 +436,7 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
state = PK_INFO_ENUM_NORMAL;
// let find what kind of upgrade this is
- pkgCache::VerFileIterator vf = i->second.FileList();
+ pkgCache::VerFileIterator vf = i->FileList();
std::string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
std::string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
std::string label = vf.File().Label() == NULL ? "" : vf.File().Label();
@@ -460,7 +455,7 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
state = PK_INFO_ENUM_ENHANCEMENT;
}
- emit_package(*i, filters, state);
+ emitPackage(*i, filters, state);
}
}
@@ -499,7 +494,7 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
rec.GetRec(start, stop);
string record(start, stop - start);
if (matcher->matches(record)) {
- output.push_back(PkgPair(pkg, ver));
+ output.push_back(ver);
}
}
@@ -569,7 +564,7 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
std::transform(libPkgName.begin(), libPkgName.end(), libPkgName.begin(), ::tolower);
if (g_strcmp0 (pkg.Name (), libPkgName.c_str ()) == 0) {
- output.push_back(PkgPair(pkg, ver));
+ output.push_back(ver);
}
}
} else {
@@ -579,13 +574,11 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
}
// used to emit packages it collects all the needed info
-void AptIntf::emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
+void AptIntf::emitDetails(const pkgCache::VerIterator &ver)
{
- pkgCache::VerIterator ver;
- if (version.end() == false) {
- ver = version;
- } else {
- ver = find_ver(pkg);
+ const pkgCache::PkgIterator &pkg = ver.ParentPkg();
+ if (ver.end() == true) {
+ return;
}
std::string section = ver.Section() == NULL ? "" : ver.Section();
@@ -634,16 +627,17 @@ void AptIntf::emitDetails(PkgList &pkgs)
break;
}
- emitDetails(i->first, i->second);
+ emitDetails(*i);
}
}
// used to emit packages it collects all the needed info
-void AptIntf::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
+void AptIntf::emitUpdateDetails(const pkgCache::VerIterator &version)
{
+ const pkgCache::PkgIterator &pkg = version.ParentPkg();
// Get the version of the current package
- pkgCache::VerIterator currver = find_ver(pkg);
- pkgCache::VerFileIterator currvf = currver.FileList();
+ const pkgCache::VerIterator &currver = find_ver(pkg);
+ const pkgCache::VerFileIterator &currvf = currver.FileList();
// Build a package_id from the current version
gchar *current_package_id;
current_package_id = pk_package_id_build(pkg.Name(),
@@ -885,21 +879,21 @@ void AptIntf::emitUpdateDetails(PkgList &pkgs)
break;
}
- emitUpdateDetails(i->first, i->second);
+ emitUpdateDetails(*i);
}
}
-void AptIntf::get_depends(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive)
+void AptIntf::getDepends(PkgList &output,
+ const pkgCache::VerIterator &ver,
+ bool recursive)
{
- pkgCache::DepIterator dep = find_ver(pkg).DependsList();
+ pkgCache::DepIterator dep = ver.DependsList();
while (!dep.end()) {
if (_cancel) {
break;
}
- pkgCache::VerIterator ver = find_ver(dep.TargetPkg());
+ const pkgCache::VerIterator &ver = find_ver(dep.TargetPkg());
// Ignore packages that exist only due to dependencies.
if (ver.end()) {
dep++;
@@ -907,44 +901,51 @@ void AptIntf::get_depends(PkgList &output,
} else if (dep->Type == pkgCache::Dep::Depends) {
if (recursive) {
if (!contains(output, dep.TargetPkg())) {
- output.push_back(PkgPair(dep.TargetPkg(), ver));
- get_depends(output, dep.TargetPkg(), recursive);
+ // TODO is this still working
+// output.push_back(PkgPair(dep.TargetPkg(), ver));
+ output.push_back(ver);
+ getDepends(output, ver, recursive);
}
} else {
- output.push_back(PkgPair(dep.TargetPkg(), ver));
+// output.push_back(PkgPair(dep.TargetPkg(), ver));
+ output.push_back(ver);
}
}
dep++;
}
}
-void AptIntf::get_requires(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive)
+void AptIntf::getRequires(PkgList &output,
+ const pkgCache::VerIterator &ver,
+ bool recursive)
{
for (pkgCache::PkgIterator parentPkg = packageCache->PkgBegin(); !parentPkg.end(); ++parentPkg) {
if (_cancel) {
break;
}
+
// Ignore packages that exist only due to dependencies.
if (parentPkg.VersionList().end() && parentPkg.ProvidesList().end()) {
continue;
}
// Don't insert virtual packages instead add what it provides
- pkgCache::VerIterator ver = find_ver(parentPkg);
- if (ver.end() == false) {
+ const pkgCache::VerIterator &parentVer = find_ver(parentPkg);
+ if (parentVer.end() == false) {
PkgList deps;
- get_depends(deps, parentPkg, false);
- for (PkgList::iterator i=deps.begin(); i != deps.end(); ++i) {
- if (i->first == pkg) {
+ getDepends(deps, parentVer, false);
+ for (PkgList::iterator it = deps.begin(); it != deps.end(); ++it) {
+// if (i->ParentPkg() == ver) { TODO make sure this works!!!!
+ if (*it == ver) {
if (recursive) {
if (!contains(output, parentPkg)) {
- output.push_back(PkgPair(parentPkg, ver));
- get_requires(output, parentPkg, recursive);
+// output.push_back(PkgPair(parentPkg, ver));
+ output.push_back(parentVer);
+ getRequires(output, parentVer, recursive);
}
} else {
- output.push_back(PkgPair(parentPkg, ver));
+// output.push_back(PkgPair(parentPkg, ver));
+ output.push_back(parentVer);
}
break;
}
@@ -1125,7 +1126,7 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
// The pkgAcquire::Item had a version hiden on it's subclass
// pkgAcqArchive but it was protected our subclass exposes that
pkgAcqArchiveSane *archive = static_cast<pkgAcqArchiveSane*>(*I);
- untrusted.push_back(PkgPair(archive->version().ParentPkg(), archive->version()));
+ untrusted.push_back(archive->version());
UntrustedList += string((*I)->ShortDesc()) + " ";
}
@@ -1154,17 +1155,19 @@ bool AptIntf::checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
return false;
}
-bool AptIntf::TryToInstall(pkgCache::PkgIterator Pkg,
+bool AptIntf::TryToInstall(const pkgCache::PkgIterator &constPkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
bool Remove,
bool BrokenFix,
unsigned int &ExpectedInst)
{
+ pkgCache::PkgIterator Pkg = constPkg;
// This is a pure virtual package and there is a single available provides
if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
Pkg.ProvidesList()->NextProvides == 0) {
pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
+ // TODO this is UGLY!!! create a local PkgIterator for this
Pkg = Tmp;
}
@@ -1304,16 +1307,16 @@ void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (Cache[pkg].NewInstall() == true) {
// installing
- installing.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ installing.push_back(find_candidate_ver(pkg));
} else if (Cache[pkg].Delete() == true) {
// removing
- removing.push_back(PkgPair(pkg, find_ver(pkg)));
+ removing.push_back(find_ver(pkg));
} else if (Cache[pkg].Upgrade() == true) {
// updating
- updating.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ updating.push_back(find_candidate_ver(pkg));
} else if (Cache[pkg].Downgrade() == true) {
// downgrading
- downgrading.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ downgrading.push_back(find_candidate_ver(pkg));
}
}
@@ -1329,16 +1332,16 @@ void AptIntf::populateInternalPackages(pkgCacheFile &Cache)
for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (Cache[pkg].NewInstall() == true) {
// installing
- m_pkgs.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ m_pkgs.push_back(find_candidate_ver(pkg));
} else if (Cache[pkg].Delete() == true) {
// removing
- m_pkgs.push_back(PkgPair(pkg, find_ver(pkg)));
+ m_pkgs.push_back(find_ver(pkg));
} else if (Cache[pkg].Upgrade() == true) {
// updating
- m_pkgs.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ m_pkgs.push_back(find_candidate_ver(pkg));
} else if (Cache[pkg].Downgrade() == true) {
// downgrading
- m_pkgs.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ m_pkgs.push_back(find_candidate_ver(pkg));
}
}
}
@@ -1346,30 +1349,29 @@ void AptIntf::populateInternalPackages(pkgCacheFile &Cache)
void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
{
for (PkgList::iterator i = m_pkgs.begin(); i != m_pkgs.end(); ++i) {
- if (i->first.Name() == name) {
- emit_package(*i, PK_FILTER_ENUM_NONE, state);
+ if (i->ParentPkg().Name() == name) {
+ emitPackage(*i, PK_FILTER_ENUM_NONE, state);
return;
}
}
- PkgPair pkgPair;
- pkgPair.first = packageCache->FindPkg(name);
+ const pkgCache::PkgIterator &pkg = packageCache->FindPkg(name);
// Ignore packages that could not be found or that exist only due to dependencies.
- if (pkgPair.first.end() == true ||
- (pkgPair.first.VersionList().end() && pkgPair.first.ProvidesList().end())) {
+ if (pkg.end() == true ||
+ (pkg.VersionList().end() && pkg.ProvidesList().end())) {
return;
}
- pkgPair.second = find_ver(pkgPair.first);
+ const pkgCache::VerIterator &ver = find_ver(pkg);
// check to see if the provided package isn't virtual too
- if (pkgPair.second.end() == false) {
- emit_package(pkgPair, PK_FILTER_ENUM_NONE, state);
+ if (ver.end() == false) {
+ emitPackage(ver, PK_FILTER_ENUM_NONE, state);
}
- pkgPair.second = find_candidate_ver(pkgPair.first);
+ const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
// check to see if we found the package
- if (pkgPair.second.end() == false) {
- emit_package(pkgPair, PK_FILTER_ENUM_NONE, state);
+ if (candidateVer.end() == false) {
+ emitPackage(candidateVer, PK_FILTER_ENUM_NONE, state);
}
}
@@ -1712,7 +1714,6 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
break;
}
- PkgPair pair;
pi = package_ids[i];
// Check if it's a valid package id
@@ -1738,45 +1739,43 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
continue;
}
- pair.first = pkg;
- pair.second = find_ver(pkg);
+ const pkgCache::VerIterator &ver = find_ver(pkg);
// check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
+ if (ver.end() == false) {
+ ret.push_back(ver);
}
- pair.second = find_candidate_ver(pkg);
+ const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
// check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
+ if (candidateVer.end() == false) {
+ ret.push_back(candidateVer);
}
}
} else {
- pkgCache::PkgIterator pkg = packageCache->FindPkg(pi);
+ const pkgCache::PkgIterator &pkg = packageCache->FindPkg(pi);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg.end() == true || (pkg.VersionList().end() && pkg.ProvidesList().end())) {
continue;
}
- pair.first = pkg;
- pair.second = find_ver(pkg);
+ const pkgCache::VerIterator &ver = find_ver(pkg);
// check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
+ if (ver.end() == false) {
+ ret.push_back(ver);
}
- pair.second = find_candidate_ver(pkg);
+ const pkgCache::VerIterator &candidateVer = find_candidate_ver(pkg);
// check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
+ if (candidateVer.end() == false) {
+ ret.push_back(candidateVer);
}
}
} else {
bool found;
- pair = find_package_id(pi, found);
+ const pkgCache::VerIterator &ver = findPackageId(pi, found);
// check to see if we found the package
if (found) {
- ret.push_back(pair);
+ ret.push_back(ver);
}
}
}
@@ -1787,13 +1786,13 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
bool AptIntf::markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag)
{
bool ret;
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
+ for(PkgList::iterator it = pkgs.begin(); it != pkgs.end(); ++it) {
if (_cancel) {
break;
}
// Mark package as auto-installed
- cache->MarkAuto(i->first, flag);
+ cache->MarkAuto(it->ParentPkg(), flag);
}
return true;
@@ -2018,13 +2017,12 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
// new scope for the ActionGroup
{
pkgDepCache::ActionGroup group(Cache);
- for(PkgList::iterator i = install.begin(); i != install.end(); ++i) {
- pkgCache::PkgIterator Pkg = i->first;
+ for (PkgList::iterator it = install.begin(); it != install.end(); ++it) {
if (_cancel) {
break;
}
- if (TryToInstall(Pkg,
+ if (TryToInstall(it->ParentPkg(),
Cache,
Fix,
false, // remove
@@ -2038,13 +2036,12 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
markAutoInstalled(Cache, install, markAuto);
}
- for (PkgList::iterator i = remove.begin(); i != remove.end(); ++i) {
- pkgCache::PkgIterator Pkg = i->first;
+ for (PkgList::iterator it = remove.begin(); it != remove.end(); ++it) {
if (_cancel) {
break;
}
- if (TryToInstall(Pkg,
+ if (TryToInstall(it->ParentPkg(),
Cache,
Fix,
true, // remove
@@ -2175,7 +2172,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
}
// Append it to the list
- Stat.addPackagePair(PkgPair(pkg, ver));
+ Stat.addPackage(ver);
}
// Display statistics
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 9727a65..15cf8ee 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -45,8 +45,7 @@ vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel);
*/
vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel);
-typedef pair<pkgCache::PkgIterator, pkgCache::VerIterator> PkgPair;
-typedef vector<PkgPair> PkgList;
+typedef vector<pkgCache::VerIterator> PkgList;
class pkgProblemResolver;
@@ -62,8 +61,7 @@ public:
// Check the returned VerIterator.end()
// if it's true we could not find it
- pair<pkgCache::PkgIterator, pkgCache::VerIterator>
- find_package_id(const gchar *package_id, bool &found);
+ pkgCache::VerIterator findPackageId(const gchar *package_id, bool &found);
pkgCache::VerIterator find_ver(const pkgCache::PkgIterator &pkg);
pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
@@ -85,25 +83,25 @@ public:
/**
* Get depends
*/
- void get_depends(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive);
+ void getDepends(PkgList &output,
+ const pkgCache::VerIterator &ver,
+ bool recursive);
/**
* Get requires
*/
- void get_requires(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive);
+ void getRequires(PkgList &output,
+ const pkgCache::VerIterator &ver,
+ bool recursive);
/**
* Emits a package if it match the filters
*/
- void emit_package(const PkgPair &pair,
- PkBitfield filters = PK_FILTER_ENUM_NONE,
- PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+ void emitPackage(const pkgCache::VerIterator &ver,
+ PkBitfield filters = PK_FILTER_ENUM_NONE,
+ PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
- bool matchPackage(const PkgPair &pair, PkBitfield filters);
+ bool matchPackage(const pkgCache::VerIterator &ver, PkBitfield filters);
PkgList filterPackages(PkgList &packages, PkBitfield filters);
void emit_packages(PkgList &output,
@@ -115,13 +113,13 @@ public:
/**
* Emits details
*/
- void emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
+ void emitDetails(const pkgCache::VerIterator &ver);
void emitDetails(PkgList &pkgs);
/**
* Emits update detail
*/
- void emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
+ void emitUpdateDetails(const pkgCache::VerIterator &version);
void emitUpdateDetails(PkgList &pkgs);
/**
@@ -166,7 +164,7 @@ private:
bool &_cancel;
bool checkTrusted(pkgAcquire &fetcher, PkBackend *backend);
- bool TryToInstall(pkgCache::PkgIterator Pkg,
+ bool TryToInstall(const pkgCache::PkgIterator &constPkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
bool Remove,
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 2cc4ffb..497e593 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -375,10 +375,10 @@ string getBugzillaUrls(const string &changelog)
return ret;
}
-bool contains(PkgList packages, const pkgCache::PkgIterator pkg)
+bool contains(PkgList packages, const pkgCache::PkgIterator &pkg)
{
for (PkgList::iterator it = packages.begin(); it != packages.end(); ++it) {
- if (it->first == pkg) {
+ if (it->ParentPkg() == pkg) {
return true;
}
}
diff --git a/backends/aptcc/apt-utils.h b/backends/aptcc/apt-utils.h
index 11abf16..122f32d 100644
--- a/backends/aptcc/apt-utils.h
+++ b/backends/aptcc/apt-utils.h
@@ -39,11 +39,11 @@ class compare
public:
compare() {}
- bool operator()(const PkgPair &a,
- const PkgPair &b) {
- int ret = strcmp(a.first.Name(), b.first.Name());
+ bool operator()(const pkgCache::VerIterator &a,
+ const pkgCache::VerIterator &b) {
+ int ret = strcmp(a.ParentPkg().Name(), b.ParentPkg().Name());
if (ret == 0) {
- return strcmp(a.second.VerStr(), b.second.VerStr()) < 0;
+ return strcmp(a.VerStr(), b.VerStr()) < 0;
}
return ret < 0;
}
@@ -55,10 +55,10 @@ class result_equality
public:
result_equality() {}
- bool operator() (const PkgPair &a, const PkgPair &b) {
- return strcmp(a.first.Name(), b.first.Name()) == 0 &&
- strcmp(a.second.VerStr(), b.second.VerStr()) == 0 &&
- strcmp(a.second.Arch(), b.second.Arch()) == 0;
+ bool operator() (const pkgCache::VerIterator &a, const pkgCache::VerIterator &b) {
+ return strcmp(a.ParentPkg().Name(), b.ParentPkg().Name()) == 0 &&
+ strcmp(a.VerStr(), b.VerStr()) == 0 &&
+ strcmp(a.Arch(), b.Arch()) == 0;
}
};
@@ -121,7 +121,7 @@ string getBugzillaUrls(const string &changelog);
/**
* Return if the given vector contain a package
*/
-bool contains(PkgList packages, const pkgCache::PkgIterator pkg);
+bool contains(PkgList packages, const pkgCache::PkgIterator &pkg);
/**
* Return if the given string ends with the other
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 27113d4..80c1b27 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -192,9 +192,8 @@ static gboolean backend_get_depends_or_requires_thread(PkBackend *backend)
return false;
}
- PkgPair pkg_ver;
bool found;
- pkg_ver = m_apt->find_package_id(pi, found);
+ const pkgCache::VerIterator &ver = m_apt->findPackageId(pi, found);
if (!found) {
pk_backend_error_code (backend,
PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
@@ -204,9 +203,9 @@ static gboolean backend_get_depends_or_requires_thread(PkBackend *backend)
}
if (depends) {
- m_apt->get_depends(output, pkg_ver.first, recursive);
+ m_apt->getDepends(output, ver, recursive);
} else {
- m_apt->get_requires(output, pkg_ver.first, recursive);
+ m_apt->getRequires(output, ver, recursive);
}
}
@@ -278,9 +277,8 @@ static gboolean backend_get_files_thread(PkBackend *backend)
return false;
}
- PkgPair pkg_ver;
bool found;
- pkg_ver = m_apt->find_package_id(pi, found);
+ m_apt->findPackageId(pi, found);
if (!found) {
pk_backend_error_code(backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "Couldn't find package");
delete m_apt;
@@ -415,11 +413,11 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
++pkg) {
if ((*Cache)[pkg].Upgrade() == true &&
(*Cache)[pkg].NewInstall() == false) {
- update.push_back(PkgPair(pkg, m_apt->find_candidate_ver(pkg)));
+ update.push_back(m_apt->find_candidate_ver(pkg));
} else if ((*Cache)[pkg].Upgradable() == true &&
pkg->CurrentVer != 0 &&
(*Cache)[pkg].Delete() == false) {
- kept.push_back(PkgPair(pkg, m_apt->find_candidate_ver(pkg)));
+ kept.push_back(m_apt->find_candidate_ver(pkg));
}
}
@@ -503,15 +501,15 @@ static gboolean backend_what_provides_thread(PkBackend *backend)
if (_cancel) {
break;
}
- pkgCache::PkgIterator pkg = m_apt->packageCache->FindPkg(i->c_str());
+ const pkgCache::PkgIterator &pkg = m_apt->packageCache->FindPkg(i->c_str());
if (pkg.end() == true) {
continue;
}
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
if (ver.end() == true) {
continue;
}
- output.push_back(PkgPair(pkg, ver));
+ output.push_back(ver);
}
if (error && provides == PK_PROVIDES_ENUM_MIMETYPE) {
@@ -620,15 +618,14 @@ static gboolean pk_backend_download_packages_thread(PkBackend *backend)
break;
}
- PkgPair pkg_ver;
bool found;
- pkg_ver = m_apt->find_package_id(pi, found);
+ const pkgCache::VerIterator &ver = m_apt->findPackageId(pi, found);
// Ignore packages that could not be found or that exist only due to dependencies.
if (!found) {
_error->Error("Can't find this package id \"%s\".", pi);
continue;
} else {
- if(!pkg_ver.second.Downloadable()) {
+ if(!ver.Downloadable()) {
_error->Error("No downloadable files for %s,"
"perhaps it is a local or obsolete" "package?",
pi);
@@ -639,10 +636,10 @@ static gboolean pk_backend_download_packages_thread(PkBackend *backend)
if (get_archive(&fetcher,
m_apt->packageSourceList,
m_apt->packageRecords,
- pkg_ver.second,
+ ver,
directory,
storeFileName)) {
- Stat.addPackagePair(pkg_ver);
+ Stat.addPackage(ver);
}
string destFile = directory + "/" + flNotDir(storeFileName);
if (filelist.empty()) {
@@ -801,15 +798,15 @@ static gboolean pk_backend_search_files_thread(PkBackend *backend)
if (_cancel) {
break;
}
- pkgCache::PkgIterator pkg = m_apt->packageCache->FindPkg(i->c_str());
+ const pkgCache::PkgIterator &pkg = m_apt->packageCache->FindPkg(i->c_str());
if (pkg.end() == true) {
continue;
}
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
if (ver.end() == true) {
continue;
}
- output.push_back(PkgPair(pkg, ver));
+ output.push_back(ver);
}
// It's faster to emmit the packages here rather than in the matching part
m_apt->emit_packages(output, filters);
@@ -873,7 +870,7 @@ static gboolean backend_search_groups_thread (PkBackend *backend)
}
// Ignore virtual packages
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
if (ver.end() == false) {
string section = pkg.VersionList().Section() == NULL ? "" : pkg.VersionList().Section();
@@ -886,7 +883,7 @@ static gboolean backend_search_groups_thread (PkBackend *backend)
i != groups.end();
++i) {
if (*i == get_enum_group(section)) {
- output.push_back(PkgPair(pkg, ver));
+ output.push_back(ver);
break;
}
}
@@ -959,12 +956,12 @@ static gboolean backend_search_package_thread(PkBackend *backend)
continue;
}
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
if (ver.end() == false) {
if (m_matcher->matches(pkg.Name()) ||
m_matcher->matches(get_long_description(ver, m_apt->packageRecords))) {
// The package matched
- output.push_back(PkgPair(pkg, ver));
+ output.push_back(ver);
}
} else if (m_matcher->matches(pkg.Name())) {
// The package is virtual and MATCHED the name
@@ -972,13 +969,13 @@ static gboolean backend_search_package_thread(PkBackend *backend)
// iterate over the provides list
for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
- ver = m_apt->find_ver(Prv.OwnerPkg());
+ const pkgCache::VerIterator &ownerVer = m_apt->find_ver(Prv.OwnerPkg());
// check to see if the provided package isn't virtual too
- if (ver.end() == false) {
+ if (ownerVer.end() == false) {
// we add the package now because we will need to
// remove duplicates later anyway
- output.push_back(PkgPair(Prv.OwnerPkg(), ver));
+ output.push_back(ownerVer);
}
}
}
@@ -995,20 +992,20 @@ static gboolean backend_search_package_thread(PkBackend *backend)
if (m_matcher->matches(pkg.Name())) {
// Don't insert virtual packages instead add what it provides
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
if (ver.end() == false) {
- output.push_back(PkgPair(pkg, ver));
+ output.push_back(ver);
} else {
// iterate over the provides list
for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
- ver = m_apt->find_ver(Prv.OwnerPkg());
+ const pkgCache::VerIterator &ownerVer = m_apt->find_ver(Prv.OwnerPkg());
// check to see if the provided package isn't virtual too
- if (ver.end() == false)
+ if (ownerVer.end() == false)
{
// we add the package now because we will need to
// remove duplicates later anyway
- output.push_back(PkgPair(Prv.OwnerPkg(), ver));
+ output.push_back(ownerVer);
}
}
}
@@ -1364,9 +1361,9 @@ static gboolean backend_get_packages_thread(PkBackend *backend)
}
// Don't insert virtual packages as they don't have all kinds of info
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ const pkgCache::VerIterator &ver = m_apt->find_ver(pkg);
if (ver.end() == false) {
- output.push_back(PkgPair(pkg, ver));
+ output.push_back(ver);
}
}
commit 0bf32e6231340eb9a72e1651262c4ad5f7e8e0ae
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sat Apr 14 00:53:15 2012 -0300
aptcc: Emit packages that are untrusted with the PK_INFO_ENUM_UNTRUSTED enum
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 2ec7891..7b8bd52 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1116,17 +1116,27 @@ void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
}
}
-static bool checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
+bool AptIntf::checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
{
string UntrustedList;
+ PkgList untrusted;
for (pkgAcquire::ItemIterator I = fetcher.ItemsBegin(); I < fetcher.ItemsEnd(); ++I) {
if (!(*I)->IsTrusted()) {
+ // The pkgAcquire::Item had a version hiden on it's subclass
+ // pkgAcqArchive but it was protected our subclass exposes that
+ pkgAcqArchiveSane *archive = static_cast<pkgAcqArchiveSane*>(*I);
+ untrusted.push_back(PkgPair(archive->version().ParentPkg(), archive->version()));
+
UntrustedList += string((*I)->ShortDesc()) + " ";
}
}
- if (UntrustedList == "") {
+ if (untrusted.empty()) {
return true;
+ } else {
+ // TODO does it make sense to emit packages
+ // when not simulating?
+ emit_packages(untrusted, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UNTRUSTED);
}
if (pk_backend_get_bool(backend, "only_trusted") == false ||
@@ -2068,7 +2078,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
// ---------------------------------------------------------------------
/* This displays the informative messages describing what is going to
happen and then calls the download routines */
-bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulate)
+bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulating)
{
// Try to auto-remove packages
if (!DoAutomaticRemove(Cache)) {
@@ -2219,16 +2229,14 @@ bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulate)
}
}
- if (!checkTrusted(fetcher, m_backend)) {
+ if (!checkTrusted(fetcher, m_backend) && !simulating) {
return false;
}
- if (simulate) {
+ if (simulating) {
// Print out a list of packages that are going to be installed extra
emitChangedPackages(Cache);
return true;
- } else {
-
}
pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index b22d667..9727a65 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -132,7 +132,7 @@ public:
/**
* Download and install packages
*/
- bool installPackages(pkgCacheFile &Cache, bool simulate);
+ bool installPackages(pkgCacheFile &Cache, bool simulating);
/**
* Install a DEB file
@@ -165,6 +165,7 @@ private:
PkBackend *m_backend;
bool &_cancel;
+ bool checkTrusted(pkgAcquire &fetcher, PkBackend *backend);
bool TryToInstall(pkgCache::PkgIterator Pkg,
pkgDepCache &Cache,
pkgProblemResolver &Fix,
diff --git a/backends/aptcc/pkg_acqfile.h b/backends/aptcc/pkg_acqfile.h
index fb6c72e..01d13cd 100644
--- a/backends/aptcc/pkg_acqfile.h
+++ b/backends/aptcc/pkg_acqfile.h
@@ -48,6 +48,13 @@ public:
virtual ~pkgAcqFileSane() {}
};
+class pkgAcqArchiveSane : public pkgAcqArchive
+{
+public:
+ // This is insane the version is protected
+ pkgCache::VerIterator version() { return Version; }
+};
+
/** Like pkgAcqArchive, but uses generic File objects to download to
* the cwd (and copies from file:/ URLs).
*/
commit e65d7dd0fb4c733a31796b3e5b6358a01cff73cd
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sat Apr 14 00:17:10 2012 -0300
aptcc: Improve the autoremove code to don't spin if disabled, move the simulate check after the download calculation has been done, remove the dpkgPM class as it didn't work for installing deb files.
diff --git a/backends/aptcc/Makefile.am b/backends/aptcc/Makefile.am
index 052bdf2..0a4f5cd 100644
--- a/backends/aptcc/Makefile.am
+++ b/backends/aptcc/Makefile.am
@@ -5,7 +5,6 @@ INCLUDES = \
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_aptcc.la
libpk_backend_aptcc_la_SOURCES = pkg_acqfile.cpp \
- pkg_dpkgpm.cpp \
acqpkitstatus.cpp \
deb-file.cpp \
matcher.cpp \
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 164d58c..2ec7891 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -49,7 +49,6 @@
#include "apt-messages.h"
#include "acqpkitstatus.h"
#include "pkg_acqfile.h"
-#include "pkg_dpkgpm.h"
#include "deb-file.h"
#define RAMFS_MAGIC 0x858458f6
@@ -1645,7 +1644,12 @@ void AptIntf::updateInterface(int fd, int writeFd)
/* Remove unused automatic packages */
bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
{
- bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
+ bool doAutoRemove;
+ if (pk_backend_get_bool(m_backend, "autoremove")) {
+ doAutoRemove = true;
+ } else {
+ doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
+ }
pkgDepCache::ActionGroup group(*Cache);
if (_config->FindB("APT::Get::Remove",true) == false &&
@@ -1655,27 +1659,30 @@ bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
doAutoRemove = false;
}
- // look over the cache to see what can be removed
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg) {
- if (Cache[Pkg].Garbage && doAutoRemove)
- {
- if (Pkg.CurrentVer() != 0 &&
- Pkg->CurrentState != pkgCache::State::ConfigFiles) {
- Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
- } else {
- Cache->MarkKeep(Pkg, false, false);
+ if (doAutoRemove) {
+ bool purge = _config->FindB("APT::Get::Purge", false);
+ // look over the cache to see what can be removed
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg) {
+ if (Cache[Pkg].Garbage) {
+ if (Pkg.CurrentVer() != 0 &&
+ Pkg->CurrentState != pkgCache::State::ConfigFiles) {
+ Cache->MarkDelete(Pkg, purge);
+ } else {
+ Cache->MarkKeep(Pkg, false, false);
+ }
}
}
- }
- // Now see if we destroyed anything
- if (Cache->BrokenCount() != 0) {
- cout << "Hmm, seems like the AutoRemover destroyed something which really\n"
- "shouldn't happen. Please file a bug report against apt." << endl;
- // TODO call show_broken
- // ShowBroken(c1out,Cache,false);
- return _error->Error("Internal Error, AutoRemover broke stuff");
+ // Now see if we destroyed anything
+ if (Cache->BrokenCount() != 0) {
+ cout << "Hmm, seems like the AutoRemover destroyed something which really\n"
+ "shouldn't happen. Please file a bug report against apt." << endl;
+ // TODO call show_broken
+ // ShowBroken(c1out,Cache,false);
+ return _error->Error("Internal Error, AutoRemover broke stuff");
+ }
}
+
return true;
}
@@ -2052,35 +2059,23 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
}
}
- // Try to auto-remove packages
- if (!DoAutomaticRemove(Cache)) {
- // TODO
- return false;
- }
-
- // check for essential packages!!!
- if (removingEssentialPackages(Cache)) {
- return false;
- }
-
- if (simulate) {
- // Print out a list of packages that are going to be installed extra
- emitChangedPackages(Cache);
- return true;
- } else {
- // Store the packages that are going to change
- // so we can emit them as we process it.
- populateInternalPackages(Cache);
- return installPackages(Cache);
- }
+ // If we are simulating the install packages
+ // will just calculate the trusted packages
+ return installPackages(Cache, simulate);
}
// InstallPackages - Download and install the packages
// ---------------------------------------------------------------------
/* This displays the informative messages describing what is going to
happen and then calls the download routines */
-bool AptIntf::installPackages(pkgCacheFile &Cache)
+bool AptIntf::installPackages(pkgCacheFile &Cache, bool simulate)
{
+ // Try to auto-remove packages
+ if (!DoAutomaticRemove(Cache)) {
+ // TODO
+ return false;
+ }
+
//cout << "installPackages() called" << endl;
if (_config->FindB("APT::Get::Purge",false) == true) {
pkgCache::PkgIterator I = Cache->PkgBegin();
@@ -2140,8 +2135,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache)
fetcher.Setup(&Stat);
// Create the package manager and prepare to download
- // SPtr<pkgPackageManager> PM= _system->CreatePM(Cache);
- SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
+ SPtr<pkgPackageManager> PM = _system->CreatePM(Cache);
if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
_error->PendingError() == true) {
return false;
@@ -2229,6 +2223,14 @@ bool AptIntf::installPackages(pkgCacheFile &Cache)
return false;
}
+ if (simulate) {
+ // Print out a list of packages that are going to be installed extra
+ emitChangedPackages(Cache);
+ return true;
+ } else {
+
+ }
+
pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
pk_backend_set_simultaneous_mode(m_backend, true);
// Download and check if we can continue
@@ -2245,30 +2247,27 @@ bool AptIntf::installPackages(pkgCacheFile &Cache)
return false;
}
- // Right now it's not safe to cancel
- pk_backend_set_allow_cancel (m_backend, false);
+ // Store the packages that are going to change
+ // so we can emit them as we process it.
+ populateInternalPackages(Cache);
- // TODO true or false?
+ // Check if the user canceled
if (_cancel) {
return true;
}
+ // Right now it's not safe to cancel
+ pk_backend_set_allow_cancel (m_backend, false);
+
// Download should be finished by now, changing it's status
pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- // TODO DBus activated does not have all vars
// we could try to see if this is the case
setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
_system->UnLock();
- if (!m_localDebFile.empty()) {
- // add the local file name to be proccessed by the PM queue
- pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
- pm->addDebFile(m_localDebFile);
- }
-
pkgPackageManager::OrderResult res;
res = PM->DoInstallPreFork();
if (res == pkgPackageManager::Failed) {
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index c6c8c56..b22d667 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -28,7 +28,6 @@
#include <apt-pkg/cachefile.h>
#include <apt-pkg/policy.h>
-#include <set>
#include <pk-backend.h>
#define PREUPGRADE_BINARY "/usr/bin/do-release-upgrade"
@@ -133,7 +132,7 @@ public:
/**
* Download and install packages
*/
- bool installPackages(pkgCacheFile &Cache);
+ bool installPackages(pkgCacheFile &Cache, bool simulate);
/**
* Install a DEB file
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 87f3b34..27113d4 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -426,7 +426,9 @@ static gboolean backend_get_or_update_system_thread (PkBackend *backend)
m_apt->emitUpdates(update, filters);
m_apt->emit_packages(kept, filters, PK_INFO_ENUM_BLOCKED);
} else {
- res = m_apt->installPackages(Cache);
+ // TODO there should be a simulate upgrade system,
+ // tho afaik Apper and GPK don't use this
+ res = m_apt->installPackages(Cache, false);
}
delete m_apt;
diff --git a/backends/aptcc/pkg_dpkgpm.cpp b/backends/aptcc/pkg_dpkgpm.cpp
deleted file mode 100644
index 4a495bd..0000000
--- a/backends/aptcc/pkg_dpkgpm.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "pkg_dpkgpm.h"
-
-#include <iostream>
-
-pkgDebDPkgPM::pkgDebDPkgPM(pkgDepCache *cache) :
- pkgDPkgPM(cache)
-{
-}
-
-void pkgDebDPkgPM::addDebFile(const std::string &filename)
-{
- PkgIterator pkg;
- std::cout << "PkgIterator " << pkg.end() << std::endl;
- Item item(Item::Install, pkg, filename);
- List.push_back(item);
-}
diff --git a/backends/aptcc/pkg_dpkgpm.h b/backends/aptcc/pkg_dpkgpm.h
deleted file mode 100644
index 320ae61..0000000
--- a/backends/aptcc/pkg_dpkgpm.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef DEB_DPKG_PM_H
-#define DEB_DPKG_PM_H
-
-#include <string>
-#include <apt-pkg/dpkgpm.h>
-
-class pkgDebDPkgPM : public pkgDPkgPM
-{
-public:
- pkgDebDPkgPM(pkgDepCache *cache);
-
- void addDebFile(const std::string &filename);
-};
-
-#endif
commit 0cb6228d593d44dbceb686b61846676e4b5ca6a5
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Fri Apr 13 22:39:14 2012 -0300
aptcc: Reident the code and re-enforce KDElibs coding style
diff --git a/backends/aptcc/acqpkitstatus.cpp b/backends/aptcc/acqpkitstatus.cpp
index b27b8c5..262bc60 100644
--- a/backends/aptcc/acqpkitstatus.cpp
+++ b/backends/aptcc/acqpkitstatus.cpp
@@ -34,11 +34,11 @@ using namespace std;
// AcqPackageKitStatus::AcqPackageKitStatus - Constructor
// ---------------------------------------------------------------------
AcqPackageKitStatus::AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled) :
- m_apt(apt),
- m_backend(backend),
- _cancelled(cancelled),
- last_percent(PK_BACKEND_PERCENTAGE_INVALID),
- last_sub_percent(PK_BACKEND_PERCENTAGE_INVALID)
+ m_apt(apt),
+ m_backend(backend),
+ _cancelled(cancelled),
+ last_percent(PK_BACKEND_PERCENTAGE_INVALID),
+ last_sub_percent(PK_BACKEND_PERCENTAGE_INVALID)
{
}
@@ -46,9 +46,9 @@ AcqPackageKitStatus::AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool
// ---------------------------------------------------------------------
void AcqPackageKitStatus::Start()
{
- pkgAcquireStatus::Start();
- ID = 1;
-};
+ pkgAcquireStatus::Start();
+ ID = 1;
+}
// AcqPackageKitStatus::IMSHit - Called when an item got a HIT response /*{{{*/
// ---------------------------------------------------------------------
@@ -61,56 +61,56 @@ void AcqPackageKitStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
false);
}
Update = true;
-};
+}
// AcqPackageKitStatus::Fetch - An item has started to download
// ---------------------------------------------------------------------
/* This prints out the short description and the expected size */
void AcqPackageKitStatus::Fetch(pkgAcquire::ItemDesc &Itm)
{
- Update = true;
- if (Itm.Owner->Complete == true)
- return;
+ Update = true;
+ if (Itm.Owner->Complete == true)
+ return;
- Itm.Owner->ID = ID++;
-};
+ Itm.Owner->ID = ID++;
+}
// AcqPackageKitStatus::Done - Completed a download
// ---------------------------------------------------------------------
/* We don't display anything... */
void AcqPackageKitStatus::Done(pkgAcquire::ItemDesc &Itm)
{
- Update = true;
-};
+ Update = true;
+}
// AcqPackageKitStatus::Fail - Called when an item fails to download
// ---------------------------------------------------------------------
/* We print out the error text */
void AcqPackageKitStatus::Fail(pkgAcquire::ItemDesc &Itm)
{
- // Ignore certain kinds of transient failures (bad code)
- if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) {
- return;
- }
+ // Ignore certain kinds of transient failures (bad code)
+ if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) {
+ return;
+ }
- if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
- {
+ if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
+ {
if (packages.size() == 0) {
pk_backend_repo_detail(m_backend,
"",
Itm.Description.c_str(),
false);
}
- } else {
- // an error was found (maybe 404, 403...)
- // the item that got the error and the error text
- _error->Error("Error %s\n %s",
- Itm.Description.c_str(),
- Itm.Owner->ErrorText.c_str());
- }
+ } else {
+ // an error was found (maybe 404, 403...)
+ // the item that got the error and the error text
+ _error->Error("Error %s\n %s",
+ Itm.Description.c_str(),
+ Itm.Owner->ErrorText.c_str());
+ }
- Update = true;
-};
+ Update = true;
+}
// AcqTextStatus::Stop - Finished downloading
@@ -119,14 +119,14 @@ void AcqPackageKitStatus::Fail(pkgAcquire::ItemDesc &Itm)
speed */
void AcqPackageKitStatus::Stop()
{
- pkgAcquireStatus::Stop();
- // the items that still on the set are finished
- for (set<string>::iterator it = currentPackages.begin();
- it != currentPackages.end();
- it++ )
- {
- emit_package(*it, true);
- }
+ pkgAcquireStatus::Stop();
+ // the items that still on the set are finished
+ for (set<string>::iterator it = currentPackages.begin();
+ it != currentPackages.end();
+ it++ )
+ {
+ emit_package(*it, true);
+ }
}
@@ -137,71 +137,71 @@ void AcqPackageKitStatus::Stop()
bandwidth and ETA indicator. */
bool AcqPackageKitStatus::Pulse(pkgAcquire *Owner)
{
- pkgAcquireStatus::Pulse(Owner);
-
- unsigned long percent_done;
- percent_done = long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems));
-
- // Emit the percent done
- if (last_percent != percent_done) {
- if (last_percent < percent_done) {
- pk_backend_set_percentage(m_backend, percent_done);
- } else {
- pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_percentage(m_backend, percent_done);
- }
- last_percent = percent_done;
- }
-
- set<string> localCurrentPackages = currentPackages;;
- for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
- I = Owner->WorkerStep(I))
- {
+ pkgAcquireStatus::Pulse(Owner);
+
+ unsigned long percent_done;
+ percent_done = long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems));
+
+ // Emit the percent done
+ if (last_percent != percent_done) {
+ if (last_percent < percent_done) {
+ pk_backend_set_percentage(m_backend, percent_done);
+ } else {
+ pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_percentage(m_backend, percent_done);
+ }
+ last_percent = percent_done;
+ }
+
+ set<string> localCurrentPackages = currentPackages;;
+ for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
+ I = Owner->WorkerStep(I))
+ {
// Check if there is no item running or if we don't have
// any packages set we are probably refreshing the cache
if (I->CurrentItem == 0 || packages.size() == 0)
{
continue;
}
- emit_package(I->CurrentItem->ShortDesc, false);
- localCurrentPackages.erase(I->CurrentItem->ShortDesc);
-
- // Add the total size and percent
- if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
- {
- unsigned long sub_percent;
- // TODO PackageKit needs to emit package with progress.
- sub_percent = long(double(I->CurrentSize*100.0)/double(I->TotalSize));
- if (last_sub_percent != sub_percent) {
- if (last_sub_percent < sub_percent) {
- pk_backend_set_sub_percentage(m_backend, sub_percent);
- } else {
- pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_sub_percentage(m_backend, sub_percent);
- }
- last_sub_percent = sub_percent;
- }
- }
- }
-
- // the items that still on the set are finished
- for (set<string>::iterator it = localCurrentPackages.begin();
- it != localCurrentPackages.end();
- it++ )
- {
- emit_package(*it, true);
- }
-
- double localCPS = (CurrentCPS >= 0) ? CurrentCPS : -1 * CurrentCPS;
- if (localCPS != last_CPS)
- {
- last_CPS = localCPS;
- pk_backend_set_speed(m_backend, (int) last_CPS);
- }
-
- Update = false;
-
- return !_cancelled;;
+ emit_package(I->CurrentItem->ShortDesc, false);
+ localCurrentPackages.erase(I->CurrentItem->ShortDesc);
+
+ // Add the total size and percent
+ if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
+ {
+ unsigned long sub_percent;
+ // TODO PackageKit needs to emit package with progress.
+ sub_percent = long(double(I->CurrentSize*100.0)/double(I->TotalSize));
+ if (last_sub_percent != sub_percent) {
+ if (last_sub_percent < sub_percent) {
+ pk_backend_set_sub_percentage(m_backend, sub_percent);
+ } else {
+ pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_sub_percentage(m_backend, sub_percent);
+ }
+ last_sub_percent = sub_percent;
+ }
+ }
+ }
+
+ // the items that still on the set are finished
+ for (set<string>::iterator it = localCurrentPackages.begin();
+ it != localCurrentPackages.end();
+ it++ )
+ {
+ emit_package(*it, true);
+ }
+
+ double localCPS = (CurrentCPS >= 0) ? CurrentCPS : -1 * CurrentCPS;
+ if (localCPS != last_CPS)
+ {
+ last_CPS = localCPS;
+ pk_backend_set_speed(m_backend, (int) last_CPS);
+ }
+
+ Update = false;
+
+ return !_cancelled;;
}
// AcqPackageKitStatus::MediaChange - Media need to be swapped
@@ -209,32 +209,32 @@ bool AcqPackageKitStatus::Pulse(pkgAcquire *Owner)
/* Prompt for a media swap */
bool AcqPackageKitStatus::MediaChange(string Media, string Drive)
{
- pk_backend_media_change_required(m_backend,
- PK_MEDIA_TYPE_ENUM_DISC,
- Media.c_str(),
- Media.c_str());
-
- char errorMsg[400];
- sprintf(errorMsg,
- "Media change: please insert the disc labeled"
- " '%s' "
- "in the drive '%s' and try again.",
- Media.c_str(),
- Drive.c_str());
-
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED,
- errorMsg);
-
- // Set this so we can fail the transaction
- Update = true;
- return false;
+ pk_backend_media_change_required(m_backend,
+ PK_MEDIA_TYPE_ENUM_DISC,
+ Media.c_str(),
+ Media.c_str());
+
+ char errorMsg[400];
+ sprintf(errorMsg,
+ "Media change: please insert the disc labeled"
+ " '%s' "
+ "in the drive '%s' and try again.",
+ Media.c_str(),
+ Drive.c_str());
+
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED,
+ errorMsg);
+
+ // Set this so we can fail the transaction
+ Update = true;
+ return false;
}
void AcqPackageKitStatus::addPackagePair(PkgPair packagePair)
{
- packages.push_back(packagePair);
+ packages.push_back(packagePair);
}
void AcqPackageKitStatus::emit_package(const string &name, bool finished)
diff --git a/backends/aptcc/acqpkitstatus.h b/backends/aptcc/acqpkitstatus.h
index 1ab9760..4e01886 100644
--- a/backends/aptcc/acqpkitstatus.h
+++ b/backends/aptcc/acqpkitstatus.h
@@ -29,35 +29,35 @@
class AcqPackageKitStatus : public pkgAcquireStatus
{
public:
- AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled);
+ AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled);
- virtual bool MediaChange(string Media, string Drive);
- virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
- virtual void Fetch(pkgAcquire::ItemDesc &Itm);
- virtual void Done(pkgAcquire::ItemDesc &Itm);
- virtual void Fail(pkgAcquire::ItemDesc &Itm);
- virtual void Start();
- virtual void Stop();
+ virtual bool MediaChange(string Media, string Drive);
+ virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
+ virtual void Fetch(pkgAcquire::ItemDesc &Itm);
+ virtual void Done(pkgAcquire::ItemDesc &Itm);
+ virtual void Fail(pkgAcquire::ItemDesc &Itm);
+ virtual void Start();
+ virtual void Stop();
- bool Pulse(pkgAcquire *Owner);
+ bool Pulse(pkgAcquire *Owner);
- void addPackagePair(PkgPair packagePair);
+ void addPackagePair(PkgPair packagePair);
private:
- PkBackend *m_backend;
- unsigned long ID;
- bool &_cancelled;
+ PkBackend *m_backend;
+ unsigned long ID;
+ bool &_cancelled;
- unsigned long last_percent;
- unsigned long last_sub_percent;
- double last_CPS;
- string last_package_name;
- AptIntf *m_apt;
+ unsigned long last_percent;
+ unsigned long last_sub_percent;
+ double last_CPS;
+ string last_package_name;
+ AptIntf *m_apt;
PkgList packages;
- set<string> currentPackages;
+ set<string> currentPackages;
- void emit_package(const string &name, bool finished);
+ void emit_package(const string &name, bool finished);
};
#endif
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 4319723..164d58c 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -54,128 +54,122 @@
#define RAMFS_MAGIC 0x858458f6
-AptIntf::AptIntf(PkBackend *backend, bool &cancel)
- :
- packageRecords(0),
- packageCache(0),
- packageDepCache(0),
- packageSourceList(0),
- Map(0),
- Policy(0),
- m_backend(backend),
- _cancel(cancel),
- m_terminalTimeout(120),
- m_lastSubProgress(0)
+AptIntf::AptIntf(PkBackend *backend, bool &cancel) :
+ packageRecords(0),
+ packageCache(0),
+ packageDepCache(0),
+ packageSourceList(0),
+ Map(0),
+ Policy(0),
+ m_backend(backend),
+ _cancel(cancel),
+ m_terminalTimeout(120),
+ m_lastSubProgress(0)
{
- _cancel = false;
+ _cancel = false;
}
bool AptIntf::init()
{
- gchar *locale;
- gchar *http_proxy;
- gchar *ftp_proxy;
-
- m_isMultiArch = APT::Configuration::getArchitectures(false).size() > 1;
-
- // Set PackageKit status
- pk_backend_set_status(m_backend, PK_STATUS_ENUM_LOADING_CACHE);
-
- // set locale
- if (locale = pk_backend_get_locale(m_backend)) {
- setlocale(LC_ALL, locale);
-// TODO why this cuts characthers on ui?
-// string _locale(locale);
-// size_t found;
-// found = _locale.find('.');
-// _locale.erase(found);
-// _config->Set("APT::Acquire::Translation", _locale);
- }
-
- // set http proxy
- http_proxy = pk_backend_get_proxy_http(m_backend);
- setenv("http_proxy", http_proxy, 1);
-
- // set ftp proxy
- ftp_proxy = pk_backend_get_proxy_ftp(m_backend);
- setenv("ftp_proxy", ftp_proxy, 1);
-
- packageSourceList = new pkgSourceList;
- // Read the source list
- packageSourceList->ReadMainList();
-
- // Generate it and map it
- bool Res = pkgMakeStatusCache(*packageSourceList, Progress, &Map, true);
- Progress.Done();
- if(!Res) {
- return false;
- //"The package lists or status file could not be parsed or opened."
- }
-
- packageCache = new pkgCache(Map);
- if (_error->PendingError()) {
- return false;
- }
-
- // create depcache
- Policy = new pkgPolicy(packageCache);
- if (_error->PendingError()) {
- return false;
- }
-
- if (!ReadPinFile(*Policy)) {
- return false;
- }
-
- packageDepCache = new pkgDepCache(packageCache, Policy);
- if (_error->PendingError()) {
- return false;
- }
-
- packageDepCache->Init(&Progress);
- Progress.Done();
- if (_error->PendingError()) {
- return false;
- }
-
- // Create the text record parser
- packageRecords = new pkgRecords(*packageDepCache);
+ gchar *locale;
+ gchar *http_proxy;
+ gchar *ftp_proxy;
+
+ m_isMultiArch = APT::Configuration::getArchitectures(false).size() > 1;
+
+ // Set PackageKit status
+ pk_backend_set_status(m_backend, PK_STATUS_ENUM_LOADING_CACHE);
+
+ // set locale
+ if (locale = pk_backend_get_locale(m_backend)) {
+ setlocale(LC_ALL, locale);
+ // TODO why this cuts characthers on ui?
+ // string _locale(locale);
+ // size_t found;
+ // found = _locale.find('.');
+ // _locale.erase(found);
+ // _config->Set("APT::Acquire::Translation", _locale);
+ }
+
+ // set http proxy
+ http_proxy = pk_backend_get_proxy_http(m_backend);
+ setenv("http_proxy", http_proxy, 1);
+
+ // set ftp proxy
+ ftp_proxy = pk_backend_get_proxy_ftp(m_backend);
+ setenv("ftp_proxy", ftp_proxy, 1);
+
+ packageSourceList = new pkgSourceList;
+ // Read the source list
+ packageSourceList->ReadMainList();
+
+ // Generate it and map it
+ bool Res = pkgMakeStatusCache(*packageSourceList, Progress, &Map, true);
+ Progress.Done();
+ if(!Res) {
+ return false;
+ //"The package lists or status file could not be parsed or opened."
+ }
+
+ packageCache = new pkgCache(Map);
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ // create depcache
+ Policy = new pkgPolicy(packageCache);
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ if (!ReadPinFile(*Policy)) {
+ return false;
+ }
+
+ packageDepCache = new pkgDepCache(packageCache, Policy);
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ packageDepCache->Init(&Progress);
+ Progress.Done();
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ // Create the text record parser
+ packageRecords = new pkgRecords(*packageDepCache);
}
AptIntf::~AptIntf()
{
- if (packageRecords)
- {
- g_debug ("~apt_init packageRecords");
- delete packageRecords;
- }
-
- if (packageCache)
- {
- g_debug ("~apt_init packageCache");
- delete packageCache;
- }
-
- if (packageDepCache)
- {
- g_debug ("~apt_init packageDepCache");
- delete packageDepCache;
- }
-
- if (Policy)
- {
- g_debug ("~apt_init Policy");
- delete Policy;
- }
-
- if (packageSourceList)
- {
- delete packageSourceList;
- }
-
- pk_backend_finished(m_backend);
-
- delete Map;
+ if (packageRecords) {
+ g_debug ("~apt_init packageRecords");
+ delete packageRecords;
+ }
+
+ if (packageCache) {
+ g_debug ("~apt_init packageCache");
+ delete packageCache;
+ }
+
+ if (packageDepCache) {
+ g_debug ("~apt_init packageDepCache");
+ delete packageDepCache;
+ }
+
+ if (Policy) {
+ g_debug ("~apt_init Policy");
+ delete Policy;
+ }
+
+ if (packageSourceList) {
+ delete packageSourceList;
+ }
+
+ pk_backend_finished(m_backend);
+
+ delete Map;
}
void AptIntf::cancel()
@@ -205,8 +199,7 @@ PkgPair AptIntf::find_package_id(const gchar *package_id, bool &found)
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkg_ver.first.end() == true ||
- (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
- {
+ (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end())) {
g_strfreev(parts);
return pkg_ver;
}
@@ -214,8 +207,7 @@ PkgPair AptIntf::find_package_id(const gchar *package_id, bool &found)
ver = find_ver(pkg_ver.first);
// check to see if the provided package isn't virtual too
if (ver.end() == false &&
- strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
- {
+ strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0) {
g_strfreev(parts);
pkg_ver.second = ver;
return pkg_ver;
@@ -224,8 +216,7 @@ PkgPair AptIntf::find_package_id(const gchar *package_id, bool &found)
ver = find_candidate_ver(pkg_ver.first);
// check to see if the provided package isn't virtual too
if (ver.end() == false &&
- strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
- {
+ strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0) {
g_strfreev(parts);
pkg_ver.second = ver;
return pkg_ver;
@@ -239,26 +230,25 @@ PkgPair AptIntf::find_package_id(const gchar *package_id, bool &found)
pkgCache::VerIterator AptIntf::find_candidate_ver(const pkgCache::PkgIterator &pkg)
{
- // get the candidate version iterator
- return (*packageDepCache)[pkg].CandidateVerIter(*packageDepCache);
+ // get the candidate version iterator
+ return (*packageDepCache)[pkg].CandidateVerIter(*packageDepCache);
}
pkgCache::VerIterator AptIntf::find_ver(const pkgCache::PkgIterator &pkg)
{
- // if the package is installed return the current version
- if(!pkg.CurrentVer().end()) {
- return pkg.CurrentVer();
- }
-
- // Else get the candidate version iterator
- pkgCache::VerIterator candver = find_candidate_ver(pkg);
- if(!candver.end())
- {
- return candver;
- }
-
- // return the version list as a last resource
- return pkg.VersionList();
+ // if the package is installed return the current version
+ if(!pkg.CurrentVer().end()) {
+ return pkg.CurrentVer();
+ }
+
+ // Else get the candidate version iterator
+ pkgCache::VerIterator candver = find_candidate_ver(pkg);
+ if(!candver.end()) {
+ return candver;
+ }
+
+ // return the version list as a last resource
+ return pkg.VersionList();
}
bool AptIntf::matchPackage(const PkgPair &pair, PkBitfield filters)
@@ -278,7 +268,7 @@ bool AptIntf::matchPackage(const PkgPair &pair, PkBitfield filters)
// don't emit the package if it does not match
// the native architecture
if (strcmp(ver.Arch(), "all") != 0 &&
- strcmp(ver.Arch(), _config->Find("APT::Architecture").c_str()) != 0) {
+ strcmp(ver.Arch(), _config->Find("APT::Architecture").c_str()) != 0) {
return false;
}
}
@@ -296,54 +286,54 @@ bool AptIntf::matchPackage(const PkgPair &pair, PkBitfield filters)
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_INSTALLED) && !installed) {
return false;
}
-
+
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_DEVELOPMENT)) {
// if ver.end() means unknow
// strcmp will be true when it's different than devel
std::string pkgName = pkg.Name();
if (!ends_with(pkgName, "-dev") &&
- !ends_with(pkgName, "-dbg") &&
- section.compare("devel") &&
- section.compare("libdevel")) {
+ !ends_with(pkgName, "-dbg") &&
+ section.compare("devel") &&
+ section.compare("libdevel")) {
return false;
}
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_DEVELOPMENT)) {
std::string pkgName = pkg.Name();
if (ends_with(pkgName, "-dev") ||
- ends_with(pkgName, "-dbg") ||
- !section.compare("devel") ||
- !section.compare("libdevel")) {
+ ends_with(pkgName, "-dbg") ||
+ !section.compare("devel") ||
+ !section.compare("libdevel")) {
return false;
}
}
-
+
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_GUI)) {
// if ver.end() means unknow
// strcmp will be true when it's different than x11
if (section.compare("x11") && section.compare("gnome") &&
- section.compare("kde") && section.compare("graphics")) {
+ section.compare("kde") && section.compare("graphics")) {
return false;
}
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_GUI)) {
if (!section.compare("x11") || !section.compare("gnome") ||
- !section.compare("kde") || !section.compare("graphics")) {
+ !section.compare("kde") || !section.compare("graphics")) {
return false;
}
}
-
+
// TODO add Ubuntu handling
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_FREE)) {
if (!repo_section.compare("contrib") ||
- !repo_section.compare("non-free")) {
+ !repo_section.compare("non-free")) {
return false;
}
} else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_FREE)) {
if (repo_section.compare("contrib") &&
- repo_section.compare("non-free")) {
+ repo_section.compare("non-free")) {
return false;
}
}
-
+
// TODO test this one..
if (pk_bitfield_contain(filters, PK_FILTER_ENUM_COLLECTIONS)) {
if (!repo_section.compare("metapackages")) {
@@ -384,18 +374,18 @@ void AptIntf::emit_package(const PkgPair &pair,
// check the state enum to see if it was not set.
if (state == PK_INFO_ENUM_UNKNOWN) {
if (pkg->CurrentState == pkgCache::State::Installed &&
- pkg.CurrentVer() == ver) {
+ pkg.CurrentVer() == ver) {
state = PK_INFO_ENUM_INSTALLED;
} else {
state = PK_INFO_ENUM_AVAILABLE;
}
- }
+ }
// Check if the filters match the package
if (!matchPackage(pair, filters)) {
return;
}
-
+
pkgCache::VerFileIterator vf = ver.FileList();
gchar *package_id;
@@ -441,7 +431,7 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
output.erase(unique(output.begin(),
output.end(),
result_equality()),
- output.end());
+ output.end());
for (PkgList::iterator i = output.begin(); i != output.end(); ++i) {
if (_cancel) {
@@ -457,9 +447,9 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
std::string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
std::string label = vf.File().Label() == NULL ? "" : vf.File().Label();
if (origin.compare("Debian") == 0 ||
- origin.compare("Ubuntu") == 0) {
+ origin.compare("Ubuntu") == 0) {
if (ends_with(archive, "-security") ||
- label.compare("Debian-Security") == 0) {
+ label.compare("Debian-Security") == 0) {
state = PK_INFO_ENUM_SECURITY;
} else if (ends_with(archive, "-backports")) {
state = PK_INFO_ENUM_ENHANCEMENT;
@@ -467,7 +457,7 @@ void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
state = PK_INFO_ENUM_BUGFIX;
}
} else if (origin.compare("Backports.org archive") == 0 ||
- ends_with(origin, "-backports")) {
+ ends_with(origin, "-backports")) {
state = PK_INFO_ENUM_ENHANCEMENT;
}
@@ -483,12 +473,12 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
return;
}
- for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg)
- {
+ for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
if (_cancel) {
delete matcher;
break;
}
+
// Ignore packages that exist only due to dependencies.
if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
continue;
@@ -551,7 +541,7 @@ void AptIntf::providesLibrary(PkgList &output, gchar **values)
string strvalue = string(value);
ssize_t pos = strvalue.find (".so.");
if ((pos != string::npos) && (pos > 0)) {
- // If last char is a number, add a "-" (to be policy-compliant)
+ // If last char is a number, add a "-" (to be policy-compliant)
if (g_ascii_isdigit (libPkgName.at (libPkgName.length () - 1))) {
libPkgName.append ("-");
}
@@ -640,8 +630,7 @@ void AptIntf::emitDetails(PkgList &pkgs)
pkgs.erase(unique(pkgs.begin(), pkgs.end(), result_equality()),
pkgs.end());
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
- {
+ for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
if (_cancel) {
break;
}
@@ -710,20 +699,20 @@ void AptIntf::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache
if (origin.compare("Debian") == 0) {
snprintf(uri,
- 512,
- "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
- prefix.c_str(),
- srcpkg.c_str(),
- srcpkg.c_str(),
- verstr.c_str());
+ 512,
+ "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
+ prefix.c_str(),
+ srcpkg.c_str(),
+ srcpkg.c_str(),
+ verstr.c_str());
} else {
snprintf(uri,
- 512,
- "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
- prefix.c_str(),
- srcpkg.c_str(),
- srcpkg.c_str(),
- verstr.c_str());
+ 512,
+ "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
+ prefix.c_str(),
+ srcpkg.c_str(),
+ srcpkg.c_str(),
+ verstr.c_str());
}
} else {
string pkgfilename;
@@ -745,8 +734,8 @@ void AptIntf::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache
pkgfilename = pkgfilename.substr(0, pkgfilename.find_last_of('.')) + ".changelog";
snprintf(uri,512,"http://%s/%s",
- cadidateOriginSiteUrl.c_str(),
- pkgfilename.c_str());
+ cadidateOriginSiteUrl.c_str(),
+ pkgfilename.c_str());
}
// Create the download object
AcqPackageKitStatus Stat(this, m_backend, _cancel);
@@ -798,8 +787,8 @@ void AptIntf::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache
// Compare if the current version is shown in the changelog, to not
// display old changelog information
if (_system != 0 &&
- _system->VS->DoCmpVersion(version, version + strlen(version),
- currver.VerStr(), currver.VerStr() + strlen(currver.VerStr())) <= 0) {
+ _system->VS->DoCmpVersion(version, version + strlen(version),
+ currver.VerStr(), currver.VerStr() + strlen(currver.VerStr())) <= 0) {
g_free (version);
break;
} else {
@@ -860,16 +849,15 @@ void AptIntf::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache
} else if (archive.compare("testing") == 0) {
updateState = PK_UPDATE_STATE_ENUM_TESTING;
} else if (archive.compare("unstable") == 0 ||
- archive.compare("experimental") == 0)
- {
+ archive.compare("experimental") == 0) {
updateState = PK_UPDATE_STATE_ENUM_UNSTABLE;
}
PkRestartEnum restart = PK_RESTART_ENUM_NONE;
if (starts_with(pkg.Name(), "linux-image-") ||
- starts_with(pkg.Name(), "nvidia-") ||
- strcmp(pkg.Name(), "libc6") == 0 ||
- strcmp(pkg.Name(), "dbus") == 0) {
+ starts_with(pkg.Name(), "nvidia-") ||
+ strcmp(pkg.Name(), "libc6") == 0 ||
+ strcmp(pkg.Name(), "dbus") == 0) {
restart = PK_RESTART_ENUM_SYSTEM;
}
@@ -893,8 +881,7 @@ void AptIntf::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache
void AptIntf::emitUpdateDetails(PkgList &pkgs)
{
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
- {
+ for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
if (_cancel) {
break;
}
@@ -970,137 +957,137 @@ void AptIntf::get_requires(PkgList &output,
// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel)
{
- vector<string> packageList;
- regex_t re;
- gchar *search;
- gchar *values_str;
-
- values_str = g_strjoinv("$|^", values);
- search = g_strdup_printf("^%s$",
- values_str);
- g_free(values_str);
- if(regcomp(&re, search, REG_NOSUB) != 0) {
- g_debug("Regex compilation error");
- g_free(search);
- return vector<string>();
- }
- g_free(search);
-
- DIR *dp;
- struct dirent *dirp;
- if (!(dp = opendir("/var/lib/dpkg/info/"))) {
- g_debug ("Error opening /var/lib/dpkg/info/\n");
- regfree(&re);
- return vector<string>();
- }
-
- string line;
- while ((dirp = readdir(dp)) != NULL) {
- if (_cancel) {
- break;
- }
- if (ends_with(dirp->d_name, ".list")) {
- string f = "/var/lib/dpkg/info/" + string(dirp->d_name);
- ifstream in(f.c_str());
- if (!in != 0) {
- continue;
- }
- while (!in.eof()) {
- getline(in, line);
- if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
- string file(dirp->d_name);
- packageList.push_back(file.erase(file.size() - 5, file.size()));
- break;
- }
- }
- }
- }
- closedir(dp);
- regfree(&re);
- return packageList;
+ vector<string> packageList;
+ regex_t re;
+ gchar *search;
+ gchar *values_str;
+
+ values_str = g_strjoinv("$|^", values);
+ search = g_strdup_printf("^%s$",
+ values_str);
+ g_free(values_str);
+ if(regcomp(&re, search, REG_NOSUB) != 0) {
+ g_debug("Regex compilation error");
+ g_free(search);
+ return vector<string>();
+ }
+ g_free(search);
+
+ DIR *dp;
+ struct dirent *dirp;
+ if (!(dp = opendir("/var/lib/dpkg/info/"))) {
+ g_debug ("Error opening /var/lib/dpkg/info/\n");
+ regfree(&re);
+ return vector<string>();
+ }
+
+ string line;
+ while ((dirp = readdir(dp)) != NULL) {
+ if (_cancel) {
+ break;
+ }
+ if (ends_with(dirp->d_name, ".list")) {
+ string f = "/var/lib/dpkg/info/" + string(dirp->d_name);
+ ifstream in(f.c_str());
+ if (!in != 0) {
+ continue;
+ }
+ while (!in.eof()) {
+ getline(in, line);
+ if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
+ string file(dirp->d_name);
+ packageList.push_back(file.erase(file.size() - 5, file.size()));
+ break;
+ }
+ }
+ }
+ }
+ closedir(dp);
+ regfree(&re);
+ return packageList;
}
// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel)
{
- vector<string> packageList;
- regex_t re;
- gchar *value;
- gchar *values_str;
-
- values_str = g_strjoinv("|", values);
- value = g_strdup_printf("^MimeType=\\(.*;\\)\\?\\(%s\\)\\(;.*\\)\\?$",
- values_str);
- g_free(values_str);
-
- if(regcomp(&re, value, REG_NOSUB) != 0) {
- g_debug("Regex compilation error");
- g_free(value);
- return vector<string>();
- }
- g_free(value);
-
- DIR *dp;
- struct dirent *dirp;
- if (!(dp = opendir("/usr/share/app-install/desktop/"))) {
- g_debug ("Error opening /usr/share/app-install/desktop/\n");
- regfree(&re);
- error = true;
- return vector<string>();
- }
-
- string line;
- while ((dirp = readdir(dp)) != NULL) {
- if (_cancel) {
- break;
- }
- if (ends_with(dirp->d_name, ".desktop")) {
- string f = "/usr/share/app-install/desktop/" + string(dirp->d_name);
- ifstream in(f.c_str());
- if (!in != 0) {
- continue;
- }
- bool getName = false;
- while (!in.eof()) {
- getline(in, line);
- if (getName) {
- if (starts_with(line, "X-AppInstall-Package=")) {
- // Remove the X-AppInstall-Package=
- packageList.push_back(line.substr(21));
- break;
- }
- } else {
- if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
- in.seekg(ios_base::beg);
- getName = true;
- }
- }
- }
- }
- }
-
- closedir(dp);
- regfree(&re);
- return packageList;
+ vector<string> packageList;
+ regex_t re;
+ gchar *value;
+ gchar *values_str;
+
+ values_str = g_strjoinv("|", values);
+ value = g_strdup_printf("^MimeType=\\(.*;\\)\\?\\(%s\\)\\(;.*\\)\\?$",
+ values_str);
+ g_free(values_str);
+
+ if(regcomp(&re, value, REG_NOSUB) != 0) {
+ g_debug("Regex compilation error");
+ g_free(value);
+ return vector<string>();
+ }
+ g_free(value);
+
+ DIR *dp;
+ struct dirent *dirp;
+ if (!(dp = opendir("/usr/share/app-install/desktop/"))) {
+ g_debug ("Error opening /usr/share/app-install/desktop/\n");
+ regfree(&re);
+ error = true;
+ return vector<string>();
+ }
+
+ string line;
+ while ((dirp = readdir(dp)) != NULL) {
+ if (_cancel) {
+ break;
+ }
+ if (ends_with(dirp->d_name, ".desktop")) {
+ string f = "/usr/share/app-install/desktop/" + string(dirp->d_name);
+ ifstream in(f.c_str());
+ if (!in != 0) {
+ continue;
+ }
+ bool getName = false;
+ while (!in.eof()) {
+ getline(in, line);
+ if (getName) {
+ if (starts_with(line, "X-AppInstall-Package=")) {
+ // Remove the X-AppInstall-Package=
+ packageList.push_back(line.substr(21));
+ break;
+ }
+ } else {
+ if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
+ in.seekg(ios_base::beg);
+ getName = true;
+ }
+ }
+ }
+ }
+ }
+
+ closedir(dp);
+ regfree(&re);
+ return packageList;
}
// used to emit files it reads the info directly from the files
void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
{
- static string filelist;
- string line;
- gchar **parts;
+ static string filelist;
+ string line;
+ gchar **parts;
- parts = pk_package_id_split (pi);
- filelist.erase(filelist.begin(), filelist.end());
+ parts = pk_package_id_split (pi);
+ filelist.erase(filelist.begin(), filelist.end());
string fName;
if (m_isMultiArch) {
- fName = "/var/lib/dpkg/info/" +
- string(parts[PK_PACKAGE_ID_NAME]) +
- ":" +
- string(parts[PK_PACKAGE_ID_ARCH]) +
- ".list";
+ fName = "/var/lib/dpkg/info/" +
+ string(parts[PK_PACKAGE_ID_NAME]) +
+ ":" +
+ string(parts[PK_PACKAGE_ID_ARCH]) +
+ ".list";
} else {
fName = "/var/lib/dpkg/info/" +
string(parts[PK_PACKAGE_ID_NAME]) +
@@ -1108,199 +1095,190 @@ void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
}
g_strfreev (parts);
- if (FileExists(fName)) {
- ifstream in(fName.c_str());
- if (!in != 0) {
- return;
- }
- while (in.eof() == false && filelist.empty()) {
- getline(in, line);
- filelist += line;
- }
- while (in.eof() == false) {
- getline(in, line);
- if (!line.empty()) {
- filelist += ";" + line;
- }
- }
-
- if (!filelist.empty()) {
- pk_backend_files (backend, pi, filelist.c_str());
- }
- }
+ if (FileExists(fName)) {
+ ifstream in(fName.c_str());
+ if (!in != 0) {
+ return;
+ }
+ while (in.eof() == false && filelist.empty()) {
+ getline(in, line);
+ filelist += line;
+ }
+ while (in.eof() == false) {
+ getline(in, line);
+ if (!line.empty()) {
+ filelist += ";" + line;
+ }
+ }
+
+ if (!filelist.empty()) {
+ pk_backend_files (backend, pi, filelist.c_str());
+ }
+ }
}
static bool checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
{
- string UntrustedList;
- for (pkgAcquire::ItemIterator I = fetcher.ItemsBegin(); I < fetcher.ItemsEnd(); ++I)
- {
- if (!(*I)->IsTrusted())
- {
- UntrustedList += string((*I)->ShortDesc()) + " ";
- }
- }
-
- if (UntrustedList == "")
- {
- return true;
- }
-
- if (pk_backend_get_bool(backend, "only_trusted") == false ||
- _config->FindB("APT::Get::AllowUnauthenticated", false) == true)
- {
- g_debug ("Authentication warning overridden.\n");
- return true;
- }
-
- string warning("The following packages cannot be authenticated:\n");
- warning += UntrustedList;
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED,
- warning.c_str());
- _error->Discard();
- return false;
+ string UntrustedList;
+ for (pkgAcquire::ItemIterator I = fetcher.ItemsBegin(); I < fetcher.ItemsEnd(); ++I) {
+ if (!(*I)->IsTrusted()) {
+ UntrustedList += string((*I)->ShortDesc()) + " ";
+ }
+ }
+
+ if (UntrustedList == "") {
+ return true;
+ }
+
+ if (pk_backend_get_bool(backend, "only_trusted") == false ||
+ _config->FindB("APT::Get::AllowUnauthenticated", false) == true) {
+ g_debug ("Authentication warning overridden.\n");
+ return true;
+ }
+
+ string warning("The following packages cannot be authenticated:\n");
+ warning += UntrustedList;
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED,
+ warning.c_str());
+ _error->Discard();
+ return false;
}
bool AptIntf::TryToInstall(pkgCache::PkgIterator Pkg,
- pkgDepCache &Cache,
- pkgProblemResolver &Fix,
- bool Remove,
- bool BrokenFix,
- unsigned int &ExpectedInst)
+ pkgDepCache &Cache,
+ pkgProblemResolver &Fix,
+ bool Remove,
+ bool BrokenFix,
+ unsigned int &ExpectedInst)
{
- // This is a pure virtual package and there is a single available provides
- if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
- Pkg.ProvidesList()->NextProvides == 0)
- {
- pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
- Pkg = Tmp;
- }
-
- // Check if there is something at all to install
- pkgDepCache::StateCache &State = Cache[Pkg];
- if (Remove == true && Pkg->CurrentVer == 0)
- {
- Fix.Clear(Pkg);
- Fix.Protect(Pkg);
- Fix.Remove(Pkg);
-
- return true;
- }
-
- if (State.CandidateVer == 0 && Remove == false)
- {
- _error->Error("Package %s is virtual and has no installation candidate", Pkg.Name());
-
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,
- g_strdup_printf("Package %s is virtual and has no "
- "installation candidate",
- Pkg.Name()));
- return false;
- }
-
- Fix.Clear(Pkg);
- Fix.Protect(Pkg);
- if (Remove == true)
- {
- Fix.Remove(Pkg);
- Cache.MarkDelete(Pkg,_config->FindB("APT::Get::Purge", false));
- return true;
- }
-
- // Install it
- Cache.MarkInstall(Pkg,false);
- if (State.Install() == false)
- {
- if (_config->FindB("APT::Get::ReInstall",false) == true) {
- if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false) {
- // ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
- // Pkg.Name());
- ;
- } else {
- Cache.SetReInstall(Pkg,true);
- }
- } else {
- // if (AllowFail == true)
- // ioprintf(c1out,_("%s is already the newest version.\n"),
- // Pkg.Name());
- }
- } else {
- ExpectedInst++;
- }
-
-// cout << "trytoinstall ExpectedInst " << ExpectedInst << endl;
- // Install it with autoinstalling enabled (if we not respect the minial
- // required deps or the policy)
- if ((State.InstBroken() == true || State.InstPolicyBroken() == true) &&
- BrokenFix == false) {
- Cache.MarkInstall(Pkg,true);
- }
-
- return true;
+ // This is a pure virtual package and there is a single available provides
+ if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
+ Pkg.ProvidesList()->NextProvides == 0) {
+ pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
+ Pkg = Tmp;
+ }
+
+ // Check if there is something at all to install
+ pkgDepCache::StateCache &State = Cache[Pkg];
+ if (Remove == true && Pkg->CurrentVer == 0) {
+ Fix.Clear(Pkg);
+ Fix.Protect(Pkg);
+ Fix.Remove(Pkg);
+
+ return true;
+ }
+
+ if (State.CandidateVer == 0 && Remove == false) {
+ _error->Error("Package %s is virtual and has no installation candidate", Pkg.Name());
+
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,
+ g_strdup_printf("Package %s is virtual and has no "
+ "installation candidate",
+ Pkg.Name()));
+ return false;
+ }
+
+ Fix.Clear(Pkg);
+ Fix.Protect(Pkg);
+ if (Remove == true) {
+ Fix.Remove(Pkg);
+ Cache.MarkDelete(Pkg,_config->FindB("APT::Get::Purge", false));
+ return true;
+ }
+
+ // Install it
+ Cache.MarkInstall(Pkg,false);
+ if (State.Install() == false) {
+ if (_config->FindB("APT::Get::ReInstall",false) == true) {
+ if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false) {
+ // ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
+ // Pkg.Name());
+ ;
+ } else {
+ Cache.SetReInstall(Pkg,true);
+ }
+ } else {
+ // if (AllowFail == true)
+ // ioprintf(c1out,_("%s is already the newest version.\n"),
+ // Pkg.Name());
+ }
+ } else {
+ ExpectedInst++;
+ }
+
+ // cout << "trytoinstall ExpectedInst " << ExpectedInst << endl;
+ // Install it with autoinstalling enabled (if we not respect the minial
+ // required deps or the policy)
+ if ((State.InstBroken() == true || State.InstPolicyBroken() == true) &&
+ BrokenFix == false) {
+ Cache.MarkInstall(Pkg,true);
+ }
+
+ return true;
}
// checks if there are Essential packages being removed
bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
{
- string List;
- bool *Added = new bool[Cache->Head().PackageCount];
- for (unsigned int I = 0; I != Cache->Head().PackageCount; I++){
- Added[I] = false;
- }
-
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
- if ((I->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
- (I->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important) {
- continue;
- }
-
- if (Cache[I].Delete() == true) {
- if (Added[I->ID] == false) {
- Added[I->ID] = true;
- List += string(I.Name()) + " ";
- }
- }
-
- if (I->CurrentVer == 0) {
- continue;
- }
-
- // Print out any essential package depenendents that are to be removed
- for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; D++) {
- // Skip everything but depends
- if (D->Type != pkgCache::Dep::PreDepends &&
- D->Type != pkgCache::Dep::Depends){
- continue;
- }
-
- pkgCache::PkgIterator P = D.SmartTargetPkg();
- if (Cache[P].Delete() == true)
- {
- if (Added[P->ID] == true){
- continue;
- }
- Added[P->ID] = true;
-
- char S[300];
- snprintf(S, sizeof(S), "%s (due to %s) ", P.Name(), I.Name());
- List += S;
- }
- }
- }
-
- delete [] Added;
- if (!List.empty()) {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE,
- g_strdup_printf("WARNING: You are trying to remove the "
- "following essential packages: %s",
- List.c_str()));
- return true;
- }
-
- return false;
+ string List;
+ bool *Added = new bool[Cache->Head().PackageCount];
+ for (unsigned int I = 0; I != Cache->Head().PackageCount; ++I) {
+ Added[I] = false;
+ }
+
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
+ if ((I->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
+ (I->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important) {
+ continue;
+ }
+
+ if (Cache[I].Delete() == true) {
+ if (Added[I->ID] == false) {
+ Added[I->ID] = true;
+ List += string(I.Name()) + " ";
+ }
+ }
+
+ if (I->CurrentVer == 0) {
+ continue;
+ }
+
+ // Print out any essential package depenendents that are to be removed
+ for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; ++D) {
+ // Skip everything but depends
+ if (D->Type != pkgCache::Dep::PreDepends &&
+ D->Type != pkgCache::Dep::Depends){
+ continue;
+ }
+
+ pkgCache::PkgIterator P = D.SmartTargetPkg();
+ if (Cache[P].Delete() == true)
+ {
+ if (Added[P->ID] == true){
+ continue;
+ }
+ Added[P->ID] = true;
+
+ char S[300];
+ snprintf(S, sizeof(S), "%s (due to %s) ", P.Name(), I.Name());
+ List += S;
+ }
+ }
+ }
+
+ delete [] Added;
+ if (!List.empty()) {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE,
+ g_strdup_printf("WARNING: You are trying to remove the "
+ "following essential packages: %s",
+ List.c_str()));
+ return true;
+ }
+
+ return false;
}
// emitChangedPackages - Show packages to newly install
@@ -1314,8 +1292,7 @@ void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
PkgList downgrading;
string VersionsList;
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg)
- {
+ for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
if (Cache[pkg].NewInstall() == true) {
// installing
installing.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
@@ -1370,88 +1347,86 @@ void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
pkgPair.first = packageCache->FindPkg(name);
// Ignore packages that could not be found or that exist only due to dependencies.
if (pkgPair.first.end() == true ||
- (pkgPair.first.VersionList().end() && pkgPair.first.ProvidesList().end())) {
+ (pkgPair.first.VersionList().end() && pkgPair.first.ProvidesList().end())) {
return;
}
pkgPair.second = find_ver(pkgPair.first);
// check to see if the provided package isn't virtual too
- if (pkgPair.second.end() == false)
- {
+ if (pkgPair.second.end() == false) {
emit_package(pkgPair, PK_FILTER_ENUM_NONE, state);
}
pkgPair.second = find_candidate_ver(pkgPair.first);
// check to see if we found the package
- if (pkgPair.second.end() == false)
- {
+ if (pkgPair.second.end() == false) {
emit_package(pkgPair, PK_FILTER_ENUM_NONE, state);
}
}
void AptIntf::updateInterface(int fd, int writeFd)
{
- char buf[2];
- static char line[1024] = "";
-
- while (1) {
- // This algorithm should be improved (it's the same as the rpm one ;)
- int len = read(fd, buf, 1);
-
- // nothing was read
- if(len < 1) {
- break;
- }
-
- // update the time we last saw some action
- m_lastTermAction = time(NULL);
-
- if( buf[0] == '\n') {
- if (_cancel) {
- kill(m_child_pid, SIGTERM);
- }
- //cout << "got line: " << line << endl;
-
- gchar **split = g_strsplit(line, ":",5);
- gchar *status = g_strstrip(split[0]);
- gchar *pkg = g_strstrip(split[1]);
- gchar *percent = g_strstrip(split[2]);
- gchar *str = g_strdup(g_strstrip(split[3]));
-
- // major problem here, we got unexpected input. should _never_ happen
- if(!(pkg && status)) {
- continue;
- }
-
- // first check for errors and conf-file prompts
- if (strstr(status, "pmerror") != NULL) {
- // error from dpkg
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL,
- str);
- } else if (strstr(status, "pmconffile") != NULL) {
- // conffile-request from dpkg, needs to be parsed different
- int i=0;
- int count=0;
- string orig_file, new_file;
-
- // go to first ' and read until the end
- for(;str[i] != '\'' || str[i] == 0; i++)
- /*nothing*/
- ;
- i++;
- for(;str[i] != '\'' || str[i] == 0; i++)
- orig_file.append(1, str[i]);
- i++;
-
- // same for second ' and read until the end
- for(;str[i] != '\'' || str[i] == 0; i++)
- /*nothing*/
- ;
- i++;
- for(;str[i] != '\'' || str[i] == 0; i++)
- new_file.append(1, str[i]);
- i++;
+ char buf[2];
+ static char line[1024] = "";
+
+ while (1) {
+ // This algorithm should be improved (it's the same as the rpm one ;)
+ int len = read(fd, buf, 1);
+
+ // nothing was read
+ if(len < 1) {
+ break;
+ }
+
+ // update the time we last saw some action
+ m_lastTermAction = time(NULL);
+
+ if( buf[0] == '\n') {
+ if (_cancel) {
+ kill(m_child_pid, SIGTERM);
+ }
+ //cout << "got line: " << line << endl;
+
+ gchar **split = g_strsplit(line, ":",5);
+ gchar *status = g_strstrip(split[0]);
+ gchar *pkg = g_strstrip(split[1]);
+ gchar *percent = g_strstrip(split[2]);
+ gchar *str = g_strdup(g_strstrip(split[3]));
+
+ // major problem here, we got unexpected input. should _never_ happen
+ if(!(pkg && status)) {
+ continue;
+ }
+
+ // first check for errors and conf-file prompts
+ if (strstr(status, "pmerror") != NULL) {
+ // error from dpkg
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL,
+ str);
+ } else if (strstr(status, "pmconffile") != NULL) {
+ // conffile-request from dpkg, needs to be parsed different
+ int i=0;
+ int count=0;
+ string orig_file, new_file;
+
+ // go to first ' and read until the end
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ /*nothing*/
+ ;
+ i++;
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ orig_file.append(1, str[i]);
+ i++;
+
+ // same for second ' and read until the end
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ /*nothing*/
+ ;
+ i++;
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ new_file.append(1, str[i]);
+ i++;
gchar *filename;
filename = g_build_filename(DATADIR, "PackageKit", "helpers", "aptcc", "pkconffile", NULL);
@@ -1481,15 +1456,15 @@ void AptIntf::updateInterface(int fd, int writeFd)
gboolean ret;
gint exitStatus;
ret = g_spawn_sync(NULL, // working dir
- argv, // argv
- envp, // envp
- G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
- NULL, // child_setup
- NULL, // user_data
- NULL, // standard_output
- NULL, // standard_error
- &exitStatus,
- &error);
+ argv, // argv
+ envp, // envp
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+ NULL, // child_setup
+ NULL, // user_data
+ NULL, // standard_output
+ NULL, // standard_error
+ &exitStatus,
+ &error);
int exit_code = WEXITSTATUS(exitStatus);
cout << filename << " " << exit_code << " ret: "<< ret << endl;
@@ -1510,11 +1485,11 @@ void AptIntf::updateInterface(int fd, int writeFd)
// either the user didn't choose an option or the front end failed'
gchar *confmsg;
confmsg = g_strdup_printf("The configuration file '%s' "
- "(modified by you or a script) "
- "has a newer version '%s'.\n"
- "Please verify your changes and update it manually.",
- orig_file.c_str(),
- new_file.c_str());
+ "(modified by you or a script) "
+ "has a newer version '%s'.\n"
+ "Please verify your changes and update it manually.",
+ orig_file.c_str(),
+ new_file.c_str());
pk_backend_message(m_backend,
PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED,
confmsg);
@@ -1524,145 +1499,145 @@ void AptIntf::updateInterface(int fd, int writeFd)
g_debug("Failed to write");
}
}
- } else if (strstr(status, "pmstatus") != NULL) {
- // INSTALL & UPDATE
- // - Running dpkg
- // loops ALL
- // - 0 Installing pkg (sometimes this is skiped)
- // - 25 Preparing pkg
- // - 50 Unpacking pkg
- // - 75 Preparing to configure pkg
- // ** Some pkgs have
- // - Running post-installation
- // - Running dpkg
- // reloops all
- // - 0 Configuring pkg
- // - +25 Configuring pkg (SOMETIMES)
- // - 100 Installed pkg
- // after all
- // - Running post-installation
-
- // REMOVE
- // - Running dpkg
- // loops
- // - 25 Removing pkg
- // - 50 Preparing for removal of pkg
- // - 75 Removing pkg
- // - 100 Removed pkg
- // after all
- // - Running post-installation
-
- // Let's start parsing the status:
- if (starts_with(str, "Preparing to configure")) {
- // Preparing to Install/configure
-// cout << "Found Preparing to configure! " << line << endl;
- // The next item might be Configuring so better it be 100
- m_lastSubProgress = 100;
- emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
- pk_backend_set_sub_percentage(m_backend, 75);
- } else if (starts_with(str, "Preparing for removal")) {
- // Preparing to Install/configure
-// cout << "Found Preparing for removal! " << line << endl;
- m_lastSubProgress = 50;
- emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
- pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
- } else if (starts_with(str, "Preparing")) {
- // Preparing to Install/configure
-// cout << "Found Preparing! " << line << endl;
- // if last package is different then finish it
- if (!m_lastPackage.empty() && m_lastPackage.compare(pkg) != 0) {
-// cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- }
- emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
- pk_backend_set_sub_percentage(m_backend, 25);
- } else if (starts_with(str, "Unpacking")) {
-// cout << "Found Unpacking! " << line << endl;
- emitTransactionPackage(pkg, PK_INFO_ENUM_DECOMPRESSING);
- pk_backend_set_sub_percentage(m_backend, 50);
- } else if (starts_with(str, "Configuring")) {
- // Installing Package
-// cout << "Found Configuring! " << line << endl;
- if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
- cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- m_lastSubProgress = 0;
- }
- emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
- pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
- m_lastSubProgress += 25;
- } else if (starts_with(str, "Running dpkg")) {
-// cout << "Found Running dpkg! " << line << endl;
- } else if (starts_with(str, "Running")) {
-// cout << "Found Running! " << line << endl;
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_COMMIT);
- } else if (starts_with(str, "Installing")) {
-// cout << "Found Installing! " << line << endl;
- // FINISH the last package
- if (!m_lastPackage.empty()) {
-// cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- }
- m_lastSubProgress = 0;
- emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
- pk_backend_set_sub_percentage(m_backend, 0);
- } else if (starts_with(str, "Removing")) {
-// cout << "Found Removing! " << line << endl;
- if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
-// cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- }
- m_lastSubProgress += 25;
- emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
- pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
- } else if (starts_with(str, "Installed") ||
- starts_with(str, "Removed")) {
-// cout << "Found FINISHED! " << line << endl;
- m_lastSubProgress = 100;
- emitTransactionPackage(pkg, PK_INFO_ENUM_FINISHED);
- } else {
- cout << ">>>Unmaped value<<< :" << line << endl;
- }
-
- if (!starts_with(str, "Running")) {
- m_lastPackage = pkg;
- }
- m_startCounting = true;
- } else {
- m_startCounting = true;
- }
-
- int val = atoi(percent);
- //cout << "progress: " << val << endl;
- pk_backend_set_percentage(m_backend, val);
-
- // clean-up
- g_strfreev(split);
- g_free(str);
- line[0] = 0;
- } else {
- buf[1] = 0;
- strcat(line, buf);
- }
- }
-
- time_t now = time(NULL);
-
- if(!m_startCounting) {
- usleep(100000);
- // wait until we get the first message from apt
- m_lastTermAction = now;
- }
-
- if ((now - m_lastTermAction) > m_terminalTimeout) {
- // get some debug info
- g_warning("no statusfd changes/content updates in terminal for %i"
- " seconds",m_terminalTimeout);
- m_lastTermAction = time(NULL);
- }
-
- // sleep for a while to don't obcess over it
- usleep(5000);
+ } else if (strstr(status, "pmstatus") != NULL) {
+ // INSTALL & UPDATE
+ // - Running dpkg
+ // loops ALL
+ // - 0 Installing pkg (sometimes this is skiped)
+ // - 25 Preparing pkg
+ // - 50 Unpacking pkg
+ // - 75 Preparing to configure pkg
+ // ** Some pkgs have
+ // - Running post-installation
+ // - Running dpkg
+ // reloops all
+ // - 0 Configuring pkg
+ // - +25 Configuring pkg (SOMETIMES)
+ // - 100 Installed pkg
+ // after all
+ // - Running post-installation
+
+ // REMOVE
+ // - Running dpkg
+ // loops
+ // - 25 Removing pkg
+ // - 50 Preparing for removal of pkg
+ // - 75 Removing pkg
+ // - 100 Removed pkg
+ // after all
+ // - Running post-installation
+
+ // Let's start parsing the status:
+ if (starts_with(str, "Preparing to configure")) {
+ // Preparing to Install/configure
+ // cout << "Found Preparing to configure! " << line << endl;
+ // The next item might be Configuring so better it be 100
+ m_lastSubProgress = 100;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
+ pk_backend_set_sub_percentage(m_backend, 75);
+ } else if (starts_with(str, "Preparing for removal")) {
+ // Preparing to Install/configure
+ // cout << "Found Preparing for removal! " << line << endl;
+ m_lastSubProgress = 50;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
+ pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
+ } else if (starts_with(str, "Preparing")) {
+ // Preparing to Install/configure
+ // cout << "Found Preparing! " << line << endl;
+ // if last package is different then finish it
+ if (!m_lastPackage.empty() && m_lastPackage.compare(pkg) != 0) {
+ // cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ }
+ emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
+ pk_backend_set_sub_percentage(m_backend, 25);
+ } else if (starts_with(str, "Unpacking")) {
+ // cout << "Found Unpacking! " << line << endl;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_DECOMPRESSING);
+ pk_backend_set_sub_percentage(m_backend, 50);
+ } else if (starts_with(str, "Configuring")) {
+ // Installing Package
+ // cout << "Found Configuring! " << line << endl;
+ if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
+ cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ m_lastSubProgress = 0;
+ }
+ emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
+ pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
+ m_lastSubProgress += 25;
+ } else if (starts_with(str, "Running dpkg")) {
+ // cout << "Found Running dpkg! " << line << endl;
+ } else if (starts_with(str, "Running")) {
+ // cout << "Found Running! " << line << endl;
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_COMMIT);
+ } else if (starts_with(str, "Installing")) {
+ // cout << "Found Installing! " << line << endl;
+ // FINISH the last package
+ if (!m_lastPackage.empty()) {
+ // cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ }
+ m_lastSubProgress = 0;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
+ pk_backend_set_sub_percentage(m_backend, 0);
+ } else if (starts_with(str, "Removing")) {
+ // cout << "Found Removing! " << line << endl;
+ if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
+ // cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ }
+ m_lastSubProgress += 25;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
+ pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
+ } else if (starts_with(str, "Installed") ||
+ starts_with(str, "Removed")) {
+ // cout << "Found FINISHED! " << line << endl;
+ m_lastSubProgress = 100;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_FINISHED);
+ } else {
+ cout << ">>>Unmaped value<<< :" << line << endl;
+ }
+
+ if (!starts_with(str, "Running")) {
+ m_lastPackage = pkg;
+ }
+ m_startCounting = true;
+ } else {
+ m_startCounting = true;
+ }
+
+ int val = atoi(percent);
+ //cout << "progress: " << val << endl;
+ pk_backend_set_percentage(m_backend, val);
+
+ // clean-up
+ g_strfreev(split);
+ g_free(str);
+ line[0] = 0;
+ } else {
+ buf[1] = 0;
+ strcat(line, buf);
+ }
+ }
+
+ time_t now = time(NULL);
+
+ if(!m_startCounting) {
+ usleep(100000);
+ // wait until we get the first message from apt
+ m_lastTermAction = now;
+ }
+
+ if ((now - m_lastTermAction) > m_terminalTimeout) {
+ // get some debug info
+ g_warning("no statusfd changes/content updates in terminal for %i"
+ " seconds",m_terminalTimeout);
+ m_lastTermAction = time(NULL);
+ }
+
+ // sleep for a while to don't obcess over it
+ usleep(5000);
}
// DoAutomaticRemove - Remove all automatic unused packages
@@ -1670,41 +1645,38 @@ void AptIntf::updateInterface(int fd, int writeFd)
/* Remove unused automatic packages */
bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
{
- bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
- pkgDepCache::ActionGroup group(*Cache);
-
- if (_config->FindB("APT::Get::Remove",true) == false &&
- doAutoRemove == true)
- {
- cout << "We are not supposed to delete stuff, can't start "
- "AutoRemover" << endl;
- doAutoRemove = false;
- }
-
- // look over the cache to see what can be removed
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
- {
- if (Cache[Pkg].Garbage && doAutoRemove)
- {
- if (Pkg.CurrentVer() != 0 &&
- Pkg->CurrentState != pkgCache::State::ConfigFiles) {
- Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
- } else {
- Cache->MarkKeep(Pkg, false, false);
- }
- }
- }
-
- // Now see if we destroyed anything
- if (Cache->BrokenCount() != 0)
- {
- cout << "Hmm, seems like the AutoRemover destroyed something which really\n"
- "shouldn't happen. Please file a bug report against apt." << endl;
- // TODO call show_broken
- // ShowBroken(c1out,Cache,false);
- return _error->Error("Internal Error, AutoRemover broke stuff");
- }
- return true;
+ bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
+ pkgDepCache::ActionGroup group(*Cache);
+
+ if (_config->FindB("APT::Get::Remove",true) == false &&
+ doAutoRemove == true) {
+ cout << "We are not supposed to delete stuff, can't start "
+ "AutoRemover" << endl;
+ doAutoRemove = false;
+ }
+
+ // look over the cache to see what can be removed
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg) {
+ if (Cache[Pkg].Garbage && doAutoRemove)
+ {
+ if (Pkg.CurrentVer() != 0 &&
+ Pkg->CurrentState != pkgCache::State::ConfigFiles) {
+ Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
+ } else {
+ Cache->MarkKeep(Pkg, false, false);
+ }
+ }
+ }
+
+ // Now see if we destroyed anything
+ if (Cache->BrokenCount() != 0) {
+ cout << "Hmm, seems like the AutoRemover destroyed something which really\n"
+ "shouldn't happen. Please file a bug report against apt." << endl;
+ // TODO call show_broken
+ // ShowBroken(c1out,Cache,false);
+ return _error->Error("Internal Error, AutoRemover broke stuff");
+ }
+ return true;
}
PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
@@ -1716,7 +1688,7 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
// Don't fail if package list is empty
if (package_ids == NULL)
- return ret;
+ return ret;
for (uint i = 0; i < g_strv_length(package_ids); ++i) {
if (_cancel) {
@@ -1797,17 +1769,17 @@ PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
bool AptIntf::markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag)
{
- bool ret;
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
- if (_cancel) {
- break;
- }
+ bool ret;
+ for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
+ if (_cancel) {
+ break;
+ }
- // Mark package as auto-installed
- cache->MarkAuto(i->first, flag);
- }
+ // Mark package as auto-installed
+ cache->MarkAuto(i->first, flag);
+ }
- return true;
+ return true;
}
bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
@@ -1828,17 +1800,17 @@ bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &r
gboolean ret;
ret = g_spawn_sync(NULL, // working dir
- argv, // argv
- NULL, // envp
- G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
- NULL, // child_setup
- NULL, // user_data
- &std_out, // standard_output
- &std_err, // standard_error
- &status,
- &gerror);
+ argv, // argv
+ NULL, // envp
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+ NULL, // child_setup
+ NULL, // user_data
+ &std_out, // standard_output
+ &std_err, // standard_error
+ &status,
+ &gerror);
int exit_code = WEXITSTATUS(status);
-// cout << "DebStatus " << exit_code << " WEXITSTATUS " << WEXITSTATUS(status) << " ret: "<< ret << endl;
+ // cout << "DebStatus " << exit_code << " WEXITSTATUS " << WEXITSTATUS(status) << " ret: "<< ret << endl;
cout << "std_out " << strlen(std_out) << std_out << endl;
cout << "std_err " << strlen(std_err) << std_err << endl;
@@ -1859,27 +1831,27 @@ bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &r
// The second line contains the packages to remove with '-' appended to
// the end of the package name
- gchar **removePkgs = NULL;
- if (strlen(lines[1]) > 0) {
- gchar *removeStr = g_strndup(lines[1], strlen(lines[1]) - 1);
- removePkgs = g_strsplit(removeStr, "- ", 0);
- g_free(removeStr);
- }
+ gchar **removePkgs = NULL;
+ if (strlen(lines[1]) > 0) {
+ gchar *removeStr = g_strndup(lines[1], strlen(lines[1]) - 1);
+ removePkgs = g_strsplit(removeStr, "- ", 0);
+ g_free(removeStr);
+ }
// Resolve the packages to install
PkBitfield intallFilters;
intallFilters = pk_bitfield_from_enums (
- PK_FILTER_ENUM_NOT_INSTALLED,
- PK_FILTER_ENUM_ARCH,
- -1);
+ PK_FILTER_ENUM_NOT_INSTALLED,
+ PK_FILTER_ENUM_ARCH,
+ -1);
install = resolvePI(installPkgs, intallFilters);
// Resolve the packages to remove
PkBitfield removeFilters;
removeFilters = pk_bitfield_from_enums (
- PK_FILTER_ENUM_INSTALLED,
- PK_FILTER_ENUM_ARCH,
- -1);
+ PK_FILTER_ENUM_INSTALLED,
+ PK_FILTER_ENUM_ARCH,
+ -1);
remove = resolvePI(removePkgs, removeFilters);
m_localDebFile = file;
@@ -1893,142 +1865,142 @@ bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &r
bool AptIntf::installFile(const gchar *path, bool simulate)
{
- if (path == NULL) {
- g_error ("installFile() path was NULL!");
- return false;
- }
-
- DebFile deb(path);
- if (!deb.isValid()) {
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "DEB package is invalid!");
- return false;
- }
-
- if (simulate) {
- // TODO: Emit signal for to-be-installed package
- //emit_package("", PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
- return true;
- }
-
- string arch = deb.architecture();
- string aptArch = _config->Find("APT::Architecture");
-
- // TODO: Perform this check _before_ installing all dependencies. (The whole thing needs
- // some rethinking anyway)
- if ((arch != "all") &&
- (arch != aptArch)) {
- cout << arch << " vs. " << aptArch << endl;
- gchar *msg = g_strdup_printf ("Package has wrong architecture, it is %s, but we need %s",
- arch.c_str(), aptArch.c_str());
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_INCOMPATIBLE_ARCHITECTURE, msg);
- g_free (msg);
- return false;
- }
-
- // Build package-id for the new package
- gchar *deb_package_id = pk_package_id_build (deb.packageName ().c_str (),
- deb.version ().c_str (),
- deb.architecture ().c_str (),
- "local");
- const gchar *deb_summary = deb.summary ().c_str ();
-
- gint status;
- gchar **argv;
- gchar **envp;
- gchar *std_out;
- gchar *std_err;
- GError *error = NULL;
-
- argv = (gchar **) g_malloc(4 * sizeof(gchar *));
- argv[0] = g_strdup("/usr/bin/dpkg");
- argv[1] = g_strdup("-i");
- argv[2] = g_strdup(path); //g_strdup_printf("\'%s\'", path);
- argv[3] = NULL;
-
- envp = (gchar **) g_malloc(4 * sizeof(gchar *));
- envp[0] = g_strdup("PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
- envp[1] = g_strdup("DEBIAN_FRONTEND=passthrough");
- envp[2] = g_strdup_printf("DEBCONF_PIPE=%s", pk_backend_get_frontend_socket(m_backend));
- envp[3] = NULL;
-
- // We're installing the package now...
- pk_backend_package (m_backend, PK_INFO_ENUM_INSTALLING, deb_package_id, deb_summary);
-
- g_spawn_sync(NULL, // working dir
- argv,
- envp,
- G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
- NULL, // child_setup
- NULL, // user_data
- &std_out, // standard_output
- &std_err, // standard_error
- &status,
- &error);
- int exit_code = WEXITSTATUS(status);
-
- cout << "DpkgOut: " << std_out << endl;
- cout << "DpkgErr: " << std_err << endl;
-
- if (error != NULL) {
- // We couldn't run dpkg for some reason...
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, error->message);
- return false;
- }
-
- // If installation has failed...
- if (exit_code != 0) {
- if ((std_out == NULL) || (strlen(std_out) == 0)) {
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_err);
- } else {
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_out);
- }
- return false;
- }
-
- // Emit data of the now-installed DEB package
- pk_backend_package (m_backend, PK_INFO_ENUM_INSTALLED, deb_package_id, deb_summary);
- g_free (deb_package_id);
-
- return true;
+ if (path == NULL) {
+ g_error ("installFile() path was NULL!");
+ return false;
+ }
+
+ DebFile deb(path);
+ if (!deb.isValid()) {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "DEB package is invalid!");
+ return false;
+ }
+
+ if (simulate) {
+ // TODO: Emit signal for to-be-installed package
+ //emit_package("", PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+ return true;
+ }
+
+ string arch = deb.architecture();
+ string aptArch = _config->Find("APT::Architecture");
+
+ // TODO: Perform this check _before_ installing all dependencies. (The whole thing needs
+ // some rethinking anyway)
+ if ((arch != "all") &&
+ (arch != aptArch)) {
+ cout << arch << " vs. " << aptArch << endl;
+ gchar *msg = g_strdup_printf ("Package has wrong architecture, it is %s, but we need %s",
+ arch.c_str(), aptArch.c_str());
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_INCOMPATIBLE_ARCHITECTURE, msg);
+ g_free (msg);
+ return false;
+ }
+
+ // Build package-id for the new package
+ gchar *deb_package_id = pk_package_id_build (deb.packageName ().c_str (),
+ deb.version ().c_str (),
+ deb.architecture ().c_str (),
+ "local");
+ const gchar *deb_summary = deb.summary ().c_str ();
+
+ gint status;
+ gchar **argv;
+ gchar **envp;
+ gchar *std_out;
+ gchar *std_err;
+ GError *error = NULL;
+
+ argv = (gchar **) g_malloc(4 * sizeof(gchar *));
+ argv[0] = g_strdup("/usr/bin/dpkg");
+ argv[1] = g_strdup("-i");
+ argv[2] = g_strdup(path); //g_strdup_printf("\'%s\'", path);
+ argv[3] = NULL;
+
+ envp = (gchar **) g_malloc(4 * sizeof(gchar *));
+ envp[0] = g_strdup("PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
+ envp[1] = g_strdup("DEBIAN_FRONTEND=passthrough");
+ envp[2] = g_strdup_printf("DEBCONF_PIPE=%s", pk_backend_get_frontend_socket(m_backend));
+ envp[3] = NULL;
+
+ // We're installing the package now...
+ pk_backend_package (m_backend, PK_INFO_ENUM_INSTALLING, deb_package_id, deb_summary);
+
+ g_spawn_sync(NULL, // working dir
+ argv,
+ envp,
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+ NULL, // child_setup
+ NULL, // user_data
+ &std_out, // standard_output
+ &std_err, // standard_error
+ &status,
+ &error);
+ int exit_code = WEXITSTATUS(status);
+
+ cout << "DpkgOut: " << std_out << endl;
+ cout << "DpkgErr: " << std_err << endl;
+
+ if (error != NULL) {
+ // We couldn't run dpkg for some reason...
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, error->message);
+ return false;
+ }
+
+ // If installation has failed...
+ if (exit_code != 0) {
+ if ((std_out == NULL) || (strlen(std_out) == 0)) {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_err);
+ } else {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_out);
+ }
+ return false;
+ }
+
+ // Emit data of the now-installed DEB package
+ pk_backend_package (m_backend, PK_INFO_ENUM_INSTALLED, deb_package_id, deb_summary);
+ g_free (deb_package_id);
+
+ return true;
}
bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto)
{
- //cout << "runTransaction" << simulate << remove << endl;
- bool WithLock = !simulate; // Check to see if we are just simulating,
- //since for that no lock is needed
-
- pkgCacheFile Cache;
- OpTextProgress Prog(*_config);
- int timeout = 10;
- // TODO test this
- while (Cache.Open(&Prog, WithLock) == false) {
- // failed to open cache, try checkDeps then..
- // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
- if (WithLock == false || (timeout <= 0)) {
- show_errors(m_backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
- return false;
- } else {
- _error->Discard();
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
- sleep(1);
- timeout--;
- }
- }
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
-
- // Enter the special broken fixing mode if the user specified arguments
- bool BrokenFix = false;
- if (Cache->BrokenCount() != 0) {
- BrokenFix = true;
- }
-
- unsigned int ExpectedInst = 0;
- pkgProblemResolver Fix(Cache);
-
- // new scope for the ActionGroup
- {
- pkgDepCache::ActionGroup group(Cache);
+ //cout << "runTransaction" << simulate << remove << endl;
+ bool WithLock = !simulate; // Check to see if we are just simulating,
+ //since for that no lock is needed
+
+ pkgCacheFile Cache;
+ OpTextProgress Prog(*_config);
+ int timeout = 10;
+ // TODO test this
+ while (Cache.Open(&Prog, WithLock) == false) {
+ // failed to open cache, try checkDeps then..
+ // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
+ if (WithLock == false || (timeout <= 0)) {
+ show_errors(m_backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
+ return false;
+ } else {
+ _error->Discard();
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
+ sleep(1);
+ timeout--;
+ }
+ }
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
+
+ // Enter the special broken fixing mode if the user specified arguments
+ bool BrokenFix = false;
+ if (Cache->BrokenCount() != 0) {
+ BrokenFix = true;
+ }
+
+ unsigned int ExpectedInst = 0;
+ pkgProblemResolver Fix(Cache);
+
+ // new scope for the ActionGroup
+ {
+ pkgDepCache::ActionGroup group(Cache);
for(PkgList::iterator i = install.begin(); i != install.end(); ++i) {
pkgCache::PkgIterator Pkg = i->first;
if (_cancel) {
@@ -2036,70 +2008,71 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
}
if (TryToInstall(Pkg,
- Cache,
- Fix,
- false, // remove
- BrokenFix,
- ExpectedInst) == false) {
+ Cache,
+ Fix,
+ false, // remove
+ BrokenFix,
+ ExpectedInst) == false) {
return false;
}
}
- if (!simulate)
- markAutoInstalled(Cache, install, markAuto);
+ if (!simulate) {
+ markAutoInstalled(Cache, install, markAuto);
+ }
- for(PkgList::iterator i = remove.begin(); i != remove.end(); ++i) {
+ for (PkgList::iterator i = remove.begin(); i != remove.end(); ++i) {
pkgCache::PkgIterator Pkg = i->first;
if (_cancel) {
break;
}
if (TryToInstall(Pkg,
- Cache,
- Fix,
- true, // remove
- BrokenFix,
- ExpectedInst) == false) {
+ Cache,
+ Fix,
+ true, // remove
+ BrokenFix,
+ ExpectedInst) == false) {
return false;
}
}
- // Call the scored problem resolver
- Fix.InstallProtect();
- if (Fix.Resolve(true) == false) {
- _error->Discard();
- }
-
- // Now we check the state of the packages,
- if (Cache->BrokenCount() != 0)
- {
- // if the problem resolver could not fix all broken things
- // show what is broken
- show_broken(m_backend, Cache, false);
- return false;
- }
- }
- // Try to auto-remove packages
- if (!DoAutomaticRemove(Cache)) {
- // TODO
- return false;
- }
-
- // check for essential packages!!!
- if (removingEssentialPackages(Cache)) {
- return false;
- }
-
- if (simulate) {
- // Print out a list of packages that are going to be installed extra
- emitChangedPackages(Cache);
- return true;
- } else {
- // Store the packages that are going to change
- // so we can emit them as we process it.
- populateInternalPackages(Cache);
- return installPackages(Cache);
- }
+ // Call the scored problem resolver
+ Fix.InstallProtect();
+ if (Fix.Resolve(true) == false) {
+ _error->Discard();
+ }
+
+ // Now we check the state of the packages,
+ if (Cache->BrokenCount() != 0) {
+ // if the problem resolver could not fix all broken things
+ // show what is broken
+ show_broken(m_backend, Cache, false);
+ return false;
+ }
+ }
+
+ // Try to auto-remove packages
+ if (!DoAutomaticRemove(Cache)) {
+ // TODO
+ return false;
+ }
+
+ // check for essential packages!!!
+ if (removingEssentialPackages(Cache)) {
+ return false;
+ }
+
+ if (simulate) {
+ // Print out a list of packages that are going to be installed extra
+ emitChangedPackages(Cache);
+ return true;
+ } else {
+ // Store the packages that are going to change
+ // so we can emit them as we process it.
+ populateInternalPackages(Cache);
+ return installPackages(Cache);
+ }
}
// InstallPackages - Download and install the packages
@@ -2108,287 +2081,276 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, b
happen and then calls the download routines */
bool AptIntf::installPackages(pkgCacheFile &Cache)
{
- //cout << "installPackages() called" << endl;
- if (_config->FindB("APT::Get::Purge",false) == true)
- {
- pkgCache::PkgIterator I = Cache->PkgBegin();
- for (; I.end() == false; I++)
- {
- if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete) {
- Cache->MarkDelete(I,true);
- }
- }
- }
-
- // check for essential packages!!!
- if (removingEssentialPackages(Cache)) {
- return false;
- }
-
- // Sanity check
- if (Cache->BrokenCount() != 0)
- {
- // TODO
- show_broken(m_backend, Cache, false);
- _error->Error("Internal error, InstallPackages was called with broken packages!");
- return false;
- }
-
- if (Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
- Cache->BadCount() == 0) {
- return true;
- }
-
- // No remove flag
- if (Cache->DelCount() != 0 && _config->FindB("APT::Get::Remove", true) == false) {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE,
- "Packages need to be removed but remove is disabled.");
- return false;
- }
-
- // Create the text record parser
- pkgRecords Recs(Cache);
- if (_error->PendingError() == true) {
- return false;
- }
-
- // Lock the archive directory
- FileFd Lock;
- if (_config->FindB("Debug::NoLocking", false) == false)
- {
- Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
- if (_error->PendingError() == true) {
- return _error->Error("Unable to lock the download directory");
- }
- }
-
- // Create the download object
- AcqPackageKitStatus Stat(this, m_backend, _cancel);
-
- // get a fetcher
- pkgAcquire fetcher;
- fetcher.Setup(&Stat);
-
- // Create the package manager and prepare to download
-// SPtr<pkgPackageManager> PM= _system->CreatePM(Cache);
- SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
- if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
- _error->PendingError() == true) {
- return false;
- }
-
- // Generate the list of affected packages
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); pkg.end() == false; ++pkg)
- {
- // Ignore no-version packages
- if (pkg->VersionList == 0) {
- continue;
- }
+ //cout << "installPackages() called" << endl;
+ if (_config->FindB("APT::Get::Purge",false) == true) {
+ pkgCache::PkgIterator I = Cache->PkgBegin();
+ for (; I.end() == false; ++I) {
+ if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete) {
+ Cache->MarkDelete(I,true);
+ }
+ }
+ }
- // Not interesting
- if ((Cache[pkg].Keep() == true ||
- Cache[pkg].InstVerIter(Cache) == pkg.CurrentVer()) &&
- pkg.State() == pkgCache::PkgIterator::NeedsNothing &&
- (Cache[pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
- (pkg.Purge() != false || Cache[pkg].Mode != pkgDepCache::ModeDelete ||
- (Cache[pkg].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
- {
- continue;
- }
+ // check for essential packages!!!
+ if (removingEssentialPackages(Cache)) {
+ return false;
+ }
- pkgCache::VerIterator ver = Cache[pkg].InstVerIter(Cache);
- if (ver.end() && (ver = find_candidate_ver(pkg))) {
- // Ignore invalid versions
- continue;
- }
+ // Sanity check
+ if (Cache->BrokenCount() != 0) {
+ // TODO
+ show_broken(m_backend, Cache, false);
+ _error->Error("Internal error, InstallPackages was called with broken packages!");
+ return false;
+ }
- // Append it to the list
- Stat.addPackagePair(PkgPair(pkg, ver));
- }
-
- // Display statistics
- double FetchBytes = fetcher.FetchNeeded();
- double FetchPBytes = fetcher.PartialPresent();
- double DebBytes = fetcher.TotalNeeded();
- if (DebBytes != Cache->DebSize())
- {
- cout << DebBytes << ',' << Cache->DebSize() << endl;
-cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
-/* _error->Warning("How odd.. The sizes didn't match, email apt at packages.debian.org");*/
- }
-
- // Number of bytes
-// if (DebBytes != FetchBytes)
-// ioprintf(c1out, "Need to get %sB/%sB of archives.\n",
-// SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
-// else if (DebBytes != 0)
-// ioprintf(c1out, "Need to get %sB of archives.\n",
-// SizeToStr(DebBytes).c_str());
-
- // Size delta
-// if (Cache->UsrSize() >= 0)
-// ioprintf(c1out, "After this operation, %sB of additional disk space will be used.\n",
-// SizeToStr(Cache->UsrSize()).c_str());
-// else
-// ioprintf(c1out, "After this operation, %sB disk space will be freed.\n",
-// SizeToStr(-1*Cache->UsrSize()).c_str());
-
- if (_error->PendingError() == true) {
- cout << "PendingError " << endl;
- return false;
- }
-
- /* Check for enough free space */
- struct statvfs Buf;
- string OutputDir = _config->FindDir("Dir::Cache::Archives");
- if (statvfs(OutputDir.c_str(),&Buf) != 0) {
- return _error->Errno("statvfs",
- "Couldn't determine free space in %s",
- OutputDir.c_str());
- }
- if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
- {
- struct statfs Stat;
- if (statfs(OutputDir.c_str(), &Stat) != 0 ||
- unsigned(Stat.f_type) != RAMFS_MAGIC)
- {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_NO_SPACE_ON_DEVICE,
- string("You don't have enough free space in ").append(OutputDir).c_str());
- return _error->Error("You don't have enough free space in %s.",
- OutputDir.c_str());
- }
- }
-
- if (!checkTrusted(fetcher, m_backend)) {
- return false;
- }
-
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
- pk_backend_set_simultaneous_mode(m_backend, true);
- // Download and check if we can continue
- if (fetcher.Run() != pkgAcquire::Continue
- && _cancel == false)
- {
- // We failed and we did not cancel
- show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
- return false;
- }
- pk_backend_set_simultaneous_mode(m_backend, false);
-
- if (_error->PendingError() == true) {
- cout << "PendingError download" << endl;
- return false;
- }
-
- // Right now it's not safe to cancel
- pk_backend_set_allow_cancel (m_backend, false);
-
- // TODO true or false?
- if (_cancel) {
- return true;
- }
-
- // Download should be finished by now, changing it's status
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
- pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
-
- // TODO DBus activated does not have all vars
- // we could try to see if this is the case
- setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
- _system->UnLock();
-
- if (!m_localDebFile.empty()) {
- // add the local file name to be proccessed by the PM queue
- pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
- pm->addDebFile(m_localDebFile);
- }
-
- pkgPackageManager::OrderResult res;
- res = PM->DoInstallPreFork();
- if (res == pkgPackageManager::Failed) {
- g_warning ("Failed to prepare installation");
- show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
- return false;
- }
-
- // File descriptors for reading dpkg --status-fd
- int readFromChildFD[2];
- if (pipe(readFromChildFD) < 0) {
- cout << "Failed to create a pipe" << endl;
- return false;
- }
-
- int pty_master;
- m_child_pid = forkpty(&pty_master, NULL, NULL, NULL);
- if (m_child_pid == -1) {
- return false;
- }
-
- if (m_child_pid == 0) {
- //cout << "FORKED: installPackages(): DoInstall" << endl;
-
- // close pipe we don't need
- close(readFromChildFD[0]);
-
- // Change the locale to not get libapt localization
- setlocale(LC_ALL, "C");
-
- // Debconf handlying
- gchar *socket;
- if (socket = pk_backend_get_frontend_socket(m_backend)) {
- setenv("DEBIAN_FRONTEND", "passthrough", 1);
- setenv("DEBCONF_PIPE", socket, 1);
- } else {
- // we don't have a socket set, let's fallback to noninteractive
- setenv("DEBIAN_FRONTEND", "noninteractive", 1);
- }
-
- gchar *locale;
- // Set the LANGUAGE so debconf messages get localization
- if (locale = pk_backend_get_locale(m_backend)) {
- setenv("LANGUAGE", locale, 1);
- setenv("LANG", locale, 1);
- //setenv("LANG", "C", 1);
- }
-
- // Pass the write end of the pipe to the install function
- res = PM->DoInstallPostFork(readFromChildFD[1]);
-
- // dump errors into cerr (pass it to the parent process)
- _error->DumpErrors();
-
- close(readFromChildFD[1]);
-
- return res == 0;
- }
-
- cout << "PARENT proccess running..." << endl;
- // make it nonblocking, verry important otherwise
- // when the child finish we stay stuck.
- fcntl(readFromChildFD[0], F_SETFL, O_NONBLOCK);
- fcntl(pty_master, F_SETFL, O_NONBLOCK);
-
- // init the timer
- m_lastTermAction = time(NULL);
- m_startCounting = false;
-
- // Check if the child died
- int ret;
- char masterbuf[1024];
- while (waitpid(m_child_pid, &ret, WNOHANG) == 0) {
- // TODO: This is dpkg's raw output. Maybe save it for error-solving?
- while(read(pty_master, masterbuf, sizeof(masterbuf)) > 0);
- updateInterface(readFromChildFD[0], pty_master);
- }
-
- close(readFromChildFD[0]);
- close(readFromChildFD[1]);
- close(pty_master);
-
- cout << "Parent finished..." << endl;
- return true;
-}
+ if (Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
+ Cache->BadCount() == 0) {
+ return true;
+ }
+
+ // No remove flag
+ if (Cache->DelCount() != 0 && _config->FindB("APT::Get::Remove", true) == false) {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE,
+ "Packages need to be removed but remove is disabled.");
+ return false;
+ }
+
+ // Create the text record parser
+ pkgRecords Recs(Cache);
+ if (_error->PendingError() == true) {
+ return false;
+ }
+
+ // Lock the archive directory
+ FileFd Lock;
+ if (_config->FindB("Debug::NoLocking", false) == false) {
+ Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+ if (_error->PendingError() == true) {
+ return _error->Error("Unable to lock the download directory");
+ }
+ }
+
+ // Create the download object
+ AcqPackageKitStatus Stat(this, m_backend, _cancel);
+
+ // get a fetcher
+ pkgAcquire fetcher;
+ fetcher.Setup(&Stat);
+
+ // Create the package manager and prepare to download
+ // SPtr<pkgPackageManager> PM= _system->CreatePM(Cache);
+ SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
+ if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
+ _error->PendingError() == true) {
+ return false;
+ }
+
+ // Generate the list of affected packages
+ for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); pkg.end() == false; ++pkg) {
+ // Ignore no-version packages
+ if (pkg->VersionList == 0) {
+ continue;
+ }
+
+ // Not interesting
+ if ((Cache[pkg].Keep() == true ||
+ Cache[pkg].InstVerIter(Cache) == pkg.CurrentVer()) &&
+ pkg.State() == pkgCache::PkgIterator::NeedsNothing &&
+ (Cache[pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
+ (pkg.Purge() != false || Cache[pkg].Mode != pkgDepCache::ModeDelete ||
+ (Cache[pkg].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge)) {
+ continue;
+ }
+
+ pkgCache::VerIterator ver = Cache[pkg].InstVerIter(Cache);
+ if (ver.end() && (ver = find_candidate_ver(pkg))) {
+ // Ignore invalid versions
+ continue;
+ }
+
+ // Append it to the list
+ Stat.addPackagePair(PkgPair(pkg, ver));
+ }
+
+ // Display statistics
+ double FetchBytes = fetcher.FetchNeeded();
+ double FetchPBytes = fetcher.PartialPresent();
+ double DebBytes = fetcher.TotalNeeded();
+ if (DebBytes != Cache->DebSize()) {
+ cout << DebBytes << ',' << Cache->DebSize() << endl;
+ cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
+ /* _error->Warning("How odd.. The sizes didn't match, email apt at packages.debian.org");*/
+ }
+
+ // Number of bytes
+ // if (DebBytes != FetchBytes)
+ // ioprintf(c1out, "Need to get %sB/%sB of archives.\n",
+ // SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
+ // else if (DebBytes != 0)
+ // ioprintf(c1out, "Need to get %sB of archives.\n",
+ // SizeToStr(DebBytes).c_str());
+
+ // Size delta
+ // if (Cache->UsrSize() >= 0)
+ // ioprintf(c1out, "After this operation, %sB of additional disk space will be used.\n",
+ // SizeToStr(Cache->UsrSize()).c_str());
+ // else
+ // ioprintf(c1out, "After this operation, %sB disk space will be freed.\n",
+ // SizeToStr(-1*Cache->UsrSize()).c_str());
+
+ if (_error->PendingError() == true) {
+ cout << "PendingError " << endl;
+ return false;
+ }
+
+ /* Check for enough free space */
+ struct statvfs Buf;
+ string OutputDir = _config->FindDir("Dir::Cache::Archives");
+ if (statvfs(OutputDir.c_str(),&Buf) != 0) {
+ return _error->Errno("statvfs",
+ "Couldn't determine free space in %s",
+ OutputDir.c_str());
+ }
+ if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize) {
+ struct statfs Stat;
+ if (statfs(OutputDir.c_str(), &Stat) != 0 ||
+ unsigned(Stat.f_type) != RAMFS_MAGIC) {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_NO_SPACE_ON_DEVICE,
+ string("You don't have enough free space in ").append(OutputDir).c_str());
+ return _error->Error("You don't have enough free space in %s.",
+ OutputDir.c_str());
+ }
+ }
+
+ if (!checkTrusted(fetcher, m_backend)) {
+ return false;
+ }
+
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
+ pk_backend_set_simultaneous_mode(m_backend, true);
+ // Download and check if we can continue
+ if (fetcher.Run() != pkgAcquire::Continue
+ && _cancel == false) {
+ // We failed and we did not cancel
+ show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
+ return false;
+ }
+ pk_backend_set_simultaneous_mode(m_backend, false);
+
+ if (_error->PendingError() == true) {
+ cout << "PendingError download" << endl;
+ return false;
+ }
+
+ // Right now it's not safe to cancel
+ pk_backend_set_allow_cancel (m_backend, false);
+ // TODO true or false?
+ if (_cancel) {
+ return true;
+ }
+
+ // Download should be finished by now, changing it's status
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
+ pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+
+ // TODO DBus activated does not have all vars
+ // we could try to see if this is the case
+ setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
+ _system->UnLock();
+
+ if (!m_localDebFile.empty()) {
+ // add the local file name to be proccessed by the PM queue
+ pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
+ pm->addDebFile(m_localDebFile);
+ }
+
+ pkgPackageManager::OrderResult res;
+ res = PM->DoInstallPreFork();
+ if (res == pkgPackageManager::Failed) {
+ g_warning ("Failed to prepare installation");
+ show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
+ return false;
+ }
+
+ // File descriptors for reading dpkg --status-fd
+ int readFromChildFD[2];
+ if (pipe(readFromChildFD) < 0) {
+ cout << "Failed to create a pipe" << endl;
+ return false;
+ }
+
+ int pty_master;
+ m_child_pid = forkpty(&pty_master, NULL, NULL, NULL);
+ if (m_child_pid == -1) {
+ return false;
+ }
+
+ if (m_child_pid == 0) {
+ //cout << "FORKED: installPackages(): DoInstall" << endl;
+
+ // close pipe we don't need
+ close(readFromChildFD[0]);
+
+ // Change the locale to not get libapt localization
+ setlocale(LC_ALL, "C");
+
+ // Debconf handlying
+ gchar *socket;
+ if (socket = pk_backend_get_frontend_socket(m_backend)) {
+ setenv("DEBIAN_FRONTEND", "passthrough", 1);
+ setenv("DEBCONF_PIPE", socket, 1);
+ } else {
+ // we don't have a socket set, let's fallback to noninteractive
+ setenv("DEBIAN_FRONTEND", "noninteractive", 1);
+ }
+
+ gchar *locale;
+ // Set the LANGUAGE so debconf messages get localization
+ if (locale = pk_backend_get_locale(m_backend)) {
+ setenv("LANGUAGE", locale, 1);
+ setenv("LANG", locale, 1);
+ //setenv("LANG", "C", 1);
+ }
+
+ // Pass the write end of the pipe to the install function
+ res = PM->DoInstallPostFork(readFromChildFD[1]);
+
+ // dump errors into cerr (pass it to the parent process)
+ _error->DumpErrors();
+
+ close(readFromChildFD[1]);
+
+ return res == 0;
+ }
+
+ cout << "PARENT proccess running..." << endl;
+ // make it nonblocking, verry important otherwise
+ // when the child finish we stay stuck.
+ fcntl(readFromChildFD[0], F_SETFL, O_NONBLOCK);
+ fcntl(pty_master, F_SETFL, O_NONBLOCK);
+
+ // init the timer
+ m_lastTermAction = time(NULL);
+ m_startCounting = false;
+
+ // Check if the child died
+ int ret;
+ char masterbuf[1024];
+ while (waitpid(m_child_pid, &ret, WNOHANG) == 0) {
+ // TODO: This is dpkg's raw output. Maybe save it for error-solving?
+ while(read(pty_master, masterbuf, sizeof(masterbuf)) > 0);
+ updateInterface(readFromChildFD[0], pty_master);
+ }
+
+ close(readFromChildFD[0]);
+ close(readFromChildFD[1]);
+ close(pty_master);
+
+ cout << "Parent finished..." << endl;
+ return true;
+}
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index ea83520..c6c8c56 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -37,13 +37,13 @@
using namespace std;
/**
-* returns a list of packages names
-*/
+ * returns a list of packages names
+ */
vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel);
/**
-* returns a list of packages names
-*/
+ * returns a list of packages names
+ */
vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel);
typedef pair<pkgCache::PkgIterator, pkgCache::VerIterator> PkgPair;
@@ -55,47 +55,47 @@ class AptIntf
{
public:
- AptIntf(PkBackend *backend, bool &cancel);
- ~AptIntf();
-
- bool init();
- void cancel();
-
- // Check the returned VerIterator.end()
- // if it's true we could not find it
- pair<pkgCache::PkgIterator, pkgCache::VerIterator>
- find_package_id(const gchar *package_id, bool &found);
- pkgCache::VerIterator find_ver(const pkgCache::PkgIterator &pkg);
- pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
-
- PkgList resolvePI(gchar **package_ids, PkBitfield filters = PK_FILTER_ENUM_NONE);
- bool markFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
-
- bool markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag);
-
- /**
- * runs a transaction to install/remove/update packages
- * - for install and update, \p remove should be set to false
- * - if you are going to remove, \p remove should be true
- * - if you don't want to actually install/update/remove
- * \p simulate should be true, in this case packages with
- * what's going to happen will be emitted.
- */
- bool runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto = false);
-
- /**
- * Get depends
- */
- void get_depends(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive);
-
- /**
- * Get requires
- */
- void get_requires(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive);
+ AptIntf(PkBackend *backend, bool &cancel);
+ ~AptIntf();
+
+ bool init();
+ void cancel();
+
+ // Check the returned VerIterator.end()
+ // if it's true we could not find it
+ pair<pkgCache::PkgIterator, pkgCache::VerIterator>
+ find_package_id(const gchar *package_id, bool &found);
+ pkgCache::VerIterator find_ver(const pkgCache::PkgIterator &pkg);
+ pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
+
+ PkgList resolvePI(gchar **package_ids, PkBitfield filters = PK_FILTER_ENUM_NONE);
+ bool markFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
+
+ bool markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag);
+
+ /**
+ * runs a transaction to install/remove/update packages
+ * - for install and update, \p remove should be set to false
+ * - if you are going to remove, \p remove should be true
+ * - if you don't want to actually install/update/remove
+ * \p simulate should be true, in this case packages with
+ * what's going to happen will be emitted.
+ */
+ bool runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto = false);
+
+ /**
+ * Get depends
+ */
+ void get_depends(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive);
+
+ /**
+ * Get requires
+ */
+ void get_requires(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive);
/**
* Emits a package if it match the filters
@@ -103,98 +103,98 @@ public:
void emit_package(const PkgPair &pair,
PkBitfield filters = PK_FILTER_ENUM_NONE,
PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
-
+
bool matchPackage(const PkgPair &pair, PkBitfield filters);
PkgList filterPackages(PkgList &packages, PkBitfield filters);
- void emit_packages(PkgList &output,
- PkBitfield filters = PK_FILTER_ENUM_NONE,
- PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
-
- void emitUpdates(PkgList &output, PkBitfield filters = PK_FILTER_ENUM_NONE);
-
- /**
- * Emits details
- */
- void emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
- void emitDetails(PkgList &pkgs);
-
- /**
- * Emits update detail
- */
- void emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
- void emitUpdateDetails(PkgList &pkgs);
-
- /**
- * Emits files of packages
- */
- void emitFiles(PkBackend *backend, const gchar *pi);
-
- /**
- * Download and install packages
- */
- bool installPackages(pkgCacheFile &Cache);
-
- /**
- * Install a DEB file
- *
- * If you don't want to actually install/update/remove
- * \p simulate should be true, in this case packages with
- * what's going to happen will be emitted.
- */
- bool installFile(const gchar *path, bool simulate);
-
- /**
- * Check which package provides the codec
- */
- void providesCodec(PkgList &output, gchar **values);
-
- /**
- * Check which package provides a shared library
- */
- void providesLibrary(PkgList &output, gchar **values);
-
- pkgRecords *packageRecords;
- pkgCache *packageCache;
- pkgDepCache *packageDepCache;
- pkgSourceList *packageSourceList;
+ void emit_packages(PkgList &output,
+ PkBitfield filters = PK_FILTER_ENUM_NONE,
+ PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+
+ void emitUpdates(PkgList &output, PkBitfield filters = PK_FILTER_ENUM_NONE);
+
+ /**
+ * Emits details
+ */
+ void emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
+ void emitDetails(PkgList &pkgs);
+
+ /**
+ * Emits update detail
+ */
+ void emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
+ void emitUpdateDetails(PkgList &pkgs);
+
+ /**
+ * Emits files of packages
+ */
+ void emitFiles(PkBackend *backend, const gchar *pi);
+
+ /**
+ * Download and install packages
+ */
+ bool installPackages(pkgCacheFile &Cache);
+
+ /**
+ * Install a DEB file
+ *
+ * If you don't want to actually install/update/remove
+ * \p simulate should be true, in this case packages with
+ * what's going to happen will be emitted.
+ */
+ bool installFile(const gchar *path, bool simulate);
+
+ /**
+ * Check which package provides the codec
+ */
+ void providesCodec(PkgList &output, gchar **values);
+
+ /**
+ * Check which package provides a shared library
+ */
+ void providesLibrary(PkgList &output, gchar **values);
+
+ pkgRecords *packageRecords;
+ pkgCache *packageCache;
+ pkgDepCache *packageDepCache;
+ pkgSourceList *packageSourceList;
private:
- MMap *Map;
- OpProgress Progress;
- pkgPolicy *Policy;
- PkBackend *m_backend;
- bool &_cancel;
-
- bool TryToInstall(pkgCache::PkgIterator Pkg,
- pkgDepCache &Cache,
- pkgProblemResolver &Fix,
- bool Remove,
- bool BrokenFix,
- unsigned int &ExpectedInst);
-
- /**
- * interprets dpkg status fd
- */
- void updateInterface(int readFd, int writeFd);
- bool DoAutomaticRemove(pkgCacheFile &Cache);
- void emitChangedPackages(pkgCacheFile &Cache);
- bool removingEssentialPackages(pkgCacheFile &Cache);
-
- bool m_isMultiArch;
- PkgList m_pkgs;
- string m_localDebFile;
- void populateInternalPackages(pkgCacheFile &Cache);
- void emitTransactionPackage(string name, PkInfoEnum state);
- time_t m_lastTermAction;
- string m_lastPackage;
- uint m_lastSubProgress;
- PkInfoEnum m_state;
- bool m_startCounting;
-
- // when the internal terminal timesout after no activity
- int m_terminalTimeout;
- pid_t m_child_pid;
+ MMap *Map;
+ OpProgress Progress;
+ pkgPolicy *Policy;
+ PkBackend *m_backend;
+ bool &_cancel;
+
+ bool TryToInstall(pkgCache::PkgIterator Pkg,
+ pkgDepCache &Cache,
+ pkgProblemResolver &Fix,
+ bool Remove,
+ bool BrokenFix,
+ unsigned int &ExpectedInst);
+
+ /**
+ * interprets dpkg status fd
+ */
+ void updateInterface(int readFd, int writeFd);
+ bool DoAutomaticRemove(pkgCacheFile &Cache);
+ void emitChangedPackages(pkgCacheFile &Cache);
+ bool removingEssentialPackages(pkgCacheFile &Cache);
+
+ bool m_isMultiArch;
+ PkgList m_pkgs;
+ string m_localDebFile;
+ void populateInternalPackages(pkgCacheFile &Cache);
+ void emitTransactionPackage(string name, PkInfoEnum state);
+ time_t m_lastTermAction;
+ string m_lastPackage;
+ uint m_lastSubProgress;
+ PkInfoEnum m_state;
+ bool m_startCounting;
+
+ // when the internal terminal timesout after no activity
+ int m_terminalTimeout;
+ pid_t m_child_pid;
};
#endif
diff --git a/backends/aptcc/apt-messages.cpp b/backends/aptcc/apt-messages.cpp
index 623100c..3363857 100644
--- a/backends/aptcc/apt-messages.cpp
+++ b/backends/aptcc/apt-messages.cpp
@@ -30,173 +30,169 @@ using namespace std;
bool show_errors(PkBackend *backend, PkErrorEnum errorCode)
{
- stringstream errors;
-
- string Err;
- while (_error->empty() == false)
- {
- bool Type = _error->PopMessage(Err);
- if (Type == true) {
- errors << "E: " << Err << endl;
- } else {
- errors << "W: " << Err << endl;
- }
- }
-
- if (!errors.str().empty())
- {
- pk_backend_error_code(backend, errorCode, errors.str().c_str());
- }
+ stringstream errors;
+
+ string Err;
+ while (_error->empty() == false) {
+ bool Type = _error->PopMessage(Err);
+ if (Type == true) {
+ errors << "E: " << Err << endl;
+ } else {
+ errors << "W: " << Err << endl;
+ }
+ }
+
+ if (!errors.str().empty()) {
+ pk_backend_error_code(backend, errorCode, errors.str().c_str());
+ }
}
bool show_warnings(PkBackend *backend, PkMessageEnum message)
{
- stringstream warnings;
-
- string Err;
- while (_error->empty() == false)
- {
- bool Type = _error->PopMessage(Err);
- if (Type == true) {
- warnings << "E: " << Err << endl;
- } else {
- warnings << "W: " << Err << endl;
- }
- }
-
- if (!warnings.str().empty())
- {
- pk_backend_message(backend, message, warnings.str().c_str());
- }
+ stringstream warnings;
+
+ string Err;
+ while (_error->empty() == false) {
+ bool Type = _error->PopMessage(Err);
+ if (Type == true) {
+ warnings << "E: " << Err << endl;
+ } else {
+ warnings << "W: " << Err << endl;
+ }
+ }
+
+ if (!warnings.str().empty()) {
+ pk_backend_message(backend, message, warnings.str().c_str());
+ }
}
/** Shows broken dependencies for a single package */
void show_broken(PkBackend *backend, pkgCacheFile &Cache, bool Now)
{
- stringstream out;
-
- out << "The following packages have unmet dependencies:" << endl;
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
- if (Now == true) {
- if (Cache[I].NowBroken() == false) {
- continue;
- }
- } else {
- if (Cache[I].InstBroken() == false){
- continue;
- }
- }
-
- // Print out each package and the failed dependencies
- out << " " << I.Name() << ":";
- unsigned Indent = strlen(I.Name()) + 3;
- bool First = true;
- pkgCache::VerIterator Ver;
-
- if (Now == true) {
- Ver = I.CurrentVer();
- } else {
- Ver = Cache[I].InstVerIter(Cache);
- }
-
- if (Ver.end() == true) {
- out << endl;
- continue;
- }
-
- for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;) {
- // Compute a single dependency element (glob or)
- pkgCache::DepIterator Start;
- pkgCache::DepIterator End;
- D.GlobOr(Start,End); // advances D
-
- if (Cache->IsImportantDep(End) == false){
- continue;
- }
-
- if (Now == true) {
- if ((Cache[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow){
- continue;
- }
- } else {
- if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) {
- continue;
- }
- }
-
- bool FirstOr = true;
- while (1) {
- if (First == false){
- for (unsigned J = 0; J != Indent; J++) {
- out << ' ';
- }
- }
- First = false;
-
- if (FirstOr == false) {
- for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++) {
- out << ' ';
- }
- } else {
- out << ' ' << End.DepType() << ": ";
- }
- FirstOr = false;
-
- out << Start.TargetPkg().Name();
-
- // Show a quick summary of the version requirements
- if (Start.TargetVer() != 0) {
- out << " (" << Start.CompType() << " " << Start.TargetVer() << ")";
- }
-
- /* Show a summary of the target package if possible. In the case
- of virtual packages we show nothing */
- pkgCache::PkgIterator Targ = Start.TargetPkg();
- if (Targ->ProvidesList == 0) {
- out << ' ';
- pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
- if (Now == true) {
- Ver = Targ.CurrentVer();
- }
-
- if (Ver.end() == false)
- {
- char buffer[1024];
- if (Now == true) {
- sprintf(buffer, "but %s is installed", Ver.VerStr());
- } else {
- sprintf(buffer, "but %s is to be installed", Ver.VerStr());
- }
-
- out << buffer;
- } else {
- if (Cache[Targ].CandidateVerIter(Cache).end() == true) {
- if (Targ->ProvidesList == 0) {
- out << "but it is not installable";
- } else {
- out << "but it is a virtual package";
- }
- } else {
- if (Now) {
- out << "but it is not installed";
- } else {
- out << "but it is not going to be installed";
- }
- }
- }
- }
-
- if (Start != End) {
- out << " or";
- }
- out << endl;
-
- if (Start == End){
- break;
- }
- Start++;
- }
- }
- }
- pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, out.str().c_str());
+ stringstream out;
+
+ out << "The following packages have unmet dependencies:" << endl;
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
+ if (Now == true) {
+ if (Cache[I].NowBroken() == false) {
+ continue;
+ }
+ } else {
+ if (Cache[I].InstBroken() == false){
+ continue;
+ }
+ }
+
+ // Print out each package and the failed dependencies
+ out << " " << I.Name() << ":";
+ unsigned Indent = strlen(I.Name()) + 3;
+ bool First = true;
+ pkgCache::VerIterator Ver;
+
+ if (Now == true) {
+ Ver = I.CurrentVer();
+ } else {
+ Ver = Cache[I].InstVerIter(Cache);
+ }
+
+ if (Ver.end() == true) {
+ out << endl;
+ continue;
+ }
+
+ for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;) {
+ // Compute a single dependency element (glob or)
+ pkgCache::DepIterator Start;
+ pkgCache::DepIterator End;
+ D.GlobOr(Start,End); // advances D
+
+ if (Cache->IsImportantDep(End) == false){
+ continue;
+ }
+
+ if (Now == true) {
+ if ((Cache[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow){
+ continue;
+ }
+ } else {
+ if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) {
+ continue;
+ }
+ }
+
+ bool FirstOr = true;
+ while (1) {
+ if (First == false){
+ for (unsigned J = 0; J != Indent; J++) {
+ out << ' ';
+ }
+ }
+ First = false;
+
+ if (FirstOr == false) {
+ for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++) {
+ out << ' ';
+ }
+ } else {
+ out << ' ' << End.DepType() << ": ";
+ }
+ FirstOr = false;
+
+ out << Start.TargetPkg().Name();
+
+ // Show a quick summary of the version requirements
+ if (Start.TargetVer() != 0) {
+ out << " (" << Start.CompType() << " " << Start.TargetVer() << ")";
+ }
+
+ /* Show a summary of the target package if possible. In the case
+ of virtual packages we show nothing */
+ pkgCache::PkgIterator Targ = Start.TargetPkg();
+ if (Targ->ProvidesList == 0) {
+ out << ' ';
+ pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
+ if (Now == true) {
+ Ver = Targ.CurrentVer();
+ }
+
+ if (Ver.end() == false)
+ {
+ char buffer[1024];
+ if (Now == true) {
+ sprintf(buffer, "but %s is installed", Ver.VerStr());
+ } else {
+ sprintf(buffer, "but %s is to be installed", Ver.VerStr());
+ }
+
+ out << buffer;
+ } else {
+ if (Cache[Targ].CandidateVerIter(Cache).end() == true) {
+ if (Targ->ProvidesList == 0) {
+ out << "but it is not installable";
+ } else {
+ out << "but it is a virtual package";
+ }
+ } else {
+ if (Now) {
+ out << "but it is not installed";
+ } else {
+ out << "but it is not going to be installed";
+ }
+ }
+ }
+ }
+
+ if (Start != End) {
+ out << " or";
+ }
+ out << endl;
+
+ if (Start == End){
+ break;
+ }
+ Start++;
+ }
+ }
+ }
+ pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, out.str().c_str());
}
diff --git a/backends/aptcc/apt-messages.h b/backends/aptcc/apt-messages.h
index 68267d7..95666f3 100644
--- a/backends/aptcc/apt-messages.h
+++ b/backends/aptcc/apt-messages.h
@@ -33,13 +33,13 @@
* Call the Packagekit error dialog
*/
bool show_errors(PkBackend *backend,
- PkErrorEnum errorCode = PK_ERROR_ENUM_UNKNOWN);
+ PkErrorEnum errorCode = PK_ERROR_ENUM_UNKNOWN);
/**
* Call the Packagekit message dialog
*/
bool show_warnings(PkBackend *backend,
- PkMessageEnum message = PK_MESSAGE_ENUM_UNKNOWN);
+ PkMessageEnum message = PK_MESSAGE_ENUM_UNKNOWN);
/** Shows a list of all broken packages together with their
* dependencies. Similar to and based on the equivalent routine in
diff --git a/backends/aptcc/apt-sourceslist.cpp b/backends/aptcc/apt-sourceslist.cpp
index 06e0a74..a984493 100644
--- a/backends/aptcc/apt-sourceslist.cpp
+++ b/backends/aptcc/apt-sourceslist.cpp
@@ -41,525 +41,568 @@
SourcesList::~SourcesList()
{
- for (list<SourceRecord *>::iterator it = SourceRecords.begin();
- it != SourceRecords.end(); it++)
- delete *it;
- for (list<VendorRecord *>::iterator it = VendorRecords.begin();
- it != VendorRecords.end(); it++)
- delete *it;
+ for (list<SourceRecord *>::iterator it = SourceRecords.begin();
+ it != SourceRecords.end(); ++it) {
+ delete *it;
+ }
+
+ for (list<VendorRecord *>::iterator it = VendorRecords.begin();
+ it != VendorRecords.end(); ++it) {
+ delete *it;
+ }
}
SourcesList::SourceRecord *SourcesList::AddSourceNode(SourceRecord &rec)
{
- SourceRecord *newrec = new SourceRecord;
- *newrec = rec;
- SourceRecords.push_back(newrec);
+ SourceRecord *newrec = new SourceRecord;
+ *newrec = rec;
+ SourceRecords.push_back(newrec);
- return newrec;
+ return newrec;
}
bool SourcesList::ReadSourcePart(string listpath)
{
- //cout << "SourcesList::ReadSourcePart() "<< listpath << endl;
- char buf[512];
- const char *p;
- ifstream ifs(listpath.c_str(), ios::in);
- bool record_ok = true;
-
- // cannot open file
- if (!ifs != 0)
- return _error->Error("Can't read %s", listpath.c_str());
-
- while (ifs.eof() == false) {
- p = buf;
- SourceRecord rec;
- string Type;
- string Section;
- string VURI;
-
- ifs.getline(buf, sizeof(buf));
-
- rec.SourceFile = listpath;
- while (isspace(*p))
- p++;
- if (*p == '#') {
- rec.Type = Disabled;
- p++;
- while (isspace(*p))
+ //cout << "SourcesList::ReadSourcePart() "<< listpath << endl;
+ char buf[512];
+ const char *p;
+ ifstream ifs(listpath.c_str(), ios::in);
+ bool record_ok = true;
+
+ // cannot open file
+ if (!ifs != 0) {
+ return _error->Error("Can't read %s", listpath.c_str());
+ }
+
+ while (ifs.eof() == false) {
+ p = buf;
+ SourceRecord rec;
+ string Type;
+ string Section;
+ string VURI;
+
+ ifs.getline(buf, sizeof(buf));
+
+ rec.SourceFile = listpath;
+ while (isspace(*p)) {
p++;
- }
-
- if (*p == '\r' || *p == '\n' || *p == 0) {
- rec.Type = Comment;
- rec.Comment = p;
-
- AddSourceNode(rec);
- continue;
- }
-
- bool Failed = true;
- if (ParseQuoteWord(p, Type) == true &&
- rec.SetType(Type) == true && ParseQuoteWord(p, VURI) == true) {
- if (VURI[0] == '[') {
- rec.VendorID = VURI.substr(1, VURI.length() - 2);
- if (ParseQuoteWord(p, VURI) == true && rec.SetURI(VURI) == true)
- Failed = false;
- } else if (rec.SetURI(VURI) == true) {
- Failed = false;
- }
- if (Failed == false && ParseQuoteWord(p, rec.Dist) == false)
- Failed = true;
- }
-
- if (Failed == true) {
- if (rec.Type == Disabled) {
- // treat as a comment field
- rec.Type = Comment;
- rec.Comment = buf;
- } else {
- // syntax error on line
+ }
+
+ if (*p == '#') {
+ rec.Type = Disabled;
+ p++;
+ while (isspace(*p))
+ p++;
+ }
+
+ if (*p == '\r' || *p == '\n' || *p == 0) {
rec.Type = Comment;
- string s = "#" + string(buf);
- rec.Comment = s;
- record_ok = false;
- //return _error->Error("Syntax error in line %s", buf);
- }
- }
+ rec.Comment = p;
+
+ AddSourceNode(rec);
+ continue;
+ }
+
+ bool Failed = true;
+ if (ParseQuoteWord(p, Type) == true &&
+ rec.SetType(Type) == true && ParseQuoteWord(p, VURI) == true) {
+ if (VURI[0] == '[') {
+ rec.VendorID = VURI.substr(1, VURI.length() - 2);
+ if (ParseQuoteWord(p, VURI) == true && rec.SetURI(VURI) == true)
+ Failed = false;
+ } else if (rec.SetURI(VURI) == true) {
+ Failed = false;
+ }
+ if (Failed == false && ParseQuoteWord(p, rec.Dist) == false)
+ Failed = true;
+ }
+
+ if (Failed == true) {
+ if (rec.Type == Disabled) {
+ // treat as a comment field
+ rec.Type = Comment;
+ rec.Comment = buf;
+ } else {
+ // syntax error on line
+ rec.Type = Comment;
+ string s = "#" + string(buf);
+ rec.Comment = s;
+ record_ok = false;
+ //return _error->Error("Syntax error in line %s", buf);
+ }
+ }
#ifndef HAVE_RPM
- // check for absolute dist
- if (rec.Dist.empty() == false && rec.Dist[rec.Dist.size() - 1] == '/') {
- // make sure there's no section
- if (ParseQuoteWord(p, Section) == true)
- return _error->Error("Syntax error in line %s", buf);
-
- rec.Dist = SubstVar(rec.Dist, "$(ARCH)",
- _config->Find("APT::Architecture"));
-
- AddSourceNode(rec);
- continue;
- }
+ // check for absolute dist
+ if (rec.Dist.empty() == false && rec.Dist[rec.Dist.size() - 1] == '/') {
+ // make sure there's no section
+ if (ParseQuoteWord(p, Section) == true)
+ return _error->Error("Syntax error in line %s", buf);
+
+ rec.Dist = SubstVar(rec.Dist, "$(ARCH)",
+ _config->Find("APT::Architecture"));
+
+ AddSourceNode(rec);
+ continue;
+ }
#endif
- const char *tmp = p;
- rec.NumSections = 0;
- while (ParseQuoteWord(p, Section) == true)
- rec.NumSections++;
- if (rec.NumSections > 0) {
- p = tmp;
- rec.Sections = new string[rec.NumSections];
- rec.NumSections = 0;
- while (ParseQuoteWord(p, Section) == true) {
- // comments inside the record are preserved
- if (Section[0] == '#') {
- SourceRecord rec;
- string s = Section + string(p);
- rec.Type = Comment;
- rec.Comment = s;
- rec.SourceFile = listpath;
- AddSourceNode(rec);
- break;
- } else {
- rec.Sections[rec.NumSections++] = Section;
+ const char *tmp = p;
+ rec.NumSections = 0;
+ while (ParseQuoteWord(p, Section) == true)
+ rec.NumSections++;
+ if (rec.NumSections > 0) {
+ p = tmp;
+ rec.Sections = new string[rec.NumSections];
+ rec.NumSections = 0;
+ while (ParseQuoteWord(p, Section) == true) {
+ // comments inside the record are preserved
+ if (Section[0] == '#') {
+ SourceRecord rec;
+ string s = Section + string(p);
+ rec.Type = Comment;
+ rec.Comment = s;
+ rec.SourceFile = listpath;
+ AddSourceNode(rec);
+ break;
+ } else {
+ rec.Sections[rec.NumSections++] = Section;
+ }
}
- }
- }
- AddSourceNode(rec);
- }
+ }
+ AddSourceNode(rec);
+ }
- ifs.close();
- return record_ok;
+ ifs.close();
+ return record_ok;
}
bool SourcesList::ReadSourceDir(string Dir)
{
- //cout << "SourcesList::ReadSourceDir() " << Dir << endl;
-
- DIR *D = opendir(Dir.c_str());
- if (D == 0)
- return _error->Errno("opendir", "Unable to read %s", Dir.c_str());
-
- vector<string> List;
- for (struct dirent * Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
- if (Ent->d_name[0] == '.')
- continue;
-
- // Skip bad file names ala run-parts
- const char *C = Ent->d_name;
- for (; *C != 0; C++)
- if (isalpha(*C) == 0 && isdigit(*C) == 0
- && *C != '_' && *C != '-' && *C != '.')
- break;
- if (*C != 0)
- continue;
-
- // Only look at files ending in .list to skip .rpmnew etc files
- if (strcmp(Ent->d_name + strlen(Ent->d_name) - 5, ".list") != 0)
- continue;
-
- // Make sure it is a file and not something else
- string File = flCombine(Dir, Ent->d_name);
- struct stat St;
- if (stat(File.c_str(), &St) != 0 || S_ISREG(St.st_mode) == 0)
- continue;
- List.push_back(File);
-
- }
- closedir(D);
-
- sort(List.begin(), List.end());
-
- // Read the files
- for (vector<string>::const_iterator I = List.begin(); I != List.end();
- I++)
- if (ReadSourcePart(*I) == false)
- return false;
- return true;
+ //cout << "SourcesList::ReadSourceDir() " << Dir << endl;
+
+ DIR *D = opendir(Dir.c_str());
+ if (D == 0) {
+ return _error->Errno("opendir", "Unable to read %s", Dir.c_str());
+ }
+
+ vector<string> List;
+ for (struct dirent * Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
+ if (Ent->d_name[0] == '.') {
+ continue;
+ }
+
+ // Skip bad file names ala run-parts
+ const char *C = Ent->d_name;
+ for (; *C != 0; C++) {
+ if (isalpha(*C) == 0 && isdigit(*C) == 0
+ && *C != '_' && *C != '-' && *C != '.') {
+ break;
+ }
+ }
+ if (*C != 0) {
+ continue;
+ }
+
+ // Only look at files ending in .list to skip .rpmnew etc files
+ if (strcmp(Ent->d_name + strlen(Ent->d_name) - 5, ".list") != 0) {
+ continue;
+ }
+
+ // Make sure it is a file and not something else
+ string File = flCombine(Dir, Ent->d_name);
+ struct stat St;
+ if (stat(File.c_str(), &St) != 0 || S_ISREG(St.st_mode) == 0) {
+ continue;
+ }
+ List.push_back(File);
+
+ }
+ closedir(D);
+
+ sort(List.begin(), List.end());
+
+ // Read the files
+ for (vector<string>::const_iterator I = List.begin(); I != List.end(); ++I) {
+ if (ReadSourcePart(*I) == false) {
+ return false;
+ }
+ }
+ return true;
}
bool SourcesList::ReadSources()
{
- //cout << "SourcesList::ReadSources() " << endl;
+ //cout << "SourcesList::ReadSources() " << endl;
- bool Res = true;
+ bool Res = true;
- string Parts = _config->FindDir("Dir::Etc::sourceparts");
- if (FileExists(Parts) == true)
- Res &= ReadSourceDir(Parts);
- string Main = _config->FindFile("Dir::Etc::sourcelist");
- if (FileExists(Main) == true)
- Res &= ReadSourcePart(Main);
+ string Parts = _config->FindDir("Dir::Etc::sourceparts");
+ if (FileExists(Parts) == true) {
+ Res &= ReadSourceDir(Parts);
+ }
- return Res;
+ string Main = _config->FindFile("Dir::Etc::sourcelist");
+ if (FileExists(Main) == true) {
+ Res &= ReadSourcePart(Main);
+ }
+
+ return Res;
}
SourcesList::SourceRecord *SourcesList::AddEmptySource()
{
- SourceRecord rec;
+ SourceRecord rec;
#ifdef HAVE_RPM
- rec.Type = Rpm;
+ rec.Type = Rpm;
#else
- rec.Type = Deb;
+ rec.Type = Deb;
#endif
- rec.VendorID = "";
- rec.SourceFile = _config->FindFile("Dir::Etc::sourcelist");
- rec.Dist = "";
- rec.NumSections = 0;
- return AddSourceNode(rec);
+ rec.VendorID = "";
+ rec.SourceFile = _config->FindFile("Dir::Etc::sourcelist");
+ rec.Dist = "";
+ rec.NumSections = 0;
+ return AddSourceNode(rec);
}
SourcesList::SourceRecord *SourcesList::AddSource(RecType Type,
- string VendorID, string URI,
- string Dist,
- string *Sections,
- unsigned short count,
- string SourceFile)
+ string VendorID, string URI,
+ string Dist,
+ string *Sections,
+ unsigned short count,
+ string SourceFile)
{
- SourceRecord rec;
- rec.Type = Type;
- rec.VendorID = VendorID;
- rec.SourceFile = SourceFile;
-
- if (rec.SetURI(URI) == false) {
- return NULL;
- }
- rec.Dist = Dist;
- rec.NumSections = count;
- rec.Sections = new string[count];
- for (unsigned int i = 0; i < count; i++)
- rec.Sections[i] = Sections[i];
-
- return AddSourceNode(rec);
+ SourceRecord rec;
+ rec.Type = Type;
+ rec.VendorID = VendorID;
+ rec.SourceFile = SourceFile;
+
+ if (rec.SetURI(URI) == false) {
+ return NULL;
+ }
+ rec.Dist = Dist;
+ rec.NumSections = count;
+ rec.Sections = new string[count];
+ for (unsigned int i = 0; i < count; ++i) {
+ rec.Sections[i] = Sections[i];
+ }
+
+ return AddSourceNode(rec);
}
void SourcesList::RemoveSource(SourceRecord *&rec)
{
- SourceRecords.remove(rec);
- delete rec;
- rec = 0;
+ SourceRecords.remove(rec);
+ delete rec;
+ rec = 0;
}
void SourcesList::SwapSources( SourceRecord *&rec_one, SourceRecord *&rec_two )
{
- list<SourceRecord *>::iterator rec_p;
- list<SourceRecord *>::iterator rec_n;
+ list<SourceRecord *>::iterator rec_p;
+ list<SourceRecord *>::iterator rec_n;
- rec_p = find( SourceRecords.begin(), SourceRecords.end(), rec_one );
- rec_n = find( SourceRecords.begin(), SourceRecords.end(), rec_two );
+ rec_p = find( SourceRecords.begin(), SourceRecords.end(), rec_one );
+ rec_n = find( SourceRecords.begin(), SourceRecords.end(), rec_two );
- SourceRecords.insert( rec_p, rec_two );
- SourceRecords.erase( rec_n );
+ SourceRecords.insert( rec_p, rec_two );
+ SourceRecords.erase( rec_n );
}
bool SourcesList::UpdateSources()
{
- list<string> filenames;
- for (list<SourceRecord *>::iterator it = SourceRecords.begin();
- it != SourceRecords.end(); it++) {
- if ((*it)->SourceFile == "")
- continue;
- filenames.push_front((*it)->SourceFile);
- }
- filenames.sort();
- filenames.unique();
-
- for (list<string>::iterator fi = filenames.begin();
- fi != filenames.end(); fi++) {
- ofstream ofs((*fi).c_str(), ios::out);
- if (!ofs != 0)
- return false;
-
- for (list<SourceRecord *>::iterator it = SourceRecords.begin();
- it != SourceRecords.end(); it++) {
- if ((*fi) != (*it)->SourceFile)
- continue;
- string S;
- if (((*it)->Type & Comment) != 0) {
- S = (*it)->Comment;
- } else if ((*it)->URI.empty() || (*it)->Dist.empty()) {
+ list<string> filenames;
+ for (list<SourceRecord *>::iterator it = SourceRecords.begin();
+ it != SourceRecords.end(); ++it) {
+ if ((*it)->SourceFile == "") {
continue;
- } else {
- if (((*it)->Type & Disabled) != 0)
- S = "# ";
-
- S += (*it)->GetType() + " ";
-
- if ((*it)->VendorID.empty() == false)
- S += "[" + (*it)->VendorID + "] ";
-
- S += (*it)->URI + " ";
- S += (*it)->Dist + " ";
-
- for (unsigned int J = 0; J < (*it)->NumSections; J++)
- S += (*it)->Sections[J] + " ";
- }
- ofs << S << endl;
- }
- ofs.close();
- }
- return true;
+ }
+ filenames.push_front((*it)->SourceFile);
+ }
+ filenames.sort();
+ filenames.unique();
+
+ for (list<string>::iterator fi = filenames.begin();
+ fi != filenames.end(); fi++) {
+ ofstream ofs((*fi).c_str(), ios::out);
+ if (!ofs != 0) {
+ return false;
+ }
+
+ for (list<SourceRecord *>::iterator it = SourceRecords.begin();
+ it != SourceRecords.end(); it++) {
+ if ((*fi) != (*it)->SourceFile) {
+ continue;
+ }
+
+ string S;
+ if (((*it)->Type & Comment) != 0) {
+ S = (*it)->Comment;
+ } else if ((*it)->URI.empty() || (*it)->Dist.empty()) {
+ continue;
+ } else {
+ if (((*it)->Type & Disabled) != 0)
+ S = "# ";
+
+ S += (*it)->GetType() + " ";
+
+ if ((*it)->VendorID.empty() == false)
+ S += "[" + (*it)->VendorID + "] ";
+
+ S += (*it)->URI + " ";
+ S += (*it)->Dist + " ";
+
+ for (unsigned int J = 0; J < (*it)->NumSections; ++J) {
+ S += (*it)->Sections[J] + " ";
+ }
+ }
+ ofs << S << endl;
+ }
+ ofs.close();
+ }
+ return true;
}
bool SourcesList::SourceRecord::SetType(string S)
{
- if (S == "deb")
- Type |= Deb;
- else if (S == "deb-src")
- Type |= DebSrc;
- else if (S == "rpm")
- Type |= Rpm;
- else if (S == "rpm-src")
- Type |= RpmSrc;
- else if (S == "rpm-dir")
- Type |= RpmDir;
- else if (S == "rpm-src-dir")
- Type |= RpmSrcDir;
- else if (S == "repomd")
- Type |= Repomd;
- else if (S == "repomd-src")
- Type |= RepomdSrc;
- else
- return false;
- //cout << S << " settype " << (Type | Repomd) << endl;
- return true;
+ if (S == "deb") {
+ Type |= Deb;
+ } else if (S == "deb-src") {
+ Type |= DebSrc;
+ } else if (S == "rpm") {
+ Type |= Rpm;
+ } else if (S == "rpm-src") {
+ Type |= RpmSrc;
+ } else if (S == "rpm-dir") {
+ Type |= RpmDir;
+ } else if (S == "rpm-src-dir") {
+ Type |= RpmSrcDir;
+ } else if (S == "repomd") {
+ Type |= Repomd;
+ } else if (S == "repomd-src") {
+ Type |= RepomdSrc;
+ } else {
+ return false;
+ }
+
+ //cout << S << " settype " << (Type | Repomd) << endl;
+ return true;
}
string SourcesList::SourceRecord::GetType()
{
- if ((Type & Deb) != 0)
- return "deb";
- else if ((Type & DebSrc) != 0)
- return "deb-src";
- else if ((Type & Rpm) != 0)
- return "rpm";
- else if ((Type & RpmSrc) != 0)
- return "rpm-src";
- else if ((Type & RpmDir) != 0)
- return "rpm-dir";
- else if ((Type & RpmSrcDir) != 0)
- return "rpm-src-dir";
- else if ((Type & Repomd) != 0)
- return "repomd";
- else if ((Type & RepomdSrc) != 0)
- return "repomd-src";
- //cout << "type " << (Type & Repomd) << endl;
- return "unknown";
+ if ((Type & Deb) != 0) {
+ return "deb";
+ } else if ((Type & DebSrc) != 0) {
+ return "deb-src";
+ } else if ((Type & Rpm) != 0) {
+ return "rpm";
+ } else if ((Type & RpmSrc) != 0) {
+ return "rpm-src";
+ } else if ((Type & RpmDir) != 0) {
+ return "rpm-dir";
+ } else if ((Type & RpmSrcDir) != 0) {
+ return "rpm-src-dir";
+ } else if ((Type & Repomd) != 0) {
+ return "repomd";
+ } else if ((Type & RepomdSrc) != 0) {
+ return "repomd-src";
+ }
+
+ //cout << "type " << (Type & Repomd) << endl;
+ return "unknown";
}
bool SourcesList::SourceRecord::SetURI(string S)
{
- if (S.empty() == true)
- return false;
- if (S.find(':') == string::npos)
- return false;
-
- S = SubstVar(S, "$(ARCH)", _config->Find("APT::Architecture"));
- S = SubstVar(S, "$(VERSION)", _config->Find("APT::DistroVersion"));
- URI = S;
-
- // append a / to the end if one is not already there
- if (URI[URI.size() - 1] != '/')
- URI += '/';
-
- return true;
+ if (S.empty() == true) {
+ return false;
+ }
+ if (S.find(':') == string::npos) {
+ return false;
+ }
+
+ S = SubstVar(S, "$(ARCH)", _config->Find("APT::Architecture"));
+ S = SubstVar(S, "$(VERSION)", _config->Find("APT::DistroVersion"));
+ URI = S;
+
+ // append a / to the end if one is not already there
+ if (URI[URI.size() - 1] != '/') {
+ URI += '/';
+ }
+
+ return true;
}
-SourcesList::SourceRecord &SourcesList::SourceRecord::
-operator=(const SourceRecord &rhs)
+SourcesList::SourceRecord &SourcesList::SourceRecord::operator=(const SourceRecord &rhs)
{
- // Needed for a proper deep copy of the record; uses the string operator= to properly copy the strings
- Type = rhs.Type;
- VendorID = rhs.VendorID;
- URI = rhs.URI;
- Dist = rhs.Dist;
- Sections = new string[rhs.NumSections];
- for (unsigned int I = 0; I < rhs.NumSections; I++)
- Sections[I] = rhs.Sections[I];
- NumSections = rhs.NumSections;
- Comment = rhs.Comment;
- SourceFile = rhs.SourceFile;
-
- return *this;
+ // Needed for a proper deep copy of the record; uses the string operator= to properly copy the strings
+ Type = rhs.Type;
+ VendorID = rhs.VendorID;
+ URI = rhs.URI;
+ Dist = rhs.Dist;
+ Sections = new string[rhs.NumSections];
+ for (unsigned int I = 0; I < rhs.NumSections; ++I) {
+ Sections[I] = rhs.Sections[I];
+ }
+ NumSections = rhs.NumSections;
+ Comment = rhs.Comment;
+ SourceFile = rhs.SourceFile;
+
+ return *this;
}
SourcesList::VendorRecord *SourcesList::AddVendorNode(VendorRecord &rec)
{
- VendorRecord *newrec = new VendorRecord;
- *newrec = rec;
- VendorRecords.push_back(newrec);
+ VendorRecord *newrec = new VendorRecord;
+ *newrec = rec;
+ VendorRecords.push_back(newrec);
- return newrec;
+ return newrec;
}
bool SourcesList::ReadVendors()
{
- Configuration Cnf;
-
- string CnfFile = _config->FindFile("Dir::Etc::vendorlist");
- if (FileExists(CnfFile) == true)
- if (ReadConfigFile(Cnf, CnfFile, true) == false)
- return false;
-
- for (list<VendorRecord *>::const_iterator I = VendorRecords.begin();
- I != VendorRecords.end(); I++)
- delete *I;
- VendorRecords.clear();
-
- // Process 'simple-key' type sections
- const Configuration::Item *Top = Cnf.Tree("simple-key");
- for (Top = (Top == 0 ? 0 : Top->Child); Top != 0; Top = Top->Next) {
- Configuration Block(Top);
- VendorRecord Vendor;
-
- Vendor.VendorID = Top->Tag;
- Vendor.FingerPrint = Block.Find("Fingerprint");
- Vendor.Description = Block.Find("Name");
-
- char *buffer = new char[Vendor.FingerPrint.length() + 1];
- char *p = buffer;;
- for (string::const_iterator I = Vendor.FingerPrint.begin();
- I != Vendor.FingerPrint.end(); I++) {
- if (*I != ' ' && *I != '\t')
- *p++ = *I;
- }
- *p = 0;
- Vendor.FingerPrint = buffer;
- delete[]buffer;
-
- if (Vendor.FingerPrint.empty() == true ||
- Vendor.Description.empty() == true) {
- _error->Error("Vendor block %s is invalid",
- Vendor.VendorID.c_str());
- continue;
- }
-
- AddVendorNode(Vendor);
- }
-
- return !_error->PendingError();
+ Configuration Cnf;
+
+ string CnfFile = _config->FindFile("Dir::Etc::vendorlist");
+ if (FileExists(CnfFile) == true) {
+ if (ReadConfigFile(Cnf, CnfFile, true) == false) {
+ return false;
+ }
+ }
+
+ for (list<VendorRecord *>::const_iterator I = VendorRecords.begin();
+ I != VendorRecords.end(); ++I) {
+ delete *I;
+ }
+ VendorRecords.clear();
+
+ // Process 'simple-key' type sections
+ const Configuration::Item *Top = Cnf.Tree("simple-key");
+ for (Top = (Top == 0 ? 0 : Top->Child); Top != 0; Top = Top->Next) {
+ Configuration Block(Top);
+ VendorRecord Vendor;
+
+ Vendor.VendorID = Top->Tag;
+ Vendor.FingerPrint = Block.Find("Fingerprint");
+ Vendor.Description = Block.Find("Name");
+
+ char *buffer = new char[Vendor.FingerPrint.length() + 1];
+ char *p = buffer;;
+ for (string::const_iterator I = Vendor.FingerPrint.begin();
+ I != Vendor.FingerPrint.end(); ++I) {
+ if (*I != ' ' && *I != '\t') {
+ *p++ = *I;
+ }
+ }
+ *p = 0;
+ Vendor.FingerPrint = buffer;
+ delete[]buffer;
+
+ if (Vendor.FingerPrint.empty() == true ||
+ Vendor.Description.empty() == true) {
+ _error->Error("Vendor block %s is invalid",
+ Vendor.VendorID.c_str());
+ continue;
+ }
+
+ AddVendorNode(Vendor);
+ }
+
+ return !_error->PendingError();
}
SourcesList::VendorRecord *SourcesList::AddVendor(string VendorID,
string FingerPrint,
string Description)
{
- VendorRecord rec;
- rec.VendorID = VendorID;
- rec.FingerPrint = FingerPrint;
- rec.Description = Description;
- return AddVendorNode(rec);
+ VendorRecord rec;
+ rec.VendorID = VendorID;
+ rec.FingerPrint = FingerPrint;
+ rec.Description = Description;
+ return AddVendorNode(rec);
}
bool SourcesList::UpdateVendors()
{
- ofstream ofs(_config->FindFile("Dir::Etc::vendorlist").c_str(), ios::out);
- if (!ofs != 0)
- return false;
-
- for (list<VendorRecord *>::iterator it = VendorRecords.begin();
- it != VendorRecords.end(); it++) {
- ofs << "simple-key \"" << (*it)->VendorID << "\" {" << endl;
- ofs << "\tFingerPrint \"" << (*it)->FingerPrint << "\";" << endl;
- ofs << "\tName \"" << (*it)->Description << "\";" << endl;
- ofs << "}" << endl;
- }
-
- ofs.close();
- return true;
+ ofstream ofs(_config->FindFile("Dir::Etc::vendorlist").c_str(), ios::out);
+ if (!ofs != 0) {
+ return false;
+ }
+
+ for (list<VendorRecord *>::iterator it = VendorRecords.begin();
+ it != VendorRecords.end(); ++it) {
+ ofs << "simple-key \"" << (*it)->VendorID << "\" {" << endl;
+ ofs << "\tFingerPrint \"" << (*it)->FingerPrint << "\";" << endl;
+ ofs << "\tName \"" << (*it)->Description << "\";" << endl;
+ ofs << "}" << endl;
+ }
+
+ ofs.close();
+ return true;
}
void SourcesList::RemoveVendor(VendorRecord *&rec)
{
- VendorRecords.remove(rec);
- delete rec;
- rec = 0;
+ VendorRecords.remove(rec);
+ delete rec;
+ rec = 0;
}
ostream &operator<<(ostream &os, const SourcesList::SourceRecord &rec)
{
- os << "Type: ";
- if ((rec.Type & SourcesList::Comment) != 0)
- os << "Comment ";
- if ((rec.Type & SourcesList::Disabled) != 0)
- os << "Disabled ";
- if ((rec.Type & SourcesList::Deb) != 0)
- os << "Deb";
- if ((rec.Type & SourcesList::DebSrc) != 0)
- os << "DebSrc";
- if ((rec.Type & SourcesList::Rpm) != 0)
- os << "Rpm";
- if ((rec.Type & SourcesList::RpmSrc) != 0)
- os << "RpmSrc";
- if ((rec.Type & SourcesList::RpmDir) != 0)
- os << "RpmDir";
- if ((rec.Type & SourcesList::RpmSrcDir) != 0)
- os << "RpmSrcDir";
- if ((rec.Type & SourcesList::Repomd) != 0)
- os << "Repomd";
- if ((rec.Type & SourcesList::RepomdSrc) != 0)
- os << "RepomdSrc";
- os << endl;
- os << "SourceFile: " << rec.SourceFile << endl;
- os << "VendorID: " << rec.VendorID << endl;
- os << "URI: " << rec.URI << endl;
- os << "Dist: " << rec.Dist << endl;
- os << "Section(s):" << endl;
+ os << "Type: ";
+ if ((rec.Type & SourcesList::Comment) != 0) {
+ os << "Comment ";
+ }
+ if ((rec.Type & SourcesList::Disabled) != 0) {
+ os << "Disabled ";
+ }
+ if ((rec.Type & SourcesList::Deb) != 0) {
+ os << "Deb";
+ }
+ if ((rec.Type & SourcesList::DebSrc) != 0) {
+ os << "DebSrc";
+ }
+ if ((rec.Type & SourcesList::Rpm) != 0) {
+ os << "Rpm";
+ }
+ if ((rec.Type & SourcesList::RpmSrc) != 0) {
+ os << "RpmSrc";
+ }
+ if ((rec.Type & SourcesList::RpmDir) != 0) {
+ os << "RpmDir";
+ }
+ if ((rec.Type & SourcesList::RpmSrcDir) != 0) {
+ os << "RpmSrcDir";
+ }
+ if ((rec.Type & SourcesList::Repomd) != 0) {
+ os << "Repomd";
+ }
+ if ((rec.Type & SourcesList::RepomdSrc) != 0) {
+ os << "RepomdSrc";
+ }
+ os << endl;
+ os << "SourceFile: " << rec.SourceFile << endl;
+ os << "VendorID: " << rec.VendorID << endl;
+ os << "URI: " << rec.URI << endl;
+ os << "Dist: " << rec.Dist << endl;
+ os << "Section(s):" << endl;
#if 0
- for (unsigned int J = 0; J < rec.NumSections; J++) {
- cout << "\t" << rec.Sections[J] << endl;
- }
+ for (unsigned int J = 0; J < rec.NumSections; ++J) {
+ cout << "\t" << rec.Sections[J] << endl;
+ }
#endif
- os << endl;
- return os;
+ os << endl;
+ return os;
}
ostream &operator<<(ostream &os, const SourcesList::VendorRecord &rec)
{
- os << "VendorID: " << rec.VendorID << endl;
- os << "FingerPrint: " << rec.FingerPrint << endl;
- os << "Description: " << rec.Description << endl;
- return os;
+ os << "VendorID: " << rec.VendorID << endl;
+ os << "FingerPrint: " << rec.FingerPrint << endl;
+ os << "Description: " << rec.Description << endl;
+ return os;
}
-
-// vim:sts=4:sw=4
diff --git a/backends/aptcc/apt-sourceslist.h b/backends/aptcc/apt-sourceslist.h
index 8b409e5..f15b60d 100644
--- a/backends/aptcc/apt-sourceslist.h
+++ b/backends/aptcc/apt-sourceslist.h
@@ -32,80 +32,79 @@
using namespace std;
class SourcesList {
- public:
- enum RecType {
- Deb = 1 << 0,
- DebSrc = 1 << 1,
- Rpm = 1 << 2,
- RpmSrc = 1 << 3,
- Disabled = 1 << 4,
- Comment = 1 << 5,
- RpmDir = 1 << 6,
- RpmSrcDir = 1 << 7,
- Repomd = 1 << 8,
- RepomdSrc = 1 << 9
- };
-
- struct SourceRecord {
- unsigned int Type;
- string VendorID;
- string URI;
- string Dist;
- string *Sections;
- unsigned short NumSections;
- string Comment;
- string SourceFile;
-
- bool SetType(string);
- string GetType();
- bool SetURI(string);
-
- SourceRecord():Type(0), Sections(0), NumSections(0) {
- };
- ~SourceRecord() {
- if (Sections)
- delete[]Sections;
- };
- SourceRecord &operator=(const SourceRecord &);
- };
-
- struct VendorRecord {
- string VendorID;
- string FingerPrint;
- string Description;
- };
-
- list<SourceRecord *> SourceRecords;
- list<VendorRecord *> VendorRecords;
-
- private:
- SourceRecord *AddSourceNode(SourceRecord &);
- VendorRecord *AddVendorNode(VendorRecord &);
-
- public:
- SourceRecord *AddSource(RecType Type,
- string VendorID,
- string URI,
- string Dist,
- string *Sections,
- unsigned short count, string SourceFile);
- SourceRecord *AddEmptySource();
- void RemoveSource(SourceRecord *&);
- void SwapSources( SourceRecord *&, SourceRecord *& );
- bool ReadSourcePart(string listpath);
- bool ReadSourceDir(string Dir);
- bool ReadSources();
- bool UpdateSources();
-
- VendorRecord *AddVendor(string VendorID,
- string FingerPrint, string Description);
- void RemoveVendor(VendorRecord *&);
- bool ReadVendors();
- bool UpdateVendors();
-
- SourcesList() {
- };
- ~SourcesList();
+public:
+ enum RecType {
+ Deb = 1 << 0,
+ DebSrc = 1 << 1,
+ Rpm = 1 << 2,
+ RpmSrc = 1 << 3,
+ Disabled = 1 << 4,
+ Comment = 1 << 5,
+ RpmDir = 1 << 6,
+ RpmSrcDir = 1 << 7,
+ Repomd = 1 << 8,
+ RepomdSrc = 1 << 9
+ };
+
+ struct SourceRecord {
+ unsigned int Type;
+ string VendorID;
+ string URI;
+ string Dist;
+ string *Sections;
+ unsigned short NumSections;
+ string Comment;
+ string SourceFile;
+
+ bool SetType(string);
+ string GetType();
+ bool SetURI(string);
+
+ SourceRecord():Type(0), Sections(0), NumSections(0) {}
+ ~SourceRecord() {
+ if (Sections) {
+ delete [] Sections;
+ }
+ }
+ SourceRecord &operator=(const SourceRecord &);
+ };
+
+ struct VendorRecord {
+ string VendorID;
+ string FingerPrint;
+ string Description;
+ };
+
+ list<SourceRecord *> SourceRecords;
+ list<VendorRecord *> VendorRecords;
+
+private:
+ SourceRecord *AddSourceNode(SourceRecord &);
+ VendorRecord *AddVendorNode(VendorRecord &);
+
+public:
+ SourceRecord *AddSource(RecType Type,
+ string VendorID,
+ string URI,
+ string Dist,
+ string *Sections,
+ unsigned short count, string SourceFile);
+ SourceRecord *AddEmptySource();
+ void RemoveSource(SourceRecord *&);
+ void SwapSources( SourceRecord *&, SourceRecord *& );
+ bool ReadSourcePart(string listpath);
+ bool ReadSourceDir(string Dir);
+ bool ReadSources();
+ bool UpdateSources();
+
+ VendorRecord *AddVendor(string VendorID,
+ string FingerPrint, string Description);
+ void RemoveVendor(VendorRecord *&);
+ bool ReadVendors();
+ bool UpdateVendors();
+
+ SourcesList() {}
+ ~SourcesList();
};
typedef list<SourcesList::SourceRecord *>::iterator SourcesListIter;
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 953ee68..2cc4ffb 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -27,216 +27,215 @@
static string debParser(string descr);
string get_default_short_description(const pkgCache::VerIterator &ver,
- pkgRecords *records)
+ pkgRecords *records)
{
- if(ver.end() || ver.FileList().end() || records == NULL) {
- return string();
- }
+ if(ver.end() || ver.FileList().end() || records == NULL) {
+ return string();
+ }
- pkgCache::VerFileIterator vf = ver.FileList();
+ pkgCache::VerFileIterator vf = ver.FileList();
- if (vf.end()) {
- return string();
- } else {
- return records->Lookup(vf).ShortDesc();
- }
+ if (vf.end()) {
+ return string();
+ } else {
+ return records->Lookup(vf).ShortDesc();
+ }
}
string get_short_description(const pkgCache::VerIterator &ver,
- pkgRecords *records)
+ pkgRecords *records)
{
- if (ver.end() || ver.FileList().end() || records == NULL) {
- return string();
- }
+ if (ver.end() || ver.FileList().end() || records == NULL) {
+ return string();
+ }
- pkgCache::DescIterator d = ver.TranslatedDescription();
+ pkgCache::DescIterator d = ver.TranslatedDescription();
- if (d.end()) {
- return string();
- }
+ if (d.end()) {
+ return string();
+ }
- pkgCache::DescFileIterator df = d.FileList();
+ pkgCache::DescFileIterator df = d.FileList();
- if (df.end()) {
- return string();
- } else {
- return records->Lookup(df).ShortDesc();
- }
+ if (df.end()) {
+ return string();
+ } else {
+ return records->Lookup(df).ShortDesc();
+ }
}
string get_long_description(const pkgCache::VerIterator &ver,
- pkgRecords *records)
+ pkgRecords *records)
{
- if (ver.end() || ver.FileList().end() || records == NULL) {
- return string();
- }
+ if (ver.end() || ver.FileList().end() || records == NULL) {
+ return string();
+ }
- pkgCache::DescIterator d = ver.TranslatedDescription();
+ pkgCache::DescIterator d = ver.TranslatedDescription();
- if (d.end()) {
- return string();
- }
+ if (d.end()) {
+ return string();
+ }
- pkgCache::DescFileIterator df = d.FileList();
+ pkgCache::DescFileIterator df = d.FileList();
- if (df.end()) {
- return string();
- } else {
- return records->Lookup(df).LongDesc();
- }
+ if (df.end()) {
+ return string();
+ } else {
+ return records->Lookup(df).LongDesc();
+ }
}
string get_long_description_parsed(const pkgCache::VerIterator &ver,
- pkgRecords *records)
+ pkgRecords *records)
{
- return debParser(get_long_description(ver, records));
+ return debParser(get_long_description(ver, records));
}
string get_default_long_description(const pkgCache::VerIterator &ver,
- pkgRecords *records)
+ pkgRecords *records)
{
- if(ver.end() || ver.FileList().end() || records == NULL) {
- return string();
- }
+ if(ver.end() || ver.FileList().end() || records == NULL) {
+ return string();
+ }
- pkgCache::VerFileIterator vf = ver.FileList();
+ pkgCache::VerFileIterator vf = ver.FileList();
- if (vf.end()) {
- return string();
- } else {
- return records->Lookup(vf).LongDesc();
- }
+ if (vf.end()) {
+ return string();
+ } else {
+ return records->Lookup(vf).LongDesc();
+ }
}
static string debParser(string descr)
{
- // Policy page on package descriptions
- // http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
- unsigned int i;
- string::size_type nlpos=0;
-
- nlpos = descr.find('\n');
- // delete first line
- if (nlpos != string::npos) {
- descr.erase(0, nlpos + 2); // del "\n " too
- }
-
- // avoid replacing '\n' for a ' ' after a '.\n' is found
- bool removedFullStop = false;
- while (nlpos < descr.length()) {
- // find the new line position
- nlpos = descr.find('\n', nlpos);
- if (nlpos == string::npos) {
- // if it could not find the new line
- // get out of the loop
- break;
- }
-
- i = nlpos;
- // erase the char after '\n' which is always " "
- descr.erase(++i, 1);
-
- // remove lines likes this: " .", making it a \n
- if (descr[i] == '.') {
- descr.erase(i, 1);
- nlpos = i;
- // don't permit the next round to replace a '\n' to a ' '
- removedFullStop = true;
- continue;
- } else if (descr[i] != ' ' && removedFullStop == false) {
- // it's not a line to be verbatim displayed
- // So it's a paragraph let's replace '\n' with a ' '
- // replace new line with " "
- descr.replace(nlpos, 1, " ");
- }
-
- removedFullStop = false;
- nlpos++;
- }
-
- return descr;
+ // Policy page on package descriptions
+ // http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
+ unsigned int i;
+ string::size_type nlpos=0;
+
+ nlpos = descr.find('\n');
+ // delete first line
+ if (nlpos != string::npos) {
+ descr.erase(0, nlpos + 2); // del "\n " too
+ }
+
+ // avoid replacing '\n' for a ' ' after a '.\n' is found
+ bool removedFullStop = false;
+ while (nlpos < descr.length()) {
+ // find the new line position
+ nlpos = descr.find('\n', nlpos);
+ if (nlpos == string::npos) {
+ // if it could not find the new line
+ // get out of the loop
+ break;
+ }
+
+ i = nlpos;
+ // erase the char after '\n' which is always " "
+ descr.erase(++i, 1);
+
+ // remove lines likes this: " .", making it a \n
+ if (descr[i] == '.') {
+ descr.erase(i, 1);
+ nlpos = i;
+ // don't permit the next round to replace a '\n' to a ' '
+ removedFullStop = true;
+ continue;
+ } else if (descr[i] != ' ' && removedFullStop == false) {
+ // it's not a line to be verbatim displayed
+ // So it's a paragraph let's replace '\n' with a ' '
+ // replace new line with " "
+ descr.replace(nlpos, 1, " ");
+ }
+
+ removedFullStop = false;
+ nlpos++;
+ }
+
+ return descr;
}
-PkGroupEnum
-get_enum_group (string group)
+PkGroupEnum get_enum_group(string group)
{
- if (group.compare ("admin") == 0) {
- return PK_GROUP_ENUM_ADMIN_TOOLS;
- } else if (group.compare ("base") == 0) {
- return PK_GROUP_ENUM_SYSTEM;
- } else if (group.compare ("comm") == 0) {
- return PK_GROUP_ENUM_COMMUNICATION;
- } else if (group.compare ("devel") == 0) {
- return PK_GROUP_ENUM_PROGRAMMING;
- } else if (group.compare ("doc") == 0) {
- return PK_GROUP_ENUM_DOCUMENTATION;
- } else if (group.compare ("editors") == 0) {
- return PK_GROUP_ENUM_PUBLISHING;
- } else if (group.compare ("electronics") == 0) {
- return PK_GROUP_ENUM_ELECTRONICS;
- } else if (group.compare ("embedded") == 0) {
- return PK_GROUP_ENUM_SYSTEM;
- } else if (group.compare ("fonts") == 0) {
- return PK_GROUP_ENUM_FONTS;
- } else if (group.compare ("games") == 0) {
- return PK_GROUP_ENUM_GAMES;
- } else if (group.compare ("gnome") == 0) {
- return PK_GROUP_ENUM_DESKTOP_GNOME;
- } else if (group.compare ("graphics") == 0) {
- return PK_GROUP_ENUM_GRAPHICS;
- } else if (group.compare ("hamradio") == 0) {
- return PK_GROUP_ENUM_COMMUNICATION;
- } else if (group.compare ("interpreters") == 0) {
- return PK_GROUP_ENUM_PROGRAMMING;
- } else if (group.compare ("kde") == 0) {
- return PK_GROUP_ENUM_DESKTOP_KDE;
- } else if (group.compare ("libdevel") == 0) {
- return PK_GROUP_ENUM_PROGRAMMING;
- } else if (group.compare ("libs") == 0) {
- return PK_GROUP_ENUM_SYSTEM;
- } else if (group.compare ("mail") == 0) {
- return PK_GROUP_ENUM_INTERNET;
- } else if (group.compare ("math") == 0) {
- return PK_GROUP_ENUM_SCIENCE;
- } else if (group.compare ("misc") == 0) {
- return PK_GROUP_ENUM_OTHER;
- } else if (group.compare ("net") == 0) {
- return PK_GROUP_ENUM_NETWORK;
- } else if (group.compare ("news") == 0) {
- return PK_GROUP_ENUM_INTERNET;
- } else if (group.compare ("oldlibs") == 0) {
- return PK_GROUP_ENUM_LEGACY;
- } else if (group.compare ("otherosfs") == 0) {
- return PK_GROUP_ENUM_SYSTEM;
- } else if (group.compare ("perl") == 0) {
- return PK_GROUP_ENUM_PROGRAMMING;
- } else if (group.compare ("python") == 0) {
- return PK_GROUP_ENUM_PROGRAMMING;
- } else if (group.compare ("science") == 0) {
- return PK_GROUP_ENUM_SCIENCE;
- } else if (group.compare ("shells") == 0) {
- return PK_GROUP_ENUM_SYSTEM;
- } else if (group.compare ("sound") == 0) {
- return PK_GROUP_ENUM_MULTIMEDIA;
- } else if (group.compare ("tex") == 0) {
- return PK_GROUP_ENUM_PUBLISHING;
- } else if (group.compare ("text") == 0) {
- return PK_GROUP_ENUM_PUBLISHING;
- } else if (group.compare ("utils") == 0) {
- return PK_GROUP_ENUM_ACCESSORIES;
- } else if (group.compare ("web") == 0) {
- return PK_GROUP_ENUM_INTERNET;
- } else if (group.compare ("x11") == 0) {
- return PK_GROUP_ENUM_DESKTOP_OTHER;
- } else if (group.compare ("alien") == 0) {
- return PK_GROUP_ENUM_UNKNOWN;//FIXME alien is an unknown group?
- } else if (group.compare ("translations") == 0) {
- return PK_GROUP_ENUM_LOCALIZATION;
- } else if (group.compare ("metapackages") == 0) {
- return PK_GROUP_ENUM_COLLECTIONS;
- } else {
- return PK_GROUP_ENUM_UNKNOWN;
- }
+ if (group.compare ("admin") == 0) {
+ return PK_GROUP_ENUM_ADMIN_TOOLS;
+ } else if (group.compare ("base") == 0) {
+ return PK_GROUP_ENUM_SYSTEM;
+ } else if (group.compare ("comm") == 0) {
+ return PK_GROUP_ENUM_COMMUNICATION;
+ } else if (group.compare ("devel") == 0) {
+ return PK_GROUP_ENUM_PROGRAMMING;
+ } else if (group.compare ("doc") == 0) {
+ return PK_GROUP_ENUM_DOCUMENTATION;
+ } else if (group.compare ("editors") == 0) {
+ return PK_GROUP_ENUM_PUBLISHING;
+ } else if (group.compare ("electronics") == 0) {
+ return PK_GROUP_ENUM_ELECTRONICS;
+ } else if (group.compare ("embedded") == 0) {
+ return PK_GROUP_ENUM_SYSTEM;
+ } else if (group.compare ("fonts") == 0) {
+ return PK_GROUP_ENUM_FONTS;
+ } else if (group.compare ("games") == 0) {
+ return PK_GROUP_ENUM_GAMES;
+ } else if (group.compare ("gnome") == 0) {
+ return PK_GROUP_ENUM_DESKTOP_GNOME;
+ } else if (group.compare ("graphics") == 0) {
+ return PK_GROUP_ENUM_GRAPHICS;
+ } else if (group.compare ("hamradio") == 0) {
+ return PK_GROUP_ENUM_COMMUNICATION;
+ } else if (group.compare ("interpreters") == 0) {
+ return PK_GROUP_ENUM_PROGRAMMING;
+ } else if (group.compare ("kde") == 0) {
+ return PK_GROUP_ENUM_DESKTOP_KDE;
+ } else if (group.compare ("libdevel") == 0) {
+ return PK_GROUP_ENUM_PROGRAMMING;
+ } else if (group.compare ("libs") == 0) {
+ return PK_GROUP_ENUM_SYSTEM;
+ } else if (group.compare ("mail") == 0) {
+ return PK_GROUP_ENUM_INTERNET;
+ } else if (group.compare ("math") == 0) {
+ return PK_GROUP_ENUM_SCIENCE;
+ } else if (group.compare ("misc") == 0) {
+ return PK_GROUP_ENUM_OTHER;
+ } else if (group.compare ("net") == 0) {
+ return PK_GROUP_ENUM_NETWORK;
+ } else if (group.compare ("news") == 0) {
+ return PK_GROUP_ENUM_INTERNET;
+ } else if (group.compare ("oldlibs") == 0) {
+ return PK_GROUP_ENUM_LEGACY;
+ } else if (group.compare ("otherosfs") == 0) {
+ return PK_GROUP_ENUM_SYSTEM;
+ } else if (group.compare ("perl") == 0) {
+ return PK_GROUP_ENUM_PROGRAMMING;
+ } else if (group.compare ("python") == 0) {
+ return PK_GROUP_ENUM_PROGRAMMING;
+ } else if (group.compare ("science") == 0) {
+ return PK_GROUP_ENUM_SCIENCE;
+ } else if (group.compare ("shells") == 0) {
+ return PK_GROUP_ENUM_SYSTEM;
+ } else if (group.compare ("sound") == 0) {
+ return PK_GROUP_ENUM_MULTIMEDIA;
+ } else if (group.compare ("tex") == 0) {
+ return PK_GROUP_ENUM_PUBLISHING;
+ } else if (group.compare ("text") == 0) {
+ return PK_GROUP_ENUM_PUBLISHING;
+ } else if (group.compare ("utils") == 0) {
+ return PK_GROUP_ENUM_ACCESSORIES;
+ } else if (group.compare ("web") == 0) {
+ return PK_GROUP_ENUM_INTERNET;
+ } else if (group.compare ("x11") == 0) {
+ return PK_GROUP_ENUM_DESKTOP_OTHER;
+ } else if (group.compare ("alien") == 0) {
+ return PK_GROUP_ENUM_UNKNOWN;//FIXME alien is an unknown group?
+ } else if (group.compare ("translations") == 0) {
+ return PK_GROUP_ENUM_LOCALIZATION;
+ } else if (group.compare ("metapackages") == 0) {
+ return PK_GROUP_ENUM_COLLECTIONS;
+ } else {
+ return PK_GROUP_ENUM_UNKNOWN;
+ }
}
string getChangelogFile(const string &name,
@@ -246,20 +245,20 @@ string getChangelogFile(const string &name,
const string &uri,
pkgAcquire *fetcher)
{
- string descr("Changelog for ");
- descr += name;
+ string descr("Changelog for ");
+ descr += name;
- // no need to translate this, the changelog is in english anyway
- string filename = "/tmp/aptcc_changelog";
+ // no need to translate this, the changelog is in english anyway
+ string filename = "/tmp/aptcc_changelog";
- new pkgAcqFileSane(fetcher, uri, descr, name, filename);
+ new pkgAcqFileSane(fetcher, uri, descr, name, filename);
- ofstream out(filename.c_str());
- if(fetcher->Run() == pkgAcquire::Failed) {
- out << "Failed to download the list of changes. " << endl;
- out << "Please check your Internet connection." << endl;
- // FIXME: Need to dequeue the item
- } else {
+ ofstream out(filename.c_str());
+ if (fetcher->Run() == pkgAcquire::Failed) {
+ out << "Failed to download the list of changes. " << endl;
+ out << "Please check your Internet connection." << endl;
+ // FIXME: Need to dequeue the item
+ } else {
struct stat filestatus;
stat(filename.c_str(), &filestatus );
@@ -268,7 +267,7 @@ string getChangelogFile(const string &name,
if (origin.compare("Ubuntu") == 0) {
out << "The list of changes is not available yet.\n" << endl;
out << "Please use http://launchpad.net/ubuntu/+source/"<< srcPkg <<
- "/" << verstr << "/+changelog" << endl;
+ "/" << verstr << "/+changelog" << endl;
out << "until the changes become available or try again later." << endl;
} else {
out << "This change is not coming from a source that supports changelogs.\n" << endl;
@@ -276,10 +275,10 @@ string getChangelogFile(const string &name,
out << "URI was: " << uri << endl;
}
}
- }
- out.close();
+ }
+ out.close();
- return filename;
+ return filename;
}
string getCVEUrls(const string &changelog)
@@ -376,40 +375,41 @@ string getBugzillaUrls(const string &changelog)
return ret;
}
-bool contains(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > packages,
- const pkgCache::PkgIterator pkg)
+bool contains(PkgList packages, const pkgCache::PkgIterator pkg)
{
- for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator it = packages.begin();
- it != packages.end(); ++it)
- {
- if (it->first == pkg) {
- return true;
- }
- }
- return false;
+ for (PkgList::iterator it = packages.begin(); it != packages.end(); ++it) {
+ if (it->first == pkg) {
+ return true;
+ }
+ }
+ return false;
}
-bool ends_with (const string &str, const char *end)
+bool ends_with(const string &str, const char *end)
{
- size_t endSize = strlen(end);
- return str.size() >= endSize && (memcmp(str.data() + str.size() - endSize, end, endSize) == 0);
+ size_t endSize = strlen(end);
+ return str.size() >= endSize && (memcmp(str.data() + str.size() - endSize, end, endSize) == 0);
}
-bool starts_with (const string &str, const char *start)
+bool starts_with(const string &str, const char *start)
{
- size_t startSize = strlen(start);
- return str.size() >= startSize && (strncmp(str.data(), start, startSize) == 0);
+ size_t startSize = strlen(start);
+ return str.size() >= startSize && (strncmp(str.data(), start, startSize) == 0);
}
const char *utf8(const char *str)
{
- static char *_str = NULL;
- if (str == NULL)
- return NULL;
- if (g_utf8_validate(str, -1, NULL) == true)
- return str;
- g_free(_str);
- _str = NULL;
- _str = g_locale_to_utf8(str, -1, NULL, NULL, NULL);
- return _str;
+ static char *_str = NULL;
+ if (str == NULL) {
+ return NULL;
+ }
+
+ if (g_utf8_validate(str, -1, NULL) == true) {
+ return str;
+ }
+
+ g_free(_str);
+ _str = NULL;
+ _str = g_locale_to_utf8(str, -1, NULL, NULL, NULL);
+ return _str;
}
diff --git a/backends/aptcc/apt-utils.h b/backends/aptcc/apt-utils.h
index 30b143b..11abf16 100644
--- a/backends/aptcc/apt-utils.h
+++ b/backends/aptcc/apt-utils.h
@@ -28,74 +28,70 @@
#include <set>
#include <pk-backend.h>
+#include "apt-intf.h"
#include "pkg_acqfile.h"
-typedef std::vector<pkgCache::PkgIterator> pkgvector;
-
using namespace std;
// compare...uses the candidate version of each package.
class compare
{
public:
- compare() {}
-
- bool operator()(const pair<pkgCache::PkgIterator, pkgCache::VerIterator> &a,
- const pair<pkgCache::PkgIterator, pkgCache::VerIterator> &b)
- {
- int ret = strcmp(a.first.Name(), b.first.Name());
- if (ret == 0) {
- return strcmp(a.second.VerStr(), b.second.VerStr()) < 0;
- }
- return ret < 0;
- }
+ compare() {}
+
+ bool operator()(const PkgPair &a,
+ const PkgPair &b) {
+ int ret = strcmp(a.first.Name(), b.first.Name());
+ if (ret == 0) {
+ return strcmp(a.second.VerStr(), b.second.VerStr()) < 0;
+ }
+ return ret < 0;
+ }
};
/** \brief operator== for match results. */
class result_equality
{
public:
- result_equality() {}
-
- bool operator()(const pair<pkgCache::PkgIterator, pkgCache::VerIterator> &a,
- const pair<pkgCache::PkgIterator, pkgCache::VerIterator> &b)
- {
- return strcmp(a.first.Name(), b.first.Name()) == 0 &&
- strcmp(a.second.VerStr(), b.second.VerStr()) == 0 &&
- strcmp(a.second.Arch(), b.second.Arch()) == 0;
- }
+ result_equality() {}
+
+ bool operator() (const PkgPair &a, const PkgPair &b) {
+ return strcmp(a.first.Name(), b.first.Name()) == 0 &&
+ strcmp(a.second.VerStr(), b.second.VerStr()) == 0 &&
+ strcmp(a.second.Arch(), b.second.Arch()) == 0;
+ }
};
/** \return a short description string corresponding to the given
* version.
*/
string get_default_short_description(const pkgCache::VerIterator &ver,
- pkgRecords *records);
+ pkgRecords *records);
/** \return a short description string corresponding to the given
* version.
*/
string get_short_description(const pkgCache::VerIterator &ver,
- pkgRecords *records);
+ pkgRecords *records);
/** \return a short description string corresponding to the given
* version.
*/
string get_default_long_description(const pkgCache::VerIterator &ver,
- pkgRecords *records);
+ pkgRecords *records);
/** \return a short description string corresponding to the given
* version.
*/
string get_long_description(const pkgCache::VerIterator &ver,
- pkgRecords *records);
+ pkgRecords *records);
/** \return a short description string corresponding to the given
* version.
*/
string get_long_description_parsed(const pkgCache::VerIterator &ver,
- pkgRecords *records);
+ pkgRecords *records);
/**
* Return the PkEnumGroup of the give group string.
@@ -125,8 +121,7 @@ string getBugzillaUrls(const string &changelog);
/**
* Return if the given vector contain a package
*/
-bool contains(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > packages,
- const pkgCache::PkgIterator pkg);
+bool contains(PkgList packages, const pkgCache::PkgIterator pkg);
/**
* Return if the given string ends with the other
diff --git a/backends/aptcc/deb-file.cpp b/backends/aptcc/deb-file.cpp
index 8fa812a..aebe974 100644
--- a/backends/aptcc/deb-file.cpp
+++ b/backends/aptcc/deb-file.cpp
@@ -28,19 +28,19 @@
#include <iostream>
-DebFile::DebFile(const std::string &filename)
- : m_filePath(filename)
+DebFile::DebFile(const std::string &filename) :
+ m_filePath(filename)
{
FileFd in(filename, FileFd::ReadOnly);
debDebFile deb(in);
// Extract control data
m_extractor = new debDebFile::MemControlExtract("control");
- if(!m_extractor->Read(deb)) {
- m_isValid = false;
- return;
+ if (!m_extractor->Read(deb)) {
+ m_isValid = false;
+ return;
} else {
- m_isValid = true;
+ m_isValid = true;
}
m_controlData = m_extractor->Section;
@@ -104,56 +104,55 @@ bool DebFile::check()
std::cout << architecture() << std::endl;
if (architecture().compare("all") != 0 &&
- architecture().compare(_config->Find("APT::Architecture")) != 0)
- {
+ architecture().compare(_config->Find("APT::Architecture")) != 0) {
m_errorMsg = "Wrong architecture ";
m_errorMsg.append(architecture());
return false;
}
-// if not "Architecture" in self._sections:
-// self._dbg(1, "ERROR: no architecture field")
-// self._failure_string = _("No Architecture field in the package")
-// return False
-// arch = self._sections["Architecture"]
-// if arch != "all" and arch != apt_pkg.config.find("APT::Architecture"):
-// self._dbg(1, "ERROR: Wrong architecture dude!")
-// self._failure_string = _("Wrong architecture '%s'") % arch
-// return False
-//
-// // check version
-// if self.compare_to_version_in_cache() == self.VERSION_OUTDATED:
-// if self._cache[self.pkgname].installed:
-// // the deb is older than the installed
-// self._failure_string = _("A later version is already installed")
-// return False
-//
-// // FIXME: this sort of error handling sux
-// self._failure_string = ""
-//
-// // check conflicts
-// if not self.check_conflicts():
-// return False
-//
-// // check if installing it would break anything on the
-// // current system
-// if not self.check_breaks_existing_packages():
-// return False
-//
-// // try to satisfy the dependencies
-// if not self._satisfy_depends(self.depends):
-// return False
-//
-// // check for conflicts again (this time with the packages that are
-// // makeed for install)
-// if not self.check_conflicts():
-// return False
-//
-// if self._cache._depcache.broken_count > 0:
-// self._failure_string = _("Failed to satisfy all dependencies "
-// "(broken cache)")
-// // clean the cache again
-// self._cache.clear()
-// return False
+ // if not "Architecture" in self._sections:
+ // self._dbg(1, "ERROR: no architecture field")
+ // self._failure_string = _("No Architecture field in the package")
+ // return False
+ // arch = self._sections["Architecture"]
+ // if arch != "all" and arch != apt_pkg.config.find("APT::Architecture"):
+ // self._dbg(1, "ERROR: Wrong architecture dude!")
+ // self._failure_string = _("Wrong architecture '%s'") % arch
+ // return False
+ //
+ // // check version
+ // if self.compare_to_version_in_cache() == self.VERSION_OUTDATED:
+ // if self._cache[self.pkgname].installed:
+ // // the deb is older than the installed
+ // self._failure_string = _("A later version is already installed")
+ // return False
+ //
+ // // FIXME: this sort of error handling sux
+ // self._failure_string = ""
+ //
+ // // check conflicts
+ // if not self.check_conflicts():
+ // return False
+ //
+ // // check if installing it would break anything on the
+ // // current system
+ // if not self.check_breaks_existing_packages():
+ // return False
+ //
+ // // try to satisfy the dependencies
+ // if not self._satisfy_depends(self.depends):
+ // return False
+ //
+ // // check for conflicts again (this time with the packages that are
+ // // makeed for install)
+ // if not self.check_conflicts():
+ // return False
+ //
+ // if self._cache._depcache.broken_count > 0:
+ // self._failure_string = _("Failed to satisfy all dependencies "
+ // "(broken cache)")
+ // // clean the cache again
+ // self._cache.clear()
+ // return False
return true;
}
diff --git a/backends/aptcc/deb-file.h b/backends/aptcc/deb-file.h
index bf19bf3..187c4b6 100644
--- a/backends/aptcc/deb-file.h
+++ b/backends/aptcc/deb-file.h
@@ -28,30 +28,30 @@
class DebFile
{
-// typedef int user_tag_reference;
+ // typedef int user_tag_reference;
public:
- DebFile(const std::string &filename);
- bool isValid() const;
+ DebFile(const std::string &filename);
+ bool isValid() const;
- std::string filePath() const;
- std::string packageName() const;
- std::string sourcePackage() const;
- std::string version() const;
- std::string architecture() const;
- std::string summary() const;
- std::string description() const;
- std::string conflicts() const;
+ std::string filePath() const;
+ std::string packageName() const;
+ std::string sourcePackage() const;
+ std::string version() const;
+ std::string architecture() const;
+ std::string summary() const;
+ std::string description() const;
+ std::string conflicts() const;
- // THIS should be moved to AptIntf class
- bool check();
- std::string errorMsg() const;
+ // THIS should be moved to AptIntf class
+ bool check();
+ std::string errorMsg() const;
private:
- std::string m_filePath;
- debDebFile::MemControlExtract *m_extractor;
- pkgTagSection m_controlData;
- std::string m_errorMsg;
- bool m_isValid;
+ std::string m_filePath;
+ debDebFile::MemControlExtract *m_extractor;
+ pkgTagSection m_controlData;
+ std::string m_errorMsg;
+ bool m_isValid;
};
#endif
diff --git a/backends/aptcc/gstMatcher.cpp b/backends/aptcc/gstMatcher.cpp
index 4dd867c..43a42d6 100644
--- a/backends/aptcc/gstMatcher.cpp
+++ b/backends/aptcc/gstMatcher.cpp
@@ -32,17 +32,17 @@ GstMatcher::GstMatcher(gchar **values)
// gstreamer0.10(urisource-foobar)
// gstreamer0.10(decoder-audio/x-wma)(wmaversion=3)
const char *pkreg = "^gstreamer\\([0-9\\.]\\+\\)"
- "(\\(encoder\\|decoder\\|urisource\\|urisink\\|element\\)-\\([^)]\\+\\))"
- "\\(([^\\(^\\)]*)\\)\\?";
+ "(\\(encoder\\|decoder\\|urisource\\|urisink\\|element\\)-\\([^)]\\+\\))"
+ "\\(([^\\(^\\)]*)\\)\\?";
regex_t pkre;
- if(regcomp(&pkre, pkreg, 0) != 0) {
+ if (regcomp(&pkre, pkreg, 0) != 0) {
g_debug("Regex compilation error: ", pkreg);
return;
}
gchar *value;
- for (uint i = 0; i < g_strv_length(values); i++) {
+ for (uint i = 0; i < g_strv_length(values); ++i) {
value = values[i];
regmatch_t matches[5];
if (regexec(&pkre, value, 5, matches, 0) != REG_NOMATCH) {
@@ -76,10 +76,10 @@ GstMatcher::GstMatcher(gchar **values)
} else if (type.compare("element") == 0) {
type = "Gstreamer-Elements: ";
}
-// cout << version << endl;
-// cout << type << endl;
-// cout << data << endl;
-// cout << opt << endl;
+ // cout << version << endl;
+ // cout << type << endl;
+ // cout << data << endl;
+ // cout << opt << endl;
gchar *capsString;
if (opt.empty()) {
@@ -120,37 +120,36 @@ GstMatcher::~GstMatcher()
bool GstMatcher::matches(string record)
{
for (vector<Match>::iterator i = m_matches.begin(); i != m_matches.end(); ++i) {
- // Tries to find "Gstreamer-version: xxx"
- if (record.find(i->version) != string::npos) {
- size_t found;
- found = record.find(i->type);
- // Tries to find the type "Gstreamer-Uri-Sinks: "
- if (found != string::npos) {
- found += i->type.size(); // skips the "Gstreamer-Uri-Sinks: " string
- size_t endOfLine;
- endOfLine = record.find('\n', found);
-
- GstCaps *caps;
- caps = gst_caps_from_string(record.substr(found, endOfLine - found).c_str());
- if (caps == NULL) {
- continue;
- }
-
- // if the record is capable of intersect them we found the package
- bool provides = gst_caps_can_intersect(static_cast<GstCaps*>(i->caps), caps);
- gst_caps_unref(caps);
-
- if (provides) {
- return true;
- }
+ // Tries to find "Gstreamer-version: xxx"
+ if (record.find(i->version) != string::npos) {
+ size_t found;
+ found = record.find(i->type);
+ // Tries to find the type "Gstreamer-Uri-Sinks: "
+ if (found != string::npos) {
+ found += i->type.size(); // skips the "Gstreamer-Uri-Sinks: " string
+ size_t endOfLine;
+ endOfLine = record.find('\n', found);
+
+ GstCaps *caps;
+ caps = gst_caps_from_string(record.substr(found, endOfLine - found).c_str());
+ if (caps == NULL) {
+ continue;
+ }
+
+ // if the record is capable of intersect them we found the package
+ bool provides = gst_caps_can_intersect(static_cast<GstCaps*>(i->caps), caps);
+ gst_caps_unref(caps);
+
+ if (provides) {
+ return true;
}
}
}
- return false;
+ }
+ return false;
}
bool GstMatcher::hasMatches() const
{
return !m_matches.empty();
}
-
diff --git a/backends/aptcc/matcher.cpp b/backends/aptcc/matcher.cpp
index 4f88074..de4c27a 100644
--- a/backends/aptcc/matcher.cpp
+++ b/backends/aptcc/matcher.cpp
@@ -24,155 +24,150 @@
#include <stdio.h>
#include <iostream>
-Matcher::Matcher(const string &matchers)
- : m_hasError(false)
+Matcher::Matcher(const string &matchers) :
+ m_hasError(false)
{
- string::const_iterator start = matchers.begin();
- parse_pattern(start, matchers.end());
- if (m_hasError) {
- cerr << "ERROR: " << m_error << endl;
- }
+ string::const_iterator start = matchers.begin();
+ parse_pattern(start, matchers.end());
+ if (m_hasError) {
+ cerr << "ERROR: " << m_error << endl;
+ }
}
Matcher::~Matcher()
{
- for (vector<regex_t>::iterator i=m_matches.begin();
- i != m_matches.end(); ++i)
- {
- regfree(&*i);
- }
+ for (vector<regex_t>::iterator i=m_matches.begin();
+ i != m_matches.end(); ++i) {
+ regfree(&*i);
+ }
}
bool do_compile(const string &_pattern,
- regex_t &pattern,
- int cflags)
+ regex_t &pattern,
+ int cflags)
{
- return !regcomp(&pattern, _pattern.c_str(), cflags);
+ return !regcomp(&pattern, _pattern.c_str(), cflags);
}
bool string_matches(const char *s, regex_t &pattern_nogroup)
{
- return !regexec(&pattern_nogroup, s, 0, NULL, 0);
+ return !regexec(&pattern_nogroup, s, 0, NULL, 0);
}
bool Matcher::matches(const string &s)
{
- int matchesCount = 0;
- for (vector<regex_t>::iterator i=m_matches.begin();
- i != m_matches.end(); ++i)
- {
- if (string_matches(s.c_str(), *i)) {
- matchesCount++;
- }
- }
- return m_matches.size() == matchesCount;
+ int matchesCount = 0;
+ for (vector<regex_t>::iterator i=m_matches.begin();
+ i != m_matches.end(); ++i) {
+ if (string_matches(s.c_str(), *i)) {
+ matchesCount++;
+ }
+ }
+ return m_matches.size() == matchesCount;
}
// This matcher is to be used for files
// pass a map so it can remember which patter was alread used
bool Matcher::matchesFile(const string &s, map<int, bool> &matchers_used)
{
- int matchesCount = 0;
- for (vector<regex_t>::iterator i = m_matches.begin();
- i != m_matches.end(); ++i)
- for (int i = 0; i < m_matches.size(); i++)
- {
- bool not_used = true;
- if (matchers_used.find(i) != matchers_used.end()) {
- not_used = true;
- }
-
- if (not_used && string_matches(s.c_str(), m_matches.at(i))) {
- matchers_used[i] = true;
- }
- }
- return m_matches.size() == matchers_used.size();
+ int matchesCount = 0;
+ for (vector<regex_t>::iterator i = m_matches.begin();
+ i != m_matches.end(); ++i) {
+ for (int i = 0; i < m_matches.size(); ++i) {
+ bool not_used = true;
+ if (matchers_used.find(i) != matchers_used.end()) {
+ not_used = true;
+ }
+
+ if (not_used && string_matches(s.c_str(), m_matches.at(i))) {
+ matchers_used[i] = true;
+ }
+ }
+ }
+
+ return m_matches.size() == matchers_used.size();
}
bool Matcher::parse_pattern(string::const_iterator &start,
- const std::string::const_iterator &end)
+ const std::string::const_iterator &end)
{
- // Just filter blank strings out immediately.
- while (start != end && isspace(*start)) {
- ++start;
- }
-
- if (start == end) {
- return false;
- }
-
- while (start != end && *start != '|' && *start != ')') {
- string subString = parse_substr(start, end);
-
- if (subString.empty()) {
- continue;
- }
-
- regex_t pattern_nogroup;
- if (do_compile(subString, pattern_nogroup, REG_ICASE|REG_EXTENDED|REG_NOSUB)) {
- m_matches.push_back(pattern_nogroup);
- } else {
- regfree(&pattern_nogroup);
- m_error = string("Regex compilation error");
- m_hasError = true;
- return false;
- }
-
-// regex_t pattern_group;
-// if (do_compile(subString, pattern_group, REG_ICASE|REG_EXTENDED)) {
-// m_matches.push_back(pattern_group);
-// } else {
-// regfree(&pattern_group);
-// m_error = string("Regex compilation error");
-// m_hasError = true;
-// return false;
-// }
- }
- return true;
-
+ // Just filter blank strings out immediately.
+ while (start != end && isspace(*start)) {
+ ++start;
+ }
+
+ if (start == end) {
+ return false;
+ }
+
+ while (start != end && *start != '|' && *start != ')') {
+ string subString = parse_substr(start, end);
+
+ if (subString.empty()) {
+ continue;
+ }
+
+ regex_t pattern_nogroup;
+ if (do_compile(subString, pattern_nogroup, REG_ICASE|REG_EXTENDED|REG_NOSUB)) {
+ m_matches.push_back(pattern_nogroup);
+ } else {
+ regfree(&pattern_nogroup);
+ m_error = string("Regex compilation error");
+ m_hasError = true;
+ return false;
+ }
+
+ // regex_t pattern_group;
+ // if (do_compile(subString, pattern_group, REG_ICASE|REG_EXTENDED)) {
+ // m_matches.push_back(pattern_group);
+ // } else {
+ // regfree(&pattern_group);
+ // m_error = string("Regex compilation error");
+ // m_hasError = true;
+ // return false;
+ // }
+ }
+
+ return true;
}
string Matcher::parse_literal_string_tail(string::const_iterator &start,
- const string::const_iterator end)
+ const string::const_iterator end)
{
- std::string rval;
-
- while (start != end && *start != '"')
- {
- if (*start == '\\')
- {
- ++start;
- if (start != end)
- {
- switch (*start)
- {
- case 'n':
- rval += '\n';
- break;
- case 't':
- rval += '\t';
- break;
- default:
- rval += *start;
- break;
- }
- ++start;
- }
- } else {
- rval += *start;
- ++start;
- }
- }
-
- if (start == end || *start != '"') {
- m_error = string("Unterminated literal string after " + rval);
- m_hasError = true;
- return string();
- }
-
- ++start;
-
- return rval;
+ std::string rval;
+
+ while (start != end && *start != '"') {
+ if (*start == '\\') {
+ ++start;
+ if (start != end) {
+ switch (*start) {
+ case 'n':
+ rval += '\n';
+ break;
+ case 't':
+ rval += '\t';
+ break;
+ default:
+ rval += *start;
+ break;
+ }
+ ++start;
+ }
+ } else {
+ rval += *start;
+ ++start;
+ }
+ }
+
+ if (start == end || *start != '"') {
+ m_error = string("Unterminated literal string after " + rval);
+ m_hasError = true;
+ return string();
+ }
+
+ ++start;
+
+ return rval;
}
// Returns a substring up to the first metacharacter, including escaped
@@ -180,66 +175,61 @@ string Matcher::parse_literal_string_tail(string::const_iterator &start,
//
// Advances loc to the first character of 's' following the escaped string.
string Matcher::parse_substr(string::const_iterator &start,
- const string::const_iterator &end)
+ const string::const_iterator &end)
{
- std::string rval;
- bool done=false;
-
- // Strip leading whitespace.
- while (start != end && isspace(*start))
- ++start;
-
- do
- {
- while (start != end &&
- *start != '(' &&
- *start != ')' &&
- *start != '!' &&
- *start != '~' &&
- *start != '|' &&
- *start != '"' &&
- !isspace(*start))
- {
- rval += *start;
- ++start;
- }
-
- if (start != end && *start == '"')
- {
- ++start;
-
- rval += parse_literal_string_tail(start, end);
- if (m_hasError) {
- return string();
- }
- }
-
- // We quit because we ran off the end of the string or saw a
- // metacharacter. If the latter case and it was a tilde-escape,
- // add the escaped character to the string and continue.
- if (start != end && start+1 != end && *start == '~')
- {
- const char next = *(start+1);
-
- if (next == '(' || next == ')' ||
- next == '!' || next == '~' ||
- next == '|' || next == '"' ||
- isspace(next))
- {
- rval += next;
- start += 2;
- } else {
- done = true;
- }
- } else {
- done = true;
- }
- } while(!done);
-
- return rval;
+ std::string rval;
+ bool done=false;
+
+ // Strip leading whitespace.
+ while (start != end && isspace(*start))
+ ++start;
+
+ do {
+ while (start != end &&
+ *start != '(' &&
+ *start != ')' &&
+ *start != '!' &&
+ *start != '~' &&
+ *start != '|' &&
+ *start != '"' &&
+ !isspace(*start)) {
+ rval += *start;
+ ++start;
+ }
+
+ if (start != end && *start == '"') {
+ ++start;
+
+ rval += parse_literal_string_tail(start, end);
+ if (m_hasError) {
+ return string();
+ }
+ }
+
+ // We quit because we ran off the end of the string or saw a
+ // metacharacter. If the latter case and it was a tilde-escape,
+ // add the escaped character to the string and continue.
+ if (start != end && start+1 != end && *start == '~') {
+ const char next = *(start+1);
+
+ if (next == '(' || next == ')' ||
+ next == '!' || next == '~' ||
+ next == '|' || next == '"' ||
+ isspace(next)) {
+ rval += next;
+ start += 2;
+ } else {
+ done = true;
+ }
+ } else {
+ done = true;
+ }
+ } while(!done);
+
+ return rval;
}
bool Matcher::hasError() const
{
- return m_hasError;
+ return m_hasError;
}
diff --git a/backends/aptcc/matcher.h b/backends/aptcc/matcher.h
index e4d1cb2..23c97ab 100644
--- a/backends/aptcc/matcher.h
+++ b/backends/aptcc/matcher.h
@@ -33,23 +33,23 @@ using namespace std;
class Matcher
{
public:
- Matcher(const string &matchers);
- ~Matcher();
+ Matcher(const string &matchers);
+ ~Matcher();
- bool matches(const string &s);
- bool matchesFile(const string &s, map<int, bool> &matchers_used);
- bool hasError() const;
+ bool matches(const string &s);
+ bool matchesFile(const string &s, map<int, bool> &matchers_used);
+ bool hasError() const;
private:
- bool m_hasError;
- string m_error;
- bool parse_pattern(string::const_iterator &start,
- const std::string::const_iterator &end);
- string parse_substr(string::const_iterator &start,
- const string::const_iterator &end);
- string parse_literal_string_tail(string::const_iterator &start,
- const string::const_iterator end);
- vector<regex_t> m_matches;
+ bool m_hasError;
+ string m_error;
+ bool parse_pattern(string::const_iterator &start,
+ const std::string::const_iterator &end);
+ string parse_substr(string::const_iterator &start,
+ const string::const_iterator &end);
+ string parse_literal_string_tail(string::const_iterator &start,
+ const string::const_iterator end);
+ vector<regex_t> m_matches;
};
#endif
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 1645f10..87f3b34 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -44,95 +44,88 @@ static PkBackendSpawn *spawn;
/**
* pk_backend_get_description:
*/
-gchar *
-pk_backend_get_description (PkBackend *backend)
+gchar* pk_backend_get_description(PkBackend *backend)
{
- return g_strdup ("APTcc");
+ return g_strdup ("APTcc");
}
/**
* pk_backend_get_author:
*/
-gchar *
-pk_backend_get_author (PkBackend *backend)
+gchar* pk_backend_get_author(PkBackend *backend)
{
- return g_strdup ("Daniel Nicoletti <dantti85-pk at yahoo.com.br>");
+ return g_strdup ("Daniel Nicoletti <dantti85-pk at yahoo.com.br>");
}
/**
* pk_backend_initialize:
*/
-void
-pk_backend_initialize (PkBackend *backend)
+void pk_backend_initialize(PkBackend *backend)
{
- g_debug ("APTcc Initializing");
+ g_debug ("APTcc Initializing");
- if (pkgInitConfig(*_config) == false ||
- pkgInitSystem(*_config, _system) == false)
- {
- g_debug ("ERROR initializing backend");
- }
+ if (pkgInitConfig(*_config) == false ||
+ pkgInitSystem(*_config, _system) == false) {
+ g_debug ("ERROR initializing backend");
+ }
// Disable apt-listbugs as it freezes PK
setenv("APT_LISTBUGS_FRONTEND", "none", 1);
- spawn = pk_backend_spawn_new ();
- pk_backend_spawn_set_name (spawn, "aptcc");
+ spawn = pk_backend_spawn_new ();
+ pk_backend_spawn_set_name (spawn, "aptcc");
}
/**
* pk_backend_destroy:
*/
-void
-pk_backend_destroy (PkBackend *backend)
+void pk_backend_destroy(PkBackend *backend)
{
- g_debug ("APTcc being destroyed");
+ g_debug ("APTcc being destroyed");
}
/**
* pk_backend_get_groups:
*/
-PkBitfield
-pk_backend_get_groups (PkBackend *backend)
+PkBitfield pk_backend_get_groups(PkBackend *backend)
{
- return pk_bitfield_from_enums (
- PK_GROUP_ENUM_ACCESSORIES,
- PK_GROUP_ENUM_ADMIN_TOOLS,
- PK_GROUP_ENUM_COMMUNICATION,
- PK_GROUP_ENUM_DOCUMENTATION,
- PK_GROUP_ENUM_DESKTOP_GNOME,
- PK_GROUP_ENUM_DESKTOP_KDE,
- PK_GROUP_ENUM_DESKTOP_OTHER,
- PK_GROUP_ENUM_ELECTRONICS,
- PK_GROUP_ENUM_FONTS,
- PK_GROUP_ENUM_GAMES,
- PK_GROUP_ENUM_GRAPHICS,
- PK_GROUP_ENUM_INTERNET,
- PK_GROUP_ENUM_LEGACY,
- PK_GROUP_ENUM_LOCALIZATION,
- PK_GROUP_ENUM_MULTIMEDIA,
- PK_GROUP_ENUM_NETWORK,
- PK_GROUP_ENUM_OTHER,
- PK_GROUP_ENUM_PROGRAMMING,
- PK_GROUP_ENUM_PUBLISHING,
- PK_GROUP_ENUM_SCIENCE,
- PK_GROUP_ENUM_SYSTEM,
- -1);
+ return pk_bitfield_from_enums (
+ PK_GROUP_ENUM_ACCESSORIES,
+ PK_GROUP_ENUM_ADMIN_TOOLS,
+ PK_GROUP_ENUM_COMMUNICATION,
+ PK_GROUP_ENUM_DOCUMENTATION,
+ PK_GROUP_ENUM_DESKTOP_GNOME,
+ PK_GROUP_ENUM_DESKTOP_KDE,
+ PK_GROUP_ENUM_DESKTOP_OTHER,
+ PK_GROUP_ENUM_ELECTRONICS,
+ PK_GROUP_ENUM_FONTS,
+ PK_GROUP_ENUM_GAMES,
+ PK_GROUP_ENUM_GRAPHICS,
+ PK_GROUP_ENUM_INTERNET,
+ PK_GROUP_ENUM_LEGACY,
+ PK_GROUP_ENUM_LOCALIZATION,
+ PK_GROUP_ENUM_MULTIMEDIA,
+ PK_GROUP_ENUM_NETWORK,
+ PK_GROUP_ENUM_OTHER,
+ PK_GROUP_ENUM_PROGRAMMING,
+ PK_GROUP_ENUM_PUBLISHING,
+ PK_GROUP_ENUM_SCIENCE,
+ PK_GROUP_ENUM_SYSTEM,
+ -1);
}
/**
* pk_backend_get_filters:
*/
-PkBitfield
-pk_backend_get_filters (PkBackend *backend)
+PkBitfield pk_backend_get_filters(PkBackend *backend)
{
PkBitfield filters;
filters = pk_bitfield_from_enums (
- PK_FILTER_ENUM_GUI,
- PK_FILTER_ENUM_INSTALLED,
- PK_FILTER_ENUM_DEVELOPMENT,
- PK_FILTER_ENUM_FREE,
- -1);
+ PK_FILTER_ENUM_GUI,
+ PK_FILTER_ENUM_INSTALLED,
+ PK_FILTER_ENUM_DEVELOPMENT,
+ PK_FILTER_ENUM_FREE,
+ -1);
// if we have multiArch support we add the native filter
if (APT::Configuration::getArchitectures(false).size() > 1) {
@@ -145,204 +138,192 @@ pk_backend_get_filters (PkBackend *backend)
/**
* pk_backend_get_mime_types:
*/
-gchar *
-pk_backend_get_mime_types (PkBackend *backend)
+gchar* pk_backend_get_mime_types(PkBackend *backend)
{
- return g_strdup ("application/x-deb");
+ return g_strdup ("application/x-deb");
}
/**
* pk_backend_cancel:
*/
-void
-pk_backend_cancel (PkBackend *backend)
+void pk_backend_cancel(PkBackend *backend)
{
- AptIntf *m_apt = (AptIntf*) pk_backend_get_pointer(backend, "aptcc_obj");
- if (m_apt) {
- m_apt->cancel();
- }
+ AptIntf *m_apt = (AptIntf*) pk_backend_get_pointer(backend, "aptcc_obj");
+ if (m_apt) {
+ m_apt->cancel();
+ }
}
-static gboolean
-backend_get_depends_or_requires_thread (PkBackend *backend)
+static gboolean backend_get_depends_or_requires_thread(PkBackend *backend)
{
- gchar **package_ids;
- PkBitfield filters;
- gchar *pi;
- bool recursive;
-
- package_ids = pk_backend_get_strv (backend, "package_ids");
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
- recursive = pk_backend_get_bool (backend, "recursive");
-
- pk_backend_set_allow_cancel (backend, true);
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
-
- bool depends = pk_backend_get_bool(backend, "get_depends");
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- PkgList output;
- for (uint i = 0; i < g_strv_length(package_ids); i++) {
- if (_cancel) {
- break;
- }
- pi = package_ids[i];
- if (pk_package_id_check(pi) == false) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_ID_INVALID,
- pi);
- delete m_apt;
- return false;
- }
-
- PkgPair pkg_ver;
+ gchar **package_ids;
+ PkBitfield filters;
+ gchar *pi;
+ bool recursive;
+
+ package_ids = pk_backend_get_strv (backend, "package_ids");
+ filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
+ recursive = pk_backend_get_bool (backend, "recursive");
+
+ pk_backend_set_allow_cancel (backend, true);
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
+
+ bool depends = pk_backend_get_bool(backend, "get_depends");
+
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ PkgList output;
+ for (uint i = 0; i < g_strv_length(package_ids); ++i) {
+ if (_cancel) {
+ break;
+ }
+ pi = package_ids[i];
+ if (pk_package_id_check(pi) == false) {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_PACKAGE_ID_INVALID,
+ pi);
+ delete m_apt;
+ return false;
+ }
+
+ PkgPair pkg_ver;
bool found;
- pkg_ver = m_apt->find_package_id(pi, found);
- if (!found)
- {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Couldn't find package");
- delete m_apt;
- return false;
- }
-
- if (depends) {
- m_apt->get_depends(output, pkg_ver.first, recursive);
- } else {
- m_apt->get_requires(output, pkg_ver.first, recursive);
- }
- }
-
- // It's faster to emmit the packages here than in the matching part
- m_apt->emit_packages(output, filters);
-
- delete m_apt;
- return true;
+ pkg_ver = m_apt->find_package_id(pi, found);
+ if (!found) {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
+ "Couldn't find package");
+ delete m_apt;
+ return false;
+ }
+
+ if (depends) {
+ m_apt->get_depends(output, pkg_ver.first, recursive);
+ } else {
+ m_apt->get_requires(output, pkg_ver.first, recursive);
+ }
+ }
+
+ // It's faster to emmit the packages here than in the matching part
+ m_apt->emit_packages(output, filters);
+
+ delete m_apt;
+ return true;
}
/**
* pk_backend_get_depends:
*/
-void
-pk_backend_get_depends (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void pk_backend_get_depends(PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
- pk_backend_set_bool (backend, "get_depends", true);
- pk_backend_set_bool (backend, "recursive", recursive);
- pk_backend_thread_create (backend, backend_get_depends_or_requires_thread);
+ pk_backend_set_bool (backend, "get_depends", true);
+ pk_backend_set_bool (backend, "recursive", recursive);
+ pk_backend_thread_create (backend, backend_get_depends_or_requires_thread);
}
/**
* pk_backend_get_requires:
*/
-void
-pk_backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
+void pk_backend_get_requires(PkBackend *backend, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
- pk_backend_set_bool (backend, "get_depends", false);
- pk_backend_set_bool (backend, "recursive", recursive);
- pk_backend_thread_create (backend, backend_get_depends_or_requires_thread);
+ pk_backend_set_bool (backend, "get_depends", false);
+ pk_backend_set_bool (backend, "recursive", recursive);
+ pk_backend_thread_create (backend, backend_get_depends_or_requires_thread);
}
/**
* pk_backend_get_distro_upgrades:
*/
-void
-pk_backend_get_distro_upgrades (PkBackend *backend)
+void pk_backend_get_distro_upgrades(PkBackend *backend)
{
- pk_backend_spawn_helper (spawn, "get-distro-upgrade.py", "get-distro-upgrades", NULL);
+ pk_backend_spawn_helper (spawn, "get-distro-upgrade.py", "get-distro-upgrades", NULL);
}
-static gboolean
-backend_get_files_thread (PkBackend *backend)
+static gboolean backend_get_files_thread(PkBackend *backend)
{
- gchar **package_ids;
- gchar *pi;
-
- package_ids = pk_backend_get_strv (backend, "package_ids");
- if (package_ids == NULL) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_ID_INVALID,
- "Invalid package id");
- pk_backend_finished (backend);
- return false;
- }
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- for (uint i = 0; i < g_strv_length(package_ids); i++) {
- pi = package_ids[i];
- if (pk_package_id_check(pi) == false) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_ID_INVALID,
- pi);
- delete m_apt;
- return false;
- }
-
- PkgPair pkg_ver;
+ gchar **package_ids;
+ gchar *pi;
+
+ package_ids = pk_backend_get_strv (backend, "package_ids");
+ if (package_ids == NULL) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_PACKAGE_ID_INVALID,
+ "Invalid package id");
+ pk_backend_finished(backend);
+ return false;
+ }
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
+ for (uint i = 0; i < g_strv_length(package_ids); ++i) {
+ pi = package_ids[i];
+ if (pk_package_id_check(pi) == false) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_PACKAGE_ID_INVALID,
+ pi);
+ delete m_apt;
+ return false;
+ }
+
+ PkgPair pkg_ver;
bool found;
- pkg_ver = m_apt->find_package_id(pi, found);
- if (!found)
- {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "Couldn't find package");
- delete m_apt;
- return false;
- }
-
- m_apt->emitFiles(backend, pi);
- }
-
- delete m_apt;
- return true;
+ pkg_ver = m_apt->find_package_id(pi, found);
+ if (!found) {
+ pk_backend_error_code(backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "Couldn't find package");
+ delete m_apt;
+ return false;
+ }
+
+ m_apt->emitFiles(backend, pi);
+ }
+
+ delete m_apt;
+ return true;
}
/**
* pk_backend_get_files:
*/
-void
-pk_backend_get_files (PkBackend *backend, gchar **package_ids)
+void pk_backend_get_files(PkBackend *backend, gchar **package_ids)
{
- pk_backend_thread_create (backend, backend_get_files_thread);
+ pk_backend_thread_create(backend, backend_get_files_thread);
}
-static gboolean
-backend_get_details_thread (PkBackend *backend)
+static gboolean backend_get_details_thread(PkBackend *backend)
{
- gchar **package_ids;
- gchar *pi;
+ gchar **package_ids;
PkRoleEnum role = pk_backend_get_role (backend);
- bool updateDetail = role == PK_ROLE_ENUM_GET_UPDATE_DETAIL ? true : false;
- package_ids = pk_backend_get_strv (backend, "package_ids");
- if (package_ids == NULL) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_ID_INVALID,
- "Invalid package id");
- pk_backend_finished (backend);
- return false;
- }
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
+ bool updateDetail = role == PK_ROLE_ENUM_GET_UPDATE_DETAIL ? true : false;
+ package_ids = pk_backend_get_strv (backend, "package_ids");
+ if (package_ids == NULL) {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_PACKAGE_ID_INVALID,
+ "Invalid package id");
+ pk_backend_finished (backend);
+ return false;
+ }
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
if (updateDetail) {
// this is needed to compare the changelog verstion to
@@ -359,656 +340,627 @@ backend_get_details_thread (PkBackend *backend)
m_apt->emitDetails(pkgs);
}
- delete m_apt;
- return true;
+ delete m_apt;
+ return true;
}
/**
* pk_backend_get_update_detail:
*/
-void
-pk_backend_get_update_detail (PkBackend *backend, gchar **package_ids)
+void pk_backend_get_update_detail(PkBackend *backend, gchar **package_ids)
{
- pk_backend_thread_create (backend, backend_get_details_thread);
+ pk_backend_thread_create(backend, backend_get_details_thread);
}
/**
* pk_backend_get_details:
*/
-void
-pk_backend_get_details (PkBackend *backend, gchar **package_ids)
+void pk_backend_get_details(PkBackend *backend, gchar **package_ids)
{
- pk_backend_thread_create (backend, backend_get_details_thread);
+ pk_backend_thread_create(backend, backend_get_details_thread);
}
-static gboolean
-backend_get_or_update_system_thread (PkBackend *backend)
+static gboolean backend_get_or_update_system_thread (PkBackend *backend)
{
- PkBitfield filters;
- bool getUpdates;
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
- getUpdates = pk_backend_get_bool(backend, "getUpdates");
- pk_backend_set_allow_cancel (backend, true);
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
-
- pkgCacheFile Cache;
- OpTextProgress Prog(*_config);
- int timeout = 10;
- // TODO test this
- while (Cache.Open(&Prog, !getUpdates) == false) {
- // failed to open cache, try checkDeps then..
- // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
- if (getUpdates == true || (timeout <= 0)) {
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_NO_CACHE,
- "Could not open package cache.");
- return false;
- } else {
- pk_backend_set_status (backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
- sleep(1);
- timeout--;
- }
- }
- pk_backend_set_status (backend, PK_STATUS_ENUM_RUNNING);
-
- if (pkgDistUpgrade(*Cache) == false)
- {
- show_broken(backend, Cache, false);
- g_debug ("Internal error, DistUpgrade broke stuff");
- delete m_apt;
- return false;
- }
-
- bool res = true;
- if (getUpdates) {
- PkgList update;
- PkgList kept;
-
- for(pkgCache::PkgIterator pkg=m_apt->packageCache->PkgBegin();
- !pkg.end();
- ++pkg)
- {
- if((*Cache)[pkg].Upgrade() == true &&
- (*Cache)[pkg].NewInstall() == false) {
- update.push_back(
- PkgPair(pkg, m_apt->find_candidate_ver(pkg)));
- } else if ((*Cache)[pkg].Upgradable() == true &&
- pkg->CurrentVer != 0 &&
- (*Cache)[pkg].Delete() == false) {
- kept.push_back(
- PkgPair(pkg, m_apt->find_candidate_ver(pkg)));
- }
- }
-
- m_apt->emitUpdates(update, filters);
- m_apt->emit_packages(kept, filters, PK_INFO_ENUM_BLOCKED);
- } else {
- res = m_apt->installPackages(Cache);
- }
-
- delete m_apt;
- return res;
+ PkBitfield filters;
+ bool getUpdates;
+ filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
+ getUpdates = pk_backend_get_bool(backend, "getUpdates");
+ pk_backend_set_allow_cancel(backend, true);
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
+
+ pkgCacheFile Cache;
+ OpTextProgress Prog(*_config);
+ int timeout = 10;
+ // TODO test this
+ while (Cache.Open(&Prog, !getUpdates) == false) {
+ // failed to open cache, try checkDeps then..
+ // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
+ if (getUpdates == true || (timeout <= 0)) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_NO_CACHE,
+ "Could not open package cache.");
+ return false;
+ } else {
+ pk_backend_set_status (backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
+ sleep(1);
+ timeout--;
+ }
+ }
+ pk_backend_set_status (backend, PK_STATUS_ENUM_RUNNING);
+
+ if (pkgDistUpgrade(*Cache) == false) {
+ show_broken(backend, Cache, false);
+ g_debug ("Internal error, DistUpgrade broke stuff");
+ delete m_apt;
+ return false;
+ }
+
+ bool res = true;
+ if (getUpdates) {
+ PkgList update;
+ PkgList kept;
+
+ for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin();
+ !pkg.end();
+ ++pkg) {
+ if ((*Cache)[pkg].Upgrade() == true &&
+ (*Cache)[pkg].NewInstall() == false) {
+ update.push_back(PkgPair(pkg, m_apt->find_candidate_ver(pkg)));
+ } else if ((*Cache)[pkg].Upgradable() == true &&
+ pkg->CurrentVer != 0 &&
+ (*Cache)[pkg].Delete() == false) {
+ kept.push_back(PkgPair(pkg, m_apt->find_candidate_ver(pkg)));
+ }
+ }
+
+ m_apt->emitUpdates(update, filters);
+ m_apt->emit_packages(kept, filters, PK_INFO_ENUM_BLOCKED);
+ } else {
+ res = m_apt->installPackages(Cache);
+ }
+
+ delete m_apt;
+ return res;
}
/**
* pk_backend_get_updates:
*/
-void
-pk_backend_get_updates (PkBackend *backend, PkBitfield filters)
+void pk_backend_get_updates(PkBackend *backend, PkBitfield filters)
{
- pk_backend_set_bool (backend, "getUpdates", true);
- pk_backend_thread_create (backend, backend_get_or_update_system_thread);
+ pk_backend_set_bool(backend, "getUpdates", true);
+ pk_backend_thread_create(backend, backend_get_or_update_system_thread);
}
/**
* pk_backend_update_system:
*/
-void
-pk_backend_update_system (PkBackend *backend, gboolean only_trusted)
+void pk_backend_update_system(PkBackend *backend, gboolean only_trusted)
{
- pk_backend_set_bool (backend, "getUpdates", false);
- pk_backend_thread_create (backend, backend_get_or_update_system_thread);
+ pk_backend_set_bool(backend, "getUpdates", false);
+ pk_backend_thread_create(backend, backend_get_or_update_system_thread);
}
-static gboolean
-backend_what_provides_thread (PkBackend *backend)
+static gboolean backend_what_provides_thread(PkBackend *backend)
{
- PkProvidesEnum provides;
- PkBitfield filters;
- const gchar *provides_text;
- gchar **values;
- bool error = false;
-
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
- provides = (PkProvidesEnum) pk_backend_get_uint (backend, "provides");
- values = pk_backend_get_strv (backend, "search");
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
-
- // We can handle libraries, mimetypes and codecs
- if (provides == PK_PROVIDES_ENUM_SHARED_LIB ||
- provides == PK_PROVIDES_ENUM_MIMETYPE ||
- provides == PK_PROVIDES_ENUM_CODEC ||
- provides == PK_PROVIDES_ENUM_ANY) {
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- g_strfreev (values);
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- vector<string> packages;
- PkgList output;
-
- if (provides == PK_PROVIDES_ENUM_SHARED_LIB) {
- m_apt->providesLibrary (output, values);
- } else if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
- packages = searchMimeType (backend, values, error, _cancel);
- } else if (provides == PK_PROVIDES_ENUM_CODEC) {
- m_apt->providesCodec (output, values);
- } else {
- // PK_PROVIDES_ENUM_ANY, just search for everything a package can provide
- m_apt->providesLibrary (output, values);
- m_apt->providesCodec (output, values);
- packages = searchMimeType (backend, values, error, _cancel);
- }
-
- for (vector<string>::iterator i = packages.begin();
- i != packages.end(); ++i) {
- if (_cancel) {
- break;
- }
- pkgCache::PkgIterator pkg = m_apt->packageCache->FindPkg(i->c_str());
- if (pkg.end() == true) {
- continue;
- }
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
- if (ver.end() == true) {
- continue;
- }
- output.push_back(PkgPair(pkg, ver));
- }
-
- if (error && provides == PK_PROVIDES_ENUM_MIMETYPE) {
- // check if app-install-data is installed
- pkgCache::PkgIterator pkg;
- pkg = m_apt->packageCache->FindPkg("app-install-data");
- if (pkg->CurrentState != pkgCache::State::Installed) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_INTERNAL_ERROR,
- "You need the app-install-data "
- "package to be able to look for "
- "applications that can handle "
- "this kind of file");
- }
- } else {
- // It's faster to emmit the packages here rather than in the matching part
- m_apt->emit_packages(output, filters);
- }
-
- delete m_apt;
-
- } else {
- provides_text = pk_provides_enum_to_string (provides);
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_NOT_SUPPORTED,
- "Provides %s not supported",
- provides_text);
+ PkProvidesEnum provides;
+ PkBitfield filters;
+ const gchar *provides_text;
+ gchar **values;
+ bool error = false;
+
+ filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
+ provides = (PkProvidesEnum) pk_backend_get_uint(backend, "provides");
+ values = pk_backend_get_strv(backend, "search");
+
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
+
+ // We can handle libraries, mimetypes and codecs
+ if (provides == PK_PROVIDES_ENUM_SHARED_LIB ||
+ provides == PK_PROVIDES_ENUM_MIMETYPE ||
+ provides == PK_PROVIDES_ENUM_CODEC ||
+ provides == PK_PROVIDES_ENUM_ANY) {
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ g_strfreev (values);
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ vector<string> packages;
+ PkgList output;
+
+ if (provides == PK_PROVIDES_ENUM_SHARED_LIB) {
+ m_apt->providesLibrary (output, values);
+ } else if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
+ packages = searchMimeType (backend, values, error, _cancel);
+ } else if (provides == PK_PROVIDES_ENUM_CODEC) {
+ m_apt->providesCodec (output, values);
+ } else {
+ // PK_PROVIDES_ENUM_ANY, just search for everything a package can provide
+ m_apt->providesLibrary (output, values);
+ m_apt->providesCodec (output, values);
+ packages = searchMimeType (backend, values, error, _cancel);
+ }
+
+ for (vector<string>::iterator i = packages.begin();
+ i != packages.end(); ++i) {
+ if (_cancel) {
+ break;
+ }
+ pkgCache::PkgIterator pkg = m_apt->packageCache->FindPkg(i->c_str());
+ if (pkg.end() == true) {
+ continue;
+ }
+ pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ output.push_back(PkgPair(pkg, ver));
+ }
+
+ if (error && provides == PK_PROVIDES_ENUM_MIMETYPE) {
+ // check if app-install-data is installed
+ pkgCache::PkgIterator pkg;
+ pkg = m_apt->packageCache->FindPkg("app-install-data");
+ if (pkg->CurrentState != pkgCache::State::Installed) {
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_INTERNAL_ERROR,
+ "You need the app-install-data "
+ "package to be able to look for "
+ "applications that can handle "
+ "this kind of file");
+ }
+ } else {
+ // It's faster to emmit the packages here rather than in the matching part
+ m_apt->emit_packages(output, filters);
+ }
+
+ delete m_apt;
+
+ } else {
+ provides_text = pk_provides_enum_to_string (provides);
+ pk_backend_error_code (backend,
+ PK_ERROR_ENUM_NOT_SUPPORTED,
+ "Provides %s not supported",
+ provides_text);
pk_backend_finished (backend);
- }
+ }
- return true;
+ return true;
}
/**
* pk_backend_what_provides
*/
-void
-pk_backend_what_provides (PkBackend *backend,
- PkBitfield filters,
- PkProvidesEnum provide,
- gchar **values)
+void pk_backend_what_provides(PkBackend *backend,
+ PkBitfield filters,
+ PkProvidesEnum provide,
+ gchar **values)
{
- pk_backend_thread_create (backend, backend_what_provides_thread);
+ pk_backend_thread_create(backend, backend_what_provides_thread);
}
/**
* pk_backend_download_packages_thread:
*/
-static gboolean
-pk_backend_download_packages_thread (PkBackend *backend)
+static gboolean pk_backend_download_packages_thread(PkBackend *backend)
{
- gchar **package_ids;
- string directory;
-
- package_ids = pk_backend_get_strv(backend, "package_ids");
- directory = _config->FindDir("Dir::Cache::archives") + "partial/";
- pk_backend_set_allow_cancel (backend, true);
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- // Create the progress
- AcqPackageKitStatus Stat(m_apt, backend, _cancel);
-
- // get a fetcher
- pkgAcquire fetcher;
- fetcher.Setup(&Stat);
- string filelist;
- gchar *pi;
-
- // TODO this might be useful when the item is in the cache
-// for (pkgAcquire::ItemIterator I = fetcher.ItemsBegin(); I < fetcher.ItemsEnd();)
-// {
-// if ((*I)->Local == true)
-// {
-// I++;
-// continue;
-// }
-//
-// // Close the item and check if it was found in cache
-// (*I)->Finished();
-// if ((*I)->Complete == false) {
-// Transient = true;
-// }
-//
-// // Clear it out of the fetch list
-// delete *I;
-// I = fetcher.ItemsBegin();
-// }
-
- for (uint i = 0; i < g_strv_length(package_ids); i++) {
- pi = package_ids[i];
- if (pk_package_id_check(pi) == false) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_PACKAGE_ID_INVALID,
- pi);
- delete m_apt;
- return false;
- }
-
- if (_cancel) {
- break;
- }
-
- PkgPair pkg_ver;
+ gchar **package_ids;
+ string directory;
+
+ package_ids = pk_backend_get_strv(backend, "package_ids");
+ directory = _config->FindDir("Dir::Cache::archives") + "partial/";
+ pk_backend_set_allow_cancel(backend, true);
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ // Create the progress
+ AcqPackageKitStatus Stat(m_apt, backend, _cancel);
+
+ // get a fetcher
+ pkgAcquire fetcher;
+ fetcher.Setup(&Stat);
+ string filelist;
+ gchar *pi;
+
+ // TODO this might be useful when the item is in the cache
+ // for (pkgAcquire::ItemIterator I = fetcher.ItemsBegin(); I < fetcher.ItemsEnd();)
+ // {
+ // if ((*I)->Local == true)
+ // {
+ // I++;
+ // continue;
+ // }
+ //
+ // // Close the item and check if it was found in cache
+ // (*I)->Finished();
+ // if ((*I)->Complete == false) {
+ // Transient = true;
+ // }
+ //
+ // // Clear it out of the fetch list
+ // delete *I;
+ // I = fetcher.ItemsBegin();
+ // }
+
+ for (uint i = 0; i < g_strv_length(package_ids); ++i) {
+ pi = package_ids[i];
+ if (pk_package_id_check(pi) == false) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_PACKAGE_ID_INVALID,
+ pi);
+ delete m_apt;
+ return false;
+ }
+
+ if (_cancel) {
+ break;
+ }
+
+ PkgPair pkg_ver;
bool found;
- pkg_ver = m_apt->find_package_id(pi, found);
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (!found)
- {
- _error->Error("Can't find this package id \"%s\".", pi);
- continue;
- } else {
- if(!pkg_ver.second.Downloadable()) {
- _error->Error("No downloadable files for %s,"
- "perhaps it is a local or obsolete" "package?",
- pi);
- continue;
- }
-
- string storeFileName;
- if (get_archive(&fetcher,
- m_apt->packageSourceList,
- m_apt->packageRecords,
- pkg_ver.second,
- directory,
- storeFileName))
- {
- Stat.addPackagePair(pkg_ver);
- }
- string destFile = directory + "/" + flNotDir(storeFileName);
- if (filelist.empty()) {
- filelist = destFile;
- } else {
- filelist.append(";" + destFile);
- }
- }
- }
-
- if (fetcher.Run() != pkgAcquire::Continue
- && _cancel == false)
- // We failed and we did not cancel
- {
- show_errors(backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
- delete m_apt;
- return _cancel;
- }
-
- // send the filelist
- pk_backend_files(backend, NULL, filelist.c_str());
-
- delete m_apt;
- return true;
+ pkg_ver = m_apt->find_package_id(pi, found);
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (!found) {
+ _error->Error("Can't find this package id \"%s\".", pi);
+ continue;
+ } else {
+ if(!pkg_ver.second.Downloadable()) {
+ _error->Error("No downloadable files for %s,"
+ "perhaps it is a local or obsolete" "package?",
+ pi);
+ continue;
+ }
+
+ string storeFileName;
+ if (get_archive(&fetcher,
+ m_apt->packageSourceList,
+ m_apt->packageRecords,
+ pkg_ver.second,
+ directory,
+ storeFileName)) {
+ Stat.addPackagePair(pkg_ver);
+ }
+ string destFile = directory + "/" + flNotDir(storeFileName);
+ if (filelist.empty()) {
+ filelist = destFile;
+ } else {
+ filelist.append(";" + destFile);
+ }
+ }
+ }
+
+ if (fetcher.Run() != pkgAcquire::Continue
+ && _cancel == false) {
+ // We failed and we did not cancel
+ show_errors(backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
+ delete m_apt;
+ return _cancel;
+ }
+
+ // send the filelist
+ pk_backend_files(backend, NULL, filelist.c_str());
+
+ delete m_apt;
+ return true;
}
/**
* pk_backend_download_packages:
*/
-void
-pk_backend_download_packages (PkBackend *backend, gchar **package_ids, const gchar *directory)
+void pk_backend_download_packages(PkBackend *backend, gchar **package_ids, const gchar *directory)
{
- pk_backend_thread_create (backend, pk_backend_download_packages_thread);
+ pk_backend_thread_create(backend, pk_backend_download_packages_thread);
}
/**
* pk_backend_refresh_cache_thread:
*/
-static gboolean
-pk_backend_refresh_cache_thread (PkBackend *backend)
+static gboolean pk_backend_refresh_cache_thread(PkBackend *backend)
{
- pk_backend_set_allow_cancel (backend, true);
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
- // Lock the list directory
- FileFd Lock;
- if (_config->FindB("Debug::NoLocking", false) == false)
- {
- Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock"));
- if (_error->PendingError() == true) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_CANNOT_GET_LOCK, "Unable to lock the list directory");
- delete m_apt;
- return false;
- // return _error->Error(_("Unable to lock the list directory"));
- }
- }
- // Create the progress
- AcqPackageKitStatus Stat(m_apt, backend, _cancel);
-
- // do the work
- ListUpdate(Stat, *m_apt->packageSourceList);
-
- // Rebuild the cache.
- pkgCacheFile Cache;
- OpTextProgress Prog(*_config);
- if (Cache.BuildCaches(&Prog, true) == false) {
- if (_error->PendingError() == true) {
- show_errors(backend, PK_ERROR_ENUM_CANNOT_FETCH_SOURCES);
- }
- delete m_apt;
- return false;
- }
-
- // missing gpg signature would appear here
- // TODO we need a better enum
- if (_error->PendingError() == false && _error->empty() == false) {
- //show_warnings(backend, PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE);
- //TODO: emit a package with PK_INFO_ENUM_UNTRUSTED
- }
-
- delete m_apt;
- return true;
+ pk_backend_set_allow_cancel(backend, true);
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
+ // Lock the list directory
+ FileFd Lock;
+ if (_config->FindB("Debug::NoLocking", false) == false) {
+ Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock"));
+ if (_error->PendingError() == true) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_CANNOT_GET_LOCK, "Unable to lock the list directory");
+ delete m_apt;
+ return false;
+ // return _error->Error(_("Unable to lock the list directory"));
+ }
+ }
+ // Create the progress
+ AcqPackageKitStatus Stat(m_apt, backend, _cancel);
+
+ // do the work
+ ListUpdate(Stat, *m_apt->packageSourceList);
+
+ // Rebuild the cache.
+ pkgCacheFile Cache;
+ OpTextProgress Prog(*_config);
+ if (Cache.BuildCaches(&Prog, true) == false) {
+ if (_error->PendingError() == true) {
+ show_errors(backend, PK_ERROR_ENUM_CANNOT_FETCH_SOURCES);
+ }
+ delete m_apt;
+ return false;
+ }
+
+ // missing gpg signature would appear here
+ // TODO we need a better enum
+ if (_error->PendingError() == false && _error->empty() == false) {
+ //show_warnings(backend, PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE);
+ //TODO: emit a package with PK_INFO_ENUM_UNTRUSTED
+ }
+
+ delete m_apt;
+ return true;
}
/**
* pk_backend_refresh_cache:
*/
-void
-pk_backend_refresh_cache (PkBackend *backend, gboolean force)
+void pk_backend_refresh_cache(PkBackend *backend, gboolean force)
{
- pk_backend_thread_create (backend, pk_backend_refresh_cache_thread);
+ pk_backend_thread_create(backend, pk_backend_refresh_cache_thread);
}
-static gboolean
-pk_backend_resolve_thread (PkBackend *backend)
+static gboolean pk_backend_resolve_thread(PkBackend *backend)
{
- gchar **package_ids;
- PkBitfield filters;
+ gchar **package_ids;
+ PkBitfield filters;
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
- package_ids = pk_backend_get_strv (backend, "package_ids");
- pk_backend_set_allow_cancel (backend, true);
+ filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
+ package_ids = pk_backend_get_strv (backend, "package_ids");
+ pk_backend_set_allow_cancel (backend, true);
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
PkgList pkgs = m_apt->resolvePI(package_ids);
// It's faster to emmit the packages here rather than in the matching part
m_apt->emit_packages(pkgs, filters);
- delete m_apt;
- return true;
+ delete m_apt;
+ return true;
}
/**
* pk_backend_resolve:
*/
-void
-pk_backend_resolve (PkBackend *backend, PkBitfield filters, gchar **packages)
+void pk_backend_resolve(PkBackend *backend, PkBitfield filters, gchar **packages)
{
- pk_backend_thread_create (backend, pk_backend_resolve_thread);
+ pk_backend_thread_create(backend, pk_backend_resolve_thread);
}
-static gboolean
-pk_backend_search_files_thread (PkBackend *backend)
+static gboolean pk_backend_search_files_thread(PkBackend *backend)
{
- gchar **values;
- PkBitfield filters;
-
- values = pk_backend_get_strv (backend, "search");
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
-
- pk_backend_set_allow_cancel (backend, true);
-
- // as we can only search for installed files lets avoid the opposite
- if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- vector<string> packages = search_files (backend, values, _cancel);
- PkgList output;
- for(vector<string>::iterator i = packages.begin();
- i != packages.end(); ++i)
- {
- if (_cancel) {
- break;
- }
- pkgCache::PkgIterator pkg = m_apt->packageCache->FindPkg(i->c_str());
+ gchar **values;
+ PkBitfield filters;
+
+ values = pk_backend_get_strv(backend, "search");
+ filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
+
+ pk_backend_set_allow_cancel(backend, true);
+
+ // as we can only search for installed files lets avoid the opposite
+ if (!pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
+ vector<string> packages = search_files(backend, values, _cancel);
+ PkgList output;
+ for(vector<string>::iterator i = packages.begin();
+ i != packages.end(); ++i) {
+ if (_cancel) {
+ break;
+ }
+ pkgCache::PkgIterator pkg = m_apt->packageCache->FindPkg(i->c_str());
if (pkg.end() == true) {
continue;
}
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
- if (ver.end() == true)
- {
- continue;
- }
- output.push_back(PkgPair(pkg, ver));
- }
- // It's faster to emmit the packages here rather than in the matching part
- m_apt->emit_packages(output, filters);
-
- delete m_apt;
+ pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ output.push_back(PkgPair(pkg, ver));
+ }
+ // It's faster to emmit the packages here rather than in the matching part
+ m_apt->emit_packages(output, filters);
+
+ delete m_apt;
} else {
pk_backend_finished (backend);
}
- return true;
+ return true;
}
/**
* pk_backend_search_files:
*/
-void
-pk_backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
+void pk_backend_search_files(PkBackend *backend, PkBitfield filters, gchar **values)
{
- pk_backend_thread_create (backend, pk_backend_search_files_thread);
+ pk_backend_thread_create(backend, pk_backend_search_files_thread);
}
-static gboolean
-backend_search_groups_thread (PkBackend *backend)
+static gboolean backend_search_groups_thread (PkBackend *backend)
{
- gchar **values;
- PkBitfield filters;
- vector<PkGroupEnum> groups;
-
- values = pk_backend_get_strv (backend, "search");
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
- pk_backend_set_allow_cancel (backend, true);
-
- int len = g_strv_length(values);
- for (uint i = 0; i < len; i++) {
- if (values[i] == NULL) {
- pk_backend_error_code (backend,
- PK_ERROR_ENUM_GROUP_NOT_FOUND,
- values[i]);
- pk_backend_finished (backend);
- return false;
- } else {
- groups.push_back(pk_group_enum_from_string(values[i]));
- }
- }
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- PkgList output;
- for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- // Ignore virtual packages
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
- if (ver.end() == false) {
- string section = pkg.VersionList().Section() == NULL ? "" : pkg.VersionList().Section();
-
- size_t found;
- found = section.find_last_of("/");
- section = section.substr(found + 1);
-
- // Don't insert virtual packages instead add what it provides
- for (vector<PkGroupEnum>::iterator i = groups.begin();
- i != groups.end();
- ++i) {
- if (*i == get_enum_group(section)) {
- output.push_back(PkgPair(pkg, ver));
- break;
- }
- }
- }
- }
-
- // It's faster to emmit the packages here rather than in the matching part
- m_apt->emit_packages(output, filters);
+ gchar **values;
+ PkBitfield filters;
+ vector<PkGroupEnum> groups;
+
+ values = pk_backend_get_strv(backend, "search");
+ filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
+ pk_backend_set_allow_cancel(backend, true);
+
+ int len = g_strv_length(values);
+ for (uint i = 0; i < len; i++) {
+ if (values[i] == NULL) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_GROUP_NOT_FOUND,
+ values[i]);
+ pk_backend_finished(backend);
+ return false;
+ } else {
+ groups.push_back(pk_group_enum_from_string(values[i]));
+ }
+ }
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ PkgList output;
+ for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
+ if (_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // Ignore virtual packages
+ pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ if (ver.end() == false) {
+ string section = pkg.VersionList().Section() == NULL ? "" : pkg.VersionList().Section();
+
+ size_t found;
+ found = section.find_last_of("/");
+ section = section.substr(found + 1);
+
+ // Don't insert virtual packages instead add what it provides
+ for (vector<PkGroupEnum>::iterator i = groups.begin();
+ i != groups.end();
+ ++i) {
+ if (*i == get_enum_group(section)) {
+ output.push_back(PkgPair(pkg, ver));
+ break;
+ }
+ }
+ }
+ }
+
+ // It's faster to emmit the packages here rather than in the matching part
+ m_apt->emit_packages(output, filters);
pk_backend_set_percentage (backend, 100);
- delete m_apt;
- return true;
+ delete m_apt;
+ return true;
}
/**
* pk_backend_search_groups:
*/
-void
-pk_backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
+void pk_backend_search_groups(PkBackend *backend, PkBitfield filters, gchar **values)
{
- pk_backend_thread_create (backend, backend_search_groups_thread);
+ pk_backend_thread_create(backend, backend_search_groups_thread);
}
-static gboolean
-backend_search_package_thread (PkBackend *backend)
+static gboolean backend_search_package_thread(PkBackend *backend)
{
- gchar **values;
- gchar *search;
- PkBitfield filters;
-
- values = pk_backend_get_strv (backend, "search");
- search = g_strjoinv("|", values);
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
-
- pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_allow_cancel (backend, true);
-
- Matcher *m_matcher = new Matcher(search);
- g_free(search);
- if (m_matcher->hasError()) {
- g_debug("Regex compilation error");
- delete m_matcher;
- pk_backend_finished (backend);
- return false;
- }
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_matcher;
- delete m_apt;
- return false;
- }
-
- if (_error->PendingError() == true)
- {
- delete m_matcher;
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pkgDepCache::Policy Plcy;
- PkgList output;
- if (pk_backend_get_bool (backend, "search_details")) {
- for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
+ gchar **values;
+ gchar *search;
+ PkBitfield filters;
+
+ values = pk_backend_get_strv(backend, "search");
+ search = g_strjoinv("|", values);
+ filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
+
+ pk_backend_set_percentage(backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_allow_cancel(backend, true);
+
+ Matcher *m_matcher = new Matcher(search);
+ g_free(search);
+ if (m_matcher->hasError()) {
+ g_debug("Regex compilation error");
+ delete m_matcher;
+ pk_backend_finished (backend);
+ return false;
+ }
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_matcher;
+ delete m_apt;
+ return false;
+ }
+
+ if (_error->PendingError() == true) {
+ delete m_matcher;
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status(backend, PK_STATUS_ENUM_QUERY);
+ pkgDepCache::Policy Plcy;
+ PkgList output;
+ if (pk_backend_get_bool(backend, "search_details")) {
+ for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
+ if (_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
pkgCache::VerIterator ver = m_apt->find_ver(pkg);
if (ver.end() == false) {
if (m_matcher->matches(pkg.Name()) ||
- m_matcher->matches(get_long_description(ver, m_apt->packageRecords))) {
+ m_matcher->matches(get_long_description(ver, m_apt->packageRecords))) {
// The package matched
output.push_back(PkgPair(pkg, ver));
}
@@ -1017,83 +969,79 @@ backend_search_package_thread (PkBackend *backend)
// Don't insert virtual packages instead add what it provides
// iterate over the provides list
- for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; Prv++) {
- ver = m_apt->find_ver(Prv.OwnerPkg());
+ for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
+ ver = m_apt->find_ver(Prv.OwnerPkg());
// check to see if the provided package isn't virtual too
- if (ver.end() == false)
- {
+ if (ver.end() == false) {
// we add the package now because we will need to
// remove duplicates later anyway
output.push_back(PkgPair(Prv.OwnerPkg(), ver));
}
}
}
- }
- } else {
- for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- if (m_matcher->matches(pkg.Name())) {
- // Don't insert virtual packages instead add what it provides
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
- if (ver.end() == false) {
- output.push_back(PkgPair(pkg, ver));
- } else {
- // iterate over the provides list
- for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; Prv++) {
- ver = m_apt->find_ver(Prv.OwnerPkg());
-
- // check to see if the provided package isn't virtual too
- if (ver.end() == false)
- {
- // we add the package now because we will need to
- // remove duplicates later anyway
- output.push_back(PkgPair(Prv.OwnerPkg(), ver));
- }
- }
- }
- }
- }
- }
-
- // It's faster to emmit the packages here than in the matching part
- m_apt->emit_packages(output, filters);
-
- delete m_matcher;
+ }
+ } else {
+ for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
+ if (_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ if (m_matcher->matches(pkg.Name())) {
+ // Don't insert virtual packages instead add what it provides
+ pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ if (ver.end() == false) {
+ output.push_back(PkgPair(pkg, ver));
+ } else {
+ // iterate over the provides list
+ for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; ++Prv) {
+ ver = m_apt->find_ver(Prv.OwnerPkg());
+
+ // check to see if the provided package isn't virtual too
+ if (ver.end() == false)
+ {
+ // we add the package now because we will need to
+ // remove duplicates later anyway
+ output.push_back(PkgPair(Prv.OwnerPkg(), ver));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // It's faster to emmit the packages here than in the matching part
+ m_apt->emit_packages(output, filters);
+
+ delete m_matcher;
pk_backend_set_percentage (backend, 100);
- delete m_apt;
- return true;
+ delete m_apt;
+ return true;
}
/**
* pk_backend_search_names:
*/
-void
-pk_backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
+void pk_backend_search_names(PkBackend *backend, PkBitfield filters, gchar **values)
{
- pk_backend_set_bool(backend, "search_details", false);
- pk_backend_thread_create(backend, backend_search_package_thread);
+ pk_backend_set_bool(backend, "search_details", false);
+ pk_backend_thread_create(backend, backend_search_package_thread);
}
/**
* pk_backend_search_details:
*/
-void
-pk_backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
+void pk_backend_search_details(PkBackend *backend, PkBitfield filters, gchar **values)
{
- pk_backend_set_bool(backend, "search_details", true);
- pk_backend_thread_create(backend, backend_search_package_thread);
+ pk_backend_set_bool(backend, "search_details", true);
+ pk_backend_thread_create(backend, backend_search_package_thread);
}
-static gboolean
-backend_manage_packages_thread (PkBackend *backend)
+static gboolean backend_manage_packages_thread(PkBackend *backend)
{
bool simulate = false;
bool remove = false;
@@ -1103,351 +1051,336 @@ backend_manage_packages_thread (PkBackend *backend)
PkRoleEnum role = pk_backend_get_role (backend);
if (role == PK_ROLE_ENUM_SIMULATE_INSTALL_FILES ||
- role == PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES ||
- role == PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES ||
- role == PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES) {
+ role == PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES ||
+ role == PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES ||
+ role == PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES) {
simulate = true;
}
if (role == PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES ||
- role == PK_ROLE_ENUM_REMOVE_PACKAGES) {
+ role == PK_ROLE_ENUM_REMOVE_PACKAGES) {
remove = true;
}
if (role == PK_ROLE_ENUM_SIMULATE_INSTALL_FILES ||
- role == PK_ROLE_ENUM_INSTALL_FILES) {
+ role == PK_ROLE_ENUM_INSTALL_FILES) {
full_paths = pk_backend_get_strv (backend, "full_paths");
fileInstall = true;
}
- g_debug ("FILE INSTALL: %i", fileInstall);
- pk_backend_set_allow_cancel (backend, true);
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- PkgList installPkgs, removePkgs;
-
- if (fileInstall) {
- // File installation EXPERIMENTAL
-
- // GDebi can not install more than one package at time
- if (g_strv_length(full_paths) > 1) {
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_NOT_SUPPORTED,
- "The backend can only proccess one file at time.");
- delete m_apt;
- return false;
- }
-
- // get the list of packages to install
- if (!m_apt->markFileForInstall(full_paths[0], installPkgs, removePkgs)) {
- delete m_apt;
- return false;
- }
-
- // Mark newly installed packages as auto-installed
- // (they're dependencies of the new local package)
- markAuto = true;
-
- cout << "installPkgs.size: " << installPkgs.size() << endl;
- cout << "removePkgs.size: " << removePkgs.size() << endl;
-
- } else {
- // Resolve the given packages
- gchar **package_ids = pk_backend_get_strv(backend, "package_ids");
- if (remove) {
- removePkgs = m_apt->resolvePI(package_ids);
- } else {
- installPkgs = m_apt->resolvePI(package_ids);
- }
-
- if (removePkgs.size() == 0 && installPkgs.size() == 0) {
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Could not find package(s)");
- delete m_apt;
- return false;
- }
- }
-
- // Install/Update/Remove packages, or just simulate
- if (!m_apt->runTransaction(installPkgs, removePkgs, simulate, markAuto)) {
- // Print transaction errors
- cout << "runTransaction failed" << endl;
- delete m_apt;
- return false;
- }
-
- if (fileInstall) {
- // Now perform the installation!
- gchar *path;
- for (uint i = 0; i < g_strv_length(full_paths); i++) {
- if (_cancel) {
- break;
- }
-
- path = full_paths[i];
- if (!m_apt->installFile(path, simulate)) {
- cout << "Installation of DEB file " << path << " failed." << endl;
- delete m_apt;
- return false;
- }
- }
- }
-
- delete m_apt;
- return true;
+ g_debug ("FILE INSTALL: %i", fileInstall);
+ pk_backend_set_allow_cancel (backend, true);
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ PkgList installPkgs, removePkgs;
+
+ if (fileInstall) {
+ // File installation EXPERIMENTAL
+
+ // GDebi can not install more than one package at time
+ if (g_strv_length(full_paths) > 1) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_NOT_SUPPORTED,
+ "The backend can only proccess one file at time.");
+ delete m_apt;
+ return false;
+ }
+
+ // get the list of packages to install
+ if (!m_apt->markFileForInstall(full_paths[0], installPkgs, removePkgs)) {
+ delete m_apt;
+ return false;
+ }
+
+ // Mark newly installed packages as auto-installed
+ // (they're dependencies of the new local package)
+ markAuto = true;
+
+ cout << "installPkgs.size: " << installPkgs.size() << endl;
+ cout << "removePkgs.size: " << removePkgs.size() << endl;
+
+ } else {
+ // Resolve the given packages
+ gchar **package_ids = pk_backend_get_strv(backend, "package_ids");
+ if (remove) {
+ removePkgs = m_apt->resolvePI(package_ids);
+ } else {
+ installPkgs = m_apt->resolvePI(package_ids);
+ }
+
+ if (removePkgs.size() == 0 && installPkgs.size() == 0) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
+ "Could not find package(s)");
+ delete m_apt;
+ return false;
+ }
+ }
+
+ // Install/Update/Remove packages, or just simulate
+ if (!m_apt->runTransaction(installPkgs, removePkgs, simulate, markAuto)) {
+ // Print transaction errors
+ cout << "runTransaction failed" << endl;
+ delete m_apt;
+ return false;
+ }
+
+ if (fileInstall) {
+ // Now perform the installation!
+ gchar *path;
+ for (uint i = 0; i < g_strv_length(full_paths); ++i) {
+ if (_cancel) {
+ break;
+ }
+
+ path = full_paths[i];
+ if (!m_apt->installFile(path, simulate)) {
+ cout << "Installation of DEB file " << path << " failed." << endl;
+ delete m_apt;
+ return false;
+ }
+ }
+ }
+
+ delete m_apt;
+ return true;
}
/**
* pk_backend_simulate_install_packages:
*/
-void
-pk_backend_simulate_install_packages (PkBackend *backend, gchar **packages)
+void pk_backend_simulate_install_packages(PkBackend *backend, gchar **packages)
{
- pk_backend_thread_create (backend, backend_manage_packages_thread);
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
}
/**
* pk_backend_install_packages:
*/
-void
-pk_backend_install_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void pk_backend_install_packages(PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
- pk_backend_thread_create (backend, backend_manage_packages_thread);
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
}
/**
* pk_backend_simulate_update_packages:
*/
-void
-pk_backend_simulate_update_packages (PkBackend *backend, gchar **packages)
+void pk_backend_simulate_update_packages(PkBackend *backend, gchar **packages)
{
- pk_backend_thread_create (backend, backend_manage_packages_thread);
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
}
/**
* pk_backend_update_packages:
*/
-void
-pk_backend_update_packages (PkBackend *backend, gboolean only_trusted, gchar **package_ids)
+void pk_backend_update_packages(PkBackend *backend, gboolean only_trusted, gchar **package_ids)
{
- pk_backend_thread_create (backend, backend_manage_packages_thread);
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
}
/**
* pk_backend_simulate_install_files:
*/
-void
-pk_backend_simulate_install_files (PkBackend *backend, gchar **full_paths)
+void pk_backend_simulate_install_files(PkBackend *backend, gchar **full_paths)
{
- pk_backend_thread_create (backend, backend_manage_packages_thread);
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
}
/**
* pk_backend_install_files:
*/
-void
-pk_backend_install_files (PkBackend *backend, gboolean only_trusted, gchar **full_paths)
+void pk_backend_install_files(PkBackend *backend, gboolean only_trusted, gchar **full_paths)
{
- pk_backend_thread_create (backend, backend_manage_packages_thread);
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
}
/**
* pk_backend_simulate_remove_packages:
*/
-void
-pk_backend_simulate_remove_packages (PkBackend *backend, gchar **packages, gboolean autoremove)
+void pk_backend_simulate_remove_packages(PkBackend *backend, gchar **packages, gboolean autoremove)
{
- pk_backend_thread_create (backend, backend_manage_packages_thread);
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
}
/**
* pk_backend_remove_packages:
*/
-void
-pk_backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
+void pk_backend_remove_packages(PkBackend *backend, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
{
- pk_backend_thread_create (backend, backend_manage_packages_thread);
+ pk_backend_thread_create(backend, backend_manage_packages_thread);
}
-static gboolean
-backend_repo_manager_thread (PkBackend *backend)
+static gboolean backend_repo_manager_thread(PkBackend *backend)
{
- // list
- PkBitfield filters;
- bool notDevelopment;
- // enable
- const gchar *repo_id;
- bool enabled;
- bool found = false;
- // generic
- const char *const salt = "$1$/iSaq7rB$EoUw5jJPPvAPECNaaWzMK/";
- bool list = pk_backend_get_bool(backend, "list");
-
- if (list) {
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
- notDevelopment = pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_DEVELOPMENT);
- } else {
- pk_backend_set_status (backend, PK_STATUS_ENUM_REQUEST);
- repo_id = pk_backend_get_string(backend, "repo_id");
- enabled = pk_backend_get_bool(backend, "enabled");
- }
-
- SourcesList _lst;
- if (_lst.ReadSources() == false) {
- _error->
- Warning("Ignoring invalid record(s) in sources.list file!");
- //return false;
- }
-
- if (_lst.ReadVendors() == false) {
- _error->Error("Cannot read vendors.list file");
- show_errors(backend, PK_ERROR_ENUM_FAILED_CONFIG_PARSING);
- pk_backend_finished (backend);
- return false;
- }
-
- for (SourcesListIter it = _lst.SourceRecords.begin();
- it != _lst.SourceRecords.end(); it++)
- {
- if ((*it)->Type & SourcesList::Comment) {
- continue;
- }
-
- string Sections;
- for (unsigned int J = 0; J < (*it)->NumSections; J++) {
- Sections += (*it)->Sections[J];
- Sections += " ";
- }
-
- if (notDevelopment &&
- ((*it)->Type & SourcesList::DebSrc ||
- (*it)->Type & SourcesList::RpmSrc ||
- (*it)->Type & SourcesList::RpmSrcDir ||
- (*it)->Type & SourcesList::RepomdSrc))
- {
- continue;
- }
-
- string repo;
- repo = (*it)->GetType();
- repo += " " + (*it)->VendorID;
- repo += " " + (*it)->URI;
- repo += " " + (*it)->Dist;
- repo += " " + Sections;
- gchar *hash;
- const gchar allowedChars[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- hash = crypt(repo.c_str(), salt);
- g_strcanon(hash, allowedChars, 'D');
- string repoId(hash);
-
- if (list) {
- pk_backend_repo_detail(backend,
- repoId.c_str(),
- repo.c_str(),
- !((*it)->Type & SourcesList::Disabled));
- } else {
- if (repoId.compare(repo_id) == 0) {
- if (enabled) {
- (*it)->Type = (*it)->Type & ~SourcesList::Disabled;
- } else {
- (*it)->Type |= SourcesList::Disabled;
- }
- found = true;
- break;
- }
- }
- }
-
- if (!list) {
- if (!found) {
- _error->Error("Could not found the repositorie");
- show_errors(backend, PK_ERROR_ENUM_REPO_NOT_AVAILABLE);
- } else if (!_lst.UpdateSources()) {
- _error->Error("Could not update sources file");
- show_errors(backend, PK_ERROR_ENUM_CANNOT_WRITE_REPO_CONFIG);
- }
- }
- pk_backend_finished (backend);
- return true;
+ // list
+ PkBitfield filters;
+ bool notDevelopment;
+ // enable
+ const gchar *repo_id;
+ bool enabled;
+ bool found = false;
+ // generic
+ const char *const salt = "$1$/iSaq7rB$EoUw5jJPPvAPECNaaWzMK/";
+ bool list = pk_backend_get_bool(backend, "list");
+
+ if (list) {
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
+ notDevelopment = pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_DEVELOPMENT);
+ } else {
+ pk_backend_set_status (backend, PK_STATUS_ENUM_REQUEST);
+ repo_id = pk_backend_get_string(backend, "repo_id");
+ enabled = pk_backend_get_bool(backend, "enabled");
+ }
+
+ SourcesList _lst;
+ if (_lst.ReadSources() == false) {
+ _error->
+ Warning("Ignoring invalid record(s) in sources.list file!");
+ //return false;
+ }
+
+ if (_lst.ReadVendors() == false) {
+ _error->Error("Cannot read vendors.list file");
+ show_errors(backend, PK_ERROR_ENUM_FAILED_CONFIG_PARSING);
+ pk_backend_finished (backend);
+ return false;
+ }
+
+ for (SourcesListIter it = _lst.SourceRecords.begin();
+ it != _lst.SourceRecords.end(); ++it) {
+ if ((*it)->Type & SourcesList::Comment) {
+ continue;
+ }
+
+ string Sections;
+ for (unsigned int j = 0; j < (*it)->NumSections; ++j) {
+ Sections += (*it)->Sections[j];
+ Sections += " ";
+ }
+
+ if (notDevelopment &&
+ ((*it)->Type & SourcesList::DebSrc ||
+ (*it)->Type & SourcesList::RpmSrc ||
+ (*it)->Type & SourcesList::RpmSrcDir ||
+ (*it)->Type & SourcesList::RepomdSrc)) {
+ continue;
+ }
+
+ string repo;
+ repo = (*it)->GetType();
+ repo += " " + (*it)->VendorID;
+ repo += " " + (*it)->URI;
+ repo += " " + (*it)->Dist;
+ repo += " " + Sections;
+ gchar *hash;
+ const gchar allowedChars[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+ hash = crypt(repo.c_str(), salt);
+ g_strcanon(hash, allowedChars, 'D');
+ string repoId(hash);
+
+ if (list) {
+ pk_backend_repo_detail(backend,
+ repoId.c_str(),
+ repo.c_str(),
+ !((*it)->Type & SourcesList::Disabled));
+ } else {
+ if (repoId.compare(repo_id) == 0) {
+ if (enabled) {
+ (*it)->Type = (*it)->Type & ~SourcesList::Disabled;
+ } else {
+ (*it)->Type |= SourcesList::Disabled;
+ }
+ found = true;
+ break;
+ }
+ }
+ }
+
+ if (!list) {
+ if (!found) {
+ _error->Error("Could not found the repositorie");
+ show_errors(backend, PK_ERROR_ENUM_REPO_NOT_AVAILABLE);
+ } else if (!_lst.UpdateSources()) {
+ _error->Error("Could not update sources file");
+ show_errors(backend, PK_ERROR_ENUM_CANNOT_WRITE_REPO_CONFIG);
+ }
+ }
+ pk_backend_finished(backend);
+ return true;
}
/**
* pk_backend_get_repo_list:
*/
-void
-pk_backend_get_repo_list (PkBackend *backend, PkBitfield filters)
+void pk_backend_get_repo_list(PkBackend *backend, PkBitfield filters)
{
- pk_backend_set_bool(backend, "list", true);
- pk_backend_thread_create(backend, backend_repo_manager_thread);
+ pk_backend_set_bool(backend, "list", true);
+ pk_backend_thread_create(backend, backend_repo_manager_thread);
}
/**
* pk_backend_repo_enable:
*/
-void
-pk_backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
+void pk_backend_repo_enable(PkBackend *backend, const gchar *rid, gboolean enabled)
{
- pk_backend_set_bool(backend, "list", false);
- pk_backend_thread_create(backend, backend_repo_manager_thread);
+ pk_backend_set_bool(backend, "list", false);
+ pk_backend_thread_create(backend, backend_repo_manager_thread);
}
-static gboolean
-backend_get_packages_thread (PkBackend *backend)
+static gboolean backend_get_packages_thread(PkBackend *backend)
{
- PkBitfield filters;
- filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
- pk_backend_set_allow_cancel (backend, true);
-
- AptIntf *m_apt = new AptIntf(backend, _cancel);
- pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
- if (m_apt->init()) {
- g_debug ("Failed to create apt cache");
- delete m_apt;
- return false;
- }
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- PkgList output;
- output.reserve(m_apt->packageCache->HeaderP->PackageCount);
- for(pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin();
- !pkg.end(); ++pkg)
- {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if(pkg.VersionList().end() && pkg.ProvidesList().end())
- continue;
-
- // Don't insert virtual packages as they don't have all kinds of info
- pkgCache::VerIterator ver = m_apt->find_ver(pkg);
- if (ver.end() == false) {
- output.push_back(PkgPair(pkg, ver));
- }
- }
-
- // It's faster to emmit the packages rather here than in the matching part
- m_apt->emit_packages(output, filters);
-
- delete m_apt;
- return true;
+ PkBitfield filters;
+ filters = (PkBitfield) pk_backend_get_uint(backend, "filters");
+ pk_backend_set_allow_cancel (backend, true);
+
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
+ pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
+ if (m_apt->init()) {
+ g_debug ("Failed to create apt cache");
+ delete m_apt;
+ return false;
+ }
+
+ pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ PkgList output;
+ output.reserve(m_apt->packageCache->HeaderP->PackageCount);
+ for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin();
+ !pkg.end(); ++pkg) {
+ if (_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if(pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // Don't insert virtual packages as they don't have all kinds of info
+ pkgCache::VerIterator ver = m_apt->find_ver(pkg);
+ if (ver.end() == false) {
+ output.push_back(PkgPair(pkg, ver));
+ }
+ }
+
+ // It's faster to emmit the packages rather here than in the matching part
+ m_apt->emit_packages(output, filters);
+
+ delete m_apt;
+ return true;
}
/**
* pk_backend_get_packages:
*/
-void
-pk_backend_get_packages (PkBackend *backend, PkBitfield filter)
+void pk_backend_get_packages(PkBackend *backend, PkBitfield filter)
{
- pk_backend_thread_create (backend, backend_get_packages_thread);
+ pk_backend_thread_create(backend, backend_get_packages_thread);
}
@@ -1458,45 +1391,44 @@ pk_backend_get_packages (PkBackend *backend, PkBitfield filter)
void
pk_backend_get_categories (PkBackend *backend)
{
- pk_backend_thread_create (backend, pk_backend_get_categories_thread);
+ pk_backend_thread_create (backend, pk_backend_get_categories_thread);
}
*/
/**
* pk_backend_get_roles:
*/
-PkBitfield
-pk_backend_get_roles (PkBackend *backend)
+PkBitfield pk_backend_get_roles(PkBackend *backend)
{
PkBitfield roles;
- roles = pk_bitfield_from_enums (
- PK_ROLE_ENUM_CANCEL,
- PK_ROLE_ENUM_GET_DEPENDS,
- PK_ROLE_ENUM_GET_DETAILS,
- PK_ROLE_ENUM_GET_FILES,
- PK_ROLE_ENUM_GET_REQUIRES,
- PK_ROLE_ENUM_GET_PACKAGES,
- PK_ROLE_ENUM_WHAT_PROVIDES,
- PK_ROLE_ENUM_GET_UPDATES,
- PK_ROLE_ENUM_GET_UPDATE_DETAIL,
- PK_ROLE_ENUM_INSTALL_PACKAGES,
- PK_ROLE_ENUM_INSTALL_SIGNATURE,
- PK_ROLE_ENUM_REFRESH_CACHE,
- PK_ROLE_ENUM_REMOVE_PACKAGES,
- PK_ROLE_ENUM_DOWNLOAD_PACKAGES,
- PK_ROLE_ENUM_RESOLVE,
- PK_ROLE_ENUM_SEARCH_DETAILS,
- PK_ROLE_ENUM_SEARCH_FILE,
- PK_ROLE_ENUM_SEARCH_GROUP,
- PK_ROLE_ENUM_SEARCH_NAME,
- PK_ROLE_ENUM_UPDATE_PACKAGES,
- PK_ROLE_ENUM_UPDATE_SYSTEM,
- PK_ROLE_ENUM_GET_REPO_LIST,
- PK_ROLE_ENUM_REPO_ENABLE,
- PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES,
- PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES,
- PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES,
- -1);
+ roles = pk_bitfield_from_enums(
+ PK_ROLE_ENUM_CANCEL,
+ PK_ROLE_ENUM_GET_DEPENDS,
+ PK_ROLE_ENUM_GET_DETAILS,
+ PK_ROLE_ENUM_GET_FILES,
+ PK_ROLE_ENUM_GET_REQUIRES,
+ PK_ROLE_ENUM_GET_PACKAGES,
+ PK_ROLE_ENUM_WHAT_PROVIDES,
+ PK_ROLE_ENUM_GET_UPDATES,
+ PK_ROLE_ENUM_GET_UPDATE_DETAIL,
+ PK_ROLE_ENUM_INSTALL_PACKAGES,
+ PK_ROLE_ENUM_INSTALL_SIGNATURE,
+ PK_ROLE_ENUM_REFRESH_CACHE,
+ PK_ROLE_ENUM_REMOVE_PACKAGES,
+ PK_ROLE_ENUM_DOWNLOAD_PACKAGES,
+ PK_ROLE_ENUM_RESOLVE,
+ PK_ROLE_ENUM_SEARCH_DETAILS,
+ PK_ROLE_ENUM_SEARCH_FILE,
+ PK_ROLE_ENUM_SEARCH_GROUP,
+ PK_ROLE_ENUM_SEARCH_NAME,
+ PK_ROLE_ENUM_UPDATE_PACKAGES,
+ PK_ROLE_ENUM_UPDATE_SYSTEM,
+ PK_ROLE_ENUM_GET_REPO_LIST,
+ PK_ROLE_ENUM_REPO_ENABLE,
+ PK_ROLE_ENUM_SIMULATE_INSTALL_PACKAGES,
+ PK_ROLE_ENUM_SIMULATE_UPDATE_PACKAGES,
+ PK_ROLE_ENUM_SIMULATE_REMOVE_PACKAGES,
+ -1);
// only add GetDistroUpgrades if the binary is present
if (g_file_test (PREUPGRADE_BINARY, G_FILE_TEST_EXISTS)) {
diff --git a/backends/aptcc/pkg_acqfile.cpp b/backends/aptcc/pkg_acqfile.cpp
index d20cff1..94ffe0b 100644
--- a/backends/aptcc/pkg_acqfile.cpp
+++ b/backends/aptcc/pkg_acqfile.cpp
@@ -43,119 +43,118 @@
// Let's all sing a song about apt-pkg's brokenness..
pkgAcqFileSane::pkgAcqFileSane(pkgAcquire *Owner, string URI,
- string Description, string ShortDesc,
- string filename):
- Item(Owner)
+ string Description, string ShortDesc,
+ string filename) :
+ Item(Owner)
{
- Retries=_config->FindI("Acquire::Retries",0);
- DestFile=filename;
+ Retries=_config->FindI("Acquire::Retries",0);
+ DestFile=filename;
- Desc.URI=URI;
- Desc.Description=Description;
- Desc.Owner=this;
- Desc.ShortDesc=ShortDesc;
+ Desc.URI=URI;
+ Desc.Description=Description;
+ Desc.Owner=this;
+ Desc.ShortDesc=ShortDesc;
- QueueURI(Desc);
+ QueueURI(Desc);
}
// Straight from acquire-item.cc
/* Here we try other sources */
void pkgAcqFileSane::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
{
- ErrorText = LookupTag(Message,"Message");
-
- // This is the retry counter
- if (Retries != 0 &&
- Cnf->LocalOnly == false &&
- StringToBool(LookupTag(Message,"Transient-Failure"),false) == true)
- {
- Retries--;
- QueueURI(Desc);
- return;
+ ErrorText = LookupTag(Message,"Message");
+
+ // This is the retry counter
+ if (Retries != 0 &&
+ Cnf->LocalOnly == false &&
+ StringToBool(LookupTag(Message,"Transient-Failure"),false) == true) {
+ Retries--;
+ QueueURI(Desc);
+ return;
}
- Item::Failed(Message,Cnf);
+ Item::Failed(Message,Cnf);
}
// Mostly copied from pkgAcqArchive.
bool get_archive(pkgAcquire *Owner, pkgSourceList *Sources,
- pkgRecords *Recs, pkgCache::VerIterator const &Version,
- string directory, string &StoreFilename)
+ pkgRecords *Recs, pkgCache::VerIterator const &Version,
+ string directory, string &StoreFilename)
{
- pkgCache::VerFileIterator Vf=Version.FileList();
-
- if (Version.Arch() == 0) {
- return _error->Error("I wasn't able to locate a file for the %s package. "
- "This might mean you need to manually fix this package. (due to missing arch)",
- Version.ParentPkg().Name());
- }
-
- /* We need to find a filename to determine the extension. We make the
- assumption here that all the available sources for this version share
- the same extension.. */
- // Skip not source sources, they do not have file fields.
- for (; Vf.end() == false; Vf++) {
- if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0) {
- continue;
- }
- break;
- }
-
- // Does not really matter here.. we are going to fail out below
- if (Vf.end() != true) {
- // If this fails to get a file name we will bomb out below.
- pkgRecords::Parser &Parse = Recs->Lookup(Vf);
- if (_error->PendingError() == true) {
- return false;
- }
-
- // Generate the final file name as: package_version_arch.foo
- StoreFilename = QuoteString(Version.ParentPkg().Name(),"_:") + '_' +
- QuoteString(Version.VerStr(),"_:") + '_' +
- QuoteString(Version.Arch(),"_:.") +
- "." + flExtension(Parse.FileName());
- }
-
- for (; Vf.end() == false; Vf++) {
- // Ignore not source sources
- if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0) {
- continue;
- }
-
- // Try to cross match against the source list
- pkgIndexFile *Index;
- if (Sources->FindIndex(Vf.File(),Index) == false) {
- continue;
- }
-
- // Grab the text package record
- pkgRecords::Parser &Parse = Recs->Lookup(Vf);
- if (_error->PendingError() == true) {
- return false;
- }
-
- const string PkgFile = Parse.FileName();
- const string MD5 = Parse.MD5Hash();
- if (PkgFile.empty() == true) {
- return _error->Error("The package index files are corrupted. No Filename: "
- "field for package %s.",
- Version.ParentPkg().Name());
- }
-
- string DestFile = directory + "/" + flNotDir(StoreFilename);
-
- // Create the item
- new pkgAcqFile(Owner,
- Index->ArchiveURI(PkgFile),
- MD5,
- Version->Size,
- Index->ArchiveInfo(Version),
- Version.ParentPkg().Name(),
- "",
- DestFile);
-
- Vf++;
- return true;
- }
- return false;
+ pkgCache::VerFileIterator Vf=Version.FileList();
+
+ if (Version.Arch() == 0) {
+ return _error->Error("I wasn't able to locate a file for the %s package. "
+ "This might mean you need to manually fix this package. (due to missing arch)",
+ Version.ParentPkg().Name());
+ }
+
+ /* We need to find a filename to determine the extension. We make the
+ assumption here that all the available sources for this version share
+ the same extension.. */
+ // Skip not source sources, they do not have file fields.
+ for (; Vf.end() == false; Vf++) {
+ if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0) {
+ continue;
+ }
+ break;
+ }
+
+ // Does not really matter here.. we are going to fail out below
+ if (Vf.end() != true) {
+ // If this fails to get a file name we will bomb out below.
+ pkgRecords::Parser &Parse = Recs->Lookup(Vf);
+ if (_error->PendingError() == true) {
+ return false;
+ }
+
+ // Generate the final file name as: package_version_arch.foo
+ StoreFilename = QuoteString(Version.ParentPkg().Name(),"_:") + '_' +
+ QuoteString(Version.VerStr(),"_:") + '_' +
+ QuoteString(Version.Arch(),"_:.") +
+ "." + flExtension(Parse.FileName());
+ }
+
+ for (; Vf.end() == false; Vf++) {
+ // Ignore not source sources
+ if ((Vf.File()->Flags & pkgCache::Flag::NotSource) != 0) {
+ continue;
+ }
+
+ // Try to cross match against the source list
+ pkgIndexFile *Index;
+ if (Sources->FindIndex(Vf.File(),Index) == false) {
+ continue;
+ }
+
+ // Grab the text package record
+ pkgRecords::Parser &Parse = Recs->Lookup(Vf);
+ if (_error->PendingError() == true) {
+ return false;
+ }
+
+ const string PkgFile = Parse.FileName();
+ const string MD5 = Parse.MD5Hash();
+ if (PkgFile.empty() == true) {
+ return _error->Error("The package index files are corrupted. No Filename: "
+ "field for package %s.",
+ Version.ParentPkg().Name());
+ }
+
+ string DestFile = directory + "/" + flNotDir(StoreFilename);
+
+ // Create the item
+ new pkgAcqFile(Owner,
+ Index->ArchiveURI(PkgFile),
+ MD5,
+ Version->Size,
+ Index->ArchiveInfo(Version),
+ Version.ParentPkg().Name(),
+ "",
+ DestFile);
+
+ Vf++;
+ return true;
+ }
+ return false;
}
diff --git a/backends/aptcc/pkg_acqfile.h b/backends/aptcc/pkg_acqfile.h
index 337ff76..fb6c72e 100644
--- a/backends/aptcc/pkg_acqfile.h
+++ b/backends/aptcc/pkg_acqfile.h
@@ -29,30 +29,30 @@
*/
class pkgAcqFileSane : public pkgAcquire::Item
-// This is frustrating: pkgAcqFile is **almost** good enough, but has some
-// hardcoded stuff that makes it not quite work.
-//
-// Based heavily on that class, though.
+ // This is frustrating: pkgAcqFile is **almost** good enough, but has some
+ // hardcoded stuff that makes it not quite work.
+ //
+ // Based heavily on that class, though.
{
- pkgAcquire::ItemDesc Desc;
- string Md5Hash;
- unsigned int Retries;
+ pkgAcquire::ItemDesc Desc;
+ string Md5Hash;
+ unsigned int Retries;
public:
- pkgAcqFileSane(pkgAcquire *Owner, string URI,
- string Description, string ShortDesc, string filename);
+ pkgAcqFileSane(pkgAcquire *Owner, string URI,
+ string Description, string ShortDesc, string filename);
- void Failed(string Message, pkgAcquire::MethodConfig *Cnf);
- string MD5Sum() {return Md5Hash;}
- string DescURI() {return Desc.URI;}
- virtual ~pkgAcqFileSane() {}
+ void Failed(string Message, pkgAcquire::MethodConfig *Cnf);
+ string MD5Sum() {return Md5Hash;}
+ string DescURI() {return Desc.URI;}
+ virtual ~pkgAcqFileSane() {}
};
/** Like pkgAcqArchive, but uses generic File objects to download to
* the cwd (and copies from file:/ URLs).
*/
bool get_archive(pkgAcquire *Owner, pkgSourceList *Sources,
- pkgRecords *Recs, pkgCache::VerIterator const &Version,
- std::string directory, std::string &StoreFilename);
+ pkgRecords *Recs, pkgCache::VerIterator const &Version,
+ std::string directory, std::string &StoreFilename);
#endif
commit c19e1a6b5573eda4a953351c6b1261365695a4e7
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Fri Apr 13 09:58:34 2012 -0300
aptcc: make more use of the typedef to improve readablility
diff --git a/backends/aptcc/acqpkitstatus.cpp b/backends/aptcc/acqpkitstatus.cpp
index 4756921..b27b8c5 100644
--- a/backends/aptcc/acqpkitstatus.cpp
+++ b/backends/aptcc/acqpkitstatus.cpp
@@ -232,37 +232,35 @@ bool AcqPackageKitStatus::MediaChange(string Media, string Drive)
}
-void AcqPackageKitStatus::addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair)
+void AcqPackageKitStatus::addPackagePair(PkgPair packagePair)
{
packages.push_back(packagePair);
}
void AcqPackageKitStatus::emit_package(const string &name, bool finished)
{
- if (name.compare(last_package_name) != 0 && packages.size()) {
- // find the package
- for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator it = packages.begin();
- it != packages.end(); ++it)
- {
- if (_cancelled) {
- break;
- }
- // try to see if any package matches
- if (name.compare(it->first.Name()) == 0) {
- m_apt->emit_package(it->first,
- it->second,
- PK_INFO_ENUM_UNKNOWN,
- finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
- last_package_name = name;
-
- // Find the downloading item
- if (finished) {
- currentPackages.erase(name);
- } else {
- currentPackages.insert(name);
- }
- break;
- }
- }
- }
+ if (name.compare(last_package_name) != 0 && packages.size()) {
+ // find the package
+ for (PkgList::iterator it = packages.begin(); it != packages.end(); ++it) {
+ if (_cancelled) {
+ break;
+ }
+
+ // try to see if any package matches
+ if (name.compare(it->first.Name()) == 0) {
+ m_apt->emit_package(*it,
+ PK_INFO_ENUM_UNKNOWN,
+ finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
+ last_package_name = name;
+
+ // Find the downloading item
+ if (finished) {
+ currentPackages.erase(name);
+ } else {
+ currentPackages.insert(name);
+ }
+ break;
+ }
+ }
+ }
}
diff --git a/backends/aptcc/acqpkitstatus.h b/backends/aptcc/acqpkitstatus.h
index d775e74..1ab9760 100644
--- a/backends/aptcc/acqpkitstatus.h
+++ b/backends/aptcc/acqpkitstatus.h
@@ -41,7 +41,7 @@ public:
bool Pulse(pkgAcquire *Owner);
- void addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair);
+ void addPackagePair(PkgPair packagePair);
private:
PkBackend *m_backend;
@@ -54,7 +54,7 @@ private:
string last_package_name;
AptIntf *m_apt;
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > packages;
+ PkgList packages;
set<string> currentPackages;
void emit_package(const string &name, bool finished);
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index aee63d0..4319723 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -180,61 +180,61 @@ AptIntf::~AptIntf()
void AptIntf::cancel()
{
- if (!_cancel) {
- _cancel = true;
- pk_backend_set_status(m_backend, PK_STATUS_ENUM_CANCEL);
- }
- if (m_child_pid > 0) {
- kill(m_child_pid, SIGTERM);
- }
+ if (!_cancel) {
+ _cancel = true;
+ pk_backend_set_status(m_backend, PK_STATUS_ENUM_CANCEL);
+ }
+ if (m_child_pid > 0) {
+ kill(m_child_pid, SIGTERM);
+ }
}
-pair<pkgCache::PkgIterator, pkgCache::VerIterator>
- AptIntf::find_package_id(const gchar *package_id, bool &found)
+PkgPair AptIntf::find_package_id(const gchar *package_id, bool &found)
{
- gchar **parts;
- pkgCache::VerIterator ver;
- pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
+ gchar **parts;
+ pkgCache::VerIterator ver;
+ PkgPair pkg_ver;
- found = true;
+ found = true;
- parts = pk_package_id_split (package_id);
- gchar *pkgNameArch;
- pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
- pkg_ver.first = packageCache->FindPkg(pkgNameArch);
- g_free(pkgNameArch);
+ parts = pk_package_id_split (package_id);
+ gchar *pkgNameArch;
+ pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
+ pkg_ver.first = packageCache->FindPkg(pkgNameArch);
+ g_free(pkgNameArch);
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (pkg_ver.first.end() == true ||
- (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
- {
- g_strfreev (parts);
- return pkg_ver;
- }
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (pkg_ver.first.end() == true ||
+ (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
+ {
+ g_strfreev(parts);
+ return pkg_ver;
+ }
- ver = find_ver(pkg_ver.first);
- // check to see if the provided package isn't virtual too
- if (ver.end() == false &&
- strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
- {
- g_strfreev (parts);
- pkg_ver.second = ver;
- return pkg_ver;
- }
+ ver = find_ver(pkg_ver.first);
+ // check to see if the provided package isn't virtual too
+ if (ver.end() == false &&
+ strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
+ {
+ g_strfreev(parts);
+ pkg_ver.second = ver;
+ return pkg_ver;
+ }
- ver = find_candidate_ver(pkg_ver.first);
- // check to see if the provided package isn't virtual too
- if (ver.end() == false &&
- strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
- {
- g_strfreev (parts);
- pkg_ver.second = ver;
- return pkg_ver;
- }
+ ver = find_candidate_ver(pkg_ver.first);
+ // check to see if the provided package isn't virtual too
+ if (ver.end() == false &&
+ strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
+ {
+ g_strfreev(parts);
+ pkg_ver.second = ver;
+ return pkg_ver;
+ }
found = false;
- g_strfreev (parts);
- return pkg_ver;
+ g_strfreev (parts);
+
+ return pkg_ver;
}
pkgCache::VerIterator AptIntf::find_candidate_ver(const pkgCache::PkgIterator &pkg)
@@ -374,186 +374,105 @@ PkgList AptIntf::filterPackages(PkgList &packages, PkBitfield filters)
}
// used to emit packages it collects all the needed info
-void AptIntf::emit_package(const pkgCache::PkgIterator &pkg,
- const pkgCache::VerIterator &ver,
- PkBitfield filters,
- PkInfoEnum state)
+void AptIntf::emit_package(const PkgPair &pair,
+ PkBitfield filters,
+ PkInfoEnum state)
{
- // check the state enum to see if it was not set.
- if (state == PK_INFO_ENUM_UNKNOWN) {
+ const pkgCache::PkgIterator &pkg = pair.first;
+ const pkgCache::VerIterator &ver = pair.second;
+
+ // check the state enum to see if it was not set.
+ if (state == PK_INFO_ENUM_UNKNOWN) {
if (pkg->CurrentState == pkgCache::State::Installed &&
pkg.CurrentVer() == ver) {
- state = PK_INFO_ENUM_INSTALLED;
- } else {
- state = PK_INFO_ENUM_AVAILABLE;
- }
- }
-
- if (m_isMultiArch &&
- (pk_bitfield_contain(filters, PK_FILTER_ENUM_ARCH) && state == PK_INFO_ENUM_AVAILABLE)) {
- // don't emit the package if it does not match
- // the native architecture
- if (strcmp(ver.Arch(), "all") != 0 &&
- strcmp(ver.Arch(), _config->Find("APT::Architecture").c_str()) != 0) {
- return;
- }
- }
-
- if (filters != 0) {
- std::string str = ver.Section() == NULL ? "" : ver.Section();
- std::string section, repo_section;
-
- size_t found;
- found = str.find_last_of("/");
- section = str.substr(found + 1);
- repo_section = str.substr(0, found);
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)
- && state == PK_INFO_ENUM_INSTALLED) {
- return;
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)
- && state == PK_INFO_ENUM_AVAILABLE) {
- return;
- }
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_DEVELOPMENT)) {
- // if ver.end() means unknow
- // strcmp will be true when it's different than devel
- std::string pkgName = pkg.Name();
- if (!ends_with(pkgName, "-dev") &&
- !ends_with(pkgName, "-dbg") &&
- section.compare("devel") &&
- section.compare("libdevel")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_DEVELOPMENT)) {
- std::string pkgName = pkg.Name();
- if (ends_with(pkgName, "-dev") ||
- ends_with(pkgName, "-dbg") ||
- !section.compare("devel") ||
- !section.compare("libdevel")) {
- return;
- }
- }
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_GUI)) {
- // if ver.end() means unknow
- // strcmp will be true when it's different than x11
- if (section.compare("x11") && section.compare("gnome") &&
- section.compare("kde") && section.compare("graphics")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_GUI)) {
- if (!section.compare("x11") || !section.compare("gnome") ||
- !section.compare("kde") || !section.compare("graphics")) {
- return;
- }
- }
-
- // TODO add Ubuntu handling
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_FREE)) {
- if (!repo_section.compare("contrib") ||
- !repo_section.compare("non-free")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_FREE)) {
- if (repo_section.compare("contrib") &&
- repo_section.compare("non-free")) {
- return;
- }
- }
-
- // TODO test this one..
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_COLLECTIONS)) {
- if (!repo_section.compare("metapackages")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_COLLECTIONS)) {
- if (repo_section.compare("metapackages")) {
- return;
- }
- }
+ state = PK_INFO_ENUM_INSTALLED;
+ } else {
+ state = PK_INFO_ENUM_AVAILABLE;
+ }
+ }
- }
- pkgCache::VerFileIterator vf = ver.FileList();
+ // Check if the filters match the package
+ if (!matchPackage(pair, filters)) {
+ return;
+ }
+
+ pkgCache::VerFileIterator vf = ver.FileList();
- gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- ver.VerStr(),
- ver.Arch(),
- vf.File().Archive() == NULL ? "" : vf.File().Archive());
- pk_backend_package(m_backend,
- state,
- package_id,
- get_short_description(ver, packageRecords).c_str());
- g_free(package_id);
+ gchar *package_id;
+ package_id = pk_package_id_build(pkg.Name(),
+ ver.VerStr(),
+ ver.Arch(),
+ vf.File().Archive() == NULL ? "" : vf.File().Archive());
+ pk_backend_package(m_backend,
+ state,
+ package_id,
+ get_short_description(ver, packageRecords).c_str());
+ g_free(package_id);
}
void AptIntf::emit_packages(PkgList &output,
- PkBitfield filters,
- PkInfoEnum state)
+ PkBitfield filters,
+ PkInfoEnum state)
{
- // Sort so we can remove the duplicated entries
- sort(output.begin(), output.end(), compare());
- // Remove the duplicated entries
- output.erase(unique(output.begin(),
- output.end(),
- result_equality()),
- output.end());
-
- for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
- i != output.end(); ++i)
- {
- if (_cancel) {
- break;
- }
- emit_package(i->first, i->second, filters, state);
- }
+ // Sort so we can remove the duplicated entries
+ sort(output.begin(), output.end(), compare());
+
+ // Remove the duplicated entries
+ output.erase(unique(output.begin(),
+ output.end(),
+ result_equality()),
+ output.end());
+
+ for (PkgList::iterator i = output.begin(); i != output.end(); ++i) {
+ if (_cancel) {
+ break;
+ }
+
+ emit_package(*i, filters, state);
+ }
}
void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
{
- PkInfoEnum state;
- // Sort so we can remove the duplicated entries
- sort(output.begin(), output.end(), compare());
- // Remove the duplicated entries
- output.erase(unique(output.begin(),
- output.end(),
- result_equality()),
- output.end());
-
- for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
- i != output.end(); ++i)
- {
- if (_cancel) {
- break;
- }
+ PkInfoEnum state;
+ // Sort so we can remove the duplicated entries
+ sort(output.begin(), output.end(), compare());
+ // Remove the duplicated entries
+ output.erase(unique(output.begin(),
+ output.end(),
+ result_equality()),
+ output.end());
- // the default update info
- state = PK_INFO_ENUM_NORMAL;
-
- // let find what kind of upgrade this is
- pkgCache::VerFileIterator vf = i->second.FileList();
- std::string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
- std::string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
- std::string label = vf.File().Label() == NULL ? "" : vf.File().Label();
- if (origin.compare("Debian") == 0 ||
- origin.compare("Ubuntu") == 0) {
- if (ends_with(archive, "-security") ||
- label.compare("Debian-Security") == 0) {
- state = PK_INFO_ENUM_SECURITY;
- } else if (ends_with(archive, "-backports")) {
- state = PK_INFO_ENUM_ENHANCEMENT;
- } else if (ends_with(archive, "-updates")) {
- state = PK_INFO_ENUM_BUGFIX;
- }
- } else if (origin.compare("Backports.org archive") == 0 ||
- ends_with(origin, "-backports")) {
- state = PK_INFO_ENUM_ENHANCEMENT;
- }
+ for (PkgList::iterator i = output.begin(); i != output.end(); ++i) {
+ if (_cancel) {
+ break;
+ }
- emit_package(i->first, i->second, filters, state);
- }
+ // the default update info
+ state = PK_INFO_ENUM_NORMAL;
+
+ // let find what kind of upgrade this is
+ pkgCache::VerFileIterator vf = i->second.FileList();
+ std::string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
+ std::string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
+ std::string label = vf.File().Label() == NULL ? "" : vf.File().Label();
+ if (origin.compare("Debian") == 0 ||
+ origin.compare("Ubuntu") == 0) {
+ if (ends_with(archive, "-security") ||
+ label.compare("Debian-Security") == 0) {
+ state = PK_INFO_ENUM_SECURITY;
+ } else if (ends_with(archive, "-backports")) {
+ state = PK_INFO_ENUM_ENHANCEMENT;
+ } else if (ends_with(archive, "-updates")) {
+ state = PK_INFO_ENUM_BUGFIX;
+ }
+ } else if (origin.compare("Backports.org archive") == 0 ||
+ ends_with(origin, "-backports")) {
+ state = PK_INFO_ENUM_ENHANCEMENT;
+ }
+
+ emit_package(*i, filters, state);
+ }
}
// search packages which provide a codec (specified in "values")
@@ -591,7 +510,7 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
rec.GetRec(start, stop);
string record(start, stop - start);
if (matcher->matches(record)) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ output.push_back(PkgPair(pkg, ver));
}
}
@@ -601,71 +520,73 @@ void AptIntf::providesCodec(PkgList &output, gchar **values)
// search packages which provide the libraries specified in "values"
void AptIntf::providesLibrary(PkgList &output, gchar **values)
{
- bool ret = false;
- // Quick-check for library names
- for (uint i = 0; i < g_strv_length(values); i++)
- if (g_str_has_prefix (values[i], "lib")) {
- ret = true;
- break;
- }
- if (!ret)
- return;
+ bool ret = false;
+ // Quick-check for library names
+ for (uint i = 0; i < g_strv_length(values); i++) {
+ if (g_str_has_prefix (values[i], "lib")) {
+ ret = true;
+ break;
+ }
+ }
- const char *libreg_str = "^\\(lib.*\\)\\.so\\.[0-9]*";
- g_debug ("RegStr: %s", libreg_str);
- regex_t libreg;
- if(regcomp(&libreg, libreg_str, 0) != 0) {
- g_debug("Regex compilation error: ", libreg);
- return;
- }
+ if (!ret) {
+ return;
+ }
- gchar *value;
- for (uint i = 0; i < g_strv_length(values); i++) {
- value = values[i];
- regmatch_t matches[2];
- if (regexec(&libreg, value, 2, matches, 0) != REG_NOMATCH) {
- string libPkgName = string(value, matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
-
- string strvalue = string(value);
- ssize_t pos = strvalue.find (".so.");
- if ((pos != string::npos) && (pos > 0)) {
- // If last char is a number, add a "-" (to be policy-compliant)
- if (g_ascii_isdigit (libPkgName.at (libPkgName.length () - 1)))
- libPkgName.append ("-");
-
- libPkgName.append (strvalue.substr (pos + 4));
- }
+ const char *libreg_str = "^\\(lib.*\\)\\.so\\.[0-9]*";
+ g_debug("RegStr: %s", libreg_str);
+ regex_t libreg;
+ if(regcomp(&libreg, libreg_str, 0) != 0) {
+ g_debug("Regex compilation error: ", libreg);
+ return;
+ }
- g_debug ("pkg-name: %s", libPkgName.c_str ());
+ gchar *value;
+ for (uint i = 0; i < g_strv_length(values); i++) {
+ value = values[i];
+ regmatch_t matches[2];
+ if (regexec(&libreg, value, 2, matches, 0) != REG_NOMATCH) {
+ string libPkgName = string(value, matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
+
+ string strvalue = string(value);
+ ssize_t pos = strvalue.find (".so.");
+ if ((pos != string::npos) && (pos > 0)) {
+ // If last char is a number, add a "-" (to be policy-compliant)
+ if (g_ascii_isdigit (libPkgName.at (libPkgName.length () - 1))) {
+ libPkgName.append ("-");
+ }
- for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
+ libPkgName.append (strvalue.substr (pos + 4));
+ }
- // TODO: Ignore virtual packages
- pkgCache::VerIterator ver = find_ver (pkg);
- if (ver.end() == true) {
- ver = find_candidate_ver(pkg);
- if (ver.end() == true) {
- continue;
- }
- }
+ g_debug ("pkg-name: %s", libPkgName.c_str ());
- // Make everything lower-case
- std::transform(libPkgName.begin(), libPkgName.end(), libPkgName.begin(), ::tolower);
+ for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
- if (g_strcmp0 (pkg.Name (), libPkgName.c_str ()) == 0) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
- }
- }
+ // TODO: Ignore virtual packages
+ pkgCache::VerIterator ver = find_ver (pkg);
+ if (ver.end() == true) {
+ ver = find_candidate_ver(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ }
- } else {
- g_debug("libmatcher: Did not match: %s", value);
- }
- }
+ // Make everything lower-case
+ std::transform(libPkgName.begin(), libPkgName.end(), libPkgName.begin(), ::tolower);
+ if (g_strcmp0 (pkg.Name (), libPkgName.c_str ()) == 0) {
+ output.push_back(PkgPair(pkg, ver));
+ }
+ }
+ } else {
+ g_debug("libmatcher: Did not match: %s", value);
+ }
+ }
}
// used to emit packages it collects all the needed info
@@ -983,69 +904,67 @@ void AptIntf::emitUpdateDetails(PkgList &pkgs)
}
void AptIntf::get_depends(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive)
+ pkgCache::PkgIterator pkg,
+ bool recursive)
{
- pkgCache::DepIterator dep = find_ver(pkg).DependsList();
- while (!dep.end()) {
- if (_cancel) {
- break;
- }
- pkgCache::VerIterator ver = find_ver(dep.TargetPkg());
- // Ignore packages that exist only due to dependencies.
- if (ver.end()) {
- dep++;
- continue;
- } else if (dep->Type == pkgCache::Dep::Depends) {
- if (recursive) {
- if (!contains(output, dep.TargetPkg())) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
- get_depends(output, dep.TargetPkg(), recursive);
- }
- } else {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
- }
- }
- dep++;
- }
+ pkgCache::DepIterator dep = find_ver(pkg).DependsList();
+ while (!dep.end()) {
+ if (_cancel) {
+ break;
+ }
+
+ pkgCache::VerIterator ver = find_ver(dep.TargetPkg());
+ // Ignore packages that exist only due to dependencies.
+ if (ver.end()) {
+ dep++;
+ continue;
+ } else if (dep->Type == pkgCache::Dep::Depends) {
+ if (recursive) {
+ if (!contains(output, dep.TargetPkg())) {
+ output.push_back(PkgPair(dep.TargetPkg(), ver));
+ get_depends(output, dep.TargetPkg(), recursive);
+ }
+ } else {
+ output.push_back(PkgPair(dep.TargetPkg(), ver));
+ }
+ }
+ dep++;
+ }
}
void AptIntf::get_requires(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive)
+ pkgCache::PkgIterator pkg,
+ bool recursive)
{
- for (pkgCache::PkgIterator parentPkg = packageCache->PkgBegin(); !parentPkg.end(); ++parentPkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (parentPkg.VersionList().end() && parentPkg.ProvidesList().end()) {
- continue;
- }
+ for (pkgCache::PkgIterator parentPkg = packageCache->PkgBegin(); !parentPkg.end(); ++parentPkg) {
+ if (_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (parentPkg.VersionList().end() && parentPkg.ProvidesList().end()) {
+ continue;
+ }
- // Don't insert virtual packages instead add what it provides
- pkgCache::VerIterator ver = find_ver(parentPkg);
- if (ver.end() == false) {
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > deps;
- get_depends(deps, parentPkg, false);
- for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=deps.begin();
- i != deps.end();
- ++i)
- {
- if (i->first == pkg) {
- if (recursive) {
- if (!contains(output, parentPkg)) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
- get_requires(output, parentPkg, recursive);
- }
- } else {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
- }
- break;
- }
- }
- }
- }
+ // Don't insert virtual packages instead add what it provides
+ pkgCache::VerIterator ver = find_ver(parentPkg);
+ if (ver.end() == false) {
+ PkgList deps;
+ get_depends(deps, parentPkg, false);
+ for (PkgList::iterator i=deps.begin(); i != deps.end(); ++i) {
+ if (i->first == pkg) {
+ if (recursive) {
+ if (!contains(output, parentPkg)) {
+ output.push_back(PkgPair(parentPkg, ver));
+ get_requires(output, parentPkg, recursive);
+ }
+ } else {
+ output.push_back(PkgPair(parentPkg, ver));
+ }
+ break;
+ }
+ }
+ }
+ }
}
// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
@@ -1389,89 +1308,85 @@ bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
/* */
void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
{
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > installing,
- removing,
- updating,
- downgrading;
+ PkgList installing;
+ PkgList removing;
+ PkgList updating;
+ PkgList downgrading;
- string VersionsList;
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg)
- {
- if (Cache[pkg].NewInstall() == true) {
- // installing
- installing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Delete() == true) {
- // removing
- removing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
- } else if (Cache[pkg].Upgrade() == true) {
- // updating
- updating.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Downgrade() == true) {
- // downgrading
- downgrading.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- }
- }
+ string VersionsList;
+ for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg)
+ {
+ if (Cache[pkg].NewInstall() == true) {
+ // installing
+ installing.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Delete() == true) {
+ // removing
+ removing.push_back(PkgPair(pkg, find_ver(pkg)));
+ } else if (Cache[pkg].Upgrade() == true) {
+ // updating
+ updating.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Downgrade() == true) {
+ // downgrading
+ downgrading.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ }
+ }
- // emit packages that have changes
- emit_packages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
- emit_packages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
- emit_packages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
- emit_packages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
+ // emit packages that have changes
+ emit_packages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
+ emit_packages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
+ emit_packages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+ emit_packages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
}
void AptIntf::populateInternalPackages(pkgCacheFile &Cache)
{
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
- if (Cache[pkg].NewInstall() == true) {
- // installing
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Delete() == true) {
- // removing
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
- } else if (Cache[pkg].Upgrade() == true) {
- // updating
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Downgrade() == true) {
- // downgrading
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- }
- }
+ for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
+ if (Cache[pkg].NewInstall() == true) {
+ // installing
+ m_pkgs.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Delete() == true) {
+ // removing
+ m_pkgs.push_back(PkgPair(pkg, find_ver(pkg)));
+ } else if (Cache[pkg].Upgrade() == true) {
+ // updating
+ m_pkgs.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Downgrade() == true) {
+ // downgrading
+ m_pkgs.push_back(PkgPair(pkg, find_candidate_ver(pkg)));
+ }
+ }
}
void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
{
- for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=m_pkgs.begin();
- i != m_pkgs.end();
- ++i)
- {
- if (i->first.Name() == name) {
- emit_package(i->first, i->second, PK_FILTER_ENUM_NONE, state);
- return;
- }
- }
+ for (PkgList::iterator i = m_pkgs.begin(); i != m_pkgs.end(); ++i) {
+ if (i->first.Name() == name) {
+ emit_package(*i, PK_FILTER_ENUM_NONE, state);
+ return;
+ }
+ }
- pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
- pkg_ver.first = packageCache->FindPkg(name);
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (pkg_ver.first.end() == true ||
- (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
- {
- return;
- }
+ PkgPair pkgPair;
+ pkgPair.first = packageCache->FindPkg(name);
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (pkgPair.first.end() == true ||
+ (pkgPair.first.VersionList().end() && pkgPair.first.ProvidesList().end())) {
+ return;
+ }
- pkg_ver.second = find_ver(pkg_ver.first);
- // check to see if the provided package isn't virtual too
- if (pkg_ver.second.end() == false)
- {
- emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
- }
+ pkgPair.second = find_ver(pkgPair.first);
+ // check to see if the provided package isn't virtual too
+ if (pkgPair.second.end() == false)
+ {
+ emit_package(pkgPair, PK_FILTER_ENUM_NONE, state);
+ }
- pkg_ver.second = find_candidate_ver(pkg_ver.first);
- // check to see if we found the package
- if (pkg_ver.second.end() == false)
- {
- emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
- }
+ pkgPair.second = find_candidate_ver(pkgPair.first);
+ // check to see if we found the package
+ if (pkgPair.second.end() == false)
+ {
+ emit_package(pkgPair, PK_FILTER_ENUM_NONE, state);
+ }
}
void AptIntf::updateInterface(int fd, int writeFd)
@@ -2289,7 +2204,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache)
}
// Append it to the list
- Stat.addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ Stat.addPackagePair(PkgPair(pkg, ver));
}
// Display statistics
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index cca2448..ea83520 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -97,16 +97,15 @@ public:
pkgCache::PkgIterator pkg,
bool recursive);
- /**
- * Emits a package if it match the filters
- */
- void emit_package(const pkgCache::PkgIterator &pkg,
- const pkgCache::VerIterator &ver,
- PkBitfield filters = PK_FILTER_ENUM_NONE,
- PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+ /**
+ * Emits a package if it match the filters
+ */
+ void emit_package(const PkgPair &pair,
+ PkBitfield filters = PK_FILTER_ENUM_NONE,
+ PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
- bool matchPackage(const PkgPair &package, PkBitfield filters);
- PkgList filterPackages(PkgList &packages, PkBitfield filters);
+ bool matchPackage(const PkgPair &pair, PkBitfield filters);
+ PkgList filterPackages(PkgList &packages, PkBitfield filters);
void emit_packages(PkgList &output,
PkBitfield filters = PK_FILTER_ENUM_NONE,
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 8d8e017..1645f10 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -188,7 +188,7 @@ backend_get_depends_or_requires_thread (PkBackend *backend)
bool depends = pk_backend_get_bool(backend, "get_depends");
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > output;
+ PkgList output;
for (uint i = 0; i < g_strv_length(package_ids); i++) {
if (_cancel) {
break;
@@ -202,7 +202,7 @@ backend_get_depends_or_requires_thread (PkBackend *backend)
return false;
}
- pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
+ PkgPair pkg_ver;
bool found;
pkg_ver = m_apt->find_package_id(pi, found);
if (!found)
@@ -293,7 +293,7 @@ backend_get_files_thread (PkBackend *backend)
return false;
}
- pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
+ PkgPair pkg_ver;
bool found;
pkg_ver = m_apt->find_package_id(pi, found);
if (!found)
@@ -510,7 +510,7 @@ backend_what_provides_thread (PkBackend *backend)
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
vector<string> packages;
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > output;
+ PkgList output;
if (provides == PK_PROVIDES_ENUM_SHARED_LIB) {
m_apt->providesLibrary (output, values);
@@ -538,7 +538,7 @@ backend_what_provides_thread (PkBackend *backend)
if (ver.end() == true) {
continue;
}
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ output.push_back(PkgPair(pkg, ver));
}
if (error && provides == PK_PROVIDES_ENUM_MIMETYPE) {
@@ -649,7 +649,7 @@ pk_backend_download_packages_thread (PkBackend *backend)
break;
}
- pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
+ PkgPair pkg_ver;
bool found;
pkg_ver = m_apt->find_package_id(pi, found);
// Ignore packages that could not be found or that exist only due to dependencies.
@@ -834,7 +834,7 @@ pk_backend_search_files_thread (PkBackend *backend)
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
vector<string> packages = search_files (backend, values, _cancel);
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > output;
+ PkgList output;
for(vector<string>::iterator i = packages.begin();
i != packages.end(); ++i)
{
@@ -850,7 +850,7 @@ pk_backend_search_files_thread (PkBackend *backend)
{
continue;
}
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ output.push_back(PkgPair(pkg, ver));
}
// It's faster to emmit the packages here rather than in the matching part
m_apt->emit_packages(output, filters);
@@ -905,7 +905,7 @@ backend_search_groups_thread (PkBackend *backend)
}
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > output;
+ PkgList output;
for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
if (_cancel) {
break;
@@ -929,7 +929,7 @@ backend_search_groups_thread (PkBackend *backend)
i != groups.end();
++i) {
if (*i == get_enum_group(section)) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ output.push_back(PkgPair(pkg, ver));
break;
}
}
@@ -994,7 +994,7 @@ backend_search_package_thread (PkBackend *backend)
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pkgDepCache::Policy Plcy;
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > output;
+ PkgList output;
if (pk_backend_get_bool (backend, "search_details")) {
for (pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin(); !pkg.end(); ++pkg) {
if (_cancel) {
@@ -1010,7 +1010,7 @@ backend_search_package_thread (PkBackend *backend)
if (m_matcher->matches(pkg.Name()) ||
m_matcher->matches(get_long_description(ver, m_apt->packageRecords))) {
// The package matched
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ output.push_back(PkgPair(pkg, ver));
}
} else if (m_matcher->matches(pkg.Name())) {
// The package is virtual and MATCHED the name
@@ -1025,7 +1025,7 @@ backend_search_package_thread (PkBackend *backend)
{
// we add the package now because we will need to
// remove duplicates later anyway
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(Prv.OwnerPkg(), ver));
+ output.push_back(PkgPair(Prv.OwnerPkg(), ver));
}
}
}
@@ -1044,7 +1044,7 @@ backend_search_package_thread (PkBackend *backend)
// Don't insert virtual packages instead add what it provides
pkgCache::VerIterator ver = m_apt->find_ver(pkg);
if (ver.end() == false) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ output.push_back(PkgPair(pkg, ver));
} else {
// iterate over the provides list
for (pkgCache::PrvIterator Prv = pkg.ProvidesList(); Prv.end() == false; Prv++) {
@@ -1055,7 +1055,7 @@ backend_search_package_thread (PkBackend *backend)
{
// we add the package now because we will need to
// remove duplicates later anyway
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(Prv.OwnerPkg(), ver));
+ output.push_back(PkgPair(Prv.OwnerPkg(), ver));
}
}
}
@@ -1415,7 +1415,7 @@ backend_get_packages_thread (PkBackend *backend)
}
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > output;
+ PkgList output;
output.reserve(m_apt->packageCache->HeaderP->PackageCount);
for(pkgCache::PkgIterator pkg = m_apt->packageCache->PkgBegin();
!pkg.end(); ++pkg)
@@ -1430,7 +1430,7 @@ backend_get_packages_thread (PkBackend *backend)
// Don't insert virtual packages as they don't have all kinds of info
pkgCache::VerIterator ver = m_apt->find_ver(pkg);
if (ver.end() == false) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ output.push_back(PkgPair(pkg, ver));
}
}
commit da791dc59194ecdeb0fd05c68738a11e51ea011d
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Thu Apr 12 13:13:00 2012 -0300
aptcc: Fix resolving of gdebi packages when they have :arch field
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index dcf5b4b..aee63d0 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -261,6 +261,118 @@ pkgCache::VerIterator AptIntf::find_ver(const pkgCache::PkgIterator &pkg)
return pkg.VersionList();
}
+bool AptIntf::matchPackage(const PkgPair &pair, PkBitfield filters)
+{
+ if (filters != 0) {
+ const pkgCache::PkgIterator &pkg = pair.first;
+ const pkgCache::VerIterator &ver = pair.second;
+ bool installed = false;
+
+ // Check if the package is installed
+ if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
+ installed = false;
+ }
+
+ // if we are on multiarch check also the arch filter
+ if (m_isMultiArch && pk_bitfield_contain(filters, PK_FILTER_ENUM_ARCH)/* && !installed*/) {
+ // don't emit the package if it does not match
+ // the native architecture
+ if (strcmp(ver.Arch(), "all") != 0 &&
+ strcmp(ver.Arch(), _config->Find("APT::Architecture").c_str()) != 0) {
+ return false;
+ }
+ }
+
+ std::string str = ver.Section() == NULL ? "" : ver.Section();
+ std::string section, repo_section;
+
+ size_t found;
+ found = str.find_last_of("/");
+ section = str.substr(found + 1);
+ repo_section = str.substr(0, found);
+
+ if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_INSTALLED) && installed) {
+ return false;
+ } else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_INSTALLED) && !installed) {
+ return false;
+ }
+
+ if (pk_bitfield_contain(filters, PK_FILTER_ENUM_DEVELOPMENT)) {
+ // if ver.end() means unknow
+ // strcmp will be true when it's different than devel
+ std::string pkgName = pkg.Name();
+ if (!ends_with(pkgName, "-dev") &&
+ !ends_with(pkgName, "-dbg") &&
+ section.compare("devel") &&
+ section.compare("libdevel")) {
+ return false;
+ }
+ } else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_DEVELOPMENT)) {
+ std::string pkgName = pkg.Name();
+ if (ends_with(pkgName, "-dev") ||
+ ends_with(pkgName, "-dbg") ||
+ !section.compare("devel") ||
+ !section.compare("libdevel")) {
+ return false;
+ }
+ }
+
+ if (pk_bitfield_contain(filters, PK_FILTER_ENUM_GUI)) {
+ // if ver.end() means unknow
+ // strcmp will be true when it's different than x11
+ if (section.compare("x11") && section.compare("gnome") &&
+ section.compare("kde") && section.compare("graphics")) {
+ return false;
+ }
+ } else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_GUI)) {
+ if (!section.compare("x11") || !section.compare("gnome") ||
+ !section.compare("kde") || !section.compare("graphics")) {
+ return false;
+ }
+ }
+
+ // TODO add Ubuntu handling
+ if (pk_bitfield_contain(filters, PK_FILTER_ENUM_FREE)) {
+ if (!repo_section.compare("contrib") ||
+ !repo_section.compare("non-free")) {
+ return false;
+ }
+ } else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_FREE)) {
+ if (repo_section.compare("contrib") &&
+ repo_section.compare("non-free")) {
+ return false;
+ }
+ }
+
+ // TODO test this one..
+ if (pk_bitfield_contain(filters, PK_FILTER_ENUM_COLLECTIONS)) {
+ if (!repo_section.compare("metapackages")) {
+ return false;
+ }
+ } else if (pk_bitfield_contain(filters, PK_FILTER_ENUM_NOT_COLLECTIONS)) {
+ if (repo_section.compare("metapackages")) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+PkgList AptIntf::filterPackages(PkgList &packages, PkBitfield filters)
+{
+ if (filters != 0) {
+ PkgList ret;
+ for (PkgList::iterator i = packages.begin(); i != packages.end(); ++i) {
+ if (matchPackage(*i, filters)) {
+ ret.push_back(*i);
+ }
+ }
+ return ret;
+ } else {
+ return packages;
+ }
+}
+
// used to emit packages it collects all the needed info
void AptIntf::emit_package(const pkgCache::PkgIterator &pkg,
const pkgCache::VerIterator &ver,
@@ -275,7 +387,7 @@ void AptIntf::emit_package(const pkgCache::PkgIterator &pkg,
} else {
state = PK_INFO_ENUM_AVAILABLE;
}
- }
+ }
if (m_isMultiArch &&
(pk_bitfield_contain(filters, PK_FILTER_ENUM_ARCH) && state == PK_INFO_ENUM_AVAILABLE)) {
@@ -1680,7 +1792,7 @@ bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
return true;
}
-PkgList AptIntf::resolvePI(gchar **package_ids)
+PkgList AptIntf::resolvePI(gchar **package_ids, PkBitfield filters)
{
gchar *pi;
PkgList ret;
@@ -1691,7 +1803,7 @@ PkgList AptIntf::resolvePI(gchar **package_ids)
if (package_ids == NULL)
return ret;
- for (uint i = 0; i < g_strv_length(package_ids); i++) {
+ for (uint i = 0; i < g_strv_length(package_ids); ++i) {
if (_cancel) {
break;
}
@@ -1701,7 +1813,8 @@ PkgList AptIntf::resolvePI(gchar **package_ids)
// Check if it's a valid package id
if (pk_package_id_check(pi) == false) {
- if (m_isMultiArch) {
+ // Check if we are on multiarch AND if the package name didn't contains the arch field (GDEBI for instance)
+ if (m_isMultiArch && strstr(pi, ":") == NULL) {
// OK FindPkg is not suitable for muitarch
// it can only return one package in this case we need to
// search the whole package cache and match the package
@@ -1763,7 +1876,8 @@ PkgList AptIntf::resolvePI(gchar **package_ids)
}
}
}
- return ret;
+
+ return filterPackages(ret, filters);
}
bool AptIntf::markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag)
@@ -1837,9 +1951,21 @@ bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &r
g_free(removeStr);
}
- // Store the changes
- install = resolvePI(installPkgs);
- remove = resolvePI(removePkgs);
+ // Resolve the packages to install
+ PkBitfield intallFilters;
+ intallFilters = pk_bitfield_from_enums (
+ PK_FILTER_ENUM_NOT_INSTALLED,
+ PK_FILTER_ENUM_ARCH,
+ -1);
+ install = resolvePI(installPkgs, intallFilters);
+
+ // Resolve the packages to remove
+ PkBitfield removeFilters;
+ removeFilters = pk_bitfield_from_enums (
+ PK_FILTER_ENUM_INSTALLED,
+ PK_FILTER_ENUM_ARCH,
+ -1);
+ remove = resolvePI(removePkgs, removeFilters);
m_localDebFile = file;
g_strfreev(lines);
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 7ae4f15..cca2448 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -68,7 +68,7 @@ public:
pkgCache::VerIterator find_ver(const pkgCache::PkgIterator &pkg);
pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
- PkgList resolvePI(gchar **package_ids);
+ PkgList resolvePI(gchar **package_ids, PkBitfield filters = PK_FILTER_ENUM_NONE);
bool markFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
bool markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag);
@@ -104,6 +104,9 @@ public:
const pkgCache::VerIterator &ver,
PkBitfield filters = PK_FILTER_ENUM_NONE,
PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+
+ bool matchPackage(const PkgPair &package, PkBitfield filters);
+ PkgList filterPackages(PkgList &packages, PkBitfield filters);
void emit_packages(PkgList &output,
PkBitfield filters = PK_FILTER_ENUM_NONE,
commit e8eb61e157eba3845f1cad5a04385468de988cbd
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Apr 11 17:41:40 2012 +0100
Do not include the website in the tarball
diff --git a/configure.ac b/configure.ac
index 89d5d2a..792a858 100644
--- a/configure.ac
+++ b/configure.ac
@@ -736,10 +736,6 @@ AC_CONFIG_FILES([
Makefile
etc/Makefile
docs/Makefile
-docs/html/Makefile
-docs/html/img/Makefile
-docs/html/img/thumbnails/Makefile
-docs/html/videos/Makefile
docs/api/Makefile
docs/api/dbus/Makefile
docs/api/version.xml
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 725d8c6..2225499 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -345,13 +345,6 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%files docs
%defattr(-,root,root,-)
%{_datadir}/gtk-doc/html/PackageKit
-%dir %{_datadir}/PackageKit/website
-%{_datadir}/PackageKit/website/*.html
-%{_datadir}/PackageKit/website/*.css
-%dir %{_datadir}/PackageKit/website/img
-%{_datadir}/PackageKit/website/img/*.png
-%dir %{_datadir}/PackageKit/website/img/thumbnails
-%{_datadir}/PackageKit/website/img/thumbnails/*.png
%if 0%{?rhel} == 0
%files smart
diff --git a/docs/Makefile.am b/docs/Makefile.am
index cc1c6dd..aae65c5 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -1,8 +1,7 @@
NULL =
SUBDIRS = \
- api \
- html
+ api
MAINTAINERCLEANFILES = \
packagekit-qt
diff --git a/docs/html/Makefile.am b/docs/html/Makefile.am
deleted file mode 100644
index 6e882e8..0000000
--- a/docs/html/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-SUBDIRS = img videos
-
-HTML_FILES = \
- style.css \
- index.html \
- pk-authors.html \
- pk-bugs.html \
- pk-download.html \
- pk-faq.html \
- pk-help.html \
- pk-intro.html \
- pk-matrix.html \
- pk-profiles.html \
- pk-reference.html \
- pk-screenshots.html \
- pk-package-not-found.html \
- pk-using.html
-
-helpfiledir = $(datadir)/PackageKit/website
-helpfile_DATA = $(HTML_FILES)
-
-EXTRA_DIST = $(HTML_FILES)
-
-clean-local:
- rm -f *~
-
-
--include $(top_srcdir)/git.mk
diff --git a/docs/html/img/Makefile.am b/docs/html/img/Makefile.am
deleted file mode 100644
index c71a06b..0000000
--- a/docs/html/img/Makefile.am
+++ /dev/null
@@ -1,99 +0,0 @@
-SUBDIRS = thumbnails
-
-IMAGE_FILES = \
- assassin.png \
- author-alefebvre.png \
- author-btimothy.png \
- author-caglar.png \
- author-elliot.png \
- author-glatzor.png \
- author-grzegorzdabrowski.png \
- author-hughsie.png \
- author-jbowes.png \
- author-kenvandine.png \
- author-lmacken.png \
- author-rnorwood.png \
- author-timlau.png \
- author-tomparker.png \
- author-unknown.png \
- author-zodman.png \
- users-fedora.png \
- users-foresight.png \
- users-kubuntu.png \
- users-moblin.png \
- dialog-information.png \
- gpk-added-deps.png \
- gpk-application-groups.png \
- gpk-application-search.png \
- gpk-auto-update.png \
- gpk-backend-status.png \
- gpk-battery.png \
- gpk-client-codecs.png \
- gpk-client-firmware.png \
- gpk-client-font.png \
- gpk-client-mime-type.png \
- gpk-distro-upgrade-notify.png \
- gpk-eula.png \
- gpk-inhibit.png \
- gpk-log.png \
- gpk-markdown.png \
- gpk-network.png \
- gpk-prefs.png \
- gpk-progress.png \
- gpk-remove-confirm.png \
- gpk-repo-auth.png \
- gpk-repo-more.png \
- gpk-repo.png \
- gpk-require-restart.png \
- gpk-run-application.png \
- gpk-service-pack.png \
- gpk-signature.png \
- gpk-updates-overview.png \
- gpk-updates.png \
- gpk-updates-warning.png \
- gpk-waiting.png \
- kpk-confirm.png \
- kpk-information.png \
- kpk-notify.png \
- kpk-progress.png \
- kpk-search.png \
- kpk-settings.png \
- kpk-update.png \
- large-accessories-text-editor.png \
- large-applications-development.png \
- large-authors.png \
- large-dialog-information.png \
- large-emblem-favorite.png \
- large-emblem-photos.png \
- large-help-browser.png \
- large-preferences-system.png \
- large-system-users.png \
- large-application-certificate.png \
- packagekit.png \
- pk-command-not-found.png \
- pk-opensuse-updater.png \
- pk-self-check.png \
- pk-update-bugfix.png \
- pk-update-enhancement.png \
- pk-update-high.png \
- pk-update-low.png \
- pk-update-normal.png \
- pk-update-security.png \
- pk-web-plugin.png \
- profile-bevan.png \
- profile-graham.png \
- profile-suzan.png \
- status-bad.png \
- status-good.png \
- $(NULL)
-
-helpfiledir = $(datadir)/PackageKit/website/img
-helpfile_DATA = $(IMAGE_FILES)
-
-EXTRA_DIST = $(IMAGE_FILES)
-
-clean-local:
- rm -f *~
-
-
--include $(top_srcdir)/git.mk
diff --git a/docs/html/videos/Makefile.am b/docs/html/videos/Makefile.am
deleted file mode 100644
index 7553b7e..0000000
--- a/docs/html/videos/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-NULL =
-
-VIDEO_FILES = \
- pk-application-not-found.ogv \
- pk-command-not-found.ogv \
- pk-font-no-found.ogv \
- $(NULL)
-
-EXTRA_DIST = \
- $(VIDEO_FILES) \
- $(NULL)
-
-clean-local:
- rm -f *~
-
-
--include $(top_srcdir)/git.mk
commit ac87008bdd583e1b24fb870641574fb3af5c773f
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Fri Apr 6 16:58:16 2012 +0200
entropy: add support to ConfigurationUpdates
diff --git a/backends/entropy/entropyBackend.py b/backends/entropy/entropyBackend.py
index 2a3fdee..7854725 100755
--- a/backends/entropy/entropyBackend.py
+++ b/backends/entropy/entropyBackend.py
@@ -896,11 +896,19 @@ class PackageKitEntropyBackend(PackageKitBaseBackend, PackageKitEntropyMixin):
self._log_message(__name__, "_generic_message:", decolorize(message))
def _config_files_message(self):
- scandata = self._entropy.PackageFileUpdates().scan(dcache = True,
- quiet = True)
- if scandata is None:
- return
- if len(scandata) > 0:
+ has_updates = False
+ if hasattr(self._entropy, "ConfigurationUpdates"):
+ updates = self._entropy.ConfigurationUpdates()
+ scandata = updates.get(quiet=True)
+ has_updates = len(scandata) > 0
+ else:
+ scandata = self._entropy.PackageFileUpdates().scan(
+ dcache = True, quiet = True)
+ if scandata is None:
+ return
+ has_updates = len(scandata) > 0
+
+ if has_updates:
message = "Some configuration files need updating."
message += ";You should use 'equo conf update' to update them"
message += ";If you can't do that, ask your system administrator."
commit d0ab4d61931314cf4b64a603323437e2b5582bd7
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Thu Apr 5 00:29:13 2012 +0200
aptcc: Emit newly-installed local package information
Also fix some bugs in aptcc's InstallFiles()
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 1d2488c..dcf5b4b 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1884,6 +1884,13 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
return false;
}
+ // Build package-id for the new package
+ gchar *deb_package_id = pk_package_id_build (deb.packageName ().c_str (),
+ deb.version ().c_str (),
+ deb.architecture ().c_str (),
+ "local");
+ const gchar *deb_summary = deb.summary ().c_str ();
+
gint status;
gchar **argv;
gchar **envp;
@@ -1903,6 +1910,9 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
envp[2] = g_strdup_printf("DEBCONF_PIPE=%s", pk_backend_get_frontend_socket(m_backend));
envp[3] = NULL;
+ // We're installing the package now...
+ pk_backend_package (m_backend, PK_INFO_ENUM_INSTALLING, deb_package_id, deb_summary);
+
g_spawn_sync(NULL, // working dir
argv,
envp,
@@ -1915,7 +1925,6 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
&error);
int exit_code = WEXITSTATUS(status);
- cout << argv[2] << endl;
cout << "DpkgOut: " << std_out << endl;
cout << "DpkgErr: " << std_err << endl;
@@ -1936,7 +1945,8 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
}
// Emit data of the now-installed DEB package
- //emit_package("", PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+ pk_backend_package (m_backend, PK_INFO_ENUM_INSTALLED, deb_package_id, deb_summary);
+ g_free (deb_package_id);
return true;
}
diff --git a/backends/aptcc/deb-file.cpp b/backends/aptcc/deb-file.cpp
index a2599af..8fa812a 100644
--- a/backends/aptcc/deb-file.cpp
+++ b/backends/aptcc/deb-file.cpp
@@ -39,6 +39,8 @@ DebFile::DebFile(const std::string &filename)
if(!m_extractor->Read(deb)) {
m_isValid = false;
return;
+ } else {
+ m_isValid = true;
}
m_controlData = m_extractor->Section;
@@ -79,6 +81,19 @@ std::string DebFile::conflicts() const
return m_controlData.FindS("Conflicts");
}
+std::string DebFile::summary() const
+{
+ std::string longDesc = description ();
+ longDesc.resize (longDesc.find_first_of ("\n"));
+
+ return longDesc;
+}
+
+std::string DebFile::description() const
+{
+ return m_controlData.FindS("Description");
+}
+
bool DebFile::check()
{
// check arch
diff --git a/backends/aptcc/deb-file.h b/backends/aptcc/deb-file.h
index 8cd305f..bf19bf3 100644
--- a/backends/aptcc/deb-file.h
+++ b/backends/aptcc/deb-file.h
@@ -38,6 +38,8 @@ public:
std::string sourcePackage() const;
std::string version() const;
std::string architecture() const;
+ std::string summary() const;
+ std::string description() const;
std::string conflicts() const;
// THIS should be moved to AptIntf class
commit 21ce80d11bba01230a8a3307ad7e21fbe0bb4685
Author: Tomáš Trnka <tomastrnka at gmx.com>
Date: Wed Apr 4 12:17:45 2012 +0100
python: Speed up get_package_list()
This patch replaces the quadratic monstrosity with an approximately linear
equivalent.
On my system (40297 installed+available packages) this gets the time spent in
get_package_list to 1.3 s from the initial ~600 s. In other words, pkcon
refresh now spends just about 20 s CPU time instead of 8 minutes.
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/lib/python/packagekit/filter.py b/lib/python/packagekit/filter.py
index 99d2de8..e99cfef 100644
--- a/lib/python/packagekit/filter.py
+++ b/lib/python/packagekit/filter.py
@@ -21,6 +21,7 @@
# imports
from .enums import *
from .package import PackagekitPackage
+import collections
class PackagekitFilter(object, PackagekitPackage):
@@ -83,17 +84,21 @@ class PackagekitFilter(object, PackagekitPackage):
if self._filter_base(pkg):
self.package_list.append((pkg, state))
+ # prepare lookup table of installed packages
+ installed_dict = collections.defaultdict(list)
+ for pkg, state in self.package_list:
+ if state is INFO_INSTALLED:
+ installed_dict[self._pkg_get_name(pkg)].append(pkg)
+
# check there are not available versions in the package list
# that are older than the installed version
package_list = self.package_list
self.package_list = []
for pkg, state in package_list:
- add = True;
+ add = True
if state is INFO_AVAILABLE:
- for pkg_tmp, state_tmp in self.package_list:
- if state_tmp is not INFO_INSTALLED:
- continue
+ for pkg_tmp in installed_dict[self._pkg_get_name(pkg)]:
rc = self._pkg_compare(pkg, pkg_tmp)
# don't add if the same as the installed package
commit 4e7d9b80e0b9acce3360357eb871f45dc06117da
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 2 17:28:31 2012 +0100
yum: Convert all instances of Message(untrusted-package) to Package(untrusted)
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index ab31b77..f800890 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1785,7 +1785,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
if only_trusted:
self.error(ERROR_CANNOT_UPDATE_REPO_UNSIGNED, "The package %s will not be updated from unsigned repo %s" % (pkg.name, pkg.repoid), exit=False)
return
- self.message (MESSAGE_UNTRUSTED_PACKAGE, "The package %s from repo %s is untrusted" % (pkg.name, pkg.repoid))
+ self._show_package(pkg, INFO_UNTRUSTED)
try:
self._runYumTransaction(allow_skip_broken=True, only_simulate=False)
except PkError, e:
@@ -2024,8 +2024,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
if only_trusted:
self.error(ERROR_CANNOT_INSTALL_REPO_UNSIGNED, "The package %s will not be installed from unsigned repo %s" % (pkg.name, pkg.repoid), exit=False)
return
- self.message (MESSAGE_UNTRUSTED_PACKAGE, "The package %s from repo %s is untrusted" % (pkg.name, pkg.repoid))
-
+ self._show_package(pkg, INFO_UNTRUSTED)
try:
self._runYumTransaction(only_simulate=simulate)
except PkError, e:
@@ -2185,7 +2184,6 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
if only_trusted:
self.error(ERROR_MISSING_GPG_SIGNATURE, _to_unicode(e), exit=False)
return
- self.message (MESSAGE_UNTRUSTED_PACKAGE, "The package %s is untrusted" % po.name)
self._show_package(po, INFO_UNTRUSTED)
except exceptions.IOError, e:
self.error(ERROR_NO_SPACE_ON_DEVICE, "Disk error: %s" % _to_unicode(e))
@@ -2362,8 +2360,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
if only_trusted:
self.error(ERROR_CANNOT_UPDATE_REPO_UNSIGNED, "The package %s will not be updated from unsigned repo %s" % (pkg.name, pkg.repoid), exit=False)
return
- self.message (MESSAGE_UNTRUSTED_PACKAGE, "The package %s from repo %s is untrusted" % (pkg.name, pkg.repoid))
-
+ self._show_package(pkg, INFO_UNTRUSTED)
try:
self._runYumTransaction(allow_skip_broken=True, only_simulate=simulate)
except PkError, e:
commit b0985cecd057e184bd797a8004b3d5f26d525efc
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 2 17:27:54 2012 +0100
zif: Do not use Message(untrusted-package)
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index dcfd8b9..1061946 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -3626,13 +3626,6 @@ pk_backend_run_transaction (PkBackend *backend, ZifState *state)
(gpointer)pk_info_enum_to_string (PK_INFO_ENUM_UNTRUSTED));
g_ptr_array_add (untrusted_array,
package);
-
- /* ignore the trusted auth step */
- pk_backend_message (backend,
- PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE,
- "The package %s has trust %s",
- zif_package_get_printable (package),
- zif_package_trust_kind_to_string (trust_kind));
}
}
state_local = zif_state_get_child (state);
commit 6b2a71b2e62e633c35a672e43864d261bdf78d37
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 2 17:27:33 2012 +0100
aptcc: Do not use Message(untrusted-package)
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index d16a685..8d8e017 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -758,7 +758,8 @@ pk_backend_refresh_cache_thread (PkBackend *backend)
// missing gpg signature would appear here
// TODO we need a better enum
if (_error->PendingError() == false && _error->empty() == false) {
- show_warnings(backend, PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE);
+ //show_warnings(backend, PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE);
+ //TODO: emit a package with PK_INFO_ENUM_UNTRUSTED
}
delete m_apt;
commit cc05de18248b31e7227ecbf3da30f3809ba0cd40
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 2 17:26:10 2012 +0100
Deprecate Message(untrusted-package) from the API
Backends should use Package(untrusted,id,summary) so that clients can display
*which* packages are unsigned.
diff --git a/lib/packagekit-glib2/pk-enum.h b/lib/packagekit-glib2/pk-enum.h
index 77eba94..7c96d8a 100644
--- a/lib/packagekit-glib2/pk-enum.h
+++ b/lib/packagekit-glib2/pk-enum.h
@@ -249,7 +249,7 @@ typedef enum {
PK_MESSAGE_ENUM_BACKEND_ERROR,
PK_MESSAGE_ENUM_DAEMON_ERROR,
PK_MESSAGE_ENUM_CACHE_BEING_REBUILT,
- PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE,
+ PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE, /* this is deprecated */
PK_MESSAGE_ENUM_NEWER_PACKAGE_EXISTS,
PK_MESSAGE_ENUM_COULD_NOT_FIND_PACKAGE,
PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED,
diff --git a/lib/packagekit-glib2/pk-task.c b/lib/packagekit-glib2/pk-task.c
index 9674209..6187331 100644
--- a/lib/packagekit-glib2/pk-task.c
+++ b/lib/packagekit-glib2/pk-task.c
@@ -308,13 +308,12 @@ pk_task_simulate_ready_cb (GObject *source_object, GAsyncResult *res, PkTaskStat
{
PkTaskClass *klass = PK_TASK_GET_CLASS (state->task);
GError *error = NULL;
- PkResults *results;
- PkPackageSack *sack = NULL;
- guint length;
- guint i;
GPtrArray *array_messages = NULL;
- PkMessage *message;
- PkMessageEnum message_type;
+ guint i;
+ guint length;
+ PkPackageSack *sack = NULL;
+ PkPackageSack *untrusted_sack = NULL;
+ PkResults *results;
/* old results no longer valid */
if (state->results != NULL) {
@@ -353,26 +352,17 @@ pk_task_simulate_ready_cb (GObject *source_object, GAsyncResult *res, PkTaskStat
goto out;
}
+ /* get data */
+ sack = pk_results_get_package_sack (results);
+
/* if we did a simulate and we got a message that a package was untrusted,
* there's no point trying to do the action with only-trusted */
- if (state->simulate && state->only_trusted) {
- array_messages = pk_results_get_message_array (state->results);
- for (i = 0; i < array_messages->len; i++) {
- message = g_ptr_array_index (array_messages, i);
- g_object_get (message,
- "type", &message_type,
- NULL);
- if (message_type == PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE) {
- g_debug ("we got an untrusted message, so skipping only-trusted");
- state->only_trusted = FALSE;
- break;
- }
- }
+ untrusted_sack = pk_package_sack_filter_by_info (sack, PK_INFO_ENUM_UNTRUSTED);
+ if (pk_package_sack_get_size (untrusted_sack) > 0) {
+ g_debug ("we got an untrusted message, so skipping only-trusted");
+ state->only_trusted = FALSE;
}
- /* get data */
- sack = pk_results_get_package_sack (results);
-
/* remove all the packages we want to ignore */
pk_package_sack_remove_by_filter (sack, pk_task_package_filter_cb, state);
@@ -401,6 +391,8 @@ out:
g_object_unref (results);
if (sack != NULL)
g_object_unref (sack);
+ if (untrusted_sack != NULL)
+ g_object_unref (untrusted_sack);
return;
}
diff --git a/src/pk-backend.c b/src/pk-backend.c
index e3c3655..bacd07b 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1497,6 +1497,13 @@ pk_backend_message (PkBackend *backend, PkMessageEnum message, const gchar *form
goto out;
}
+ /* we've deprecated this */
+ if (message == PK_MESSAGE_ENUM_UNTRUSTED_PACKAGE) {
+ g_warning ("Do not use %s, instead indicate the package using Package(untrusted,package_id,summary)",
+ pk_message_enum_to_string (message));
+ goto out;
+ }
+
va_start (args, format);
g_vasprintf (&buffer, format, args);
va_end (args);
commit 0bfb3ec06e1a4cd6975fab22cdb04c83ba983202
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 2 16:23:32 2012 +0100
Add some documentation about the auto-untrusted logic
diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am
index 75d7397..0a4896d 100644
--- a/docs/api/Makefile.am
+++ b/docs/api/Makefile.am
@@ -56,6 +56,7 @@ HTML_IMAGES = \
spec/pk-transactions-download.png \
spec/pk-transactions-sig-install.png \
spec/pk-transactions-success.png \
+ spec/pk-transactions-auto-untrusted.png \
spec/pk-transactions-trusted.png
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
diff --git a/docs/api/spec/pk-concepts.xml b/docs/api/spec/pk-concepts.xml
index b74b532..632594e 100644
--- a/docs/api/spec/pk-concepts.xml
+++ b/docs/api/spec/pk-concepts.xml
@@ -863,6 +863,29 @@
</para>
</sect2>
+ <sect2 id="introduction-ideas-transactions-auto-untrusted">
+ <title>Transaction example: Auto Untrusted</title>
+ <mediaobject id="pk-transactions-auto-untrusted">
+ <imageobject>
+ <imagedata format="PNG" fileref="pk-transactions-auto-untrusted.png" align="center"/>
+ </imageobject>
+ </mediaobject>
+ <para>
+ If <literal>SimulateInstallPackage</literal> or
+ <literal>SimulateInstallFile</literal> is used then the client
+ may receive a <literal>INFO_UNTRUSTED</literal> package.
+ </para>
+ <para>
+ This is used to inform the client that the action would require
+ the untrusted authentication type, which means the client does
+ not attempt to do <literal>SimulateInstallPackage(only_trusted=TRUE)</literal>
+ and only does <literal>SimulateInstallPackage(only_trusted=FALSE)</literal>.
+ This ensures the user has to only authenticate once for the
+ transaction as the <literal>only_trusted=TRUE</literal> action
+ may also require a password.
+ </para>
+ </sect2>
+
<sect2 id="introduction-ideas-transactions-sig-install">
<title>Transaction example: Package signature install</title>
<mediaobject id="pk-transactions-sig-install">
diff --git a/docs/api/spec/pk-transactions-auto-untrusted.png b/docs/api/spec/pk-transactions-auto-untrusted.png
new file mode 100644
index 0000000..5217aa9
Binary files /dev/null and b/docs/api/spec/pk-transactions-auto-untrusted.png differ
diff --git a/docs/api/spec/pk-transactions.svg b/docs/api/spec/pk-transactions.svg
index 8ad37e0..152e121 100644
--- a/docs/api/spec/pk-transactions.svg
+++ b/docs/api/spec/pk-transactions.svg
@@ -81,6 +81,202 @@
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-7"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-2"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3300"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3302"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3304"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3306"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3308"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3310"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3312"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3314"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3316"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3318"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3320"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3322"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3324"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3326"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3328"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3330"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3332"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3334"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-9"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-6"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3516"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3518"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="marker3520"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3522"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mstart-0"
+ style="overflow:visible">
+ <path
+ inkscape:connector-curvature="0"
+ id="path3246-4"
+ style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(0.6,0.6)" />
+ </marker>
</defs>
<sodipodi:namedview
id="base"
@@ -92,19 +288,19 @@
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="1.4"
- inkscape:cx="246.57148"
- inkscape:cy="896.57354"
+ inkscape:zoom="1.979899"
+ inkscape:cx="147.99934"
+ inkscape:cy="-520.13479"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
borderlayer="true"
inkscape:showpageshadow="false"
- inkscape:window-width="1280"
- inkscape:window-height="951"
+ inkscape:window-width="1920"
+ inkscape:window-height="1172"
inkscape:window-x="0"
- inkscape:window-y="25"
- inkscape:window-maximized="0">
+ inkscape:window-y="0"
+ inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid2403"
@@ -1707,5 +1903,342 @@
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.75000000000000000;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none"
d="M 250,1337.3622 C 220,1337.3622 220,1337.3622 220,1337.3622"
id="path2729" />
+ <rect
+ style="fill:none;stroke:#000000;stroke-width:0.55129081;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ id="rect6503-7"
+ width="475"
+ height="310"
+ x="29.94306"
+ y="1412.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <rect
+ style="opacity:0.76146785;fill:#8d5fd3;fill-opacity:1"
+ id="rect6269-2"
+ width="35"
+ height="150"
+ x="464.94305"
+ y="1437.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <rect
+ style="opacity:0.76146785;fill:#ff8080;fill-opacity:1"
+ id="rect2405-2"
+ width="35"
+ height="300"
+ x="249.94305"
+ y="1417.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <rect
+ style="opacity:0.76146785;fill:#5fd38d;fill-opacity:1"
+ id="rect2407-6"
+ width="35"
+ height="300"
+ x="34.943062"
+ y="1417.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-1566.495"
+ y="59.943062"
+ id="text2413-0"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan2415-6"
+ x="-1566.495"
+ y="59.943062"
+ style="font-size:20px;text-align:center;text-anchor:middle">Manager</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-1512.1825"
+ y="489.94305"
+ id="text2417-1"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan2419-5"
+ x="-1512.1825"
+ y="489.94305"
+ style="font-size:20px;text-align:center;text-anchor:middle">Tran #1</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-1566.4169"
+ y="274.94305"
+ id="text2421-9"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan2423-4"
+ x="-1566.4169"
+ y="274.94305"
+ style="font-size:20px;text-align:center;text-anchor:middle">Client</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 459.88612,1452.3622 -174.94306,0"
+ id="path6109-9"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.75172305;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 74.94306,1432.3622 174.87185,0"
+ id="path6113-0"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="164.2829"
+ y="1427.3622"
+ id="text6115-9"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6117-1"
+ x="164.2829"
+ y="1427.3622"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">GetTid()</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.39060569;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 244.91321,1442.3691 -125.38793,0 -9.6421,-10.035"
+ id="path6119-7"
+ sodipodi:nodetypes="ccc"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="362.2829"
+ y="1447.3622"
+ id="text6121-7"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6123-1"
+ x="362.2829"
+ y="1447.3622"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">SimulateInstallPkg(p)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290,1492.3622 174.94306,0"
+ id="path6125-1"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="387.12274"
+ y="1487.3622"
+ id="text6127-5"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6129-9"
+ x="387.12274"
+ y="1487.3622"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Package(installing, p)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 289.94306,1532.3622 174.94306,0"
+ id="path6239-8"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:37.75381088px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="409.20782"
+ y="1441.5935"
+ id="text6241-1"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"
+ transform="scale(0.94384518,1.0594958)"><tspan
+ sodipodi:role="line"
+ id="tspan6243-2"
+ x="409.20782"
+ y="1441.5935"
+ style="font-size:11.32614231px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Package(untrusted, p)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.75172305;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 75.02985,1612.3553 174.87185,0"
+ id="path6253-9"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="164.36969"
+ y="1607.3552"
+ id="text6255-3"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6257-9"
+ x="164.36969"
+ y="1607.3552"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">GetTid()</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.39060569;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 245,1622.3622 -125.38793,0 -9.6421,-10.035"
+ id="path6259-0"
+ sodipodi:nodetypes="ccc"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <rect
+ style="opacity:0.76146785;fill:#8d5fd3;fill-opacity:1"
+ id="rect2411-1-3"
+ width="35"
+ height="115"
+ x="465"
+ y="1602.3622"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 459.53741,1622.3622 -174.94306,0"
+ id="path6131-7-8"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="362.90131"
+ y="1617.3622"
+ id="text6133-7-5"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6135-6-6"
+ x="362.90131"
+ y="1617.3622"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">InstallPkg(untrusted, p)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.05694,1662.3622 174.94306,0"
+ id="path6159-7-1"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="380.66016"
+ y="1657.3622"
+ id="text6161-3-1"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6163-6-5"
+ x="380.66016"
+ y="1657.3622"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Package(installing)</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 290.05694,1702.3622 174.94306,0"
+ id="path6165-5-9"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="380.66016"
+ y="1697.3622"
+ id="text6167-6-8"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6169-3-4"
+ x="380.66016"
+ y="1697.3622"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(success)</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="-1663.1825"
+ y="490"
+ id="text6265-8-8"
+ transform="matrix(0,-1,1,0,0,0)"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
+ sodipodi:role="line"
+ id="tspan6267-8-1"
+ x="-1663.1825"
+ y="490"
+ style="font-size:20px;text-align:center;text-anchor:middle">Tran #2</tspan></text>
+ <path
+ inkscape:connector-curvature="0"
+ style="fill:none;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow2Mstart)"
+ d="m 288.71421,1572.3621 174.94306,0"
+ id="path6239-8-8"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
+ <text
+ xml:space="preserve"
+ style="font-size:37.75381088px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="407.90588"
+ y="1479.3473"
+ id="text6241-1-8"
+ sodipodi:linespacing="125%"
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-auto-untrusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"
+ transform="scale(0.94384518,1.0594958)"><tspan
+ sodipodi:role="line"
+ id="tspan6243-2-8"
+ x="407.90588"
+ y="1479.3473"
+ style="font-size:11.32614231px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(success)</tspan></text>
</g>
</svg>
commit e8174800c75240379f804ff4a3c6032d49a03a69
Author: Nils Philippsen <nils at redhat.com>
Date: Thu Mar 29 12:02:31 2012 +0200
yum: always set GPG checking members if present
This fixes a regression introduced in commit
1055c52d723346006d8bbb7e0f2b324c9de9b82f which caused users to be asked
to authorize installing signed packages when they were unsigned, i.e.
untrusted (see rhbz#717566).
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 8f6db33..ab31b77 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1721,25 +1721,23 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
def _set_only_trusted(self, only_trusted):
# if only_trusted is true, it means that we will only install/update
- # signed files
-
- # _override_sigchecks logic is reversed
- override_sigchecks = not only_trusted
+ # signed files and fail on unsigned ones
if hasattr(self.yumbase, "_override_sigchecks"):
- # yum >= 3.2.29:
+ # _override_sigchecks logic is reversed
+ override_sigchecks = not only_trusted
+
self.yumbase._override_sigchecks = override_sigchecks
for repo in self.yumbase.repos.listEnabled():
repo._override_sigchecks = override_sigchecks
- else:
- # yum < 3.2.29:
- for attrname in ("gpgcheck", "repo_gpgcheck", "localpkg_gpgcheck"):
+ for attrname in ("gpgcheck", "repo_gpgcheck", "localpkg_gpgcheck"):
+ if hasattr(self.yumbase.conf, attrname):
setattr(self.yumbase.conf, attrname, only_trusted)
- for attrname in ("gpgcheck", "repo_gpgcheck"):
- for repo in self.yumbase.repos.listEnabled():
+ for repo in self.yumbase.repos.listEnabled():
+ if hasattr(repo, attrname):
setattr(repo, attrname, only_trusted)
commit 42ea6690d55928fba7ef76a7bc819ac58632c6de
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 29 17:23:16 2012 +0100
trivial: remove the debugging comment left in
diff --git a/lib/packagekit-glib2/pk-control.c b/lib/packagekit-glib2/pk-control.c
index e205dcb..5aa62c1 100644
--- a/lib/packagekit-glib2/pk-control.c
+++ b/lib/packagekit-glib2/pk-control.c
@@ -352,7 +352,7 @@ pk_control_signal_cb (GDBusProxy *proxy,
goto out;
}
if (g_strcmp0 (signal_name, "Changed") == 0) {
- g_warning ("do something?");
+ /* we don't need to do anything here */
goto out;
}
if (g_strcmp0 (signal_name, "RestartSchedule") == 0) {
commit 1c065095663cd5ca0c7ec3c04bc075aa698d328f
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 29 14:50:57 2012 +0100
trivial: update the API docs diagram to reflect reality
diff --git a/docs/api/spec/pk-transactions-trusted.png b/docs/api/spec/pk-transactions-trusted.png
index 4085e8a..d2dd8ec 100644
Binary files a/docs/api/spec/pk-transactions-trusted.png and b/docs/api/spec/pk-transactions-trusted.png differ
diff --git a/docs/api/spec/pk-transactions.svg b/docs/api/spec/pk-transactions.svg
index f19062f..8ad37e0 100644
--- a/docs/api/spec/pk-transactions.svg
+++ b/docs/api/spec/pk-transactions.svg
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
@@ -12,12 +13,13 @@
height="1052.3622047"
id="svg2"
sodipodi:version="0.32"
- inkscape:version="0.46"
+ inkscape:version="0.48.2 r9819"
sodipodi:docname="pk-transactions.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/html/pk-transactions.png"
inkscape:export-xdpi="89.970497"
- inkscape:export-ydpi="89.970497">
+ inkscape:export-ydpi="89.970497"
+ version="1.1">
<defs
id="defs4">
<marker
@@ -91,8 +93,8 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
- inkscape:cx="245.14291"
- inkscape:cy="-303.42646"
+ inkscape:cx="246.57148"
+ inkscape:cy="896.57354"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
@@ -101,7 +103,8 @@
inkscape:window-width="1280"
inkscape:window-height="951"
inkscape:window-x="0"
- inkscape:window-y="25">
+ inkscape:window-y="25"
+ inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid2403"
@@ -120,6 +123,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@@ -164,9 +168,9 @@
height="255"
x="30"
y="12.362183"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<rect
style="opacity:0.76146784999999984;fill:#8d5fd3;fill-opacity:1"
id="rect6269"
@@ -174,9 +178,9 @@
height="105"
x="465"
y="37.362183"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<rect
style="opacity:0.76146784999999984;fill:#ff8080;fill-opacity:1"
id="rect2405"
@@ -184,9 +188,9 @@
height="245"
x="250"
y="17.362183"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<rect
style="opacity:0.76146784999999984;fill:#5fd38d;fill-opacity:1"
id="rect2407"
@@ -194,9 +198,9 @@
height="245"
x="35"
y="17.362183"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<rect
style="opacity:0.76146784999999984;fill:#8d5fd3;fill-opacity:1"
id="rect2411"
@@ -204,9 +208,9 @@
height="110"
x="465"
y="152.36218"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
@@ -214,9 +218,9 @@
y="60"
id="text2413"
transform="matrix(0,-1,1,0,0,0)"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan2415"
x="-128.495"
@@ -229,9 +233,9 @@
y="490"
id="text2417"
transform="matrix(0,-1,1,0,0,0)"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan2419"
x="-88.182495"
@@ -244,9 +248,9 @@
y="275"
id="text2421"
transform="matrix(0,-1,1,0,0,0)"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan2423"
x="-128.41687"
@@ -256,16 +260,16 @@
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 459.94306,52.36218 L 285,52.36218"
id="path6109"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.75172305;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 75,32.36218 L 249.87185,32.36218"
id="path6113"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
@@ -273,9 +277,9 @@
y="27.362183"
id="text6115"
sodipodi:linespacing="125%"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan6117"
x="164.33984"
@@ -286,9 +290,9 @@
d="M 244.97015,42.36906 L 119.58222,42.36906 L 109.94012,32.33406"
id="path6119"
sodipodi:nodetypes="ccc"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
@@ -296,9 +300,9 @@
y="47.362183"
id="text6121"
sodipodi:linespacing="125%"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan6123"
x="370.33984"
@@ -308,31 +312,31 @@
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 290.05694,92.36218 L 465,92.36218"
id="path6125"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
- style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
- x="381.17969"
+ style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="387.17969"
y="87.362183"
id="text6127"
sodipodi:linespacing="125%"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan6129"
- x="381.17969"
+ x="387.17969"
y="87.362183"
- style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::ErrorCode(no-sig)</tspan></text>
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::ErrorCode(bad-gpg-sig)</tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 459.53741,172.36218 L 284.59435,172.36218"
id="path6131"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
@@ -340,9 +344,9 @@
y="167.36218"
id="text6133"
sodipodi:linespacing="125%"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan6135"
x="362.90131"
@@ -352,9 +356,9 @@
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 289.53741,212.36218 L 464.48047,212.36218"
id="path6159"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
@@ -362,9 +366,9 @@
y="207.36218"
id="text6161"
sodipodi:linespacing="125%"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan6163"
x="380.66016"
@@ -374,9 +378,9 @@
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 289.53741,252.36218 L 464.48047,252.36218"
id="path6165"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
@@ -384,9 +388,9 @@
y="247.36218"
id="text6167"
sodipodi:linespacing="125%"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan6169"
x="380.66016"
@@ -586,24 +590,25 @@
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 290,132.36218 L 464.94306,132.36218"
id="path6239"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
- style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
- x="381.12274"
- y="127.36218"
+ style="font-size:37.75381088px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans"
+ x="409.26813"
+ y="120.21018"
id="text6241"
sodipodi:linespacing="125%"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"
+ transform="scale(0.9438452,1.0594958)"><tspan
sodipodi:role="line"
id="tspan6243"
- x="381.12274"
- y="127.36218"
- style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(failure)</tspan></text>
+ x="409.26813"
+ y="120.21018"
+ style="font-size:11.32614231px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;font-family:Sans;-inkscape-font-specification:Sans">::Finished(need-untrusted)</tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.7523787;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 290.6546,397.36218 L 465.59766,397.36218"
@@ -630,9 +635,9 @@
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:3.75172305;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 75,152.36218 L 249.87185,152.36218"
id="path6253"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
@@ -640,9 +645,9 @@
y="147.36218"
id="text6255"
sodipodi:linespacing="125%"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan6257"
x="164.33984"
@@ -653,9 +658,9 @@
d="M 244.97015,162.36906 L 119.58222,162.36906 L 109.94012,152.33406"
id="path6259"
sodipodi:nodetypes="ccc"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180" />
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635" />
<text
xml:space="preserve"
style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Sans;-inkscape-font-specification:Sans"
@@ -663,9 +668,9 @@
y="490"
id="text6265"
transform="matrix(0,-1,1,0,0,0)"
- inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/spec/pk-transactions-trusted.png"
- inkscape:export-xdpi="180"
- inkscape:export-ydpi="180"><tspan
+ inkscape:export-filename="/home/hughsie/Code/PackageKit/docs/api/spec/pk-transactions-trusted.png"
+ inkscape:export-xdpi="90.094635"
+ inkscape:export-ydpi="90.094635"><tspan
sodipodi:role="line"
id="tspan6267"
x="-213.1825"
commit 8c1b5c4767653d746ee87a653253e7e54f54d4e2
Author: Stef Walter <stefw at gnome.org>
Date: Thu Mar 29 13:20:49 2012 +0200
Install pk-task-sync.h as part of the public API
https://bugs.freedesktop.org/show_bug.cgi?id=48044
diff --git a/docs/api/PackageKit-docs.sgml b/docs/api/PackageKit-docs.sgml
index 021156e..b107b72 100644
--- a/docs/api/PackageKit-docs.sgml
+++ b/docs/api/PackageKit-docs.sgml
@@ -103,6 +103,7 @@
<xi:include href="xml/pk-enum.xml"/>
<xi:include href="xml/pk-package-ids.xml"/>
<xi:include href="xml/pk-package-id.xml"/>
+ <xi:include href="xml/pk-task-sync.xml"/>
</reference>
<reference id="faq">
diff --git a/lib/packagekit-glib2/Makefile.am b/lib/packagekit-glib2/Makefile.am
index d693dd2..5da708c 100644
--- a/lib/packagekit-glib2/Makefile.am
+++ b/lib/packagekit-glib2/Makefile.am
@@ -67,6 +67,7 @@ HEADER_FILES = \
pk-service-pack.h \
pk-source.h \
pk-task.h \
+ pk-task-sync.h \
pk-transaction-past.h \
pk-transaction-list.h \
pk-update-detail.h \
@@ -148,6 +149,8 @@ libpackagekit_glib2_la_SOURCES = \
pk-source.h \
pk-task.c \
pk-task.h \
+ pk-task-sync.c \
+ pk-task-sync.h \
pk-transaction-past.c \
pk-transaction-past.h \
pk-transaction-list.c \
@@ -182,8 +185,6 @@ libpackagekitprivate_a_SOURCES = \
pk-console-shared.h \
pk-progress-bar.c \
pk-progress-bar.h \
- pk-task-sync.c \
- pk-task-sync.h \
pk-task-text.c \
pk-task-text.h \
pk-task-wrapper.c \
diff --git a/lib/packagekit-glib2/packagekit.h b/lib/packagekit-glib2/packagekit.h
index 63b0e87..7083a0a 100644
--- a/lib/packagekit-glib2/packagekit.h
+++ b/lib/packagekit-glib2/packagekit.h
@@ -57,6 +57,7 @@
#include <packagekit-glib2/pk-results.h>
#include <packagekit-glib2/pk-service-pack.h>
#include <packagekit-glib2/pk-task.h>
+#include <packagekit-glib2/pk-task-sync.h>
#include <packagekit-glib2/pk-transaction-past.h>
#include <packagekit-glib2/pk-transaction-list.h>
#include <packagekit-glib2/pk-update-detail.h>
diff --git a/lib/packagekit-glib2/pk-task-sync.c b/lib/packagekit-glib2/pk-task-sync.c
index 4d8b226..66a5990 100644
--- a/lib/packagekit-glib2/pk-task-sync.c
+++ b/lib/packagekit-glib2/pk-task-sync.c
@@ -57,7 +57,7 @@ pk_task_generic_finish_sync (PkTask *task, GAsyncResult *res, PkTaskHelper *help
* pk_task_update_system_sync:
* @task: a valid #PkTask instance
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
@@ -71,7 +71,7 @@ pk_task_generic_finish_sync (PkTask *task, GAsyncResult *res, PkTaskHelper *help
* Warning: this function is synchronous, and may block. Do not use it in GUI
* applications.
*
- * Return value: a %PkResults object, or NULL for error
+ * Return value: (transfer full): a %PkResults object, or NULL for error
*
* Since: 0.5.3
**/
@@ -112,7 +112,7 @@ pk_task_update_system_sync (PkTask *task, GCancellable *cancellable,
* @allow_deps: if other dependent packages are allowed to be removed from the computer
* @autoremove: if other packages installed at the same time should be tried to remove
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
@@ -123,7 +123,7 @@ pk_task_update_system_sync (PkTask *task, GCancellable *cancellable,
* Warning: this function is synchronous, and may block. Do not use it in GUI
* applications.
*
- * Return value: a %PkResults object, or NULL for error
+ * Return value: (transfer full): a %PkResults object, or NULL for error
*
* Since: 0.5.3
**/
@@ -162,7 +162,7 @@ pk_task_remove_packages_sync (PkTask *task, gchar **package_ids, gboolean allow_
* @task: a valid #PkTask instance
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
@@ -171,7 +171,7 @@ pk_task_remove_packages_sync (PkTask *task, gchar **package_ids, gboolean allow_
* Warning: this function is synchronous, and may block. Do not use it in GUI
* applications.
*
- * Return value: a %PkResults object, or NULL for error
+ * Return value: (transfer full): a %PkResults object, or NULL for error
*
* Since: 0.5.3
**/
@@ -210,7 +210,7 @@ pk_task_install_packages_sync (PkTask *task, gchar **package_ids, GCancellable *
* @task: a valid #PkTask instance
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
@@ -219,7 +219,7 @@ pk_task_install_packages_sync (PkTask *task, gchar **package_ids, GCancellable *
* Warning: this function is synchronous, and may block. Do not use it in GUI
* applications.
*
- * Return value: a %PkResults object, or NULL for error
+ * Return value: (transfer full): a %PkResults object, or NULL for error
*
* Since: 0.5.3
**/
@@ -258,7 +258,7 @@ pk_task_update_packages_sync (PkTask *task, gchar **package_ids, GCancellable *c
* @task: a valid #PkTask instance
* @files: (array zero-terminated=1): a file such as "/home/hughsie/Desktop/hal-devel-0.10.0.rpm"
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
@@ -268,7 +268,7 @@ pk_task_update_packages_sync (PkTask *task, gchar **package_ids, GCancellable *c
* Warning: this function is synchronous, and may block. Do not use it in GUI
* applications.
*
- * Return value: a %PkResults object, or NULL for error
+ * Return value: (transfer full): a %PkResults object, or NULL for error
*
* Since: 0.5.3
**/
@@ -308,13 +308,15 @@ pk_task_install_files_sync (PkTask *task, gchar **files, GCancellable *cancellab
* @filters: a bitfield of filters that can be used to limit the results
* @packages: package names to find
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Resolves a package name to a package-id.
*
* Since: 0.6.5
+ *
+ * Return value: (transfer full): a %PkResults object, or NULL for error
**/
PkResults *
pk_task_resolve_sync (PkTask *task, PkBitfield filters, gchar **packages, GCancellable *cancellable,
@@ -353,13 +355,15 @@ pk_task_resolve_sync (PkTask *task, PkBitfield filters, gchar **packages, GCance
* @filters: a bitfield of filters that can be used to limit the results
* @values: (array zero-terminated=1): search values
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Searches for a package name.
*
* Since: 0.6.5
+ *
+ * Return value: (transfer full): a %PkResults object, or NULL for error
**/
PkResults *
pk_task_search_names_sync (PkTask *task, PkBitfield filters, gchar **values, GCancellable *cancellable,
@@ -398,13 +402,15 @@ pk_task_search_names_sync (PkTask *task, PkBitfield filters, gchar **values, GCa
* @filters: a bitfield of filters that can be used to limit the results
* @values: (array zero-terminated=1): search values
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Searches for some package details.
*
* Since: 0.6.5
+ *
+ * Return value: (transfer full): a %PkResults object, or NULL for error
**/
PkResults *
pk_task_search_details_sync (PkTask *task, PkBitfield filters, gchar **values, GCancellable *cancellable,
@@ -443,12 +449,14 @@ pk_task_search_details_sync (PkTask *task, PkBitfield filters, gchar **values, G
* @filters: a bitfield of filters that can be used to limit the results
* @values: (array zero-terminated=1): search values
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Searches the group lists.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -488,12 +496,14 @@ pk_task_search_groups_sync (PkTask *task, PkBitfield filters, gchar **values, GC
* @filters: a bitfield of filters that can be used to limit the results
* @values: (array zero-terminated=1): search values
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Searches for specific files.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -532,12 +542,14 @@ pk_task_search_files_sync (PkTask *task, PkBitfield filters, gchar **values, GCa
* @task: a valid #PkTask instance
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Gets details about packages.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -576,12 +588,14 @@ pk_task_get_details_sync (PkTask *task, gchar **package_ids, GCancellable *cance
* @task: a valid #PkTask instance
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Gets details about updates.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -621,12 +635,14 @@ pk_task_get_update_detail_sync (PkTask *task, gchar **package_ids, GCancellable
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
* @directory: the destination directory
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Downloads packages
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -665,12 +681,14 @@ pk_task_download_packages_sync (PkTask *task, gchar **package_ids, const gchar *
* @task: a valid #PkTask instance
* @filters: a bitfield of filters that can be used to limit the results
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Gets the update lists.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -711,12 +729,14 @@ pk_task_get_updates_sync (PkTask *task, PkBitfield filters, GCancellable *cancel
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
* @recursive: if we should recurse to packages that depend on other packages
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Get the list of dependent packages.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -755,12 +775,14 @@ pk_task_get_depends_sync (PkTask *task, PkBitfield filters, gchar **package_ids,
* @task: a valid #PkTask instance
* @filters: a bitfield of filters that can be used to limit the results
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Gets the list of packages.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -801,12 +823,14 @@ pk_task_get_packages_sync (PkTask *task, PkBitfield filters, GCancellable *cance
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
* @recursive: if we should return packages that depend on the ones we do
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Get the packages this package requires.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -847,12 +871,14 @@ pk_task_get_requires_sync (PkTask *task, PkBitfield filters, gchar **package_ids
* @provides: a #PkProvidesEnum type
* @values: (array zero-terminated=1): values to search for
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Find the package that provides some resource.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -891,12 +917,14 @@ pk_task_what_provides_sync (PkTask *task, PkBitfield filters, PkProvidesEnum pro
* @task: a valid #PkTask instance
* @package_ids: (array zero-terminated=1): a null terminated array of package_id structures such as "hal;0.0.1;i386;fedora"
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Get the files in a package.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -934,12 +962,14 @@ pk_task_get_files_sync (PkTask *task, gchar **package_ids, GCancellable *cancell
* pk_task_get_categories_sync:
* @task: a valid #PkTask instance
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Get the categories available.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -978,12 +1008,14 @@ pk_task_get_categories_sync (PkTask *task, GCancellable *cancellable,
* @task: a valid #PkTask instance
* @force: if the metadata should be deleted and re-downloaded even if it is correct
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Refresh the package cache.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -1022,12 +1054,14 @@ pk_task_refresh_cache_sync (PkTask *task, gboolean force, GCancellable *cancella
* @task: a valid #PkTask instance
* @transaction_id: The transaction ID of the old transaction
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Rollback to a previous package state.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -1066,12 +1100,14 @@ pk_task_rollback_sync (PkTask *task, const gchar *transaction_id, GCancellable *
* @task: a valid #PkTask instance
* @filters: a bitfield of filters that can be used to limit the results
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Get the list of available repositories.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -1111,12 +1147,14 @@ pk_task_get_repo_list_sync (PkTask *task, PkBitfield filters, GCancellable *canc
* @repo_id: The software source ID
* @enabled: %TRUE or %FALSE
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
* Enable or disable a specific repo.
*
+ * Return value: (transfer full): a %PkResults object, or NULL for error
+ *
* Since: 0.6.5
**/
PkResults *
@@ -1154,7 +1192,7 @@ pk_task_repo_enable_sync (PkTask *task, const gchar *repo_id, gboolean enabled,
* pk_task_repair_system_sync:
* @task: a valid #PkTask instance
* @cancellable: a #GCancellable or %NULL
- * @progress_callback: the function to run when the progress changes
+ * @progress_callback: (scope call): the function to run when the progress changes
* @progress_user_data: data to pass to @progress_callback
* @error: the #GError to store any failure, or %NULL
*
@@ -1164,7 +1202,7 @@ pk_task_repo_enable_sync (PkTask *task, const gchar *repo_id, gboolean enabled,
* Warning: this function is synchronous, and may block. Do not use it in GUI
* applications.
*
- * Return value: a %PkResults object, or NULL for error
+ * Return value: (transfer full): a %PkResults object, or NULL for error
*
* Since: 0.7.2
**/
diff --git a/lib/packagekit-glib2/pk-task-sync.h b/lib/packagekit-glib2/pk-task-sync.h
index 492a4de..61a7223 100644
--- a/lib/packagekit-glib2/pk-task-sync.h
+++ b/lib/packagekit-glib2/pk-task-sync.h
@@ -19,6 +19,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#if !defined (__PACKAGEKIT_H_INSIDE__) && !defined (PK_COMPILATION)
+#error "Only <packagekit.h> can be included directly."
+#endif
+
#ifndef __PK_TASK_SYNC_H
#define __PK_TASK_SYNC_H
commit ec74897acc201c0030d7ee7ccf5803a4eaf6ce5e
Author: Stef Walter <stefw at gnome.org>
Date: Thu Mar 29 15:27:23 2012 +0200
Actually include the enum types in the build
* Since BUILT_SOURCES is not in the build, include in the
build and fix up other build errors.
https://bugs.freedesktop.org/show_bug.cgi?id=48038
diff --git a/lib/packagekit-glib2/Makefile.am b/lib/packagekit-glib2/Makefile.am
index d5adab6..d693dd2 100644
--- a/lib/packagekit-glib2/Makefile.am
+++ b/lib/packagekit-glib2/Makefile.am
@@ -108,6 +108,8 @@ libpackagekit_glib2_la_SOURCES = \
pk-distro-upgrade.h \
pk-enum.c \
pk-enum.h \
+ pk-enum-types.c \
+ pk-enum-types.h \
pk-error.c \
pk-error.h \
pk-eula-required.c \
diff --git a/lib/packagekit-glib2/pk-catalog.c b/lib/packagekit-glib2/pk-catalog.c
index 0a56c1f..4bcd19d 100644
--- a/lib/packagekit-glib2/pk-catalog.c
+++ b/lib/packagekit-glib2/pk-catalog.c
@@ -102,21 +102,6 @@ pk_catalog_error_quark (void)
* pk_catalog_error_get_type:
**/
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-GType
-pk_catalog_error_get_type (void)
-{
- static GType etype = 0;
-
- if (etype == 0) {
- static const GEnumValue values[] =
- {
- ENUM_ENTRY (PK_CATALOG_ERROR_FAILED, "Failed"),
- { 0, NULL, NULL }
- };
- etype = g_enum_register_static ("PkCatalogError", values);
- }
- return etype;
-}
/**
* pk_catalog_mode_to_string:
diff --git a/lib/packagekit-glib2/pk-catalog.h b/lib/packagekit-glib2/pk-catalog.h
index 2e7c360..0e5ab58 100644
--- a/lib/packagekit-glib2/pk-catalog.h
+++ b/lib/packagekit-glib2/pk-catalog.h
@@ -73,7 +73,6 @@ struct _PkCatalogClass
};
GQuark pk_catalog_error_quark (void);
-GType pk_catalog_error_get_type (void);
GType pk_catalog_get_type (void);
PkCatalog *pk_catalog_new (void);
void pk_catalog_test (gpointer user_data);
diff --git a/lib/packagekit-glib2/pk-service-pack.c b/lib/packagekit-glib2/pk-service-pack.c
index 339012e..bade4b3 100644
--- a/lib/packagekit-glib2/pk-service-pack.c
+++ b/lib/packagekit-glib2/pk-service-pack.c
@@ -112,26 +112,6 @@ pk_service_pack_error_quark (void)
* pk_service_pack_error_get_type:
**/
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-GType
-pk_service_pack_error_get_type (void)
-{
- static GType etype = 0;
-
- if (etype == 0) {
- static const GEnumValue values[] =
- {
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_SETUP, "FailedSetup"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_DOWNLOAD, "FailedDownload"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION, "FailedExtraction"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_CREATE, "FailedCreate"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_NOTHING_TO_DO, "NothingToDo"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_NOT_COMPATIBLE, "NotCompatible"),
- { 0, NULL, NULL }
- };
- etype = g_enum_register_static ("PkServicePackError", values);
- }
- return etype;
-}
/**
* pk_service_pack_check_metadata_file:
diff --git a/lib/packagekit-glib2/pk-service-pack.h b/lib/packagekit-glib2/pk-service-pack.h
index 3a7cbeb..469655b 100644
--- a/lib/packagekit-glib2/pk-service-pack.h
+++ b/lib/packagekit-glib2/pk-service-pack.h
@@ -77,7 +77,6 @@ struct _PkServicePackClass
};
GQuark pk_service_pack_error_quark (void);
-GType pk_service_pack_error_get_type (void);
GType pk_service_pack_get_type (void);
PkServicePack *pk_service_pack_new (void);
void pk_service_pack_test (gpointer user_data);
commit 55bedb1c34e776bb3a632f1f7cec3badf3a5f9c4
Author: Stef Walter <stefw at gnome.org>
Date: Thu Mar 29 11:56:13 2012 +0200
Add GType's for packagekit-glib2 enumerations
https://bugs.freedesktop.org/show_bug.cgi?id=48038
diff --git a/configure.ac b/configure.ac
index f1dcc29..89d5d2a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,6 +81,7 @@ AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
GTK_DOC_CHECK([1.11],[--flavour no-tmpl])
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
+AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
AM_PATH_PYTHON([2.7])
PYTHON_PACKAGE_DIR=${pythondir}/packagekit
diff --git a/lib/packagekit-glib2/Makefile.am b/lib/packagekit-glib2/Makefile.am
index ead4160..d5adab6 100644
--- a/lib/packagekit-glib2/Makefile.am
+++ b/lib/packagekit-glib2/Makefile.am
@@ -34,7 +34,7 @@ lib_LTLIBRARIES = \
libpackagekit_glib2_includedir = $(includedir)/PackageKit/packagekit-glib2
-libpackagekit_glib2_include_HEADERS = \
+HEADER_FILES = \
packagekit.h \
pk-bitfield.h \
pk-catalog.h \
@@ -73,6 +73,11 @@ libpackagekit_glib2_include_HEADERS = \
pk-version.h \
$(NULL)
+libpackagekit_glib2_include_HEADERS = \
+ $(HEADER_FILES) \
+ pk-enum-types.h \
+ $(NULL)
+
libpackagekit_glib2_la_SOURCES = \
packagekit.h \
pk-bitfield.c \
@@ -218,11 +223,16 @@ endif
EXTRA_DIST = \
packagekit-glib2.pc.in \
pk-version.h.in \
- pk-marshal.list
+ pk-marshal.list \
+ pk-enum-types.h.template \
+ pk-enum-types.c.template \
+ $(NULL)
BUILT_SOURCES = \
pk-marshal.c \
pk-marshal.h \
+ pk-enum-types.h \
+ pk-enum-types.c \
$(NULL)
pk-marshal.c: pk-marshal.list
@@ -232,6 +242,12 @@ pk-marshal.c: pk-marshal.list
pk-marshal.h: pk-marshal.list
@GLIB_GENMARSHAL@ $< --prefix=pk_marshal --header > $@
+pk-enum-types.h: pk-enum-types.h.template $(HEADER_FILES)
+ $(AM_V_GEN) $(GLIB_MKENUMS) --template $^ > $@
+
+pk-enum-types.c: pk-enum-types.c.template $(HEADER_FILES)
+ $(AM_V_GEN) $(GLIB_MKENUMS) --template $^ > $@
+
CLEANFILES = $(BUILT_SOURCES) *.a *.servicepack
if HAVE_INTROSPECTION
diff --git a/lib/packagekit-glib2/packagekit.h b/lib/packagekit-glib2/packagekit.h
index 7548efa..63b0e87 100644
--- a/lib/packagekit-glib2/packagekit.h
+++ b/lib/packagekit-glib2/packagekit.h
@@ -40,6 +40,7 @@
#include <packagekit-glib2/pk-details.h>
#include <packagekit-glib2/pk-distro-upgrade.h>
#include <packagekit-glib2/pk-enum.h>
+#include <packagekit-glib2/pk-enum-types.h>
#include <packagekit-glib2/pk-error.h>
#include <packagekit-glib2/pk-eula-required.h>
#include <packagekit-glib2/pk-files.h>
diff --git a/lib/packagekit-glib2/pk-enum-types.c.template b/lib/packagekit-glib2/pk-enum-types.c.template
new file mode 100644
index 0000000..683cbda
--- /dev/null
+++ b/lib/packagekit-glib2/pk-enum-types.c.template
@@ -0,0 +1,43 @@
+/*** BEGIN file-header ***/
+
+#include <glib-object.h>
+
+#ifndef PK_COMPILATION
+#define PK_COMPILATION
+#endif
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+#include "@filename@"
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name at _get_type (void) G_GNUC_CONST;
+
+GType
+ at enum_name@_get_type (void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const G at Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ etype = g_ at type@_register_static (g_intern_static_string ("@EnumName@"), values);
+ }
+ return etype;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+ /**/
+/*** END file-tail ***/
diff --git a/lib/packagekit-glib2/pk-enum-types.h.template b/lib/packagekit-glib2/pk-enum-types.h.template
new file mode 100644
index 0000000..c42c9e5
--- /dev/null
+++ b/lib/packagekit-glib2/pk-enum-types.h.template
@@ -0,0 +1,28 @@
+/*** BEGIN file-header ***/
+#if !defined (__PACKAGEKIT_H_INSIDE__) && !defined (PK_COMPILATION)
+#error "Only <packagekit.h> can be included directly."
+#endif
+
+#ifndef __PK_ENUM_TYPES_H__
+#define __PK_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name at _get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX at _TYPE_@ENUMSHORT@ (@enum_name at _get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __PK_ENUM_TYPES_H__ */
+/*** END file-tail ***/
commit 75efd24e3db49c8a489c2cdc37673bfcce03738b
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 22 11:07:37 2012 +0000
Do not allow an empty resolve call to be passed down to the backends
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 0c72a04..dd009e8 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -4663,6 +4663,13 @@ pk_transaction_resolve (PkTransaction *transaction,
/* check for length sanity */
length = g_strv_length (packages);
+ if (length == 0) {
+ error = g_error_new (PK_TRANSACTION_ERROR,
+ PK_TRANSACTION_ERROR_INPUT_INVALID,
+ "Too few items to process");
+ pk_transaction_release_tid (transaction);
+ goto out;
+ }
max_length = pk_conf_get_int (transaction->priv->conf, "MaximumItemsToResolve");
if (length > max_length) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INPUT_INVALID,
commit 71696da1852616fb4d7679db74cfb7c36399d01a
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 22 11:05:08 2012 +0000
zif: Fix segfault of the daemon when a program does Resolve("")
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c
index 6116341..dcfd8b9 100644
--- a/backends/zif/pk-backend-zif.c
+++ b/backends/zif/pk-backend-zif.c
@@ -1216,7 +1216,7 @@ pk_backend_search_thread (PkBackend *backend)
/* if the search temp is prefixed with '@' then it is a
* category search, and we have to strip it */
- if (search[0][0] == '@') {
+ if (search[0] != NULL && search[0][0] == '@') {
search_entries = g_strv_length (search);
search_stripped = g_new0 (gchar *, search_entries + 1);
for (i=0; i < search_entries; i++)
@@ -1262,7 +1262,7 @@ pk_backend_search_thread (PkBackend *backend)
} else if (role == PK_ROLE_ENUM_SEARCH_FILE) {
array = zif_store_array_search_file (store_array, search, state_local, &error);
} else if (role == PK_ROLE_ENUM_RESOLVE) {
- if (search[0][0] == '@') {
+ if (search[0] != NULL && search[0][0] == '@') {
/* this is a group */
array = pk_backend_resolve_groups (store_array, search, state_local, &error);
} else {
commit 44273adece4243f2e8a2462e87d4ebb1e3ded6d9
Author: Adam Williamson <awilliam at redhat.com>
Date: Mon Feb 6 10:57:54 2012 -0800
Drop --print-reply from dbus-send command used on suspend/resume
The dbus-send command used to refresh PK's caches over a suspend/resume cycle
included the --print-reply parameter. This causes the command not to return
until the dbus call either succeeds or fails - in the failure case, a delay of
25 seconds (dbus' timeout) is possible. This blocks all later resume-time
scripts, including the one that brings the network back up. Removing the
parameter makes the PK call non-blocking, so the rest of the system resume can
proceed even if it doesn't work immediately, eliminating the possibility of the
network being down for 25 seconds at system resume.
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/contrib/pm-utils/95packagekit b/contrib/pm-utils/95packagekit
index 407cd1a..73ed00c 100755
--- a/contrib/pm-utils/95packagekit
+++ b/contrib/pm-utils/95packagekit
@@ -11,7 +11,7 @@ case "$1" in
thaw|resume)
# get PackageKit to invalidate its caches and get new updates
dbus-send --system --dest=org.freedesktop.PackageKit \
- --type=method_call --print-reply \
+ --type=method_call \
/org/freedesktop/PackageKit \
org.freedesktop.PackageKit.StateHasChanged \
string:'resume'
commit 5303da33f4bc778fc8574ea66344be97e066fe85
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Mon Mar 12 19:10:32 2012 +0100
portage: port code to new Layman API and fix usage with newer Portage API
diff --git a/backends/portage/portageBackend.py b/backends/portage/portageBackend.py
index aa8f8c4..38e0991 100755
--- a/backends/portage/portageBackend.py
+++ b/backends/portage/portageBackend.py
@@ -64,6 +64,7 @@ import _emerge.actions
import _emerge.stdout_spinner
import _emerge.create_depgraph_params
import _emerge.AtomArg
+from portage.exception import InvalidAtom
# layman imports
import layman.db
@@ -967,7 +968,10 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
for cpv in cpv_list:
# prevent showing input packages
if '=' + cpv not in cpv_input:
- self._package(cpv)
+ try:
+ self._package(cpv)
+ except InvalidAtom:
+ continue
def get_details(self, pkgs):
self.status(STATUS_INFO)
@@ -1043,7 +1047,10 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
for cp in self._get_all_cp(filters):
for cpv in self._get_all_cpv(cp, filters):
- self._package(cpv)
+ try:
+ self._package(cpv)
+ except InvalidAtom:
+ continue
cp_processed += 100.0
self.percentage(int(cp_processed/nb_cp))
@@ -1060,8 +1067,16 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
self.percentage(None)
# get installed and available dbs
- installed_layman_db = layman.db.DB(layman.config.Config())
- available_layman_db = layman.db.RemoteDB(layman.config.Config())
+ if hasattr(layman.config, "Config"):
+ installed_layman_db = layman.db.DB(layman.config.Config())
+ else:
+ installed_layman_db = layman.db.DB(layman.config.BareConfig())
+
+ if hasattr(layman.config, "Config"):
+ available_layman_db = layman.db.RemoteDB(layman.config.Config())
+ else:
+ available_layman_db = layman.db.RemoteDB(layman.config.BareConfig())
+
# 'gentoo' is a dummy repo
self.repo_detail('gentoo', 'Gentoo Portage tree', True)
@@ -1121,7 +1136,10 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
for cpv in cpv_list:
# prevent showing input packages
if '=' + cpv not in cpv_input:
- self._package(cpv)
+ try:
+ self._package(cpv)
+ except InvalidAtom:
+ continue
def get_update_detail(self, pkgs):
# TODO: a lot of informations are missing
@@ -1378,7 +1396,14 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
myopts = {'--quiet': True}
# get installed and available dbs
- installed_layman_db = layman.db.DB(layman.config.Config())
+ if hasattr(layman.config, "Config"):
+ layman_opts = {"quiet": True}
+ installed_layman_db = layman.db.DB(layman.config.Config())
+ else:
+ layman_opts = {}
+ conf = layman.config.BareConfig()
+ conf.set_option("quiet", True)
+ installed_layman_db = layman.db.DB(conf)
if force:
timestamp_path = os.path.join(
@@ -1389,7 +1414,7 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
try:
self._block_output()
for o in installed_layman_db.overlays.keys():
- installed_layman_db.sync(o, quiet=True)
+ installed_layman_db.sync(o, **layman_opts)
_emerge.actions.action_sync(self.pvar.settings, self.pvar.trees,
self.pvar.mtimedb, myopts, "")
except:
@@ -1640,7 +1665,7 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
self.percentage(100)
- def search_file(self, filters, key):
+ def search_file(self, filters, values):
# FILTERS:
# - ~installed is not accepted (error)
# - free: ok
@@ -1659,24 +1684,28 @@ class PackageKitPortageBackend(PackageKitPortageMixin, PackageKitBaseBackend):
cpv_processed = 0.0
is_full_path = True
- if key[0] != "/":
- is_full_path = False
- key = re.escape(key)
- searchre = re.compile("/" + key + "$", re.IGNORECASE)
+ count = 0
+ values_len = len(values)
+ for key in values:
- # free filter
- cpv_list = self._filter_free(cpv_list, filters)
- nb_cpv = float(len(cpv_list))
+ if key[0] != "/":
+ is_full_path = False
+ key = re.escape(key)
+ searchre = re.compile("/" + key + "$", re.IGNORECASE)
- for cpv in cpv_list:
- for f in self._get_file_list(cpv):
- if (is_full_path and key == f) \
- or (not is_full_path and searchre.search(f)):
- self._package(cpv)
- break
+ # free filter
+ cpv_list = self._filter_free(cpv_list, filters)
+ nb_cpv = float(len(cpv_list))
+
+ for cpv in cpv_list:
+ for f in self._get_file_list(cpv):
+ if (is_full_path and key == f) \
+ or (not is_full_path and searchre.search(f)):
+ self._package(cpv)
+ break
- cpv_processed += 100.0
- self.percentage(int(cpv_processed/nb_cpv))
+ count += 1
+ self.percentage(float(count)/values_len)
self.percentage(100)
commit 7d9f2bdbde8221b76043f785ba0d50200e070c28
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Sat Mar 10 14:26:18 2012 +0100
trivial: Don't call exit() in aptcc backend
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 0d451e0..1d2488c 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1727,7 +1727,7 @@ PkgList AptIntf::resolvePI(gchar **package_ids)
if (pair.second.end() == false) {
ret.push_back(pair);
}
-
+
pair.second = find_candidate_ver(pkg);
// check to see if the provided package isn't virtual too
if (pair.second.end() == false) {
@@ -1740,7 +1740,7 @@ PkgList AptIntf::resolvePI(gchar **package_ids)
if (pkg.end() == true || (pkg.VersionList().end() && pkg.ProvidesList().end())) {
continue;
}
-
+
pair.first = pkg;
pair.second = find_ver(pkg);
// check to see if the provided package isn't virtual too
@@ -2311,7 +2311,7 @@ cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
close(readFromChildFD[1]);
- _exit(res);
+ return res == 0;
}
cout << "PARENT proccess running..." << endl;
commit ac5822f5d34ffd2f928cab31d5b6c31f3a0e70c3
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sat Mar 10 01:03:32 2012 -0300
aptcc: Fix a multiarch bug that failed to resolve packages if the desired arch was not luckly returned by FindPkg
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 853d49c..0d451e0 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1699,24 +1699,60 @@ PkgList AptIntf::resolvePI(gchar **package_ids)
PkgPair pair;
pi = package_ids[i];
+ // Check if it's a valid package id
if (pk_package_id_check(pi) == false) {
- pair.first = packageCache->FindPkg(pi);
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (pair.first.end() == true ||
- (pair.first.VersionList().end() && pair.first.ProvidesList().end())) {
- continue;
- }
+ if (m_isMultiArch) {
+ // OK FindPkg is not suitable for muitarch
+ // it can only return one package in this case we need to
+ // search the whole package cache and match the package
+ // name manually
+ for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
+ if (_cancel) {
+ break;
+ }
- pair.second = find_ver(pair.first);
- // check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
- }
+ // check if this is the package we want
+ if (strcmp(pkg.Name(), pi) != 0) {
+ continue;
+ }
- pair.second = find_candidate_ver(pair.first);
- // check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if ((pkg.end() == true || (pkg.VersionList().end() && pkg.ProvidesList().end()))) {
+ continue;
+ }
+
+ pair.first = pkg;
+ pair.second = find_ver(pkg);
+ // check to see if the provided package isn't virtual too
+ if (pair.second.end() == false) {
+ ret.push_back(pair);
+ }
+
+ pair.second = find_candidate_ver(pkg);
+ // check to see if the provided package isn't virtual too
+ if (pair.second.end() == false) {
+ ret.push_back(pair);
+ }
+ }
+ } else {
+ pkgCache::PkgIterator pkg = packageCache->FindPkg(pi);
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (pkg.end() == true || (pkg.VersionList().end() && pkg.ProvidesList().end())) {
+ continue;
+ }
+
+ pair.first = pkg;
+ pair.second = find_ver(pkg);
+ // check to see if the provided package isn't virtual too
+ if (pair.second.end() == false) {
+ ret.push_back(pair);
+ }
+
+ pair.second = find_candidate_ver(pkg);
+ // check to see if the provided package isn't virtual too
+ if (pair.second.end() == false) {
+ ret.push_back(pair);
+ }
}
} else {
bool found;
commit e167cc91d7cecbbcbb685b27cf26b7a0c0890887
Author: Daniel Nicoletti <dantti12 at gmail.com>
Date: Sat Mar 10 00:10:59 2012 -0300
aptcc: Fix crash when a package with an invalid version is appended to the fetcher class and latter emited
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 6b91629..853d49c 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -2091,27 +2091,33 @@ bool AptIntf::installPackages(pkgCacheFile &Cache)
return false;
}
- // Generate the list of affected packages and sort it
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; I++)
- {
- // Ignore no-version packages
- if (I->VersionList == 0) {
- continue;
- }
+ // Generate the list of affected packages
+ for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); pkg.end() == false; ++pkg)
+ {
+ // Ignore no-version packages
+ if (pkg->VersionList == 0) {
+ continue;
+ }
- // Not interesting
- if ((Cache[I].Keep() == true ||
- Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
- I.State() == pkgCache::PkgIterator::NeedsNothing &&
- (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
- (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
- (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
- {
- continue;
- }
+ // Not interesting
+ if ((Cache[pkg].Keep() == true ||
+ Cache[pkg].InstVerIter(Cache) == pkg.CurrentVer()) &&
+ pkg.State() == pkgCache::PkgIterator::NeedsNothing &&
+ (Cache[pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
+ (pkg.Purge() != false || Cache[pkg].Mode != pkgDepCache::ModeDelete ||
+ (Cache[pkg].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
+ {
+ continue;
+ }
+
+ pkgCache::VerIterator ver = Cache[pkg].InstVerIter(Cache);
+ if (ver.end() && (ver = find_candidate_ver(pkg))) {
+ // Ignore invalid versions
+ continue;
+ }
- // Append it to the list
- Stat.addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(I, Cache[I].InstVerIter(Cache)));
+ // Append it to the list
+ Stat.addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
}
// Display statistics
commit 025fc6113ca38d3364bd59f609e462d978e54e12
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Tue Mar 6 16:50:21 2012 +0100
trivial: Update backend matrix
diff --git a/docs/html/pk-matrix.html b/docs/html/pk-matrix.html
index f10e513..397588e 100644
--- a/docs/html/pk-matrix.html
+++ b/docs/html/pk-matrix.html
@@ -250,7 +250,7 @@
<tr>
<td><b>InstallFiles</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- aptcc -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
@@ -267,6 +267,25 @@
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
</tr>
<tr>
+<td><b>SimulateInstallFiles</b></td>
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- entropy -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- poldek -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- slapt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
+</tr>
+<tr>
<td><b>InstallPackages</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
@@ -285,6 +304,24 @@
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
</tr>
+<td><b>SimulateInstallPackages</b></td>
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
+<td><img src="img/status-good.png" alt="[no]"/></td><!-- conary -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- entropy -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- slapt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
+</tr>
<tr>
<td><b>InstallSignature</b></td>
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- apt -->
@@ -343,6 +380,25 @@
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
</tr>
<tr>
+<td><b>SimulateRemovePackages</b></td>
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
+<td><img src="img/status-good.png" alt="[no]"/></td><!-- conary -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- entropy -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- slapt -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
+<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
+</tr>
+<tr>
<td><b>RepoEnable</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
@@ -495,61 +551,24 @@
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
</tr>
<tr>
-<td><b>SimulateInstallFiles</b></td>
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- aptcc -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- entropy -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- poldek -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- slapt -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
-</tr>
-<tr>
-<td><b>SimulateInstallPackages</b></td>
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
-<td><img src="img/status-good.png" alt="[no]"/></td><!-- conary -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- entropy -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- slapt -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
-</tr>
<tr>
-<td><b>SimulateRemovePackages</b></td>
+<td><b>UpdatePackages</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
-<td><img src="img/status-good.png" alt="[no]"/></td><!-- conary -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- box -->
+<td><img src="img/status-bad.png" alt="[yes]"/></td><!-- conary -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- entropy -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- opkg -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- pisi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- portage -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- ports -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- portage -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- ports -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- slapt -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- urpmi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
</tr>
<tr>
<td><b>SimulateUpdatePackages</b></td>
@@ -571,25 +590,6 @@
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
</tr>
<tr>
-<td><b>UpdatePackages</b></td>
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- box -->
-<td><img src="img/status-bad.png" alt="[yes]"/></td><!-- conary -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- entropy -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- opkg -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- pisi -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- portage -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- ports -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- slapt -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- urpmi -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
-<td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
-</tr>
-<tr>
<td><b>UpdateSystem</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- aptcc -->
commit 209926a1f2d76842402c49a95d319df2fc478e42
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Tue Mar 6 14:20:02 2012 +0100
aptcc: Mark dependencies of a file-installation as automatic
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 2d0fa7d..6b91629 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1730,6 +1730,21 @@ PkgList AptIntf::resolvePI(gchar **package_ids)
return ret;
}
+bool AptIntf::markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag)
+{
+ bool ret;
+ for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i) {
+ if (_cancel) {
+ break;
+ }
+
+ // Mark package as auto-installed
+ cache->MarkAuto(i->first, flag);
+ }
+
+ return true;
+}
+
bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
{
// We call gdebi to tell us what do we need to install/remove
@@ -1801,11 +1816,14 @@ bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &r
bool AptIntf::installFile(const gchar *path, bool simulate)
{
- if (path == NULL)
+ if (path == NULL) {
+ g_error ("installFile() path was NULL!");
return false;
+ }
DebFile deb(path);
if (!deb.isValid()) {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, "DEB package is invalid!");
return false;
}
@@ -1887,7 +1905,7 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
return true;
}
-bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate)
+bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto)
{
//cout << "runTransaction" << simulate << remove << endl;
bool WithLock = !simulate; // Check to see if we are just simulating,
@@ -1940,6 +1958,9 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate)
}
}
+ if (!simulate)
+ markAutoInstalled(Cache, install, markAuto);
+
for(PkgList::iterator i = remove.begin(); i != remove.end(); ++i) {
pkgCache::PkgIterator Pkg = i->first;
if (_cancel) {
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 6e96aa8..7ae4f15 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -71,6 +71,8 @@ public:
PkgList resolvePI(gchar **package_ids);
bool markFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
+ bool markAutoInstalled(pkgCacheFile &cache, PkgList &pkgs, bool flag);
+
/**
* runs a transaction to install/remove/update packages
* - for install and update, \p remove should be set to false
@@ -79,7 +81,7 @@ public:
* \p simulate should be true, in this case packages with
* what's going to happen will be emitted.
*/
- bool runTransaction(PkgList &install, PkgList &remove, bool simulate);
+ bool runTransaction(PkgList &install, PkgList &remove, bool simulate, bool markAuto = false);
/**
* Get depends
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 49f6d33..d16a685 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -1097,6 +1097,7 @@ backend_manage_packages_thread (PkBackend *backend)
bool simulate = false;
bool remove = false;
bool fileInstall = false;
+ bool markAuto = false;
gchar **full_paths = NULL;
PkRoleEnum role = pk_backend_get_role (backend);
@@ -1147,6 +1148,10 @@ backend_manage_packages_thread (PkBackend *backend)
return false;
}
+ // Mark newly installed packages as auto-installed
+ // (they're dependencies of the new local package)
+ markAuto = true;
+
cout << "installPkgs.size: " << installPkgs.size() << endl;
cout << "removePkgs.size: " << removePkgs.size() << endl;
@@ -1169,7 +1174,7 @@ backend_manage_packages_thread (PkBackend *backend)
}
// Install/Update/Remove packages, or just simulate
- if (!m_apt->runTransaction(installPkgs, removePkgs, simulate)) {
+ if (!m_apt->runTransaction(installPkgs, removePkgs, simulate, markAuto)) {
// Print transaction errors
cout << "runTransaction failed" << endl;
delete m_apt;
commit 577adf2ebdb4c72361fba995f02e6cc01ea7fbf1
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Tue Mar 6 00:13:41 2012 +0100
aptcc: Implement basic support for InstallFiles()
There are still some parts missing and some parts which
have to be done better, but this patch makes
InstallFiles() work with aptcc now.
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index a536833..2d0fa7d 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1736,12 +1736,11 @@ bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &r
// in order to be able to install this package
gint status;
gchar **argv;
- gchar **envp;
gchar *std_out;
gchar *std_err;
GError *gerror = NULL;
argv = (gchar **) g_malloc(5 * sizeof(gchar *));
- argv[0] = g_strdup("/usr/bin/gdebi");
+ argv[0] = g_strdup(GDEBI_BINARY);
argv[1] = g_strdup("-q");
argv[2] = g_strdup("--apt-line");
argv[3] = g_strdup(file);
@@ -1750,7 +1749,7 @@ bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &r
gboolean ret;
ret = g_spawn_sync(NULL, // working dir
argv, // argv
- envp, // envp
+ NULL, // envp
G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
NULL, // child_setup
NULL, // user_data
@@ -1805,26 +1804,87 @@ bool AptIntf::installFile(const gchar *path, bool simulate)
if (path == NULL)
return false;
- DebFile *deb = new DebFile(path);
- if (!deb->isValid()) {
- delete deb;
+ DebFile deb(path);
+ if (!deb.isValid()) {
return false;
}
if (simulate) {
// TODO: Emit signal for to-be-installed package
//emit_package("", PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
- delete deb;
return true;
}
- delete deb;
- // TODO: Install the package using dpkg
+ string arch = deb.architecture();
+ string aptArch = _config->Find("APT::Architecture");
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_NOT_SUPPORTED,
- "Installation of Deb files is in progress and not (yet) working completely.");
+ // TODO: Perform this check _before_ installing all dependencies. (The whole thing needs
+ // some rethinking anyway)
+ if ((arch != "all") &&
+ (arch != aptArch)) {
+ cout << arch << " vs. " << aptArch << endl;
+ gchar *msg = g_strdup_printf ("Package has wrong architecture, it is %s, but we need %s",
+ arch.c_str(), aptArch.c_str());
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_INCOMPATIBLE_ARCHITECTURE, msg);
+ g_free (msg);
+ return false;
+ }
- return false;
+ gint status;
+ gchar **argv;
+ gchar **envp;
+ gchar *std_out;
+ gchar *std_err;
+ GError *error = NULL;
+
+ argv = (gchar **) g_malloc(4 * sizeof(gchar *));
+ argv[0] = g_strdup("/usr/bin/dpkg");
+ argv[1] = g_strdup("-i");
+ argv[2] = g_strdup(path); //g_strdup_printf("\'%s\'", path);
+ argv[3] = NULL;
+
+ envp = (gchar **) g_malloc(4 * sizeof(gchar *));
+ envp[0] = g_strdup("PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin");
+ envp[1] = g_strdup("DEBIAN_FRONTEND=passthrough");
+ envp[2] = g_strdup_printf("DEBCONF_PIPE=%s", pk_backend_get_frontend_socket(m_backend));
+ envp[3] = NULL;
+
+ g_spawn_sync(NULL, // working dir
+ argv,
+ envp,
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+ NULL, // child_setup
+ NULL, // user_data
+ &std_out, // standard_output
+ &std_err, // standard_error
+ &status,
+ &error);
+ int exit_code = WEXITSTATUS(status);
+
+ cout << argv[2] << endl;
+ cout << "DpkgOut: " << std_out << endl;
+ cout << "DpkgErr: " << std_err << endl;
+
+ if (error != NULL) {
+ // We couldn't run dpkg for some reason...
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, error->message);
+ return false;
+ }
+
+ // If installation has failed...
+ if (exit_code != 0) {
+ if ((std_out == NULL) || (strlen(std_out) == 0)) {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_err);
+ } else {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_out);
+ }
+ return false;
+ }
+
+ // Emit data of the now-installed DEB package
+ //emit_package("", PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+
+ return true;
}
bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate)
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 12c4b30..6e96aa8 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -28,9 +28,11 @@
#include <apt-pkg/cachefile.h>
#include <apt-pkg/policy.h>
+#include <set>
#include <pk-backend.h>
-#include <set>
+#define PREUPGRADE_BINARY "/usr/bin/do-release-upgrade"
+#define GDEBI_BINARY "/usr/bin/gdebi"
using namespace std;
diff --git a/backends/aptcc/deb-file.cpp b/backends/aptcc/deb-file.cpp
index c68197a..a2599af 100644
--- a/backends/aptcc/deb-file.cpp
+++ b/backends/aptcc/deb-file.cpp
@@ -1,6 +1,7 @@
/* deb-file.cpp
*
* Copyright (c) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
*
* Licensed under the GNU General Public License Version 2
*
@@ -28,6 +29,7 @@
#include <iostream>
DebFile::DebFile(const std::string &filename)
+ : m_filePath(filename)
{
FileFd in(filename, FileFd::ReadOnly);
debDebFile deb(in);
@@ -47,11 +49,21 @@ bool DebFile::isValid() const
return m_isValid;
}
-std::string DebFile::name() const
+std::string DebFile::filePath() const
+{
+ return m_filePath;
+}
+
+std::string DebFile::packageName() const
{
return m_controlData.FindS("Package");
}
+std::string DebFile::sourcePackage() const
+{
+ return m_controlData.FindS("Source");
+}
+
std::string DebFile::version() const
{
return m_controlData.FindS("Version");
diff --git a/backends/aptcc/deb-file.h b/backends/aptcc/deb-file.h
index f4ae5a1..8cd305f 100644
--- a/backends/aptcc/deb-file.h
+++ b/backends/aptcc/deb-file.h
@@ -1,6 +1,7 @@
/* deb-file.h
*
* Copyright (c) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
*
* Licensed under the GNU General Public License Version 2
*
@@ -29,23 +30,26 @@ class DebFile
{
// typedef int user_tag_reference;
public:
- DebFile(const std::string &filename);
- bool isValid() const;
+ DebFile(const std::string &filename);
+ bool isValid() const;
- std::string name() const;
- std::string version() const;
- std::string architecture() const;
- std::string conflicts() const;
+ std::string filePath() const;
+ std::string packageName() const;
+ std::string sourcePackage() const;
+ std::string version() const;
+ std::string architecture() const;
+ std::string conflicts() const;
- // THIS should be moved to AptIntf class
- bool check();
- std::string errorMsg() const;
+ // THIS should be moved to AptIntf class
+ bool check();
+ std::string errorMsg() const;
private:
- debDebFile::MemControlExtract *m_extractor;
- pkgTagSection m_controlData;
- std::string m_errorMsg;
- bool m_isValid;
+ std::string m_filePath;
+ debDebFile::MemControlExtract *m_extractor;
+ pkgTagSection m_controlData;
+ std::string m_errorMsg;
+ bool m_isValid;
};
#endif
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index c495114..49f6d33 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -37,9 +37,6 @@
#include "pkg_acqfile.h"
#include "apt-sourceslist.h"
-#define PREUPGRADE_BINARY "/usr/bin/do-release-upgrade"
-#define GDEBI_BINARY "/usr/bin/gdebi"
-
/* static bodges */
static bool _cancel = false;
static PkBackendSpawn *spawn;
commit ec01a5316dd5f2b903c334026bdd4209f3d1618f
Merge: f82737b... 9469101...
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Mar 5 22:57:14 2012 +0100
Merge branch 'aptcc_testing'
commit f82737bcb78eaf52340db0306975ad1f2d369566
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Mar 5 22:54:36 2012 +0100
aptcc: Some more stuff required for installFiles()
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 1b33679..a536833 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1730,7 +1730,7 @@ PkgList AptIntf::resolvePI(gchar **package_ids)
return ret;
}
-bool AptIntf::markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
+bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
{
// We call gdebi to tell us what do we need to install/remove
// in order to be able to install this package
@@ -1800,6 +1800,33 @@ bool AptIntf::markDebFileForInstall(const gchar *file, PkgList &install, PkgList
return true;
}
+bool AptIntf::installFile(const gchar *path, bool simulate)
+{
+ if (path == NULL)
+ return false;
+
+ DebFile *deb = new DebFile(path);
+ if (!deb->isValid()) {
+ delete deb;
+ return false;
+ }
+
+ if (simulate) {
+ // TODO: Emit signal for to-be-installed package
+ //emit_package("", PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+ delete deb;
+ return true;
+ }
+ delete deb;
+
+ // TODO: Install the package using dpkg
+
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_NOT_SUPPORTED,
+ "Installation of Deb files is in progress and not (yet) working completely.");
+
+ return false;
+}
+
bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate)
{
//cout << "runTransaction" << simulate << remove << endl;
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 7b7dd6d..12c4b30 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -67,7 +67,7 @@ public:
pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
PkgList resolvePI(gchar **package_ids);
- bool markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
+ bool markFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
/**
* runs a transaction to install/remove/update packages
@@ -125,17 +125,26 @@ public:
void emitFiles(PkBackend *backend, const gchar *pi);
/**
- * seems to install packages
+ * Download and install packages
*/
bool installPackages(pkgCacheFile &Cache);
/**
- * check which package provides the codec
+ * Install a DEB file
+ *
+ * If you don't want to actually install/update/remove
+ * \p simulate should be true, in this case packages with
+ * what's going to happen will be emitted.
+ */
+ bool installFile(const gchar *path, bool simulate);
+
+ /**
+ * Check which package provides the codec
*/
void providesCodec(PkgList &output, gchar **values);
/**
- * check which package provides a shared library
+ * Check which package provides a shared library
*/
void providesLibrary(PkgList &output, gchar **values);
diff --git a/backends/aptcc/deb-file.h b/backends/aptcc/deb-file.h
index 8f6dbce..f4ae5a1 100644
--- a/backends/aptcc/deb-file.h
+++ b/backends/aptcc/deb-file.h
@@ -37,7 +37,7 @@ public:
std::string architecture() const;
std::string conflicts() const;
- // THIS should be moved to AptCC class
+ // THIS should be moved to AptIntf class
bool check();
std::string errorMsg() const;
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index c3abb86..c495114 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -1118,7 +1118,7 @@ backend_manage_packages_thread (PkBackend *backend)
full_paths = pk_backend_get_strv (backend, "full_paths");
fileInstall = true;
}
-cout << "FILE INSTALL: " << fileInstall << endl;
+ g_debug ("FILE INSTALL: %i", fileInstall);
pk_backend_set_allow_cancel (backend, true);
AptIntf *m_apt = new AptIntf(backend, _cancel);
@@ -1130,66 +1130,71 @@ cout << "FILE INSTALL: " << fileInstall << endl;
}
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- PkgList installPkgs, removePkgs;
- if (fileInstall) {
- // GDebi can not install more than one package at time
- if (g_strv_length(full_paths) > 1) {
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_NOT_SUPPORTED,
- "The backend can only proccess one file at time.");
- delete m_apt;
- return false;
- }
-
- // get the list of packages to install
- if (!m_apt->markDebFileForInstall(full_paths[0], installPkgs, removePkgs)) {
- delete m_apt;
- return false;
- }
- cout << "installPkgs.size: " << installPkgs.size() << endl;
- cout << "removePkgs.size: " << removePkgs.size() << endl;
- } else {
- // Resolve the given packages
- gchar **package_ids = pk_backend_get_strv(backend, "package_ids");
- if (remove) {
- removePkgs = m_apt->resolvePI(package_ids);
- } else {
- installPkgs = m_apt->resolvePI(package_ids);
- }
-
- if (removePkgs.size() == 0 && installPkgs.size() == 0) {
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Could not find package(s)");
- delete m_apt;
- return false;
- }
- }
+ PkgList installPkgs, removePkgs;
- // Install/Update/Remove packages, or just simulate
- if (!m_apt->runTransaction(installPkgs, removePkgs, simulate)) {
- // Print transaction errors
- cout << "runTransaction failed" << endl;
- delete m_apt;
- return false;
- }
+ if (fileInstall) {
+ // File installation EXPERIMENTAL
- // This is broken at time.
-/*
- if (fileInstall) {
- // File installation EXPERIMENTAL
- gchar *path;
+ // GDebi can not install more than one package at time
+ if (g_strv_length(full_paths) > 1) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_NOT_SUPPORTED,
+ "The backend can only proccess one file at time.");
+ delete m_apt;
+ return false;
+ }
- for (uint i = 0; i < g_strv_length(full_paths); i++) {
- if (_cancel) {
- break;
+ // get the list of packages to install
+ if (!m_apt->markFileForInstall(full_paths[0], installPkgs, removePkgs)) {
+ delete m_apt;
+ return false;
+ }
+
+ cout << "installPkgs.size: " << installPkgs.size() << endl;
+ cout << "removePkgs.size: " << removePkgs.size() << endl;
+
+ } else {
+ // Resolve the given packages
+ gchar **package_ids = pk_backend_get_strv(backend, "package_ids");
+ if (remove) {
+ removePkgs = m_apt->resolvePI(package_ids);
+ } else {
+ installPkgs = m_apt->resolvePI(package_ids);
+ }
+
+ if (removePkgs.size() == 0 && installPkgs.size() == 0) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
+ "Could not find package(s)");
+ delete m_apt;
+ return false;
}
+ }
- path = full_paths[i];
- cout << "InstallFiles: " << m_apt->installDebFiles(path, simulate) << endl;
+ // Install/Update/Remove packages, or just simulate
+ if (!m_apt->runTransaction(installPkgs, removePkgs, simulate)) {
+ // Print transaction errors
+ cout << "runTransaction failed" << endl;
+ delete m_apt;
+ return false;
+ }
+
+ if (fileInstall) {
+ // Now perform the installation!
+ gchar *path;
+ for (uint i = 0; i < g_strv_length(full_paths); i++) {
+ if (_cancel) {
+ break;
+ }
+
+ path = full_paths[i];
+ if (!m_apt->installFile(path, simulate)) {
+ cout << "Installation of DEB file " << path << " failed." << endl;
+ delete m_apt;
+ return false;
+ }
+ }
}
- }
-*/
delete m_apt;
return true;
@@ -1496,13 +1501,10 @@ pk_backend_get_roles (PkBackend *backend)
}
// only add GetDistroUpgrades if the binary is present
- // InstallFiles is not working at time.
-/*
if (g_file_test (GDEBI_BINARY, G_FILE_TEST_EXISTS)) {
pk_bitfield_add(roles, PK_ROLE_ENUM_SIMULATE_INSTALL_FILES);
pk_bitfield_add(roles, PK_ROLE_ENUM_INSTALL_FILES);
}
-*/
return roles;
}
commit f9432ef6a0b4ef72fe2bef23b9af073f13f019bd
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Mar 5 22:11:49 2012 +0100
aptcc: Update license headers & fix some more indentation and typos
diff --git a/backends/aptcc/20packagekit b/backends/aptcc/20packagekit
index ffd677a..98fe23f 100644
--- a/backends/aptcc/20packagekit
+++ b/backends/aptcc/20packagekit
@@ -1,12 +1,13 @@
// THIS FILE IS USED TO INFORM PACKAGEKIT
-// THAT THE UPDATES MIGHT HAVE CHANGED
-// Whenever the dpkg is called we might have different updates
-// i.e. a user removes a package that had an update
+// THAT THE UPDATE-INFO MIGHT HAVE CHANGED
+
+// Whenever dpkg is called we might have different updates
+// i.e. if an user removes a package that had an update
DPkg::Post-Invoke {
"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 1 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null";
};
-// When the apt cache is updated (i.e. apt-cache update)
+// When Apt's cache is updated (i.e. apt-cache update)
APT::Update::Post-Invoke-Success {
"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 1 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null";
};
diff --git a/backends/aptcc/Makefile.am b/backends/aptcc/Makefile.am
index cc0274a..052bdf2 100644
--- a/backends/aptcc/Makefile.am
+++ b/backends/aptcc/Makefile.am
@@ -5,9 +5,9 @@ INCLUDES = \
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_aptcc.la
libpk_backend_aptcc_la_SOURCES = pkg_acqfile.cpp \
- acqprogress.cpp \
+ pkg_dpkgpm.cpp \
+ acqpkitstatus.cpp \
deb-file.cpp \
- dpkgpm.cpp \
matcher.cpp \
gstMatcher.cpp \
apt-messages.cpp \
@@ -30,9 +30,9 @@ EXTRA_DIST = 20packagekit \
gstMatcher.h \
matcher.h \
deb-file.h \
- dpkgpm.h \
apt-messages.h \
- acqprogress.h \
+ acqpkitstatus.h \
+ pkg_dpkgpm.h \
pkg_acqfile.h
helperdir = $(datadir)/PackageKit/helpers/aptcc
diff --git a/backends/aptcc/acqpkitstatus.cpp b/backends/aptcc/acqpkitstatus.cpp
new file mode 100644
index 0000000..4756921
--- /dev/null
+++ b/backends/aptcc/acqpkitstatus.cpp
@@ -0,0 +1,268 @@
+/* acqpkitstatus.cpp
+ *
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "acqpkitstatus.h"
+
+#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/acquire-worker.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
+
+#include <stdio.h>
+#include <signal.h>
+#include <iostream>
+
+using namespace std;
+
+// AcqPackageKitStatus::AcqPackageKitStatus - Constructor
+// ---------------------------------------------------------------------
+AcqPackageKitStatus::AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled) :
+ m_apt(apt),
+ m_backend(backend),
+ _cancelled(cancelled),
+ last_percent(PK_BACKEND_PERCENTAGE_INVALID),
+ last_sub_percent(PK_BACKEND_PERCENTAGE_INVALID)
+{
+}
+
+// AcqPackageKitStatus::Start - Downloading has started
+// ---------------------------------------------------------------------
+void AcqPackageKitStatus::Start()
+{
+ pkgAcquireStatus::Start();
+ ID = 1;
+};
+
+// AcqPackageKitStatus::IMSHit - Called when an item got a HIT response /*{{{*/
+// ---------------------------------------------------------------------
+void AcqPackageKitStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
+{
+ if (packages.size() == 0) {
+ pk_backend_repo_detail(m_backend,
+ "",
+ Itm.Description.c_str(),
+ false);
+ }
+ Update = true;
+};
+
+// AcqPackageKitStatus::Fetch - An item has started to download
+// ---------------------------------------------------------------------
+/* This prints out the short description and the expected size */
+void AcqPackageKitStatus::Fetch(pkgAcquire::ItemDesc &Itm)
+{
+ Update = true;
+ if (Itm.Owner->Complete == true)
+ return;
+
+ Itm.Owner->ID = ID++;
+};
+
+// AcqPackageKitStatus::Done - Completed a download
+// ---------------------------------------------------------------------
+/* We don't display anything... */
+void AcqPackageKitStatus::Done(pkgAcquire::ItemDesc &Itm)
+{
+ Update = true;
+};
+
+// AcqPackageKitStatus::Fail - Called when an item fails to download
+// ---------------------------------------------------------------------
+/* We print out the error text */
+void AcqPackageKitStatus::Fail(pkgAcquire::ItemDesc &Itm)
+{
+ // Ignore certain kinds of transient failures (bad code)
+ if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) {
+ return;
+ }
+
+ if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
+ {
+ if (packages.size() == 0) {
+ pk_backend_repo_detail(m_backend,
+ "",
+ Itm.Description.c_str(),
+ false);
+ }
+ } else {
+ // an error was found (maybe 404, 403...)
+ // the item that got the error and the error text
+ _error->Error("Error %s\n %s",
+ Itm.Description.c_str(),
+ Itm.Owner->ErrorText.c_str());
+ }
+
+ Update = true;
+};
+
+
+// AcqTextStatus::Stop - Finished downloading
+// ---------------------------------------------------------------------
+/* This prints out the bytes downloaded and the overall average line
+ speed */
+void AcqPackageKitStatus::Stop()
+{
+ pkgAcquireStatus::Stop();
+ // the items that still on the set are finished
+ for (set<string>::iterator it = currentPackages.begin();
+ it != currentPackages.end();
+ it++ )
+ {
+ emit_package(*it, true);
+ }
+}
+
+
+// AcqPackageKitStatus::Pulse - Regular event pulse
+// ---------------------------------------------------------------------
+/* This draws the current progress. Each line has an overall percent
+ meter and a per active item status meter along with an overall
+ bandwidth and ETA indicator. */
+bool AcqPackageKitStatus::Pulse(pkgAcquire *Owner)
+{
+ pkgAcquireStatus::Pulse(Owner);
+
+ unsigned long percent_done;
+ percent_done = long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems));
+
+ // Emit the percent done
+ if (last_percent != percent_done) {
+ if (last_percent < percent_done) {
+ pk_backend_set_percentage(m_backend, percent_done);
+ } else {
+ pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_percentage(m_backend, percent_done);
+ }
+ last_percent = percent_done;
+ }
+
+ set<string> localCurrentPackages = currentPackages;;
+ for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
+ I = Owner->WorkerStep(I))
+ {
+ // Check if there is no item running or if we don't have
+ // any packages set we are probably refreshing the cache
+ if (I->CurrentItem == 0 || packages.size() == 0)
+ {
+ continue;
+ }
+ emit_package(I->CurrentItem->ShortDesc, false);
+ localCurrentPackages.erase(I->CurrentItem->ShortDesc);
+
+ // Add the total size and percent
+ if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
+ {
+ unsigned long sub_percent;
+ // TODO PackageKit needs to emit package with progress.
+ sub_percent = long(double(I->CurrentSize*100.0)/double(I->TotalSize));
+ if (last_sub_percent != sub_percent) {
+ if (last_sub_percent < sub_percent) {
+ pk_backend_set_sub_percentage(m_backend, sub_percent);
+ } else {
+ pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_sub_percentage(m_backend, sub_percent);
+ }
+ last_sub_percent = sub_percent;
+ }
+ }
+ }
+
+ // the items that still on the set are finished
+ for (set<string>::iterator it = localCurrentPackages.begin();
+ it != localCurrentPackages.end();
+ it++ )
+ {
+ emit_package(*it, true);
+ }
+
+ double localCPS = (CurrentCPS >= 0) ? CurrentCPS : -1 * CurrentCPS;
+ if (localCPS != last_CPS)
+ {
+ last_CPS = localCPS;
+ pk_backend_set_speed(m_backend, (int) last_CPS);
+ }
+
+ Update = false;
+
+ return !_cancelled;;
+}
+
+// AcqPackageKitStatus::MediaChange - Media need to be swapped
+// ---------------------------------------------------------------------
+/* Prompt for a media swap */
+bool AcqPackageKitStatus::MediaChange(string Media, string Drive)
+{
+ pk_backend_media_change_required(m_backend,
+ PK_MEDIA_TYPE_ENUM_DISC,
+ Media.c_str(),
+ Media.c_str());
+
+ char errorMsg[400];
+ sprintf(errorMsg,
+ "Media change: please insert the disc labeled"
+ " '%s' "
+ "in the drive '%s' and try again.",
+ Media.c_str(),
+ Drive.c_str());
+
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED,
+ errorMsg);
+
+ // Set this so we can fail the transaction
+ Update = true;
+ return false;
+}
+
+
+void AcqPackageKitStatus::addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair)
+{
+ packages.push_back(packagePair);
+}
+
+void AcqPackageKitStatus::emit_package(const string &name, bool finished)
+{
+ if (name.compare(last_package_name) != 0 && packages.size()) {
+ // find the package
+ for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator it = packages.begin();
+ it != packages.end(); ++it)
+ {
+ if (_cancelled) {
+ break;
+ }
+ // try to see if any package matches
+ if (name.compare(it->first.Name()) == 0) {
+ m_apt->emit_package(it->first,
+ it->second,
+ PK_INFO_ENUM_UNKNOWN,
+ finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
+ last_package_name = name;
+
+ // Find the downloading item
+ if (finished) {
+ currentPackages.erase(name);
+ } else {
+ currentPackages.insert(name);
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/backends/aptcc/acqpkitstatus.h b/backends/aptcc/acqpkitstatus.h
new file mode 100644
index 0000000..d775e74
--- /dev/null
+++ b/backends/aptcc/acqpkitstatus.h
@@ -0,0 +1,63 @@
+/* acqpkitstatus.h
+ *
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef ACQ_PKIT_STATUS_H
+#define ACQ_PKIT_STATUS_H
+
+#include <apt-pkg/acquire.h>
+#include <pk-backend.h>
+
+#include "apt-intf.h"
+
+class AcqPackageKitStatus : public pkgAcquireStatus
+{
+public:
+ AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled);
+
+ virtual bool MediaChange(string Media, string Drive);
+ virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
+ virtual void Fetch(pkgAcquire::ItemDesc &Itm);
+ virtual void Done(pkgAcquire::ItemDesc &Itm);
+ virtual void Fail(pkgAcquire::ItemDesc &Itm);
+ virtual void Start();
+ virtual void Stop();
+
+ bool Pulse(pkgAcquire *Owner);
+
+ void addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair);
+
+private:
+ PkBackend *m_backend;
+ unsigned long ID;
+ bool &_cancelled;
+
+ unsigned long last_percent;
+ unsigned long last_sub_percent;
+ double last_CPS;
+ string last_package_name;
+ AptIntf *m_apt;
+
+ vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > packages;
+ set<string> currentPackages;
+
+ void emit_package(const string &name, bool finished);
+};
+
+#endif
diff --git a/backends/aptcc/acqprogress.cpp b/backends/aptcc/acqprogress.cpp
deleted file mode 100644
index 0374ce2..0000000
--- a/backends/aptcc/acqprogress.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description /*{{{*/
-// $Id: acqprogress.cc,v 1.24 2003/04/27 01:56:48 doogie Exp $
-/* ######################################################################
-
- Acquire Progress - Command line progress meter
-
- ##################################################################### */
- /*}}}*/
-// Include files /*{{{*/
-#include "acqprogress.h"
-#include <apt-pkg/acquire-item.h>
-#include <apt-pkg/acquire-worker.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/error.h>
-
-#include <stdio.h>
-#include <signal.h>
-#include <iostream>
- /*}}}*/
-
-using namespace std;
-
-// AcqPackageKitStatus::AcqPackageKitStatus - Constructor /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-AcqPackageKitStatus::AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled) :
- m_apt(apt),
- m_backend(backend),
- _cancelled(cancelled),
- last_percent(PK_BACKEND_PERCENTAGE_INVALID),
- last_sub_percent(PK_BACKEND_PERCENTAGE_INVALID)
-{
-}
- /*}}}*/
-// AcqPackageKitStatus::Start - Downloading has started /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-void AcqPackageKitStatus::Start()
-{
- pkgAcquireStatus::Start();
- ID = 1;
-};
- /*}}}*/
-// AcqPackageKitStatus::IMSHit - Called when an item got a HIT response /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-void AcqPackageKitStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
-{
- if (packages.size() == 0) {
- pk_backend_repo_detail(m_backend,
- "",
- Itm.Description.c_str(),
- false);
- }
- Update = true;
-};
- /*}}}*/
-// AcqPackageKitStatus::Fetch - An item has started to download /*{{{*/
-// ---------------------------------------------------------------------
-/* This prints out the short description and the expected size */
-void AcqPackageKitStatus::Fetch(pkgAcquire::ItemDesc &Itm)
-{
- Update = true;
- if (Itm.Owner->Complete == true)
- return;
-
- Itm.Owner->ID = ID++;
-};
- /*}}}*/
-// AcqPackageKitStatus::Done - Completed a download /*{{{*/
-// ---------------------------------------------------------------------
-/* We don't display anything... */
-void AcqPackageKitStatus::Done(pkgAcquire::ItemDesc &Itm)
-{
- Update = true;
-};
- /*}}}*/
-// AcqPackageKitStatus::Fail - Called when an item fails to download /*{{{*/
-// ---------------------------------------------------------------------
-/* We print out the error text */
-void AcqPackageKitStatus::Fail(pkgAcquire::ItemDesc &Itm)
-{
- // Ignore certain kinds of transient failures (bad code)
- if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) {
- return;
- }
-
- if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
- {
- if (packages.size() == 0) {
- pk_backend_repo_detail(m_backend,
- "",
- Itm.Description.c_str(),
- false);
- }
- } else {
- // an error was found (maybe 404, 403...)
- // the item that got the error and the error text
- _error->Error("Error %s\n %s",
- Itm.Description.c_str(),
- Itm.Owner->ErrorText.c_str());
- }
-
- Update = true;
-};
-
- /*}}}*/
-// AcqTextStatus::Stop - Finished downloading /*{{{*/
-// ---------------------------------------------------------------------
-/* This prints out the bytes downloaded and the overall average line
- speed */
-void AcqPackageKitStatus::Stop()
-{
- pkgAcquireStatus::Stop();
- // the items that still on the set are finished
- for (set<string>::iterator it = currentPackages.begin();
- it != currentPackages.end();
- it++ )
- {
- emit_package(*it, true);
- }
-}
-
- /*}}}*/
-// AcqPackageKitStatus::Pulse - Regular event pulse /*{{{*/
-// ---------------------------------------------------------------------
-/* This draws the current progress. Each line has an overall percent
- meter and a per active item status meter along with an overall
- bandwidth and ETA indicator. */
-bool AcqPackageKitStatus::Pulse(pkgAcquire *Owner)
-{
- pkgAcquireStatus::Pulse(Owner);
-
- unsigned long percent_done;
- percent_done = long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems));
-
- // Emit the percent done
- if (last_percent != percent_done) {
- if (last_percent < percent_done) {
- pk_backend_set_percentage(m_backend, percent_done);
- } else {
- pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_percentage(m_backend, percent_done);
- }
- last_percent = percent_done;
- }
-
- set<string> localCurrentPackages = currentPackages;;
- for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
- I = Owner->WorkerStep(I))
- {
- // Check if there is no item running or if we don't have
- // any packages set we are probably refreshing the cache
- if (I->CurrentItem == 0 || packages.size() == 0)
- {
- continue;
- }
- emit_package(I->CurrentItem->ShortDesc, false);
- localCurrentPackages.erase(I->CurrentItem->ShortDesc);
-
- // Add the total size and percent
- if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
- {
- unsigned long sub_percent;
- // TODO PackageKit needs to emit package with progress.
- sub_percent = long(double(I->CurrentSize*100.0)/double(I->TotalSize));
- if (last_sub_percent != sub_percent) {
- if (last_sub_percent < sub_percent) {
- pk_backend_set_sub_percentage(m_backend, sub_percent);
- } else {
- pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_sub_percentage(m_backend, sub_percent);
- }
- last_sub_percent = sub_percent;
- }
- }
- }
-
- // the items that still on the set are finished
- for (set<string>::iterator it = localCurrentPackages.begin();
- it != localCurrentPackages.end();
- it++ )
- {
- emit_package(*it, true);
- }
-
- double localCPS = (CurrentCPS >= 0) ? CurrentCPS : -1 * CurrentCPS;
- if (localCPS != last_CPS)
- {
- last_CPS = localCPS;
- pk_backend_set_speed(m_backend, (int) last_CPS);
- }
-
- Update = false;
-
- return !_cancelled;;
-}
- /*}}}*/
-// AcqPackageKitStatus::MediaChange - Media need to be swapped /*{{{*/
-// ---------------------------------------------------------------------
-/* Prompt for a media swap */
-bool AcqPackageKitStatus::MediaChange(string Media, string Drive)
-{
- pk_backend_media_change_required(m_backend,
- PK_MEDIA_TYPE_ENUM_DISC,
- Media.c_str(),
- Media.c_str());
-
- char errorMsg[400];
- sprintf(errorMsg,
- "Media change: please insert the disc labeled"
- " '%s' "
- "in the drive '%s' and try again.",
- Media.c_str(),
- Drive.c_str());
-
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED,
- errorMsg);
-
- // Set this so we can fail the transaction
- Update = true;
- return false;
-}
- /*}}}*/
-
-void AcqPackageKitStatus::addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair)
-{
- packages.push_back(packagePair);
-}
-
-void AcqPackageKitStatus::emit_package(const string &name, bool finished)
-{
- if (name.compare(last_package_name) != 0 && packages.size()) {
- // find the package
- for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator it = packages.begin();
- it != packages.end(); ++it)
- {
- if (_cancelled) {
- break;
- }
- // try to see if any package matches
- if (name.compare(it->first.Name()) == 0) {
- m_apt->emit_package(it->first,
- it->second,
- PK_INFO_ENUM_UNKNOWN,
- finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
- last_package_name = name;
-
- // Find the downloading item
- if (finished) {
- currentPackages.erase(name);
- } else {
- currentPackages.insert(name);
- }
- break;
- }
- }
- }
-}
diff --git a/backends/aptcc/acqprogress.h b/backends/aptcc/acqprogress.h
deleted file mode 100644
index 68c4499..0000000
--- a/backends/aptcc/acqprogress.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description /*{{{*/
-// $Id: acqprogress.h,v 1.5 2003/02/02 22:24:11 jgg Exp $
-/* ######################################################################
-
- Acquire Progress - Command line progress meter
-
- ##################################################################### */
- /*}}}*/
-#ifndef ACQPROGRESS_H
-#define ACQPROGRESS_H
-
-#include <apt-pkg/acquire.h>
-#include <pk-backend.h>
-
-#include "apt-intf.h"
-
-class AcqPackageKitStatus : public pkgAcquireStatus
-{
-public:
- AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled);
-
- virtual bool MediaChange(string Media, string Drive);
- virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
- virtual void Fetch(pkgAcquire::ItemDesc &Itm);
- virtual void Done(pkgAcquire::ItemDesc &Itm);
- virtual void Fail(pkgAcquire::ItemDesc &Itm);
- virtual void Start();
- virtual void Stop();
-
- bool Pulse(pkgAcquire *Owner);
-
- void addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair);
-
-private:
- PkBackend *m_backend;
- unsigned long ID;
- bool &_cancelled;
-
- unsigned long last_percent;
- unsigned long last_sub_percent;
- double last_CPS;
- string last_package_name;
- AptIntf *m_apt;
-
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > packages;
- set<string> currentPackages;
-
- void emit_package(const string &name, bool finished);
-};
-
-#endif
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 4798121..1b33679 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -23,15 +23,6 @@
#include "apt-intf.h"
-#include "apt-utils.h"
-#include "matcher.h"
-#include "gstMatcher.h"
-#include "apt-messages.h"
-#include "acqprogress.h"
-#include "pkg_acqfile.h"
-#include "deb-file.h"
-#include "dpkgpm.h"
-
#include <apt-pkg/error.h>
#include <apt-pkg/tagfile.h>
#include <apt-pkg/algorithms.h>
@@ -47,13 +38,22 @@
#include <sys/fcntl.h>
#include <pty.h>
-#define RAMFS_MAGIC 0x858458f6
-
#include <fstream>
#include <dirent.h>
#include <assert.h>
#include <regex.h>
+#include "apt-utils.h"
+#include "matcher.h"
+#include "gstMatcher.h"
+#include "apt-messages.h"
+#include "acqpkitstatus.h"
+#include "pkg_acqfile.h"
+#include "pkg_dpkgpm.h"
+#include "deb-file.h"
+
+#define RAMFS_MAGIC 0x858458f6
+
AptIntf::AptIntf(PkBackend *backend, bool &cancel)
:
packageRecords(0),
@@ -1272,7 +1272,7 @@ bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
return false;
}
-// emitChangedPackages - Show packages to newly install /*{{{*/
+// emitChangedPackages - Show packages to newly install
// ---------------------------------------------------------------------
/* */
void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
@@ -1638,7 +1638,7 @@ void AptIntf::updateInterface(int fd, int writeFd)
usleep(5000);
}
-// DoAutomaticRemove - Remove all automatic unused packages /*{{{*/
+// DoAutomaticRemove - Remove all automatic unused packages
// ---------------------------------------------------------------------
/* Remove unused automatic packages */
bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
@@ -1907,9 +1907,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate)
}
}
- /*}}}*/
-
-// InstallPackages - Actually download and install the packages /*{{{*/
+// InstallPackages - Download and install the packages
// ---------------------------------------------------------------------
/* This displays the informative messages describing what is going to
happen and then calls the download routines */
@@ -1979,7 +1977,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache)
// Create the package manager and prepare to download
// SPtr<pkgPackageManager> PM= _system->CreatePM(Cache);
- SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
+ SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
_error->PendingError() == true) {
return false;
@@ -2101,11 +2099,11 @@ cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
_system->UnLock();
- if (!m_localDebFile.empty()) {
- // add the local file name to be proccessed by the PM queue
- pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
- pm->addDebFile(m_localDebFile);
- }
+ if (!m_localDebFile.empty()) {
+ // add the local file name to be proccessed by the PM queue
+ pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
+ pm->addDebFile(m_localDebFile);
+ }
pkgPackageManager::OrderResult res;
res = PM->DoInstallPreFork();
diff --git a/backends/aptcc/deb-file.cpp b/backends/aptcc/deb-file.cpp
index 68da1d8..c68197a 100644
--- a/backends/aptcc/deb-file.cpp
+++ b/backends/aptcc/deb-file.cpp
@@ -1,6 +1,6 @@
-/*
+/* deb-file.cpp
*
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
*
* Licensed under the GNU General Public License Version 2
*
@@ -77,7 +77,7 @@ bool DebFile::check()
std::cout << architecture() << std::endl;
if (architecture().compare("all") != 0 &&
- architecture().compare(_config->Find("APT::Architecture")) != 0)
+ architecture().compare(_config->Find("APT::Architecture")) != 0)
{
m_errorMsg = "Wrong architecture ";
m_errorMsg.append(architecture());
@@ -92,35 +92,35 @@ bool DebFile::check()
// self._dbg(1, "ERROR: Wrong architecture dude!")
// self._failure_string = _("Wrong architecture '%s'") % arch
// return False
-//
+//
// // check version
// if self.compare_to_version_in_cache() == self.VERSION_OUTDATED:
// if self._cache[self.pkgname].installed:
// // the deb is older than the installed
// self._failure_string = _("A later version is already installed")
// return False
-//
+//
// // FIXME: this sort of error handling sux
// self._failure_string = ""
-//
+//
// // check conflicts
// if not self.check_conflicts():
// return False
-//
-// // check if installing it would break anything on the
+//
+// // check if installing it would break anything on the
// // current system
// if not self.check_breaks_existing_packages():
// return False
-//
+//
// // try to satisfy the dependencies
// if not self._satisfy_depends(self.depends):
// return False
-//
+//
// // check for conflicts again (this time with the packages that are
// // makeed for install)
// if not self.check_conflicts():
// return False
-//
+//
// if self._cache._depcache.broken_count > 0:
// self._failure_string = _("Failed to satisfy all dependencies "
// "(broken cache)")
diff --git a/backends/aptcc/deb-file.h b/backends/aptcc/deb-file.h
index 84e2ef9..8f6dbce 100644
--- a/backends/aptcc/deb-file.h
+++ b/backends/aptcc/deb-file.h
@@ -1,6 +1,6 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/* deb-file.h
*
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
*
* Licensed under the GNU General Public License Version 2
*
@@ -36,7 +36,7 @@ public:
std::string version() const;
std::string architecture() const;
std::string conflicts() const;
-
+
// THIS should be moved to AptCC class
bool check();
std::string errorMsg() const;
diff --git a/backends/aptcc/dpkgpm.cpp b/backends/aptcc/dpkgpm.cpp
deleted file mode 100644
index ce490ea..0000000
--- a/backends/aptcc/dpkgpm.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "dpkgpm.h"
-
-#include <iostream>
-
-pkgDebDPkgPM::pkgDebDPkgPM(pkgDepCache *cache) :
- pkgDPkgPM(cache)
-{
-}
-
-void pkgDebDPkgPM::addDebFile(const std::string &filename)
-{
- PkgIterator pkg;
- std::cout << "PkgIterator " << pkg.end() << std::endl;
- Item item(Item::Install, pkg, filename);
- List.push_back(item);
-}
diff --git a/backends/aptcc/dpkgpm.h b/backends/aptcc/dpkgpm.h
deleted file mode 100644
index 730f29d..0000000
--- a/backends/aptcc/dpkgpm.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef DPKG_PM_H
-#define DPKG_PM_H
-
-#include <string>
-#include <apt-pkg/dpkgpm.h>
-
-class pkgDebDPkgPM : public pkgDPkgPM
-{
-public:
- pkgDebDPkgPM(pkgDepCache *cache);
-
- void addDebFile(const std::string &filename);
-};
-
-#endif
diff --git a/backends/aptcc/gstMatcher.cpp b/backends/aptcc/gstMatcher.cpp
index 7e5e1d6..4dd867c 100644
--- a/backends/aptcc/gstMatcher.cpp
+++ b/backends/aptcc/gstMatcher.cpp
@@ -1,20 +1,22 @@
-//
-// Copyright (C) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
+/* gstMatcher.cpp - Match GStreamer packages
+ *
+ * Copyright (c) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "gstMatcher.h"
diff --git a/backends/aptcc/gstMatcher.h b/backends/aptcc/gstMatcher.h
index 7f8ca7b..d6e18d7 100644
--- a/backends/aptcc/gstMatcher.h
+++ b/backends/aptcc/gstMatcher.h
@@ -1,21 +1,22 @@
-//
-// Copyright (C) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-//
+/* gstMatcher.h - Match GStreamer package names
+ *
+ * Copyright (c) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef GST_MATCHER_H
#define GST_MATCHER_H
diff --git a/backends/aptcc/matcher.cpp b/backends/aptcc/matcher.cpp
index 427b72e..4f88074 100644
--- a/backends/aptcc/matcher.cpp
+++ b/backends/aptcc/matcher.cpp
@@ -1,28 +1,30 @@
-// apt.cc
-//
-// Copyright 1999-2008 Daniel Burrows
-// Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
+/* matcher.cpp
+ *
+ * Copyright (c) 1999-2008 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "matcher.h"
#include <stdio.h>
#include <iostream>
-matcher::matcher(const string &matchers)
+Matcher::Matcher(const string &matchers)
: m_hasError(false)
{
string::const_iterator start = matchers.begin();
@@ -32,7 +34,7 @@ matcher::matcher(const string &matchers)
}
}
-matcher::~matcher()
+Matcher::~Matcher()
{
for (vector<regex_t>::iterator i=m_matches.begin();
i != m_matches.end(); ++i)
@@ -53,7 +55,7 @@ bool string_matches(const char *s, regex_t &pattern_nogroup)
return !regexec(&pattern_nogroup, s, 0, NULL, 0);
}
-bool matcher::matches(const string &s)
+bool Matcher::matches(const string &s)
{
int matchesCount = 0;
for (vector<regex_t>::iterator i=m_matches.begin();
@@ -68,7 +70,7 @@ bool matcher::matches(const string &s)
// This matcher is to be used for files
// pass a map so it can remember which patter was alread used
-bool matcher::matchesFile(const string &s, map<int, bool> &matchers_used)
+bool Matcher::matchesFile(const string &s, map<int, bool> &matchers_used)
{
int matchesCount = 0;
for (vector<regex_t>::iterator i = m_matches.begin();
@@ -87,7 +89,7 @@ bool matcher::matchesFile(const string &s, map<int, bool> &matchers_used)
return m_matches.size() == matchers_used.size();
}
-bool matcher::parse_pattern(string::const_iterator &start,
+bool Matcher::parse_pattern(string::const_iterator &start,
const std::string::const_iterator &end)
{
// Just filter blank strings out immediately.
@@ -130,7 +132,7 @@ bool matcher::parse_pattern(string::const_iterator &start,
}
-string matcher::parse_literal_string_tail(string::const_iterator &start,
+string Matcher::parse_literal_string_tail(string::const_iterator &start,
const string::const_iterator end)
{
std::string rval;
@@ -177,7 +179,7 @@ string matcher::parse_literal_string_tail(string::const_iterator &start,
// metacharacters (parentheses, ~, |, and !)
//
// Advances loc to the first character of 's' following the escaped string.
-string matcher::parse_substr(string::const_iterator &start,
+string Matcher::parse_substr(string::const_iterator &start,
const string::const_iterator &end)
{
std::string rval;
@@ -237,7 +239,7 @@ string matcher::parse_substr(string::const_iterator &start,
return rval;
}
-bool matcher::hasError() const
+bool Matcher::hasError() const
{
return m_hasError;
}
diff --git a/backends/aptcc/matcher.h b/backends/aptcc/matcher.h
index 9f334d3..e4d1cb2 100644
--- a/backends/aptcc/matcher.h
+++ b/backends/aptcc/matcher.h
@@ -1,23 +1,23 @@
-// apt.h -*-c++-*-
-//
-// Copyright 1999-2002, 2004-2005, 2007-2008 Daniel Burrows
-// Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-//
+/* matcher.h
+ *
+ * Copyright (c) 1999-2008 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef MATCHER_H
#define MATCHER_H
@@ -30,11 +30,11 @@
using namespace std;
-class matcher
+class Matcher
{
public:
- matcher(const string &matchers);
- ~matcher();
+ Matcher(const string &matchers);
+ ~Matcher();
bool matches(const string &s);
bool matchesFile(const string &s, map<int, bool> &matchers_used);
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 3a95816..c3abb86 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -25,18 +25,18 @@
#include <apt-pkg/algorithms.h>
#include <apt-pkg/aptconfiguration.h>
+#include <config.h>
+#include <pk-backend.h>
+#include <pk-backend-spawn.h>
+
#include "apt-intf.h"
#include "apt-utils.h"
#include "matcher.h"
#include "apt-messages.h"
-#include "acqprogress.h"
+#include "acqpkitstatus.h"
#include "pkg_acqfile.h"
#include "apt-sourceslist.h"
-#include <config.h>
-#include <pk-backend.h>
-#include <pk-backend-spawn.h>
-
#define PREUPGRADE_BINARY "/usr/bin/do-release-upgrade"
#define GDEBI_BINARY "/usr/bin/gdebi"
@@ -969,7 +969,7 @@ backend_search_package_thread (PkBackend *backend)
pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
pk_backend_set_allow_cancel (backend, true);
- matcher *m_matcher = new matcher(search);
+ Matcher *m_matcher = new Matcher(search);
g_free(search);
if (m_matcher->hasError()) {
g_debug("Regex compilation error");
diff --git a/backends/aptcc/pkg_dpkgpm.cpp b/backends/aptcc/pkg_dpkgpm.cpp
new file mode 100644
index 0000000..4a495bd
--- /dev/null
+++ b/backends/aptcc/pkg_dpkgpm.cpp
@@ -0,0 +1,37 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "pkg_dpkgpm.h"
+
+#include <iostream>
+
+pkgDebDPkgPM::pkgDebDPkgPM(pkgDepCache *cache) :
+ pkgDPkgPM(cache)
+{
+}
+
+void pkgDebDPkgPM::addDebFile(const std::string &filename)
+{
+ PkgIterator pkg;
+ std::cout << "PkgIterator " << pkg.end() << std::endl;
+ Item item(Item::Install, pkg, filename);
+ List.push_back(item);
+}
diff --git a/backends/aptcc/pkg_dpkgpm.h b/backends/aptcc/pkg_dpkgpm.h
new file mode 100644
index 0000000..320ae61
--- /dev/null
+++ b/backends/aptcc/pkg_dpkgpm.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef DEB_DPKG_PM_H
+#define DEB_DPKG_PM_H
+
+#include <string>
+#include <apt-pkg/dpkgpm.h>
+
+class pkgDebDPkgPM : public pkgDPkgPM
+{
+public:
+ pkgDebDPkgPM(pkgDepCache *cache);
+
+ void addDebFile(const std::string &filename);
+};
+
+#endif
commit 261d85b6502b7ad802f11f7142412ff3bcbc78ae
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Mar 5 21:21:43 2012 +0100
Reorganise parts of AptCC to make the code more readable
* Proper license headers for most files
* Rename apt/aptcc -> AptIntf, to separate Apt components
from non-apt, backend specific parts
* Fix some indentation mistakes
* Fix some "broken" copy&paste parts of old Aptitude code
* Remove unused components
diff --git a/backends/aptcc/Makefile.am b/backends/aptcc/Makefile.am
index 415cd39..cc0274a 100644
--- a/backends/aptcc/Makefile.am
+++ b/backends/aptcc/Makefile.am
@@ -1,20 +1,19 @@
INCLUDES = \
- -DDATADIR=\"$(datadir)\" \
+ -DDATADIR=\"$(datadir)\" \
-DG_LOG_DOMAIN=\"PackageKit-Aptcc\"
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_aptcc.la
libpk_backend_aptcc_la_SOURCES = pkg_acqfile.cpp \
- aptcc_show_broken.cpp \
- aptcc_show_error.cpp \
- apt-utils.cpp \
acqprogress.cpp \
deb-file.cpp \
dpkgpm.cpp \
matcher.cpp \
gstMatcher.cpp \
- rsources.cpp \
- apt.cpp \
+ apt-messages.cpp \
+ apt-utils.cpp \
+ apt-sourceslist.cpp \
+ apt-intf.cpp \
pk-backend-aptcc.cpp
libpk_backend_aptcc_la_LIBADD = -lcrypt -lapt-pkg -lapt-inst $(PK_PLUGIN_LIBS)
libpk_backend_aptcc_la_LDFLAGS = -module -avoid-version $(APTCC_LIBS) $(GSTREAMER_LIBS)
@@ -25,17 +24,16 @@ aptconfdir = ${SYSCONFDIR}/apt/apt.conf.d
aptconf_DATA = 20packagekit
EXTRA_DIST = 20packagekit \
- apt.h \
+ apt-intf.h \
apt-utils.h \
+ apt-sourceslist.h \
gstMatcher.h \
matcher.h \
deb-file.h \
dpkgpm.h \
- aptcc_show_broken.h \
+ apt-messages.h \
acqprogress.h \
- aptcc_show_error.h \
- pkg_acqfile.h \
- rsources.h
+ pkg_acqfile.h
helperdir = $(datadir)/PackageKit/helpers/aptcc
dist_helper_DATA = \
diff --git a/backends/aptcc/acqprogress.cpp b/backends/aptcc/acqprogress.cpp
index cef398e..0374ce2 100644
--- a/backends/aptcc/acqprogress.cpp
+++ b/backends/aptcc/acqprogress.cpp
@@ -24,7 +24,7 @@ using namespace std;
// AcqPackageKitStatus::AcqPackageKitStatus - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-AcqPackageKitStatus::AcqPackageKitStatus(aptcc *apt, PkBackend *backend, bool &cancelled) :
+AcqPackageKitStatus::AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled) :
m_apt(apt),
m_backend(backend),
_cancelled(cancelled),
diff --git a/backends/aptcc/acqprogress.h b/backends/aptcc/acqprogress.h
index ccec64d..68c4499 100644
--- a/backends/aptcc/acqprogress.h
+++ b/backends/aptcc/acqprogress.h
@@ -13,12 +13,12 @@
#include <apt-pkg/acquire.h>
#include <pk-backend.h>
-#include "apt.h"
+#include "apt-intf.h"
class AcqPackageKitStatus : public pkgAcquireStatus
{
public:
- AcqPackageKitStatus(aptcc *apt, PkBackend *backend, bool &cancelled);
+ AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled);
virtual bool MediaChange(string Media, string Drive);
virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
@@ -41,7 +41,7 @@ private:
unsigned long last_sub_percent;
double last_CPS;
string last_package_name;
- aptcc *m_apt;
+ AptIntf *m_apt;
vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > packages;
set<string> currentPackages;
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
new file mode 100644
index 0000000..4798121
--- /dev/null
+++ b/backends/aptcc/apt-intf.cpp
@@ -0,0 +1,2195 @@
+/* apt-intf.cpp
+ *
+ * Copyright (c) 1999-2008 Daniel Burrows
+ * Copyright (c) 2004 Michael Vogt <mvo at debian.org>
+ * 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "apt-intf.h"
+
+#include "apt-utils.h"
+#include "matcher.h"
+#include "gstMatcher.h"
+#include "apt-messages.h"
+#include "acqprogress.h"
+#include "pkg_acqfile.h"
+#include "deb-file.h"
+#include "dpkgpm.h"
+
+#include <apt-pkg/error.h>
+#include <apt-pkg/tagfile.h>
+#include <apt-pkg/algorithms.h>
+#include <apt-pkg/init.h>
+#include <apt-pkg/sptr.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/aptconfiguration.h>
+
+#include <sys/statvfs.h>
+#include <sys/statfs.h>
+#include <sys/wait.h>
+#include <sys/fcntl.h>
+#include <pty.h>
+
+#define RAMFS_MAGIC 0x858458f6
+
+#include <fstream>
+#include <dirent.h>
+#include <assert.h>
+#include <regex.h>
+
+AptIntf::AptIntf(PkBackend *backend, bool &cancel)
+ :
+ packageRecords(0),
+ packageCache(0),
+ packageDepCache(0),
+ packageSourceList(0),
+ Map(0),
+ Policy(0),
+ m_backend(backend),
+ _cancel(cancel),
+ m_terminalTimeout(120),
+ m_lastSubProgress(0)
+{
+ _cancel = false;
+}
+
+bool AptIntf::init()
+{
+ gchar *locale;
+ gchar *http_proxy;
+ gchar *ftp_proxy;
+
+ m_isMultiArch = APT::Configuration::getArchitectures(false).size() > 1;
+
+ // Set PackageKit status
+ pk_backend_set_status(m_backend, PK_STATUS_ENUM_LOADING_CACHE);
+
+ // set locale
+ if (locale = pk_backend_get_locale(m_backend)) {
+ setlocale(LC_ALL, locale);
+// TODO why this cuts characthers on ui?
+// string _locale(locale);
+// size_t found;
+// found = _locale.find('.');
+// _locale.erase(found);
+// _config->Set("APT::Acquire::Translation", _locale);
+ }
+
+ // set http proxy
+ http_proxy = pk_backend_get_proxy_http(m_backend);
+ setenv("http_proxy", http_proxy, 1);
+
+ // set ftp proxy
+ ftp_proxy = pk_backend_get_proxy_ftp(m_backend);
+ setenv("ftp_proxy", ftp_proxy, 1);
+
+ packageSourceList = new pkgSourceList;
+ // Read the source list
+ packageSourceList->ReadMainList();
+
+ // Generate it and map it
+ bool Res = pkgMakeStatusCache(*packageSourceList, Progress, &Map, true);
+ Progress.Done();
+ if(!Res) {
+ return false;
+ //"The package lists or status file could not be parsed or opened."
+ }
+
+ packageCache = new pkgCache(Map);
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ // create depcache
+ Policy = new pkgPolicy(packageCache);
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ if (!ReadPinFile(*Policy)) {
+ return false;
+ }
+
+ packageDepCache = new pkgDepCache(packageCache, Policy);
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ packageDepCache->Init(&Progress);
+ Progress.Done();
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ // Create the text record parser
+ packageRecords = new pkgRecords(*packageDepCache);
+}
+
+AptIntf::~AptIntf()
+{
+ if (packageRecords)
+ {
+ g_debug ("~apt_init packageRecords");
+ delete packageRecords;
+ }
+
+ if (packageCache)
+ {
+ g_debug ("~apt_init packageCache");
+ delete packageCache;
+ }
+
+ if (packageDepCache)
+ {
+ g_debug ("~apt_init packageDepCache");
+ delete packageDepCache;
+ }
+
+ if (Policy)
+ {
+ g_debug ("~apt_init Policy");
+ delete Policy;
+ }
+
+ if (packageSourceList)
+ {
+ delete packageSourceList;
+ }
+
+ pk_backend_finished(m_backend);
+
+ delete Map;
+}
+
+void AptIntf::cancel()
+{
+ if (!_cancel) {
+ _cancel = true;
+ pk_backend_set_status(m_backend, PK_STATUS_ENUM_CANCEL);
+ }
+ if (m_child_pid > 0) {
+ kill(m_child_pid, SIGTERM);
+ }
+}
+
+pair<pkgCache::PkgIterator, pkgCache::VerIterator>
+ AptIntf::find_package_id(const gchar *package_id, bool &found)
+{
+ gchar **parts;
+ pkgCache::VerIterator ver;
+ pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
+
+ found = true;
+
+ parts = pk_package_id_split (package_id);
+ gchar *pkgNameArch;
+ pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
+ pkg_ver.first = packageCache->FindPkg(pkgNameArch);
+ g_free(pkgNameArch);
+
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (pkg_ver.first.end() == true ||
+ (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
+ {
+ g_strfreev (parts);
+ return pkg_ver;
+ }
+
+ ver = find_ver(pkg_ver.first);
+ // check to see if the provided package isn't virtual too
+ if (ver.end() == false &&
+ strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
+ {
+ g_strfreev (parts);
+ pkg_ver.second = ver;
+ return pkg_ver;
+ }
+
+ ver = find_candidate_ver(pkg_ver.first);
+ // check to see if the provided package isn't virtual too
+ if (ver.end() == false &&
+ strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
+ {
+ g_strfreev (parts);
+ pkg_ver.second = ver;
+ return pkg_ver;
+ }
+
+ found = false;
+ g_strfreev (parts);
+ return pkg_ver;
+}
+
+pkgCache::VerIterator AptIntf::find_candidate_ver(const pkgCache::PkgIterator &pkg)
+{
+ // get the candidate version iterator
+ return (*packageDepCache)[pkg].CandidateVerIter(*packageDepCache);
+}
+
+pkgCache::VerIterator AptIntf::find_ver(const pkgCache::PkgIterator &pkg)
+{
+ // if the package is installed return the current version
+ if(!pkg.CurrentVer().end()) {
+ return pkg.CurrentVer();
+ }
+
+ // Else get the candidate version iterator
+ pkgCache::VerIterator candver = find_candidate_ver(pkg);
+ if(!candver.end())
+ {
+ return candver;
+ }
+
+ // return the version list as a last resource
+ return pkg.VersionList();
+}
+
+// used to emit packages it collects all the needed info
+void AptIntf::emit_package(const pkgCache::PkgIterator &pkg,
+ const pkgCache::VerIterator &ver,
+ PkBitfield filters,
+ PkInfoEnum state)
+{
+ // check the state enum to see if it was not set.
+ if (state == PK_INFO_ENUM_UNKNOWN) {
+ if (pkg->CurrentState == pkgCache::State::Installed &&
+ pkg.CurrentVer() == ver) {
+ state = PK_INFO_ENUM_INSTALLED;
+ } else {
+ state = PK_INFO_ENUM_AVAILABLE;
+ }
+ }
+
+ if (m_isMultiArch &&
+ (pk_bitfield_contain(filters, PK_FILTER_ENUM_ARCH) && state == PK_INFO_ENUM_AVAILABLE)) {
+ // don't emit the package if it does not match
+ // the native architecture
+ if (strcmp(ver.Arch(), "all") != 0 &&
+ strcmp(ver.Arch(), _config->Find("APT::Architecture").c_str()) != 0) {
+ return;
+ }
+ }
+
+ if (filters != 0) {
+ std::string str = ver.Section() == NULL ? "" : ver.Section();
+ std::string section, repo_section;
+
+ size_t found;
+ found = str.find_last_of("/");
+ section = str.substr(found + 1);
+ repo_section = str.substr(0, found);
+
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)
+ && state == PK_INFO_ENUM_INSTALLED) {
+ return;
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)
+ && state == PK_INFO_ENUM_AVAILABLE) {
+ return;
+ }
+
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_DEVELOPMENT)) {
+ // if ver.end() means unknow
+ // strcmp will be true when it's different than devel
+ std::string pkgName = pkg.Name();
+ if (!ends_with(pkgName, "-dev") &&
+ !ends_with(pkgName, "-dbg") &&
+ section.compare("devel") &&
+ section.compare("libdevel")) {
+ return;
+ }
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_DEVELOPMENT)) {
+ std::string pkgName = pkg.Name();
+ if (ends_with(pkgName, "-dev") ||
+ ends_with(pkgName, "-dbg") ||
+ !section.compare("devel") ||
+ !section.compare("libdevel")) {
+ return;
+ }
+ }
+
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_GUI)) {
+ // if ver.end() means unknow
+ // strcmp will be true when it's different than x11
+ if (section.compare("x11") && section.compare("gnome") &&
+ section.compare("kde") && section.compare("graphics")) {
+ return;
+ }
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_GUI)) {
+ if (!section.compare("x11") || !section.compare("gnome") ||
+ !section.compare("kde") || !section.compare("graphics")) {
+ return;
+ }
+ }
+
+ // TODO add Ubuntu handling
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_FREE)) {
+ if (!repo_section.compare("contrib") ||
+ !repo_section.compare("non-free")) {
+ return;
+ }
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_FREE)) {
+ if (repo_section.compare("contrib") &&
+ repo_section.compare("non-free")) {
+ return;
+ }
+ }
+
+ // TODO test this one..
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_COLLECTIONS)) {
+ if (!repo_section.compare("metapackages")) {
+ return;
+ }
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_COLLECTIONS)) {
+ if (repo_section.compare("metapackages")) {
+ return;
+ }
+ }
+
+ }
+ pkgCache::VerFileIterator vf = ver.FileList();
+
+ gchar *package_id;
+ package_id = pk_package_id_build(pkg.Name(),
+ ver.VerStr(),
+ ver.Arch(),
+ vf.File().Archive() == NULL ? "" : vf.File().Archive());
+ pk_backend_package(m_backend,
+ state,
+ package_id,
+ get_short_description(ver, packageRecords).c_str());
+ g_free(package_id);
+}
+
+void AptIntf::emit_packages(PkgList &output,
+ PkBitfield filters,
+ PkInfoEnum state)
+{
+ // Sort so we can remove the duplicated entries
+ sort(output.begin(), output.end(), compare());
+ // Remove the duplicated entries
+ output.erase(unique(output.begin(),
+ output.end(),
+ result_equality()),
+ output.end());
+
+ for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
+ i != output.end(); ++i)
+ {
+ if (_cancel) {
+ break;
+ }
+ emit_package(i->first, i->second, filters, state);
+ }
+}
+
+void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
+{
+ PkInfoEnum state;
+ // Sort so we can remove the duplicated entries
+ sort(output.begin(), output.end(), compare());
+ // Remove the duplicated entries
+ output.erase(unique(output.begin(),
+ output.end(),
+ result_equality()),
+ output.end());
+
+ for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
+ i != output.end(); ++i)
+ {
+ if (_cancel) {
+ break;
+ }
+
+ // the default update info
+ state = PK_INFO_ENUM_NORMAL;
+
+ // let find what kind of upgrade this is
+ pkgCache::VerFileIterator vf = i->second.FileList();
+ std::string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
+ std::string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
+ std::string label = vf.File().Label() == NULL ? "" : vf.File().Label();
+ if (origin.compare("Debian") == 0 ||
+ origin.compare("Ubuntu") == 0) {
+ if (ends_with(archive, "-security") ||
+ label.compare("Debian-Security") == 0) {
+ state = PK_INFO_ENUM_SECURITY;
+ } else if (ends_with(archive, "-backports")) {
+ state = PK_INFO_ENUM_ENHANCEMENT;
+ } else if (ends_with(archive, "-updates")) {
+ state = PK_INFO_ENUM_BUGFIX;
+ }
+ } else if (origin.compare("Backports.org archive") == 0 ||
+ ends_with(origin, "-backports")) {
+ state = PK_INFO_ENUM_ENHANCEMENT;
+ }
+
+ emit_package(i->first, i->second, filters, state);
+ }
+}
+
+// search packages which provide a codec (specified in "values")
+void AptIntf::providesCodec(PkgList &output, gchar **values)
+{
+ GstMatcher *matcher = new GstMatcher(values);
+ if (!matcher->hasMatches()) {
+ return;
+ }
+
+ for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg)
+ {
+ if (_cancel) {
+ delete matcher;
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // TODO search in updates packages
+ // Ignore virtual packages
+ pkgCache::VerIterator ver = find_ver(pkg);
+ if (ver.end() == true) {
+ ver = find_candidate_ver(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ }
+
+ pkgCache::VerFileIterator vf = ver.FileList();
+ pkgRecords::Parser &rec = packageRecords->Lookup(vf);
+ const char *start, *stop;
+ rec.GetRec(start, stop);
+ string record(start, stop - start);
+ if (matcher->matches(record)) {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ }
+ }
+
+ delete matcher;
+}
+
+// search packages which provide the libraries specified in "values"
+void AptIntf::providesLibrary(PkgList &output, gchar **values)
+{
+ bool ret = false;
+ // Quick-check for library names
+ for (uint i = 0; i < g_strv_length(values); i++)
+ if (g_str_has_prefix (values[i], "lib")) {
+ ret = true;
+ break;
+ }
+ if (!ret)
+ return;
+
+ const char *libreg_str = "^\\(lib.*\\)\\.so\\.[0-9]*";
+ g_debug ("RegStr: %s", libreg_str);
+ regex_t libreg;
+ if(regcomp(&libreg, libreg_str, 0) != 0) {
+ g_debug("Regex compilation error: ", libreg);
+ return;
+ }
+
+ gchar *value;
+ for (uint i = 0; i < g_strv_length(values); i++) {
+ value = values[i];
+ regmatch_t matches[2];
+ if (regexec(&libreg, value, 2, matches, 0) != REG_NOMATCH) {
+ string libPkgName = string(value, matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
+
+ string strvalue = string(value);
+ ssize_t pos = strvalue.find (".so.");
+ if ((pos != string::npos) && (pos > 0)) {
+ // If last char is a number, add a "-" (to be policy-compliant)
+ if (g_ascii_isdigit (libPkgName.at (libPkgName.length () - 1)))
+ libPkgName.append ("-");
+
+ libPkgName.append (strvalue.substr (pos + 4));
+ }
+
+ g_debug ("pkg-name: %s", libPkgName.c_str ());
+
+ for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // TODO: Ignore virtual packages
+ pkgCache::VerIterator ver = find_ver (pkg);
+ if (ver.end() == true) {
+ ver = find_candidate_ver(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ }
+
+ // Make everything lower-case
+ std::transform(libPkgName.begin(), libPkgName.end(), libPkgName.begin(), ::tolower);
+
+ if (g_strcmp0 (pkg.Name (), libPkgName.c_str ()) == 0) {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ }
+ }
+
+ } else {
+ g_debug("libmatcher: Did not match: %s", value);
+ }
+ }
+
+}
+
+// used to emit packages it collects all the needed info
+void AptIntf::emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
+{
+ pkgCache::VerIterator ver;
+ if (version.end() == false) {
+ ver = version;
+ } else {
+ ver = find_ver(pkg);
+ }
+ std::string section = ver.Section() == NULL ? "" : ver.Section();
+
+ size_t found;
+ found = section.find_last_of("/");
+ section = section.substr(found + 1);
+
+ pkgCache::VerFileIterator vf = ver.FileList();
+ pkgRecords::Parser &rec = packageRecords->Lookup(vf);
+
+ long size;
+ if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
+ // if the package is installed emit the installed size
+ size = ver->InstalledSize;
+ } else {
+ size = ver->Size;
+ }
+
+ gchar *package_id;
+ package_id = pk_package_id_build(pkg.Name(),
+ ver.VerStr(),
+ ver.Arch(),
+ vf.File().Archive() == NULL ? "" : vf.File().Archive());
+
+ pk_backend_details(m_backend,
+ package_id,
+ "unknown",
+ get_enum_group(section),
+ get_long_description_parsed(ver, packageRecords).c_str(),
+ rec.Homepage().c_str(),
+ size);
+
+ g_free(package_id);
+}
+
+void AptIntf::emitDetails(PkgList &pkgs)
+{
+ // Sort so we can remove the duplicated entries
+ sort(pkgs.begin(), pkgs.end(), compare());
+ // Remove the duplicated entries
+ pkgs.erase(unique(pkgs.begin(), pkgs.end(), result_equality()),
+ pkgs.end());
+
+ for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
+ {
+ if (_cancel) {
+ break;
+ }
+
+ emitDetails(i->first, i->second);
+ }
+}
+
+// used to emit packages it collects all the needed info
+void AptIntf::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
+{
+ // Get the version of the current package
+ pkgCache::VerIterator currver = find_ver(pkg);
+ pkgCache::VerFileIterator currvf = currver.FileList();
+ // Build a package_id from the current version
+ gchar *current_package_id;
+ current_package_id = pk_package_id_build(pkg.Name(),
+ currver.VerStr(),
+ currver.Arch(),
+ currvf.File().Archive() == NULL ? "" : currvf.File().Archive());
+
+ // Get the update version
+ pkgCache::VerIterator candver;
+ if (version.end() == false) {
+ candver = version;
+ } else {
+ candver = find_candidate_ver(pkg);
+ }
+
+ pkgCache::VerFileIterator vf = candver.FileList();
+ string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
+ pkgRecords::Parser &rec = packageRecords->Lookup(candver.FileList());
+
+ // Build the changelogURI
+ char uri[512];
+ string srcpkg;
+ string verstr;
+
+ if (rec.SourcePkg().empty()) {
+ srcpkg = pkg.Name();
+ } else {
+ srcpkg = rec.SourcePkg();
+ }
+ if (origin.compare("Debian") == 0 || origin.compare("Ubuntu") == 0) {
+ string prefix;
+
+ string src_section = candver.Section() == NULL ? "" : candver.Section();
+ if(src_section.find('/') != src_section.npos) {
+ src_section = string(src_section, 0, src_section.find('/'));
+ } else {
+ src_section = "main";
+ }
+
+ prefix += srcpkg[0];
+ if(srcpkg.size() > 3 && srcpkg[0] == 'l' && srcpkg[1] == 'i' && srcpkg[2] == 'b') {
+ prefix = string("lib") + srcpkg[3];
+ }
+
+ if(candver.VerStr() != NULL) {
+ verstr = candver.VerStr();
+ }
+
+ if(verstr.find(':') != verstr.npos) {
+ verstr = string(verstr, verstr.find(':') + 1);
+ }
+
+ if (origin.compare("Debian") == 0) {
+ snprintf(uri,
+ 512,
+ "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
+ prefix.c_str(),
+ srcpkg.c_str(),
+ srcpkg.c_str(),
+ verstr.c_str());
+ } else {
+ snprintf(uri,
+ 512,
+ "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
+ prefix.c_str(),
+ srcpkg.c_str(),
+ srcpkg.c_str(),
+ verstr.c_str());
+ }
+ } else {
+ string pkgfilename;
+ const char *start, *stop;
+ pkgTagSection sec;
+ unsigned long len;
+
+ rec.GetRec(start, stop);
+ len = stop - start;
+ // add +1 to ensure we have the double lineline in the buffer
+ if (start && sec.Scan(start, len + 1)) {
+ pkgfilename = sec.FindS("Filename");
+ }
+
+ string cadidateOriginSiteUrl;
+ if(!vf.end() && vf.File() && vf.File().Site()) {
+ cadidateOriginSiteUrl = vf.File().Site();
+ }
+
+ pkgfilename = pkgfilename.substr(0, pkgfilename.find_last_of('.')) + ".changelog";
+ snprintf(uri,512,"http://%s/%s",
+ cadidateOriginSiteUrl.c_str(),
+ pkgfilename.c_str());
+ }
+ // Create the download object
+ AcqPackageKitStatus Stat(this, m_backend, _cancel);
+
+ // get a fetcher
+ pkgAcquire fetcher;
+ fetcher.Setup(&Stat);
+
+ // fetch the changelog
+ pk_backend_set_status(m_backend, PK_STATUS_ENUM_DOWNLOAD_CHANGELOG);
+ string filename = getChangelogFile(pkg.Name(), origin, verstr, srcpkg, uri, &fetcher);
+
+ string changelog;
+ string update_text;
+ ifstream in(filename.c_str());
+ string line;
+ GRegex *regexVer;
+ regexVer = g_regex_new("(?'source'.+) \\((?'version'.*)\\) "
+ "(?'dist'.+); urgency=(?'urgency'.+)",
+ G_REGEX_CASELESS,
+ G_REGEX_MATCH_ANCHORED,
+ 0);
+ GRegex *regexDate;
+ regexDate = g_regex_new("^ -- (?'maintainer'.+) (?'mail'<.+>) (?'date'.+)$",
+ G_REGEX_CASELESS,
+ G_REGEX_MATCH_ANCHORED,
+ 0);
+ string updated;
+ string issued;
+ while (getline(in, line)) {
+ // no need to free str later, it is allocated in a static buffer
+ const char *str = utf8(line.c_str());
+ if (strcmp(str, "") == 0) {
+ changelog.append("\n");
+ continue;
+ } else {
+ changelog.append(str);
+ changelog.append("\n");
+ }
+
+ if (starts_with(str, srcpkg.c_str())) {
+ // Check to see if the the text isn't about the current package,
+ // otherwise add a == version ==
+ GMatchInfo *match_info;
+ if (g_regex_match(regexVer, str, G_REGEX_MATCH_ANCHORED, &match_info)) {
+ gchar *version;
+ version = g_match_info_fetch_named(match_info, "version");
+
+ // Compare if the current version is shown in the changelog, to not
+ // display old changelog information
+ if (_system != 0 &&
+ _system->VS->DoCmpVersion(version, version + strlen(version),
+ currver.VerStr(), currver.VerStr() + strlen(currver.VerStr())) <= 0) {
+ g_free (version);
+ break;
+ } else {
+ if (!update_text.empty()) {
+ update_text.append("\n\n");
+ }
+ update_text.append(" == ");
+ update_text.append(version);
+ update_text.append(" ==");
+ g_free (version);
+ }
+ }
+ g_match_info_free (match_info);
+ } else if (starts_with(str, " ")) {
+ // update descritption
+ update_text.append("\n");
+ update_text.append(str);
+ } else if (starts_with(str, " --")) {
+ // Parse the text to know when the update was issued,
+ // and when it got updated
+ GMatchInfo *match_info;
+ if (g_regex_match(regexDate, str, G_REGEX_MATCH_ANCHORED, &match_info)) {
+ GTimeVal dateTime = {0, 0};
+ gchar *date;
+ date = g_match_info_fetch_named(match_info, "date");
+ g_warn_if_fail(RFC1123StrToTime(date, dateTime.tv_sec));
+ g_free(date);
+
+ issued = g_time_val_to_iso8601(&dateTime);
+ if (updated.empty()) {
+ updated = g_time_val_to_iso8601(&dateTime);
+ }
+ }
+ g_match_info_free(match_info);
+ }
+ }
+ // Clean structures
+ g_regex_unref(regexVer);
+ g_regex_unref(regexDate);
+ unlink(filename.c_str());
+
+ // Check if the update was updates since it was issued
+ if (issued.compare(updated) == 0) {
+ updated = "";
+ }
+
+ // Build a package_id from the update version
+ string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
+ gchar *package_id;
+ package_id = pk_package_id_build(pkg.Name(),
+ candver.VerStr(),
+ candver.Arch(),
+ archive.c_str());
+
+ PkUpdateStateEnum updateState = PK_UPDATE_STATE_ENUM_UNKNOWN;
+ if (archive.compare("stable") == 0) {
+ updateState = PK_UPDATE_STATE_ENUM_STABLE;
+ } else if (archive.compare("testing") == 0) {
+ updateState = PK_UPDATE_STATE_ENUM_TESTING;
+ } else if (archive.compare("unstable") == 0 ||
+ archive.compare("experimental") == 0)
+ {
+ updateState = PK_UPDATE_STATE_ENUM_UNSTABLE;
+ }
+
+ PkRestartEnum restart = PK_RESTART_ENUM_NONE;
+ if (starts_with(pkg.Name(), "linux-image-") ||
+ starts_with(pkg.Name(), "nvidia-") ||
+ strcmp(pkg.Name(), "libc6") == 0 ||
+ strcmp(pkg.Name(), "dbus") == 0) {
+ restart = PK_RESTART_ENUM_SYSTEM;
+ }
+
+ pk_backend_update_detail(m_backend,
+ package_id,
+ current_package_id,//const gchar *updates
+ "",//const gchar *obsoletes
+ "",//const gchar *vendor_url
+ getBugzillaUrls(changelog).c_str(),//const gchar *bugzilla_url
+ getCVEUrls(changelog).c_str(),//const gchar *cve_url
+ restart,//PkRestartEnum restart
+ update_text.c_str(),//const gchar *update_text
+ changelog.c_str(),//const gchar *changelog
+ updateState,//PkUpdateStateEnum state
+ issued.c_str(), //const gchar *issued_text
+ updated.c_str() //const gchar *updated_text
+ );
+ g_free(current_package_id);
+ g_free(package_id);
+}
+
+void AptIntf::emitUpdateDetails(PkgList &pkgs)
+{
+ for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
+ {
+ if (_cancel) {
+ break;
+ }
+
+ emitUpdateDetails(i->first, i->second);
+ }
+}
+
+void AptIntf::get_depends(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive)
+{
+ pkgCache::DepIterator dep = find_ver(pkg).DependsList();
+ while (!dep.end()) {
+ if (_cancel) {
+ break;
+ }
+ pkgCache::VerIterator ver = find_ver(dep.TargetPkg());
+ // Ignore packages that exist only due to dependencies.
+ if (ver.end()) {
+ dep++;
+ continue;
+ } else if (dep->Type == pkgCache::Dep::Depends) {
+ if (recursive) {
+ if (!contains(output, dep.TargetPkg())) {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
+ get_depends(output, dep.TargetPkg(), recursive);
+ }
+ } else {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
+ }
+ }
+ dep++;
+ }
+}
+
+void AptIntf::get_requires(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive)
+{
+ for (pkgCache::PkgIterator parentPkg = packageCache->PkgBegin(); !parentPkg.end(); ++parentPkg) {
+ if (_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (parentPkg.VersionList().end() && parentPkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // Don't insert virtual packages instead add what it provides
+ pkgCache::VerIterator ver = find_ver(parentPkg);
+ if (ver.end() == false) {
+ vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > deps;
+ get_depends(deps, parentPkg, false);
+ for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=deps.begin();
+ i != deps.end();
+ ++i)
+ {
+ if (i->first == pkg) {
+ if (recursive) {
+ if (!contains(output, parentPkg)) {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
+ get_requires(output, parentPkg, recursive);
+ }
+ } else {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
+vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel)
+{
+ vector<string> packageList;
+ regex_t re;
+ gchar *search;
+ gchar *values_str;
+
+ values_str = g_strjoinv("$|^", values);
+ search = g_strdup_printf("^%s$",
+ values_str);
+ g_free(values_str);
+ if(regcomp(&re, search, REG_NOSUB) != 0) {
+ g_debug("Regex compilation error");
+ g_free(search);
+ return vector<string>();
+ }
+ g_free(search);
+
+ DIR *dp;
+ struct dirent *dirp;
+ if (!(dp = opendir("/var/lib/dpkg/info/"))) {
+ g_debug ("Error opening /var/lib/dpkg/info/\n");
+ regfree(&re);
+ return vector<string>();
+ }
+
+ string line;
+ while ((dirp = readdir(dp)) != NULL) {
+ if (_cancel) {
+ break;
+ }
+ if (ends_with(dirp->d_name, ".list")) {
+ string f = "/var/lib/dpkg/info/" + string(dirp->d_name);
+ ifstream in(f.c_str());
+ if (!in != 0) {
+ continue;
+ }
+ while (!in.eof()) {
+ getline(in, line);
+ if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
+ string file(dirp->d_name);
+ packageList.push_back(file.erase(file.size() - 5, file.size()));
+ break;
+ }
+ }
+ }
+ }
+ closedir(dp);
+ regfree(&re);
+ return packageList;
+}
+
+// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
+vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel)
+{
+ vector<string> packageList;
+ regex_t re;
+ gchar *value;
+ gchar *values_str;
+
+ values_str = g_strjoinv("|", values);
+ value = g_strdup_printf("^MimeType=\\(.*;\\)\\?\\(%s\\)\\(;.*\\)\\?$",
+ values_str);
+ g_free(values_str);
+
+ if(regcomp(&re, value, REG_NOSUB) != 0) {
+ g_debug("Regex compilation error");
+ g_free(value);
+ return vector<string>();
+ }
+ g_free(value);
+
+ DIR *dp;
+ struct dirent *dirp;
+ if (!(dp = opendir("/usr/share/app-install/desktop/"))) {
+ g_debug ("Error opening /usr/share/app-install/desktop/\n");
+ regfree(&re);
+ error = true;
+ return vector<string>();
+ }
+
+ string line;
+ while ((dirp = readdir(dp)) != NULL) {
+ if (_cancel) {
+ break;
+ }
+ if (ends_with(dirp->d_name, ".desktop")) {
+ string f = "/usr/share/app-install/desktop/" + string(dirp->d_name);
+ ifstream in(f.c_str());
+ if (!in != 0) {
+ continue;
+ }
+ bool getName = false;
+ while (!in.eof()) {
+ getline(in, line);
+ if (getName) {
+ if (starts_with(line, "X-AppInstall-Package=")) {
+ // Remove the X-AppInstall-Package=
+ packageList.push_back(line.substr(21));
+ break;
+ }
+ } else {
+ if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
+ in.seekg(ios_base::beg);
+ getName = true;
+ }
+ }
+ }
+ }
+ }
+
+ closedir(dp);
+ regfree(&re);
+ return packageList;
+}
+
+// used to emit files it reads the info directly from the files
+void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
+{
+ static string filelist;
+ string line;
+ gchar **parts;
+
+ parts = pk_package_id_split (pi);
+ filelist.erase(filelist.begin(), filelist.end());
+
+ string fName;
+ if (m_isMultiArch) {
+ fName = "/var/lib/dpkg/info/" +
+ string(parts[PK_PACKAGE_ID_NAME]) +
+ ":" +
+ string(parts[PK_PACKAGE_ID_ARCH]) +
+ ".list";
+ } else {
+ fName = "/var/lib/dpkg/info/" +
+ string(parts[PK_PACKAGE_ID_NAME]) +
+ ".list";
+ }
+ g_strfreev (parts);
+
+ if (FileExists(fName)) {
+ ifstream in(fName.c_str());
+ if (!in != 0) {
+ return;
+ }
+ while (in.eof() == false && filelist.empty()) {
+ getline(in, line);
+ filelist += line;
+ }
+ while (in.eof() == false) {
+ getline(in, line);
+ if (!line.empty()) {
+ filelist += ";" + line;
+ }
+ }
+
+ if (!filelist.empty()) {
+ pk_backend_files (backend, pi, filelist.c_str());
+ }
+ }
+}
+
+static bool checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
+{
+ string UntrustedList;
+ for (pkgAcquire::ItemIterator I = fetcher.ItemsBegin(); I < fetcher.ItemsEnd(); ++I)
+ {
+ if (!(*I)->IsTrusted())
+ {
+ UntrustedList += string((*I)->ShortDesc()) + " ";
+ }
+ }
+
+ if (UntrustedList == "")
+ {
+ return true;
+ }
+
+ if (pk_backend_get_bool(backend, "only_trusted") == false ||
+ _config->FindB("APT::Get::AllowUnauthenticated", false) == true)
+ {
+ g_debug ("Authentication warning overridden.\n");
+ return true;
+ }
+
+ string warning("The following packages cannot be authenticated:\n");
+ warning += UntrustedList;
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED,
+ warning.c_str());
+ _error->Discard();
+ return false;
+}
+
+bool AptIntf::TryToInstall(pkgCache::PkgIterator Pkg,
+ pkgDepCache &Cache,
+ pkgProblemResolver &Fix,
+ bool Remove,
+ bool BrokenFix,
+ unsigned int &ExpectedInst)
+{
+ // This is a pure virtual package and there is a single available provides
+ if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
+ Pkg.ProvidesList()->NextProvides == 0)
+ {
+ pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
+ Pkg = Tmp;
+ }
+
+ // Check if there is something at all to install
+ pkgDepCache::StateCache &State = Cache[Pkg];
+ if (Remove == true && Pkg->CurrentVer == 0)
+ {
+ Fix.Clear(Pkg);
+ Fix.Protect(Pkg);
+ Fix.Remove(Pkg);
+
+ return true;
+ }
+
+ if (State.CandidateVer == 0 && Remove == false)
+ {
+ _error->Error("Package %s is virtual and has no installation candidate", Pkg.Name());
+
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,
+ g_strdup_printf("Package %s is virtual and has no "
+ "installation candidate",
+ Pkg.Name()));
+ return false;
+ }
+
+ Fix.Clear(Pkg);
+ Fix.Protect(Pkg);
+ if (Remove == true)
+ {
+ Fix.Remove(Pkg);
+ Cache.MarkDelete(Pkg,_config->FindB("APT::Get::Purge", false));
+ return true;
+ }
+
+ // Install it
+ Cache.MarkInstall(Pkg,false);
+ if (State.Install() == false)
+ {
+ if (_config->FindB("APT::Get::ReInstall",false) == true) {
+ if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false) {
+ // ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
+ // Pkg.Name());
+ ;
+ } else {
+ Cache.SetReInstall(Pkg,true);
+ }
+ } else {
+ // if (AllowFail == true)
+ // ioprintf(c1out,_("%s is already the newest version.\n"),
+ // Pkg.Name());
+ }
+ } else {
+ ExpectedInst++;
+ }
+
+// cout << "trytoinstall ExpectedInst " << ExpectedInst << endl;
+ // Install it with autoinstalling enabled (if we not respect the minial
+ // required deps or the policy)
+ if ((State.InstBroken() == true || State.InstPolicyBroken() == true) &&
+ BrokenFix == false) {
+ Cache.MarkInstall(Pkg,true);
+ }
+
+ return true;
+}
+
+// checks if there are Essential packages being removed
+bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
+{
+ string List;
+ bool *Added = new bool[Cache->Head().PackageCount];
+ for (unsigned int I = 0; I != Cache->Head().PackageCount; I++){
+ Added[I] = false;
+ }
+
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
+ if ((I->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
+ (I->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important) {
+ continue;
+ }
+
+ if (Cache[I].Delete() == true) {
+ if (Added[I->ID] == false) {
+ Added[I->ID] = true;
+ List += string(I.Name()) + " ";
+ }
+ }
+
+ if (I->CurrentVer == 0) {
+ continue;
+ }
+
+ // Print out any essential package depenendents that are to be removed
+ for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; D++) {
+ // Skip everything but depends
+ if (D->Type != pkgCache::Dep::PreDepends &&
+ D->Type != pkgCache::Dep::Depends){
+ continue;
+ }
+
+ pkgCache::PkgIterator P = D.SmartTargetPkg();
+ if (Cache[P].Delete() == true)
+ {
+ if (Added[P->ID] == true){
+ continue;
+ }
+ Added[P->ID] = true;
+
+ char S[300];
+ snprintf(S, sizeof(S), "%s (due to %s) ", P.Name(), I.Name());
+ List += S;
+ }
+ }
+ }
+
+ delete [] Added;
+ if (!List.empty()) {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE,
+ g_strdup_printf("WARNING: You are trying to remove the "
+ "following essential packages: %s",
+ List.c_str()));
+ return true;
+ }
+
+ return false;
+}
+
+// emitChangedPackages - Show packages to newly install /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
+{
+ vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > installing,
+ removing,
+ updating,
+ downgrading;
+
+ string VersionsList;
+ for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg)
+ {
+ if (Cache[pkg].NewInstall() == true) {
+ // installing
+ installing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Delete() == true) {
+ // removing
+ removing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
+ } else if (Cache[pkg].Upgrade() == true) {
+ // updating
+ updating.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Downgrade() == true) {
+ // downgrading
+ downgrading.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ }
+ }
+
+ // emit packages that have changes
+ emit_packages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
+ emit_packages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
+ emit_packages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+ emit_packages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
+}
+
+void AptIntf::populateInternalPackages(pkgCacheFile &Cache)
+{
+ for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
+ if (Cache[pkg].NewInstall() == true) {
+ // installing
+ m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Delete() == true) {
+ // removing
+ m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
+ } else if (Cache[pkg].Upgrade() == true) {
+ // updating
+ m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Downgrade() == true) {
+ // downgrading
+ m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ }
+ }
+}
+
+void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
+{
+ for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=m_pkgs.begin();
+ i != m_pkgs.end();
+ ++i)
+ {
+ if (i->first.Name() == name) {
+ emit_package(i->first, i->second, PK_FILTER_ENUM_NONE, state);
+ return;
+ }
+ }
+
+ pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
+ pkg_ver.first = packageCache->FindPkg(name);
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (pkg_ver.first.end() == true ||
+ (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
+ {
+ return;
+ }
+
+ pkg_ver.second = find_ver(pkg_ver.first);
+ // check to see if the provided package isn't virtual too
+ if (pkg_ver.second.end() == false)
+ {
+ emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
+ }
+
+ pkg_ver.second = find_candidate_ver(pkg_ver.first);
+ // check to see if we found the package
+ if (pkg_ver.second.end() == false)
+ {
+ emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
+ }
+}
+
+void AptIntf::updateInterface(int fd, int writeFd)
+{
+ char buf[2];
+ static char line[1024] = "";
+
+ while (1) {
+ // This algorithm should be improved (it's the same as the rpm one ;)
+ int len = read(fd, buf, 1);
+
+ // nothing was read
+ if(len < 1) {
+ break;
+ }
+
+ // update the time we last saw some action
+ m_lastTermAction = time(NULL);
+
+ if( buf[0] == '\n') {
+ if (_cancel) {
+ kill(m_child_pid, SIGTERM);
+ }
+ //cout << "got line: " << line << endl;
+
+ gchar **split = g_strsplit(line, ":",5);
+ gchar *status = g_strstrip(split[0]);
+ gchar *pkg = g_strstrip(split[1]);
+ gchar *percent = g_strstrip(split[2]);
+ gchar *str = g_strdup(g_strstrip(split[3]));
+
+ // major problem here, we got unexpected input. should _never_ happen
+ if(!(pkg && status)) {
+ continue;
+ }
+
+ // first check for errors and conf-file prompts
+ if (strstr(status, "pmerror") != NULL) {
+ // error from dpkg
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL,
+ str);
+ } else if (strstr(status, "pmconffile") != NULL) {
+ // conffile-request from dpkg, needs to be parsed different
+ int i=0;
+ int count=0;
+ string orig_file, new_file;
+
+ // go to first ' and read until the end
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ /*nothing*/
+ ;
+ i++;
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ orig_file.append(1, str[i]);
+ i++;
+
+ // same for second ' and read until the end
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ /*nothing*/
+ ;
+ i++;
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ new_file.append(1, str[i]);
+ i++;
+
+ gchar *filename;
+ filename = g_build_filename(DATADIR, "PackageKit", "helpers", "aptcc", "pkconffile", NULL);
+ gchar **argv;
+ gchar **envp;
+ GError *error = NULL;
+ argv = (gchar **) g_malloc(5 * sizeof(gchar *));
+ argv[0] = filename;
+ argv[1] = g_strdup(m_lastPackage.c_str());
+ argv[2] = g_strdup(orig_file.c_str());
+ argv[3] = g_strdup(new_file.c_str());
+ argv[4] = NULL;
+
+ gchar *socket;
+ if (socket = pk_backend_get_frontend_socket(m_backend)) {
+ envp = (gchar **) g_malloc(3 * sizeof(gchar *));
+ envp[0] = g_strdup("DEBIAN_FRONTEND=passthrough");
+ envp[1] = g_strdup_printf("DEBCONF_PIPE=%s", socket);
+ envp[2] = NULL;
+ } else {
+ // we don't have a socket set, let's fallback to noninteractive
+ envp = (gchar **) g_malloc(2 * sizeof(gchar *));
+ envp[0] = g_strdup("DEBIAN_FRONTEND=noninteractive");
+ envp[1] = NULL;
+ }
+
+ gboolean ret;
+ gint exitStatus;
+ ret = g_spawn_sync(NULL, // working dir
+ argv, // argv
+ envp, // envp
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+ NULL, // child_setup
+ NULL, // user_data
+ NULL, // standard_output
+ NULL, // standard_error
+ &exitStatus,
+ &error);
+
+ int exit_code = WEXITSTATUS(exitStatus);
+ cout << filename << " " << exit_code << " ret: "<< ret << endl;
+
+ if (exit_code == 10) {
+ // 1 means the user wants the package config
+ if (write(writeFd, "Y\n", 2) != 2) {
+ // TODO we need a DPKG patch to use debconf
+ g_debug("Failed to write");
+ }
+ } else if (exit_code == 20) {
+ // 2 means the user wants to keep the current config
+ if (write(writeFd, "N\n", 2) != 2) {
+ // TODO we need a DPKG patch to use debconf
+ g_debug("Failed to write");
+ }
+ } else {
+ // either the user didn't choose an option or the front end failed'
+ gchar *confmsg;
+ confmsg = g_strdup_printf("The configuration file '%s' "
+ "(modified by you or a script) "
+ "has a newer version '%s'.\n"
+ "Please verify your changes and update it manually.",
+ orig_file.c_str(),
+ new_file.c_str());
+ pk_backend_message(m_backend,
+ PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED,
+ confmsg);
+ // fall back to keep the current config file
+ if (write(writeFd, "N\n", 2) != 2) {
+ // TODO we need a DPKG patch to use debconf
+ g_debug("Failed to write");
+ }
+ }
+ } else if (strstr(status, "pmstatus") != NULL) {
+ // INSTALL & UPDATE
+ // - Running dpkg
+ // loops ALL
+ // - 0 Installing pkg (sometimes this is skiped)
+ // - 25 Preparing pkg
+ // - 50 Unpacking pkg
+ // - 75 Preparing to configure pkg
+ // ** Some pkgs have
+ // - Running post-installation
+ // - Running dpkg
+ // reloops all
+ // - 0 Configuring pkg
+ // - +25 Configuring pkg (SOMETIMES)
+ // - 100 Installed pkg
+ // after all
+ // - Running post-installation
+
+ // REMOVE
+ // - Running dpkg
+ // loops
+ // - 25 Removing pkg
+ // - 50 Preparing for removal of pkg
+ // - 75 Removing pkg
+ // - 100 Removed pkg
+ // after all
+ // - Running post-installation
+
+ // Let's start parsing the status:
+ if (starts_with(str, "Preparing to configure")) {
+ // Preparing to Install/configure
+// cout << "Found Preparing to configure! " << line << endl;
+ // The next item might be Configuring so better it be 100
+ m_lastSubProgress = 100;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
+ pk_backend_set_sub_percentage(m_backend, 75);
+ } else if (starts_with(str, "Preparing for removal")) {
+ // Preparing to Install/configure
+// cout << "Found Preparing for removal! " << line << endl;
+ m_lastSubProgress = 50;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
+ pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
+ } else if (starts_with(str, "Preparing")) {
+ // Preparing to Install/configure
+// cout << "Found Preparing! " << line << endl;
+ // if last package is different then finish it
+ if (!m_lastPackage.empty() && m_lastPackage.compare(pkg) != 0) {
+// cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ }
+ emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
+ pk_backend_set_sub_percentage(m_backend, 25);
+ } else if (starts_with(str, "Unpacking")) {
+// cout << "Found Unpacking! " << line << endl;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_DECOMPRESSING);
+ pk_backend_set_sub_percentage(m_backend, 50);
+ } else if (starts_with(str, "Configuring")) {
+ // Installing Package
+// cout << "Found Configuring! " << line << endl;
+ if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
+ cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ m_lastSubProgress = 0;
+ }
+ emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
+ pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
+ m_lastSubProgress += 25;
+ } else if (starts_with(str, "Running dpkg")) {
+// cout << "Found Running dpkg! " << line << endl;
+ } else if (starts_with(str, "Running")) {
+// cout << "Found Running! " << line << endl;
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_COMMIT);
+ } else if (starts_with(str, "Installing")) {
+// cout << "Found Installing! " << line << endl;
+ // FINISH the last package
+ if (!m_lastPackage.empty()) {
+// cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ }
+ m_lastSubProgress = 0;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
+ pk_backend_set_sub_percentage(m_backend, 0);
+ } else if (starts_with(str, "Removing")) {
+// cout << "Found Removing! " << line << endl;
+ if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
+// cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ }
+ m_lastSubProgress += 25;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
+ pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
+ } else if (starts_with(str, "Installed") ||
+ starts_with(str, "Removed")) {
+// cout << "Found FINISHED! " << line << endl;
+ m_lastSubProgress = 100;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_FINISHED);
+ } else {
+ cout << ">>>Unmaped value<<< :" << line << endl;
+ }
+
+ if (!starts_with(str, "Running")) {
+ m_lastPackage = pkg;
+ }
+ m_startCounting = true;
+ } else {
+ m_startCounting = true;
+ }
+
+ int val = atoi(percent);
+ //cout << "progress: " << val << endl;
+ pk_backend_set_percentage(m_backend, val);
+
+ // clean-up
+ g_strfreev(split);
+ g_free(str);
+ line[0] = 0;
+ } else {
+ buf[1] = 0;
+ strcat(line, buf);
+ }
+ }
+
+ time_t now = time(NULL);
+
+ if(!m_startCounting) {
+ usleep(100000);
+ // wait until we get the first message from apt
+ m_lastTermAction = now;
+ }
+
+ if ((now - m_lastTermAction) > m_terminalTimeout) {
+ // get some debug info
+ g_warning("no statusfd changes/content updates in terminal for %i"
+ " seconds",m_terminalTimeout);
+ m_lastTermAction = time(NULL);
+ }
+
+ // sleep for a while to don't obcess over it
+ usleep(5000);
+}
+
+// DoAutomaticRemove - Remove all automatic unused packages /*{{{*/
+// ---------------------------------------------------------------------
+/* Remove unused automatic packages */
+bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
+{
+ bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
+ pkgDepCache::ActionGroup group(*Cache);
+
+ if (_config->FindB("APT::Get::Remove",true) == false &&
+ doAutoRemove == true)
+ {
+ cout << "We are not supposed to delete stuff, can't start "
+ "AutoRemover" << endl;
+ doAutoRemove = false;
+ }
+
+ // look over the cache to see what can be removed
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
+ {
+ if (Cache[Pkg].Garbage && doAutoRemove)
+ {
+ if (Pkg.CurrentVer() != 0 &&
+ Pkg->CurrentState != pkgCache::State::ConfigFiles) {
+ Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
+ } else {
+ Cache->MarkKeep(Pkg, false, false);
+ }
+ }
+ }
+
+ // Now see if we destroyed anything
+ if (Cache->BrokenCount() != 0)
+ {
+ cout << "Hmm, seems like the AutoRemover destroyed something which really\n"
+ "shouldn't happen. Please file a bug report against apt." << endl;
+ // TODO call show_broken
+ // ShowBroken(c1out,Cache,false);
+ return _error->Error("Internal Error, AutoRemover broke stuff");
+ }
+ return true;
+}
+
+PkgList AptIntf::resolvePI(gchar **package_ids)
+{
+ gchar *pi;
+ PkgList ret;
+
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_QUERY);
+
+ // Don't fail if package list is empty
+ if (package_ids == NULL)
+ return ret;
+
+ for (uint i = 0; i < g_strv_length(package_ids); i++) {
+ if (_cancel) {
+ break;
+ }
+
+ PkgPair pair;
+ pi = package_ids[i];
+
+ if (pk_package_id_check(pi) == false) {
+ pair.first = packageCache->FindPkg(pi);
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (pair.first.end() == true ||
+ (pair.first.VersionList().end() && pair.first.ProvidesList().end())) {
+ continue;
+ }
+
+ pair.second = find_ver(pair.first);
+ // check to see if the provided package isn't virtual too
+ if (pair.second.end() == false) {
+ ret.push_back(pair);
+ }
+
+ pair.second = find_candidate_ver(pair.first);
+ // check to see if the provided package isn't virtual too
+ if (pair.second.end() == false) {
+ ret.push_back(pair);
+ }
+ } else {
+ bool found;
+ pair = find_package_id(pi, found);
+ // check to see if we found the package
+ if (found) {
+ ret.push_back(pair);
+ }
+ }
+ }
+ return ret;
+}
+
+bool AptIntf::markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
+{
+ // We call gdebi to tell us what do we need to install/remove
+ // in order to be able to install this package
+ gint status;
+ gchar **argv;
+ gchar **envp;
+ gchar *std_out;
+ gchar *std_err;
+ GError *gerror = NULL;
+ argv = (gchar **) g_malloc(5 * sizeof(gchar *));
+ argv[0] = g_strdup("/usr/bin/gdebi");
+ argv[1] = g_strdup("-q");
+ argv[2] = g_strdup("--apt-line");
+ argv[3] = g_strdup(file);
+ argv[4] = NULL;
+
+ gboolean ret;
+ ret = g_spawn_sync(NULL, // working dir
+ argv, // argv
+ envp, // envp
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+ NULL, // child_setup
+ NULL, // user_data
+ &std_out, // standard_output
+ &std_err, // standard_error
+ &status,
+ &gerror);
+ int exit_code = WEXITSTATUS(status);
+// cout << "DebStatus " << exit_code << " WEXITSTATUS " << WEXITSTATUS(status) << " ret: "<< ret << endl;
+ cout << "std_out " << strlen(std_out) << std_out << endl;
+ cout << "std_err " << strlen(std_err) << std_err << endl;
+
+ PkgList pkgs;
+ if (exit_code == 1) {
+ if (strlen(std_out) == 0) {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_err);
+ } else {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_out);
+ }
+ return false;
+ } else {
+ // GDebi outputs two lines
+ gchar **lines = g_strsplit(std_out, "\n", 3);
+
+ // The first line contains the packages to install
+ gchar **installPkgs = g_strsplit(lines[0], " ", 0);
+
+ // The second line contains the packages to remove with '-' appended to
+ // the end of the package name
+ gchar **removePkgs = NULL;
+ if (strlen(lines[1]) > 0) {
+ gchar *removeStr = g_strndup(lines[1], strlen(lines[1]) - 1);
+ removePkgs = g_strsplit(removeStr, "- ", 0);
+ g_free(removeStr);
+ }
+
+ // Store the changes
+ install = resolvePI(installPkgs);
+ remove = resolvePI(removePkgs);
+ m_localDebFile = file;
+
+ g_strfreev(lines);
+ g_strfreev(installPkgs);
+ g_strfreev(removePkgs);
+ }
+
+ return true;
+}
+
+bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate)
+{
+ //cout << "runTransaction" << simulate << remove << endl;
+ bool WithLock = !simulate; // Check to see if we are just simulating,
+ //since for that no lock is needed
+
+ pkgCacheFile Cache;
+ OpTextProgress Prog(*_config);
+ int timeout = 10;
+ // TODO test this
+ while (Cache.Open(&Prog, WithLock) == false) {
+ // failed to open cache, try checkDeps then..
+ // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
+ if (WithLock == false || (timeout <= 0)) {
+ show_errors(m_backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
+ return false;
+ } else {
+ _error->Discard();
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
+ sleep(1);
+ timeout--;
+ }
+ }
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
+
+ // Enter the special broken fixing mode if the user specified arguments
+ bool BrokenFix = false;
+ if (Cache->BrokenCount() != 0) {
+ BrokenFix = true;
+ }
+
+ unsigned int ExpectedInst = 0;
+ pkgProblemResolver Fix(Cache);
+
+ // new scope for the ActionGroup
+ {
+ pkgDepCache::ActionGroup group(Cache);
+ for(PkgList::iterator i = install.begin(); i != install.end(); ++i) {
+ pkgCache::PkgIterator Pkg = i->first;
+ if (_cancel) {
+ break;
+ }
+
+ if (TryToInstall(Pkg,
+ Cache,
+ Fix,
+ false, // remove
+ BrokenFix,
+ ExpectedInst) == false) {
+ return false;
+ }
+ }
+
+ for(PkgList::iterator i = remove.begin(); i != remove.end(); ++i) {
+ pkgCache::PkgIterator Pkg = i->first;
+ if (_cancel) {
+ break;
+ }
+
+ if (TryToInstall(Pkg,
+ Cache,
+ Fix,
+ true, // remove
+ BrokenFix,
+ ExpectedInst) == false) {
+ return false;
+ }
+ }
+
+ // Call the scored problem resolver
+ Fix.InstallProtect();
+ if (Fix.Resolve(true) == false) {
+ _error->Discard();
+ }
+
+ // Now we check the state of the packages,
+ if (Cache->BrokenCount() != 0)
+ {
+ // if the problem resolver could not fix all broken things
+ // show what is broken
+ show_broken(m_backend, Cache, false);
+ return false;
+ }
+ }
+ // Try to auto-remove packages
+ if (!DoAutomaticRemove(Cache)) {
+ // TODO
+ return false;
+ }
+
+ // check for essential packages!!!
+ if (removingEssentialPackages(Cache)) {
+ return false;
+ }
+
+ if (simulate) {
+ // Print out a list of packages that are going to be installed extra
+ emitChangedPackages(Cache);
+ return true;
+ } else {
+ // Store the packages that are going to change
+ // so we can emit them as we process it.
+ populateInternalPackages(Cache);
+ return installPackages(Cache);
+ }
+}
+
+ /*}}}*/
+
+// InstallPackages - Actually download and install the packages /*{{{*/
+// ---------------------------------------------------------------------
+/* This displays the informative messages describing what is going to
+ happen and then calls the download routines */
+bool AptIntf::installPackages(pkgCacheFile &Cache)
+{
+ //cout << "installPackages() called" << endl;
+ if (_config->FindB("APT::Get::Purge",false) == true)
+ {
+ pkgCache::PkgIterator I = Cache->PkgBegin();
+ for (; I.end() == false; I++)
+ {
+ if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete) {
+ Cache->MarkDelete(I,true);
+ }
+ }
+ }
+
+ // check for essential packages!!!
+ if (removingEssentialPackages(Cache)) {
+ return false;
+ }
+
+ // Sanity check
+ if (Cache->BrokenCount() != 0)
+ {
+ // TODO
+ show_broken(m_backend, Cache, false);
+ _error->Error("Internal error, InstallPackages was called with broken packages!");
+ return false;
+ }
+
+ if (Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
+ Cache->BadCount() == 0) {
+ return true;
+ }
+
+ // No remove flag
+ if (Cache->DelCount() != 0 && _config->FindB("APT::Get::Remove", true) == false) {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE,
+ "Packages need to be removed but remove is disabled.");
+ return false;
+ }
+
+ // Create the text record parser
+ pkgRecords Recs(Cache);
+ if (_error->PendingError() == true) {
+ return false;
+ }
+
+ // Lock the archive directory
+ FileFd Lock;
+ if (_config->FindB("Debug::NoLocking", false) == false)
+ {
+ Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+ if (_error->PendingError() == true) {
+ return _error->Error("Unable to lock the download directory");
+ }
+ }
+
+ // Create the download object
+ AcqPackageKitStatus Stat(this, m_backend, _cancel);
+
+ // get a fetcher
+ pkgAcquire fetcher;
+ fetcher.Setup(&Stat);
+
+ // Create the package manager and prepare to download
+// SPtr<pkgPackageManager> PM= _system->CreatePM(Cache);
+ SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
+ if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
+ _error->PendingError() == true) {
+ return false;
+ }
+
+ // Generate the list of affected packages and sort it
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; I++)
+ {
+ // Ignore no-version packages
+ if (I->VersionList == 0) {
+ continue;
+ }
+
+ // Not interesting
+ if ((Cache[I].Keep() == true ||
+ Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
+ I.State() == pkgCache::PkgIterator::NeedsNothing &&
+ (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
+ (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
+ (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
+ {
+ continue;
+ }
+
+ // Append it to the list
+ Stat.addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(I, Cache[I].InstVerIter(Cache)));
+ }
+
+ // Display statistics
+ double FetchBytes = fetcher.FetchNeeded();
+ double FetchPBytes = fetcher.PartialPresent();
+ double DebBytes = fetcher.TotalNeeded();
+ if (DebBytes != Cache->DebSize())
+ {
+ cout << DebBytes << ',' << Cache->DebSize() << endl;
+cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
+/* _error->Warning("How odd.. The sizes didn't match, email apt at packages.debian.org");*/
+ }
+
+ // Number of bytes
+// if (DebBytes != FetchBytes)
+// ioprintf(c1out, "Need to get %sB/%sB of archives.\n",
+// SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
+// else if (DebBytes != 0)
+// ioprintf(c1out, "Need to get %sB of archives.\n",
+// SizeToStr(DebBytes).c_str());
+
+ // Size delta
+// if (Cache->UsrSize() >= 0)
+// ioprintf(c1out, "After this operation, %sB of additional disk space will be used.\n",
+// SizeToStr(Cache->UsrSize()).c_str());
+// else
+// ioprintf(c1out, "After this operation, %sB disk space will be freed.\n",
+// SizeToStr(-1*Cache->UsrSize()).c_str());
+
+ if (_error->PendingError() == true) {
+ cout << "PendingError " << endl;
+ return false;
+ }
+
+ /* Check for enough free space */
+ struct statvfs Buf;
+ string OutputDir = _config->FindDir("Dir::Cache::Archives");
+ if (statvfs(OutputDir.c_str(),&Buf) != 0) {
+ return _error->Errno("statvfs",
+ "Couldn't determine free space in %s",
+ OutputDir.c_str());
+ }
+ if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
+ {
+ struct statfs Stat;
+ if (statfs(OutputDir.c_str(), &Stat) != 0 ||
+ unsigned(Stat.f_type) != RAMFS_MAGIC)
+ {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_NO_SPACE_ON_DEVICE,
+ string("You don't have enough free space in ").append(OutputDir).c_str());
+ return _error->Error("You don't have enough free space in %s.",
+ OutputDir.c_str());
+ }
+ }
+
+ if (!checkTrusted(fetcher, m_backend)) {
+ return false;
+ }
+
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
+ pk_backend_set_simultaneous_mode(m_backend, true);
+ // Download and check if we can continue
+ if (fetcher.Run() != pkgAcquire::Continue
+ && _cancel == false)
+ {
+ // We failed and we did not cancel
+ show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
+ return false;
+ }
+ pk_backend_set_simultaneous_mode(m_backend, false);
+
+ if (_error->PendingError() == true) {
+ cout << "PendingError download" << endl;
+ return false;
+ }
+
+ // Right now it's not safe to cancel
+ pk_backend_set_allow_cancel (m_backend, false);
+
+ // TODO true or false?
+ if (_cancel) {
+ return true;
+ }
+
+ // Download should be finished by now, changing it's status
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
+ pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+
+ // TODO DBus activated does not have all vars
+ // we could try to see if this is the case
+ setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
+ _system->UnLock();
+
+ if (!m_localDebFile.empty()) {
+ // add the local file name to be proccessed by the PM queue
+ pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
+ pm->addDebFile(m_localDebFile);
+ }
+
+ pkgPackageManager::OrderResult res;
+ res = PM->DoInstallPreFork();
+ if (res == pkgPackageManager::Failed) {
+ g_warning ("Failed to prepare installation");
+ show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
+ return false;
+ }
+
+ // File descriptors for reading dpkg --status-fd
+ int readFromChildFD[2];
+ if (pipe(readFromChildFD) < 0) {
+ cout << "Failed to create a pipe" << endl;
+ return false;
+ }
+
+ int pty_master;
+ m_child_pid = forkpty(&pty_master, NULL, NULL, NULL);
+ if (m_child_pid == -1) {
+ return false;
+ }
+
+ if (m_child_pid == 0) {
+ //cout << "FORKED: installPackages(): DoInstall" << endl;
+
+ // close pipe we don't need
+ close(readFromChildFD[0]);
+
+ // Change the locale to not get libapt localization
+ setlocale(LC_ALL, "C");
+
+ // Debconf handlying
+ gchar *socket;
+ if (socket = pk_backend_get_frontend_socket(m_backend)) {
+ setenv("DEBIAN_FRONTEND", "passthrough", 1);
+ setenv("DEBCONF_PIPE", socket, 1);
+ } else {
+ // we don't have a socket set, let's fallback to noninteractive
+ setenv("DEBIAN_FRONTEND", "noninteractive", 1);
+ }
+
+ gchar *locale;
+ // Set the LANGUAGE so debconf messages get localization
+ if (locale = pk_backend_get_locale(m_backend)) {
+ setenv("LANGUAGE", locale, 1);
+ setenv("LANG", locale, 1);
+ //setenv("LANG", "C", 1);
+ }
+
+ // Pass the write end of the pipe to the install function
+ res = PM->DoInstallPostFork(readFromChildFD[1]);
+
+ // dump errors into cerr (pass it to the parent process)
+ _error->DumpErrors();
+
+ close(readFromChildFD[1]);
+
+ _exit(res);
+ }
+
+ cout << "PARENT proccess running..." << endl;
+ // make it nonblocking, verry important otherwise
+ // when the child finish we stay stuck.
+ fcntl(readFromChildFD[0], F_SETFL, O_NONBLOCK);
+ fcntl(pty_master, F_SETFL, O_NONBLOCK);
+
+ // init the timer
+ m_lastTermAction = time(NULL);
+ m_startCounting = false;
+
+ // Check if the child died
+ int ret;
+ char masterbuf[1024];
+ while (waitpid(m_child_pid, &ret, WNOHANG) == 0) {
+ // TODO: This is dpkg's raw output. Maybe save it for error-solving?
+ while(read(pty_master, masterbuf, sizeof(masterbuf)) > 0);
+ updateInterface(readFromChildFD[0], pty_master);
+ }
+
+ close(readFromChildFD[0]);
+ close(readFromChildFD[1]);
+ close(pty_master);
+
+ cout << "Parent finished..." << endl;
+ return true;
+}
+
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
new file mode 100644
index 0000000..7b7dd6d
--- /dev/null
+++ b/backends/aptcc/apt-intf.h
@@ -0,0 +1,185 @@
+/* apt-intf.h - Interface to APT
+ *
+ * Copyright (c) 1999-2002, 2004-2005, 2007-2008 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef APTINTF_H
+#define APTINTF_H
+
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/pkgcachegen.h>
+#include <apt-pkg/cachefile.h>
+#include <apt-pkg/policy.h>
+
+#include <pk-backend.h>
+
+#include <set>
+
+using namespace std;
+
+/**
+* returns a list of packages names
+*/
+vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel);
+
+/**
+* returns a list of packages names
+*/
+vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel);
+
+typedef pair<pkgCache::PkgIterator, pkgCache::VerIterator> PkgPair;
+typedef vector<PkgPair> PkgList;
+
+class pkgProblemResolver;
+
+class AptIntf
+{
+
+public:
+ AptIntf(PkBackend *backend, bool &cancel);
+ ~AptIntf();
+
+ bool init();
+ void cancel();
+
+ // Check the returned VerIterator.end()
+ // if it's true we could not find it
+ pair<pkgCache::PkgIterator, pkgCache::VerIterator>
+ find_package_id(const gchar *package_id, bool &found);
+ pkgCache::VerIterator find_ver(const pkgCache::PkgIterator &pkg);
+ pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
+
+ PkgList resolvePI(gchar **package_ids);
+ bool markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
+
+ /**
+ * runs a transaction to install/remove/update packages
+ * - for install and update, \p remove should be set to false
+ * - if you are going to remove, \p remove should be true
+ * - if you don't want to actually install/update/remove
+ * \p simulate should be true, in this case packages with
+ * what's going to happen will be emitted.
+ */
+ bool runTransaction(PkgList &install, PkgList &remove, bool simulate);
+
+ /**
+ * Get depends
+ */
+ void get_depends(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive);
+
+ /**
+ * Get requires
+ */
+ void get_requires(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive);
+
+ /**
+ * Emits a package if it match the filters
+ */
+ void emit_package(const pkgCache::PkgIterator &pkg,
+ const pkgCache::VerIterator &ver,
+ PkBitfield filters = PK_FILTER_ENUM_NONE,
+ PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+
+ void emit_packages(PkgList &output,
+ PkBitfield filters = PK_FILTER_ENUM_NONE,
+ PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+
+ void emitUpdates(PkgList &output, PkBitfield filters = PK_FILTER_ENUM_NONE);
+
+ /**
+ * Emits details
+ */
+ void emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
+ void emitDetails(PkgList &pkgs);
+
+ /**
+ * Emits update detail
+ */
+ void emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
+ void emitUpdateDetails(PkgList &pkgs);
+
+ /**
+ * Emits files of packages
+ */
+ void emitFiles(PkBackend *backend, const gchar *pi);
+
+ /**
+ * seems to install packages
+ */
+ bool installPackages(pkgCacheFile &Cache);
+
+ /**
+ * check which package provides the codec
+ */
+ void providesCodec(PkgList &output, gchar **values);
+
+ /**
+ * check which package provides a shared library
+ */
+ void providesLibrary(PkgList &output, gchar **values);
+
+ pkgRecords *packageRecords;
+ pkgCache *packageCache;
+ pkgDepCache *packageDepCache;
+ pkgSourceList *packageSourceList;
+
+private:
+ MMap *Map;
+ OpProgress Progress;
+ pkgPolicy *Policy;
+ PkBackend *m_backend;
+ bool &_cancel;
+
+ bool TryToInstall(pkgCache::PkgIterator Pkg,
+ pkgDepCache &Cache,
+ pkgProblemResolver &Fix,
+ bool Remove,
+ bool BrokenFix,
+ unsigned int &ExpectedInst);
+
+ /**
+ * interprets dpkg status fd
+ */
+ void updateInterface(int readFd, int writeFd);
+ bool DoAutomaticRemove(pkgCacheFile &Cache);
+ void emitChangedPackages(pkgCacheFile &Cache);
+ bool removingEssentialPackages(pkgCacheFile &Cache);
+
+ bool m_isMultiArch;
+ PkgList m_pkgs;
+ string m_localDebFile;
+ void populateInternalPackages(pkgCacheFile &Cache);
+ void emitTransactionPackage(string name, PkInfoEnum state);
+ time_t m_lastTermAction;
+ string m_lastPackage;
+ uint m_lastSubProgress;
+ PkInfoEnum m_state;
+ bool m_startCounting;
+
+ // when the internal terminal timesout after no activity
+ int m_terminalTimeout;
+ pid_t m_child_pid;
+};
+
+#endif
diff --git a/backends/aptcc/apt-messages.cpp b/backends/aptcc/apt-messages.cpp
new file mode 100644
index 0000000..623100c
--- /dev/null
+++ b/backends/aptcc/apt-messages.cpp
@@ -0,0 +1,202 @@
+/* apt-messages.cpp
+ *
+ * Copyright (c) 2004 Daniel Burrows
+ * Copyright (c) 2009-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2011-2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "apt-messages.h"
+
+#include <string>
+#include <sstream>
+#include <cstdio>
+
+using namespace std;
+
+bool show_errors(PkBackend *backend, PkErrorEnum errorCode)
+{
+ stringstream errors;
+
+ string Err;
+ while (_error->empty() == false)
+ {
+ bool Type = _error->PopMessage(Err);
+ if (Type == true) {
+ errors << "E: " << Err << endl;
+ } else {
+ errors << "W: " << Err << endl;
+ }
+ }
+
+ if (!errors.str().empty())
+ {
+ pk_backend_error_code(backend, errorCode, errors.str().c_str());
+ }
+}
+
+bool show_warnings(PkBackend *backend, PkMessageEnum message)
+{
+ stringstream warnings;
+
+ string Err;
+ while (_error->empty() == false)
+ {
+ bool Type = _error->PopMessage(Err);
+ if (Type == true) {
+ warnings << "E: " << Err << endl;
+ } else {
+ warnings << "W: " << Err << endl;
+ }
+ }
+
+ if (!warnings.str().empty())
+ {
+ pk_backend_message(backend, message, warnings.str().c_str());
+ }
+}
+
+/** Shows broken dependencies for a single package */
+void show_broken(PkBackend *backend, pkgCacheFile &Cache, bool Now)
+{
+ stringstream out;
+
+ out << "The following packages have unmet dependencies:" << endl;
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
+ if (Now == true) {
+ if (Cache[I].NowBroken() == false) {
+ continue;
+ }
+ } else {
+ if (Cache[I].InstBroken() == false){
+ continue;
+ }
+ }
+
+ // Print out each package and the failed dependencies
+ out << " " << I.Name() << ":";
+ unsigned Indent = strlen(I.Name()) + 3;
+ bool First = true;
+ pkgCache::VerIterator Ver;
+
+ if (Now == true) {
+ Ver = I.CurrentVer();
+ } else {
+ Ver = Cache[I].InstVerIter(Cache);
+ }
+
+ if (Ver.end() == true) {
+ out << endl;
+ continue;
+ }
+
+ for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;) {
+ // Compute a single dependency element (glob or)
+ pkgCache::DepIterator Start;
+ pkgCache::DepIterator End;
+ D.GlobOr(Start,End); // advances D
+
+ if (Cache->IsImportantDep(End) == false){
+ continue;
+ }
+
+ if (Now == true) {
+ if ((Cache[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow){
+ continue;
+ }
+ } else {
+ if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) {
+ continue;
+ }
+ }
+
+ bool FirstOr = true;
+ while (1) {
+ if (First == false){
+ for (unsigned J = 0; J != Indent; J++) {
+ out << ' ';
+ }
+ }
+ First = false;
+
+ if (FirstOr == false) {
+ for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++) {
+ out << ' ';
+ }
+ } else {
+ out << ' ' << End.DepType() << ": ";
+ }
+ FirstOr = false;
+
+ out << Start.TargetPkg().Name();
+
+ // Show a quick summary of the version requirements
+ if (Start.TargetVer() != 0) {
+ out << " (" << Start.CompType() << " " << Start.TargetVer() << ")";
+ }
+
+ /* Show a summary of the target package if possible. In the case
+ of virtual packages we show nothing */
+ pkgCache::PkgIterator Targ = Start.TargetPkg();
+ if (Targ->ProvidesList == 0) {
+ out << ' ';
+ pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
+ if (Now == true) {
+ Ver = Targ.CurrentVer();
+ }
+
+ if (Ver.end() == false)
+ {
+ char buffer[1024];
+ if (Now == true) {
+ sprintf(buffer, "but %s is installed", Ver.VerStr());
+ } else {
+ sprintf(buffer, "but %s is to be installed", Ver.VerStr());
+ }
+
+ out << buffer;
+ } else {
+ if (Cache[Targ].CandidateVerIter(Cache).end() == true) {
+ if (Targ->ProvidesList == 0) {
+ out << "but it is not installable";
+ } else {
+ out << "but it is a virtual package";
+ }
+ } else {
+ if (Now) {
+ out << "but it is not installed";
+ } else {
+ out << "but it is not going to be installed";
+ }
+ }
+ }
+ }
+
+ if (Start != End) {
+ out << " or";
+ }
+ out << endl;
+
+ if (Start == End){
+ break;
+ }
+ Start++;
+ }
+ }
+ }
+ pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, out.str().c_str());
+}
diff --git a/backends/aptcc/apt-messages.h b/backends/aptcc/apt-messages.h
new file mode 100644
index 0000000..68267d7
--- /dev/null
+++ b/backends/aptcc/apt-messages.h
@@ -0,0 +1,50 @@
+/* apt-messages.h
+ *
+ * Copyright (c) 2004 Daniel Burrows
+ * Copyright (c) 2009-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2011-2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef APT_MESSAGES_H
+#define APT_MESSAGES_H
+
+#include <pk-backend.h>
+#include <apt-pkg/cachefile.h>
+
+/** \file apt-messages.h
+ */
+
+/**
+ * Call the Packagekit error dialog
+ */
+bool show_errors(PkBackend *backend,
+ PkErrorEnum errorCode = PK_ERROR_ENUM_UNKNOWN);
+
+/**
+ * Call the Packagekit message dialog
+ */
+bool show_warnings(PkBackend *backend,
+ PkMessageEnum message = PK_MESSAGE_ENUM_UNKNOWN);
+
+/** Shows a list of all broken packages together with their
+ * dependencies. Similar to and based on the equivalent routine in
+ * apt-get.
+ */
+void show_broken(PkBackend *backend, pkgCacheFile &cache, bool Now);
+
+#endif // AAPT_BACKEND_MESSAGES_H
diff --git a/backends/aptcc/apt-sourceslist.cpp b/backends/aptcc/apt-sourceslist.cpp
new file mode 100644
index 0000000..06e0a74
--- /dev/null
+++ b/backends/aptcc/apt-sourceslist.cpp
@@ -0,0 +1,565 @@
+/* apt-sourceslist.cpp - access the sources.list file
+ *
+ * Copyright (c) 1999 Patrick Cole <z at amused.net>
+ * (c) 2002 Synaptic development team
+ *
+ * Author: Patrick Cole <z at amused.net>
+ * Michael Vogt <mvo at debian.org>
+ * Gustavo Niemeyer <niemeyer at conectiva.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "apt-sourceslist.h"
+
+#include <sys/stat.h>
+#include <dirent.h>
+
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
+#include <algorithm>
+#include <fstream>
+
+#include "config.h"
+#include "apt-intf.h"
+
+SourcesList::~SourcesList()
+{
+ for (list<SourceRecord *>::iterator it = SourceRecords.begin();
+ it != SourceRecords.end(); it++)
+ delete *it;
+ for (list<VendorRecord *>::iterator it = VendorRecords.begin();
+ it != VendorRecords.end(); it++)
+ delete *it;
+}
+
+SourcesList::SourceRecord *SourcesList::AddSourceNode(SourceRecord &rec)
+{
+ SourceRecord *newrec = new SourceRecord;
+ *newrec = rec;
+ SourceRecords.push_back(newrec);
+
+ return newrec;
+}
+
+bool SourcesList::ReadSourcePart(string listpath)
+{
+ //cout << "SourcesList::ReadSourcePart() "<< listpath << endl;
+ char buf[512];
+ const char *p;
+ ifstream ifs(listpath.c_str(), ios::in);
+ bool record_ok = true;
+
+ // cannot open file
+ if (!ifs != 0)
+ return _error->Error("Can't read %s", listpath.c_str());
+
+ while (ifs.eof() == false) {
+ p = buf;
+ SourceRecord rec;
+ string Type;
+ string Section;
+ string VURI;
+
+ ifs.getline(buf, sizeof(buf));
+
+ rec.SourceFile = listpath;
+ while (isspace(*p))
+ p++;
+ if (*p == '#') {
+ rec.Type = Disabled;
+ p++;
+ while (isspace(*p))
+ p++;
+ }
+
+ if (*p == '\r' || *p == '\n' || *p == 0) {
+ rec.Type = Comment;
+ rec.Comment = p;
+
+ AddSourceNode(rec);
+ continue;
+ }
+
+ bool Failed = true;
+ if (ParseQuoteWord(p, Type) == true &&
+ rec.SetType(Type) == true && ParseQuoteWord(p, VURI) == true) {
+ if (VURI[0] == '[') {
+ rec.VendorID = VURI.substr(1, VURI.length() - 2);
+ if (ParseQuoteWord(p, VURI) == true && rec.SetURI(VURI) == true)
+ Failed = false;
+ } else if (rec.SetURI(VURI) == true) {
+ Failed = false;
+ }
+ if (Failed == false && ParseQuoteWord(p, rec.Dist) == false)
+ Failed = true;
+ }
+
+ if (Failed == true) {
+ if (rec.Type == Disabled) {
+ // treat as a comment field
+ rec.Type = Comment;
+ rec.Comment = buf;
+ } else {
+ // syntax error on line
+ rec.Type = Comment;
+ string s = "#" + string(buf);
+ rec.Comment = s;
+ record_ok = false;
+ //return _error->Error("Syntax error in line %s", buf);
+ }
+ }
+#ifndef HAVE_RPM
+ // check for absolute dist
+ if (rec.Dist.empty() == false && rec.Dist[rec.Dist.size() - 1] == '/') {
+ // make sure there's no section
+ if (ParseQuoteWord(p, Section) == true)
+ return _error->Error("Syntax error in line %s", buf);
+
+ rec.Dist = SubstVar(rec.Dist, "$(ARCH)",
+ _config->Find("APT::Architecture"));
+
+ AddSourceNode(rec);
+ continue;
+ }
+#endif
+
+ const char *tmp = p;
+ rec.NumSections = 0;
+ while (ParseQuoteWord(p, Section) == true)
+ rec.NumSections++;
+ if (rec.NumSections > 0) {
+ p = tmp;
+ rec.Sections = new string[rec.NumSections];
+ rec.NumSections = 0;
+ while (ParseQuoteWord(p, Section) == true) {
+ // comments inside the record are preserved
+ if (Section[0] == '#') {
+ SourceRecord rec;
+ string s = Section + string(p);
+ rec.Type = Comment;
+ rec.Comment = s;
+ rec.SourceFile = listpath;
+ AddSourceNode(rec);
+ break;
+ } else {
+ rec.Sections[rec.NumSections++] = Section;
+ }
+ }
+ }
+ AddSourceNode(rec);
+ }
+
+ ifs.close();
+ return record_ok;
+}
+
+bool SourcesList::ReadSourceDir(string Dir)
+{
+ //cout << "SourcesList::ReadSourceDir() " << Dir << endl;
+
+ DIR *D = opendir(Dir.c_str());
+ if (D == 0)
+ return _error->Errno("opendir", "Unable to read %s", Dir.c_str());
+
+ vector<string> List;
+ for (struct dirent * Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
+ if (Ent->d_name[0] == '.')
+ continue;
+
+ // Skip bad file names ala run-parts
+ const char *C = Ent->d_name;
+ for (; *C != 0; C++)
+ if (isalpha(*C) == 0 && isdigit(*C) == 0
+ && *C != '_' && *C != '-' && *C != '.')
+ break;
+ if (*C != 0)
+ continue;
+
+ // Only look at files ending in .list to skip .rpmnew etc files
+ if (strcmp(Ent->d_name + strlen(Ent->d_name) - 5, ".list") != 0)
+ continue;
+
+ // Make sure it is a file and not something else
+ string File = flCombine(Dir, Ent->d_name);
+ struct stat St;
+ if (stat(File.c_str(), &St) != 0 || S_ISREG(St.st_mode) == 0)
+ continue;
+ List.push_back(File);
+
+ }
+ closedir(D);
+
+ sort(List.begin(), List.end());
+
+ // Read the files
+ for (vector<string>::const_iterator I = List.begin(); I != List.end();
+ I++)
+ if (ReadSourcePart(*I) == false)
+ return false;
+ return true;
+}
+
+
+bool SourcesList::ReadSources()
+{
+ //cout << "SourcesList::ReadSources() " << endl;
+
+ bool Res = true;
+
+ string Parts = _config->FindDir("Dir::Etc::sourceparts");
+ if (FileExists(Parts) == true)
+ Res &= ReadSourceDir(Parts);
+ string Main = _config->FindFile("Dir::Etc::sourcelist");
+ if (FileExists(Main) == true)
+ Res &= ReadSourcePart(Main);
+
+ return Res;
+}
+
+SourcesList::SourceRecord *SourcesList::AddEmptySource()
+{
+ SourceRecord rec;
+#ifdef HAVE_RPM
+ rec.Type = Rpm;
+#else
+ rec.Type = Deb;
+#endif
+ rec.VendorID = "";
+ rec.SourceFile = _config->FindFile("Dir::Etc::sourcelist");
+ rec.Dist = "";
+ rec.NumSections = 0;
+ return AddSourceNode(rec);
+}
+
+SourcesList::SourceRecord *SourcesList::AddSource(RecType Type,
+ string VendorID, string URI,
+ string Dist,
+ string *Sections,
+ unsigned short count,
+ string SourceFile)
+{
+ SourceRecord rec;
+ rec.Type = Type;
+ rec.VendorID = VendorID;
+ rec.SourceFile = SourceFile;
+
+ if (rec.SetURI(URI) == false) {
+ return NULL;
+ }
+ rec.Dist = Dist;
+ rec.NumSections = count;
+ rec.Sections = new string[count];
+ for (unsigned int i = 0; i < count; i++)
+ rec.Sections[i] = Sections[i];
+
+ return AddSourceNode(rec);
+}
+
+void SourcesList::RemoveSource(SourceRecord *&rec)
+{
+ SourceRecords.remove(rec);
+ delete rec;
+ rec = 0;
+}
+
+void SourcesList::SwapSources( SourceRecord *&rec_one, SourceRecord *&rec_two )
+{
+ list<SourceRecord *>::iterator rec_p;
+ list<SourceRecord *>::iterator rec_n;
+
+ rec_p = find( SourceRecords.begin(), SourceRecords.end(), rec_one );
+ rec_n = find( SourceRecords.begin(), SourceRecords.end(), rec_two );
+
+ SourceRecords.insert( rec_p, rec_two );
+ SourceRecords.erase( rec_n );
+}
+
+bool SourcesList::UpdateSources()
+{
+ list<string> filenames;
+ for (list<SourceRecord *>::iterator it = SourceRecords.begin();
+ it != SourceRecords.end(); it++) {
+ if ((*it)->SourceFile == "")
+ continue;
+ filenames.push_front((*it)->SourceFile);
+ }
+ filenames.sort();
+ filenames.unique();
+
+ for (list<string>::iterator fi = filenames.begin();
+ fi != filenames.end(); fi++) {
+ ofstream ofs((*fi).c_str(), ios::out);
+ if (!ofs != 0)
+ return false;
+
+ for (list<SourceRecord *>::iterator it = SourceRecords.begin();
+ it != SourceRecords.end(); it++) {
+ if ((*fi) != (*it)->SourceFile)
+ continue;
+ string S;
+ if (((*it)->Type & Comment) != 0) {
+ S = (*it)->Comment;
+ } else if ((*it)->URI.empty() || (*it)->Dist.empty()) {
+ continue;
+ } else {
+ if (((*it)->Type & Disabled) != 0)
+ S = "# ";
+
+ S += (*it)->GetType() + " ";
+
+ if ((*it)->VendorID.empty() == false)
+ S += "[" + (*it)->VendorID + "] ";
+
+ S += (*it)->URI + " ";
+ S += (*it)->Dist + " ";
+
+ for (unsigned int J = 0; J < (*it)->NumSections; J++)
+ S += (*it)->Sections[J] + " ";
+ }
+ ofs << S << endl;
+ }
+ ofs.close();
+ }
+ return true;
+}
+
+bool SourcesList::SourceRecord::SetType(string S)
+{
+ if (S == "deb")
+ Type |= Deb;
+ else if (S == "deb-src")
+ Type |= DebSrc;
+ else if (S == "rpm")
+ Type |= Rpm;
+ else if (S == "rpm-src")
+ Type |= RpmSrc;
+ else if (S == "rpm-dir")
+ Type |= RpmDir;
+ else if (S == "rpm-src-dir")
+ Type |= RpmSrcDir;
+ else if (S == "repomd")
+ Type |= Repomd;
+ else if (S == "repomd-src")
+ Type |= RepomdSrc;
+ else
+ return false;
+ //cout << S << " settype " << (Type | Repomd) << endl;
+ return true;
+}
+
+string SourcesList::SourceRecord::GetType()
+{
+ if ((Type & Deb) != 0)
+ return "deb";
+ else if ((Type & DebSrc) != 0)
+ return "deb-src";
+ else if ((Type & Rpm) != 0)
+ return "rpm";
+ else if ((Type & RpmSrc) != 0)
+ return "rpm-src";
+ else if ((Type & RpmDir) != 0)
+ return "rpm-dir";
+ else if ((Type & RpmSrcDir) != 0)
+ return "rpm-src-dir";
+ else if ((Type & Repomd) != 0)
+ return "repomd";
+ else if ((Type & RepomdSrc) != 0)
+ return "repomd-src";
+ //cout << "type " << (Type & Repomd) << endl;
+ return "unknown";
+}
+
+bool SourcesList::SourceRecord::SetURI(string S)
+{
+ if (S.empty() == true)
+ return false;
+ if (S.find(':') == string::npos)
+ return false;
+
+ S = SubstVar(S, "$(ARCH)", _config->Find("APT::Architecture"));
+ S = SubstVar(S, "$(VERSION)", _config->Find("APT::DistroVersion"));
+ URI = S;
+
+ // append a / to the end if one is not already there
+ if (URI[URI.size() - 1] != '/')
+ URI += '/';
+
+ return true;
+}
+
+SourcesList::SourceRecord &SourcesList::SourceRecord::
+operator=(const SourceRecord &rhs)
+{
+ // Needed for a proper deep copy of the record; uses the string operator= to properly copy the strings
+ Type = rhs.Type;
+ VendorID = rhs.VendorID;
+ URI = rhs.URI;
+ Dist = rhs.Dist;
+ Sections = new string[rhs.NumSections];
+ for (unsigned int I = 0; I < rhs.NumSections; I++)
+ Sections[I] = rhs.Sections[I];
+ NumSections = rhs.NumSections;
+ Comment = rhs.Comment;
+ SourceFile = rhs.SourceFile;
+
+ return *this;
+}
+
+SourcesList::VendorRecord *SourcesList::AddVendorNode(VendorRecord &rec)
+{
+ VendorRecord *newrec = new VendorRecord;
+ *newrec = rec;
+ VendorRecords.push_back(newrec);
+
+ return newrec;
+}
+
+bool SourcesList::ReadVendors()
+{
+ Configuration Cnf;
+
+ string CnfFile = _config->FindFile("Dir::Etc::vendorlist");
+ if (FileExists(CnfFile) == true)
+ if (ReadConfigFile(Cnf, CnfFile, true) == false)
+ return false;
+
+ for (list<VendorRecord *>::const_iterator I = VendorRecords.begin();
+ I != VendorRecords.end(); I++)
+ delete *I;
+ VendorRecords.clear();
+
+ // Process 'simple-key' type sections
+ const Configuration::Item *Top = Cnf.Tree("simple-key");
+ for (Top = (Top == 0 ? 0 : Top->Child); Top != 0; Top = Top->Next) {
+ Configuration Block(Top);
+ VendorRecord Vendor;
+
+ Vendor.VendorID = Top->Tag;
+ Vendor.FingerPrint = Block.Find("Fingerprint");
+ Vendor.Description = Block.Find("Name");
+
+ char *buffer = new char[Vendor.FingerPrint.length() + 1];
+ char *p = buffer;;
+ for (string::const_iterator I = Vendor.FingerPrint.begin();
+ I != Vendor.FingerPrint.end(); I++) {
+ if (*I != ' ' && *I != '\t')
+ *p++ = *I;
+ }
+ *p = 0;
+ Vendor.FingerPrint = buffer;
+ delete[]buffer;
+
+ if (Vendor.FingerPrint.empty() == true ||
+ Vendor.Description.empty() == true) {
+ _error->Error("Vendor block %s is invalid",
+ Vendor.VendorID.c_str());
+ continue;
+ }
+
+ AddVendorNode(Vendor);
+ }
+
+ return !_error->PendingError();
+}
+
+SourcesList::VendorRecord *SourcesList::AddVendor(string VendorID,
+ string FingerPrint,
+ string Description)
+{
+ VendorRecord rec;
+ rec.VendorID = VendorID;
+ rec.FingerPrint = FingerPrint;
+ rec.Description = Description;
+ return AddVendorNode(rec);
+}
+
+bool SourcesList::UpdateVendors()
+{
+ ofstream ofs(_config->FindFile("Dir::Etc::vendorlist").c_str(), ios::out);
+ if (!ofs != 0)
+ return false;
+
+ for (list<VendorRecord *>::iterator it = VendorRecords.begin();
+ it != VendorRecords.end(); it++) {
+ ofs << "simple-key \"" << (*it)->VendorID << "\" {" << endl;
+ ofs << "\tFingerPrint \"" << (*it)->FingerPrint << "\";" << endl;
+ ofs << "\tName \"" << (*it)->Description << "\";" << endl;
+ ofs << "}" << endl;
+ }
+
+ ofs.close();
+ return true;
+}
+
+
+void SourcesList::RemoveVendor(VendorRecord *&rec)
+{
+ VendorRecords.remove(rec);
+ delete rec;
+ rec = 0;
+}
+
+ostream &operator<<(ostream &os, const SourcesList::SourceRecord &rec)
+{
+ os << "Type: ";
+ if ((rec.Type & SourcesList::Comment) != 0)
+ os << "Comment ";
+ if ((rec.Type & SourcesList::Disabled) != 0)
+ os << "Disabled ";
+ if ((rec.Type & SourcesList::Deb) != 0)
+ os << "Deb";
+ if ((rec.Type & SourcesList::DebSrc) != 0)
+ os << "DebSrc";
+ if ((rec.Type & SourcesList::Rpm) != 0)
+ os << "Rpm";
+ if ((rec.Type & SourcesList::RpmSrc) != 0)
+ os << "RpmSrc";
+ if ((rec.Type & SourcesList::RpmDir) != 0)
+ os << "RpmDir";
+ if ((rec.Type & SourcesList::RpmSrcDir) != 0)
+ os << "RpmSrcDir";
+ if ((rec.Type & SourcesList::Repomd) != 0)
+ os << "Repomd";
+ if ((rec.Type & SourcesList::RepomdSrc) != 0)
+ os << "RepomdSrc";
+ os << endl;
+ os << "SourceFile: " << rec.SourceFile << endl;
+ os << "VendorID: " << rec.VendorID << endl;
+ os << "URI: " << rec.URI << endl;
+ os << "Dist: " << rec.Dist << endl;
+ os << "Section(s):" << endl;
+#if 0
+ for (unsigned int J = 0; J < rec.NumSections; J++) {
+ cout << "\t" << rec.Sections[J] << endl;
+ }
+#endif
+ os << endl;
+ return os;
+}
+
+ostream &operator<<(ostream &os, const SourcesList::VendorRecord &rec)
+{
+ os << "VendorID: " << rec.VendorID << endl;
+ os << "FingerPrint: " << rec.FingerPrint << endl;
+ os << "Description: " << rec.Description << endl;
+ return os;
+}
+
+// vim:sts=4:sw=4
diff --git a/backends/aptcc/apt-sourceslist.h b/backends/aptcc/apt-sourceslist.h
new file mode 100644
index 0000000..8b409e5
--- /dev/null
+++ b/backends/aptcc/apt-sourceslist.h
@@ -0,0 +1,115 @@
+/* apt-sourceslist.h - access the sources.list file
+ *
+ * Copyright (c) 1999 Patrick Cole <z at amused.net>
+ * (c) 2002 Synaptic development team
+ *
+ * Author: Patrick Cole <z at amused.net>
+ * Michael Vogt <mvo at debian.org>
+ * Gustavo Niemeyer <niemeyer at conectiva.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef APT_SOURCESLIST_H
+#define APT_SOURCESLIST_H
+
+#include <string>
+#include <list>
+
+using namespace std;
+
+class SourcesList {
+ public:
+ enum RecType {
+ Deb = 1 << 0,
+ DebSrc = 1 << 1,
+ Rpm = 1 << 2,
+ RpmSrc = 1 << 3,
+ Disabled = 1 << 4,
+ Comment = 1 << 5,
+ RpmDir = 1 << 6,
+ RpmSrcDir = 1 << 7,
+ Repomd = 1 << 8,
+ RepomdSrc = 1 << 9
+ };
+
+ struct SourceRecord {
+ unsigned int Type;
+ string VendorID;
+ string URI;
+ string Dist;
+ string *Sections;
+ unsigned short NumSections;
+ string Comment;
+ string SourceFile;
+
+ bool SetType(string);
+ string GetType();
+ bool SetURI(string);
+
+ SourceRecord():Type(0), Sections(0), NumSections(0) {
+ };
+ ~SourceRecord() {
+ if (Sections)
+ delete[]Sections;
+ };
+ SourceRecord &operator=(const SourceRecord &);
+ };
+
+ struct VendorRecord {
+ string VendorID;
+ string FingerPrint;
+ string Description;
+ };
+
+ list<SourceRecord *> SourceRecords;
+ list<VendorRecord *> VendorRecords;
+
+ private:
+ SourceRecord *AddSourceNode(SourceRecord &);
+ VendorRecord *AddVendorNode(VendorRecord &);
+
+ public:
+ SourceRecord *AddSource(RecType Type,
+ string VendorID,
+ string URI,
+ string Dist,
+ string *Sections,
+ unsigned short count, string SourceFile);
+ SourceRecord *AddEmptySource();
+ void RemoveSource(SourceRecord *&);
+ void SwapSources( SourceRecord *&, SourceRecord *& );
+ bool ReadSourcePart(string listpath);
+ bool ReadSourceDir(string Dir);
+ bool ReadSources();
+ bool UpdateSources();
+
+ VendorRecord *AddVendor(string VendorID,
+ string FingerPrint, string Description);
+ void RemoveVendor(VendorRecord *&);
+ bool ReadVendors();
+ bool UpdateVendors();
+
+ SourcesList() {
+ };
+ ~SourcesList();
+};
+
+typedef list<SourcesList::SourceRecord *>::iterator SourcesListIter;
+
+ostream &operator <<(ostream &, const SourcesList::SourceRecord &);
+
+#endif
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 546b75a..953ee68 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -1,8 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * Licensed under the GNU General Public License Version 2
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,13 +13,13 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
#include "apt-utils.h"
-#include "pkg_acqfile.h"
#include <iostream>
#include <fstream>
#include <sys/stat.h>
diff --git a/backends/aptcc/apt-utils.h b/backends/aptcc/apt-utils.h
index 4b95206..30b143b 100644
--- a/backends/aptcc/apt-utils.h
+++ b/backends/aptcc/apt-utils.h
@@ -1,9 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 200 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- * Copyright (C) 2001, 2005 Daniel Burrows (aptitude)
- *
- * Licensed under the GNU General Public License Version 2
+ * Copyright (c) 2001, 2005 Daniel Burrows (aptitude)
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,8 +14,9 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
#ifndef APT_UTILS_H
@@ -25,12 +24,11 @@
#include <apt-pkg/pkgrecords.h>
-#include <pk-backend.h>
-
#include <string.h>
#include <set>
+#include <pk-backend.h>
-#include "apt.h"
+#include "pkg_acqfile.h"
typedef std::vector<pkgCache::PkgIterator> pkgvector;
diff --git a/backends/aptcc/apt.cpp b/backends/aptcc/apt.cpp
deleted file mode 100644
index 36a2a15..0000000
--- a/backends/aptcc/apt.cpp
+++ /dev/null
@@ -1,2194 +0,0 @@
-// apt.cc
-//
-// Copyright 1999-2008 Daniel Burrows
-// Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-// Copyright (c) 2004 Michael Vogt <mvo at debian.org>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-
-#include "apt.h"
-#include "apt-utils.h"
-#include "matcher.h"
-#include "gstMatcher.h"
-#include "aptcc_show_broken.h"
-#include "acqprogress.h"
-#include "pkg_acqfile.h"
-#include "aptcc_show_error.h"
-#include "deb-file.h"
-#include "dpkgpm.h"
-
-#include <apt-pkg/error.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/algorithms.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/sptr.h>
-#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/version.h>
-#include <apt-pkg/aptconfiguration.h>
-
-#include <sys/statvfs.h>
-#include <sys/statfs.h>
-#include <sys/wait.h>
-#include <sys/fcntl.h>
-#include <pty.h>
-
-#define RAMFS_MAGIC 0x858458f6
-
-#include <fstream>
-#include <dirent.h>
-#include <assert.h>
-#include <regex.h>
-
-aptcc::aptcc(PkBackend *backend, bool &cancel)
- :
- packageRecords(0),
- packageCache(0),
- packageDepCache(0),
- packageSourceList(0),
- Map(0),
- Policy(0),
- m_backend(backend),
- _cancel(cancel),
- m_terminalTimeout(120),
- m_lastSubProgress(0)
-{
- _cancel = false;
-}
-
-bool aptcc::init()
-{
- gchar *locale;
- gchar *http_proxy;
- gchar *ftp_proxy;
-
- m_isMultiArch = APT::Configuration::getArchitectures(false).size() > 1;
-
- // Set PackageKit status
- pk_backend_set_status(m_backend, PK_STATUS_ENUM_LOADING_CACHE);
-
- // set locale
- if (locale = pk_backend_get_locale(m_backend)) {
- setlocale(LC_ALL, locale);
-// TODO why this cuts characthers on ui?
-// string _locale(locale);
-// size_t found;
-// found = _locale.find('.');
-// _locale.erase(found);
-// _config->Set("APT::Acquire::Translation", _locale);
- }
-
- // set http proxy
- http_proxy = pk_backend_get_proxy_http(m_backend);
- setenv("http_proxy", http_proxy, 1);
-
- // set ftp proxy
- ftp_proxy = pk_backend_get_proxy_ftp(m_backend);
- setenv("ftp_proxy", ftp_proxy, 1);
-
- packageSourceList = new pkgSourceList;
- // Read the source list
- packageSourceList->ReadMainList();
-
- // Generate it and map it
- bool Res = pkgMakeStatusCache(*packageSourceList, Progress, &Map, true);
- Progress.Done();
- if(!Res) {
- return false;
- //"The package lists or status file could not be parsed or opened."
- }
-
- packageCache = new pkgCache(Map);
- if (_error->PendingError()) {
- return false;
- }
-
- // create depcache
- Policy = new pkgPolicy(packageCache);
- if (_error->PendingError()) {
- return false;
- }
-
- if (!ReadPinFile(*Policy)) {
- return false;
- }
-
- packageDepCache = new pkgDepCache(packageCache, Policy);
- if (_error->PendingError()) {
- return false;
- }
-
- packageDepCache->Init(&Progress);
- Progress.Done();
- if (_error->PendingError()) {
- return false;
- }
-
- // Create the text record parser
- packageRecords = new pkgRecords(*packageDepCache);
-}
-
-aptcc::~aptcc()
-{
- if (packageRecords)
- {
- g_debug ("~apt_init packageRecords");
- delete packageRecords;
- }
-
- if (packageCache)
- {
- g_debug ("~apt_init packageCache");
- delete packageCache;
- }
-
- if (packageDepCache)
- {
- g_debug ("~apt_init packageDepCache");
- delete packageDepCache;
- }
-
- if (Policy)
- {
- g_debug ("~apt_init Policy");
- delete Policy;
- }
-
- if (packageSourceList)
- {
- delete packageSourceList;
- }
-
- pk_backend_finished(m_backend);
-
- delete Map;
-}
-
-void aptcc::cancel()
-{
- if (!_cancel) {
- _cancel = true;
- pk_backend_set_status(m_backend, PK_STATUS_ENUM_CANCEL);
- }
- if (m_child_pid > 0) {
- kill(m_child_pid, SIGTERM);
- }
-}
-
-pair<pkgCache::PkgIterator, pkgCache::VerIterator>
- aptcc::find_package_id(const gchar *package_id, bool &found)
-{
- gchar **parts;
- pkgCache::VerIterator ver;
- pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
-
- found = true;
-
- parts = pk_package_id_split (package_id);
- gchar *pkgNameArch;
- pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
- pkg_ver.first = packageCache->FindPkg(pkgNameArch);
- g_free(pkgNameArch);
-
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (pkg_ver.first.end() == true ||
- (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
- {
- g_strfreev (parts);
- return pkg_ver;
- }
-
- ver = find_ver(pkg_ver.first);
- // check to see if the provided package isn't virtual too
- if (ver.end() == false &&
- strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
- {
- g_strfreev (parts);
- pkg_ver.second = ver;
- return pkg_ver;
- }
-
- ver = find_candidate_ver(pkg_ver.first);
- // check to see if the provided package isn't virtual too
- if (ver.end() == false &&
- strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
- {
- g_strfreev (parts);
- pkg_ver.second = ver;
- return pkg_ver;
- }
-
- found = false;
- g_strfreev (parts);
- return pkg_ver;
-}
-
-pkgCache::VerIterator aptcc::find_candidate_ver(const pkgCache::PkgIterator &pkg)
-{
- // get the candidate version iterator
- return (*packageDepCache)[pkg].CandidateVerIter(*packageDepCache);
-}
-
-pkgCache::VerIterator aptcc::find_ver(const pkgCache::PkgIterator &pkg)
-{
- // if the package is installed return the current version
- if(!pkg.CurrentVer().end()) {
- return pkg.CurrentVer();
- }
-
- // Else get the candidate version iterator
- pkgCache::VerIterator candver = find_candidate_ver(pkg);
- if(!candver.end())
- {
- return candver;
- }
-
- // return the version list as a last resource
- return pkg.VersionList();
-}
-
-// used to emit packages it collects all the needed info
-void aptcc::emit_package(const pkgCache::PkgIterator &pkg,
- const pkgCache::VerIterator &ver,
- PkBitfield filters,
- PkInfoEnum state)
-{
- // check the state enum to see if it was not set.
- if (state == PK_INFO_ENUM_UNKNOWN) {
- if (pkg->CurrentState == pkgCache::State::Installed &&
- pkg.CurrentVer() == ver) {
- state = PK_INFO_ENUM_INSTALLED;
- } else {
- state = PK_INFO_ENUM_AVAILABLE;
- }
- }
-
- if (m_isMultiArch &&
- (pk_bitfield_contain(filters, PK_FILTER_ENUM_ARCH) &&
- state == PK_INFO_ENUM_AVAILABLE)) {
- // don't emit the package if it does not match
- // the native architecture
- if (strcmp(ver.Arch(), "all") != 0 &&
- strcmp(ver.Arch(), _config->Find("APT::Architecture").c_str()) != 0) {
- return;
- }
- }
-
- if (filters != 0) {
- std::string str = ver.Section() == NULL ? "" : ver.Section();
- std::string section, repo_section;
-
- size_t found;
- found = str.find_last_of("/");
- section = str.substr(found + 1);
- repo_section = str.substr(0, found);
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)
- && state == PK_INFO_ENUM_INSTALLED) {
- return;
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)
- && state == PK_INFO_ENUM_AVAILABLE) {
- return;
- }
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_DEVELOPMENT)) {
- // if ver.end() means unknow
- // strcmp will be true when it's different than devel
- std::string pkgName = pkg.Name();
- if (!ends_with(pkgName, "-dev") &&
- !ends_with(pkgName, "-dbg") &&
- section.compare("devel") &&
- section.compare("libdevel")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_DEVELOPMENT)) {
- std::string pkgName = pkg.Name();
- if (ends_with(pkgName, "-dev") ||
- ends_with(pkgName, "-dbg") ||
- !section.compare("devel") ||
- !section.compare("libdevel")) {
- return;
- }
- }
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_GUI)) {
- // if ver.end() means unknow
- // strcmp will be true when it's different than x11
- if (section.compare("x11") && section.compare("gnome") &&
- section.compare("kde") && section.compare("graphics")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_GUI)) {
- if (!section.compare("x11") || !section.compare("gnome") ||
- !section.compare("kde") || !section.compare("graphics")) {
- return;
- }
- }
-
- // TODO add Ubuntu handling
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_FREE)) {
- if (!repo_section.compare("contrib") ||
- !repo_section.compare("non-free")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_FREE)) {
- if (repo_section.compare("contrib") &&
- repo_section.compare("non-free")) {
- return;
- }
- }
-
- // TODO test this one..
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_COLLECTIONS)) {
- if (!repo_section.compare("metapackages")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_COLLECTIONS)) {
- if (repo_section.compare("metapackages")) {
- return;
- }
- }
-
- }
- pkgCache::VerFileIterator vf = ver.FileList();
-
- gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- ver.VerStr(),
- ver.Arch(),
- vf.File().Archive() == NULL ? "" : vf.File().Archive());
- pk_backend_package(m_backend,
- state,
- package_id,
- get_short_description(ver, packageRecords).c_str());
- g_free(package_id);
-}
-
-void aptcc::emit_packages(PkgList &output,
- PkBitfield filters,
- PkInfoEnum state)
-{
- // Sort so we can remove the duplicated entries
- sort(output.begin(), output.end(), compare());
- // Remove the duplicated entries
- output.erase(unique(output.begin(),
- output.end(),
- result_equality()),
- output.end());
-
- for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
- i != output.end(); ++i)
- {
- if (_cancel) {
- break;
- }
- emit_package(i->first, i->second, filters, state);
- }
-}
-
-void aptcc::emitUpdates(PkgList &output, PkBitfield filters)
-{
- PkInfoEnum state;
- // Sort so we can remove the duplicated entries
- sort(output.begin(), output.end(), compare());
- // Remove the duplicated entries
- output.erase(unique(output.begin(),
- output.end(),
- result_equality()),
- output.end());
-
- for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
- i != output.end(); ++i)
- {
- if (_cancel) {
- break;
- }
-
- // the default update info
- state = PK_INFO_ENUM_NORMAL;
-
- // let find what kind of upgrade this is
- pkgCache::VerFileIterator vf = i->second.FileList();
- std::string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
- std::string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
- std::string label = vf.File().Label() == NULL ? "" : vf.File().Label();
- if (origin.compare("Debian") == 0 ||
- origin.compare("Ubuntu") == 0) {
- if (ends_with(archive, "-security") ||
- label.compare("Debian-Security") == 0) {
- state = PK_INFO_ENUM_SECURITY;
- } else if (ends_with(archive, "-backports")) {
- state = PK_INFO_ENUM_ENHANCEMENT;
- } else if (ends_with(archive, "-updates")) {
- state = PK_INFO_ENUM_BUGFIX;
- }
- } else if (origin.compare("Backports.org archive") == 0 ||
- ends_with(origin, "-backports")) {
- state = PK_INFO_ENUM_ENHANCEMENT;
- }
-
- emit_package(i->first, i->second, filters, state);
- }
-}
-
-// search packages which provide a codec (specified in "values")
-void aptcc::providesCodec(PkgList &output, gchar **values)
-{
- GstMatcher *matcher = new GstMatcher(values);
- if (!matcher->hasMatches()) {
- return;
- }
-
- for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg)
- {
- if (_cancel) {
- delete matcher;
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- // TODO search in updates packages
- // Ignore virtual packages
- pkgCache::VerIterator ver = find_ver(pkg);
- if (ver.end() == true) {
- ver = find_candidate_ver(pkg);
- if (ver.end() == true) {
- continue;
- }
- }
-
- pkgCache::VerFileIterator vf = ver.FileList();
- pkgRecords::Parser &rec = packageRecords->Lookup(vf);
- const char *start, *stop;
- rec.GetRec(start, stop);
- string record(start, stop - start);
- if (matcher->matches(record)) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
- }
- }
-
- delete matcher;
-}
-
-// search packages which provide the libraries specified in "values"
-void aptcc::providesLibrary(PkgList &output, gchar **values)
-{
- bool ret = false;
- // Quick-check for library names
- for (uint i = 0; i < g_strv_length(values); i++)
- if (g_str_has_prefix (values[i], "lib")) {
- ret = true;
- break;
- }
- if (!ret)
- return;
-
- const char *libreg_str = "^\\(lib.*\\)\\.so\\.[0-9]*";
- g_debug ("RegStr: %s", libreg_str);
- regex_t libreg;
- if(regcomp(&libreg, libreg_str, 0) != 0) {
- g_debug("Regex compilation error: ", libreg);
- return;
- }
-
- gchar *value;
- for (uint i = 0; i < g_strv_length(values); i++) {
- value = values[i];
- regmatch_t matches[2];
- if (regexec(&libreg, value, 2, matches, 0) != REG_NOMATCH) {
- string libPkgName = string(value, matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
-
- string strvalue = string(value);
- ssize_t pos = strvalue.find (".so.");
- if ((pos != string::npos) && (pos > 0)) {
- // If last char is a number, add a "-" (to be policy-compliant)
- if (g_ascii_isdigit (libPkgName.at (libPkgName.length () - 1)))
- libPkgName.append ("-");
-
- libPkgName.append (strvalue.substr (pos + 4));
- }
-
- g_debug ("pkg-name: %s", libPkgName.c_str ());
-
- for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- // TODO: Ignore virtual packages
- pkgCache::VerIterator ver = find_ver (pkg);
- if (ver.end() == true) {
- ver = find_candidate_ver(pkg);
- if (ver.end() == true) {
- continue;
- }
- }
-
- // Make everything lower-case
- std::transform(libPkgName.begin(), libPkgName.end(), libPkgName.begin(), ::tolower);
-
- if (g_strcmp0 (pkg.Name (), libPkgName.c_str ()) == 0) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
- }
- }
-
- } else {
- g_debug("libmatcher: Did not match: %s", value);
- }
- }
-
-}
-
-// used to emit packages it collects all the needed info
-void aptcc::emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
-{
- pkgCache::VerIterator ver;
- if (version.end() == false) {
- ver = version;
- } else {
- ver = find_ver(pkg);
- }
- std::string section = ver.Section() == NULL ? "" : ver.Section();
-
- size_t found;
- found = section.find_last_of("/");
- section = section.substr(found + 1);
-
- pkgCache::VerFileIterator vf = ver.FileList();
- pkgRecords::Parser &rec = packageRecords->Lookup(vf);
-
- long size;
- if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
- // if the package is installed emit the installed size
- size = ver->InstalledSize;
- } else {
- size = ver->Size;
- }
-
- gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- ver.VerStr(),
- ver.Arch(),
- vf.File().Archive() == NULL ? "" : vf.File().Archive());
-
- pk_backend_details(m_backend,
- package_id,
- "unknown",
- get_enum_group(section),
- get_long_description_parsed(ver, packageRecords).c_str(),
- rec.Homepage().c_str(),
- size);
-
- g_free(package_id);
-}
-
-void aptcc::emitDetails(PkgList &pkgs)
-{
- // Sort so we can remove the duplicated entries
- sort(pkgs.begin(), pkgs.end(), compare());
- // Remove the duplicated entries
- pkgs.erase(unique(pkgs.begin(), pkgs.end(), result_equality()),
- pkgs.end());
-
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
- {
- if (_cancel) {
- break;
- }
-
- emitDetails(i->first, i->second);
- }
-}
-
-// used to emit packages it collects all the needed info
-void aptcc::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
-{
- // Get the version of the current package
- pkgCache::VerIterator currver = find_ver(pkg);
- pkgCache::VerFileIterator currvf = currver.FileList();
- // Build a package_id from the current version
- gchar *current_package_id;
- current_package_id = pk_package_id_build(pkg.Name(),
- currver.VerStr(),
- currver.Arch(),
- currvf.File().Archive() == NULL ? "" : currvf.File().Archive());
-
- // Get the update version
- pkgCache::VerIterator candver;
- if (version.end() == false) {
- candver = version;
- } else {
- candver = find_candidate_ver(pkg);
- }
-
- pkgCache::VerFileIterator vf = candver.FileList();
- string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
- pkgRecords::Parser &rec = packageRecords->Lookup(candver.FileList());
-
- // Build the changelogURI
- char uri[512];
- string srcpkg;
- string verstr;
-
- if (rec.SourcePkg().empty()) {
- srcpkg = pkg.Name();
- } else {
- srcpkg = rec.SourcePkg();
- }
- if (origin.compare("Debian") == 0 || origin.compare("Ubuntu") == 0) {
- string prefix;
-
- string src_section = candver.Section() == NULL ? "" : candver.Section();
- if(src_section.find('/') != src_section.npos) {
- src_section = string(src_section, 0, src_section.find('/'));
- } else {
- src_section = "main";
- }
-
- prefix += srcpkg[0];
- if(srcpkg.size() > 3 && srcpkg[0] == 'l' && srcpkg[1] == 'i' && srcpkg[2] == 'b') {
- prefix = string("lib") + srcpkg[3];
- }
-
- if(candver.VerStr() != NULL) {
- verstr = candver.VerStr();
- }
-
- if(verstr.find(':') != verstr.npos) {
- verstr = string(verstr, verstr.find(':') + 1);
- }
-
- if (origin.compare("Debian") == 0) {
- snprintf(uri,
- 512,
- "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
- prefix.c_str(),
- srcpkg.c_str(),
- srcpkg.c_str(),
- verstr.c_str());
- } else {
- snprintf(uri,
- 512,
- "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
- prefix.c_str(),
- srcpkg.c_str(),
- srcpkg.c_str(),
- verstr.c_str());
- }
- } else {
- string pkgfilename;
- const char *start, *stop;
- pkgTagSection sec;
- unsigned long len;
-
- rec.GetRec(start, stop);
- len = stop - start;
- // add +1 to ensure we have the double lineline in the buffer
- if (start && sec.Scan(start, len + 1)) {
- pkgfilename = sec.FindS("Filename");
- }
-
- string cadidateOriginSiteUrl;
- if(!vf.end() && vf.File() && vf.File().Site()) {
- cadidateOriginSiteUrl = vf.File().Site();
- }
-
- pkgfilename = pkgfilename.substr(0, pkgfilename.find_last_of('.')) + ".changelog";
- snprintf(uri,512,"http://%s/%s",
- cadidateOriginSiteUrl.c_str(),
- pkgfilename.c_str());
- }
- // Create the download object
- AcqPackageKitStatus Stat(this, m_backend, _cancel);
-
- // get a fetcher
- pkgAcquire fetcher;
- fetcher.Setup(&Stat);
-
- // fetch the changelog
- pk_backend_set_status(m_backend, PK_STATUS_ENUM_DOWNLOAD_CHANGELOG);
- string filename = getChangelogFile(pkg.Name(), origin, verstr, srcpkg, uri, &fetcher);
-
- string changelog;
- string update_text;
- ifstream in(filename.c_str());
- string line;
- GRegex *regexVer;
- regexVer = g_regex_new("(?'source'.+) \\((?'version'.*)\\) "
- "(?'dist'.+); urgency=(?'urgency'.+)",
- G_REGEX_CASELESS,
- G_REGEX_MATCH_ANCHORED,
- 0);
- GRegex *regexDate;
- regexDate = g_regex_new("^ -- (?'maintainer'.+) (?'mail'<.+>) (?'date'.+)$",
- G_REGEX_CASELESS,
- G_REGEX_MATCH_ANCHORED,
- 0);
- string updated;
- string issued;
- while (getline(in, line)) {
- // no need to free str later, it is allocated in a static buffer
- const char *str = utf8(line.c_str());
- if (strcmp(str, "") == 0) {
- changelog.append("\n");
- continue;
- } else {
- changelog.append(str);
- changelog.append("\n");
- }
-
- if (starts_with(str, srcpkg.c_str())) {
- // Check to see if the the text isn't about the current package,
- // otherwise add a == version ==
- GMatchInfo *match_info;
- if (g_regex_match(regexVer, str, G_REGEX_MATCH_ANCHORED, &match_info)) {
- gchar *version;
- version = g_match_info_fetch_named(match_info, "version");
-
- // Compare if the current version is shown in the changelog, to not
- // display old changelog information
- if (_system != 0 &&
- _system->VS->DoCmpVersion(version, version + strlen(version),
- currver.VerStr(), currver.VerStr() + strlen(currver.VerStr())) <= 0) {
- g_free (version);
- break;
- } else {
- if (!update_text.empty()) {
- update_text.append("\n\n");
- }
- update_text.append(" == ");
- update_text.append(version);
- update_text.append(" ==");
- g_free (version);
- }
- }
- g_match_info_free (match_info);
- } else if (starts_with(str, " ")) {
- // update descritption
- update_text.append("\n");
- update_text.append(str);
- } else if (starts_with(str, " --")) {
- // Parse the text to know when the update was issued,
- // and when it got updated
- GMatchInfo *match_info;
- if (g_regex_match(regexDate, str, G_REGEX_MATCH_ANCHORED, &match_info)) {
- GTimeVal dateTime = {0, 0};
- gchar *date;
- date = g_match_info_fetch_named(match_info, "date");
- g_warn_if_fail(RFC1123StrToTime(date, dateTime.tv_sec));
- g_free(date);
-
- issued = g_time_val_to_iso8601(&dateTime);
- if (updated.empty()) {
- updated = g_time_val_to_iso8601(&dateTime);
- }
- }
- g_match_info_free(match_info);
- }
- }
- // Clean structures
- g_regex_unref(regexVer);
- g_regex_unref(regexDate);
- unlink(filename.c_str());
-
- // Check if the update was updates since it was issued
- if (issued.compare(updated) == 0) {
- updated = "";
- }
-
- // Build a package_id from the update version
- string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
- gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- candver.VerStr(),
- candver.Arch(),
- archive.c_str());
-
- PkUpdateStateEnum updateState = PK_UPDATE_STATE_ENUM_UNKNOWN;
- if (archive.compare("stable") == 0) {
- updateState = PK_UPDATE_STATE_ENUM_STABLE;
- } else if (archive.compare("testing") == 0) {
- updateState = PK_UPDATE_STATE_ENUM_TESTING;
- } else if (archive.compare("unstable") == 0 ||
- archive.compare("experimental") == 0)
- {
- updateState = PK_UPDATE_STATE_ENUM_UNSTABLE;
- }
-
- PkRestartEnum restart = PK_RESTART_ENUM_NONE;
- if (starts_with(pkg.Name(), "linux-image-") ||
- starts_with(pkg.Name(), "nvidia-") ||
- strcmp(pkg.Name(), "libc6") == 0 ||
- strcmp(pkg.Name(), "dbus") == 0) {
- restart = PK_RESTART_ENUM_SYSTEM;
- }
-
- pk_backend_update_detail(m_backend,
- package_id,
- current_package_id,//const gchar *updates
- "",//const gchar *obsoletes
- "",//const gchar *vendor_url
- getBugzillaUrls(changelog).c_str(),//const gchar *bugzilla_url
- getCVEUrls(changelog).c_str(),//const gchar *cve_url
- restart,//PkRestartEnum restart
- update_text.c_str(),//const gchar *update_text
- changelog.c_str(),//const gchar *changelog
- updateState,//PkUpdateStateEnum state
- issued.c_str(), //const gchar *issued_text
- updated.c_str() //const gchar *updated_text
- );
- g_free(current_package_id);
- g_free(package_id);
-}
-
-void aptcc::emitUpdateDetails(PkgList &pkgs)
-{
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
- {
- if (_cancel) {
- break;
- }
-
- emitUpdateDetails(i->first, i->second);
- }
-}
-
-void aptcc::get_depends(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive)
-{
- pkgCache::DepIterator dep = find_ver(pkg).DependsList();
- while (!dep.end()) {
- if (_cancel) {
- break;
- }
- pkgCache::VerIterator ver = find_ver(dep.TargetPkg());
- // Ignore packages that exist only due to dependencies.
- if (ver.end()) {
- dep++;
- continue;
- } else if (dep->Type == pkgCache::Dep::Depends) {
- if (recursive) {
- if (!contains(output, dep.TargetPkg())) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
- get_depends(output, dep.TargetPkg(), recursive);
- }
- } else {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
- }
- }
- dep++;
- }
-}
-
-void aptcc::get_requires(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive)
-{
- for (pkgCache::PkgIterator parentPkg = packageCache->PkgBegin(); !parentPkg.end(); ++parentPkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (parentPkg.VersionList().end() && parentPkg.ProvidesList().end()) {
- continue;
- }
-
- // Don't insert virtual packages instead add what it provides
- pkgCache::VerIterator ver = find_ver(parentPkg);
- if (ver.end() == false) {
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > deps;
- get_depends(deps, parentPkg, false);
- for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=deps.begin();
- i != deps.end();
- ++i)
- {
- if (i->first == pkg) {
- if (recursive) {
- if (!contains(output, parentPkg)) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
- get_requires(output, parentPkg, recursive);
- }
- } else {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
- }
- break;
- }
- }
- }
- }
-}
-
-// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
-vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel)
-{
- vector<string> packageList;
- regex_t re;
- gchar *search;
- gchar *values_str;
-
- values_str = g_strjoinv("$|^", values);
- search = g_strdup_printf("^%s$",
- values_str);
- g_free(values_str);
- if(regcomp(&re, search, REG_NOSUB) != 0) {
- g_debug("Regex compilation error");
- g_free(search);
- return vector<string>();
- }
- g_free(search);
-
- DIR *dp;
- struct dirent *dirp;
- if (!(dp = opendir("/var/lib/dpkg/info/"))) {
- g_debug ("Error opening /var/lib/dpkg/info/\n");
- regfree(&re);
- return vector<string>();
- }
-
- string line;
- while ((dirp = readdir(dp)) != NULL) {
- if (_cancel) {
- break;
- }
- if (ends_with(dirp->d_name, ".list")) {
- string f = "/var/lib/dpkg/info/" + string(dirp->d_name);
- ifstream in(f.c_str());
- if (!in != 0) {
- continue;
- }
- while (!in.eof()) {
- getline(in, line);
- if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
- string file(dirp->d_name);
- packageList.push_back(file.erase(file.size() - 5, file.size()));
- break;
- }
- }
- }
- }
- closedir(dp);
- regfree(&re);
- return packageList;
-}
-
-// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
-vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel)
-{
- vector<string> packageList;
- regex_t re;
- gchar *value;
- gchar *values_str;
-
- values_str = g_strjoinv("|", values);
- value = g_strdup_printf("^MimeType=\\(.*;\\)\\?\\(%s\\)\\(;.*\\)\\?$",
- values_str);
- g_free(values_str);
-
- if(regcomp(&re, value, REG_NOSUB) != 0) {
- g_debug("Regex compilation error");
- g_free(value);
- return vector<string>();
- }
- g_free(value);
-
- DIR *dp;
- struct dirent *dirp;
- if (!(dp = opendir("/usr/share/app-install/desktop/"))) {
- g_debug ("Error opening /usr/share/app-install/desktop/\n");
- regfree(&re);
- error = true;
- return vector<string>();
- }
-
- string line;
- while ((dirp = readdir(dp)) != NULL) {
- if (_cancel) {
- break;
- }
- if (ends_with(dirp->d_name, ".desktop")) {
- string f = "/usr/share/app-install/desktop/" + string(dirp->d_name);
- ifstream in(f.c_str());
- if (!in != 0) {
- continue;
- }
- bool getName = false;
- while (!in.eof()) {
- getline(in, line);
- if (getName) {
- if (starts_with(line, "X-AppInstall-Package=")) {
- // Remove the X-AppInstall-Package=
- packageList.push_back(line.substr(21));
- break;
- }
- } else {
- if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
- in.seekg(ios_base::beg);
- getName = true;
- }
- }
- }
- }
- }
-
- closedir(dp);
- regfree(&re);
- return packageList;
-}
-
-// used to emit files it reads the info directly from the files
-void aptcc::emitFiles(PkBackend *backend, const gchar *pi)
-{
- static string filelist;
- string line;
- gchar **parts;
-
- parts = pk_package_id_split (pi);
- filelist.erase(filelist.begin(), filelist.end());
-
- string fName;
- if (m_isMultiArch) {
- fName = "/var/lib/dpkg/info/" +
- string(parts[PK_PACKAGE_ID_NAME]) +
- ":" +
- string(parts[PK_PACKAGE_ID_ARCH]) +
- ".list";
- } else {
- fName = "/var/lib/dpkg/info/" +
- string(parts[PK_PACKAGE_ID_NAME]) +
- ".list";
- }
- g_strfreev (parts);
-
- if (FileExists(fName)) {
- ifstream in(fName.c_str());
- if (!in != 0) {
- return;
- }
- while (in.eof() == false && filelist.empty()) {
- getline(in, line);
- filelist += line;
- }
- while (in.eof() == false) {
- getline(in, line);
- if (!line.empty()) {
- filelist += ";" + line;
- }
- }
-
- if (!filelist.empty()) {
- pk_backend_files (backend, pi, filelist.c_str());
- }
- }
-}
-
-static bool checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
-{
- string UntrustedList;
- for (pkgAcquire::ItemIterator I = fetcher.ItemsBegin(); I < fetcher.ItemsEnd(); ++I)
- {
- if (!(*I)->IsTrusted())
- {
- UntrustedList += string((*I)->ShortDesc()) + " ";
- }
- }
-
- if (UntrustedList == "")
- {
- return true;
- }
-
- if (pk_backend_get_bool(backend, "only_trusted") == false ||
- _config->FindB("APT::Get::AllowUnauthenticated", false) == true)
- {
- g_debug ("Authentication warning overridden.\n");
- return true;
- }
-
- string warning("The following packages cannot be authenticated:\n");
- warning += UntrustedList;
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED,
- warning.c_str());
- _error->Discard();
- return false;
-}
-
-bool aptcc::TryToInstall(pkgCache::PkgIterator Pkg,
- pkgDepCache &Cache,
- pkgProblemResolver &Fix,
- bool Remove,
- bool BrokenFix,
- unsigned int &ExpectedInst)
-{
- // This is a pure virtual package and there is a single available provides
- if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
- Pkg.ProvidesList()->NextProvides == 0)
- {
- pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
- Pkg = Tmp;
- }
-
- // Check if there is something at all to install
- pkgDepCache::StateCache &State = Cache[Pkg];
- if (Remove == true && Pkg->CurrentVer == 0)
- {
- Fix.Clear(Pkg);
- Fix.Protect(Pkg);
- Fix.Remove(Pkg);
-
- return true;
- }
-
- if (State.CandidateVer == 0 && Remove == false)
- {
- _error->Error("Package %s is virtual and has no installation candidate", Pkg.Name());
-
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,
- g_strdup_printf("Package %s is virtual and has no "
- "installation candidate",
- Pkg.Name()));
- return false;
- }
-
- Fix.Clear(Pkg);
- Fix.Protect(Pkg);
- if (Remove == true)
- {
- Fix.Remove(Pkg);
- Cache.MarkDelete(Pkg,_config->FindB("APT::Get::Purge", false));
- return true;
- }
-
- // Install it
- Cache.MarkInstall(Pkg,false);
- if (State.Install() == false)
- {
- if (_config->FindB("APT::Get::ReInstall",false) == true) {
- if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false) {
- // ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
- // Pkg.Name());
- ;
- } else {
- Cache.SetReInstall(Pkg,true);
- }
- } else {
- // if (AllowFail == true)
- // ioprintf(c1out,_("%s is already the newest version.\n"),
- // Pkg.Name());
- }
- } else {
- ExpectedInst++;
- }
-
-// cout << "trytoinstall ExpectedInst " << ExpectedInst << endl;
- // Install it with autoinstalling enabled (if we not respect the minial
- // required deps or the policy)
- if ((State.InstBroken() == true || State.InstPolicyBroken() == true) &&
- BrokenFix == false) {
- Cache.MarkInstall(Pkg,true);
- }
-
- return true;
-}
-
-// checks if there are Essential packages being removed
-bool aptcc::removingEssentialPackages(pkgCacheFile &Cache)
-{
- string List;
- bool *Added = new bool[Cache->Head().PackageCount];
- for (unsigned int I = 0; I != Cache->Head().PackageCount; I++){
- Added[I] = false;
- }
-
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
- if ((I->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
- (I->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important) {
- continue;
- }
-
- if (Cache[I].Delete() == true) {
- if (Added[I->ID] == false) {
- Added[I->ID] = true;
- List += string(I.Name()) + " ";
- }
- }
-
- if (I->CurrentVer == 0) {
- continue;
- }
-
- // Print out any essential package depenendents that are to be removed
- for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; D++) {
- // Skip everything but depends
- if (D->Type != pkgCache::Dep::PreDepends &&
- D->Type != pkgCache::Dep::Depends){
- continue;
- }
-
- pkgCache::PkgIterator P = D.SmartTargetPkg();
- if (Cache[P].Delete() == true)
- {
- if (Added[P->ID] == true){
- continue;
- }
- Added[P->ID] = true;
-
- char S[300];
- snprintf(S, sizeof(S), "%s (due to %s) ", P.Name(), I.Name());
- List += S;
- }
- }
- }
-
- delete [] Added;
- if (!List.empty()) {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE,
- g_strdup_printf("WARNING: You are trying to remove the "
- "following essential packages: %s",
- List.c_str()));
- return true;
- }
-
- return false;
-}
-
-// emitChangedPackages - Show packages to newly install /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-void aptcc::emitChangedPackages(pkgCacheFile &Cache)
-{
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > installing,
- removing,
- updating,
- downgrading;
-
- string VersionsList;
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg)
- {
- if (Cache[pkg].NewInstall() == true) {
- // installing
- installing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Delete() == true) {
- // removing
- removing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
- } else if (Cache[pkg].Upgrade() == true) {
- // updating
- updating.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Downgrade() == true) {
- // downgrading
- downgrading.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- }
- }
-
- // emit packages that have changes
- emit_packages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
- emit_packages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
- emit_packages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
- emit_packages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
-}
-
-void aptcc::populateInternalPackages(pkgCacheFile &Cache)
-{
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
- if (Cache[pkg].NewInstall() == true) {
- // installing
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Delete() == true) {
- // removing
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
- } else if (Cache[pkg].Upgrade() == true) {
- // updating
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Downgrade() == true) {
- // downgrading
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- }
- }
-}
-
-void aptcc::emitTransactionPackage(string name, PkInfoEnum state)
-{
- for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=m_pkgs.begin();
- i != m_pkgs.end();
- ++i)
- {
- if (i->first.Name() == name) {
- emit_package(i->first, i->second, PK_FILTER_ENUM_NONE, state);
- return;
- }
- }
-
- pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
- pkg_ver.first = packageCache->FindPkg(name);
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (pkg_ver.first.end() == true ||
- (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
- {
- return;
- }
-
- pkg_ver.second = find_ver(pkg_ver.first);
- // check to see if the provided package isn't virtual too
- if (pkg_ver.second.end() == false)
- {
- emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
- }
-
- pkg_ver.second = find_candidate_ver(pkg_ver.first);
- // check to see if we found the package
- if (pkg_ver.second.end() == false)
- {
- emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
- }
-}
-
-void aptcc::updateInterface(int fd, int writeFd)
-{
- char buf[2];
- static char line[1024] = "";
-
- while (1) {
- // This algorithm should be improved (it's the same as the rpm one ;)
- int len = read(fd, buf, 1);
-
- // nothing was read
- if(len < 1) {
- break;
- }
-
- // update the time we last saw some action
- m_lastTermAction = time(NULL);
-
- if( buf[0] == '\n') {
- if (_cancel) {
- kill(m_child_pid, SIGTERM);
- }
- //cout << "got line: " << line << endl;
-
- gchar **split = g_strsplit(line, ":",5);
- gchar *status = g_strstrip(split[0]);
- gchar *pkg = g_strstrip(split[1]);
- gchar *percent = g_strstrip(split[2]);
- gchar *str = g_strdup(g_strstrip(split[3]));
-
- // major problem here, we got unexpected input. should _never_ happen
- if(!(pkg && status)) {
- continue;
- }
-
- // first check for errors and conf-file prompts
- if (strstr(status, "pmerror") != NULL) {
- // error from dpkg
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL,
- str);
- } else if (strstr(status, "pmconffile") != NULL) {
- // conffile-request from dpkg, needs to be parsed different
- int i=0;
- int count=0;
- string orig_file, new_file;
-
- // go to first ' and read until the end
- for(;str[i] != '\'' || str[i] == 0; i++)
- /*nothing*/
- ;
- i++;
- for(;str[i] != '\'' || str[i] == 0; i++)
- orig_file.append(1, str[i]);
- i++;
-
- // same for second ' and read until the end
- for(;str[i] != '\'' || str[i] == 0; i++)
- /*nothing*/
- ;
- i++;
- for(;str[i] != '\'' || str[i] == 0; i++)
- new_file.append(1, str[i]);
- i++;
-
- gchar *filename;
- filename = g_build_filename(DATADIR, "PackageKit", "helpers", "aptcc", "pkconffile", NULL);
- gchar **argv;
- gchar **envp;
- GError *error = NULL;
- argv = (gchar **) g_malloc(5 * sizeof(gchar *));
- argv[0] = filename;
- argv[1] = g_strdup(m_lastPackage.c_str());
- argv[2] = g_strdup(orig_file.c_str());
- argv[3] = g_strdup(new_file.c_str());
- argv[4] = NULL;
-
- gchar *socket;
- if (socket = pk_backend_get_frontend_socket(m_backend)) {
- envp = (gchar **) g_malloc(3 * sizeof(gchar *));
- envp[0] = g_strdup("DEBIAN_FRONTEND=passthrough");
- envp[1] = g_strdup_printf("DEBCONF_PIPE=%s", socket);
- envp[2] = NULL;
- } else {
- // we don't have a socket set, let's fallback to noninteractive
- envp = (gchar **) g_malloc(2 * sizeof(gchar *));
- envp[0] = g_strdup("DEBIAN_FRONTEND=noninteractive");
- envp[1] = NULL;
- }
-
- gboolean ret;
- gint exitStatus;
- ret = g_spawn_sync(NULL, // working dir
- argv, // argv
- envp, // envp
- G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
- NULL, // child_setup
- NULL, // user_data
- NULL, // standard_output
- NULL, // standard_error
- &exitStatus,
- &error);
-
- int exit_code = WEXITSTATUS(exitStatus);
- cout << filename << " " << exit_code << " ret: "<< ret << endl;
-
- if (exit_code == 10) {
- // 1 means the user wants the package config
- if (write(writeFd, "Y\n", 2) != 2) {
- // TODO we need a DPKG patch to use debconf
- g_debug("Failed to write");
- }
- } else if (exit_code == 20) {
- // 2 means the user wants to keep the current config
- if (write(writeFd, "N\n", 2) != 2) {
- // TODO we need a DPKG patch to use debconf
- g_debug("Failed to write");
- }
- } else {
- // either the user didn't choose an option or the front end failed'
- gchar *confmsg;
- confmsg = g_strdup_printf("The configuration file '%s' "
- "(modified by you or a script) "
- "has a newer version '%s'.\n"
- "Please verify your changes and update it manually.",
- orig_file.c_str(),
- new_file.c_str());
- pk_backend_message(m_backend,
- PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED,
- confmsg);
- // fall back to keep the current config file
- if (write(writeFd, "N\n", 2) != 2) {
- // TODO we need a DPKG patch to use debconf
- g_debug("Failed to write");
- }
- }
- } else if (strstr(status, "pmstatus") != NULL) {
- // INSTALL & UPDATE
- // - Running dpkg
- // loops ALL
- // - 0 Installing pkg (sometimes this is skiped)
- // - 25 Preparing pkg
- // - 50 Unpacking pkg
- // - 75 Preparing to configure pkg
- // ** Some pkgs have
- // - Running post-installation
- // - Running dpkg
- // reloops all
- // - 0 Configuring pkg
- // - +25 Configuring pkg (SOMETIMES)
- // - 100 Installed pkg
- // after all
- // - Running post-installation
-
- // REMOVE
- // - Running dpkg
- // loops
- // - 25 Removing pkg
- // - 50 Preparing for removal of pkg
- // - 75 Removing pkg
- // - 100 Removed pkg
- // after all
- // - Running post-installation
-
- // Let's start parsing the status:
- if (starts_with(str, "Preparing to configure")) {
- // Preparing to Install/configure
-// cout << "Found Preparing to configure! " << line << endl;
- // The next item might be Configuring so better it be 100
- m_lastSubProgress = 100;
- emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
- pk_backend_set_sub_percentage(m_backend, 75);
- } else if (starts_with(str, "Preparing for removal")) {
- // Preparing to Install/configure
-// cout << "Found Preparing for removal! " << line << endl;
- m_lastSubProgress = 50;
- emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
- pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
- } else if (starts_with(str, "Preparing")) {
- // Preparing to Install/configure
-// cout << "Found Preparing! " << line << endl;
- // if last package is different then finish it
- if (!m_lastPackage.empty() && m_lastPackage.compare(pkg) != 0) {
-// cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- }
- emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
- pk_backend_set_sub_percentage(m_backend, 25);
- } else if (starts_with(str, "Unpacking")) {
-// cout << "Found Unpacking! " << line << endl;
- emitTransactionPackage(pkg, PK_INFO_ENUM_DECOMPRESSING);
- pk_backend_set_sub_percentage(m_backend, 50);
- } else if (starts_with(str, "Configuring")) {
- // Installing Package
-// cout << "Found Configuring! " << line << endl;
- if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
- cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- m_lastSubProgress = 0;
- }
- emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
- pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
- m_lastSubProgress += 25;
- } else if (starts_with(str, "Running dpkg")) {
-// cout << "Found Running dpkg! " << line << endl;
- } else if (starts_with(str, "Running")) {
-// cout << "Found Running! " << line << endl;
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_COMMIT);
- } else if (starts_with(str, "Installing")) {
-// cout << "Found Installing! " << line << endl;
- // FINISH the last package
- if (!m_lastPackage.empty()) {
-// cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- }
- m_lastSubProgress = 0;
- emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
- pk_backend_set_sub_percentage(m_backend, 0);
- } else if (starts_with(str, "Removing")) {
-// cout << "Found Removing! " << line << endl;
- if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
-// cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- }
- m_lastSubProgress += 25;
- emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
- pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
- } else if (starts_with(str, "Installed") ||
- starts_with(str, "Removed")) {
-// cout << "Found FINISHED! " << line << endl;
- m_lastSubProgress = 100;
- emitTransactionPackage(pkg, PK_INFO_ENUM_FINISHED);
- } else {
- cout << ">>>Unmaped value<<< :" << line << endl;
- }
-
- if (!starts_with(str, "Running")) {
- m_lastPackage = pkg;
- }
- m_startCounting = true;
- } else {
- m_startCounting = true;
- }
-
- int val = atoi(percent);
- //cout << "progress: " << val << endl;
- pk_backend_set_percentage(m_backend, val);
-
- // clean-up
- g_strfreev(split);
- g_free(str);
- line[0] = 0;
- } else {
- buf[1] = 0;
- strcat(line, buf);
- }
- }
-
- time_t now = time(NULL);
-
- if(!m_startCounting) {
- usleep(100000);
- // wait until we get the first message from apt
- m_lastTermAction = now;
- }
-
- if ((now - m_lastTermAction) > m_terminalTimeout) {
- // get some debug info
- g_warning("no statusfd changes/content updates in terminal for %i"
- " seconds",m_terminalTimeout);
- m_lastTermAction = time(NULL);
- }
-
- // sleep for a while to don't obcess over it
- usleep(5000);
-}
-
-// DoAutomaticRemove - Remove all automatic unused packages /*{{{*/
-// ---------------------------------------------------------------------
-/* Remove unused automatic packages */
-bool aptcc::DoAutomaticRemove(pkgCacheFile &Cache)
-{
- bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
- pkgDepCache::ActionGroup group(*Cache);
-
- if (_config->FindB("APT::Get::Remove",true) == false &&
- doAutoRemove == true)
- {
- cout << "We are not supposed to delete stuff, can't start "
- "AutoRemover" << endl;
- doAutoRemove = false;
- }
-
- // look over the cache to see what can be removed
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
- {
- if (Cache[Pkg].Garbage && doAutoRemove)
- {
- if (Pkg.CurrentVer() != 0 &&
- Pkg->CurrentState != pkgCache::State::ConfigFiles) {
- Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
- } else {
- Cache->MarkKeep(Pkg, false, false);
- }
- }
- }
-
- // Now see if we destroyed anything
- if (Cache->BrokenCount() != 0)
- {
- cout << "Hmm, seems like the AutoRemover destroyed something which really\n"
- "shouldn't happen. Please file a bug report against apt." << endl;
- // TODO call show_broken
- // ShowBroken(c1out,Cache,false);
- return _error->Error("Internal Error, AutoRemover broke stuff");
- }
- return true;
-}
-
-PkgList aptcc::resolvePI(gchar **package_ids)
-{
- gchar *pi;
- PkgList ret;
-
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_QUERY);
-
- // Don't fail if package list is empty
- if (package_ids == NULL)
- return ret;
-
- for (uint i = 0; i < g_strv_length(package_ids); i++) {
- if (_cancel) {
- break;
- }
-
- PkgPair pair;
- pi = package_ids[i];
-
- if (pk_package_id_check(pi) == false) {
- pair.first = packageCache->FindPkg(pi);
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (pair.first.end() == true ||
- (pair.first.VersionList().end() && pair.first.ProvidesList().end())) {
- continue;
- }
-
- pair.second = find_ver(pair.first);
- // check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
- }
-
- pair.second = find_candidate_ver(pair.first);
- // check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
- }
- } else {
- bool found;
- pair = find_package_id(pi, found);
- // check to see if we found the package
- if (found) {
- ret.push_back(pair);
- }
- }
- }
- return ret;
-}
-
-bool aptcc::markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
-{
- // We call gdebi to tell us what do we need to install/remove
- // in order to be able to install this package
- gint status;
- gchar **argv;
- gchar **envp;
- gchar *std_out;
- gchar *std_err;
- GError *gerror = NULL;
- argv = (gchar **) g_malloc(5 * sizeof(gchar *));
- argv[0] = g_strdup("/usr/bin/gdebi");
- argv[1] = g_strdup("-q");
- argv[2] = g_strdup("--apt-line");
- argv[3] = g_strdup(file);
- argv[4] = NULL;
-
- gboolean ret;
- ret = g_spawn_sync(NULL, // working dir
- argv, // argv
- envp, // envp
- G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
- NULL, // child_setup
- NULL, // user_data
- &std_out, // standard_output
- &std_err, // standard_error
- &status,
- &gerror);
- int exit_code = WEXITSTATUS(status);
-// cout << "DebStatus " << exit_code << " WEXITSTATUS " << WEXITSTATUS(status) << " ret: "<< ret << endl;
- cout << "std_out " << strlen(std_out) << std_out << endl;
- cout << "std_err " << strlen(std_err) << std_err << endl;
-
- PkgList pkgs;
- if (exit_code == 1) {
- if (strlen(std_out) == 0) {
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_err);
- } else {
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_out);
- }
- return false;
- } else {
- // GDebi outputs two lines
- gchar **lines = g_strsplit(std_out, "\n", 3);
-
- // The first line contains the packages to install
- gchar **installPkgs = g_strsplit(lines[0], " ", 0);
-
- // The second line contains the packages to remove with '-' appended to
- // the end of the package name
- gchar **removePkgs = NULL;
- if (strlen(lines[1]) > 0) {
- gchar *removeStr = g_strndup(lines[1], strlen(lines[1]) - 1);
- removePkgs = g_strsplit(removeStr, "- ", 0);
- g_free(removeStr);
- }
-
- // Store the changes
- install = resolvePI(installPkgs);
- remove = resolvePI(removePkgs);
- m_localDebFile = file;
-
- g_strfreev(lines);
- g_strfreev(installPkgs);
- g_strfreev(removePkgs);
- }
-
- return true;
-}
-
-bool aptcc::runTransaction(PkgList &install, PkgList &remove, bool simulate)
-{
- //cout << "runTransaction" << simulate << remove << endl;
- bool WithLock = !simulate; // Check to see if we are just simulating,
- //since for that no lock is needed
-
- pkgCacheFile Cache;
- OpTextProgress Prog(*_config);
- int timeout = 10;
- // TODO test this
- while (Cache.Open(&Prog, WithLock) == false) {
- // failed to open cache, try checkDeps then..
- // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
- if (WithLock == false || (timeout <= 0)) {
- show_errors(m_backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
- return false;
- } else {
- _error->Discard();
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
- sleep(1);
- timeout--;
- }
- }
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
-
- // Enter the special broken fixing mode if the user specified arguments
- bool BrokenFix = false;
- if (Cache->BrokenCount() != 0) {
- BrokenFix = true;
- }
-
- unsigned int ExpectedInst = 0;
- pkgProblemResolver Fix(Cache);
-
- // new scope for the ActionGroup
- {
- pkgDepCache::ActionGroup group(Cache);
- for(PkgList::iterator i = install.begin(); i != install.end(); ++i) {
- pkgCache::PkgIterator Pkg = i->first;
- if (_cancel) {
- break;
- }
-
- if (TryToInstall(Pkg,
- Cache,
- Fix,
- false, // remove
- BrokenFix,
- ExpectedInst) == false) {
- return false;
- }
- }
-
- for(PkgList::iterator i = remove.begin(); i != remove.end(); ++i) {
- pkgCache::PkgIterator Pkg = i->first;
- if (_cancel) {
- break;
- }
-
- if (TryToInstall(Pkg,
- Cache,
- Fix,
- true, // remove
- BrokenFix,
- ExpectedInst) == false) {
- return false;
- }
- }
-
- // Call the scored problem resolver
- Fix.InstallProtect();
- if (Fix.Resolve(true) == false) {
- _error->Discard();
- }
-
- // Now we check the state of the packages,
- if (Cache->BrokenCount() != 0)
- {
- // if the problem resolver could not fix all broken things
- // show what is broken
- show_broken(m_backend, Cache, false);
- return false;
- }
- }
- // Try to auto-remove packages
- if (!DoAutomaticRemove(Cache)) {
- // TODO
- return false;
- }
-
- // check for essential packages!!!
- if (removingEssentialPackages(Cache)) {
- return false;
- }
-
- if (simulate) {
- // Print out a list of packages that are going to be installed extra
- emitChangedPackages(Cache);
- return true;
- } else {
- // Store the packages that are going to change
- // so we can emit them as we process it.
- populateInternalPackages(Cache);
- return installPackages(Cache);
- }
-}
-
- /*}}}*/
-
-// InstallPackages - Actually download and install the packages /*{{{*/
-// ---------------------------------------------------------------------
-/* This displays the informative messages describing what is going to
- happen and then calls the download routines */
-bool aptcc::installPackages(pkgCacheFile &Cache)
-{
- //cout << "installPackages() called" << endl;
- if (_config->FindB("APT::Get::Purge",false) == true)
- {
- pkgCache::PkgIterator I = Cache->PkgBegin();
- for (; I.end() == false; I++)
- {
- if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete) {
- Cache->MarkDelete(I,true);
- }
- }
- }
-
- // check for essential packages!!!
- if (removingEssentialPackages(Cache)) {
- return false;
- }
-
- // Sanity check
- if (Cache->BrokenCount() != 0)
- {
- // TODO
- show_broken(m_backend, Cache, false);
- _error->Error("Internal error, InstallPackages was called with broken packages!");
- return false;
- }
-
- if (Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
- Cache->BadCount() == 0) {
- return true;
- }
-
- // No remove flag
- if (Cache->DelCount() != 0 && _config->FindB("APT::Get::Remove", true) == false) {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE,
- "Packages need to be removed but remove is disabled.");
- return false;
- }
-
- // Create the text record parser
- pkgRecords Recs(Cache);
- if (_error->PendingError() == true) {
- return false;
- }
-
- // Lock the archive directory
- FileFd Lock;
- if (_config->FindB("Debug::NoLocking", false) == false)
- {
- Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
- if (_error->PendingError() == true) {
- return _error->Error("Unable to lock the download directory");
- }
- }
-
- // Create the download object
- AcqPackageKitStatus Stat(this, m_backend, _cancel);
-
- // get a fetcher
- pkgAcquire fetcher;
- fetcher.Setup(&Stat);
-
- // Create the package manager and prepare to download
-// SPtr<pkgPackageManager> PM= _system->CreatePM(Cache);
- SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
- if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
- _error->PendingError() == true) {
- return false;
- }
-
- // Generate the list of affected packages and sort it
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; I++)
- {
- // Ignore no-version packages
- if (I->VersionList == 0) {
- continue;
- }
-
- // Not interesting
- if ((Cache[I].Keep() == true ||
- Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
- I.State() == pkgCache::PkgIterator::NeedsNothing &&
- (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
- (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
- (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
- {
- continue;
- }
-
- // Append it to the list
- Stat.addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(I, Cache[I].InstVerIter(Cache)));
- }
-
- // Display statistics
- double FetchBytes = fetcher.FetchNeeded();
- double FetchPBytes = fetcher.PartialPresent();
- double DebBytes = fetcher.TotalNeeded();
- if (DebBytes != Cache->DebSize())
- {
- cout << DebBytes << ',' << Cache->DebSize() << endl;
-cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
-/* _error->Warning("How odd.. The sizes didn't match, email apt at packages.debian.org");*/
- }
-
- // Number of bytes
-// if (DebBytes != FetchBytes)
-// ioprintf(c1out, "Need to get %sB/%sB of archives.\n",
-// SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
-// else if (DebBytes != 0)
-// ioprintf(c1out, "Need to get %sB of archives.\n",
-// SizeToStr(DebBytes).c_str());
-
- // Size delta
-// if (Cache->UsrSize() >= 0)
-// ioprintf(c1out, "After this operation, %sB of additional disk space will be used.\n",
-// SizeToStr(Cache->UsrSize()).c_str());
-// else
-// ioprintf(c1out, "After this operation, %sB disk space will be freed.\n",
-// SizeToStr(-1*Cache->UsrSize()).c_str());
-
- if (_error->PendingError() == true) {
- cout << "PendingError " << endl;
- return false;
- }
-
- /* Check for enough free space */
- struct statvfs Buf;
- string OutputDir = _config->FindDir("Dir::Cache::Archives");
- if (statvfs(OutputDir.c_str(),&Buf) != 0) {
- return _error->Errno("statvfs",
- "Couldn't determine free space in %s",
- OutputDir.c_str());
- }
- if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
- {
- struct statfs Stat;
- if (statfs(OutputDir.c_str(), &Stat) != 0 ||
- unsigned(Stat.f_type) != RAMFS_MAGIC)
- {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_NO_SPACE_ON_DEVICE,
- string("You don't have enough free space in ").append(OutputDir).c_str());
- return _error->Error("You don't have enough free space in %s.",
- OutputDir.c_str());
- }
- }
-
- if (!checkTrusted(fetcher, m_backend)) {
- return false;
- }
-
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
- pk_backend_set_simultaneous_mode(m_backend, true);
- // Download and check if we can continue
- if (fetcher.Run() != pkgAcquire::Continue
- && _cancel == false)
- {
- // We failed and we did not cancel
- show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
- return false;
- }
- pk_backend_set_simultaneous_mode(m_backend, false);
-
- if (_error->PendingError() == true) {
- cout << "PendingError download" << endl;
- return false;
- }
-
- // Right now it's not safe to cancel
- pk_backend_set_allow_cancel (m_backend, false);
-
- // TODO true or false?
- if (_cancel) {
- return true;
- }
-
- // Download should be finished by now, changing it's status
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
- pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
-
- // TODO DBus activated does not have all vars
- // we could try to see if this is the case
- setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
- _system->UnLock();
-
- if (!m_localDebFile.empty()) {
- // add the local file name to be proccessed by the PM queue
- pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
- pm->addDebFile(m_localDebFile);
- }
-
- pkgPackageManager::OrderResult res;
- res = PM->DoInstallPreFork();
- if (res == pkgPackageManager::Failed) {
- g_warning ("Failed to prepare installation");
- show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
- return false;
- }
-
- // File descriptors for reading dpkg --status-fd
- int readFromChildFD[2];
- if (pipe(readFromChildFD) < 0) {
- cout << "Failed to create a pipe" << endl;
- return false;
- }
-
- int pty_master;
- m_child_pid = forkpty(&pty_master, NULL, NULL, NULL);
- if (m_child_pid == -1) {
- return false;
- }
-
- if (m_child_pid == 0) {
- //cout << "FORKED: installPackages(): DoInstall" << endl;
-
- // close pipe we don't need
- close(readFromChildFD[0]);
-
- // Change the locale to not get libapt localization
- setlocale(LC_ALL, "C");
-
- // Debconf handlying
- gchar *socket;
- if (socket = pk_backend_get_frontend_socket(m_backend)) {
- setenv("DEBIAN_FRONTEND", "passthrough", 1);
- setenv("DEBCONF_PIPE", socket, 1);
- } else {
- // we don't have a socket set, let's fallback to noninteractive
- setenv("DEBIAN_FRONTEND", "noninteractive", 1);
- }
-
- gchar *locale;
- // Set the LANGUAGE so debconf messages get localization
- if (locale = pk_backend_get_locale(m_backend)) {
- setenv("LANGUAGE", locale, 1);
- setenv("LANG", locale, 1);
- //setenv("LANG", "C", 1);
- }
-
- // Pass the write end of the pipe to the install function
- res = PM->DoInstallPostFork(readFromChildFD[1]);
-
- // dump errors into cerr (pass it to the parent process)
- _error->DumpErrors();
-
- close(readFromChildFD[1]);
-
- _exit(res);
- }
-
- cout << "PARENT proccess running..." << endl;
- // make it nonblocking, verry important otherwise
- // when the child finish we stay stuck.
- fcntl(readFromChildFD[0], F_SETFL, O_NONBLOCK);
- fcntl(pty_master, F_SETFL, O_NONBLOCK);
-
- // init the timer
- m_lastTermAction = time(NULL);
- m_startCounting = false;
-
- // Check if the child died
- int ret;
- char masterbuf[1024];
- while (waitpid(m_child_pid, &ret, WNOHANG) == 0) {
- // TODO: This is dpkg's raw output. Maybe save it for error-solving?
- while(read(pty_master, masterbuf, sizeof(masterbuf)) > 0);
- updateInterface(readFromChildFD[0], pty_master);
- }
-
- close(readFromChildFD[0]);
- close(readFromChildFD[1]);
- close(pty_master);
-
- cout << "Parent finished..." << endl;
- return true;
-}
-
diff --git a/backends/aptcc/apt.h b/backends/aptcc/apt.h
deleted file mode 100644
index 53edd75..0000000
--- a/backends/aptcc/apt.h
+++ /dev/null
@@ -1,182 +0,0 @@
-// apt.h -*-c++-*-
-//
-// Copyright 1999-2002, 2004-2005, 2007-2008 Daniel Burrows
-// Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-//
-
-#ifndef APT_H
-#define APT_H
-
-#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/pkgcachegen.h>
-#include <apt-pkg/cachefile.h>
-#include <apt-pkg/policy.h>
-
-#include <pk-backend.h>
-
-#include <set>
-
-using namespace std;
-
-/**
-* returns a list of packages names
-*/
-vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel);
-
-/**
-* returns a list of packages names
-*/
-vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel);
-
-typedef pair<pkgCache::PkgIterator, pkgCache::VerIterator> PkgPair;
-typedef vector<PkgPair> PkgList;
-
-class pkgProblemResolver;
-class aptcc
-{
-// typedef int user_tag_reference;
-public:
- aptcc(PkBackend *backend, bool &cancel);
- ~aptcc();
-
- bool init();
- void cancel();
-
- // Check the returned VerIterator.end()
- // if it's true we could not find it
- pair<pkgCache::PkgIterator, pkgCache::VerIterator>
- find_package_id(const gchar *package_id, bool &found);
- pkgCache::VerIterator find_ver(const pkgCache::PkgIterator &pkg);
- pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
-
- PkgList resolvePI(gchar **package_ids);
- bool markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
-
- /**
- * runs a transaction to install/remove/update packages
- * - for install and update, \p remove should be set to false
- * - if you are going to remove, \p remove should be true
- * - if you don't want to actually install/update/remove
- * \p simulate should be true, in this case packages with
- * what's going to happen will be emitted.
- */
- bool runTransaction(PkgList &install, PkgList &remove, bool simulate);
-
- /**
- * Get depends
- */
- void get_depends(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive);
-
- /**
- * Get requires
- */
- void get_requires(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive);
-
- /**
- * Emits a package if it match the filters
- */
- void emit_package(const pkgCache::PkgIterator &pkg,
- const pkgCache::VerIterator &ver,
- PkBitfield filters = PK_FILTER_ENUM_NONE,
- PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
-
- void emit_packages(PkgList &output,
- PkBitfield filters = PK_FILTER_ENUM_NONE,
- PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
-
- void emitUpdates(PkgList &output, PkBitfield filters = PK_FILTER_ENUM_NONE);
-
- /**
- * Emits details
- */
- void emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
- void emitDetails(PkgList &pkgs);
-
- /**
- * Emits update detail
- */
- void emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
- void emitUpdateDetails(PkgList &pkgs);
-
- /**
- * Emits files of packages
- */
- void emitFiles(PkBackend *backend, const gchar *pi);
-
- /**
- * seems to install packages
- */
- bool installPackages(pkgCacheFile &Cache);
-
- /**
- * check which package provides the codec
- */
- void providesCodec(PkgList &output, gchar **values);
-
- /**
- * check which package provides a shared library
- */
- void providesLibrary(PkgList &output, gchar **values);
-
- pkgRecords *packageRecords;
- pkgCache *packageCache;
- pkgDepCache *packageDepCache;
- pkgSourceList *packageSourceList;
-
-private:
- MMap *Map;
- OpProgress Progress;
- pkgPolicy *Policy;
- PkBackend *m_backend;
- bool &_cancel;
-
- bool TryToInstall(pkgCache::PkgIterator Pkg,
- pkgDepCache &Cache,
- pkgProblemResolver &Fix,
- bool Remove,
- bool BrokenFix,
- unsigned int &ExpectedInst);
-
- /**
- * interprets dpkg status fd
- */
- void updateInterface(int readFd, int writeFd);
- bool DoAutomaticRemove(pkgCacheFile &Cache);
- void emitChangedPackages(pkgCacheFile &Cache);
- bool removingEssentialPackages(pkgCacheFile &Cache);
-
- bool m_isMultiArch;
- PkgList m_pkgs;
- string m_localDebFile;
- void populateInternalPackages(pkgCacheFile &Cache);
- void emitTransactionPackage(string name, PkInfoEnum state);
- time_t m_lastTermAction;
- string m_lastPackage;
- uint m_lastSubProgress;
- PkInfoEnum m_state;
- bool m_startCounting;
- // when the internal terminal timesout after no activity
- int m_terminalTimeout;
- pid_t m_child_pid;
-};
-
-#endif
diff --git a/backends/aptcc/aptcc_show_broken.cpp b/backends/aptcc/aptcc_show_broken.cpp
deleted file mode 100644
index 8001136..0000000
--- a/backends/aptcc/aptcc_show_broken.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-// aptcc_show_broken.cc
-//
-// Copyright 2004 Daniel Burrows
-// Copyright 2009-2010 Daniel Nicoletti
-
-#include "aptcc_show_broken.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include <sstream>
-
-using namespace std;
-
-/** Shows broken dependencies for a single package */
-void show_broken(PkBackend *backend, pkgCacheFile &Cache, bool Now)
-{
- stringstream out;
-
- out << "The following packages have unmet dependencies:" << endl;
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
- if (Now == true) {
- if (Cache[I].NowBroken() == false) {
- continue;
- }
- } else {
- if (Cache[I].InstBroken() == false){
- continue;
- }
- }
-
- // Print out each package and the failed dependencies
- out << " " << I.Name() << ":";
- unsigned Indent = strlen(I.Name()) + 3;
- bool First = true;
- pkgCache::VerIterator Ver;
-
- if (Now == true) {
- Ver = I.CurrentVer();
- } else {
- Ver = Cache[I].InstVerIter(Cache);
- }
-
- if (Ver.end() == true) {
- out << endl;
- continue;
- }
-
- for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;) {
- // Compute a single dependency element (glob or)
- pkgCache::DepIterator Start;
- pkgCache::DepIterator End;
- D.GlobOr(Start,End); // advances D
-
- if (Cache->IsImportantDep(End) == false){
- continue;
- }
-
- if (Now == true) {
- if ((Cache[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow){
- continue;
- }
- } else {
- if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) {
- continue;
- }
- }
-
- bool FirstOr = true;
- while (1) {
- if (First == false){
- for (unsigned J = 0; J != Indent; J++) {
- out << ' ';
- }
- }
- First = false;
-
- if (FirstOr == false) {
- for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++) {
- out << ' ';
- }
- } else {
- out << ' ' << End.DepType() << ": ";
- }
- FirstOr = false;
-
- out << Start.TargetPkg().Name();
-
- // Show a quick summary of the version requirements
- if (Start.TargetVer() != 0) {
- out << " (" << Start.CompType() << " " << Start.TargetVer() << ")";
- }
-
- /* Show a summary of the target package if possible. In the case
- of virtual packages we show nothing */
- pkgCache::PkgIterator Targ = Start.TargetPkg();
- if (Targ->ProvidesList == 0) {
- out << ' ';
- pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
- if (Now == true) {
- Ver = Targ.CurrentVer();
- }
-
- if (Ver.end() == false)
- {
- char buffer[1024];
- if (Now == true) {
- sprintf(buffer, "but %s is installed", Ver.VerStr());
- } else {
- sprintf(buffer, "but %s is to be installed", Ver.VerStr());
- }
-
- out << buffer;
- } else {
- if (Cache[Targ].CandidateVerIter(Cache).end() == true) {
- if (Targ->ProvidesList == 0) {
- out << "but it is not installable";
- } else {
- out << "but it is a virtual package";
- }
- } else {
- if (Now) {
- out << "but it is not installed";
- } else {
- out << "but it is not going to be installed";
- }
- }
- }
- }
-
- if (Start != End) {
- out << " or";
- }
- out << endl;
-
- if (Start == End){
- break;
- }
- Start++;
- }
- }
- }
- pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, out.str().c_str());
-}
diff --git a/backends/aptcc/aptcc_show_broken.h b/backends/aptcc/aptcc_show_broken.h
deleted file mode 100644
index 7aa5adf..0000000
--- a/backends/aptcc/aptcc_show_broken.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// aptcc_show_broken.h -*-c++-*-
-//
-// Copyright 2004 Daniel Burrows
-// Copyright 2009-2010 Daniel Nicoletti
-
-#ifndef APTCC_SHOW_BROKEN_H
-#define APTCC_SHOW_BROKEN_H
-
-#include <pk-backend.h>
-
-#include <apt-pkg/cachefile.h>
-
-/** \file aptcc_show_broken.h
- */
-
-/** Shows a list of all broken packages together with their
- * dependencies. Similar to and based on the equivalent routine in
- * apt-get.
- */
-void show_broken(PkBackend *backend, pkgCacheFile &cache, bool Now);
-
-#endif // APTCC_SHOW_BROKEN
diff --git a/backends/aptcc/aptcc_show_error.cpp b/backends/aptcc/aptcc_show_error.cpp
deleted file mode 100644
index e9117da..0000000
--- a/backends/aptcc/aptcc_show_error.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// aptcc_show_broken.cc
-//
-// Copyright 2004 Daniel Burrows
-// Copyright 2009 Daniel Nicoletti
-
-#include "aptcc_show_error.h"
-
-#include <string>
-#include <sstream>
-
-using namespace std;
-
-bool show_errors(PkBackend *backend, PkErrorEnum errorCode)
-{
- stringstream errors;
-
- string Err;
- while (_error->empty() == false)
- {
- bool Type = _error->PopMessage(Err);
- if (Type == true) {
- errors << "E: " << Err << endl;
- } else {
- errors << "W: " << Err << endl;
- }
- }
-
- if (!errors.str().empty())
- {
- pk_backend_error_code(backend, errorCode, errors.str().c_str());
- }
-}
-
-bool show_warnings(PkBackend *backend, PkMessageEnum message)
-{
- stringstream warnings;
-
- string Err;
- while (_error->empty() == false)
- {
- bool Type = _error->PopMessage(Err);
- if (Type == true) {
- warnings << "E: " << Err << endl;
- } else {
- warnings << "W: " << Err << endl;
- }
- }
-
- if (!warnings.str().empty())
- {
- pk_backend_message(backend, message, warnings.str().c_str());
- }
-}
diff --git a/backends/aptcc/aptcc_show_error.h b/backends/aptcc/aptcc_show_error.h
deleted file mode 100644
index 09817b8..0000000
--- a/backends/aptcc/aptcc_show_error.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// aptcc_show_broken.h -*-c++-*-
-//
-// Copyright 2004 Daniel Burrows
-// Copyright 2009 Daniel Nicoletti
-
-#ifndef APTCC_SHOW_ERROR_H
-#define APTCC_SHOW_ERROR_H
-
-#include <pk-backend.h>
-#include <apt-pkg/error.h>
-
-/** \file aptcc_show_error.h
- */
-
-/**
- * Call the Packagekit error dialog
- */
-bool show_errors(PkBackend *backend,
- PkErrorEnum errorCode = PK_ERROR_ENUM_UNKNOWN);
-
-/**
- * Call the Packagekit message dialog
- */
-bool show_warnings(PkBackend *backend,
- PkMessageEnum message = PK_MESSAGE_ENUM_UNKNOWN);
-#endif // APTCC_SHOW_ERROR
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 1815a12..3a95816 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -25,14 +25,13 @@
#include <apt-pkg/algorithms.h>
#include <apt-pkg/aptconfiguration.h>
-#include "apt.h"
+#include "apt-intf.h"
#include "apt-utils.h"
#include "matcher.h"
-#include "aptcc_show_broken.h"
+#include "apt-messages.h"
#include "acqprogress.h"
-#include "aptcc_show_error.h"
#include "pkg_acqfile.h"
-#include "rsources.h"
+#include "apt-sourceslist.h"
#include <config.h>
#include <pk-backend.h>
@@ -161,7 +160,7 @@ pk_backend_get_mime_types (PkBackend *backend)
void
pk_backend_cancel (PkBackend *backend)
{
- aptcc *m_apt = (aptcc*) pk_backend_get_pointer(backend, "aptcc_obj");
+ AptIntf *m_apt = (AptIntf*) pk_backend_get_pointer(backend, "aptcc_obj");
if (m_apt) {
m_apt->cancel();
}
@@ -181,7 +180,7 @@ backend_get_depends_or_requires_thread (PkBackend *backend)
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -278,7 +277,7 @@ backend_get_files_thread (PkBackend *backend)
return false;
}
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -340,7 +339,7 @@ backend_get_details_thread (PkBackend *backend)
return false;
}
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -394,7 +393,7 @@ backend_get_or_update_system_thread (PkBackend *backend)
getUpdates = pk_backend_get_bool(backend, "getUpdates");
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -503,7 +502,7 @@ backend_what_provides_thread (PkBackend *backend)
provides == PK_PROVIDES_ENUM_MIMETYPE ||
provides == PK_PROVIDES_ENUM_CODEC ||
provides == PK_PROVIDES_ENUM_ANY) {
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -601,7 +600,7 @@ pk_backend_download_packages_thread (PkBackend *backend)
directory = _config->FindDir("Dir::Cache::archives") + "partial/";
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -721,7 +720,7 @@ pk_backend_refresh_cache_thread (PkBackend *backend)
{
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -788,7 +787,7 @@ pk_backend_resolve_thread (PkBackend *backend)
package_ids = pk_backend_get_strv (backend, "package_ids");
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -827,7 +826,7 @@ pk_backend_search_files_thread (PkBackend *backend)
// as we can only search for installed files lets avoid the opposite
if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -899,7 +898,7 @@ backend_search_groups_thread (PkBackend *backend)
}
}
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -979,7 +978,7 @@ backend_search_package_thread (PkBackend *backend)
return false;
}
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -1122,7 +1121,7 @@ backend_manage_packages_thread (PkBackend *backend)
cout << "FILE INSTALL: " << fileInstall << endl;
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -1399,7 +1398,7 @@ backend_get_packages_thread (PkBackend *backend)
filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
diff --git a/backends/aptcc/pkg_acqfile.cpp b/backends/aptcc/pkg_acqfile.cpp
index 872816b..d20cff1 100644
--- a/backends/aptcc/pkg_acqfile.cpp
+++ b/backends/aptcc/pkg_acqfile.cpp
@@ -1,22 +1,24 @@
-// pkg_acqfile.cc
-//
-// Copyright 2002, 2005 Daniel Burrows
-// Copyright 2009 Daniel Nicoletti
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
+/* pkg_acqfile.cpp
+ *
+ * Copyright (c) 2002, 2005 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
// (based on pkg_changelog)
diff --git a/backends/aptcc/pkg_acqfile.h b/backends/aptcc/pkg_acqfile.h
index a6638b7..337ff76 100644
--- a/backends/aptcc/pkg_acqfile.h
+++ b/backends/aptcc/pkg_acqfile.h
@@ -1,28 +1,34 @@
-// pkg_acqfile.h -*-c++-*-
-//
-// Copyright (C) 2002, 2005 Daniel Burrows
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
+/* pkg_acqfile.h
+ *
+ * Copyright (c) 2002, 2005 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef PKG_ACQFILE_H
+#define PKG_ACQFILE_H
#include <apt-pkg/acquire-item.h>
/** \file pkg_acqfile.h
*/
-class pkgAcqFileSane:public pkgAcquire::Item
+class pkgAcqFileSane : public pkgAcquire::Item
// This is frustrating: pkgAcqFile is **almost** good enough, but has some
// hardcoded stuff that makes it not quite work.
//
@@ -48,3 +54,5 @@ public:
bool get_archive(pkgAcquire *Owner, pkgSourceList *Sources,
pkgRecords *Recs, pkgCache::VerIterator const &Version,
std::string directory, std::string &StoreFilename);
+
+#endif
diff --git a/backends/aptcc/rsources.cpp b/backends/aptcc/rsources.cpp
deleted file mode 100644
index 6283ee7..0000000
--- a/backends/aptcc/rsources.cpp
+++ /dev/null
@@ -1,563 +0,0 @@
-/* rsource.cc - access the sources.list file
- *
- * Copyright (c) 1999 Patrick Cole <z at amused.net>
- * (c) 2002 Synaptic development team
- *
- * Author: Patrick Cole <z at amused.net>
- * Michael Vogt <mvo at debian.org>
- * Gustavo Niemeyer <niemeyer at conectiva.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <sys/stat.h>
-#include <dirent.h>
-
-#include "rsources.h"
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/fileutl.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/error.h>
-#include <algorithm>
-#include <fstream>
-#include "config.h"
-#include "apt.h"
-
-SourcesList::~SourcesList()
-{
- for (list<SourceRecord *>::iterator it = SourceRecords.begin();
- it != SourceRecords.end(); it++)
- delete *it;
- for (list<VendorRecord *>::iterator it = VendorRecords.begin();
- it != VendorRecords.end(); it++)
- delete *it;
-}
-
-SourcesList::SourceRecord *SourcesList::AddSourceNode(SourceRecord &rec)
-{
- SourceRecord *newrec = new SourceRecord;
- *newrec = rec;
- SourceRecords.push_back(newrec);
-
- return newrec;
-}
-
-bool SourcesList::ReadSourcePart(string listpath)
-{
- //cout << "SourcesList::ReadSourcePart() "<< listpath << endl;
- char buf[512];
- const char *p;
- ifstream ifs(listpath.c_str(), ios::in);
- bool record_ok = true;
-
- // cannot open file
- if (!ifs != 0)
- return _error->Error("Can't read %s", listpath.c_str());
-
- while (ifs.eof() == false) {
- p = buf;
- SourceRecord rec;
- string Type;
- string Section;
- string VURI;
-
- ifs.getline(buf, sizeof(buf));
-
- rec.SourceFile = listpath;
- while (isspace(*p))
- p++;
- if (*p == '#') {
- rec.Type = Disabled;
- p++;
- while (isspace(*p))
- p++;
- }
-
- if (*p == '\r' || *p == '\n' || *p == 0) {
- rec.Type = Comment;
- rec.Comment = p;
-
- AddSourceNode(rec);
- continue;
- }
-
- bool Failed = true;
- if (ParseQuoteWord(p, Type) == true &&
- rec.SetType(Type) == true && ParseQuoteWord(p, VURI) == true) {
- if (VURI[0] == '[') {
- rec.VendorID = VURI.substr(1, VURI.length() - 2);
- if (ParseQuoteWord(p, VURI) == true && rec.SetURI(VURI) == true)
- Failed = false;
- } else if (rec.SetURI(VURI) == true) {
- Failed = false;
- }
- if (Failed == false && ParseQuoteWord(p, rec.Dist) == false)
- Failed = true;
- }
-
- if (Failed == true) {
- if (rec.Type == Disabled) {
- // treat as a comment field
- rec.Type = Comment;
- rec.Comment = buf;
- } else {
- // syntax error on line
- rec.Type = Comment;
- string s = "#" + string(buf);
- rec.Comment = s;
- record_ok = false;
- //return _error->Error("Syntax error in line %s", buf);
- }
- }
-#ifndef HAVE_RPM
- // check for absolute dist
- if (rec.Dist.empty() == false && rec.Dist[rec.Dist.size() - 1] == '/') {
- // make sure there's no section
- if (ParseQuoteWord(p, Section) == true)
- return _error->Error("Syntax error in line %s", buf);
-
- rec.Dist = SubstVar(rec.Dist, "$(ARCH)",
- _config->Find("APT::Architecture"));
-
- AddSourceNode(rec);
- continue;
- }
-#endif
-
- const char *tmp = p;
- rec.NumSections = 0;
- while (ParseQuoteWord(p, Section) == true)
- rec.NumSections++;
- if (rec.NumSections > 0) {
- p = tmp;
- rec.Sections = new string[rec.NumSections];
- rec.NumSections = 0;
- while (ParseQuoteWord(p, Section) == true) {
- // comments inside the record are preserved
- if (Section[0] == '#') {
- SourceRecord rec;
- string s = Section + string(p);
- rec.Type = Comment;
- rec.Comment = s;
- rec.SourceFile = listpath;
- AddSourceNode(rec);
- break;
- } else {
- rec.Sections[rec.NumSections++] = Section;
- }
- }
- }
- AddSourceNode(rec);
- }
-
- ifs.close();
- return record_ok;
-}
-
-bool SourcesList::ReadSourceDir(string Dir)
-{
- //cout << "SourcesList::ReadSourceDir() " << Dir << endl;
-
- DIR *D = opendir(Dir.c_str());
- if (D == 0)
- return _error->Errno("opendir", "Unable to read %s", Dir.c_str());
-
- vector<string> List;
- for (struct dirent * Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
- if (Ent->d_name[0] == '.')
- continue;
-
- // Skip bad file names ala run-parts
- const char *C = Ent->d_name;
- for (; *C != 0; C++)
- if (isalpha(*C) == 0 && isdigit(*C) == 0
- && *C != '_' && *C != '-' && *C != '.')
- break;
- if (*C != 0)
- continue;
-
- // Only look at files ending in .list to skip .rpmnew etc files
- if (strcmp(Ent->d_name + strlen(Ent->d_name) - 5, ".list") != 0)
- continue;
-
- // Make sure it is a file and not something else
- string File = flCombine(Dir, Ent->d_name);
- struct stat St;
- if (stat(File.c_str(), &St) != 0 || S_ISREG(St.st_mode) == 0)
- continue;
- List.push_back(File);
-
- }
- closedir(D);
-
- sort(List.begin(), List.end());
-
- // Read the files
- for (vector<string>::const_iterator I = List.begin(); I != List.end();
- I++)
- if (ReadSourcePart(*I) == false)
- return false;
- return true;
-}
-
-
-bool SourcesList::ReadSources()
-{
- //cout << "SourcesList::ReadSources() " << endl;
-
- bool Res = true;
-
- string Parts = _config->FindDir("Dir::Etc::sourceparts");
- if (FileExists(Parts) == true)
- Res &= ReadSourceDir(Parts);
- string Main = _config->FindFile("Dir::Etc::sourcelist");
- if (FileExists(Main) == true)
- Res &= ReadSourcePart(Main);
-
- return Res;
-}
-
-SourcesList::SourceRecord *SourcesList::AddEmptySource()
-{
- SourceRecord rec;
-#ifdef HAVE_RPM
- rec.Type = Rpm;
-#else
- rec.Type = Deb;
-#endif
- rec.VendorID = "";
- rec.SourceFile = _config->FindFile("Dir::Etc::sourcelist");
- rec.Dist = "";
- rec.NumSections = 0;
- return AddSourceNode(rec);
-}
-
-SourcesList::SourceRecord *SourcesList::AddSource(RecType Type,
- string VendorID, string URI,
- string Dist,
- string *Sections,
- unsigned short count,
- string SourceFile)
-{
- SourceRecord rec;
- rec.Type = Type;
- rec.VendorID = VendorID;
- rec.SourceFile = SourceFile;
-
- if (rec.SetURI(URI) == false) {
- return NULL;
- }
- rec.Dist = Dist;
- rec.NumSections = count;
- rec.Sections = new string[count];
- for (unsigned int i = 0; i < count; i++)
- rec.Sections[i] = Sections[i];
-
- return AddSourceNode(rec);
-}
-
-void SourcesList::RemoveSource(SourceRecord *&rec)
-{
- SourceRecords.remove(rec);
- delete rec;
- rec = 0;
-}
-
-void SourcesList::SwapSources( SourceRecord *&rec_one, SourceRecord *&rec_two )
-{
- list<SourceRecord *>::iterator rec_p;
- list<SourceRecord *>::iterator rec_n;
-
- rec_p = find( SourceRecords.begin(), SourceRecords.end(), rec_one );
- rec_n = find( SourceRecords.begin(), SourceRecords.end(), rec_two );
-
- SourceRecords.insert( rec_p, rec_two );
- SourceRecords.erase( rec_n );
-}
-
-bool SourcesList::UpdateSources()
-{
- list<string> filenames;
- for (list<SourceRecord *>::iterator it = SourceRecords.begin();
- it != SourceRecords.end(); it++) {
- if ((*it)->SourceFile == "")
- continue;
- filenames.push_front((*it)->SourceFile);
- }
- filenames.sort();
- filenames.unique();
-
- for (list<string>::iterator fi = filenames.begin();
- fi != filenames.end(); fi++) {
- ofstream ofs((*fi).c_str(), ios::out);
- if (!ofs != 0)
- return false;
-
- for (list<SourceRecord *>::iterator it = SourceRecords.begin();
- it != SourceRecords.end(); it++) {
- if ((*fi) != (*it)->SourceFile)
- continue;
- string S;
- if (((*it)->Type & Comment) != 0) {
- S = (*it)->Comment;
- } else if ((*it)->URI.empty() || (*it)->Dist.empty()) {
- continue;
- } else {
- if (((*it)->Type & Disabled) != 0)
- S = "# ";
-
- S += (*it)->GetType() + " ";
-
- if ((*it)->VendorID.empty() == false)
- S += "[" + (*it)->VendorID + "] ";
-
- S += (*it)->URI + " ";
- S += (*it)->Dist + " ";
-
- for (unsigned int J = 0; J < (*it)->NumSections; J++)
- S += (*it)->Sections[J] + " ";
- }
- ofs << S << endl;
- }
- ofs.close();
- }
- return true;
-}
-
-bool SourcesList::SourceRecord::SetType(string S)
-{
- if (S == "deb")
- Type |= Deb;
- else if (S == "deb-src")
- Type |= DebSrc;
- else if (S == "rpm")
- Type |= Rpm;
- else if (S == "rpm-src")
- Type |= RpmSrc;
- else if (S == "rpm-dir")
- Type |= RpmDir;
- else if (S == "rpm-src-dir")
- Type |= RpmSrcDir;
- else if (S == "repomd")
- Type |= Repomd;
- else if (S == "repomd-src")
- Type |= RepomdSrc;
- else
- return false;
- //cout << S << " settype " << (Type | Repomd) << endl;
- return true;
-}
-
-string SourcesList::SourceRecord::GetType()
-{
- if ((Type & Deb) != 0)
- return "deb";
- else if ((Type & DebSrc) != 0)
- return "deb-src";
- else if ((Type & Rpm) != 0)
- return "rpm";
- else if ((Type & RpmSrc) != 0)
- return "rpm-src";
- else if ((Type & RpmDir) != 0)
- return "rpm-dir";
- else if ((Type & RpmSrcDir) != 0)
- return "rpm-src-dir";
- else if ((Type & Repomd) != 0)
- return "repomd";
- else if ((Type & RepomdSrc) != 0)
- return "repomd-src";
- //cout << "type " << (Type & Repomd) << endl;
- return "unknown";
-}
-
-bool SourcesList::SourceRecord::SetURI(string S)
-{
- if (S.empty() == true)
- return false;
- if (S.find(':') == string::npos)
- return false;
-
- S = SubstVar(S, "$(ARCH)", _config->Find("APT::Architecture"));
- S = SubstVar(S, "$(VERSION)", _config->Find("APT::DistroVersion"));
- URI = S;
-
- // append a / to the end if one is not already there
- if (URI[URI.size() - 1] != '/')
- URI += '/';
-
- return true;
-}
-
-SourcesList::SourceRecord &SourcesList::SourceRecord::
-operator=(const SourceRecord &rhs)
-{
- // Needed for a proper deep copy of the record; uses the string operator= to properly copy the strings
- Type = rhs.Type;
- VendorID = rhs.VendorID;
- URI = rhs.URI;
- Dist = rhs.Dist;
- Sections = new string[rhs.NumSections];
- for (unsigned int I = 0; I < rhs.NumSections; I++)
- Sections[I] = rhs.Sections[I];
- NumSections = rhs.NumSections;
- Comment = rhs.Comment;
- SourceFile = rhs.SourceFile;
-
- return *this;
-}
-
-SourcesList::VendorRecord *SourcesList::AddVendorNode(VendorRecord &rec)
-{
- VendorRecord *newrec = new VendorRecord;
- *newrec = rec;
- VendorRecords.push_back(newrec);
-
- return newrec;
-}
-
-bool SourcesList::ReadVendors()
-{
- Configuration Cnf;
-
- string CnfFile = _config->FindFile("Dir::Etc::vendorlist");
- if (FileExists(CnfFile) == true)
- if (ReadConfigFile(Cnf, CnfFile, true) == false)
- return false;
-
- for (list<VendorRecord *>::const_iterator I = VendorRecords.begin();
- I != VendorRecords.end(); I++)
- delete *I;
- VendorRecords.clear();
-
- // Process 'simple-key' type sections
- const Configuration::Item *Top = Cnf.Tree("simple-key");
- for (Top = (Top == 0 ? 0 : Top->Child); Top != 0; Top = Top->Next) {
- Configuration Block(Top);
- VendorRecord Vendor;
-
- Vendor.VendorID = Top->Tag;
- Vendor.FingerPrint = Block.Find("Fingerprint");
- Vendor.Description = Block.Find("Name");
-
- char *buffer = new char[Vendor.FingerPrint.length() + 1];
- char *p = buffer;;
- for (string::const_iterator I = Vendor.FingerPrint.begin();
- I != Vendor.FingerPrint.end(); I++) {
- if (*I != ' ' && *I != '\t')
- *p++ = *I;
- }
- *p = 0;
- Vendor.FingerPrint = buffer;
- delete[]buffer;
-
- if (Vendor.FingerPrint.empty() == true ||
- Vendor.Description.empty() == true) {
- _error->Error("Vendor block %s is invalid",
- Vendor.VendorID.c_str());
- continue;
- }
-
- AddVendorNode(Vendor);
- }
-
- return !_error->PendingError();
-}
-
-SourcesList::VendorRecord *SourcesList::AddVendor(string VendorID,
- string FingerPrint,
- string Description)
-{
- VendorRecord rec;
- rec.VendorID = VendorID;
- rec.FingerPrint = FingerPrint;
- rec.Description = Description;
- return AddVendorNode(rec);
-}
-
-bool SourcesList::UpdateVendors()
-{
- ofstream ofs(_config->FindFile("Dir::Etc::vendorlist").c_str(), ios::out);
- if (!ofs != 0)
- return false;
-
- for (list<VendorRecord *>::iterator it = VendorRecords.begin();
- it != VendorRecords.end(); it++) {
- ofs << "simple-key \"" << (*it)->VendorID << "\" {" << endl;
- ofs << "\tFingerPrint \"" << (*it)->FingerPrint << "\";" << endl;
- ofs << "\tName \"" << (*it)->Description << "\";" << endl;
- ofs << "}" << endl;
- }
-
- ofs.close();
- return true;
-}
-
-
-void SourcesList::RemoveVendor(VendorRecord *&rec)
-{
- VendorRecords.remove(rec);
- delete rec;
- rec = 0;
-}
-
-ostream &operator<<(ostream &os, const SourcesList::SourceRecord &rec)
-{
- os << "Type: ";
- if ((rec.Type & SourcesList::Comment) != 0)
- os << "Comment ";
- if ((rec.Type & SourcesList::Disabled) != 0)
- os << "Disabled ";
- if ((rec.Type & SourcesList::Deb) != 0)
- os << "Deb";
- if ((rec.Type & SourcesList::DebSrc) != 0)
- os << "DebSrc";
- if ((rec.Type & SourcesList::Rpm) != 0)
- os << "Rpm";
- if ((rec.Type & SourcesList::RpmSrc) != 0)
- os << "RpmSrc";
- if ((rec.Type & SourcesList::RpmDir) != 0)
- os << "RpmDir";
- if ((rec.Type & SourcesList::RpmSrcDir) != 0)
- os << "RpmSrcDir";
- if ((rec.Type & SourcesList::Repomd) != 0)
- os << "Repomd";
- if ((rec.Type & SourcesList::RepomdSrc) != 0)
- os << "RepomdSrc";
- os << endl;
- os << "SourceFile: " << rec.SourceFile << endl;
- os << "VendorID: " << rec.VendorID << endl;
- os << "URI: " << rec.URI << endl;
- os << "Dist: " << rec.Dist << endl;
- os << "Section(s):" << endl;
-#if 0
- for (unsigned int J = 0; J < rec.NumSections; J++) {
- cout << "\t" << rec.Sections[J] << endl;
- }
-#endif
- os << endl;
- return os;
-}
-
-ostream &operator<<(ostream &os, const SourcesList::VendorRecord &rec)
-{
- os << "VendorID: " << rec.VendorID << endl;
- os << "FingerPrint: " << rec.FingerPrint << endl;
- os << "Description: " << rec.Description << endl;
- return os;
-}
-
-// vim:sts=4:sw=4
diff --git a/backends/aptcc/rsources.h b/backends/aptcc/rsources.h
deleted file mode 100644
index 77fcbb2..0000000
--- a/backends/aptcc/rsources.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* rsource.h - access the sources.list file
- *
- * Copyright (c) 1999 Patrick Cole <z at amused.net>
- * (c) 2002 Synaptic development team
- *
- * Author: Patrick Cole <z at amused.net>
- * Michael Vogt <mvo at debian.org>
- * Gustavo Niemeyer <niemeyer at conectiva.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _RSOURCES_H
-#define _RSOURCES_H
-
-#include <string>
-#include <list>
-
-using namespace std;
-
-class SourcesList {
- public:
- enum RecType {
- Deb = 1 << 0,
- DebSrc = 1 << 1,
- Rpm = 1 << 2,
- RpmSrc = 1 << 3,
- Disabled = 1 << 4,
- Comment = 1 << 5,
- RpmDir = 1 << 6,
- RpmSrcDir = 1 << 7,
- Repomd = 1 << 8,
- RepomdSrc = 1 << 9
- };
-
- struct SourceRecord {
- unsigned int Type;
- string VendorID;
- string URI;
- string Dist;
- string *Sections;
- unsigned short NumSections;
- string Comment;
- string SourceFile;
-
- bool SetType(string);
- string GetType();
- bool SetURI(string);
-
- SourceRecord():Type(0), Sections(0), NumSections(0) {
- };
- ~SourceRecord() {
- if (Sections)
- delete[]Sections;
- };
- SourceRecord &operator=(const SourceRecord &);
- };
-
- struct VendorRecord {
- string VendorID;
- string FingerPrint;
- string Description;
- };
-
- list<SourceRecord *> SourceRecords;
- list<VendorRecord *> VendorRecords;
-
- private:
- SourceRecord *AddSourceNode(SourceRecord &);
- VendorRecord *AddVendorNode(VendorRecord &);
-
- public:
- SourceRecord *AddSource(RecType Type,
- string VendorID,
- string URI,
- string Dist,
- string *Sections,
- unsigned short count, string SourceFile);
- SourceRecord *AddEmptySource();
- void RemoveSource(SourceRecord *&);
- void SwapSources( SourceRecord *&, SourceRecord *& );
- bool ReadSourcePart(string listpath);
- bool ReadSourceDir(string Dir);
- bool ReadSources();
- bool UpdateSources();
-
- VendorRecord *AddVendor(string VendorID,
- string FingerPrint, string Description);
- void RemoveVendor(VendorRecord *&);
- bool ReadVendors();
- bool UpdateVendors();
-
- SourcesList() {
- };
- ~SourcesList();
-};
-
-typedef list<SourcesList::SourceRecord *>::iterator SourcesListIter;
-
-ostream &operator <<(ostream &, const SourcesList::SourceRecord &);
-
-#endif
commit 94691012d185eac98c830b608c3d999176932490
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Mar 5 22:54:36 2012 +0100
aptcc: Some more stuff required for installFiles()
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 1b33679..a536833 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -1730,7 +1730,7 @@ PkgList AptIntf::resolvePI(gchar **package_ids)
return ret;
}
-bool AptIntf::markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
+bool AptIntf::markFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
{
// We call gdebi to tell us what do we need to install/remove
// in order to be able to install this package
@@ -1800,6 +1800,33 @@ bool AptIntf::markDebFileForInstall(const gchar *file, PkgList &install, PkgList
return true;
}
+bool AptIntf::installFile(const gchar *path, bool simulate)
+{
+ if (path == NULL)
+ return false;
+
+ DebFile *deb = new DebFile(path);
+ if (!deb->isValid()) {
+ delete deb;
+ return false;
+ }
+
+ if (simulate) {
+ // TODO: Emit signal for to-be-installed package
+ //emit_package("", PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+ delete deb;
+ return true;
+ }
+ delete deb;
+
+ // TODO: Install the package using dpkg
+
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_NOT_SUPPORTED,
+ "Installation of Deb files is in progress and not (yet) working completely.");
+
+ return false;
+}
+
bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate)
{
//cout << "runTransaction" << simulate << remove << endl;
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
index 7b7dd6d..12c4b30 100644
--- a/backends/aptcc/apt-intf.h
+++ b/backends/aptcc/apt-intf.h
@@ -67,7 +67,7 @@ public:
pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
PkgList resolvePI(gchar **package_ids);
- bool markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
+ bool markFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
/**
* runs a transaction to install/remove/update packages
@@ -125,17 +125,26 @@ public:
void emitFiles(PkBackend *backend, const gchar *pi);
/**
- * seems to install packages
+ * Download and install packages
*/
bool installPackages(pkgCacheFile &Cache);
/**
- * check which package provides the codec
+ * Install a DEB file
+ *
+ * If you don't want to actually install/update/remove
+ * \p simulate should be true, in this case packages with
+ * what's going to happen will be emitted.
+ */
+ bool installFile(const gchar *path, bool simulate);
+
+ /**
+ * Check which package provides the codec
*/
void providesCodec(PkgList &output, gchar **values);
/**
- * check which package provides a shared library
+ * Check which package provides a shared library
*/
void providesLibrary(PkgList &output, gchar **values);
diff --git a/backends/aptcc/deb-file.h b/backends/aptcc/deb-file.h
index 8f6dbce..f4ae5a1 100644
--- a/backends/aptcc/deb-file.h
+++ b/backends/aptcc/deb-file.h
@@ -37,7 +37,7 @@ public:
std::string architecture() const;
std::string conflicts() const;
- // THIS should be moved to AptCC class
+ // THIS should be moved to AptIntf class
bool check();
std::string errorMsg() const;
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index c3abb86..c495114 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -1118,7 +1118,7 @@ backend_manage_packages_thread (PkBackend *backend)
full_paths = pk_backend_get_strv (backend, "full_paths");
fileInstall = true;
}
-cout << "FILE INSTALL: " << fileInstall << endl;
+ g_debug ("FILE INSTALL: %i", fileInstall);
pk_backend_set_allow_cancel (backend, true);
AptIntf *m_apt = new AptIntf(backend, _cancel);
@@ -1130,66 +1130,71 @@ cout << "FILE INSTALL: " << fileInstall << endl;
}
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- PkgList installPkgs, removePkgs;
- if (fileInstall) {
- // GDebi can not install more than one package at time
- if (g_strv_length(full_paths) > 1) {
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_NOT_SUPPORTED,
- "The backend can only proccess one file at time.");
- delete m_apt;
- return false;
- }
-
- // get the list of packages to install
- if (!m_apt->markDebFileForInstall(full_paths[0], installPkgs, removePkgs)) {
- delete m_apt;
- return false;
- }
- cout << "installPkgs.size: " << installPkgs.size() << endl;
- cout << "removePkgs.size: " << removePkgs.size() << endl;
- } else {
- // Resolve the given packages
- gchar **package_ids = pk_backend_get_strv(backend, "package_ids");
- if (remove) {
- removePkgs = m_apt->resolvePI(package_ids);
- } else {
- installPkgs = m_apt->resolvePI(package_ids);
- }
-
- if (removePkgs.size() == 0 && installPkgs.size() == 0) {
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Could not find package(s)");
- delete m_apt;
- return false;
- }
- }
+ PkgList installPkgs, removePkgs;
- // Install/Update/Remove packages, or just simulate
- if (!m_apt->runTransaction(installPkgs, removePkgs, simulate)) {
- // Print transaction errors
- cout << "runTransaction failed" << endl;
- delete m_apt;
- return false;
- }
+ if (fileInstall) {
+ // File installation EXPERIMENTAL
- // This is broken at time.
-/*
- if (fileInstall) {
- // File installation EXPERIMENTAL
- gchar *path;
+ // GDebi can not install more than one package at time
+ if (g_strv_length(full_paths) > 1) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_NOT_SUPPORTED,
+ "The backend can only proccess one file at time.");
+ delete m_apt;
+ return false;
+ }
- for (uint i = 0; i < g_strv_length(full_paths); i++) {
- if (_cancel) {
- break;
+ // get the list of packages to install
+ if (!m_apt->markFileForInstall(full_paths[0], installPkgs, removePkgs)) {
+ delete m_apt;
+ return false;
+ }
+
+ cout << "installPkgs.size: " << installPkgs.size() << endl;
+ cout << "removePkgs.size: " << removePkgs.size() << endl;
+
+ } else {
+ // Resolve the given packages
+ gchar **package_ids = pk_backend_get_strv(backend, "package_ids");
+ if (remove) {
+ removePkgs = m_apt->resolvePI(package_ids);
+ } else {
+ installPkgs = m_apt->resolvePI(package_ids);
+ }
+
+ if (removePkgs.size() == 0 && installPkgs.size() == 0) {
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
+ "Could not find package(s)");
+ delete m_apt;
+ return false;
}
+ }
- path = full_paths[i];
- cout << "InstallFiles: " << m_apt->installDebFiles(path, simulate) << endl;
+ // Install/Update/Remove packages, or just simulate
+ if (!m_apt->runTransaction(installPkgs, removePkgs, simulate)) {
+ // Print transaction errors
+ cout << "runTransaction failed" << endl;
+ delete m_apt;
+ return false;
+ }
+
+ if (fileInstall) {
+ // Now perform the installation!
+ gchar *path;
+ for (uint i = 0; i < g_strv_length(full_paths); i++) {
+ if (_cancel) {
+ break;
+ }
+
+ path = full_paths[i];
+ if (!m_apt->installFile(path, simulate)) {
+ cout << "Installation of DEB file " << path << " failed." << endl;
+ delete m_apt;
+ return false;
+ }
+ }
}
- }
-*/
delete m_apt;
return true;
@@ -1496,13 +1501,10 @@ pk_backend_get_roles (PkBackend *backend)
}
// only add GetDistroUpgrades if the binary is present
- // InstallFiles is not working at time.
-/*
if (g_file_test (GDEBI_BINARY, G_FILE_TEST_EXISTS)) {
pk_bitfield_add(roles, PK_ROLE_ENUM_SIMULATE_INSTALL_FILES);
pk_bitfield_add(roles, PK_ROLE_ENUM_INSTALL_FILES);
}
-*/
return roles;
}
commit 692c2fc7d05cee6d063df9e526f5e8b65bcb926a
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Mar 5 22:11:49 2012 +0100
aptcc: Update license headers & fix some more indentation and typos
diff --git a/backends/aptcc/20packagekit b/backends/aptcc/20packagekit
index ffd677a..98fe23f 100644
--- a/backends/aptcc/20packagekit
+++ b/backends/aptcc/20packagekit
@@ -1,12 +1,13 @@
// THIS FILE IS USED TO INFORM PACKAGEKIT
-// THAT THE UPDATES MIGHT HAVE CHANGED
-// Whenever the dpkg is called we might have different updates
-// i.e. a user removes a package that had an update
+// THAT THE UPDATE-INFO MIGHT HAVE CHANGED
+
+// Whenever dpkg is called we might have different updates
+// i.e. if an user removes a package that had an update
DPkg::Post-Invoke {
"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 1 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null";
};
-// When the apt cache is updated (i.e. apt-cache update)
+// When Apt's cache is updated (i.e. apt-cache update)
APT::Update::Post-Invoke-Success {
"/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 1 --method org.freedesktop.PackageKit.StateHasChanged cache-update > /dev/null; /bin/echo > /dev/null";
};
diff --git a/backends/aptcc/Makefile.am b/backends/aptcc/Makefile.am
index cc0274a..052bdf2 100644
--- a/backends/aptcc/Makefile.am
+++ b/backends/aptcc/Makefile.am
@@ -5,9 +5,9 @@ INCLUDES = \
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_aptcc.la
libpk_backend_aptcc_la_SOURCES = pkg_acqfile.cpp \
- acqprogress.cpp \
+ pkg_dpkgpm.cpp \
+ acqpkitstatus.cpp \
deb-file.cpp \
- dpkgpm.cpp \
matcher.cpp \
gstMatcher.cpp \
apt-messages.cpp \
@@ -30,9 +30,9 @@ EXTRA_DIST = 20packagekit \
gstMatcher.h \
matcher.h \
deb-file.h \
- dpkgpm.h \
apt-messages.h \
- acqprogress.h \
+ acqpkitstatus.h \
+ pkg_dpkgpm.h \
pkg_acqfile.h
helperdir = $(datadir)/PackageKit/helpers/aptcc
diff --git a/backends/aptcc/acqpkitstatus.cpp b/backends/aptcc/acqpkitstatus.cpp
new file mode 100644
index 0000000..4756921
--- /dev/null
+++ b/backends/aptcc/acqpkitstatus.cpp
@@ -0,0 +1,268 @@
+/* acqpkitstatus.cpp
+ *
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "acqpkitstatus.h"
+
+#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/acquire-worker.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
+
+#include <stdio.h>
+#include <signal.h>
+#include <iostream>
+
+using namespace std;
+
+// AcqPackageKitStatus::AcqPackageKitStatus - Constructor
+// ---------------------------------------------------------------------
+AcqPackageKitStatus::AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled) :
+ m_apt(apt),
+ m_backend(backend),
+ _cancelled(cancelled),
+ last_percent(PK_BACKEND_PERCENTAGE_INVALID),
+ last_sub_percent(PK_BACKEND_PERCENTAGE_INVALID)
+{
+}
+
+// AcqPackageKitStatus::Start - Downloading has started
+// ---------------------------------------------------------------------
+void AcqPackageKitStatus::Start()
+{
+ pkgAcquireStatus::Start();
+ ID = 1;
+};
+
+// AcqPackageKitStatus::IMSHit - Called when an item got a HIT response /*{{{*/
+// ---------------------------------------------------------------------
+void AcqPackageKitStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
+{
+ if (packages.size() == 0) {
+ pk_backend_repo_detail(m_backend,
+ "",
+ Itm.Description.c_str(),
+ false);
+ }
+ Update = true;
+};
+
+// AcqPackageKitStatus::Fetch - An item has started to download
+// ---------------------------------------------------------------------
+/* This prints out the short description and the expected size */
+void AcqPackageKitStatus::Fetch(pkgAcquire::ItemDesc &Itm)
+{
+ Update = true;
+ if (Itm.Owner->Complete == true)
+ return;
+
+ Itm.Owner->ID = ID++;
+};
+
+// AcqPackageKitStatus::Done - Completed a download
+// ---------------------------------------------------------------------
+/* We don't display anything... */
+void AcqPackageKitStatus::Done(pkgAcquire::ItemDesc &Itm)
+{
+ Update = true;
+};
+
+// AcqPackageKitStatus::Fail - Called when an item fails to download
+// ---------------------------------------------------------------------
+/* We print out the error text */
+void AcqPackageKitStatus::Fail(pkgAcquire::ItemDesc &Itm)
+{
+ // Ignore certain kinds of transient failures (bad code)
+ if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) {
+ return;
+ }
+
+ if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
+ {
+ if (packages.size() == 0) {
+ pk_backend_repo_detail(m_backend,
+ "",
+ Itm.Description.c_str(),
+ false);
+ }
+ } else {
+ // an error was found (maybe 404, 403...)
+ // the item that got the error and the error text
+ _error->Error("Error %s\n %s",
+ Itm.Description.c_str(),
+ Itm.Owner->ErrorText.c_str());
+ }
+
+ Update = true;
+};
+
+
+// AcqTextStatus::Stop - Finished downloading
+// ---------------------------------------------------------------------
+/* This prints out the bytes downloaded and the overall average line
+ speed */
+void AcqPackageKitStatus::Stop()
+{
+ pkgAcquireStatus::Stop();
+ // the items that still on the set are finished
+ for (set<string>::iterator it = currentPackages.begin();
+ it != currentPackages.end();
+ it++ )
+ {
+ emit_package(*it, true);
+ }
+}
+
+
+// AcqPackageKitStatus::Pulse - Regular event pulse
+// ---------------------------------------------------------------------
+/* This draws the current progress. Each line has an overall percent
+ meter and a per active item status meter along with an overall
+ bandwidth and ETA indicator. */
+bool AcqPackageKitStatus::Pulse(pkgAcquire *Owner)
+{
+ pkgAcquireStatus::Pulse(Owner);
+
+ unsigned long percent_done;
+ percent_done = long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems));
+
+ // Emit the percent done
+ if (last_percent != percent_done) {
+ if (last_percent < percent_done) {
+ pk_backend_set_percentage(m_backend, percent_done);
+ } else {
+ pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_percentage(m_backend, percent_done);
+ }
+ last_percent = percent_done;
+ }
+
+ set<string> localCurrentPackages = currentPackages;;
+ for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
+ I = Owner->WorkerStep(I))
+ {
+ // Check if there is no item running or if we don't have
+ // any packages set we are probably refreshing the cache
+ if (I->CurrentItem == 0 || packages.size() == 0)
+ {
+ continue;
+ }
+ emit_package(I->CurrentItem->ShortDesc, false);
+ localCurrentPackages.erase(I->CurrentItem->ShortDesc);
+
+ // Add the total size and percent
+ if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
+ {
+ unsigned long sub_percent;
+ // TODO PackageKit needs to emit package with progress.
+ sub_percent = long(double(I->CurrentSize*100.0)/double(I->TotalSize));
+ if (last_sub_percent != sub_percent) {
+ if (last_sub_percent < sub_percent) {
+ pk_backend_set_sub_percentage(m_backend, sub_percent);
+ } else {
+ pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_sub_percentage(m_backend, sub_percent);
+ }
+ last_sub_percent = sub_percent;
+ }
+ }
+ }
+
+ // the items that still on the set are finished
+ for (set<string>::iterator it = localCurrentPackages.begin();
+ it != localCurrentPackages.end();
+ it++ )
+ {
+ emit_package(*it, true);
+ }
+
+ double localCPS = (CurrentCPS >= 0) ? CurrentCPS : -1 * CurrentCPS;
+ if (localCPS != last_CPS)
+ {
+ last_CPS = localCPS;
+ pk_backend_set_speed(m_backend, (int) last_CPS);
+ }
+
+ Update = false;
+
+ return !_cancelled;;
+}
+
+// AcqPackageKitStatus::MediaChange - Media need to be swapped
+// ---------------------------------------------------------------------
+/* Prompt for a media swap */
+bool AcqPackageKitStatus::MediaChange(string Media, string Drive)
+{
+ pk_backend_media_change_required(m_backend,
+ PK_MEDIA_TYPE_ENUM_DISC,
+ Media.c_str(),
+ Media.c_str());
+
+ char errorMsg[400];
+ sprintf(errorMsg,
+ "Media change: please insert the disc labeled"
+ " '%s' "
+ "in the drive '%s' and try again.",
+ Media.c_str(),
+ Drive.c_str());
+
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED,
+ errorMsg);
+
+ // Set this so we can fail the transaction
+ Update = true;
+ return false;
+}
+
+
+void AcqPackageKitStatus::addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair)
+{
+ packages.push_back(packagePair);
+}
+
+void AcqPackageKitStatus::emit_package(const string &name, bool finished)
+{
+ if (name.compare(last_package_name) != 0 && packages.size()) {
+ // find the package
+ for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator it = packages.begin();
+ it != packages.end(); ++it)
+ {
+ if (_cancelled) {
+ break;
+ }
+ // try to see if any package matches
+ if (name.compare(it->first.Name()) == 0) {
+ m_apt->emit_package(it->first,
+ it->second,
+ PK_INFO_ENUM_UNKNOWN,
+ finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
+ last_package_name = name;
+
+ // Find the downloading item
+ if (finished) {
+ currentPackages.erase(name);
+ } else {
+ currentPackages.insert(name);
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/backends/aptcc/acqpkitstatus.h b/backends/aptcc/acqpkitstatus.h
new file mode 100644
index 0000000..d775e74
--- /dev/null
+++ b/backends/aptcc/acqpkitstatus.h
@@ -0,0 +1,63 @@
+/* acqpkitstatus.h
+ *
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef ACQ_PKIT_STATUS_H
+#define ACQ_PKIT_STATUS_H
+
+#include <apt-pkg/acquire.h>
+#include <pk-backend.h>
+
+#include "apt-intf.h"
+
+class AcqPackageKitStatus : public pkgAcquireStatus
+{
+public:
+ AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled);
+
+ virtual bool MediaChange(string Media, string Drive);
+ virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
+ virtual void Fetch(pkgAcquire::ItemDesc &Itm);
+ virtual void Done(pkgAcquire::ItemDesc &Itm);
+ virtual void Fail(pkgAcquire::ItemDesc &Itm);
+ virtual void Start();
+ virtual void Stop();
+
+ bool Pulse(pkgAcquire *Owner);
+
+ void addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair);
+
+private:
+ PkBackend *m_backend;
+ unsigned long ID;
+ bool &_cancelled;
+
+ unsigned long last_percent;
+ unsigned long last_sub_percent;
+ double last_CPS;
+ string last_package_name;
+ AptIntf *m_apt;
+
+ vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > packages;
+ set<string> currentPackages;
+
+ void emit_package(const string &name, bool finished);
+};
+
+#endif
diff --git a/backends/aptcc/acqprogress.cpp b/backends/aptcc/acqprogress.cpp
deleted file mode 100644
index 0374ce2..0000000
--- a/backends/aptcc/acqprogress.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description /*{{{*/
-// $Id: acqprogress.cc,v 1.24 2003/04/27 01:56:48 doogie Exp $
-/* ######################################################################
-
- Acquire Progress - Command line progress meter
-
- ##################################################################### */
- /*}}}*/
-// Include files /*{{{*/
-#include "acqprogress.h"
-#include <apt-pkg/acquire-item.h>
-#include <apt-pkg/acquire-worker.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/error.h>
-
-#include <stdio.h>
-#include <signal.h>
-#include <iostream>
- /*}}}*/
-
-using namespace std;
-
-// AcqPackageKitStatus::AcqPackageKitStatus - Constructor /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-AcqPackageKitStatus::AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled) :
- m_apt(apt),
- m_backend(backend),
- _cancelled(cancelled),
- last_percent(PK_BACKEND_PERCENTAGE_INVALID),
- last_sub_percent(PK_BACKEND_PERCENTAGE_INVALID)
-{
-}
- /*}}}*/
-// AcqPackageKitStatus::Start - Downloading has started /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-void AcqPackageKitStatus::Start()
-{
- pkgAcquireStatus::Start();
- ID = 1;
-};
- /*}}}*/
-// AcqPackageKitStatus::IMSHit - Called when an item got a HIT response /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-void AcqPackageKitStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
-{
- if (packages.size() == 0) {
- pk_backend_repo_detail(m_backend,
- "",
- Itm.Description.c_str(),
- false);
- }
- Update = true;
-};
- /*}}}*/
-// AcqPackageKitStatus::Fetch - An item has started to download /*{{{*/
-// ---------------------------------------------------------------------
-/* This prints out the short description and the expected size */
-void AcqPackageKitStatus::Fetch(pkgAcquire::ItemDesc &Itm)
-{
- Update = true;
- if (Itm.Owner->Complete == true)
- return;
-
- Itm.Owner->ID = ID++;
-};
- /*}}}*/
-// AcqPackageKitStatus::Done - Completed a download /*{{{*/
-// ---------------------------------------------------------------------
-/* We don't display anything... */
-void AcqPackageKitStatus::Done(pkgAcquire::ItemDesc &Itm)
-{
- Update = true;
-};
- /*}}}*/
-// AcqPackageKitStatus::Fail - Called when an item fails to download /*{{{*/
-// ---------------------------------------------------------------------
-/* We print out the error text */
-void AcqPackageKitStatus::Fail(pkgAcquire::ItemDesc &Itm)
-{
- // Ignore certain kinds of transient failures (bad code)
- if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) {
- return;
- }
-
- if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
- {
- if (packages.size() == 0) {
- pk_backend_repo_detail(m_backend,
- "",
- Itm.Description.c_str(),
- false);
- }
- } else {
- // an error was found (maybe 404, 403...)
- // the item that got the error and the error text
- _error->Error("Error %s\n %s",
- Itm.Description.c_str(),
- Itm.Owner->ErrorText.c_str());
- }
-
- Update = true;
-};
-
- /*}}}*/
-// AcqTextStatus::Stop - Finished downloading /*{{{*/
-// ---------------------------------------------------------------------
-/* This prints out the bytes downloaded and the overall average line
- speed */
-void AcqPackageKitStatus::Stop()
-{
- pkgAcquireStatus::Stop();
- // the items that still on the set are finished
- for (set<string>::iterator it = currentPackages.begin();
- it != currentPackages.end();
- it++ )
- {
- emit_package(*it, true);
- }
-}
-
- /*}}}*/
-// AcqPackageKitStatus::Pulse - Regular event pulse /*{{{*/
-// ---------------------------------------------------------------------
-/* This draws the current progress. Each line has an overall percent
- meter and a per active item status meter along with an overall
- bandwidth and ETA indicator. */
-bool AcqPackageKitStatus::Pulse(pkgAcquire *Owner)
-{
- pkgAcquireStatus::Pulse(Owner);
-
- unsigned long percent_done;
- percent_done = long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems));
-
- // Emit the percent done
- if (last_percent != percent_done) {
- if (last_percent < percent_done) {
- pk_backend_set_percentage(m_backend, percent_done);
- } else {
- pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_percentage(m_backend, percent_done);
- }
- last_percent = percent_done;
- }
-
- set<string> localCurrentPackages = currentPackages;;
- for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
- I = Owner->WorkerStep(I))
- {
- // Check if there is no item running or if we don't have
- // any packages set we are probably refreshing the cache
- if (I->CurrentItem == 0 || packages.size() == 0)
- {
- continue;
- }
- emit_package(I->CurrentItem->ShortDesc, false);
- localCurrentPackages.erase(I->CurrentItem->ShortDesc);
-
- // Add the total size and percent
- if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
- {
- unsigned long sub_percent;
- // TODO PackageKit needs to emit package with progress.
- sub_percent = long(double(I->CurrentSize*100.0)/double(I->TotalSize));
- if (last_sub_percent != sub_percent) {
- if (last_sub_percent < sub_percent) {
- pk_backend_set_sub_percentage(m_backend, sub_percent);
- } else {
- pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_sub_percentage(m_backend, sub_percent);
- }
- last_sub_percent = sub_percent;
- }
- }
- }
-
- // the items that still on the set are finished
- for (set<string>::iterator it = localCurrentPackages.begin();
- it != localCurrentPackages.end();
- it++ )
- {
- emit_package(*it, true);
- }
-
- double localCPS = (CurrentCPS >= 0) ? CurrentCPS : -1 * CurrentCPS;
- if (localCPS != last_CPS)
- {
- last_CPS = localCPS;
- pk_backend_set_speed(m_backend, (int) last_CPS);
- }
-
- Update = false;
-
- return !_cancelled;;
-}
- /*}}}*/
-// AcqPackageKitStatus::MediaChange - Media need to be swapped /*{{{*/
-// ---------------------------------------------------------------------
-/* Prompt for a media swap */
-bool AcqPackageKitStatus::MediaChange(string Media, string Drive)
-{
- pk_backend_media_change_required(m_backend,
- PK_MEDIA_TYPE_ENUM_DISC,
- Media.c_str(),
- Media.c_str());
-
- char errorMsg[400];
- sprintf(errorMsg,
- "Media change: please insert the disc labeled"
- " '%s' "
- "in the drive '%s' and try again.",
- Media.c_str(),
- Drive.c_str());
-
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_MEDIA_CHANGE_REQUIRED,
- errorMsg);
-
- // Set this so we can fail the transaction
- Update = true;
- return false;
-}
- /*}}}*/
-
-void AcqPackageKitStatus::addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair)
-{
- packages.push_back(packagePair);
-}
-
-void AcqPackageKitStatus::emit_package(const string &name, bool finished)
-{
- if (name.compare(last_package_name) != 0 && packages.size()) {
- // find the package
- for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator it = packages.begin();
- it != packages.end(); ++it)
- {
- if (_cancelled) {
- break;
- }
- // try to see if any package matches
- if (name.compare(it->first.Name()) == 0) {
- m_apt->emit_package(it->first,
- it->second,
- PK_INFO_ENUM_UNKNOWN,
- finished ? PK_INFO_ENUM_FINISHED : PK_INFO_ENUM_DOWNLOADING);
- last_package_name = name;
-
- // Find the downloading item
- if (finished) {
- currentPackages.erase(name);
- } else {
- currentPackages.insert(name);
- }
- break;
- }
- }
- }
-}
diff --git a/backends/aptcc/acqprogress.h b/backends/aptcc/acqprogress.h
deleted file mode 100644
index 68c4499..0000000
--- a/backends/aptcc/acqprogress.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description /*{{{*/
-// $Id: acqprogress.h,v 1.5 2003/02/02 22:24:11 jgg Exp $
-/* ######################################################################
-
- Acquire Progress - Command line progress meter
-
- ##################################################################### */
- /*}}}*/
-#ifndef ACQPROGRESS_H
-#define ACQPROGRESS_H
-
-#include <apt-pkg/acquire.h>
-#include <pk-backend.h>
-
-#include "apt-intf.h"
-
-class AcqPackageKitStatus : public pkgAcquireStatus
-{
-public:
- AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled);
-
- virtual bool MediaChange(string Media, string Drive);
- virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
- virtual void Fetch(pkgAcquire::ItemDesc &Itm);
- virtual void Done(pkgAcquire::ItemDesc &Itm);
- virtual void Fail(pkgAcquire::ItemDesc &Itm);
- virtual void Start();
- virtual void Stop();
-
- bool Pulse(pkgAcquire *Owner);
-
- void addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator> packagePair);
-
-private:
- PkBackend *m_backend;
- unsigned long ID;
- bool &_cancelled;
-
- unsigned long last_percent;
- unsigned long last_sub_percent;
- double last_CPS;
- string last_package_name;
- AptIntf *m_apt;
-
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > packages;
- set<string> currentPackages;
-
- void emit_package(const string &name, bool finished);
-};
-
-#endif
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
index 4798121..1b33679 100644
--- a/backends/aptcc/apt-intf.cpp
+++ b/backends/aptcc/apt-intf.cpp
@@ -23,15 +23,6 @@
#include "apt-intf.h"
-#include "apt-utils.h"
-#include "matcher.h"
-#include "gstMatcher.h"
-#include "apt-messages.h"
-#include "acqprogress.h"
-#include "pkg_acqfile.h"
-#include "deb-file.h"
-#include "dpkgpm.h"
-
#include <apt-pkg/error.h>
#include <apt-pkg/tagfile.h>
#include <apt-pkg/algorithms.h>
@@ -47,13 +38,22 @@
#include <sys/fcntl.h>
#include <pty.h>
-#define RAMFS_MAGIC 0x858458f6
-
#include <fstream>
#include <dirent.h>
#include <assert.h>
#include <regex.h>
+#include "apt-utils.h"
+#include "matcher.h"
+#include "gstMatcher.h"
+#include "apt-messages.h"
+#include "acqpkitstatus.h"
+#include "pkg_acqfile.h"
+#include "pkg_dpkgpm.h"
+#include "deb-file.h"
+
+#define RAMFS_MAGIC 0x858458f6
+
AptIntf::AptIntf(PkBackend *backend, bool &cancel)
:
packageRecords(0),
@@ -1272,7 +1272,7 @@ bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
return false;
}
-// emitChangedPackages - Show packages to newly install /*{{{*/
+// emitChangedPackages - Show packages to newly install
// ---------------------------------------------------------------------
/* */
void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
@@ -1638,7 +1638,7 @@ void AptIntf::updateInterface(int fd, int writeFd)
usleep(5000);
}
-// DoAutomaticRemove - Remove all automatic unused packages /*{{{*/
+// DoAutomaticRemove - Remove all automatic unused packages
// ---------------------------------------------------------------------
/* Remove unused automatic packages */
bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
@@ -1907,9 +1907,7 @@ bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate)
}
}
- /*}}}*/
-
-// InstallPackages - Actually download and install the packages /*{{{*/
+// InstallPackages - Download and install the packages
// ---------------------------------------------------------------------
/* This displays the informative messages describing what is going to
happen and then calls the download routines */
@@ -1979,7 +1977,7 @@ bool AptIntf::installPackages(pkgCacheFile &Cache)
// Create the package manager and prepare to download
// SPtr<pkgPackageManager> PM= _system->CreatePM(Cache);
- SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
+ SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
_error->PendingError() == true) {
return false;
@@ -2101,11 +2099,11 @@ cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
_system->UnLock();
- if (!m_localDebFile.empty()) {
- // add the local file name to be proccessed by the PM queue
- pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
- pm->addDebFile(m_localDebFile);
- }
+ if (!m_localDebFile.empty()) {
+ // add the local file name to be proccessed by the PM queue
+ pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
+ pm->addDebFile(m_localDebFile);
+ }
pkgPackageManager::OrderResult res;
res = PM->DoInstallPreFork();
diff --git a/backends/aptcc/deb-file.cpp b/backends/aptcc/deb-file.cpp
index 68da1d8..c68197a 100644
--- a/backends/aptcc/deb-file.cpp
+++ b/backends/aptcc/deb-file.cpp
@@ -1,6 +1,6 @@
-/*
+/* deb-file.cpp
*
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
*
* Licensed under the GNU General Public License Version 2
*
@@ -77,7 +77,7 @@ bool DebFile::check()
std::cout << architecture() << std::endl;
if (architecture().compare("all") != 0 &&
- architecture().compare(_config->Find("APT::Architecture")) != 0)
+ architecture().compare(_config->Find("APT::Architecture")) != 0)
{
m_errorMsg = "Wrong architecture ";
m_errorMsg.append(architecture());
@@ -92,35 +92,35 @@ bool DebFile::check()
// self._dbg(1, "ERROR: Wrong architecture dude!")
// self._failure_string = _("Wrong architecture '%s'") % arch
// return False
-//
+//
// // check version
// if self.compare_to_version_in_cache() == self.VERSION_OUTDATED:
// if self._cache[self.pkgname].installed:
// // the deb is older than the installed
// self._failure_string = _("A later version is already installed")
// return False
-//
+//
// // FIXME: this sort of error handling sux
// self._failure_string = ""
-//
+//
// // check conflicts
// if not self.check_conflicts():
// return False
-//
-// // check if installing it would break anything on the
+//
+// // check if installing it would break anything on the
// // current system
// if not self.check_breaks_existing_packages():
// return False
-//
+//
// // try to satisfy the dependencies
// if not self._satisfy_depends(self.depends):
// return False
-//
+//
// // check for conflicts again (this time with the packages that are
// // makeed for install)
// if not self.check_conflicts():
// return False
-//
+//
// if self._cache._depcache.broken_count > 0:
// self._failure_string = _("Failed to satisfy all dependencies "
// "(broken cache)")
diff --git a/backends/aptcc/deb-file.h b/backends/aptcc/deb-file.h
index 84e2ef9..8f6dbce 100644
--- a/backends/aptcc/deb-file.h
+++ b/backends/aptcc/deb-file.h
@@ -1,6 +1,6 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+/* deb-file.h
*
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (c) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
*
* Licensed under the GNU General Public License Version 2
*
@@ -36,7 +36,7 @@ public:
std::string version() const;
std::string architecture() const;
std::string conflicts() const;
-
+
// THIS should be moved to AptCC class
bool check();
std::string errorMsg() const;
diff --git a/backends/aptcc/dpkgpm.cpp b/backends/aptcc/dpkgpm.cpp
deleted file mode 100644
index ce490ea..0000000
--- a/backends/aptcc/dpkgpm.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "dpkgpm.h"
-
-#include <iostream>
-
-pkgDebDPkgPM::pkgDebDPkgPM(pkgDepCache *cache) :
- pkgDPkgPM(cache)
-{
-}
-
-void pkgDebDPkgPM::addDebFile(const std::string &filename)
-{
- PkgIterator pkg;
- std::cout << "PkgIterator " << pkg.end() << std::endl;
- Item item(Item::Install, pkg, filename);
- List.push_back(item);
-}
diff --git a/backends/aptcc/dpkgpm.h b/backends/aptcc/dpkgpm.h
deleted file mode 100644
index 730f29d..0000000
--- a/backends/aptcc/dpkgpm.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef DPKG_PM_H
-#define DPKG_PM_H
-
-#include <string>
-#include <apt-pkg/dpkgpm.h>
-
-class pkgDebDPkgPM : public pkgDPkgPM
-{
-public:
- pkgDebDPkgPM(pkgDepCache *cache);
-
- void addDebFile(const std::string &filename);
-};
-
-#endif
diff --git a/backends/aptcc/gstMatcher.cpp b/backends/aptcc/gstMatcher.cpp
index 7e5e1d6..4dd867c 100644
--- a/backends/aptcc/gstMatcher.cpp
+++ b/backends/aptcc/gstMatcher.cpp
@@ -1,20 +1,22 @@
-//
-// Copyright (C) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
+/* gstMatcher.cpp - Match GStreamer packages
+ *
+ * Copyright (c) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "gstMatcher.h"
diff --git a/backends/aptcc/gstMatcher.h b/backends/aptcc/gstMatcher.h
index 7f8ca7b..d6e18d7 100644
--- a/backends/aptcc/gstMatcher.h
+++ b/backends/aptcc/gstMatcher.h
@@ -1,21 +1,22 @@
-//
-// Copyright (C) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-//
+/* gstMatcher.h - Match GStreamer package names
+ *
+ * Copyright (c) 2010 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef GST_MATCHER_H
#define GST_MATCHER_H
diff --git a/backends/aptcc/matcher.cpp b/backends/aptcc/matcher.cpp
index 427b72e..4f88074 100644
--- a/backends/aptcc/matcher.cpp
+++ b/backends/aptcc/matcher.cpp
@@ -1,28 +1,30 @@
-// apt.cc
-//
-// Copyright 1999-2008 Daniel Burrows
-// Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
+/* matcher.cpp
+ *
+ * Copyright (c) 1999-2008 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#include "matcher.h"
#include <stdio.h>
#include <iostream>
-matcher::matcher(const string &matchers)
+Matcher::Matcher(const string &matchers)
: m_hasError(false)
{
string::const_iterator start = matchers.begin();
@@ -32,7 +34,7 @@ matcher::matcher(const string &matchers)
}
}
-matcher::~matcher()
+Matcher::~Matcher()
{
for (vector<regex_t>::iterator i=m_matches.begin();
i != m_matches.end(); ++i)
@@ -53,7 +55,7 @@ bool string_matches(const char *s, regex_t &pattern_nogroup)
return !regexec(&pattern_nogroup, s, 0, NULL, 0);
}
-bool matcher::matches(const string &s)
+bool Matcher::matches(const string &s)
{
int matchesCount = 0;
for (vector<regex_t>::iterator i=m_matches.begin();
@@ -68,7 +70,7 @@ bool matcher::matches(const string &s)
// This matcher is to be used for files
// pass a map so it can remember which patter was alread used
-bool matcher::matchesFile(const string &s, map<int, bool> &matchers_used)
+bool Matcher::matchesFile(const string &s, map<int, bool> &matchers_used)
{
int matchesCount = 0;
for (vector<regex_t>::iterator i = m_matches.begin();
@@ -87,7 +89,7 @@ bool matcher::matchesFile(const string &s, map<int, bool> &matchers_used)
return m_matches.size() == matchers_used.size();
}
-bool matcher::parse_pattern(string::const_iterator &start,
+bool Matcher::parse_pattern(string::const_iterator &start,
const std::string::const_iterator &end)
{
// Just filter blank strings out immediately.
@@ -130,7 +132,7 @@ bool matcher::parse_pattern(string::const_iterator &start,
}
-string matcher::parse_literal_string_tail(string::const_iterator &start,
+string Matcher::parse_literal_string_tail(string::const_iterator &start,
const string::const_iterator end)
{
std::string rval;
@@ -177,7 +179,7 @@ string matcher::parse_literal_string_tail(string::const_iterator &start,
// metacharacters (parentheses, ~, |, and !)
//
// Advances loc to the first character of 's' following the escaped string.
-string matcher::parse_substr(string::const_iterator &start,
+string Matcher::parse_substr(string::const_iterator &start,
const string::const_iterator &end)
{
std::string rval;
@@ -237,7 +239,7 @@ string matcher::parse_substr(string::const_iterator &start,
return rval;
}
-bool matcher::hasError() const
+bool Matcher::hasError() const
{
return m_hasError;
}
diff --git a/backends/aptcc/matcher.h b/backends/aptcc/matcher.h
index 9f334d3..e4d1cb2 100644
--- a/backends/aptcc/matcher.h
+++ b/backends/aptcc/matcher.h
@@ -1,23 +1,23 @@
-// apt.h -*-c++-*-
-//
-// Copyright 1999-2002, 2004-2005, 2007-2008 Daniel Burrows
-// Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-//
+/* matcher.h
+ *
+ * Copyright (c) 1999-2008 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
#ifndef MATCHER_H
#define MATCHER_H
@@ -30,11 +30,11 @@
using namespace std;
-class matcher
+class Matcher
{
public:
- matcher(const string &matchers);
- ~matcher();
+ Matcher(const string &matchers);
+ ~Matcher();
bool matches(const string &s);
bool matchesFile(const string &s, map<int, bool> &matchers_used);
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 3a95816..c3abb86 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -25,18 +25,18 @@
#include <apt-pkg/algorithms.h>
#include <apt-pkg/aptconfiguration.h>
+#include <config.h>
+#include <pk-backend.h>
+#include <pk-backend-spawn.h>
+
#include "apt-intf.h"
#include "apt-utils.h"
#include "matcher.h"
#include "apt-messages.h"
-#include "acqprogress.h"
+#include "acqpkitstatus.h"
#include "pkg_acqfile.h"
#include "apt-sourceslist.h"
-#include <config.h>
-#include <pk-backend.h>
-#include <pk-backend-spawn.h>
-
#define PREUPGRADE_BINARY "/usr/bin/do-release-upgrade"
#define GDEBI_BINARY "/usr/bin/gdebi"
@@ -969,7 +969,7 @@ backend_search_package_thread (PkBackend *backend)
pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
pk_backend_set_allow_cancel (backend, true);
- matcher *m_matcher = new matcher(search);
+ Matcher *m_matcher = new Matcher(search);
g_free(search);
if (m_matcher->hasError()) {
g_debug("Regex compilation error");
diff --git a/backends/aptcc/pkg_dpkgpm.cpp b/backends/aptcc/pkg_dpkgpm.cpp
new file mode 100644
index 0000000..4a495bd
--- /dev/null
+++ b/backends/aptcc/pkg_dpkgpm.cpp
@@ -0,0 +1,37 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "pkg_dpkgpm.h"
+
+#include <iostream>
+
+pkgDebDPkgPM::pkgDebDPkgPM(pkgDepCache *cache) :
+ pkgDPkgPM(cache)
+{
+}
+
+void pkgDebDPkgPM::addDebFile(const std::string &filename)
+{
+ PkgIterator pkg;
+ std::cout << "PkgIterator " << pkg.end() << std::endl;
+ Item item(Item::Install, pkg, filename);
+ List.push_back(item);
+}
diff --git a/backends/aptcc/pkg_dpkgpm.h b/backends/aptcc/pkg_dpkgpm.h
new file mode 100644
index 0000000..320ae61
--- /dev/null
+++ b/backends/aptcc/pkg_dpkgpm.h
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef DEB_DPKG_PM_H
+#define DEB_DPKG_PM_H
+
+#include <string>
+#include <apt-pkg/dpkgpm.h>
+
+class pkgDebDPkgPM : public pkgDPkgPM
+{
+public:
+ pkgDebDPkgPM(pkgDepCache *cache);
+
+ void addDebFile(const std::string &filename);
+};
+
+#endif
commit d9e6f528460f510d95f5dc998b2c952dea670621
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Mar 5 21:21:43 2012 +0100
Reorganise parts of AptCC to make the code more readable
* Proper license headers for most files
* Rename apt/aptcc -> AptIntf, to separate Apt components
from non-apt, backend specific parts
* Fix some indentation mistakes
* Fix some "broken" copy&paste parts of old Aptitude code
* Remove unused components
diff --git a/backends/aptcc/Makefile.am b/backends/aptcc/Makefile.am
index 415cd39..cc0274a 100644
--- a/backends/aptcc/Makefile.am
+++ b/backends/aptcc/Makefile.am
@@ -1,20 +1,19 @@
INCLUDES = \
- -DDATADIR=\"$(datadir)\" \
+ -DDATADIR=\"$(datadir)\" \
-DG_LOG_DOMAIN=\"PackageKit-Aptcc\"
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_aptcc.la
libpk_backend_aptcc_la_SOURCES = pkg_acqfile.cpp \
- aptcc_show_broken.cpp \
- aptcc_show_error.cpp \
- apt-utils.cpp \
acqprogress.cpp \
deb-file.cpp \
dpkgpm.cpp \
matcher.cpp \
gstMatcher.cpp \
- rsources.cpp \
- apt.cpp \
+ apt-messages.cpp \
+ apt-utils.cpp \
+ apt-sourceslist.cpp \
+ apt-intf.cpp \
pk-backend-aptcc.cpp
libpk_backend_aptcc_la_LIBADD = -lcrypt -lapt-pkg -lapt-inst $(PK_PLUGIN_LIBS)
libpk_backend_aptcc_la_LDFLAGS = -module -avoid-version $(APTCC_LIBS) $(GSTREAMER_LIBS)
@@ -25,17 +24,16 @@ aptconfdir = ${SYSCONFDIR}/apt/apt.conf.d
aptconf_DATA = 20packagekit
EXTRA_DIST = 20packagekit \
- apt.h \
+ apt-intf.h \
apt-utils.h \
+ apt-sourceslist.h \
gstMatcher.h \
matcher.h \
deb-file.h \
dpkgpm.h \
- aptcc_show_broken.h \
+ apt-messages.h \
acqprogress.h \
- aptcc_show_error.h \
- pkg_acqfile.h \
- rsources.h
+ pkg_acqfile.h
helperdir = $(datadir)/PackageKit/helpers/aptcc
dist_helper_DATA = \
diff --git a/backends/aptcc/acqprogress.cpp b/backends/aptcc/acqprogress.cpp
index cef398e..0374ce2 100644
--- a/backends/aptcc/acqprogress.cpp
+++ b/backends/aptcc/acqprogress.cpp
@@ -24,7 +24,7 @@ using namespace std;
// AcqPackageKitStatus::AcqPackageKitStatus - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */
-AcqPackageKitStatus::AcqPackageKitStatus(aptcc *apt, PkBackend *backend, bool &cancelled) :
+AcqPackageKitStatus::AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled) :
m_apt(apt),
m_backend(backend),
_cancelled(cancelled),
diff --git a/backends/aptcc/acqprogress.h b/backends/aptcc/acqprogress.h
index ccec64d..68c4499 100644
--- a/backends/aptcc/acqprogress.h
+++ b/backends/aptcc/acqprogress.h
@@ -13,12 +13,12 @@
#include <apt-pkg/acquire.h>
#include <pk-backend.h>
-#include "apt.h"
+#include "apt-intf.h"
class AcqPackageKitStatus : public pkgAcquireStatus
{
public:
- AcqPackageKitStatus(aptcc *apt, PkBackend *backend, bool &cancelled);
+ AcqPackageKitStatus(AptIntf *apt, PkBackend *backend, bool &cancelled);
virtual bool MediaChange(string Media, string Drive);
virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
@@ -41,7 +41,7 @@ private:
unsigned long last_sub_percent;
double last_CPS;
string last_package_name;
- aptcc *m_apt;
+ AptIntf *m_apt;
vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > packages;
set<string> currentPackages;
diff --git a/backends/aptcc/apt-intf.cpp b/backends/aptcc/apt-intf.cpp
new file mode 100644
index 0000000..4798121
--- /dev/null
+++ b/backends/aptcc/apt-intf.cpp
@@ -0,0 +1,2195 @@
+/* apt-intf.cpp
+ *
+ * Copyright (c) 1999-2008 Daniel Burrows
+ * Copyright (c) 2004 Michael Vogt <mvo at debian.org>
+ * 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "apt-intf.h"
+
+#include "apt-utils.h"
+#include "matcher.h"
+#include "gstMatcher.h"
+#include "apt-messages.h"
+#include "acqprogress.h"
+#include "pkg_acqfile.h"
+#include "deb-file.h"
+#include "dpkgpm.h"
+
+#include <apt-pkg/error.h>
+#include <apt-pkg/tagfile.h>
+#include <apt-pkg/algorithms.h>
+#include <apt-pkg/init.h>
+#include <apt-pkg/sptr.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/version.h>
+#include <apt-pkg/aptconfiguration.h>
+
+#include <sys/statvfs.h>
+#include <sys/statfs.h>
+#include <sys/wait.h>
+#include <sys/fcntl.h>
+#include <pty.h>
+
+#define RAMFS_MAGIC 0x858458f6
+
+#include <fstream>
+#include <dirent.h>
+#include <assert.h>
+#include <regex.h>
+
+AptIntf::AptIntf(PkBackend *backend, bool &cancel)
+ :
+ packageRecords(0),
+ packageCache(0),
+ packageDepCache(0),
+ packageSourceList(0),
+ Map(0),
+ Policy(0),
+ m_backend(backend),
+ _cancel(cancel),
+ m_terminalTimeout(120),
+ m_lastSubProgress(0)
+{
+ _cancel = false;
+}
+
+bool AptIntf::init()
+{
+ gchar *locale;
+ gchar *http_proxy;
+ gchar *ftp_proxy;
+
+ m_isMultiArch = APT::Configuration::getArchitectures(false).size() > 1;
+
+ // Set PackageKit status
+ pk_backend_set_status(m_backend, PK_STATUS_ENUM_LOADING_CACHE);
+
+ // set locale
+ if (locale = pk_backend_get_locale(m_backend)) {
+ setlocale(LC_ALL, locale);
+// TODO why this cuts characthers on ui?
+// string _locale(locale);
+// size_t found;
+// found = _locale.find('.');
+// _locale.erase(found);
+// _config->Set("APT::Acquire::Translation", _locale);
+ }
+
+ // set http proxy
+ http_proxy = pk_backend_get_proxy_http(m_backend);
+ setenv("http_proxy", http_proxy, 1);
+
+ // set ftp proxy
+ ftp_proxy = pk_backend_get_proxy_ftp(m_backend);
+ setenv("ftp_proxy", ftp_proxy, 1);
+
+ packageSourceList = new pkgSourceList;
+ // Read the source list
+ packageSourceList->ReadMainList();
+
+ // Generate it and map it
+ bool Res = pkgMakeStatusCache(*packageSourceList, Progress, &Map, true);
+ Progress.Done();
+ if(!Res) {
+ return false;
+ //"The package lists or status file could not be parsed or opened."
+ }
+
+ packageCache = new pkgCache(Map);
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ // create depcache
+ Policy = new pkgPolicy(packageCache);
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ if (!ReadPinFile(*Policy)) {
+ return false;
+ }
+
+ packageDepCache = new pkgDepCache(packageCache, Policy);
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ packageDepCache->Init(&Progress);
+ Progress.Done();
+ if (_error->PendingError()) {
+ return false;
+ }
+
+ // Create the text record parser
+ packageRecords = new pkgRecords(*packageDepCache);
+}
+
+AptIntf::~AptIntf()
+{
+ if (packageRecords)
+ {
+ g_debug ("~apt_init packageRecords");
+ delete packageRecords;
+ }
+
+ if (packageCache)
+ {
+ g_debug ("~apt_init packageCache");
+ delete packageCache;
+ }
+
+ if (packageDepCache)
+ {
+ g_debug ("~apt_init packageDepCache");
+ delete packageDepCache;
+ }
+
+ if (Policy)
+ {
+ g_debug ("~apt_init Policy");
+ delete Policy;
+ }
+
+ if (packageSourceList)
+ {
+ delete packageSourceList;
+ }
+
+ pk_backend_finished(m_backend);
+
+ delete Map;
+}
+
+void AptIntf::cancel()
+{
+ if (!_cancel) {
+ _cancel = true;
+ pk_backend_set_status(m_backend, PK_STATUS_ENUM_CANCEL);
+ }
+ if (m_child_pid > 0) {
+ kill(m_child_pid, SIGTERM);
+ }
+}
+
+pair<pkgCache::PkgIterator, pkgCache::VerIterator>
+ AptIntf::find_package_id(const gchar *package_id, bool &found)
+{
+ gchar **parts;
+ pkgCache::VerIterator ver;
+ pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
+
+ found = true;
+
+ parts = pk_package_id_split (package_id);
+ gchar *pkgNameArch;
+ pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
+ pkg_ver.first = packageCache->FindPkg(pkgNameArch);
+ g_free(pkgNameArch);
+
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (pkg_ver.first.end() == true ||
+ (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
+ {
+ g_strfreev (parts);
+ return pkg_ver;
+ }
+
+ ver = find_ver(pkg_ver.first);
+ // check to see if the provided package isn't virtual too
+ if (ver.end() == false &&
+ strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
+ {
+ g_strfreev (parts);
+ pkg_ver.second = ver;
+ return pkg_ver;
+ }
+
+ ver = find_candidate_ver(pkg_ver.first);
+ // check to see if the provided package isn't virtual too
+ if (ver.end() == false &&
+ strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
+ {
+ g_strfreev (parts);
+ pkg_ver.second = ver;
+ return pkg_ver;
+ }
+
+ found = false;
+ g_strfreev (parts);
+ return pkg_ver;
+}
+
+pkgCache::VerIterator AptIntf::find_candidate_ver(const pkgCache::PkgIterator &pkg)
+{
+ // get the candidate version iterator
+ return (*packageDepCache)[pkg].CandidateVerIter(*packageDepCache);
+}
+
+pkgCache::VerIterator AptIntf::find_ver(const pkgCache::PkgIterator &pkg)
+{
+ // if the package is installed return the current version
+ if(!pkg.CurrentVer().end()) {
+ return pkg.CurrentVer();
+ }
+
+ // Else get the candidate version iterator
+ pkgCache::VerIterator candver = find_candidate_ver(pkg);
+ if(!candver.end())
+ {
+ return candver;
+ }
+
+ // return the version list as a last resource
+ return pkg.VersionList();
+}
+
+// used to emit packages it collects all the needed info
+void AptIntf::emit_package(const pkgCache::PkgIterator &pkg,
+ const pkgCache::VerIterator &ver,
+ PkBitfield filters,
+ PkInfoEnum state)
+{
+ // check the state enum to see if it was not set.
+ if (state == PK_INFO_ENUM_UNKNOWN) {
+ if (pkg->CurrentState == pkgCache::State::Installed &&
+ pkg.CurrentVer() == ver) {
+ state = PK_INFO_ENUM_INSTALLED;
+ } else {
+ state = PK_INFO_ENUM_AVAILABLE;
+ }
+ }
+
+ if (m_isMultiArch &&
+ (pk_bitfield_contain(filters, PK_FILTER_ENUM_ARCH) && state == PK_INFO_ENUM_AVAILABLE)) {
+ // don't emit the package if it does not match
+ // the native architecture
+ if (strcmp(ver.Arch(), "all") != 0 &&
+ strcmp(ver.Arch(), _config->Find("APT::Architecture").c_str()) != 0) {
+ return;
+ }
+ }
+
+ if (filters != 0) {
+ std::string str = ver.Section() == NULL ? "" : ver.Section();
+ std::string section, repo_section;
+
+ size_t found;
+ found = str.find_last_of("/");
+ section = str.substr(found + 1);
+ repo_section = str.substr(0, found);
+
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)
+ && state == PK_INFO_ENUM_INSTALLED) {
+ return;
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)
+ && state == PK_INFO_ENUM_AVAILABLE) {
+ return;
+ }
+
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_DEVELOPMENT)) {
+ // if ver.end() means unknow
+ // strcmp will be true when it's different than devel
+ std::string pkgName = pkg.Name();
+ if (!ends_with(pkgName, "-dev") &&
+ !ends_with(pkgName, "-dbg") &&
+ section.compare("devel") &&
+ section.compare("libdevel")) {
+ return;
+ }
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_DEVELOPMENT)) {
+ std::string pkgName = pkg.Name();
+ if (ends_with(pkgName, "-dev") ||
+ ends_with(pkgName, "-dbg") ||
+ !section.compare("devel") ||
+ !section.compare("libdevel")) {
+ return;
+ }
+ }
+
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_GUI)) {
+ // if ver.end() means unknow
+ // strcmp will be true when it's different than x11
+ if (section.compare("x11") && section.compare("gnome") &&
+ section.compare("kde") && section.compare("graphics")) {
+ return;
+ }
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_GUI)) {
+ if (!section.compare("x11") || !section.compare("gnome") ||
+ !section.compare("kde") || !section.compare("graphics")) {
+ return;
+ }
+ }
+
+ // TODO add Ubuntu handling
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_FREE)) {
+ if (!repo_section.compare("contrib") ||
+ !repo_section.compare("non-free")) {
+ return;
+ }
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_FREE)) {
+ if (repo_section.compare("contrib") &&
+ repo_section.compare("non-free")) {
+ return;
+ }
+ }
+
+ // TODO test this one..
+ if (pk_bitfield_contain (filters, PK_FILTER_ENUM_COLLECTIONS)) {
+ if (!repo_section.compare("metapackages")) {
+ return;
+ }
+ } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_COLLECTIONS)) {
+ if (repo_section.compare("metapackages")) {
+ return;
+ }
+ }
+
+ }
+ pkgCache::VerFileIterator vf = ver.FileList();
+
+ gchar *package_id;
+ package_id = pk_package_id_build(pkg.Name(),
+ ver.VerStr(),
+ ver.Arch(),
+ vf.File().Archive() == NULL ? "" : vf.File().Archive());
+ pk_backend_package(m_backend,
+ state,
+ package_id,
+ get_short_description(ver, packageRecords).c_str());
+ g_free(package_id);
+}
+
+void AptIntf::emit_packages(PkgList &output,
+ PkBitfield filters,
+ PkInfoEnum state)
+{
+ // Sort so we can remove the duplicated entries
+ sort(output.begin(), output.end(), compare());
+ // Remove the duplicated entries
+ output.erase(unique(output.begin(),
+ output.end(),
+ result_equality()),
+ output.end());
+
+ for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
+ i != output.end(); ++i)
+ {
+ if (_cancel) {
+ break;
+ }
+ emit_package(i->first, i->second, filters, state);
+ }
+}
+
+void AptIntf::emitUpdates(PkgList &output, PkBitfield filters)
+{
+ PkInfoEnum state;
+ // Sort so we can remove the duplicated entries
+ sort(output.begin(), output.end(), compare());
+ // Remove the duplicated entries
+ output.erase(unique(output.begin(),
+ output.end(),
+ result_equality()),
+ output.end());
+
+ for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
+ i != output.end(); ++i)
+ {
+ if (_cancel) {
+ break;
+ }
+
+ // the default update info
+ state = PK_INFO_ENUM_NORMAL;
+
+ // let find what kind of upgrade this is
+ pkgCache::VerFileIterator vf = i->second.FileList();
+ std::string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
+ std::string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
+ std::string label = vf.File().Label() == NULL ? "" : vf.File().Label();
+ if (origin.compare("Debian") == 0 ||
+ origin.compare("Ubuntu") == 0) {
+ if (ends_with(archive, "-security") ||
+ label.compare("Debian-Security") == 0) {
+ state = PK_INFO_ENUM_SECURITY;
+ } else if (ends_with(archive, "-backports")) {
+ state = PK_INFO_ENUM_ENHANCEMENT;
+ } else if (ends_with(archive, "-updates")) {
+ state = PK_INFO_ENUM_BUGFIX;
+ }
+ } else if (origin.compare("Backports.org archive") == 0 ||
+ ends_with(origin, "-backports")) {
+ state = PK_INFO_ENUM_ENHANCEMENT;
+ }
+
+ emit_package(i->first, i->second, filters, state);
+ }
+}
+
+// search packages which provide a codec (specified in "values")
+void AptIntf::providesCodec(PkgList &output, gchar **values)
+{
+ GstMatcher *matcher = new GstMatcher(values);
+ if (!matcher->hasMatches()) {
+ return;
+ }
+
+ for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg)
+ {
+ if (_cancel) {
+ delete matcher;
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // TODO search in updates packages
+ // Ignore virtual packages
+ pkgCache::VerIterator ver = find_ver(pkg);
+ if (ver.end() == true) {
+ ver = find_candidate_ver(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ }
+
+ pkgCache::VerFileIterator vf = ver.FileList();
+ pkgRecords::Parser &rec = packageRecords->Lookup(vf);
+ const char *start, *stop;
+ rec.GetRec(start, stop);
+ string record(start, stop - start);
+ if (matcher->matches(record)) {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ }
+ }
+
+ delete matcher;
+}
+
+// search packages which provide the libraries specified in "values"
+void AptIntf::providesLibrary(PkgList &output, gchar **values)
+{
+ bool ret = false;
+ // Quick-check for library names
+ for (uint i = 0; i < g_strv_length(values); i++)
+ if (g_str_has_prefix (values[i], "lib")) {
+ ret = true;
+ break;
+ }
+ if (!ret)
+ return;
+
+ const char *libreg_str = "^\\(lib.*\\)\\.so\\.[0-9]*";
+ g_debug ("RegStr: %s", libreg_str);
+ regex_t libreg;
+ if(regcomp(&libreg, libreg_str, 0) != 0) {
+ g_debug("Regex compilation error: ", libreg);
+ return;
+ }
+
+ gchar *value;
+ for (uint i = 0; i < g_strv_length(values); i++) {
+ value = values[i];
+ regmatch_t matches[2];
+ if (regexec(&libreg, value, 2, matches, 0) != REG_NOMATCH) {
+ string libPkgName = string(value, matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
+
+ string strvalue = string(value);
+ ssize_t pos = strvalue.find (".so.");
+ if ((pos != string::npos) && (pos > 0)) {
+ // If last char is a number, add a "-" (to be policy-compliant)
+ if (g_ascii_isdigit (libPkgName.at (libPkgName.length () - 1)))
+ libPkgName.append ("-");
+
+ libPkgName.append (strvalue.substr (pos + 4));
+ }
+
+ g_debug ("pkg-name: %s", libPkgName.c_str ());
+
+ for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
+ // Ignore packages that exist only due to dependencies.
+ if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // TODO: Ignore virtual packages
+ pkgCache::VerIterator ver = find_ver (pkg);
+ if (ver.end() == true) {
+ ver = find_candidate_ver(pkg);
+ if (ver.end() == true) {
+ continue;
+ }
+ }
+
+ // Make everything lower-case
+ std::transform(libPkgName.begin(), libPkgName.end(), libPkgName.begin(), ::tolower);
+
+ if (g_strcmp0 (pkg.Name (), libPkgName.c_str ()) == 0) {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
+ }
+ }
+
+ } else {
+ g_debug("libmatcher: Did not match: %s", value);
+ }
+ }
+
+}
+
+// used to emit packages it collects all the needed info
+void AptIntf::emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
+{
+ pkgCache::VerIterator ver;
+ if (version.end() == false) {
+ ver = version;
+ } else {
+ ver = find_ver(pkg);
+ }
+ std::string section = ver.Section() == NULL ? "" : ver.Section();
+
+ size_t found;
+ found = section.find_last_of("/");
+ section = section.substr(found + 1);
+
+ pkgCache::VerFileIterator vf = ver.FileList();
+ pkgRecords::Parser &rec = packageRecords->Lookup(vf);
+
+ long size;
+ if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
+ // if the package is installed emit the installed size
+ size = ver->InstalledSize;
+ } else {
+ size = ver->Size;
+ }
+
+ gchar *package_id;
+ package_id = pk_package_id_build(pkg.Name(),
+ ver.VerStr(),
+ ver.Arch(),
+ vf.File().Archive() == NULL ? "" : vf.File().Archive());
+
+ pk_backend_details(m_backend,
+ package_id,
+ "unknown",
+ get_enum_group(section),
+ get_long_description_parsed(ver, packageRecords).c_str(),
+ rec.Homepage().c_str(),
+ size);
+
+ g_free(package_id);
+}
+
+void AptIntf::emitDetails(PkgList &pkgs)
+{
+ // Sort so we can remove the duplicated entries
+ sort(pkgs.begin(), pkgs.end(), compare());
+ // Remove the duplicated entries
+ pkgs.erase(unique(pkgs.begin(), pkgs.end(), result_equality()),
+ pkgs.end());
+
+ for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
+ {
+ if (_cancel) {
+ break;
+ }
+
+ emitDetails(i->first, i->second);
+ }
+}
+
+// used to emit packages it collects all the needed info
+void AptIntf::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
+{
+ // Get the version of the current package
+ pkgCache::VerIterator currver = find_ver(pkg);
+ pkgCache::VerFileIterator currvf = currver.FileList();
+ // Build a package_id from the current version
+ gchar *current_package_id;
+ current_package_id = pk_package_id_build(pkg.Name(),
+ currver.VerStr(),
+ currver.Arch(),
+ currvf.File().Archive() == NULL ? "" : currvf.File().Archive());
+
+ // Get the update version
+ pkgCache::VerIterator candver;
+ if (version.end() == false) {
+ candver = version;
+ } else {
+ candver = find_candidate_ver(pkg);
+ }
+
+ pkgCache::VerFileIterator vf = candver.FileList();
+ string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
+ pkgRecords::Parser &rec = packageRecords->Lookup(candver.FileList());
+
+ // Build the changelogURI
+ char uri[512];
+ string srcpkg;
+ string verstr;
+
+ if (rec.SourcePkg().empty()) {
+ srcpkg = pkg.Name();
+ } else {
+ srcpkg = rec.SourcePkg();
+ }
+ if (origin.compare("Debian") == 0 || origin.compare("Ubuntu") == 0) {
+ string prefix;
+
+ string src_section = candver.Section() == NULL ? "" : candver.Section();
+ if(src_section.find('/') != src_section.npos) {
+ src_section = string(src_section, 0, src_section.find('/'));
+ } else {
+ src_section = "main";
+ }
+
+ prefix += srcpkg[0];
+ if(srcpkg.size() > 3 && srcpkg[0] == 'l' && srcpkg[1] == 'i' && srcpkg[2] == 'b') {
+ prefix = string("lib") + srcpkg[3];
+ }
+
+ if(candver.VerStr() != NULL) {
+ verstr = candver.VerStr();
+ }
+
+ if(verstr.find(':') != verstr.npos) {
+ verstr = string(verstr, verstr.find(':') + 1);
+ }
+
+ if (origin.compare("Debian") == 0) {
+ snprintf(uri,
+ 512,
+ "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
+ prefix.c_str(),
+ srcpkg.c_str(),
+ srcpkg.c_str(),
+ verstr.c_str());
+ } else {
+ snprintf(uri,
+ 512,
+ "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
+ prefix.c_str(),
+ srcpkg.c_str(),
+ srcpkg.c_str(),
+ verstr.c_str());
+ }
+ } else {
+ string pkgfilename;
+ const char *start, *stop;
+ pkgTagSection sec;
+ unsigned long len;
+
+ rec.GetRec(start, stop);
+ len = stop - start;
+ // add +1 to ensure we have the double lineline in the buffer
+ if (start && sec.Scan(start, len + 1)) {
+ pkgfilename = sec.FindS("Filename");
+ }
+
+ string cadidateOriginSiteUrl;
+ if(!vf.end() && vf.File() && vf.File().Site()) {
+ cadidateOriginSiteUrl = vf.File().Site();
+ }
+
+ pkgfilename = pkgfilename.substr(0, pkgfilename.find_last_of('.')) + ".changelog";
+ snprintf(uri,512,"http://%s/%s",
+ cadidateOriginSiteUrl.c_str(),
+ pkgfilename.c_str());
+ }
+ // Create the download object
+ AcqPackageKitStatus Stat(this, m_backend, _cancel);
+
+ // get a fetcher
+ pkgAcquire fetcher;
+ fetcher.Setup(&Stat);
+
+ // fetch the changelog
+ pk_backend_set_status(m_backend, PK_STATUS_ENUM_DOWNLOAD_CHANGELOG);
+ string filename = getChangelogFile(pkg.Name(), origin, verstr, srcpkg, uri, &fetcher);
+
+ string changelog;
+ string update_text;
+ ifstream in(filename.c_str());
+ string line;
+ GRegex *regexVer;
+ regexVer = g_regex_new("(?'source'.+) \\((?'version'.*)\\) "
+ "(?'dist'.+); urgency=(?'urgency'.+)",
+ G_REGEX_CASELESS,
+ G_REGEX_MATCH_ANCHORED,
+ 0);
+ GRegex *regexDate;
+ regexDate = g_regex_new("^ -- (?'maintainer'.+) (?'mail'<.+>) (?'date'.+)$",
+ G_REGEX_CASELESS,
+ G_REGEX_MATCH_ANCHORED,
+ 0);
+ string updated;
+ string issued;
+ while (getline(in, line)) {
+ // no need to free str later, it is allocated in a static buffer
+ const char *str = utf8(line.c_str());
+ if (strcmp(str, "") == 0) {
+ changelog.append("\n");
+ continue;
+ } else {
+ changelog.append(str);
+ changelog.append("\n");
+ }
+
+ if (starts_with(str, srcpkg.c_str())) {
+ // Check to see if the the text isn't about the current package,
+ // otherwise add a == version ==
+ GMatchInfo *match_info;
+ if (g_regex_match(regexVer, str, G_REGEX_MATCH_ANCHORED, &match_info)) {
+ gchar *version;
+ version = g_match_info_fetch_named(match_info, "version");
+
+ // Compare if the current version is shown in the changelog, to not
+ // display old changelog information
+ if (_system != 0 &&
+ _system->VS->DoCmpVersion(version, version + strlen(version),
+ currver.VerStr(), currver.VerStr() + strlen(currver.VerStr())) <= 0) {
+ g_free (version);
+ break;
+ } else {
+ if (!update_text.empty()) {
+ update_text.append("\n\n");
+ }
+ update_text.append(" == ");
+ update_text.append(version);
+ update_text.append(" ==");
+ g_free (version);
+ }
+ }
+ g_match_info_free (match_info);
+ } else if (starts_with(str, " ")) {
+ // update descritption
+ update_text.append("\n");
+ update_text.append(str);
+ } else if (starts_with(str, " --")) {
+ // Parse the text to know when the update was issued,
+ // and when it got updated
+ GMatchInfo *match_info;
+ if (g_regex_match(regexDate, str, G_REGEX_MATCH_ANCHORED, &match_info)) {
+ GTimeVal dateTime = {0, 0};
+ gchar *date;
+ date = g_match_info_fetch_named(match_info, "date");
+ g_warn_if_fail(RFC1123StrToTime(date, dateTime.tv_sec));
+ g_free(date);
+
+ issued = g_time_val_to_iso8601(&dateTime);
+ if (updated.empty()) {
+ updated = g_time_val_to_iso8601(&dateTime);
+ }
+ }
+ g_match_info_free(match_info);
+ }
+ }
+ // Clean structures
+ g_regex_unref(regexVer);
+ g_regex_unref(regexDate);
+ unlink(filename.c_str());
+
+ // Check if the update was updates since it was issued
+ if (issued.compare(updated) == 0) {
+ updated = "";
+ }
+
+ // Build a package_id from the update version
+ string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
+ gchar *package_id;
+ package_id = pk_package_id_build(pkg.Name(),
+ candver.VerStr(),
+ candver.Arch(),
+ archive.c_str());
+
+ PkUpdateStateEnum updateState = PK_UPDATE_STATE_ENUM_UNKNOWN;
+ if (archive.compare("stable") == 0) {
+ updateState = PK_UPDATE_STATE_ENUM_STABLE;
+ } else if (archive.compare("testing") == 0) {
+ updateState = PK_UPDATE_STATE_ENUM_TESTING;
+ } else if (archive.compare("unstable") == 0 ||
+ archive.compare("experimental") == 0)
+ {
+ updateState = PK_UPDATE_STATE_ENUM_UNSTABLE;
+ }
+
+ PkRestartEnum restart = PK_RESTART_ENUM_NONE;
+ if (starts_with(pkg.Name(), "linux-image-") ||
+ starts_with(pkg.Name(), "nvidia-") ||
+ strcmp(pkg.Name(), "libc6") == 0 ||
+ strcmp(pkg.Name(), "dbus") == 0) {
+ restart = PK_RESTART_ENUM_SYSTEM;
+ }
+
+ pk_backend_update_detail(m_backend,
+ package_id,
+ current_package_id,//const gchar *updates
+ "",//const gchar *obsoletes
+ "",//const gchar *vendor_url
+ getBugzillaUrls(changelog).c_str(),//const gchar *bugzilla_url
+ getCVEUrls(changelog).c_str(),//const gchar *cve_url
+ restart,//PkRestartEnum restart
+ update_text.c_str(),//const gchar *update_text
+ changelog.c_str(),//const gchar *changelog
+ updateState,//PkUpdateStateEnum state
+ issued.c_str(), //const gchar *issued_text
+ updated.c_str() //const gchar *updated_text
+ );
+ g_free(current_package_id);
+ g_free(package_id);
+}
+
+void AptIntf::emitUpdateDetails(PkgList &pkgs)
+{
+ for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
+ {
+ if (_cancel) {
+ break;
+ }
+
+ emitUpdateDetails(i->first, i->second);
+ }
+}
+
+void AptIntf::get_depends(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive)
+{
+ pkgCache::DepIterator dep = find_ver(pkg).DependsList();
+ while (!dep.end()) {
+ if (_cancel) {
+ break;
+ }
+ pkgCache::VerIterator ver = find_ver(dep.TargetPkg());
+ // Ignore packages that exist only due to dependencies.
+ if (ver.end()) {
+ dep++;
+ continue;
+ } else if (dep->Type == pkgCache::Dep::Depends) {
+ if (recursive) {
+ if (!contains(output, dep.TargetPkg())) {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
+ get_depends(output, dep.TargetPkg(), recursive);
+ }
+ } else {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
+ }
+ }
+ dep++;
+ }
+}
+
+void AptIntf::get_requires(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive)
+{
+ for (pkgCache::PkgIterator parentPkg = packageCache->PkgBegin(); !parentPkg.end(); ++parentPkg) {
+ if (_cancel) {
+ break;
+ }
+ // Ignore packages that exist only due to dependencies.
+ if (parentPkg.VersionList().end() && parentPkg.ProvidesList().end()) {
+ continue;
+ }
+
+ // Don't insert virtual packages instead add what it provides
+ pkgCache::VerIterator ver = find_ver(parentPkg);
+ if (ver.end() == false) {
+ vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > deps;
+ get_depends(deps, parentPkg, false);
+ for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=deps.begin();
+ i != deps.end();
+ ++i)
+ {
+ if (i->first == pkg) {
+ if (recursive) {
+ if (!contains(output, parentPkg)) {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
+ get_requires(output, parentPkg, recursive);
+ }
+ } else {
+ output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
+vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel)
+{
+ vector<string> packageList;
+ regex_t re;
+ gchar *search;
+ gchar *values_str;
+
+ values_str = g_strjoinv("$|^", values);
+ search = g_strdup_printf("^%s$",
+ values_str);
+ g_free(values_str);
+ if(regcomp(&re, search, REG_NOSUB) != 0) {
+ g_debug("Regex compilation error");
+ g_free(search);
+ return vector<string>();
+ }
+ g_free(search);
+
+ DIR *dp;
+ struct dirent *dirp;
+ if (!(dp = opendir("/var/lib/dpkg/info/"))) {
+ g_debug ("Error opening /var/lib/dpkg/info/\n");
+ regfree(&re);
+ return vector<string>();
+ }
+
+ string line;
+ while ((dirp = readdir(dp)) != NULL) {
+ if (_cancel) {
+ break;
+ }
+ if (ends_with(dirp->d_name, ".list")) {
+ string f = "/var/lib/dpkg/info/" + string(dirp->d_name);
+ ifstream in(f.c_str());
+ if (!in != 0) {
+ continue;
+ }
+ while (!in.eof()) {
+ getline(in, line);
+ if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
+ string file(dirp->d_name);
+ packageList.push_back(file.erase(file.size() - 5, file.size()));
+ break;
+ }
+ }
+ }
+ }
+ closedir(dp);
+ regfree(&re);
+ return packageList;
+}
+
+// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
+vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel)
+{
+ vector<string> packageList;
+ regex_t re;
+ gchar *value;
+ gchar *values_str;
+
+ values_str = g_strjoinv("|", values);
+ value = g_strdup_printf("^MimeType=\\(.*;\\)\\?\\(%s\\)\\(;.*\\)\\?$",
+ values_str);
+ g_free(values_str);
+
+ if(regcomp(&re, value, REG_NOSUB) != 0) {
+ g_debug("Regex compilation error");
+ g_free(value);
+ return vector<string>();
+ }
+ g_free(value);
+
+ DIR *dp;
+ struct dirent *dirp;
+ if (!(dp = opendir("/usr/share/app-install/desktop/"))) {
+ g_debug ("Error opening /usr/share/app-install/desktop/\n");
+ regfree(&re);
+ error = true;
+ return vector<string>();
+ }
+
+ string line;
+ while ((dirp = readdir(dp)) != NULL) {
+ if (_cancel) {
+ break;
+ }
+ if (ends_with(dirp->d_name, ".desktop")) {
+ string f = "/usr/share/app-install/desktop/" + string(dirp->d_name);
+ ifstream in(f.c_str());
+ if (!in != 0) {
+ continue;
+ }
+ bool getName = false;
+ while (!in.eof()) {
+ getline(in, line);
+ if (getName) {
+ if (starts_with(line, "X-AppInstall-Package=")) {
+ // Remove the X-AppInstall-Package=
+ packageList.push_back(line.substr(21));
+ break;
+ }
+ } else {
+ if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
+ in.seekg(ios_base::beg);
+ getName = true;
+ }
+ }
+ }
+ }
+ }
+
+ closedir(dp);
+ regfree(&re);
+ return packageList;
+}
+
+// used to emit files it reads the info directly from the files
+void AptIntf::emitFiles(PkBackend *backend, const gchar *pi)
+{
+ static string filelist;
+ string line;
+ gchar **parts;
+
+ parts = pk_package_id_split (pi);
+ filelist.erase(filelist.begin(), filelist.end());
+
+ string fName;
+ if (m_isMultiArch) {
+ fName = "/var/lib/dpkg/info/" +
+ string(parts[PK_PACKAGE_ID_NAME]) +
+ ":" +
+ string(parts[PK_PACKAGE_ID_ARCH]) +
+ ".list";
+ } else {
+ fName = "/var/lib/dpkg/info/" +
+ string(parts[PK_PACKAGE_ID_NAME]) +
+ ".list";
+ }
+ g_strfreev (parts);
+
+ if (FileExists(fName)) {
+ ifstream in(fName.c_str());
+ if (!in != 0) {
+ return;
+ }
+ while (in.eof() == false && filelist.empty()) {
+ getline(in, line);
+ filelist += line;
+ }
+ while (in.eof() == false) {
+ getline(in, line);
+ if (!line.empty()) {
+ filelist += ";" + line;
+ }
+ }
+
+ if (!filelist.empty()) {
+ pk_backend_files (backend, pi, filelist.c_str());
+ }
+ }
+}
+
+static bool checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
+{
+ string UntrustedList;
+ for (pkgAcquire::ItemIterator I = fetcher.ItemsBegin(); I < fetcher.ItemsEnd(); ++I)
+ {
+ if (!(*I)->IsTrusted())
+ {
+ UntrustedList += string((*I)->ShortDesc()) + " ";
+ }
+ }
+
+ if (UntrustedList == "")
+ {
+ return true;
+ }
+
+ if (pk_backend_get_bool(backend, "only_trusted") == false ||
+ _config->FindB("APT::Get::AllowUnauthenticated", false) == true)
+ {
+ g_debug ("Authentication warning overridden.\n");
+ return true;
+ }
+
+ string warning("The following packages cannot be authenticated:\n");
+ warning += UntrustedList;
+ pk_backend_error_code(backend,
+ PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED,
+ warning.c_str());
+ _error->Discard();
+ return false;
+}
+
+bool AptIntf::TryToInstall(pkgCache::PkgIterator Pkg,
+ pkgDepCache &Cache,
+ pkgProblemResolver &Fix,
+ bool Remove,
+ bool BrokenFix,
+ unsigned int &ExpectedInst)
+{
+ // This is a pure virtual package and there is a single available provides
+ if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
+ Pkg.ProvidesList()->NextProvides == 0)
+ {
+ pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
+ Pkg = Tmp;
+ }
+
+ // Check if there is something at all to install
+ pkgDepCache::StateCache &State = Cache[Pkg];
+ if (Remove == true && Pkg->CurrentVer == 0)
+ {
+ Fix.Clear(Pkg);
+ Fix.Protect(Pkg);
+ Fix.Remove(Pkg);
+
+ return true;
+ }
+
+ if (State.CandidateVer == 0 && Remove == false)
+ {
+ _error->Error("Package %s is virtual and has no installation candidate", Pkg.Name());
+
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,
+ g_strdup_printf("Package %s is virtual and has no "
+ "installation candidate",
+ Pkg.Name()));
+ return false;
+ }
+
+ Fix.Clear(Pkg);
+ Fix.Protect(Pkg);
+ if (Remove == true)
+ {
+ Fix.Remove(Pkg);
+ Cache.MarkDelete(Pkg,_config->FindB("APT::Get::Purge", false));
+ return true;
+ }
+
+ // Install it
+ Cache.MarkInstall(Pkg,false);
+ if (State.Install() == false)
+ {
+ if (_config->FindB("APT::Get::ReInstall",false) == true) {
+ if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false) {
+ // ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
+ // Pkg.Name());
+ ;
+ } else {
+ Cache.SetReInstall(Pkg,true);
+ }
+ } else {
+ // if (AllowFail == true)
+ // ioprintf(c1out,_("%s is already the newest version.\n"),
+ // Pkg.Name());
+ }
+ } else {
+ ExpectedInst++;
+ }
+
+// cout << "trytoinstall ExpectedInst " << ExpectedInst << endl;
+ // Install it with autoinstalling enabled (if we not respect the minial
+ // required deps or the policy)
+ if ((State.InstBroken() == true || State.InstPolicyBroken() == true) &&
+ BrokenFix == false) {
+ Cache.MarkInstall(Pkg,true);
+ }
+
+ return true;
+}
+
+// checks if there are Essential packages being removed
+bool AptIntf::removingEssentialPackages(pkgCacheFile &Cache)
+{
+ string List;
+ bool *Added = new bool[Cache->Head().PackageCount];
+ for (unsigned int I = 0; I != Cache->Head().PackageCount; I++){
+ Added[I] = false;
+ }
+
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
+ if ((I->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
+ (I->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important) {
+ continue;
+ }
+
+ if (Cache[I].Delete() == true) {
+ if (Added[I->ID] == false) {
+ Added[I->ID] = true;
+ List += string(I.Name()) + " ";
+ }
+ }
+
+ if (I->CurrentVer == 0) {
+ continue;
+ }
+
+ // Print out any essential package depenendents that are to be removed
+ for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; D++) {
+ // Skip everything but depends
+ if (D->Type != pkgCache::Dep::PreDepends &&
+ D->Type != pkgCache::Dep::Depends){
+ continue;
+ }
+
+ pkgCache::PkgIterator P = D.SmartTargetPkg();
+ if (Cache[P].Delete() == true)
+ {
+ if (Added[P->ID] == true){
+ continue;
+ }
+ Added[P->ID] = true;
+
+ char S[300];
+ snprintf(S, sizeof(S), "%s (due to %s) ", P.Name(), I.Name());
+ List += S;
+ }
+ }
+ }
+
+ delete [] Added;
+ if (!List.empty()) {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE,
+ g_strdup_printf("WARNING: You are trying to remove the "
+ "following essential packages: %s",
+ List.c_str()));
+ return true;
+ }
+
+ return false;
+}
+
+// emitChangedPackages - Show packages to newly install /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void AptIntf::emitChangedPackages(pkgCacheFile &Cache)
+{
+ vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > installing,
+ removing,
+ updating,
+ downgrading;
+
+ string VersionsList;
+ for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg)
+ {
+ if (Cache[pkg].NewInstall() == true) {
+ // installing
+ installing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Delete() == true) {
+ // removing
+ removing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
+ } else if (Cache[pkg].Upgrade() == true) {
+ // updating
+ updating.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Downgrade() == true) {
+ // downgrading
+ downgrading.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ }
+ }
+
+ // emit packages that have changes
+ emit_packages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
+ emit_packages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
+ emit_packages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
+ emit_packages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
+}
+
+void AptIntf::populateInternalPackages(pkgCacheFile &Cache)
+{
+ for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
+ if (Cache[pkg].NewInstall() == true) {
+ // installing
+ m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Delete() == true) {
+ // removing
+ m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
+ } else if (Cache[pkg].Upgrade() == true) {
+ // updating
+ m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ } else if (Cache[pkg].Downgrade() == true) {
+ // downgrading
+ m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
+ }
+ }
+}
+
+void AptIntf::emitTransactionPackage(string name, PkInfoEnum state)
+{
+ for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=m_pkgs.begin();
+ i != m_pkgs.end();
+ ++i)
+ {
+ if (i->first.Name() == name) {
+ emit_package(i->first, i->second, PK_FILTER_ENUM_NONE, state);
+ return;
+ }
+ }
+
+ pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
+ pkg_ver.first = packageCache->FindPkg(name);
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (pkg_ver.first.end() == true ||
+ (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
+ {
+ return;
+ }
+
+ pkg_ver.second = find_ver(pkg_ver.first);
+ // check to see if the provided package isn't virtual too
+ if (pkg_ver.second.end() == false)
+ {
+ emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
+ }
+
+ pkg_ver.second = find_candidate_ver(pkg_ver.first);
+ // check to see if we found the package
+ if (pkg_ver.second.end() == false)
+ {
+ emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
+ }
+}
+
+void AptIntf::updateInterface(int fd, int writeFd)
+{
+ char buf[2];
+ static char line[1024] = "";
+
+ while (1) {
+ // This algorithm should be improved (it's the same as the rpm one ;)
+ int len = read(fd, buf, 1);
+
+ // nothing was read
+ if(len < 1) {
+ break;
+ }
+
+ // update the time we last saw some action
+ m_lastTermAction = time(NULL);
+
+ if( buf[0] == '\n') {
+ if (_cancel) {
+ kill(m_child_pid, SIGTERM);
+ }
+ //cout << "got line: " << line << endl;
+
+ gchar **split = g_strsplit(line, ":",5);
+ gchar *status = g_strstrip(split[0]);
+ gchar *pkg = g_strstrip(split[1]);
+ gchar *percent = g_strstrip(split[2]);
+ gchar *str = g_strdup(g_strstrip(split[3]));
+
+ // major problem here, we got unexpected input. should _never_ happen
+ if(!(pkg && status)) {
+ continue;
+ }
+
+ // first check for errors and conf-file prompts
+ if (strstr(status, "pmerror") != NULL) {
+ // error from dpkg
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL,
+ str);
+ } else if (strstr(status, "pmconffile") != NULL) {
+ // conffile-request from dpkg, needs to be parsed different
+ int i=0;
+ int count=0;
+ string orig_file, new_file;
+
+ // go to first ' and read until the end
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ /*nothing*/
+ ;
+ i++;
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ orig_file.append(1, str[i]);
+ i++;
+
+ // same for second ' and read until the end
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ /*nothing*/
+ ;
+ i++;
+ for(;str[i] != '\'' || str[i] == 0; i++)
+ new_file.append(1, str[i]);
+ i++;
+
+ gchar *filename;
+ filename = g_build_filename(DATADIR, "PackageKit", "helpers", "aptcc", "pkconffile", NULL);
+ gchar **argv;
+ gchar **envp;
+ GError *error = NULL;
+ argv = (gchar **) g_malloc(5 * sizeof(gchar *));
+ argv[0] = filename;
+ argv[1] = g_strdup(m_lastPackage.c_str());
+ argv[2] = g_strdup(orig_file.c_str());
+ argv[3] = g_strdup(new_file.c_str());
+ argv[4] = NULL;
+
+ gchar *socket;
+ if (socket = pk_backend_get_frontend_socket(m_backend)) {
+ envp = (gchar **) g_malloc(3 * sizeof(gchar *));
+ envp[0] = g_strdup("DEBIAN_FRONTEND=passthrough");
+ envp[1] = g_strdup_printf("DEBCONF_PIPE=%s", socket);
+ envp[2] = NULL;
+ } else {
+ // we don't have a socket set, let's fallback to noninteractive
+ envp = (gchar **) g_malloc(2 * sizeof(gchar *));
+ envp[0] = g_strdup("DEBIAN_FRONTEND=noninteractive");
+ envp[1] = NULL;
+ }
+
+ gboolean ret;
+ gint exitStatus;
+ ret = g_spawn_sync(NULL, // working dir
+ argv, // argv
+ envp, // envp
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+ NULL, // child_setup
+ NULL, // user_data
+ NULL, // standard_output
+ NULL, // standard_error
+ &exitStatus,
+ &error);
+
+ int exit_code = WEXITSTATUS(exitStatus);
+ cout << filename << " " << exit_code << " ret: "<< ret << endl;
+
+ if (exit_code == 10) {
+ // 1 means the user wants the package config
+ if (write(writeFd, "Y\n", 2) != 2) {
+ // TODO we need a DPKG patch to use debconf
+ g_debug("Failed to write");
+ }
+ } else if (exit_code == 20) {
+ // 2 means the user wants to keep the current config
+ if (write(writeFd, "N\n", 2) != 2) {
+ // TODO we need a DPKG patch to use debconf
+ g_debug("Failed to write");
+ }
+ } else {
+ // either the user didn't choose an option or the front end failed'
+ gchar *confmsg;
+ confmsg = g_strdup_printf("The configuration file '%s' "
+ "(modified by you or a script) "
+ "has a newer version '%s'.\n"
+ "Please verify your changes and update it manually.",
+ orig_file.c_str(),
+ new_file.c_str());
+ pk_backend_message(m_backend,
+ PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED,
+ confmsg);
+ // fall back to keep the current config file
+ if (write(writeFd, "N\n", 2) != 2) {
+ // TODO we need a DPKG patch to use debconf
+ g_debug("Failed to write");
+ }
+ }
+ } else if (strstr(status, "pmstatus") != NULL) {
+ // INSTALL & UPDATE
+ // - Running dpkg
+ // loops ALL
+ // - 0 Installing pkg (sometimes this is skiped)
+ // - 25 Preparing pkg
+ // - 50 Unpacking pkg
+ // - 75 Preparing to configure pkg
+ // ** Some pkgs have
+ // - Running post-installation
+ // - Running dpkg
+ // reloops all
+ // - 0 Configuring pkg
+ // - +25 Configuring pkg (SOMETIMES)
+ // - 100 Installed pkg
+ // after all
+ // - Running post-installation
+
+ // REMOVE
+ // - Running dpkg
+ // loops
+ // - 25 Removing pkg
+ // - 50 Preparing for removal of pkg
+ // - 75 Removing pkg
+ // - 100 Removed pkg
+ // after all
+ // - Running post-installation
+
+ // Let's start parsing the status:
+ if (starts_with(str, "Preparing to configure")) {
+ // Preparing to Install/configure
+// cout << "Found Preparing to configure! " << line << endl;
+ // The next item might be Configuring so better it be 100
+ m_lastSubProgress = 100;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
+ pk_backend_set_sub_percentage(m_backend, 75);
+ } else if (starts_with(str, "Preparing for removal")) {
+ // Preparing to Install/configure
+// cout << "Found Preparing for removal! " << line << endl;
+ m_lastSubProgress = 50;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
+ pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
+ } else if (starts_with(str, "Preparing")) {
+ // Preparing to Install/configure
+// cout << "Found Preparing! " << line << endl;
+ // if last package is different then finish it
+ if (!m_lastPackage.empty() && m_lastPackage.compare(pkg) != 0) {
+// cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ }
+ emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
+ pk_backend_set_sub_percentage(m_backend, 25);
+ } else if (starts_with(str, "Unpacking")) {
+// cout << "Found Unpacking! " << line << endl;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_DECOMPRESSING);
+ pk_backend_set_sub_percentage(m_backend, 50);
+ } else if (starts_with(str, "Configuring")) {
+ // Installing Package
+// cout << "Found Configuring! " << line << endl;
+ if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
+ cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ m_lastSubProgress = 0;
+ }
+ emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
+ pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
+ m_lastSubProgress += 25;
+ } else if (starts_with(str, "Running dpkg")) {
+// cout << "Found Running dpkg! " << line << endl;
+ } else if (starts_with(str, "Running")) {
+// cout << "Found Running! " << line << endl;
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_COMMIT);
+ } else if (starts_with(str, "Installing")) {
+// cout << "Found Installing! " << line << endl;
+ // FINISH the last package
+ if (!m_lastPackage.empty()) {
+// cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ }
+ m_lastSubProgress = 0;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
+ pk_backend_set_sub_percentage(m_backend, 0);
+ } else if (starts_with(str, "Removing")) {
+// cout << "Found Removing! " << line << endl;
+ if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
+// cout << "FINISH the last package: " << m_lastPackage << endl;
+ emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
+ }
+ m_lastSubProgress += 25;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
+ pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
+ } else if (starts_with(str, "Installed") ||
+ starts_with(str, "Removed")) {
+// cout << "Found FINISHED! " << line << endl;
+ m_lastSubProgress = 100;
+ emitTransactionPackage(pkg, PK_INFO_ENUM_FINISHED);
+ } else {
+ cout << ">>>Unmaped value<<< :" << line << endl;
+ }
+
+ if (!starts_with(str, "Running")) {
+ m_lastPackage = pkg;
+ }
+ m_startCounting = true;
+ } else {
+ m_startCounting = true;
+ }
+
+ int val = atoi(percent);
+ //cout << "progress: " << val << endl;
+ pk_backend_set_percentage(m_backend, val);
+
+ // clean-up
+ g_strfreev(split);
+ g_free(str);
+ line[0] = 0;
+ } else {
+ buf[1] = 0;
+ strcat(line, buf);
+ }
+ }
+
+ time_t now = time(NULL);
+
+ if(!m_startCounting) {
+ usleep(100000);
+ // wait until we get the first message from apt
+ m_lastTermAction = now;
+ }
+
+ if ((now - m_lastTermAction) > m_terminalTimeout) {
+ // get some debug info
+ g_warning("no statusfd changes/content updates in terminal for %i"
+ " seconds",m_terminalTimeout);
+ m_lastTermAction = time(NULL);
+ }
+
+ // sleep for a while to don't obcess over it
+ usleep(5000);
+}
+
+// DoAutomaticRemove - Remove all automatic unused packages /*{{{*/
+// ---------------------------------------------------------------------
+/* Remove unused automatic packages */
+bool AptIntf::DoAutomaticRemove(pkgCacheFile &Cache)
+{
+ bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
+ pkgDepCache::ActionGroup group(*Cache);
+
+ if (_config->FindB("APT::Get::Remove",true) == false &&
+ doAutoRemove == true)
+ {
+ cout << "We are not supposed to delete stuff, can't start "
+ "AutoRemover" << endl;
+ doAutoRemove = false;
+ }
+
+ // look over the cache to see what can be removed
+ for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
+ {
+ if (Cache[Pkg].Garbage && doAutoRemove)
+ {
+ if (Pkg.CurrentVer() != 0 &&
+ Pkg->CurrentState != pkgCache::State::ConfigFiles) {
+ Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
+ } else {
+ Cache->MarkKeep(Pkg, false, false);
+ }
+ }
+ }
+
+ // Now see if we destroyed anything
+ if (Cache->BrokenCount() != 0)
+ {
+ cout << "Hmm, seems like the AutoRemover destroyed something which really\n"
+ "shouldn't happen. Please file a bug report against apt." << endl;
+ // TODO call show_broken
+ // ShowBroken(c1out,Cache,false);
+ return _error->Error("Internal Error, AutoRemover broke stuff");
+ }
+ return true;
+}
+
+PkgList AptIntf::resolvePI(gchar **package_ids)
+{
+ gchar *pi;
+ PkgList ret;
+
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_QUERY);
+
+ // Don't fail if package list is empty
+ if (package_ids == NULL)
+ return ret;
+
+ for (uint i = 0; i < g_strv_length(package_ids); i++) {
+ if (_cancel) {
+ break;
+ }
+
+ PkgPair pair;
+ pi = package_ids[i];
+
+ if (pk_package_id_check(pi) == false) {
+ pair.first = packageCache->FindPkg(pi);
+ // Ignore packages that could not be found or that exist only due to dependencies.
+ if (pair.first.end() == true ||
+ (pair.first.VersionList().end() && pair.first.ProvidesList().end())) {
+ continue;
+ }
+
+ pair.second = find_ver(pair.first);
+ // check to see if the provided package isn't virtual too
+ if (pair.second.end() == false) {
+ ret.push_back(pair);
+ }
+
+ pair.second = find_candidate_ver(pair.first);
+ // check to see if the provided package isn't virtual too
+ if (pair.second.end() == false) {
+ ret.push_back(pair);
+ }
+ } else {
+ bool found;
+ pair = find_package_id(pi, found);
+ // check to see if we found the package
+ if (found) {
+ ret.push_back(pair);
+ }
+ }
+ }
+ return ret;
+}
+
+bool AptIntf::markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
+{
+ // We call gdebi to tell us what do we need to install/remove
+ // in order to be able to install this package
+ gint status;
+ gchar **argv;
+ gchar **envp;
+ gchar *std_out;
+ gchar *std_err;
+ GError *gerror = NULL;
+ argv = (gchar **) g_malloc(5 * sizeof(gchar *));
+ argv[0] = g_strdup("/usr/bin/gdebi");
+ argv[1] = g_strdup("-q");
+ argv[2] = g_strdup("--apt-line");
+ argv[3] = g_strdup(file);
+ argv[4] = NULL;
+
+ gboolean ret;
+ ret = g_spawn_sync(NULL, // working dir
+ argv, // argv
+ envp, // envp
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+ NULL, // child_setup
+ NULL, // user_data
+ &std_out, // standard_output
+ &std_err, // standard_error
+ &status,
+ &gerror);
+ int exit_code = WEXITSTATUS(status);
+// cout << "DebStatus " << exit_code << " WEXITSTATUS " << WEXITSTATUS(status) << " ret: "<< ret << endl;
+ cout << "std_out " << strlen(std_out) << std_out << endl;
+ cout << "std_err " << strlen(std_err) << std_err << endl;
+
+ PkgList pkgs;
+ if (exit_code == 1) {
+ if (strlen(std_out) == 0) {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_err);
+ } else {
+ pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_out);
+ }
+ return false;
+ } else {
+ // GDebi outputs two lines
+ gchar **lines = g_strsplit(std_out, "\n", 3);
+
+ // The first line contains the packages to install
+ gchar **installPkgs = g_strsplit(lines[0], " ", 0);
+
+ // The second line contains the packages to remove with '-' appended to
+ // the end of the package name
+ gchar **removePkgs = NULL;
+ if (strlen(lines[1]) > 0) {
+ gchar *removeStr = g_strndup(lines[1], strlen(lines[1]) - 1);
+ removePkgs = g_strsplit(removeStr, "- ", 0);
+ g_free(removeStr);
+ }
+
+ // Store the changes
+ install = resolvePI(installPkgs);
+ remove = resolvePI(removePkgs);
+ m_localDebFile = file;
+
+ g_strfreev(lines);
+ g_strfreev(installPkgs);
+ g_strfreev(removePkgs);
+ }
+
+ return true;
+}
+
+bool AptIntf::runTransaction(PkgList &install, PkgList &remove, bool simulate)
+{
+ //cout << "runTransaction" << simulate << remove << endl;
+ bool WithLock = !simulate; // Check to see if we are just simulating,
+ //since for that no lock is needed
+
+ pkgCacheFile Cache;
+ OpTextProgress Prog(*_config);
+ int timeout = 10;
+ // TODO test this
+ while (Cache.Open(&Prog, WithLock) == false) {
+ // failed to open cache, try checkDeps then..
+ // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
+ if (WithLock == false || (timeout <= 0)) {
+ show_errors(m_backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
+ return false;
+ } else {
+ _error->Discard();
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
+ sleep(1);
+ timeout--;
+ }
+ }
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
+
+ // Enter the special broken fixing mode if the user specified arguments
+ bool BrokenFix = false;
+ if (Cache->BrokenCount() != 0) {
+ BrokenFix = true;
+ }
+
+ unsigned int ExpectedInst = 0;
+ pkgProblemResolver Fix(Cache);
+
+ // new scope for the ActionGroup
+ {
+ pkgDepCache::ActionGroup group(Cache);
+ for(PkgList::iterator i = install.begin(); i != install.end(); ++i) {
+ pkgCache::PkgIterator Pkg = i->first;
+ if (_cancel) {
+ break;
+ }
+
+ if (TryToInstall(Pkg,
+ Cache,
+ Fix,
+ false, // remove
+ BrokenFix,
+ ExpectedInst) == false) {
+ return false;
+ }
+ }
+
+ for(PkgList::iterator i = remove.begin(); i != remove.end(); ++i) {
+ pkgCache::PkgIterator Pkg = i->first;
+ if (_cancel) {
+ break;
+ }
+
+ if (TryToInstall(Pkg,
+ Cache,
+ Fix,
+ true, // remove
+ BrokenFix,
+ ExpectedInst) == false) {
+ return false;
+ }
+ }
+
+ // Call the scored problem resolver
+ Fix.InstallProtect();
+ if (Fix.Resolve(true) == false) {
+ _error->Discard();
+ }
+
+ // Now we check the state of the packages,
+ if (Cache->BrokenCount() != 0)
+ {
+ // if the problem resolver could not fix all broken things
+ // show what is broken
+ show_broken(m_backend, Cache, false);
+ return false;
+ }
+ }
+ // Try to auto-remove packages
+ if (!DoAutomaticRemove(Cache)) {
+ // TODO
+ return false;
+ }
+
+ // check for essential packages!!!
+ if (removingEssentialPackages(Cache)) {
+ return false;
+ }
+
+ if (simulate) {
+ // Print out a list of packages that are going to be installed extra
+ emitChangedPackages(Cache);
+ return true;
+ } else {
+ // Store the packages that are going to change
+ // so we can emit them as we process it.
+ populateInternalPackages(Cache);
+ return installPackages(Cache);
+ }
+}
+
+ /*}}}*/
+
+// InstallPackages - Actually download and install the packages /*{{{*/
+// ---------------------------------------------------------------------
+/* This displays the informative messages describing what is going to
+ happen and then calls the download routines */
+bool AptIntf::installPackages(pkgCacheFile &Cache)
+{
+ //cout << "installPackages() called" << endl;
+ if (_config->FindB("APT::Get::Purge",false) == true)
+ {
+ pkgCache::PkgIterator I = Cache->PkgBegin();
+ for (; I.end() == false; I++)
+ {
+ if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete) {
+ Cache->MarkDelete(I,true);
+ }
+ }
+ }
+
+ // check for essential packages!!!
+ if (removingEssentialPackages(Cache)) {
+ return false;
+ }
+
+ // Sanity check
+ if (Cache->BrokenCount() != 0)
+ {
+ // TODO
+ show_broken(m_backend, Cache, false);
+ _error->Error("Internal error, InstallPackages was called with broken packages!");
+ return false;
+ }
+
+ if (Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
+ Cache->BadCount() == 0) {
+ return true;
+ }
+
+ // No remove flag
+ if (Cache->DelCount() != 0 && _config->FindB("APT::Get::Remove", true) == false) {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE,
+ "Packages need to be removed but remove is disabled.");
+ return false;
+ }
+
+ // Create the text record parser
+ pkgRecords Recs(Cache);
+ if (_error->PendingError() == true) {
+ return false;
+ }
+
+ // Lock the archive directory
+ FileFd Lock;
+ if (_config->FindB("Debug::NoLocking", false) == false)
+ {
+ Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
+ if (_error->PendingError() == true) {
+ return _error->Error("Unable to lock the download directory");
+ }
+ }
+
+ // Create the download object
+ AcqPackageKitStatus Stat(this, m_backend, _cancel);
+
+ // get a fetcher
+ pkgAcquire fetcher;
+ fetcher.Setup(&Stat);
+
+ // Create the package manager and prepare to download
+// SPtr<pkgPackageManager> PM= _system->CreatePM(Cache);
+ SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
+ if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
+ _error->PendingError() == true) {
+ return false;
+ }
+
+ // Generate the list of affected packages and sort it
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; I++)
+ {
+ // Ignore no-version packages
+ if (I->VersionList == 0) {
+ continue;
+ }
+
+ // Not interesting
+ if ((Cache[I].Keep() == true ||
+ Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
+ I.State() == pkgCache::PkgIterator::NeedsNothing &&
+ (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
+ (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
+ (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
+ {
+ continue;
+ }
+
+ // Append it to the list
+ Stat.addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(I, Cache[I].InstVerIter(Cache)));
+ }
+
+ // Display statistics
+ double FetchBytes = fetcher.FetchNeeded();
+ double FetchPBytes = fetcher.PartialPresent();
+ double DebBytes = fetcher.TotalNeeded();
+ if (DebBytes != Cache->DebSize())
+ {
+ cout << DebBytes << ',' << Cache->DebSize() << endl;
+cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
+/* _error->Warning("How odd.. The sizes didn't match, email apt at packages.debian.org");*/
+ }
+
+ // Number of bytes
+// if (DebBytes != FetchBytes)
+// ioprintf(c1out, "Need to get %sB/%sB of archives.\n",
+// SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
+// else if (DebBytes != 0)
+// ioprintf(c1out, "Need to get %sB of archives.\n",
+// SizeToStr(DebBytes).c_str());
+
+ // Size delta
+// if (Cache->UsrSize() >= 0)
+// ioprintf(c1out, "After this operation, %sB of additional disk space will be used.\n",
+// SizeToStr(Cache->UsrSize()).c_str());
+// else
+// ioprintf(c1out, "After this operation, %sB disk space will be freed.\n",
+// SizeToStr(-1*Cache->UsrSize()).c_str());
+
+ if (_error->PendingError() == true) {
+ cout << "PendingError " << endl;
+ return false;
+ }
+
+ /* Check for enough free space */
+ struct statvfs Buf;
+ string OutputDir = _config->FindDir("Dir::Cache::Archives");
+ if (statvfs(OutputDir.c_str(),&Buf) != 0) {
+ return _error->Errno("statvfs",
+ "Couldn't determine free space in %s",
+ OutputDir.c_str());
+ }
+ if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
+ {
+ struct statfs Stat;
+ if (statfs(OutputDir.c_str(), &Stat) != 0 ||
+ unsigned(Stat.f_type) != RAMFS_MAGIC)
+ {
+ pk_backend_error_code(m_backend,
+ PK_ERROR_ENUM_NO_SPACE_ON_DEVICE,
+ string("You don't have enough free space in ").append(OutputDir).c_str());
+ return _error->Error("You don't have enough free space in %s.",
+ OutputDir.c_str());
+ }
+ }
+
+ if (!checkTrusted(fetcher, m_backend)) {
+ return false;
+ }
+
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
+ pk_backend_set_simultaneous_mode(m_backend, true);
+ // Download and check if we can continue
+ if (fetcher.Run() != pkgAcquire::Continue
+ && _cancel == false)
+ {
+ // We failed and we did not cancel
+ show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
+ return false;
+ }
+ pk_backend_set_simultaneous_mode(m_backend, false);
+
+ if (_error->PendingError() == true) {
+ cout << "PendingError download" << endl;
+ return false;
+ }
+
+ // Right now it's not safe to cancel
+ pk_backend_set_allow_cancel (m_backend, false);
+
+ // TODO true or false?
+ if (_cancel) {
+ return true;
+ }
+
+ // Download should be finished by now, changing it's status
+ pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
+ pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+ pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
+
+ // TODO DBus activated does not have all vars
+ // we could try to see if this is the case
+ setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
+ _system->UnLock();
+
+ if (!m_localDebFile.empty()) {
+ // add the local file name to be proccessed by the PM queue
+ pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
+ pm->addDebFile(m_localDebFile);
+ }
+
+ pkgPackageManager::OrderResult res;
+ res = PM->DoInstallPreFork();
+ if (res == pkgPackageManager::Failed) {
+ g_warning ("Failed to prepare installation");
+ show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
+ return false;
+ }
+
+ // File descriptors for reading dpkg --status-fd
+ int readFromChildFD[2];
+ if (pipe(readFromChildFD) < 0) {
+ cout << "Failed to create a pipe" << endl;
+ return false;
+ }
+
+ int pty_master;
+ m_child_pid = forkpty(&pty_master, NULL, NULL, NULL);
+ if (m_child_pid == -1) {
+ return false;
+ }
+
+ if (m_child_pid == 0) {
+ //cout << "FORKED: installPackages(): DoInstall" << endl;
+
+ // close pipe we don't need
+ close(readFromChildFD[0]);
+
+ // Change the locale to not get libapt localization
+ setlocale(LC_ALL, "C");
+
+ // Debconf handlying
+ gchar *socket;
+ if (socket = pk_backend_get_frontend_socket(m_backend)) {
+ setenv("DEBIAN_FRONTEND", "passthrough", 1);
+ setenv("DEBCONF_PIPE", socket, 1);
+ } else {
+ // we don't have a socket set, let's fallback to noninteractive
+ setenv("DEBIAN_FRONTEND", "noninteractive", 1);
+ }
+
+ gchar *locale;
+ // Set the LANGUAGE so debconf messages get localization
+ if (locale = pk_backend_get_locale(m_backend)) {
+ setenv("LANGUAGE", locale, 1);
+ setenv("LANG", locale, 1);
+ //setenv("LANG", "C", 1);
+ }
+
+ // Pass the write end of the pipe to the install function
+ res = PM->DoInstallPostFork(readFromChildFD[1]);
+
+ // dump errors into cerr (pass it to the parent process)
+ _error->DumpErrors();
+
+ close(readFromChildFD[1]);
+
+ _exit(res);
+ }
+
+ cout << "PARENT proccess running..." << endl;
+ // make it nonblocking, verry important otherwise
+ // when the child finish we stay stuck.
+ fcntl(readFromChildFD[0], F_SETFL, O_NONBLOCK);
+ fcntl(pty_master, F_SETFL, O_NONBLOCK);
+
+ // init the timer
+ m_lastTermAction = time(NULL);
+ m_startCounting = false;
+
+ // Check if the child died
+ int ret;
+ char masterbuf[1024];
+ while (waitpid(m_child_pid, &ret, WNOHANG) == 0) {
+ // TODO: This is dpkg's raw output. Maybe save it for error-solving?
+ while(read(pty_master, masterbuf, sizeof(masterbuf)) > 0);
+ updateInterface(readFromChildFD[0], pty_master);
+ }
+
+ close(readFromChildFD[0]);
+ close(readFromChildFD[1]);
+ close(pty_master);
+
+ cout << "Parent finished..." << endl;
+ return true;
+}
+
diff --git a/backends/aptcc/apt-intf.h b/backends/aptcc/apt-intf.h
new file mode 100644
index 0000000..7b7dd6d
--- /dev/null
+++ b/backends/aptcc/apt-intf.h
@@ -0,0 +1,185 @@
+/* apt-intf.h - Interface to APT
+ *
+ * Copyright (c) 1999-2002, 2004-2005, 2007-2008 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef APTINTF_H
+#define APTINTF_H
+
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/pkgcachegen.h>
+#include <apt-pkg/cachefile.h>
+#include <apt-pkg/policy.h>
+
+#include <pk-backend.h>
+
+#include <set>
+
+using namespace std;
+
+/**
+* returns a list of packages names
+*/
+vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel);
+
+/**
+* returns a list of packages names
+*/
+vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel);
+
+typedef pair<pkgCache::PkgIterator, pkgCache::VerIterator> PkgPair;
+typedef vector<PkgPair> PkgList;
+
+class pkgProblemResolver;
+
+class AptIntf
+{
+
+public:
+ AptIntf(PkBackend *backend, bool &cancel);
+ ~AptIntf();
+
+ bool init();
+ void cancel();
+
+ // Check the returned VerIterator.end()
+ // if it's true we could not find it
+ pair<pkgCache::PkgIterator, pkgCache::VerIterator>
+ find_package_id(const gchar *package_id, bool &found);
+ pkgCache::VerIterator find_ver(const pkgCache::PkgIterator &pkg);
+ pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
+
+ PkgList resolvePI(gchar **package_ids);
+ bool markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
+
+ /**
+ * runs a transaction to install/remove/update packages
+ * - for install and update, \p remove should be set to false
+ * - if you are going to remove, \p remove should be true
+ * - if you don't want to actually install/update/remove
+ * \p simulate should be true, in this case packages with
+ * what's going to happen will be emitted.
+ */
+ bool runTransaction(PkgList &install, PkgList &remove, bool simulate);
+
+ /**
+ * Get depends
+ */
+ void get_depends(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive);
+
+ /**
+ * Get requires
+ */
+ void get_requires(PkgList &output,
+ pkgCache::PkgIterator pkg,
+ bool recursive);
+
+ /**
+ * Emits a package if it match the filters
+ */
+ void emit_package(const pkgCache::PkgIterator &pkg,
+ const pkgCache::VerIterator &ver,
+ PkBitfield filters = PK_FILTER_ENUM_NONE,
+ PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+
+ void emit_packages(PkgList &output,
+ PkBitfield filters = PK_FILTER_ENUM_NONE,
+ PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
+
+ void emitUpdates(PkgList &output, PkBitfield filters = PK_FILTER_ENUM_NONE);
+
+ /**
+ * Emits details
+ */
+ void emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
+ void emitDetails(PkgList &pkgs);
+
+ /**
+ * Emits update detail
+ */
+ void emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
+ void emitUpdateDetails(PkgList &pkgs);
+
+ /**
+ * Emits files of packages
+ */
+ void emitFiles(PkBackend *backend, const gchar *pi);
+
+ /**
+ * seems to install packages
+ */
+ bool installPackages(pkgCacheFile &Cache);
+
+ /**
+ * check which package provides the codec
+ */
+ void providesCodec(PkgList &output, gchar **values);
+
+ /**
+ * check which package provides a shared library
+ */
+ void providesLibrary(PkgList &output, gchar **values);
+
+ pkgRecords *packageRecords;
+ pkgCache *packageCache;
+ pkgDepCache *packageDepCache;
+ pkgSourceList *packageSourceList;
+
+private:
+ MMap *Map;
+ OpProgress Progress;
+ pkgPolicy *Policy;
+ PkBackend *m_backend;
+ bool &_cancel;
+
+ bool TryToInstall(pkgCache::PkgIterator Pkg,
+ pkgDepCache &Cache,
+ pkgProblemResolver &Fix,
+ bool Remove,
+ bool BrokenFix,
+ unsigned int &ExpectedInst);
+
+ /**
+ * interprets dpkg status fd
+ */
+ void updateInterface(int readFd, int writeFd);
+ bool DoAutomaticRemove(pkgCacheFile &Cache);
+ void emitChangedPackages(pkgCacheFile &Cache);
+ bool removingEssentialPackages(pkgCacheFile &Cache);
+
+ bool m_isMultiArch;
+ PkgList m_pkgs;
+ string m_localDebFile;
+ void populateInternalPackages(pkgCacheFile &Cache);
+ void emitTransactionPackage(string name, PkInfoEnum state);
+ time_t m_lastTermAction;
+ string m_lastPackage;
+ uint m_lastSubProgress;
+ PkInfoEnum m_state;
+ bool m_startCounting;
+
+ // when the internal terminal timesout after no activity
+ int m_terminalTimeout;
+ pid_t m_child_pid;
+};
+
+#endif
diff --git a/backends/aptcc/apt-messages.cpp b/backends/aptcc/apt-messages.cpp
new file mode 100644
index 0000000..623100c
--- /dev/null
+++ b/backends/aptcc/apt-messages.cpp
@@ -0,0 +1,202 @@
+/* apt-messages.cpp
+ *
+ * Copyright (c) 2004 Daniel Burrows
+ * Copyright (c) 2009-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2011-2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "apt-messages.h"
+
+#include <string>
+#include <sstream>
+#include <cstdio>
+
+using namespace std;
+
+bool show_errors(PkBackend *backend, PkErrorEnum errorCode)
+{
+ stringstream errors;
+
+ string Err;
+ while (_error->empty() == false)
+ {
+ bool Type = _error->PopMessage(Err);
+ if (Type == true) {
+ errors << "E: " << Err << endl;
+ } else {
+ errors << "W: " << Err << endl;
+ }
+ }
+
+ if (!errors.str().empty())
+ {
+ pk_backend_error_code(backend, errorCode, errors.str().c_str());
+ }
+}
+
+bool show_warnings(PkBackend *backend, PkMessageEnum message)
+{
+ stringstream warnings;
+
+ string Err;
+ while (_error->empty() == false)
+ {
+ bool Type = _error->PopMessage(Err);
+ if (Type == true) {
+ warnings << "E: " << Err << endl;
+ } else {
+ warnings << "W: " << Err << endl;
+ }
+ }
+
+ if (!warnings.str().empty())
+ {
+ pk_backend_message(backend, message, warnings.str().c_str());
+ }
+}
+
+/** Shows broken dependencies for a single package */
+void show_broken(PkBackend *backend, pkgCacheFile &Cache, bool Now)
+{
+ stringstream out;
+
+ out << "The following packages have unmet dependencies:" << endl;
+ for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
+ if (Now == true) {
+ if (Cache[I].NowBroken() == false) {
+ continue;
+ }
+ } else {
+ if (Cache[I].InstBroken() == false){
+ continue;
+ }
+ }
+
+ // Print out each package and the failed dependencies
+ out << " " << I.Name() << ":";
+ unsigned Indent = strlen(I.Name()) + 3;
+ bool First = true;
+ pkgCache::VerIterator Ver;
+
+ if (Now == true) {
+ Ver = I.CurrentVer();
+ } else {
+ Ver = Cache[I].InstVerIter(Cache);
+ }
+
+ if (Ver.end() == true) {
+ out << endl;
+ continue;
+ }
+
+ for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;) {
+ // Compute a single dependency element (glob or)
+ pkgCache::DepIterator Start;
+ pkgCache::DepIterator End;
+ D.GlobOr(Start,End); // advances D
+
+ if (Cache->IsImportantDep(End) == false){
+ continue;
+ }
+
+ if (Now == true) {
+ if ((Cache[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow){
+ continue;
+ }
+ } else {
+ if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) {
+ continue;
+ }
+ }
+
+ bool FirstOr = true;
+ while (1) {
+ if (First == false){
+ for (unsigned J = 0; J != Indent; J++) {
+ out << ' ';
+ }
+ }
+ First = false;
+
+ if (FirstOr == false) {
+ for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++) {
+ out << ' ';
+ }
+ } else {
+ out << ' ' << End.DepType() << ": ";
+ }
+ FirstOr = false;
+
+ out << Start.TargetPkg().Name();
+
+ // Show a quick summary of the version requirements
+ if (Start.TargetVer() != 0) {
+ out << " (" << Start.CompType() << " " << Start.TargetVer() << ")";
+ }
+
+ /* Show a summary of the target package if possible. In the case
+ of virtual packages we show nothing */
+ pkgCache::PkgIterator Targ = Start.TargetPkg();
+ if (Targ->ProvidesList == 0) {
+ out << ' ';
+ pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
+ if (Now == true) {
+ Ver = Targ.CurrentVer();
+ }
+
+ if (Ver.end() == false)
+ {
+ char buffer[1024];
+ if (Now == true) {
+ sprintf(buffer, "but %s is installed", Ver.VerStr());
+ } else {
+ sprintf(buffer, "but %s is to be installed", Ver.VerStr());
+ }
+
+ out << buffer;
+ } else {
+ if (Cache[Targ].CandidateVerIter(Cache).end() == true) {
+ if (Targ->ProvidesList == 0) {
+ out << "but it is not installable";
+ } else {
+ out << "but it is a virtual package";
+ }
+ } else {
+ if (Now) {
+ out << "but it is not installed";
+ } else {
+ out << "but it is not going to be installed";
+ }
+ }
+ }
+ }
+
+ if (Start != End) {
+ out << " or";
+ }
+ out << endl;
+
+ if (Start == End){
+ break;
+ }
+ Start++;
+ }
+ }
+ }
+ pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, out.str().c_str());
+}
diff --git a/backends/aptcc/apt-messages.h b/backends/aptcc/apt-messages.h
new file mode 100644
index 0000000..68267d7
--- /dev/null
+++ b/backends/aptcc/apt-messages.h
@@ -0,0 +1,50 @@
+/* apt-messages.h
+ *
+ * Copyright (c) 2004 Daniel Burrows
+ * Copyright (c) 2009-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2011-2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef APT_MESSAGES_H
+#define APT_MESSAGES_H
+
+#include <pk-backend.h>
+#include <apt-pkg/cachefile.h>
+
+/** \file apt-messages.h
+ */
+
+/**
+ * Call the Packagekit error dialog
+ */
+bool show_errors(PkBackend *backend,
+ PkErrorEnum errorCode = PK_ERROR_ENUM_UNKNOWN);
+
+/**
+ * Call the Packagekit message dialog
+ */
+bool show_warnings(PkBackend *backend,
+ PkMessageEnum message = PK_MESSAGE_ENUM_UNKNOWN);
+
+/** Shows a list of all broken packages together with their
+ * dependencies. Similar to and based on the equivalent routine in
+ * apt-get.
+ */
+void show_broken(PkBackend *backend, pkgCacheFile &cache, bool Now);
+
+#endif // AAPT_BACKEND_MESSAGES_H
diff --git a/backends/aptcc/apt-sourceslist.cpp b/backends/aptcc/apt-sourceslist.cpp
new file mode 100644
index 0000000..06e0a74
--- /dev/null
+++ b/backends/aptcc/apt-sourceslist.cpp
@@ -0,0 +1,565 @@
+/* apt-sourceslist.cpp - access the sources.list file
+ *
+ * Copyright (c) 1999 Patrick Cole <z at amused.net>
+ * (c) 2002 Synaptic development team
+ *
+ * Author: Patrick Cole <z at amused.net>
+ * Michael Vogt <mvo at debian.org>
+ * Gustavo Niemeyer <niemeyer at conectiva.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "apt-sourceslist.h"
+
+#include <sys/stat.h>
+#include <dirent.h>
+
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
+#include <algorithm>
+#include <fstream>
+
+#include "config.h"
+#include "apt-intf.h"
+
+SourcesList::~SourcesList()
+{
+ for (list<SourceRecord *>::iterator it = SourceRecords.begin();
+ it != SourceRecords.end(); it++)
+ delete *it;
+ for (list<VendorRecord *>::iterator it = VendorRecords.begin();
+ it != VendorRecords.end(); it++)
+ delete *it;
+}
+
+SourcesList::SourceRecord *SourcesList::AddSourceNode(SourceRecord &rec)
+{
+ SourceRecord *newrec = new SourceRecord;
+ *newrec = rec;
+ SourceRecords.push_back(newrec);
+
+ return newrec;
+}
+
+bool SourcesList::ReadSourcePart(string listpath)
+{
+ //cout << "SourcesList::ReadSourcePart() "<< listpath << endl;
+ char buf[512];
+ const char *p;
+ ifstream ifs(listpath.c_str(), ios::in);
+ bool record_ok = true;
+
+ // cannot open file
+ if (!ifs != 0)
+ return _error->Error("Can't read %s", listpath.c_str());
+
+ while (ifs.eof() == false) {
+ p = buf;
+ SourceRecord rec;
+ string Type;
+ string Section;
+ string VURI;
+
+ ifs.getline(buf, sizeof(buf));
+
+ rec.SourceFile = listpath;
+ while (isspace(*p))
+ p++;
+ if (*p == '#') {
+ rec.Type = Disabled;
+ p++;
+ while (isspace(*p))
+ p++;
+ }
+
+ if (*p == '\r' || *p == '\n' || *p == 0) {
+ rec.Type = Comment;
+ rec.Comment = p;
+
+ AddSourceNode(rec);
+ continue;
+ }
+
+ bool Failed = true;
+ if (ParseQuoteWord(p, Type) == true &&
+ rec.SetType(Type) == true && ParseQuoteWord(p, VURI) == true) {
+ if (VURI[0] == '[') {
+ rec.VendorID = VURI.substr(1, VURI.length() - 2);
+ if (ParseQuoteWord(p, VURI) == true && rec.SetURI(VURI) == true)
+ Failed = false;
+ } else if (rec.SetURI(VURI) == true) {
+ Failed = false;
+ }
+ if (Failed == false && ParseQuoteWord(p, rec.Dist) == false)
+ Failed = true;
+ }
+
+ if (Failed == true) {
+ if (rec.Type == Disabled) {
+ // treat as a comment field
+ rec.Type = Comment;
+ rec.Comment = buf;
+ } else {
+ // syntax error on line
+ rec.Type = Comment;
+ string s = "#" + string(buf);
+ rec.Comment = s;
+ record_ok = false;
+ //return _error->Error("Syntax error in line %s", buf);
+ }
+ }
+#ifndef HAVE_RPM
+ // check for absolute dist
+ if (rec.Dist.empty() == false && rec.Dist[rec.Dist.size() - 1] == '/') {
+ // make sure there's no section
+ if (ParseQuoteWord(p, Section) == true)
+ return _error->Error("Syntax error in line %s", buf);
+
+ rec.Dist = SubstVar(rec.Dist, "$(ARCH)",
+ _config->Find("APT::Architecture"));
+
+ AddSourceNode(rec);
+ continue;
+ }
+#endif
+
+ const char *tmp = p;
+ rec.NumSections = 0;
+ while (ParseQuoteWord(p, Section) == true)
+ rec.NumSections++;
+ if (rec.NumSections > 0) {
+ p = tmp;
+ rec.Sections = new string[rec.NumSections];
+ rec.NumSections = 0;
+ while (ParseQuoteWord(p, Section) == true) {
+ // comments inside the record are preserved
+ if (Section[0] == '#') {
+ SourceRecord rec;
+ string s = Section + string(p);
+ rec.Type = Comment;
+ rec.Comment = s;
+ rec.SourceFile = listpath;
+ AddSourceNode(rec);
+ break;
+ } else {
+ rec.Sections[rec.NumSections++] = Section;
+ }
+ }
+ }
+ AddSourceNode(rec);
+ }
+
+ ifs.close();
+ return record_ok;
+}
+
+bool SourcesList::ReadSourceDir(string Dir)
+{
+ //cout << "SourcesList::ReadSourceDir() " << Dir << endl;
+
+ DIR *D = opendir(Dir.c_str());
+ if (D == 0)
+ return _error->Errno("opendir", "Unable to read %s", Dir.c_str());
+
+ vector<string> List;
+ for (struct dirent * Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
+ if (Ent->d_name[0] == '.')
+ continue;
+
+ // Skip bad file names ala run-parts
+ const char *C = Ent->d_name;
+ for (; *C != 0; C++)
+ if (isalpha(*C) == 0 && isdigit(*C) == 0
+ && *C != '_' && *C != '-' && *C != '.')
+ break;
+ if (*C != 0)
+ continue;
+
+ // Only look at files ending in .list to skip .rpmnew etc files
+ if (strcmp(Ent->d_name + strlen(Ent->d_name) - 5, ".list") != 0)
+ continue;
+
+ // Make sure it is a file and not something else
+ string File = flCombine(Dir, Ent->d_name);
+ struct stat St;
+ if (stat(File.c_str(), &St) != 0 || S_ISREG(St.st_mode) == 0)
+ continue;
+ List.push_back(File);
+
+ }
+ closedir(D);
+
+ sort(List.begin(), List.end());
+
+ // Read the files
+ for (vector<string>::const_iterator I = List.begin(); I != List.end();
+ I++)
+ if (ReadSourcePart(*I) == false)
+ return false;
+ return true;
+}
+
+
+bool SourcesList::ReadSources()
+{
+ //cout << "SourcesList::ReadSources() " << endl;
+
+ bool Res = true;
+
+ string Parts = _config->FindDir("Dir::Etc::sourceparts");
+ if (FileExists(Parts) == true)
+ Res &= ReadSourceDir(Parts);
+ string Main = _config->FindFile("Dir::Etc::sourcelist");
+ if (FileExists(Main) == true)
+ Res &= ReadSourcePart(Main);
+
+ return Res;
+}
+
+SourcesList::SourceRecord *SourcesList::AddEmptySource()
+{
+ SourceRecord rec;
+#ifdef HAVE_RPM
+ rec.Type = Rpm;
+#else
+ rec.Type = Deb;
+#endif
+ rec.VendorID = "";
+ rec.SourceFile = _config->FindFile("Dir::Etc::sourcelist");
+ rec.Dist = "";
+ rec.NumSections = 0;
+ return AddSourceNode(rec);
+}
+
+SourcesList::SourceRecord *SourcesList::AddSource(RecType Type,
+ string VendorID, string URI,
+ string Dist,
+ string *Sections,
+ unsigned short count,
+ string SourceFile)
+{
+ SourceRecord rec;
+ rec.Type = Type;
+ rec.VendorID = VendorID;
+ rec.SourceFile = SourceFile;
+
+ if (rec.SetURI(URI) == false) {
+ return NULL;
+ }
+ rec.Dist = Dist;
+ rec.NumSections = count;
+ rec.Sections = new string[count];
+ for (unsigned int i = 0; i < count; i++)
+ rec.Sections[i] = Sections[i];
+
+ return AddSourceNode(rec);
+}
+
+void SourcesList::RemoveSource(SourceRecord *&rec)
+{
+ SourceRecords.remove(rec);
+ delete rec;
+ rec = 0;
+}
+
+void SourcesList::SwapSources( SourceRecord *&rec_one, SourceRecord *&rec_two )
+{
+ list<SourceRecord *>::iterator rec_p;
+ list<SourceRecord *>::iterator rec_n;
+
+ rec_p = find( SourceRecords.begin(), SourceRecords.end(), rec_one );
+ rec_n = find( SourceRecords.begin(), SourceRecords.end(), rec_two );
+
+ SourceRecords.insert( rec_p, rec_two );
+ SourceRecords.erase( rec_n );
+}
+
+bool SourcesList::UpdateSources()
+{
+ list<string> filenames;
+ for (list<SourceRecord *>::iterator it = SourceRecords.begin();
+ it != SourceRecords.end(); it++) {
+ if ((*it)->SourceFile == "")
+ continue;
+ filenames.push_front((*it)->SourceFile);
+ }
+ filenames.sort();
+ filenames.unique();
+
+ for (list<string>::iterator fi = filenames.begin();
+ fi != filenames.end(); fi++) {
+ ofstream ofs((*fi).c_str(), ios::out);
+ if (!ofs != 0)
+ return false;
+
+ for (list<SourceRecord *>::iterator it = SourceRecords.begin();
+ it != SourceRecords.end(); it++) {
+ if ((*fi) != (*it)->SourceFile)
+ continue;
+ string S;
+ if (((*it)->Type & Comment) != 0) {
+ S = (*it)->Comment;
+ } else if ((*it)->URI.empty() || (*it)->Dist.empty()) {
+ continue;
+ } else {
+ if (((*it)->Type & Disabled) != 0)
+ S = "# ";
+
+ S += (*it)->GetType() + " ";
+
+ if ((*it)->VendorID.empty() == false)
+ S += "[" + (*it)->VendorID + "] ";
+
+ S += (*it)->URI + " ";
+ S += (*it)->Dist + " ";
+
+ for (unsigned int J = 0; J < (*it)->NumSections; J++)
+ S += (*it)->Sections[J] + " ";
+ }
+ ofs << S << endl;
+ }
+ ofs.close();
+ }
+ return true;
+}
+
+bool SourcesList::SourceRecord::SetType(string S)
+{
+ if (S == "deb")
+ Type |= Deb;
+ else if (S == "deb-src")
+ Type |= DebSrc;
+ else if (S == "rpm")
+ Type |= Rpm;
+ else if (S == "rpm-src")
+ Type |= RpmSrc;
+ else if (S == "rpm-dir")
+ Type |= RpmDir;
+ else if (S == "rpm-src-dir")
+ Type |= RpmSrcDir;
+ else if (S == "repomd")
+ Type |= Repomd;
+ else if (S == "repomd-src")
+ Type |= RepomdSrc;
+ else
+ return false;
+ //cout << S << " settype " << (Type | Repomd) << endl;
+ return true;
+}
+
+string SourcesList::SourceRecord::GetType()
+{
+ if ((Type & Deb) != 0)
+ return "deb";
+ else if ((Type & DebSrc) != 0)
+ return "deb-src";
+ else if ((Type & Rpm) != 0)
+ return "rpm";
+ else if ((Type & RpmSrc) != 0)
+ return "rpm-src";
+ else if ((Type & RpmDir) != 0)
+ return "rpm-dir";
+ else if ((Type & RpmSrcDir) != 0)
+ return "rpm-src-dir";
+ else if ((Type & Repomd) != 0)
+ return "repomd";
+ else if ((Type & RepomdSrc) != 0)
+ return "repomd-src";
+ //cout << "type " << (Type & Repomd) << endl;
+ return "unknown";
+}
+
+bool SourcesList::SourceRecord::SetURI(string S)
+{
+ if (S.empty() == true)
+ return false;
+ if (S.find(':') == string::npos)
+ return false;
+
+ S = SubstVar(S, "$(ARCH)", _config->Find("APT::Architecture"));
+ S = SubstVar(S, "$(VERSION)", _config->Find("APT::DistroVersion"));
+ URI = S;
+
+ // append a / to the end if one is not already there
+ if (URI[URI.size() - 1] != '/')
+ URI += '/';
+
+ return true;
+}
+
+SourcesList::SourceRecord &SourcesList::SourceRecord::
+operator=(const SourceRecord &rhs)
+{
+ // Needed for a proper deep copy of the record; uses the string operator= to properly copy the strings
+ Type = rhs.Type;
+ VendorID = rhs.VendorID;
+ URI = rhs.URI;
+ Dist = rhs.Dist;
+ Sections = new string[rhs.NumSections];
+ for (unsigned int I = 0; I < rhs.NumSections; I++)
+ Sections[I] = rhs.Sections[I];
+ NumSections = rhs.NumSections;
+ Comment = rhs.Comment;
+ SourceFile = rhs.SourceFile;
+
+ return *this;
+}
+
+SourcesList::VendorRecord *SourcesList::AddVendorNode(VendorRecord &rec)
+{
+ VendorRecord *newrec = new VendorRecord;
+ *newrec = rec;
+ VendorRecords.push_back(newrec);
+
+ return newrec;
+}
+
+bool SourcesList::ReadVendors()
+{
+ Configuration Cnf;
+
+ string CnfFile = _config->FindFile("Dir::Etc::vendorlist");
+ if (FileExists(CnfFile) == true)
+ if (ReadConfigFile(Cnf, CnfFile, true) == false)
+ return false;
+
+ for (list<VendorRecord *>::const_iterator I = VendorRecords.begin();
+ I != VendorRecords.end(); I++)
+ delete *I;
+ VendorRecords.clear();
+
+ // Process 'simple-key' type sections
+ const Configuration::Item *Top = Cnf.Tree("simple-key");
+ for (Top = (Top == 0 ? 0 : Top->Child); Top != 0; Top = Top->Next) {
+ Configuration Block(Top);
+ VendorRecord Vendor;
+
+ Vendor.VendorID = Top->Tag;
+ Vendor.FingerPrint = Block.Find("Fingerprint");
+ Vendor.Description = Block.Find("Name");
+
+ char *buffer = new char[Vendor.FingerPrint.length() + 1];
+ char *p = buffer;;
+ for (string::const_iterator I = Vendor.FingerPrint.begin();
+ I != Vendor.FingerPrint.end(); I++) {
+ if (*I != ' ' && *I != '\t')
+ *p++ = *I;
+ }
+ *p = 0;
+ Vendor.FingerPrint = buffer;
+ delete[]buffer;
+
+ if (Vendor.FingerPrint.empty() == true ||
+ Vendor.Description.empty() == true) {
+ _error->Error("Vendor block %s is invalid",
+ Vendor.VendorID.c_str());
+ continue;
+ }
+
+ AddVendorNode(Vendor);
+ }
+
+ return !_error->PendingError();
+}
+
+SourcesList::VendorRecord *SourcesList::AddVendor(string VendorID,
+ string FingerPrint,
+ string Description)
+{
+ VendorRecord rec;
+ rec.VendorID = VendorID;
+ rec.FingerPrint = FingerPrint;
+ rec.Description = Description;
+ return AddVendorNode(rec);
+}
+
+bool SourcesList::UpdateVendors()
+{
+ ofstream ofs(_config->FindFile("Dir::Etc::vendorlist").c_str(), ios::out);
+ if (!ofs != 0)
+ return false;
+
+ for (list<VendorRecord *>::iterator it = VendorRecords.begin();
+ it != VendorRecords.end(); it++) {
+ ofs << "simple-key \"" << (*it)->VendorID << "\" {" << endl;
+ ofs << "\tFingerPrint \"" << (*it)->FingerPrint << "\";" << endl;
+ ofs << "\tName \"" << (*it)->Description << "\";" << endl;
+ ofs << "}" << endl;
+ }
+
+ ofs.close();
+ return true;
+}
+
+
+void SourcesList::RemoveVendor(VendorRecord *&rec)
+{
+ VendorRecords.remove(rec);
+ delete rec;
+ rec = 0;
+}
+
+ostream &operator<<(ostream &os, const SourcesList::SourceRecord &rec)
+{
+ os << "Type: ";
+ if ((rec.Type & SourcesList::Comment) != 0)
+ os << "Comment ";
+ if ((rec.Type & SourcesList::Disabled) != 0)
+ os << "Disabled ";
+ if ((rec.Type & SourcesList::Deb) != 0)
+ os << "Deb";
+ if ((rec.Type & SourcesList::DebSrc) != 0)
+ os << "DebSrc";
+ if ((rec.Type & SourcesList::Rpm) != 0)
+ os << "Rpm";
+ if ((rec.Type & SourcesList::RpmSrc) != 0)
+ os << "RpmSrc";
+ if ((rec.Type & SourcesList::RpmDir) != 0)
+ os << "RpmDir";
+ if ((rec.Type & SourcesList::RpmSrcDir) != 0)
+ os << "RpmSrcDir";
+ if ((rec.Type & SourcesList::Repomd) != 0)
+ os << "Repomd";
+ if ((rec.Type & SourcesList::RepomdSrc) != 0)
+ os << "RepomdSrc";
+ os << endl;
+ os << "SourceFile: " << rec.SourceFile << endl;
+ os << "VendorID: " << rec.VendorID << endl;
+ os << "URI: " << rec.URI << endl;
+ os << "Dist: " << rec.Dist << endl;
+ os << "Section(s):" << endl;
+#if 0
+ for (unsigned int J = 0; J < rec.NumSections; J++) {
+ cout << "\t" << rec.Sections[J] << endl;
+ }
+#endif
+ os << endl;
+ return os;
+}
+
+ostream &operator<<(ostream &os, const SourcesList::VendorRecord &rec)
+{
+ os << "VendorID: " << rec.VendorID << endl;
+ os << "FingerPrint: " << rec.FingerPrint << endl;
+ os << "Description: " << rec.Description << endl;
+ return os;
+}
+
+// vim:sts=4:sw=4
diff --git a/backends/aptcc/apt-sourceslist.h b/backends/aptcc/apt-sourceslist.h
new file mode 100644
index 0000000..8b409e5
--- /dev/null
+++ b/backends/aptcc/apt-sourceslist.h
@@ -0,0 +1,115 @@
+/* apt-sourceslist.h - access the sources.list file
+ *
+ * Copyright (c) 1999 Patrick Cole <z at amused.net>
+ * (c) 2002 Synaptic development team
+ *
+ * Author: Patrick Cole <z at amused.net>
+ * Michael Vogt <mvo at debian.org>
+ * Gustavo Niemeyer <niemeyer at conectiva.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef APT_SOURCESLIST_H
+#define APT_SOURCESLIST_H
+
+#include <string>
+#include <list>
+
+using namespace std;
+
+class SourcesList {
+ public:
+ enum RecType {
+ Deb = 1 << 0,
+ DebSrc = 1 << 1,
+ Rpm = 1 << 2,
+ RpmSrc = 1 << 3,
+ Disabled = 1 << 4,
+ Comment = 1 << 5,
+ RpmDir = 1 << 6,
+ RpmSrcDir = 1 << 7,
+ Repomd = 1 << 8,
+ RepomdSrc = 1 << 9
+ };
+
+ struct SourceRecord {
+ unsigned int Type;
+ string VendorID;
+ string URI;
+ string Dist;
+ string *Sections;
+ unsigned short NumSections;
+ string Comment;
+ string SourceFile;
+
+ bool SetType(string);
+ string GetType();
+ bool SetURI(string);
+
+ SourceRecord():Type(0), Sections(0), NumSections(0) {
+ };
+ ~SourceRecord() {
+ if (Sections)
+ delete[]Sections;
+ };
+ SourceRecord &operator=(const SourceRecord &);
+ };
+
+ struct VendorRecord {
+ string VendorID;
+ string FingerPrint;
+ string Description;
+ };
+
+ list<SourceRecord *> SourceRecords;
+ list<VendorRecord *> VendorRecords;
+
+ private:
+ SourceRecord *AddSourceNode(SourceRecord &);
+ VendorRecord *AddVendorNode(VendorRecord &);
+
+ public:
+ SourceRecord *AddSource(RecType Type,
+ string VendorID,
+ string URI,
+ string Dist,
+ string *Sections,
+ unsigned short count, string SourceFile);
+ SourceRecord *AddEmptySource();
+ void RemoveSource(SourceRecord *&);
+ void SwapSources( SourceRecord *&, SourceRecord *& );
+ bool ReadSourcePart(string listpath);
+ bool ReadSourceDir(string Dir);
+ bool ReadSources();
+ bool UpdateSources();
+
+ VendorRecord *AddVendor(string VendorID,
+ string FingerPrint, string Description);
+ void RemoveVendor(VendorRecord *&);
+ bool ReadVendors();
+ bool UpdateVendors();
+
+ SourcesList() {
+ };
+ ~SourcesList();
+};
+
+typedef list<SourcesList::SourceRecord *>::iterator SourcesListIter;
+
+ostream &operator <<(ostream &, const SourcesList::SourceRecord &);
+
+#endif
diff --git a/backends/aptcc/apt-utils.cpp b/backends/aptcc/apt-utils.cpp
index 546b75a..953ee68 100644
--- a/backends/aptcc/apt-utils.cpp
+++ b/backends/aptcc/apt-utils.cpp
@@ -1,8 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- *
- * Licensed under the GNU General Public License Version 2
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,13 +13,13 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
#include "apt-utils.h"
-#include "pkg_acqfile.h"
#include <iostream>
#include <fstream>
#include <sys/stat.h>
diff --git a/backends/aptcc/apt-utils.h b/backends/aptcc/apt-utils.h
index 4b95206..30b143b 100644
--- a/backends/aptcc/apt-utils.h
+++ b/backends/aptcc/apt-utils.h
@@ -1,9 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 200 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
- * Copyright (C) 2001, 2005 Daniel Burrows (aptitude)
- *
- * Licensed under the GNU General Public License Version 2
+ * Copyright (c) 2001, 2005 Daniel Burrows (aptitude)
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,8 +14,9 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
*/
#ifndef APT_UTILS_H
@@ -25,12 +24,11 @@
#include <apt-pkg/pkgrecords.h>
-#include <pk-backend.h>
-
#include <string.h>
#include <set>
+#include <pk-backend.h>
-#include "apt.h"
+#include "pkg_acqfile.h"
typedef std::vector<pkgCache::PkgIterator> pkgvector;
diff --git a/backends/aptcc/apt.cpp b/backends/aptcc/apt.cpp
deleted file mode 100644
index 36a2a15..0000000
--- a/backends/aptcc/apt.cpp
+++ /dev/null
@@ -1,2194 +0,0 @@
-// apt.cc
-//
-// Copyright 1999-2008 Daniel Burrows
-// Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-// Copyright (c) 2004 Michael Vogt <mvo at debian.org>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-
-#include "apt.h"
-#include "apt-utils.h"
-#include "matcher.h"
-#include "gstMatcher.h"
-#include "aptcc_show_broken.h"
-#include "acqprogress.h"
-#include "pkg_acqfile.h"
-#include "aptcc_show_error.h"
-#include "deb-file.h"
-#include "dpkgpm.h"
-
-#include <apt-pkg/error.h>
-#include <apt-pkg/tagfile.h>
-#include <apt-pkg/algorithms.h>
-#include <apt-pkg/init.h>
-#include <apt-pkg/sptr.h>
-#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/version.h>
-#include <apt-pkg/aptconfiguration.h>
-
-#include <sys/statvfs.h>
-#include <sys/statfs.h>
-#include <sys/wait.h>
-#include <sys/fcntl.h>
-#include <pty.h>
-
-#define RAMFS_MAGIC 0x858458f6
-
-#include <fstream>
-#include <dirent.h>
-#include <assert.h>
-#include <regex.h>
-
-aptcc::aptcc(PkBackend *backend, bool &cancel)
- :
- packageRecords(0),
- packageCache(0),
- packageDepCache(0),
- packageSourceList(0),
- Map(0),
- Policy(0),
- m_backend(backend),
- _cancel(cancel),
- m_terminalTimeout(120),
- m_lastSubProgress(0)
-{
- _cancel = false;
-}
-
-bool aptcc::init()
-{
- gchar *locale;
- gchar *http_proxy;
- gchar *ftp_proxy;
-
- m_isMultiArch = APT::Configuration::getArchitectures(false).size() > 1;
-
- // Set PackageKit status
- pk_backend_set_status(m_backend, PK_STATUS_ENUM_LOADING_CACHE);
-
- // set locale
- if (locale = pk_backend_get_locale(m_backend)) {
- setlocale(LC_ALL, locale);
-// TODO why this cuts characthers on ui?
-// string _locale(locale);
-// size_t found;
-// found = _locale.find('.');
-// _locale.erase(found);
-// _config->Set("APT::Acquire::Translation", _locale);
- }
-
- // set http proxy
- http_proxy = pk_backend_get_proxy_http(m_backend);
- setenv("http_proxy", http_proxy, 1);
-
- // set ftp proxy
- ftp_proxy = pk_backend_get_proxy_ftp(m_backend);
- setenv("ftp_proxy", ftp_proxy, 1);
-
- packageSourceList = new pkgSourceList;
- // Read the source list
- packageSourceList->ReadMainList();
-
- // Generate it and map it
- bool Res = pkgMakeStatusCache(*packageSourceList, Progress, &Map, true);
- Progress.Done();
- if(!Res) {
- return false;
- //"The package lists or status file could not be parsed or opened."
- }
-
- packageCache = new pkgCache(Map);
- if (_error->PendingError()) {
- return false;
- }
-
- // create depcache
- Policy = new pkgPolicy(packageCache);
- if (_error->PendingError()) {
- return false;
- }
-
- if (!ReadPinFile(*Policy)) {
- return false;
- }
-
- packageDepCache = new pkgDepCache(packageCache, Policy);
- if (_error->PendingError()) {
- return false;
- }
-
- packageDepCache->Init(&Progress);
- Progress.Done();
- if (_error->PendingError()) {
- return false;
- }
-
- // Create the text record parser
- packageRecords = new pkgRecords(*packageDepCache);
-}
-
-aptcc::~aptcc()
-{
- if (packageRecords)
- {
- g_debug ("~apt_init packageRecords");
- delete packageRecords;
- }
-
- if (packageCache)
- {
- g_debug ("~apt_init packageCache");
- delete packageCache;
- }
-
- if (packageDepCache)
- {
- g_debug ("~apt_init packageDepCache");
- delete packageDepCache;
- }
-
- if (Policy)
- {
- g_debug ("~apt_init Policy");
- delete Policy;
- }
-
- if (packageSourceList)
- {
- delete packageSourceList;
- }
-
- pk_backend_finished(m_backend);
-
- delete Map;
-}
-
-void aptcc::cancel()
-{
- if (!_cancel) {
- _cancel = true;
- pk_backend_set_status(m_backend, PK_STATUS_ENUM_CANCEL);
- }
- if (m_child_pid > 0) {
- kill(m_child_pid, SIGTERM);
- }
-}
-
-pair<pkgCache::PkgIterator, pkgCache::VerIterator>
- aptcc::find_package_id(const gchar *package_id, bool &found)
-{
- gchar **parts;
- pkgCache::VerIterator ver;
- pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
-
- found = true;
-
- parts = pk_package_id_split (package_id);
- gchar *pkgNameArch;
- pkgNameArch = g_strdup_printf("%s:%s", parts[PK_PACKAGE_ID_NAME], parts[PK_PACKAGE_ID_ARCH]);
- pkg_ver.first = packageCache->FindPkg(pkgNameArch);
- g_free(pkgNameArch);
-
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (pkg_ver.first.end() == true ||
- (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
- {
- g_strfreev (parts);
- return pkg_ver;
- }
-
- ver = find_ver(pkg_ver.first);
- // check to see if the provided package isn't virtual too
- if (ver.end() == false &&
- strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
- {
- g_strfreev (parts);
- pkg_ver.second = ver;
- return pkg_ver;
- }
-
- ver = find_candidate_ver(pkg_ver.first);
- // check to see if the provided package isn't virtual too
- if (ver.end() == false &&
- strcmp(ver.VerStr(), parts[PK_PACKAGE_ID_VERSION]) == 0)
- {
- g_strfreev (parts);
- pkg_ver.second = ver;
- return pkg_ver;
- }
-
- found = false;
- g_strfreev (parts);
- return pkg_ver;
-}
-
-pkgCache::VerIterator aptcc::find_candidate_ver(const pkgCache::PkgIterator &pkg)
-{
- // get the candidate version iterator
- return (*packageDepCache)[pkg].CandidateVerIter(*packageDepCache);
-}
-
-pkgCache::VerIterator aptcc::find_ver(const pkgCache::PkgIterator &pkg)
-{
- // if the package is installed return the current version
- if(!pkg.CurrentVer().end()) {
- return pkg.CurrentVer();
- }
-
- // Else get the candidate version iterator
- pkgCache::VerIterator candver = find_candidate_ver(pkg);
- if(!candver.end())
- {
- return candver;
- }
-
- // return the version list as a last resource
- return pkg.VersionList();
-}
-
-// used to emit packages it collects all the needed info
-void aptcc::emit_package(const pkgCache::PkgIterator &pkg,
- const pkgCache::VerIterator &ver,
- PkBitfield filters,
- PkInfoEnum state)
-{
- // check the state enum to see if it was not set.
- if (state == PK_INFO_ENUM_UNKNOWN) {
- if (pkg->CurrentState == pkgCache::State::Installed &&
- pkg.CurrentVer() == ver) {
- state = PK_INFO_ENUM_INSTALLED;
- } else {
- state = PK_INFO_ENUM_AVAILABLE;
- }
- }
-
- if (m_isMultiArch &&
- (pk_bitfield_contain(filters, PK_FILTER_ENUM_ARCH) &&
- state == PK_INFO_ENUM_AVAILABLE)) {
- // don't emit the package if it does not match
- // the native architecture
- if (strcmp(ver.Arch(), "all") != 0 &&
- strcmp(ver.Arch(), _config->Find("APT::Architecture").c_str()) != 0) {
- return;
- }
- }
-
- if (filters != 0) {
- std::string str = ver.Section() == NULL ? "" : ver.Section();
- std::string section, repo_section;
-
- size_t found;
- found = str.find_last_of("/");
- section = str.substr(found + 1);
- repo_section = str.substr(0, found);
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)
- && state == PK_INFO_ENUM_INSTALLED) {
- return;
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)
- && state == PK_INFO_ENUM_AVAILABLE) {
- return;
- }
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_DEVELOPMENT)) {
- // if ver.end() means unknow
- // strcmp will be true when it's different than devel
- std::string pkgName = pkg.Name();
- if (!ends_with(pkgName, "-dev") &&
- !ends_with(pkgName, "-dbg") &&
- section.compare("devel") &&
- section.compare("libdevel")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_DEVELOPMENT)) {
- std::string pkgName = pkg.Name();
- if (ends_with(pkgName, "-dev") ||
- ends_with(pkgName, "-dbg") ||
- !section.compare("devel") ||
- !section.compare("libdevel")) {
- return;
- }
- }
-
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_GUI)) {
- // if ver.end() means unknow
- // strcmp will be true when it's different than x11
- if (section.compare("x11") && section.compare("gnome") &&
- section.compare("kde") && section.compare("graphics")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_GUI)) {
- if (!section.compare("x11") || !section.compare("gnome") ||
- !section.compare("kde") || !section.compare("graphics")) {
- return;
- }
- }
-
- // TODO add Ubuntu handling
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_FREE)) {
- if (!repo_section.compare("contrib") ||
- !repo_section.compare("non-free")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_FREE)) {
- if (repo_section.compare("contrib") &&
- repo_section.compare("non-free")) {
- return;
- }
- }
-
- // TODO test this one..
- if (pk_bitfield_contain (filters, PK_FILTER_ENUM_COLLECTIONS)) {
- if (!repo_section.compare("metapackages")) {
- return;
- }
- } else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_COLLECTIONS)) {
- if (repo_section.compare("metapackages")) {
- return;
- }
- }
-
- }
- pkgCache::VerFileIterator vf = ver.FileList();
-
- gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- ver.VerStr(),
- ver.Arch(),
- vf.File().Archive() == NULL ? "" : vf.File().Archive());
- pk_backend_package(m_backend,
- state,
- package_id,
- get_short_description(ver, packageRecords).c_str());
- g_free(package_id);
-}
-
-void aptcc::emit_packages(PkgList &output,
- PkBitfield filters,
- PkInfoEnum state)
-{
- // Sort so we can remove the duplicated entries
- sort(output.begin(), output.end(), compare());
- // Remove the duplicated entries
- output.erase(unique(output.begin(),
- output.end(),
- result_equality()),
- output.end());
-
- for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
- i != output.end(); ++i)
- {
- if (_cancel) {
- break;
- }
- emit_package(i->first, i->second, filters, state);
- }
-}
-
-void aptcc::emitUpdates(PkgList &output, PkBitfield filters)
-{
- PkInfoEnum state;
- // Sort so we can remove the duplicated entries
- sort(output.begin(), output.end(), compare());
- // Remove the duplicated entries
- output.erase(unique(output.begin(),
- output.end(),
- result_equality()),
- output.end());
-
- for(vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=output.begin();
- i != output.end(); ++i)
- {
- if (_cancel) {
- break;
- }
-
- // the default update info
- state = PK_INFO_ENUM_NORMAL;
-
- // let find what kind of upgrade this is
- pkgCache::VerFileIterator vf = i->second.FileList();
- std::string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
- std::string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
- std::string label = vf.File().Label() == NULL ? "" : vf.File().Label();
- if (origin.compare("Debian") == 0 ||
- origin.compare("Ubuntu") == 0) {
- if (ends_with(archive, "-security") ||
- label.compare("Debian-Security") == 0) {
- state = PK_INFO_ENUM_SECURITY;
- } else if (ends_with(archive, "-backports")) {
- state = PK_INFO_ENUM_ENHANCEMENT;
- } else if (ends_with(archive, "-updates")) {
- state = PK_INFO_ENUM_BUGFIX;
- }
- } else if (origin.compare("Backports.org archive") == 0 ||
- ends_with(origin, "-backports")) {
- state = PK_INFO_ENUM_ENHANCEMENT;
- }
-
- emit_package(i->first, i->second, filters, state);
- }
-}
-
-// search packages which provide a codec (specified in "values")
-void aptcc::providesCodec(PkgList &output, gchar **values)
-{
- GstMatcher *matcher = new GstMatcher(values);
- if (!matcher->hasMatches()) {
- return;
- }
-
- for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg)
- {
- if (_cancel) {
- delete matcher;
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- // TODO search in updates packages
- // Ignore virtual packages
- pkgCache::VerIterator ver = find_ver(pkg);
- if (ver.end() == true) {
- ver = find_candidate_ver(pkg);
- if (ver.end() == true) {
- continue;
- }
- }
-
- pkgCache::VerFileIterator vf = ver.FileList();
- pkgRecords::Parser &rec = packageRecords->Lookup(vf);
- const char *start, *stop;
- rec.GetRec(start, stop);
- string record(start, stop - start);
- if (matcher->matches(record)) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
- }
- }
-
- delete matcher;
-}
-
-// search packages which provide the libraries specified in "values"
-void aptcc::providesLibrary(PkgList &output, gchar **values)
-{
- bool ret = false;
- // Quick-check for library names
- for (uint i = 0; i < g_strv_length(values); i++)
- if (g_str_has_prefix (values[i], "lib")) {
- ret = true;
- break;
- }
- if (!ret)
- return;
-
- const char *libreg_str = "^\\(lib.*\\)\\.so\\.[0-9]*";
- g_debug ("RegStr: %s", libreg_str);
- regex_t libreg;
- if(regcomp(&libreg, libreg_str, 0) != 0) {
- g_debug("Regex compilation error: ", libreg);
- return;
- }
-
- gchar *value;
- for (uint i = 0; i < g_strv_length(values); i++) {
- value = values[i];
- regmatch_t matches[2];
- if (regexec(&libreg, value, 2, matches, 0) != REG_NOMATCH) {
- string libPkgName = string(value, matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so);
-
- string strvalue = string(value);
- ssize_t pos = strvalue.find (".so.");
- if ((pos != string::npos) && (pos > 0)) {
- // If last char is a number, add a "-" (to be policy-compliant)
- if (g_ascii_isdigit (libPkgName.at (libPkgName.length () - 1)))
- libPkgName.append ("-");
-
- libPkgName.append (strvalue.substr (pos + 4));
- }
-
- g_debug ("pkg-name: %s", libPkgName.c_str ());
-
- for (pkgCache::PkgIterator pkg = packageCache->PkgBegin(); !pkg.end(); ++pkg) {
- // Ignore packages that exist only due to dependencies.
- if (pkg.VersionList().end() && pkg.ProvidesList().end()) {
- continue;
- }
-
- // TODO: Ignore virtual packages
- pkgCache::VerIterator ver = find_ver (pkg);
- if (ver.end() == true) {
- ver = find_candidate_ver(pkg);
- if (ver.end() == true) {
- continue;
- }
- }
-
- // Make everything lower-case
- std::transform(libPkgName.begin(), libPkgName.end(), libPkgName.begin(), ::tolower);
-
- if (g_strcmp0 (pkg.Name (), libPkgName.c_str ()) == 0) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, ver));
- }
- }
-
- } else {
- g_debug("libmatcher: Did not match: %s", value);
- }
- }
-
-}
-
-// used to emit packages it collects all the needed info
-void aptcc::emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
-{
- pkgCache::VerIterator ver;
- if (version.end() == false) {
- ver = version;
- } else {
- ver = find_ver(pkg);
- }
- std::string section = ver.Section() == NULL ? "" : ver.Section();
-
- size_t found;
- found = section.find_last_of("/");
- section = section.substr(found + 1);
-
- pkgCache::VerFileIterator vf = ver.FileList();
- pkgRecords::Parser &rec = packageRecords->Lookup(vf);
-
- long size;
- if (pkg->CurrentState == pkgCache::State::Installed && pkg.CurrentVer() == ver) {
- // if the package is installed emit the installed size
- size = ver->InstalledSize;
- } else {
- size = ver->Size;
- }
-
- gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- ver.VerStr(),
- ver.Arch(),
- vf.File().Archive() == NULL ? "" : vf.File().Archive());
-
- pk_backend_details(m_backend,
- package_id,
- "unknown",
- get_enum_group(section),
- get_long_description_parsed(ver, packageRecords).c_str(),
- rec.Homepage().c_str(),
- size);
-
- g_free(package_id);
-}
-
-void aptcc::emitDetails(PkgList &pkgs)
-{
- // Sort so we can remove the duplicated entries
- sort(pkgs.begin(), pkgs.end(), compare());
- // Remove the duplicated entries
- pkgs.erase(unique(pkgs.begin(), pkgs.end(), result_equality()),
- pkgs.end());
-
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
- {
- if (_cancel) {
- break;
- }
-
- emitDetails(i->first, i->second);
- }
-}
-
-// used to emit packages it collects all the needed info
-void aptcc::emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &version)
-{
- // Get the version of the current package
- pkgCache::VerIterator currver = find_ver(pkg);
- pkgCache::VerFileIterator currvf = currver.FileList();
- // Build a package_id from the current version
- gchar *current_package_id;
- current_package_id = pk_package_id_build(pkg.Name(),
- currver.VerStr(),
- currver.Arch(),
- currvf.File().Archive() == NULL ? "" : currvf.File().Archive());
-
- // Get the update version
- pkgCache::VerIterator candver;
- if (version.end() == false) {
- candver = version;
- } else {
- candver = find_candidate_ver(pkg);
- }
-
- pkgCache::VerFileIterator vf = candver.FileList();
- string origin = vf.File().Origin() == NULL ? "" : vf.File().Origin();
- pkgRecords::Parser &rec = packageRecords->Lookup(candver.FileList());
-
- // Build the changelogURI
- char uri[512];
- string srcpkg;
- string verstr;
-
- if (rec.SourcePkg().empty()) {
- srcpkg = pkg.Name();
- } else {
- srcpkg = rec.SourcePkg();
- }
- if (origin.compare("Debian") == 0 || origin.compare("Ubuntu") == 0) {
- string prefix;
-
- string src_section = candver.Section() == NULL ? "" : candver.Section();
- if(src_section.find('/') != src_section.npos) {
- src_section = string(src_section, 0, src_section.find('/'));
- } else {
- src_section = "main";
- }
-
- prefix += srcpkg[0];
- if(srcpkg.size() > 3 && srcpkg[0] == 'l' && srcpkg[1] == 'i' && srcpkg[2] == 'b') {
- prefix = string("lib") + srcpkg[3];
- }
-
- if(candver.VerStr() != NULL) {
- verstr = candver.VerStr();
- }
-
- if(verstr.find(':') != verstr.npos) {
- verstr = string(verstr, verstr.find(':') + 1);
- }
-
- if (origin.compare("Debian") == 0) {
- snprintf(uri,
- 512,
- "http://packages.debian.org/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
- prefix.c_str(),
- srcpkg.c_str(),
- srcpkg.c_str(),
- verstr.c_str());
- } else {
- snprintf(uri,
- 512,
- "http://changelogs.ubuntu.com/changelogs/pool/%s/%s/%s/%s_%s/changelog", src_section.c_str(),
- prefix.c_str(),
- srcpkg.c_str(),
- srcpkg.c_str(),
- verstr.c_str());
- }
- } else {
- string pkgfilename;
- const char *start, *stop;
- pkgTagSection sec;
- unsigned long len;
-
- rec.GetRec(start, stop);
- len = stop - start;
- // add +1 to ensure we have the double lineline in the buffer
- if (start && sec.Scan(start, len + 1)) {
- pkgfilename = sec.FindS("Filename");
- }
-
- string cadidateOriginSiteUrl;
- if(!vf.end() && vf.File() && vf.File().Site()) {
- cadidateOriginSiteUrl = vf.File().Site();
- }
-
- pkgfilename = pkgfilename.substr(0, pkgfilename.find_last_of('.')) + ".changelog";
- snprintf(uri,512,"http://%s/%s",
- cadidateOriginSiteUrl.c_str(),
- pkgfilename.c_str());
- }
- // Create the download object
- AcqPackageKitStatus Stat(this, m_backend, _cancel);
-
- // get a fetcher
- pkgAcquire fetcher;
- fetcher.Setup(&Stat);
-
- // fetch the changelog
- pk_backend_set_status(m_backend, PK_STATUS_ENUM_DOWNLOAD_CHANGELOG);
- string filename = getChangelogFile(pkg.Name(), origin, verstr, srcpkg, uri, &fetcher);
-
- string changelog;
- string update_text;
- ifstream in(filename.c_str());
- string line;
- GRegex *regexVer;
- regexVer = g_regex_new("(?'source'.+) \\((?'version'.*)\\) "
- "(?'dist'.+); urgency=(?'urgency'.+)",
- G_REGEX_CASELESS,
- G_REGEX_MATCH_ANCHORED,
- 0);
- GRegex *regexDate;
- regexDate = g_regex_new("^ -- (?'maintainer'.+) (?'mail'<.+>) (?'date'.+)$",
- G_REGEX_CASELESS,
- G_REGEX_MATCH_ANCHORED,
- 0);
- string updated;
- string issued;
- while (getline(in, line)) {
- // no need to free str later, it is allocated in a static buffer
- const char *str = utf8(line.c_str());
- if (strcmp(str, "") == 0) {
- changelog.append("\n");
- continue;
- } else {
- changelog.append(str);
- changelog.append("\n");
- }
-
- if (starts_with(str, srcpkg.c_str())) {
- // Check to see if the the text isn't about the current package,
- // otherwise add a == version ==
- GMatchInfo *match_info;
- if (g_regex_match(regexVer, str, G_REGEX_MATCH_ANCHORED, &match_info)) {
- gchar *version;
- version = g_match_info_fetch_named(match_info, "version");
-
- // Compare if the current version is shown in the changelog, to not
- // display old changelog information
- if (_system != 0 &&
- _system->VS->DoCmpVersion(version, version + strlen(version),
- currver.VerStr(), currver.VerStr() + strlen(currver.VerStr())) <= 0) {
- g_free (version);
- break;
- } else {
- if (!update_text.empty()) {
- update_text.append("\n\n");
- }
- update_text.append(" == ");
- update_text.append(version);
- update_text.append(" ==");
- g_free (version);
- }
- }
- g_match_info_free (match_info);
- } else if (starts_with(str, " ")) {
- // update descritption
- update_text.append("\n");
- update_text.append(str);
- } else if (starts_with(str, " --")) {
- // Parse the text to know when the update was issued,
- // and when it got updated
- GMatchInfo *match_info;
- if (g_regex_match(regexDate, str, G_REGEX_MATCH_ANCHORED, &match_info)) {
- GTimeVal dateTime = {0, 0};
- gchar *date;
- date = g_match_info_fetch_named(match_info, "date");
- g_warn_if_fail(RFC1123StrToTime(date, dateTime.tv_sec));
- g_free(date);
-
- issued = g_time_val_to_iso8601(&dateTime);
- if (updated.empty()) {
- updated = g_time_val_to_iso8601(&dateTime);
- }
- }
- g_match_info_free(match_info);
- }
- }
- // Clean structures
- g_regex_unref(regexVer);
- g_regex_unref(regexDate);
- unlink(filename.c_str());
-
- // Check if the update was updates since it was issued
- if (issued.compare(updated) == 0) {
- updated = "";
- }
-
- // Build a package_id from the update version
- string archive = vf.File().Archive() == NULL ? "" : vf.File().Archive();
- gchar *package_id;
- package_id = pk_package_id_build(pkg.Name(),
- candver.VerStr(),
- candver.Arch(),
- archive.c_str());
-
- PkUpdateStateEnum updateState = PK_UPDATE_STATE_ENUM_UNKNOWN;
- if (archive.compare("stable") == 0) {
- updateState = PK_UPDATE_STATE_ENUM_STABLE;
- } else if (archive.compare("testing") == 0) {
- updateState = PK_UPDATE_STATE_ENUM_TESTING;
- } else if (archive.compare("unstable") == 0 ||
- archive.compare("experimental") == 0)
- {
- updateState = PK_UPDATE_STATE_ENUM_UNSTABLE;
- }
-
- PkRestartEnum restart = PK_RESTART_ENUM_NONE;
- if (starts_with(pkg.Name(), "linux-image-") ||
- starts_with(pkg.Name(), "nvidia-") ||
- strcmp(pkg.Name(), "libc6") == 0 ||
- strcmp(pkg.Name(), "dbus") == 0) {
- restart = PK_RESTART_ENUM_SYSTEM;
- }
-
- pk_backend_update_detail(m_backend,
- package_id,
- current_package_id,//const gchar *updates
- "",//const gchar *obsoletes
- "",//const gchar *vendor_url
- getBugzillaUrls(changelog).c_str(),//const gchar *bugzilla_url
- getCVEUrls(changelog).c_str(),//const gchar *cve_url
- restart,//PkRestartEnum restart
- update_text.c_str(),//const gchar *update_text
- changelog.c_str(),//const gchar *changelog
- updateState,//PkUpdateStateEnum state
- issued.c_str(), //const gchar *issued_text
- updated.c_str() //const gchar *updated_text
- );
- g_free(current_package_id);
- g_free(package_id);
-}
-
-void aptcc::emitUpdateDetails(PkgList &pkgs)
-{
- for(PkgList::iterator i = pkgs.begin(); i != pkgs.end(); ++i)
- {
- if (_cancel) {
- break;
- }
-
- emitUpdateDetails(i->first, i->second);
- }
-}
-
-void aptcc::get_depends(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive)
-{
- pkgCache::DepIterator dep = find_ver(pkg).DependsList();
- while (!dep.end()) {
- if (_cancel) {
- break;
- }
- pkgCache::VerIterator ver = find_ver(dep.TargetPkg());
- // Ignore packages that exist only due to dependencies.
- if (ver.end()) {
- dep++;
- continue;
- } else if (dep->Type == pkgCache::Dep::Depends) {
- if (recursive) {
- if (!contains(output, dep.TargetPkg())) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
- get_depends(output, dep.TargetPkg(), recursive);
- }
- } else {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(dep.TargetPkg(), ver));
- }
- }
- dep++;
- }
-}
-
-void aptcc::get_requires(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive)
-{
- for (pkgCache::PkgIterator parentPkg = packageCache->PkgBegin(); !parentPkg.end(); ++parentPkg) {
- if (_cancel) {
- break;
- }
- // Ignore packages that exist only due to dependencies.
- if (parentPkg.VersionList().end() && parentPkg.ProvidesList().end()) {
- continue;
- }
-
- // Don't insert virtual packages instead add what it provides
- pkgCache::VerIterator ver = find_ver(parentPkg);
- if (ver.end() == false) {
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > deps;
- get_depends(deps, parentPkg, false);
- for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=deps.begin();
- i != deps.end();
- ++i)
- {
- if (i->first == pkg) {
- if (recursive) {
- if (!contains(output, parentPkg)) {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
- get_requires(output, parentPkg, recursive);
- }
- } else {
- output.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(parentPkg, ver));
- }
- break;
- }
- }
- }
- }
-}
-
-// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
-vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel)
-{
- vector<string> packageList;
- regex_t re;
- gchar *search;
- gchar *values_str;
-
- values_str = g_strjoinv("$|^", values);
- search = g_strdup_printf("^%s$",
- values_str);
- g_free(values_str);
- if(regcomp(&re, search, REG_NOSUB) != 0) {
- g_debug("Regex compilation error");
- g_free(search);
- return vector<string>();
- }
- g_free(search);
-
- DIR *dp;
- struct dirent *dirp;
- if (!(dp = opendir("/var/lib/dpkg/info/"))) {
- g_debug ("Error opening /var/lib/dpkg/info/\n");
- regfree(&re);
- return vector<string>();
- }
-
- string line;
- while ((dirp = readdir(dp)) != NULL) {
- if (_cancel) {
- break;
- }
- if (ends_with(dirp->d_name, ".list")) {
- string f = "/var/lib/dpkg/info/" + string(dirp->d_name);
- ifstream in(f.c_str());
- if (!in != 0) {
- continue;
- }
- while (!in.eof()) {
- getline(in, line);
- if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
- string file(dirp->d_name);
- packageList.push_back(file.erase(file.size() - 5, file.size()));
- break;
- }
- }
- }
- }
- closedir(dp);
- regfree(&re);
- return packageList;
-}
-
-// used to return files it reads, using the info from the files in /var/lib/dpkg/info/
-vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel)
-{
- vector<string> packageList;
- regex_t re;
- gchar *value;
- gchar *values_str;
-
- values_str = g_strjoinv("|", values);
- value = g_strdup_printf("^MimeType=\\(.*;\\)\\?\\(%s\\)\\(;.*\\)\\?$",
- values_str);
- g_free(values_str);
-
- if(regcomp(&re, value, REG_NOSUB) != 0) {
- g_debug("Regex compilation error");
- g_free(value);
- return vector<string>();
- }
- g_free(value);
-
- DIR *dp;
- struct dirent *dirp;
- if (!(dp = opendir("/usr/share/app-install/desktop/"))) {
- g_debug ("Error opening /usr/share/app-install/desktop/\n");
- regfree(&re);
- error = true;
- return vector<string>();
- }
-
- string line;
- while ((dirp = readdir(dp)) != NULL) {
- if (_cancel) {
- break;
- }
- if (ends_with(dirp->d_name, ".desktop")) {
- string f = "/usr/share/app-install/desktop/" + string(dirp->d_name);
- ifstream in(f.c_str());
- if (!in != 0) {
- continue;
- }
- bool getName = false;
- while (!in.eof()) {
- getline(in, line);
- if (getName) {
- if (starts_with(line, "X-AppInstall-Package=")) {
- // Remove the X-AppInstall-Package=
- packageList.push_back(line.substr(21));
- break;
- }
- } else {
- if (regexec(&re, line.c_str(), (size_t)0, NULL, 0) == 0) {
- in.seekg(ios_base::beg);
- getName = true;
- }
- }
- }
- }
- }
-
- closedir(dp);
- regfree(&re);
- return packageList;
-}
-
-// used to emit files it reads the info directly from the files
-void aptcc::emitFiles(PkBackend *backend, const gchar *pi)
-{
- static string filelist;
- string line;
- gchar **parts;
-
- parts = pk_package_id_split (pi);
- filelist.erase(filelist.begin(), filelist.end());
-
- string fName;
- if (m_isMultiArch) {
- fName = "/var/lib/dpkg/info/" +
- string(parts[PK_PACKAGE_ID_NAME]) +
- ":" +
- string(parts[PK_PACKAGE_ID_ARCH]) +
- ".list";
- } else {
- fName = "/var/lib/dpkg/info/" +
- string(parts[PK_PACKAGE_ID_NAME]) +
- ".list";
- }
- g_strfreev (parts);
-
- if (FileExists(fName)) {
- ifstream in(fName.c_str());
- if (!in != 0) {
- return;
- }
- while (in.eof() == false && filelist.empty()) {
- getline(in, line);
- filelist += line;
- }
- while (in.eof() == false) {
- getline(in, line);
- if (!line.empty()) {
- filelist += ";" + line;
- }
- }
-
- if (!filelist.empty()) {
- pk_backend_files (backend, pi, filelist.c_str());
- }
- }
-}
-
-static bool checkTrusted(pkgAcquire &fetcher, PkBackend *backend)
-{
- string UntrustedList;
- for (pkgAcquire::ItemIterator I = fetcher.ItemsBegin(); I < fetcher.ItemsEnd(); ++I)
- {
- if (!(*I)->IsTrusted())
- {
- UntrustedList += string((*I)->ShortDesc()) + " ";
- }
- }
-
- if (UntrustedList == "")
- {
- return true;
- }
-
- if (pk_backend_get_bool(backend, "only_trusted") == false ||
- _config->FindB("APT::Get::AllowUnauthenticated", false) == true)
- {
- g_debug ("Authentication warning overridden.\n");
- return true;
- }
-
- string warning("The following packages cannot be authenticated:\n");
- warning += UntrustedList;
- pk_backend_error_code(backend,
- PK_ERROR_ENUM_CANNOT_INSTALL_REPO_UNSIGNED,
- warning.c_str());
- _error->Discard();
- return false;
-}
-
-bool aptcc::TryToInstall(pkgCache::PkgIterator Pkg,
- pkgDepCache &Cache,
- pkgProblemResolver &Fix,
- bool Remove,
- bool BrokenFix,
- unsigned int &ExpectedInst)
-{
- // This is a pure virtual package and there is a single available provides
- if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
- Pkg.ProvidesList()->NextProvides == 0)
- {
- pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
- Pkg = Tmp;
- }
-
- // Check if there is something at all to install
- pkgDepCache::StateCache &State = Cache[Pkg];
- if (Remove == true && Pkg->CurrentVer == 0)
- {
- Fix.Clear(Pkg);
- Fix.Protect(Pkg);
- Fix.Remove(Pkg);
-
- return true;
- }
-
- if (State.CandidateVer == 0 && Remove == false)
- {
- _error->Error("Package %s is virtual and has no installation candidate", Pkg.Name());
-
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_DEP_RESOLUTION_FAILED,
- g_strdup_printf("Package %s is virtual and has no "
- "installation candidate",
- Pkg.Name()));
- return false;
- }
-
- Fix.Clear(Pkg);
- Fix.Protect(Pkg);
- if (Remove == true)
- {
- Fix.Remove(Pkg);
- Cache.MarkDelete(Pkg,_config->FindB("APT::Get::Purge", false));
- return true;
- }
-
- // Install it
- Cache.MarkInstall(Pkg,false);
- if (State.Install() == false)
- {
- if (_config->FindB("APT::Get::ReInstall",false) == true) {
- if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false) {
- // ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
- // Pkg.Name());
- ;
- } else {
- Cache.SetReInstall(Pkg,true);
- }
- } else {
- // if (AllowFail == true)
- // ioprintf(c1out,_("%s is already the newest version.\n"),
- // Pkg.Name());
- }
- } else {
- ExpectedInst++;
- }
-
-// cout << "trytoinstall ExpectedInst " << ExpectedInst << endl;
- // Install it with autoinstalling enabled (if we not respect the minial
- // required deps or the policy)
- if ((State.InstBroken() == true || State.InstPolicyBroken() == true) &&
- BrokenFix == false) {
- Cache.MarkInstall(Pkg,true);
- }
-
- return true;
-}
-
-// checks if there are Essential packages being removed
-bool aptcc::removingEssentialPackages(pkgCacheFile &Cache)
-{
- string List;
- bool *Added = new bool[Cache->Head().PackageCount];
- for (unsigned int I = 0; I != Cache->Head().PackageCount; I++){
- Added[I] = false;
- }
-
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
- if ((I->Flags & pkgCache::Flag::Essential) != pkgCache::Flag::Essential &&
- (I->Flags & pkgCache::Flag::Important) != pkgCache::Flag::Important) {
- continue;
- }
-
- if (Cache[I].Delete() == true) {
- if (Added[I->ID] == false) {
- Added[I->ID] = true;
- List += string(I.Name()) + " ";
- }
- }
-
- if (I->CurrentVer == 0) {
- continue;
- }
-
- // Print out any essential package depenendents that are to be removed
- for (pkgCache::DepIterator D = I.CurrentVer().DependsList(); D.end() == false; D++) {
- // Skip everything but depends
- if (D->Type != pkgCache::Dep::PreDepends &&
- D->Type != pkgCache::Dep::Depends){
- continue;
- }
-
- pkgCache::PkgIterator P = D.SmartTargetPkg();
- if (Cache[P].Delete() == true)
- {
- if (Added[P->ID] == true){
- continue;
- }
- Added[P->ID] = true;
-
- char S[300];
- snprintf(S, sizeof(S), "%s (due to %s) ", P.Name(), I.Name());
- List += S;
- }
- }
- }
-
- delete [] Added;
- if (!List.empty()) {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE,
- g_strdup_printf("WARNING: You are trying to remove the "
- "following essential packages: %s",
- List.c_str()));
- return true;
- }
-
- return false;
-}
-
-// emitChangedPackages - Show packages to newly install /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-void aptcc::emitChangedPackages(pkgCacheFile &Cache)
-{
- vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> > installing,
- removing,
- updating,
- downgrading;
-
- string VersionsList;
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg)
- {
- if (Cache[pkg].NewInstall() == true) {
- // installing
- installing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Delete() == true) {
- // removing
- removing.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
- } else if (Cache[pkg].Upgrade() == true) {
- // updating
- updating.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Downgrade() == true) {
- // downgrading
- downgrading.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- }
- }
-
- // emit packages that have changes
- emit_packages(removing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_REMOVING);
- emit_packages(downgrading, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_DOWNGRADING);
- emit_packages(installing, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_INSTALLING);
- emit_packages(updating, PK_FILTER_ENUM_NONE, PK_INFO_ENUM_UPDATING);
-}
-
-void aptcc::populateInternalPackages(pkgCacheFile &Cache)
-{
- for (pkgCache::PkgIterator pkg = Cache->PkgBegin(); ! pkg.end(); ++pkg) {
- if (Cache[pkg].NewInstall() == true) {
- // installing
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Delete() == true) {
- // removing
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_ver(pkg)));
- } else if (Cache[pkg].Upgrade() == true) {
- // updating
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- } else if (Cache[pkg].Downgrade() == true) {
- // downgrading
- m_pkgs.push_back(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(pkg, find_candidate_ver(pkg)));
- }
- }
-}
-
-void aptcc::emitTransactionPackage(string name, PkInfoEnum state)
-{
- for (vector<pair<pkgCache::PkgIterator, pkgCache::VerIterator> >::iterator i=m_pkgs.begin();
- i != m_pkgs.end();
- ++i)
- {
- if (i->first.Name() == name) {
- emit_package(i->first, i->second, PK_FILTER_ENUM_NONE, state);
- return;
- }
- }
-
- pair<pkgCache::PkgIterator, pkgCache::VerIterator> pkg_ver;
- pkg_ver.first = packageCache->FindPkg(name);
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (pkg_ver.first.end() == true ||
- (pkg_ver.first.VersionList().end() && pkg_ver.first.ProvidesList().end()))
- {
- return;
- }
-
- pkg_ver.second = find_ver(pkg_ver.first);
- // check to see if the provided package isn't virtual too
- if (pkg_ver.second.end() == false)
- {
- emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
- }
-
- pkg_ver.second = find_candidate_ver(pkg_ver.first);
- // check to see if we found the package
- if (pkg_ver.second.end() == false)
- {
- emit_package(pkg_ver.first, pkg_ver.second, PK_FILTER_ENUM_NONE, state);
- }
-}
-
-void aptcc::updateInterface(int fd, int writeFd)
-{
- char buf[2];
- static char line[1024] = "";
-
- while (1) {
- // This algorithm should be improved (it's the same as the rpm one ;)
- int len = read(fd, buf, 1);
-
- // nothing was read
- if(len < 1) {
- break;
- }
-
- // update the time we last saw some action
- m_lastTermAction = time(NULL);
-
- if( buf[0] == '\n') {
- if (_cancel) {
- kill(m_child_pid, SIGTERM);
- }
- //cout << "got line: " << line << endl;
-
- gchar **split = g_strsplit(line, ":",5);
- gchar *status = g_strstrip(split[0]);
- gchar *pkg = g_strstrip(split[1]);
- gchar *percent = g_strstrip(split[2]);
- gchar *str = g_strdup(g_strstrip(split[3]));
-
- // major problem here, we got unexpected input. should _never_ happen
- if(!(pkg && status)) {
- continue;
- }
-
- // first check for errors and conf-file prompts
- if (strstr(status, "pmerror") != NULL) {
- // error from dpkg
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_PACKAGE_FAILED_TO_INSTALL,
- str);
- } else if (strstr(status, "pmconffile") != NULL) {
- // conffile-request from dpkg, needs to be parsed different
- int i=0;
- int count=0;
- string orig_file, new_file;
-
- // go to first ' and read until the end
- for(;str[i] != '\'' || str[i] == 0; i++)
- /*nothing*/
- ;
- i++;
- for(;str[i] != '\'' || str[i] == 0; i++)
- orig_file.append(1, str[i]);
- i++;
-
- // same for second ' and read until the end
- for(;str[i] != '\'' || str[i] == 0; i++)
- /*nothing*/
- ;
- i++;
- for(;str[i] != '\'' || str[i] == 0; i++)
- new_file.append(1, str[i]);
- i++;
-
- gchar *filename;
- filename = g_build_filename(DATADIR, "PackageKit", "helpers", "aptcc", "pkconffile", NULL);
- gchar **argv;
- gchar **envp;
- GError *error = NULL;
- argv = (gchar **) g_malloc(5 * sizeof(gchar *));
- argv[0] = filename;
- argv[1] = g_strdup(m_lastPackage.c_str());
- argv[2] = g_strdup(orig_file.c_str());
- argv[3] = g_strdup(new_file.c_str());
- argv[4] = NULL;
-
- gchar *socket;
- if (socket = pk_backend_get_frontend_socket(m_backend)) {
- envp = (gchar **) g_malloc(3 * sizeof(gchar *));
- envp[0] = g_strdup("DEBIAN_FRONTEND=passthrough");
- envp[1] = g_strdup_printf("DEBCONF_PIPE=%s", socket);
- envp[2] = NULL;
- } else {
- // we don't have a socket set, let's fallback to noninteractive
- envp = (gchar **) g_malloc(2 * sizeof(gchar *));
- envp[0] = g_strdup("DEBIAN_FRONTEND=noninteractive");
- envp[1] = NULL;
- }
-
- gboolean ret;
- gint exitStatus;
- ret = g_spawn_sync(NULL, // working dir
- argv, // argv
- envp, // envp
- G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
- NULL, // child_setup
- NULL, // user_data
- NULL, // standard_output
- NULL, // standard_error
- &exitStatus,
- &error);
-
- int exit_code = WEXITSTATUS(exitStatus);
- cout << filename << " " << exit_code << " ret: "<< ret << endl;
-
- if (exit_code == 10) {
- // 1 means the user wants the package config
- if (write(writeFd, "Y\n", 2) != 2) {
- // TODO we need a DPKG patch to use debconf
- g_debug("Failed to write");
- }
- } else if (exit_code == 20) {
- // 2 means the user wants to keep the current config
- if (write(writeFd, "N\n", 2) != 2) {
- // TODO we need a DPKG patch to use debconf
- g_debug("Failed to write");
- }
- } else {
- // either the user didn't choose an option or the front end failed'
- gchar *confmsg;
- confmsg = g_strdup_printf("The configuration file '%s' "
- "(modified by you or a script) "
- "has a newer version '%s'.\n"
- "Please verify your changes and update it manually.",
- orig_file.c_str(),
- new_file.c_str());
- pk_backend_message(m_backend,
- PK_MESSAGE_ENUM_CONFIG_FILES_CHANGED,
- confmsg);
- // fall back to keep the current config file
- if (write(writeFd, "N\n", 2) != 2) {
- // TODO we need a DPKG patch to use debconf
- g_debug("Failed to write");
- }
- }
- } else if (strstr(status, "pmstatus") != NULL) {
- // INSTALL & UPDATE
- // - Running dpkg
- // loops ALL
- // - 0 Installing pkg (sometimes this is skiped)
- // - 25 Preparing pkg
- // - 50 Unpacking pkg
- // - 75 Preparing to configure pkg
- // ** Some pkgs have
- // - Running post-installation
- // - Running dpkg
- // reloops all
- // - 0 Configuring pkg
- // - +25 Configuring pkg (SOMETIMES)
- // - 100 Installed pkg
- // after all
- // - Running post-installation
-
- // REMOVE
- // - Running dpkg
- // loops
- // - 25 Removing pkg
- // - 50 Preparing for removal of pkg
- // - 75 Removing pkg
- // - 100 Removed pkg
- // after all
- // - Running post-installation
-
- // Let's start parsing the status:
- if (starts_with(str, "Preparing to configure")) {
- // Preparing to Install/configure
-// cout << "Found Preparing to configure! " << line << endl;
- // The next item might be Configuring so better it be 100
- m_lastSubProgress = 100;
- emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
- pk_backend_set_sub_percentage(m_backend, 75);
- } else if (starts_with(str, "Preparing for removal")) {
- // Preparing to Install/configure
-// cout << "Found Preparing for removal! " << line << endl;
- m_lastSubProgress = 50;
- emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
- pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
- } else if (starts_with(str, "Preparing")) {
- // Preparing to Install/configure
-// cout << "Found Preparing! " << line << endl;
- // if last package is different then finish it
- if (!m_lastPackage.empty() && m_lastPackage.compare(pkg) != 0) {
-// cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- }
- emitTransactionPackage(pkg, PK_INFO_ENUM_PREPARING);
- pk_backend_set_sub_percentage(m_backend, 25);
- } else if (starts_with(str, "Unpacking")) {
-// cout << "Found Unpacking! " << line << endl;
- emitTransactionPackage(pkg, PK_INFO_ENUM_DECOMPRESSING);
- pk_backend_set_sub_percentage(m_backend, 50);
- } else if (starts_with(str, "Configuring")) {
- // Installing Package
-// cout << "Found Configuring! " << line << endl;
- if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
- cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- m_lastSubProgress = 0;
- }
- emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
- pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
- m_lastSubProgress += 25;
- } else if (starts_with(str, "Running dpkg")) {
-// cout << "Found Running dpkg! " << line << endl;
- } else if (starts_with(str, "Running")) {
-// cout << "Found Running! " << line << endl;
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_COMMIT);
- } else if (starts_with(str, "Installing")) {
-// cout << "Found Installing! " << line << endl;
- // FINISH the last package
- if (!m_lastPackage.empty()) {
-// cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- }
- m_lastSubProgress = 0;
- emitTransactionPackage(pkg, PK_INFO_ENUM_INSTALLING);
- pk_backend_set_sub_percentage(m_backend, 0);
- } else if (starts_with(str, "Removing")) {
-// cout << "Found Removing! " << line << endl;
- if (m_lastSubProgress >= 100 && !m_lastPackage.empty()) {
-// cout << "FINISH the last package: " << m_lastPackage << endl;
- emitTransactionPackage(m_lastPackage, PK_INFO_ENUM_FINISHED);
- }
- m_lastSubProgress += 25;
- emitTransactionPackage(pkg, PK_INFO_ENUM_REMOVING);
- pk_backend_set_sub_percentage(m_backend, m_lastSubProgress);
- } else if (starts_with(str, "Installed") ||
- starts_with(str, "Removed")) {
-// cout << "Found FINISHED! " << line << endl;
- m_lastSubProgress = 100;
- emitTransactionPackage(pkg, PK_INFO_ENUM_FINISHED);
- } else {
- cout << ">>>Unmaped value<<< :" << line << endl;
- }
-
- if (!starts_with(str, "Running")) {
- m_lastPackage = pkg;
- }
- m_startCounting = true;
- } else {
- m_startCounting = true;
- }
-
- int val = atoi(percent);
- //cout << "progress: " << val << endl;
- pk_backend_set_percentage(m_backend, val);
-
- // clean-up
- g_strfreev(split);
- g_free(str);
- line[0] = 0;
- } else {
- buf[1] = 0;
- strcat(line, buf);
- }
- }
-
- time_t now = time(NULL);
-
- if(!m_startCounting) {
- usleep(100000);
- // wait until we get the first message from apt
- m_lastTermAction = now;
- }
-
- if ((now - m_lastTermAction) > m_terminalTimeout) {
- // get some debug info
- g_warning("no statusfd changes/content updates in terminal for %i"
- " seconds",m_terminalTimeout);
- m_lastTermAction = time(NULL);
- }
-
- // sleep for a while to don't obcess over it
- usleep(5000);
-}
-
-// DoAutomaticRemove - Remove all automatic unused packages /*{{{*/
-// ---------------------------------------------------------------------
-/* Remove unused automatic packages */
-bool aptcc::DoAutomaticRemove(pkgCacheFile &Cache)
-{
- bool doAutoRemove = _config->FindB("APT::Get::AutomaticRemove", false);
- pkgDepCache::ActionGroup group(*Cache);
-
- if (_config->FindB("APT::Get::Remove",true) == false &&
- doAutoRemove == true)
- {
- cout << "We are not supposed to delete stuff, can't start "
- "AutoRemover" << endl;
- doAutoRemove = false;
- }
-
- // look over the cache to see what can be removed
- for (pkgCache::PkgIterator Pkg = Cache->PkgBegin(); ! Pkg.end(); ++Pkg)
- {
- if (Cache[Pkg].Garbage && doAutoRemove)
- {
- if (Pkg.CurrentVer() != 0 &&
- Pkg->CurrentState != pkgCache::State::ConfigFiles) {
- Cache->MarkDelete(Pkg, _config->FindB("APT::Get::Purge", false));
- } else {
- Cache->MarkKeep(Pkg, false, false);
- }
- }
- }
-
- // Now see if we destroyed anything
- if (Cache->BrokenCount() != 0)
- {
- cout << "Hmm, seems like the AutoRemover destroyed something which really\n"
- "shouldn't happen. Please file a bug report against apt." << endl;
- // TODO call show_broken
- // ShowBroken(c1out,Cache,false);
- return _error->Error("Internal Error, AutoRemover broke stuff");
- }
- return true;
-}
-
-PkgList aptcc::resolvePI(gchar **package_ids)
-{
- gchar *pi;
- PkgList ret;
-
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_QUERY);
-
- // Don't fail if package list is empty
- if (package_ids == NULL)
- return ret;
-
- for (uint i = 0; i < g_strv_length(package_ids); i++) {
- if (_cancel) {
- break;
- }
-
- PkgPair pair;
- pi = package_ids[i];
-
- if (pk_package_id_check(pi) == false) {
- pair.first = packageCache->FindPkg(pi);
- // Ignore packages that could not be found or that exist only due to dependencies.
- if (pair.first.end() == true ||
- (pair.first.VersionList().end() && pair.first.ProvidesList().end())) {
- continue;
- }
-
- pair.second = find_ver(pair.first);
- // check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
- }
-
- pair.second = find_candidate_ver(pair.first);
- // check to see if the provided package isn't virtual too
- if (pair.second.end() == false) {
- ret.push_back(pair);
- }
- } else {
- bool found;
- pair = find_package_id(pi, found);
- // check to see if we found the package
- if (found) {
- ret.push_back(pair);
- }
- }
- }
- return ret;
-}
-
-bool aptcc::markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove)
-{
- // We call gdebi to tell us what do we need to install/remove
- // in order to be able to install this package
- gint status;
- gchar **argv;
- gchar **envp;
- gchar *std_out;
- gchar *std_err;
- GError *gerror = NULL;
- argv = (gchar **) g_malloc(5 * sizeof(gchar *));
- argv[0] = g_strdup("/usr/bin/gdebi");
- argv[1] = g_strdup("-q");
- argv[2] = g_strdup("--apt-line");
- argv[3] = g_strdup(file);
- argv[4] = NULL;
-
- gboolean ret;
- ret = g_spawn_sync(NULL, // working dir
- argv, // argv
- envp, // envp
- G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
- NULL, // child_setup
- NULL, // user_data
- &std_out, // standard_output
- &std_err, // standard_error
- &status,
- &gerror);
- int exit_code = WEXITSTATUS(status);
-// cout << "DebStatus " << exit_code << " WEXITSTATUS " << WEXITSTATUS(status) << " ret: "<< ret << endl;
- cout << "std_out " << strlen(std_out) << std_out << endl;
- cout << "std_err " << strlen(std_err) << std_err << endl;
-
- PkgList pkgs;
- if (exit_code == 1) {
- if (strlen(std_out) == 0) {
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_err);
- } else {
- pk_backend_error_code(m_backend, PK_ERROR_ENUM_TRANSACTION_ERROR, std_out);
- }
- return false;
- } else {
- // GDebi outputs two lines
- gchar **lines = g_strsplit(std_out, "\n", 3);
-
- // The first line contains the packages to install
- gchar **installPkgs = g_strsplit(lines[0], " ", 0);
-
- // The second line contains the packages to remove with '-' appended to
- // the end of the package name
- gchar **removePkgs = NULL;
- if (strlen(lines[1]) > 0) {
- gchar *removeStr = g_strndup(lines[1], strlen(lines[1]) - 1);
- removePkgs = g_strsplit(removeStr, "- ", 0);
- g_free(removeStr);
- }
-
- // Store the changes
- install = resolvePI(installPkgs);
- remove = resolvePI(removePkgs);
- m_localDebFile = file;
-
- g_strfreev(lines);
- g_strfreev(installPkgs);
- g_strfreev(removePkgs);
- }
-
- return true;
-}
-
-bool aptcc::runTransaction(PkgList &install, PkgList &remove, bool simulate)
-{
- //cout << "runTransaction" << simulate << remove << endl;
- bool WithLock = !simulate; // Check to see if we are just simulating,
- //since for that no lock is needed
-
- pkgCacheFile Cache;
- OpTextProgress Prog(*_config);
- int timeout = 10;
- // TODO test this
- while (Cache.Open(&Prog, WithLock) == false) {
- // failed to open cache, try checkDeps then..
- // || Cache.CheckDeps(CmdL.FileSize() != 1) == false
- if (WithLock == false || (timeout <= 0)) {
- show_errors(m_backend, PK_ERROR_ENUM_CANNOT_GET_LOCK);
- return false;
- } else {
- _error->Discard();
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_WAITING_FOR_LOCK);
- sleep(1);
- timeout--;
- }
- }
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
-
- // Enter the special broken fixing mode if the user specified arguments
- bool BrokenFix = false;
- if (Cache->BrokenCount() != 0) {
- BrokenFix = true;
- }
-
- unsigned int ExpectedInst = 0;
- pkgProblemResolver Fix(Cache);
-
- // new scope for the ActionGroup
- {
- pkgDepCache::ActionGroup group(Cache);
- for(PkgList::iterator i = install.begin(); i != install.end(); ++i) {
- pkgCache::PkgIterator Pkg = i->first;
- if (_cancel) {
- break;
- }
-
- if (TryToInstall(Pkg,
- Cache,
- Fix,
- false, // remove
- BrokenFix,
- ExpectedInst) == false) {
- return false;
- }
- }
-
- for(PkgList::iterator i = remove.begin(); i != remove.end(); ++i) {
- pkgCache::PkgIterator Pkg = i->first;
- if (_cancel) {
- break;
- }
-
- if (TryToInstall(Pkg,
- Cache,
- Fix,
- true, // remove
- BrokenFix,
- ExpectedInst) == false) {
- return false;
- }
- }
-
- // Call the scored problem resolver
- Fix.InstallProtect();
- if (Fix.Resolve(true) == false) {
- _error->Discard();
- }
-
- // Now we check the state of the packages,
- if (Cache->BrokenCount() != 0)
- {
- // if the problem resolver could not fix all broken things
- // show what is broken
- show_broken(m_backend, Cache, false);
- return false;
- }
- }
- // Try to auto-remove packages
- if (!DoAutomaticRemove(Cache)) {
- // TODO
- return false;
- }
-
- // check for essential packages!!!
- if (removingEssentialPackages(Cache)) {
- return false;
- }
-
- if (simulate) {
- // Print out a list of packages that are going to be installed extra
- emitChangedPackages(Cache);
- return true;
- } else {
- // Store the packages that are going to change
- // so we can emit them as we process it.
- populateInternalPackages(Cache);
- return installPackages(Cache);
- }
-}
-
- /*}}}*/
-
-// InstallPackages - Actually download and install the packages /*{{{*/
-// ---------------------------------------------------------------------
-/* This displays the informative messages describing what is going to
- happen and then calls the download routines */
-bool aptcc::installPackages(pkgCacheFile &Cache)
-{
- //cout << "installPackages() called" << endl;
- if (_config->FindB("APT::Get::Purge",false) == true)
- {
- pkgCache::PkgIterator I = Cache->PkgBegin();
- for (; I.end() == false; I++)
- {
- if (I.Purge() == false && Cache[I].Mode == pkgDepCache::ModeDelete) {
- Cache->MarkDelete(I,true);
- }
- }
- }
-
- // check for essential packages!!!
- if (removingEssentialPackages(Cache)) {
- return false;
- }
-
- // Sanity check
- if (Cache->BrokenCount() != 0)
- {
- // TODO
- show_broken(m_backend, Cache, false);
- _error->Error("Internal error, InstallPackages was called with broken packages!");
- return false;
- }
-
- if (Cache->DelCount() == 0 && Cache->InstCount() == 0 &&
- Cache->BadCount() == 0) {
- return true;
- }
-
- // No remove flag
- if (Cache->DelCount() != 0 && _config->FindB("APT::Get::Remove", true) == false) {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE,
- "Packages need to be removed but remove is disabled.");
- return false;
- }
-
- // Create the text record parser
- pkgRecords Recs(Cache);
- if (_error->PendingError() == true) {
- return false;
- }
-
- // Lock the archive directory
- FileFd Lock;
- if (_config->FindB("Debug::NoLocking", false) == false)
- {
- Lock.Fd(GetLock(_config->FindDir("Dir::Cache::Archives") + "lock"));
- if (_error->PendingError() == true) {
- return _error->Error("Unable to lock the download directory");
- }
- }
-
- // Create the download object
- AcqPackageKitStatus Stat(this, m_backend, _cancel);
-
- // get a fetcher
- pkgAcquire fetcher;
- fetcher.Setup(&Stat);
-
- // Create the package manager and prepare to download
-// SPtr<pkgPackageManager> PM= _system->CreatePM(Cache);
- SPtr<pkgPackageManager> PM = new pkgDebDPkgPM(Cache);
- if (PM->GetArchives(&fetcher, packageSourceList, &Recs) == false ||
- _error->PendingError() == true) {
- return false;
- }
-
- // Generate the list of affected packages and sort it
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() == false; I++)
- {
- // Ignore no-version packages
- if (I->VersionList == 0) {
- continue;
- }
-
- // Not interesting
- if ((Cache[I].Keep() == true ||
- Cache[I].InstVerIter(Cache) == I.CurrentVer()) &&
- I.State() == pkgCache::PkgIterator::NeedsNothing &&
- (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall &&
- (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete ||
- (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge))
- {
- continue;
- }
-
- // Append it to the list
- Stat.addPackagePair(pair<pkgCache::PkgIterator, pkgCache::VerIterator>(I, Cache[I].InstVerIter(Cache)));
- }
-
- // Display statistics
- double FetchBytes = fetcher.FetchNeeded();
- double FetchPBytes = fetcher.PartialPresent();
- double DebBytes = fetcher.TotalNeeded();
- if (DebBytes != Cache->DebSize())
- {
- cout << DebBytes << ',' << Cache->DebSize() << endl;
-cout << "How odd.. The sizes didn't match, email apt at packages.debian.org";
-/* _error->Warning("How odd.. The sizes didn't match, email apt at packages.debian.org");*/
- }
-
- // Number of bytes
-// if (DebBytes != FetchBytes)
-// ioprintf(c1out, "Need to get %sB/%sB of archives.\n",
-// SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
-// else if (DebBytes != 0)
-// ioprintf(c1out, "Need to get %sB of archives.\n",
-// SizeToStr(DebBytes).c_str());
-
- // Size delta
-// if (Cache->UsrSize() >= 0)
-// ioprintf(c1out, "After this operation, %sB of additional disk space will be used.\n",
-// SizeToStr(Cache->UsrSize()).c_str());
-// else
-// ioprintf(c1out, "After this operation, %sB disk space will be freed.\n",
-// SizeToStr(-1*Cache->UsrSize()).c_str());
-
- if (_error->PendingError() == true) {
- cout << "PendingError " << endl;
- return false;
- }
-
- /* Check for enough free space */
- struct statvfs Buf;
- string OutputDir = _config->FindDir("Dir::Cache::Archives");
- if (statvfs(OutputDir.c_str(),&Buf) != 0) {
- return _error->Errno("statvfs",
- "Couldn't determine free space in %s",
- OutputDir.c_str());
- }
- if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
- {
- struct statfs Stat;
- if (statfs(OutputDir.c_str(), &Stat) != 0 ||
- unsigned(Stat.f_type) != RAMFS_MAGIC)
- {
- pk_backend_error_code(m_backend,
- PK_ERROR_ENUM_NO_SPACE_ON_DEVICE,
- string("You don't have enough free space in ").append(OutputDir).c_str());
- return _error->Error("You don't have enough free space in %s.",
- OutputDir.c_str());
- }
- }
-
- if (!checkTrusted(fetcher, m_backend)) {
- return false;
- }
-
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_DOWNLOAD);
- pk_backend_set_simultaneous_mode(m_backend, true);
- // Download and check if we can continue
- if (fetcher.Run() != pkgAcquire::Continue
- && _cancel == false)
- {
- // We failed and we did not cancel
- show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
- return false;
- }
- pk_backend_set_simultaneous_mode(m_backend, false);
-
- if (_error->PendingError() == true) {
- cout << "PendingError download" << endl;
- return false;
- }
-
- // Right now it's not safe to cancel
- pk_backend_set_allow_cancel (m_backend, false);
-
- // TODO true or false?
- if (_cancel) {
- return true;
- }
-
- // Download should be finished by now, changing it's status
- pk_backend_set_status (m_backend, PK_STATUS_ENUM_RUNNING);
- pk_backend_set_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
- pk_backend_set_sub_percentage(m_backend, PK_BACKEND_PERCENTAGE_INVALID);
-
- // TODO DBus activated does not have all vars
- // we could try to see if this is the case
- setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1);
- _system->UnLock();
-
- if (!m_localDebFile.empty()) {
- // add the local file name to be proccessed by the PM queue
- pkgDebDPkgPM *pm = static_cast<pkgDebDPkgPM*>(&*PM);
- pm->addDebFile(m_localDebFile);
- }
-
- pkgPackageManager::OrderResult res;
- res = PM->DoInstallPreFork();
- if (res == pkgPackageManager::Failed) {
- g_warning ("Failed to prepare installation");
- show_errors(m_backend, PK_ERROR_ENUM_PACKAGE_DOWNLOAD_FAILED);
- return false;
- }
-
- // File descriptors for reading dpkg --status-fd
- int readFromChildFD[2];
- if (pipe(readFromChildFD) < 0) {
- cout << "Failed to create a pipe" << endl;
- return false;
- }
-
- int pty_master;
- m_child_pid = forkpty(&pty_master, NULL, NULL, NULL);
- if (m_child_pid == -1) {
- return false;
- }
-
- if (m_child_pid == 0) {
- //cout << "FORKED: installPackages(): DoInstall" << endl;
-
- // close pipe we don't need
- close(readFromChildFD[0]);
-
- // Change the locale to not get libapt localization
- setlocale(LC_ALL, "C");
-
- // Debconf handlying
- gchar *socket;
- if (socket = pk_backend_get_frontend_socket(m_backend)) {
- setenv("DEBIAN_FRONTEND", "passthrough", 1);
- setenv("DEBCONF_PIPE", socket, 1);
- } else {
- // we don't have a socket set, let's fallback to noninteractive
- setenv("DEBIAN_FRONTEND", "noninteractive", 1);
- }
-
- gchar *locale;
- // Set the LANGUAGE so debconf messages get localization
- if (locale = pk_backend_get_locale(m_backend)) {
- setenv("LANGUAGE", locale, 1);
- setenv("LANG", locale, 1);
- //setenv("LANG", "C", 1);
- }
-
- // Pass the write end of the pipe to the install function
- res = PM->DoInstallPostFork(readFromChildFD[1]);
-
- // dump errors into cerr (pass it to the parent process)
- _error->DumpErrors();
-
- close(readFromChildFD[1]);
-
- _exit(res);
- }
-
- cout << "PARENT proccess running..." << endl;
- // make it nonblocking, verry important otherwise
- // when the child finish we stay stuck.
- fcntl(readFromChildFD[0], F_SETFL, O_NONBLOCK);
- fcntl(pty_master, F_SETFL, O_NONBLOCK);
-
- // init the timer
- m_lastTermAction = time(NULL);
- m_startCounting = false;
-
- // Check if the child died
- int ret;
- char masterbuf[1024];
- while (waitpid(m_child_pid, &ret, WNOHANG) == 0) {
- // TODO: This is dpkg's raw output. Maybe save it for error-solving?
- while(read(pty_master, masterbuf, sizeof(masterbuf)) > 0);
- updateInterface(readFromChildFD[0], pty_master);
- }
-
- close(readFromChildFD[0]);
- close(readFromChildFD[1]);
- close(pty_master);
-
- cout << "Parent finished..." << endl;
- return true;
-}
-
diff --git a/backends/aptcc/apt.h b/backends/aptcc/apt.h
deleted file mode 100644
index 53edd75..0000000
--- a/backends/aptcc/apt.h
+++ /dev/null
@@ -1,182 +0,0 @@
-// apt.h -*-c++-*-
-//
-// Copyright 1999-2002, 2004-2005, 2007-2008 Daniel Burrows
-// Copyright (C) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
-//
-
-#ifndef APT_H
-#define APT_H
-
-#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/pkgcachegen.h>
-#include <apt-pkg/cachefile.h>
-#include <apt-pkg/policy.h>
-
-#include <pk-backend.h>
-
-#include <set>
-
-using namespace std;
-
-/**
-* returns a list of packages names
-*/
-vector<string> search_files (PkBackend *backend, gchar **values, bool &_cancel);
-
-/**
-* returns a list of packages names
-*/
-vector<string> searchMimeType (PkBackend *backend, gchar **values, bool &error, bool &_cancel);
-
-typedef pair<pkgCache::PkgIterator, pkgCache::VerIterator> PkgPair;
-typedef vector<PkgPair> PkgList;
-
-class pkgProblemResolver;
-class aptcc
-{
-// typedef int user_tag_reference;
-public:
- aptcc(PkBackend *backend, bool &cancel);
- ~aptcc();
-
- bool init();
- void cancel();
-
- // Check the returned VerIterator.end()
- // if it's true we could not find it
- pair<pkgCache::PkgIterator, pkgCache::VerIterator>
- find_package_id(const gchar *package_id, bool &found);
- pkgCache::VerIterator find_ver(const pkgCache::PkgIterator &pkg);
- pkgCache::VerIterator find_candidate_ver(const pkgCache::PkgIterator &pkg);
-
- PkgList resolvePI(gchar **package_ids);
- bool markDebFileForInstall(const gchar *file, PkgList &install, PkgList &remove);
-
- /**
- * runs a transaction to install/remove/update packages
- * - for install and update, \p remove should be set to false
- * - if you are going to remove, \p remove should be true
- * - if you don't want to actually install/update/remove
- * \p simulate should be true, in this case packages with
- * what's going to happen will be emitted.
- */
- bool runTransaction(PkgList &install, PkgList &remove, bool simulate);
-
- /**
- * Get depends
- */
- void get_depends(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive);
-
- /**
- * Get requires
- */
- void get_requires(PkgList &output,
- pkgCache::PkgIterator pkg,
- bool recursive);
-
- /**
- * Emits a package if it match the filters
- */
- void emit_package(const pkgCache::PkgIterator &pkg,
- const pkgCache::VerIterator &ver,
- PkBitfield filters = PK_FILTER_ENUM_NONE,
- PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
-
- void emit_packages(PkgList &output,
- PkBitfield filters = PK_FILTER_ENUM_NONE,
- PkInfoEnum state = PK_INFO_ENUM_UNKNOWN);
-
- void emitUpdates(PkgList &output, PkBitfield filters = PK_FILTER_ENUM_NONE);
-
- /**
- * Emits details
- */
- void emitDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
- void emitDetails(PkgList &pkgs);
-
- /**
- * Emits update detail
- */
- void emitUpdateDetails(const pkgCache::PkgIterator &pkg, const pkgCache::VerIterator &ver);
- void emitUpdateDetails(PkgList &pkgs);
-
- /**
- * Emits files of packages
- */
- void emitFiles(PkBackend *backend, const gchar *pi);
-
- /**
- * seems to install packages
- */
- bool installPackages(pkgCacheFile &Cache);
-
- /**
- * check which package provides the codec
- */
- void providesCodec(PkgList &output, gchar **values);
-
- /**
- * check which package provides a shared library
- */
- void providesLibrary(PkgList &output, gchar **values);
-
- pkgRecords *packageRecords;
- pkgCache *packageCache;
- pkgDepCache *packageDepCache;
- pkgSourceList *packageSourceList;
-
-private:
- MMap *Map;
- OpProgress Progress;
- pkgPolicy *Policy;
- PkBackend *m_backend;
- bool &_cancel;
-
- bool TryToInstall(pkgCache::PkgIterator Pkg,
- pkgDepCache &Cache,
- pkgProblemResolver &Fix,
- bool Remove,
- bool BrokenFix,
- unsigned int &ExpectedInst);
-
- /**
- * interprets dpkg status fd
- */
- void updateInterface(int readFd, int writeFd);
- bool DoAutomaticRemove(pkgCacheFile &Cache);
- void emitChangedPackages(pkgCacheFile &Cache);
- bool removingEssentialPackages(pkgCacheFile &Cache);
-
- bool m_isMultiArch;
- PkgList m_pkgs;
- string m_localDebFile;
- void populateInternalPackages(pkgCacheFile &Cache);
- void emitTransactionPackage(string name, PkInfoEnum state);
- time_t m_lastTermAction;
- string m_lastPackage;
- uint m_lastSubProgress;
- PkInfoEnum m_state;
- bool m_startCounting;
- // when the internal terminal timesout after no activity
- int m_terminalTimeout;
- pid_t m_child_pid;
-};
-
-#endif
diff --git a/backends/aptcc/aptcc_show_broken.cpp b/backends/aptcc/aptcc_show_broken.cpp
deleted file mode 100644
index 8001136..0000000
--- a/backends/aptcc/aptcc_show_broken.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-// aptcc_show_broken.cc
-//
-// Copyright 2004 Daniel Burrows
-// Copyright 2009-2010 Daniel Nicoletti
-
-#include "aptcc_show_broken.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include <sstream>
-
-using namespace std;
-
-/** Shows broken dependencies for a single package */
-void show_broken(PkBackend *backend, pkgCacheFile &Cache, bool Now)
-{
- stringstream out;
-
- out << "The following packages have unmet dependencies:" << endl;
- for (pkgCache::PkgIterator I = Cache->PkgBegin(); ! I.end(); ++I) {
- if (Now == true) {
- if (Cache[I].NowBroken() == false) {
- continue;
- }
- } else {
- if (Cache[I].InstBroken() == false){
- continue;
- }
- }
-
- // Print out each package and the failed dependencies
- out << " " << I.Name() << ":";
- unsigned Indent = strlen(I.Name()) + 3;
- bool First = true;
- pkgCache::VerIterator Ver;
-
- if (Now == true) {
- Ver = I.CurrentVer();
- } else {
- Ver = Cache[I].InstVerIter(Cache);
- }
-
- if (Ver.end() == true) {
- out << endl;
- continue;
- }
-
- for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false;) {
- // Compute a single dependency element (glob or)
- pkgCache::DepIterator Start;
- pkgCache::DepIterator End;
- D.GlobOr(Start,End); // advances D
-
- if (Cache->IsImportantDep(End) == false){
- continue;
- }
-
- if (Now == true) {
- if ((Cache[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow){
- continue;
- }
- } else {
- if ((Cache[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall) {
- continue;
- }
- }
-
- bool FirstOr = true;
- while (1) {
- if (First == false){
- for (unsigned J = 0; J != Indent; J++) {
- out << ' ';
- }
- }
- First = false;
-
- if (FirstOr == false) {
- for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++) {
- out << ' ';
- }
- } else {
- out << ' ' << End.DepType() << ": ";
- }
- FirstOr = false;
-
- out << Start.TargetPkg().Name();
-
- // Show a quick summary of the version requirements
- if (Start.TargetVer() != 0) {
- out << " (" << Start.CompType() << " " << Start.TargetVer() << ")";
- }
-
- /* Show a summary of the target package if possible. In the case
- of virtual packages we show nothing */
- pkgCache::PkgIterator Targ = Start.TargetPkg();
- if (Targ->ProvidesList == 0) {
- out << ' ';
- pkgCache::VerIterator Ver = Cache[Targ].InstVerIter(Cache);
- if (Now == true) {
- Ver = Targ.CurrentVer();
- }
-
- if (Ver.end() == false)
- {
- char buffer[1024];
- if (Now == true) {
- sprintf(buffer, "but %s is installed", Ver.VerStr());
- } else {
- sprintf(buffer, "but %s is to be installed", Ver.VerStr());
- }
-
- out << buffer;
- } else {
- if (Cache[Targ].CandidateVerIter(Cache).end() == true) {
- if (Targ->ProvidesList == 0) {
- out << "but it is not installable";
- } else {
- out << "but it is a virtual package";
- }
- } else {
- if (Now) {
- out << "but it is not installed";
- } else {
- out << "but it is not going to be installed";
- }
- }
- }
- }
-
- if (Start != End) {
- out << " or";
- }
- out << endl;
-
- if (Start == End){
- break;
- }
- Start++;
- }
- }
- }
- pk_backend_error_code (backend, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, out.str().c_str());
-}
diff --git a/backends/aptcc/aptcc_show_broken.h b/backends/aptcc/aptcc_show_broken.h
deleted file mode 100644
index 7aa5adf..0000000
--- a/backends/aptcc/aptcc_show_broken.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// aptcc_show_broken.h -*-c++-*-
-//
-// Copyright 2004 Daniel Burrows
-// Copyright 2009-2010 Daniel Nicoletti
-
-#ifndef APTCC_SHOW_BROKEN_H
-#define APTCC_SHOW_BROKEN_H
-
-#include <pk-backend.h>
-
-#include <apt-pkg/cachefile.h>
-
-/** \file aptcc_show_broken.h
- */
-
-/** Shows a list of all broken packages together with their
- * dependencies. Similar to and based on the equivalent routine in
- * apt-get.
- */
-void show_broken(PkBackend *backend, pkgCacheFile &cache, bool Now);
-
-#endif // APTCC_SHOW_BROKEN
diff --git a/backends/aptcc/aptcc_show_error.cpp b/backends/aptcc/aptcc_show_error.cpp
deleted file mode 100644
index e9117da..0000000
--- a/backends/aptcc/aptcc_show_error.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// aptcc_show_broken.cc
-//
-// Copyright 2004 Daniel Burrows
-// Copyright 2009 Daniel Nicoletti
-
-#include "aptcc_show_error.h"
-
-#include <string>
-#include <sstream>
-
-using namespace std;
-
-bool show_errors(PkBackend *backend, PkErrorEnum errorCode)
-{
- stringstream errors;
-
- string Err;
- while (_error->empty() == false)
- {
- bool Type = _error->PopMessage(Err);
- if (Type == true) {
- errors << "E: " << Err << endl;
- } else {
- errors << "W: " << Err << endl;
- }
- }
-
- if (!errors.str().empty())
- {
- pk_backend_error_code(backend, errorCode, errors.str().c_str());
- }
-}
-
-bool show_warnings(PkBackend *backend, PkMessageEnum message)
-{
- stringstream warnings;
-
- string Err;
- while (_error->empty() == false)
- {
- bool Type = _error->PopMessage(Err);
- if (Type == true) {
- warnings << "E: " << Err << endl;
- } else {
- warnings << "W: " << Err << endl;
- }
- }
-
- if (!warnings.str().empty())
- {
- pk_backend_message(backend, message, warnings.str().c_str());
- }
-}
diff --git a/backends/aptcc/aptcc_show_error.h b/backends/aptcc/aptcc_show_error.h
deleted file mode 100644
index 09817b8..0000000
--- a/backends/aptcc/aptcc_show_error.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// aptcc_show_broken.h -*-c++-*-
-//
-// Copyright 2004 Daniel Burrows
-// Copyright 2009 Daniel Nicoletti
-
-#ifndef APTCC_SHOW_ERROR_H
-#define APTCC_SHOW_ERROR_H
-
-#include <pk-backend.h>
-#include <apt-pkg/error.h>
-
-/** \file aptcc_show_error.h
- */
-
-/**
- * Call the Packagekit error dialog
- */
-bool show_errors(PkBackend *backend,
- PkErrorEnum errorCode = PK_ERROR_ENUM_UNKNOWN);
-
-/**
- * Call the Packagekit message dialog
- */
-bool show_warnings(PkBackend *backend,
- PkMessageEnum message = PK_MESSAGE_ENUM_UNKNOWN);
-#endif // APTCC_SHOW_ERROR
diff --git a/backends/aptcc/pk-backend-aptcc.cpp b/backends/aptcc/pk-backend-aptcc.cpp
index 1815a12..3a95816 100644
--- a/backends/aptcc/pk-backend-aptcc.cpp
+++ b/backends/aptcc/pk-backend-aptcc.cpp
@@ -25,14 +25,13 @@
#include <apt-pkg/algorithms.h>
#include <apt-pkg/aptconfiguration.h>
-#include "apt.h"
+#include "apt-intf.h"
#include "apt-utils.h"
#include "matcher.h"
-#include "aptcc_show_broken.h"
+#include "apt-messages.h"
#include "acqprogress.h"
-#include "aptcc_show_error.h"
#include "pkg_acqfile.h"
-#include "rsources.h"
+#include "apt-sourceslist.h"
#include <config.h>
#include <pk-backend.h>
@@ -161,7 +160,7 @@ pk_backend_get_mime_types (PkBackend *backend)
void
pk_backend_cancel (PkBackend *backend)
{
- aptcc *m_apt = (aptcc*) pk_backend_get_pointer(backend, "aptcc_obj");
+ AptIntf *m_apt = (AptIntf*) pk_backend_get_pointer(backend, "aptcc_obj");
if (m_apt) {
m_apt->cancel();
}
@@ -181,7 +180,7 @@ backend_get_depends_or_requires_thread (PkBackend *backend)
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -278,7 +277,7 @@ backend_get_files_thread (PkBackend *backend)
return false;
}
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -340,7 +339,7 @@ backend_get_details_thread (PkBackend *backend)
return false;
}
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -394,7 +393,7 @@ backend_get_or_update_system_thread (PkBackend *backend)
getUpdates = pk_backend_get_bool(backend, "getUpdates");
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -503,7 +502,7 @@ backend_what_provides_thread (PkBackend *backend)
provides == PK_PROVIDES_ENUM_MIMETYPE ||
provides == PK_PROVIDES_ENUM_CODEC ||
provides == PK_PROVIDES_ENUM_ANY) {
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -601,7 +600,7 @@ pk_backend_download_packages_thread (PkBackend *backend)
directory = _config->FindDir("Dir::Cache::archives") + "partial/";
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -721,7 +720,7 @@ pk_backend_refresh_cache_thread (PkBackend *backend)
{
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -788,7 +787,7 @@ pk_backend_resolve_thread (PkBackend *backend)
package_ids = pk_backend_get_strv (backend, "package_ids");
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -827,7 +826,7 @@ pk_backend_search_files_thread (PkBackend *backend)
// as we can only search for installed files lets avoid the opposite
if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -899,7 +898,7 @@ backend_search_groups_thread (PkBackend *backend)
}
}
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -979,7 +978,7 @@ backend_search_package_thread (PkBackend *backend)
return false;
}
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -1122,7 +1121,7 @@ backend_manage_packages_thread (PkBackend *backend)
cout << "FILE INSTALL: " << fileInstall << endl;
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
@@ -1399,7 +1398,7 @@ backend_get_packages_thread (PkBackend *backend)
filters = (PkBitfield) pk_backend_get_uint (backend, "filters");
pk_backend_set_allow_cancel (backend, true);
- aptcc *m_apt = new aptcc(backend, _cancel);
+ AptIntf *m_apt = new AptIntf(backend, _cancel);
pk_backend_set_pointer(backend, "aptcc_obj", m_apt);
if (m_apt->init()) {
g_debug ("Failed to create apt cache");
diff --git a/backends/aptcc/pkg_acqfile.cpp b/backends/aptcc/pkg_acqfile.cpp
index 872816b..d20cff1 100644
--- a/backends/aptcc/pkg_acqfile.cpp
+++ b/backends/aptcc/pkg_acqfile.cpp
@@ -1,22 +1,24 @@
-// pkg_acqfile.cc
-//
-// Copyright 2002, 2005 Daniel Burrows
-// Copyright 2009 Daniel Nicoletti
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
+/* pkg_acqfile.cpp
+ *
+ * Copyright (c) 2002, 2005 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
// (based on pkg_changelog)
diff --git a/backends/aptcc/pkg_acqfile.h b/backends/aptcc/pkg_acqfile.h
index a6638b7..337ff76 100644
--- a/backends/aptcc/pkg_acqfile.h
+++ b/backends/aptcc/pkg_acqfile.h
@@ -1,28 +1,34 @@
-// pkg_acqfile.h -*-c++-*-
-//
-// Copyright (C) 2002, 2005 Daniel Burrows
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of
-// the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; see the file COPYING. If not, write to
-// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
+/* pkg_acqfile.h
+ *
+ * Copyright (c) 2002, 2005 Daniel Burrows
+ * Copyright (c) 2009 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * 2012 Matthias Klumpp <matthias at tenstral.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef PKG_ACQFILE_H
+#define PKG_ACQFILE_H
#include <apt-pkg/acquire-item.h>
/** \file pkg_acqfile.h
*/
-class pkgAcqFileSane:public pkgAcquire::Item
+class pkgAcqFileSane : public pkgAcquire::Item
// This is frustrating: pkgAcqFile is **almost** good enough, but has some
// hardcoded stuff that makes it not quite work.
//
@@ -48,3 +54,5 @@ public:
bool get_archive(pkgAcquire *Owner, pkgSourceList *Sources,
pkgRecords *Recs, pkgCache::VerIterator const &Version,
std::string directory, std::string &StoreFilename);
+
+#endif
diff --git a/backends/aptcc/rsources.cpp b/backends/aptcc/rsources.cpp
deleted file mode 100644
index 6283ee7..0000000
--- a/backends/aptcc/rsources.cpp
+++ /dev/null
@@ -1,563 +0,0 @@
-/* rsource.cc - access the sources.list file
- *
- * Copyright (c) 1999 Patrick Cole <z at amused.net>
- * (c) 2002 Synaptic development team
- *
- * Author: Patrick Cole <z at amused.net>
- * Michael Vogt <mvo at debian.org>
- * Gustavo Niemeyer <niemeyer at conectiva.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <sys/stat.h>
-#include <dirent.h>
-
-#include "rsources.h"
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/fileutl.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/error.h>
-#include <algorithm>
-#include <fstream>
-#include "config.h"
-#include "apt.h"
-
-SourcesList::~SourcesList()
-{
- for (list<SourceRecord *>::iterator it = SourceRecords.begin();
- it != SourceRecords.end(); it++)
- delete *it;
- for (list<VendorRecord *>::iterator it = VendorRecords.begin();
- it != VendorRecords.end(); it++)
- delete *it;
-}
-
-SourcesList::SourceRecord *SourcesList::AddSourceNode(SourceRecord &rec)
-{
- SourceRecord *newrec = new SourceRecord;
- *newrec = rec;
- SourceRecords.push_back(newrec);
-
- return newrec;
-}
-
-bool SourcesList::ReadSourcePart(string listpath)
-{
- //cout << "SourcesList::ReadSourcePart() "<< listpath << endl;
- char buf[512];
- const char *p;
- ifstream ifs(listpath.c_str(), ios::in);
- bool record_ok = true;
-
- // cannot open file
- if (!ifs != 0)
- return _error->Error("Can't read %s", listpath.c_str());
-
- while (ifs.eof() == false) {
- p = buf;
- SourceRecord rec;
- string Type;
- string Section;
- string VURI;
-
- ifs.getline(buf, sizeof(buf));
-
- rec.SourceFile = listpath;
- while (isspace(*p))
- p++;
- if (*p == '#') {
- rec.Type = Disabled;
- p++;
- while (isspace(*p))
- p++;
- }
-
- if (*p == '\r' || *p == '\n' || *p == 0) {
- rec.Type = Comment;
- rec.Comment = p;
-
- AddSourceNode(rec);
- continue;
- }
-
- bool Failed = true;
- if (ParseQuoteWord(p, Type) == true &&
- rec.SetType(Type) == true && ParseQuoteWord(p, VURI) == true) {
- if (VURI[0] == '[') {
- rec.VendorID = VURI.substr(1, VURI.length() - 2);
- if (ParseQuoteWord(p, VURI) == true && rec.SetURI(VURI) == true)
- Failed = false;
- } else if (rec.SetURI(VURI) == true) {
- Failed = false;
- }
- if (Failed == false && ParseQuoteWord(p, rec.Dist) == false)
- Failed = true;
- }
-
- if (Failed == true) {
- if (rec.Type == Disabled) {
- // treat as a comment field
- rec.Type = Comment;
- rec.Comment = buf;
- } else {
- // syntax error on line
- rec.Type = Comment;
- string s = "#" + string(buf);
- rec.Comment = s;
- record_ok = false;
- //return _error->Error("Syntax error in line %s", buf);
- }
- }
-#ifndef HAVE_RPM
- // check for absolute dist
- if (rec.Dist.empty() == false && rec.Dist[rec.Dist.size() - 1] == '/') {
- // make sure there's no section
- if (ParseQuoteWord(p, Section) == true)
- return _error->Error("Syntax error in line %s", buf);
-
- rec.Dist = SubstVar(rec.Dist, "$(ARCH)",
- _config->Find("APT::Architecture"));
-
- AddSourceNode(rec);
- continue;
- }
-#endif
-
- const char *tmp = p;
- rec.NumSections = 0;
- while (ParseQuoteWord(p, Section) == true)
- rec.NumSections++;
- if (rec.NumSections > 0) {
- p = tmp;
- rec.Sections = new string[rec.NumSections];
- rec.NumSections = 0;
- while (ParseQuoteWord(p, Section) == true) {
- // comments inside the record are preserved
- if (Section[0] == '#') {
- SourceRecord rec;
- string s = Section + string(p);
- rec.Type = Comment;
- rec.Comment = s;
- rec.SourceFile = listpath;
- AddSourceNode(rec);
- break;
- } else {
- rec.Sections[rec.NumSections++] = Section;
- }
- }
- }
- AddSourceNode(rec);
- }
-
- ifs.close();
- return record_ok;
-}
-
-bool SourcesList::ReadSourceDir(string Dir)
-{
- //cout << "SourcesList::ReadSourceDir() " << Dir << endl;
-
- DIR *D = opendir(Dir.c_str());
- if (D == 0)
- return _error->Errno("opendir", "Unable to read %s", Dir.c_str());
-
- vector<string> List;
- for (struct dirent * Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
- if (Ent->d_name[0] == '.')
- continue;
-
- // Skip bad file names ala run-parts
- const char *C = Ent->d_name;
- for (; *C != 0; C++)
- if (isalpha(*C) == 0 && isdigit(*C) == 0
- && *C != '_' && *C != '-' && *C != '.')
- break;
- if (*C != 0)
- continue;
-
- // Only look at files ending in .list to skip .rpmnew etc files
- if (strcmp(Ent->d_name + strlen(Ent->d_name) - 5, ".list") != 0)
- continue;
-
- // Make sure it is a file and not something else
- string File = flCombine(Dir, Ent->d_name);
- struct stat St;
- if (stat(File.c_str(), &St) != 0 || S_ISREG(St.st_mode) == 0)
- continue;
- List.push_back(File);
-
- }
- closedir(D);
-
- sort(List.begin(), List.end());
-
- // Read the files
- for (vector<string>::const_iterator I = List.begin(); I != List.end();
- I++)
- if (ReadSourcePart(*I) == false)
- return false;
- return true;
-}
-
-
-bool SourcesList::ReadSources()
-{
- //cout << "SourcesList::ReadSources() " << endl;
-
- bool Res = true;
-
- string Parts = _config->FindDir("Dir::Etc::sourceparts");
- if (FileExists(Parts) == true)
- Res &= ReadSourceDir(Parts);
- string Main = _config->FindFile("Dir::Etc::sourcelist");
- if (FileExists(Main) == true)
- Res &= ReadSourcePart(Main);
-
- return Res;
-}
-
-SourcesList::SourceRecord *SourcesList::AddEmptySource()
-{
- SourceRecord rec;
-#ifdef HAVE_RPM
- rec.Type = Rpm;
-#else
- rec.Type = Deb;
-#endif
- rec.VendorID = "";
- rec.SourceFile = _config->FindFile("Dir::Etc::sourcelist");
- rec.Dist = "";
- rec.NumSections = 0;
- return AddSourceNode(rec);
-}
-
-SourcesList::SourceRecord *SourcesList::AddSource(RecType Type,
- string VendorID, string URI,
- string Dist,
- string *Sections,
- unsigned short count,
- string SourceFile)
-{
- SourceRecord rec;
- rec.Type = Type;
- rec.VendorID = VendorID;
- rec.SourceFile = SourceFile;
-
- if (rec.SetURI(URI) == false) {
- return NULL;
- }
- rec.Dist = Dist;
- rec.NumSections = count;
- rec.Sections = new string[count];
- for (unsigned int i = 0; i < count; i++)
- rec.Sections[i] = Sections[i];
-
- return AddSourceNode(rec);
-}
-
-void SourcesList::RemoveSource(SourceRecord *&rec)
-{
- SourceRecords.remove(rec);
- delete rec;
- rec = 0;
-}
-
-void SourcesList::SwapSources( SourceRecord *&rec_one, SourceRecord *&rec_two )
-{
- list<SourceRecord *>::iterator rec_p;
- list<SourceRecord *>::iterator rec_n;
-
- rec_p = find( SourceRecords.begin(), SourceRecords.end(), rec_one );
- rec_n = find( SourceRecords.begin(), SourceRecords.end(), rec_two );
-
- SourceRecords.insert( rec_p, rec_two );
- SourceRecords.erase( rec_n );
-}
-
-bool SourcesList::UpdateSources()
-{
- list<string> filenames;
- for (list<SourceRecord *>::iterator it = SourceRecords.begin();
- it != SourceRecords.end(); it++) {
- if ((*it)->SourceFile == "")
- continue;
- filenames.push_front((*it)->SourceFile);
- }
- filenames.sort();
- filenames.unique();
-
- for (list<string>::iterator fi = filenames.begin();
- fi != filenames.end(); fi++) {
- ofstream ofs((*fi).c_str(), ios::out);
- if (!ofs != 0)
- return false;
-
- for (list<SourceRecord *>::iterator it = SourceRecords.begin();
- it != SourceRecords.end(); it++) {
- if ((*fi) != (*it)->SourceFile)
- continue;
- string S;
- if (((*it)->Type & Comment) != 0) {
- S = (*it)->Comment;
- } else if ((*it)->URI.empty() || (*it)->Dist.empty()) {
- continue;
- } else {
- if (((*it)->Type & Disabled) != 0)
- S = "# ";
-
- S += (*it)->GetType() + " ";
-
- if ((*it)->VendorID.empty() == false)
- S += "[" + (*it)->VendorID + "] ";
-
- S += (*it)->URI + " ";
- S += (*it)->Dist + " ";
-
- for (unsigned int J = 0; J < (*it)->NumSections; J++)
- S += (*it)->Sections[J] + " ";
- }
- ofs << S << endl;
- }
- ofs.close();
- }
- return true;
-}
-
-bool SourcesList::SourceRecord::SetType(string S)
-{
- if (S == "deb")
- Type |= Deb;
- else if (S == "deb-src")
- Type |= DebSrc;
- else if (S == "rpm")
- Type |= Rpm;
- else if (S == "rpm-src")
- Type |= RpmSrc;
- else if (S == "rpm-dir")
- Type |= RpmDir;
- else if (S == "rpm-src-dir")
- Type |= RpmSrcDir;
- else if (S == "repomd")
- Type |= Repomd;
- else if (S == "repomd-src")
- Type |= RepomdSrc;
- else
- return false;
- //cout << S << " settype " << (Type | Repomd) << endl;
- return true;
-}
-
-string SourcesList::SourceRecord::GetType()
-{
- if ((Type & Deb) != 0)
- return "deb";
- else if ((Type & DebSrc) != 0)
- return "deb-src";
- else if ((Type & Rpm) != 0)
- return "rpm";
- else if ((Type & RpmSrc) != 0)
- return "rpm-src";
- else if ((Type & RpmDir) != 0)
- return "rpm-dir";
- else if ((Type & RpmSrcDir) != 0)
- return "rpm-src-dir";
- else if ((Type & Repomd) != 0)
- return "repomd";
- else if ((Type & RepomdSrc) != 0)
- return "repomd-src";
- //cout << "type " << (Type & Repomd) << endl;
- return "unknown";
-}
-
-bool SourcesList::SourceRecord::SetURI(string S)
-{
- if (S.empty() == true)
- return false;
- if (S.find(':') == string::npos)
- return false;
-
- S = SubstVar(S, "$(ARCH)", _config->Find("APT::Architecture"));
- S = SubstVar(S, "$(VERSION)", _config->Find("APT::DistroVersion"));
- URI = S;
-
- // append a / to the end if one is not already there
- if (URI[URI.size() - 1] != '/')
- URI += '/';
-
- return true;
-}
-
-SourcesList::SourceRecord &SourcesList::SourceRecord::
-operator=(const SourceRecord &rhs)
-{
- // Needed for a proper deep copy of the record; uses the string operator= to properly copy the strings
- Type = rhs.Type;
- VendorID = rhs.VendorID;
- URI = rhs.URI;
- Dist = rhs.Dist;
- Sections = new string[rhs.NumSections];
- for (unsigned int I = 0; I < rhs.NumSections; I++)
- Sections[I] = rhs.Sections[I];
- NumSections = rhs.NumSections;
- Comment = rhs.Comment;
- SourceFile = rhs.SourceFile;
-
- return *this;
-}
-
-SourcesList::VendorRecord *SourcesList::AddVendorNode(VendorRecord &rec)
-{
- VendorRecord *newrec = new VendorRecord;
- *newrec = rec;
- VendorRecords.push_back(newrec);
-
- return newrec;
-}
-
-bool SourcesList::ReadVendors()
-{
- Configuration Cnf;
-
- string CnfFile = _config->FindFile("Dir::Etc::vendorlist");
- if (FileExists(CnfFile) == true)
- if (ReadConfigFile(Cnf, CnfFile, true) == false)
- return false;
-
- for (list<VendorRecord *>::const_iterator I = VendorRecords.begin();
- I != VendorRecords.end(); I++)
- delete *I;
- VendorRecords.clear();
-
- // Process 'simple-key' type sections
- const Configuration::Item *Top = Cnf.Tree("simple-key");
- for (Top = (Top == 0 ? 0 : Top->Child); Top != 0; Top = Top->Next) {
- Configuration Block(Top);
- VendorRecord Vendor;
-
- Vendor.VendorID = Top->Tag;
- Vendor.FingerPrint = Block.Find("Fingerprint");
- Vendor.Description = Block.Find("Name");
-
- char *buffer = new char[Vendor.FingerPrint.length() + 1];
- char *p = buffer;;
- for (string::const_iterator I = Vendor.FingerPrint.begin();
- I != Vendor.FingerPrint.end(); I++) {
- if (*I != ' ' && *I != '\t')
- *p++ = *I;
- }
- *p = 0;
- Vendor.FingerPrint = buffer;
- delete[]buffer;
-
- if (Vendor.FingerPrint.empty() == true ||
- Vendor.Description.empty() == true) {
- _error->Error("Vendor block %s is invalid",
- Vendor.VendorID.c_str());
- continue;
- }
-
- AddVendorNode(Vendor);
- }
-
- return !_error->PendingError();
-}
-
-SourcesList::VendorRecord *SourcesList::AddVendor(string VendorID,
- string FingerPrint,
- string Description)
-{
- VendorRecord rec;
- rec.VendorID = VendorID;
- rec.FingerPrint = FingerPrint;
- rec.Description = Description;
- return AddVendorNode(rec);
-}
-
-bool SourcesList::UpdateVendors()
-{
- ofstream ofs(_config->FindFile("Dir::Etc::vendorlist").c_str(), ios::out);
- if (!ofs != 0)
- return false;
-
- for (list<VendorRecord *>::iterator it = VendorRecords.begin();
- it != VendorRecords.end(); it++) {
- ofs << "simple-key \"" << (*it)->VendorID << "\" {" << endl;
- ofs << "\tFingerPrint \"" << (*it)->FingerPrint << "\";" << endl;
- ofs << "\tName \"" << (*it)->Description << "\";" << endl;
- ofs << "}" << endl;
- }
-
- ofs.close();
- return true;
-}
-
-
-void SourcesList::RemoveVendor(VendorRecord *&rec)
-{
- VendorRecords.remove(rec);
- delete rec;
- rec = 0;
-}
-
-ostream &operator<<(ostream &os, const SourcesList::SourceRecord &rec)
-{
- os << "Type: ";
- if ((rec.Type & SourcesList::Comment) != 0)
- os << "Comment ";
- if ((rec.Type & SourcesList::Disabled) != 0)
- os << "Disabled ";
- if ((rec.Type & SourcesList::Deb) != 0)
- os << "Deb";
- if ((rec.Type & SourcesList::DebSrc) != 0)
- os << "DebSrc";
- if ((rec.Type & SourcesList::Rpm) != 0)
- os << "Rpm";
- if ((rec.Type & SourcesList::RpmSrc) != 0)
- os << "RpmSrc";
- if ((rec.Type & SourcesList::RpmDir) != 0)
- os << "RpmDir";
- if ((rec.Type & SourcesList::RpmSrcDir) != 0)
- os << "RpmSrcDir";
- if ((rec.Type & SourcesList::Repomd) != 0)
- os << "Repomd";
- if ((rec.Type & SourcesList::RepomdSrc) != 0)
- os << "RepomdSrc";
- os << endl;
- os << "SourceFile: " << rec.SourceFile << endl;
- os << "VendorID: " << rec.VendorID << endl;
- os << "URI: " << rec.URI << endl;
- os << "Dist: " << rec.Dist << endl;
- os << "Section(s):" << endl;
-#if 0
- for (unsigned int J = 0; J < rec.NumSections; J++) {
- cout << "\t" << rec.Sections[J] << endl;
- }
-#endif
- os << endl;
- return os;
-}
-
-ostream &operator<<(ostream &os, const SourcesList::VendorRecord &rec)
-{
- os << "VendorID: " << rec.VendorID << endl;
- os << "FingerPrint: " << rec.FingerPrint << endl;
- os << "Description: " << rec.Description << endl;
- return os;
-}
-
-// vim:sts=4:sw=4
diff --git a/backends/aptcc/rsources.h b/backends/aptcc/rsources.h
deleted file mode 100644
index 77fcbb2..0000000
--- a/backends/aptcc/rsources.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* rsource.h - access the sources.list file
- *
- * Copyright (c) 1999 Patrick Cole <z at amused.net>
- * (c) 2002 Synaptic development team
- *
- * Author: Patrick Cole <z at amused.net>
- * Michael Vogt <mvo at debian.org>
- * Gustavo Niemeyer <niemeyer at conectiva.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _RSOURCES_H
-#define _RSOURCES_H
-
-#include <string>
-#include <list>
-
-using namespace std;
-
-class SourcesList {
- public:
- enum RecType {
- Deb = 1 << 0,
- DebSrc = 1 << 1,
- Rpm = 1 << 2,
- RpmSrc = 1 << 3,
- Disabled = 1 << 4,
- Comment = 1 << 5,
- RpmDir = 1 << 6,
- RpmSrcDir = 1 << 7,
- Repomd = 1 << 8,
- RepomdSrc = 1 << 9
- };
-
- struct SourceRecord {
- unsigned int Type;
- string VendorID;
- string URI;
- string Dist;
- string *Sections;
- unsigned short NumSections;
- string Comment;
- string SourceFile;
-
- bool SetType(string);
- string GetType();
- bool SetURI(string);
-
- SourceRecord():Type(0), Sections(0), NumSections(0) {
- };
- ~SourceRecord() {
- if (Sections)
- delete[]Sections;
- };
- SourceRecord &operator=(const SourceRecord &);
- };
-
- struct VendorRecord {
- string VendorID;
- string FingerPrint;
- string Description;
- };
-
- list<SourceRecord *> SourceRecords;
- list<VendorRecord *> VendorRecords;
-
- private:
- SourceRecord *AddSourceNode(SourceRecord &);
- VendorRecord *AddVendorNode(VendorRecord &);
-
- public:
- SourceRecord *AddSource(RecType Type,
- string VendorID,
- string URI,
- string Dist,
- string *Sections,
- unsigned short count, string SourceFile);
- SourceRecord *AddEmptySource();
- void RemoveSource(SourceRecord *&);
- void SwapSources( SourceRecord *&, SourceRecord *& );
- bool ReadSourcePart(string listpath);
- bool ReadSourceDir(string Dir);
- bool ReadSources();
- bool UpdateSources();
-
- VendorRecord *AddVendor(string VendorID,
- string FingerPrint, string Description);
- void RemoveVendor(VendorRecord *&);
- bool ReadVendors();
- bool UpdateVendors();
-
- SourcesList() {
- };
- ~SourcesList();
-};
-
-typedef list<SourcesList::SourceRecord *>::iterator SourcesListIter;
-
-ostream &operator <<(ostream &, const SourcesList::SourceRecord &);
-
-#endif
commit 8d327c16cf1593269055d66f3f0922ef4f6140a5
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Mon Mar 5 20:32:38 2012 +0100
apt: Fix modalias search on non-multi-arch systems
diff --git a/backends/apt/aptBackend.py b/backends/apt/aptBackend.py
index 7aed40d..aa07dc8 100755
--- a/backends/apt/aptBackend.py
+++ b/backends/apt/aptBackend.py
@@ -1916,7 +1916,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
for package in self._cache:
# skip foreign architectures, we usually only want native
# driver packages
- if package.architecture() != system_architecture:
+ if (not package.candidate or
+ package.candidate.architecture not in ("all",
+ system_architecture)):
continue
try:
commit 6ff638479fe759597e7590cddff7c5d8553dc1cb
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Mon Mar 5 20:17:43 2012 +0100
apt: Replace use of depracted python-apt 0.7.x API
diff --git a/backends/apt/aptBackend.py b/backends/apt/aptBackend.py
index a79eeee..7aed40d 100755
--- a/backends/apt/aptBackend.py
+++ b/backends/apt/aptBackend.py
@@ -200,15 +200,15 @@ def lock_cache(func):
try:
# see if the lock for the download dir can be acquired
# (work around bug in python-apt/apps that call _fetchArchives)
- lockfile = apt_pkg.config.FindDir("Dir::Cache::Archives") + \
+ lockfile = apt_pkg.config.find_dir("Dir::Cache::Archives") + \
"lock"
- lock = apt_pkg.GetLock(lockfile)
+ lock = apt_pkg.get_lock(lockfile)
if lock < 0:
raise SystemError("failed to lock '%s'" % lockfile)
else:
os.close(lock)
# then lock the main package system
- apt_pkg.PkgSystemLock()
+ apt_pkg.pkgsystem_lock()
except SystemError:
time.sleep(3)
else:
@@ -248,7 +248,9 @@ class PackageKitOpProgress(apt.progress.base.OpProgress):
self.show_progress = progress
# OpProgress callbacks
- def update(self, percent):
+ def update(self, percent=None):
+ if percent is None:
+ return
progress = int(self.pstart + percent / 100 * (self.pend - self.pstart))
if self.show_progress == True and self.pprev < progress:
self._backend.percentage(progress)
@@ -786,7 +788,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
if META_RELEASE_SUPPORT == False:
if "update-manager-core" in self._cache and \
- self._cache["update-manager-core"].isInstalled == False:
+ self._cache["update-manager-core"].is_installed == False:
raise PKError(enums.ERROR_INTERNAL_ERROR,
"Please install the package update-manager-core "
"to get notified of the latest distribution "
@@ -846,7 +848,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
# Search for upgrades which are not already part of the safe upgrade
# but would only require the installation of additional packages
for pkg in self._cache:
- if not pkg.isUpgradable:
+ if not pkg.is_upgradable:
continue
# This may occur on pinned packages which have been updated to
# later version than the pinned one
@@ -1017,20 +1019,18 @@ class PackageKitAptBackend(PackageKitBaseBackend):
total = len(pkg_ids)
for count, pkg_id in enumerate(pkg_ids):
self.percentage(count * 100 / total)
- pkg = self._get_package_by_id(pkg_id)
+ version = self._get_version_by_id(pkg_id)
#FIXME: We need more fine grained license information!
- candidate = pkg.candidateOrigin
- if candidate != None and \
- candidate[0].component in ["main", "universe"] and \
- candidate[0].origin in ["Debian", "Ubuntu"]:
+ if (version.origins and
+ version.origins[0].component in ["main", "universe"] and
+ version.origins[0].origin in ["Debian", "Ubuntu"]):
license = "free"
else:
license = "unknown"
group = self._get_package_group(pkg)
self.details(pkg_id, license, group,
- format_string(pkg.description),
- pkg.homepage,
- pkg.packageSize)
+ format_string(version.description),
+ version.homepage, version.size)
@catch_pkerror
@lock_cache
@@ -1174,7 +1174,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
for id in ids:
version = self._get_version_by_id(id)
pkg = version.package
- if not pkg.isInstalled:
+ if not pkg.is_installed:
raise PKError(enums.ERROR_PACKAGE_NOT_INSTALLED,
"Package %s isn't installed" % pkg.name)
if pkg.installed != version:
@@ -1185,7 +1185,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
raise PKError(enums.ERROR_CANNOT_REMOVE_SYSTEM_PACKAGE,
"Package %s cannot be removed." % pkg.name)
pkgs.append(pkg.name[:])
- pkg.markDelete(False, False)
+ pkg.mark_delete(False, False)
resolver.clear(pkg)
resolver.protect(pkg)
resolver.remove(pkg)
@@ -1211,8 +1211,8 @@ class PackageKitAptBackend(PackageKitBaseBackend):
self.allow_cancel(False)
self.percentage(0)
if REPOS_SUPPORT == False:
- if "python-software-properties" in self._cache and \
- self._cache["python-software-properties"].isInstalled == False:
+ if ("python-software-properties" in self._cache and
+ not self._cache["python-software-properties"].is_installed):
raise PKError(enums.ERROR_INTERNAL_ERROR,
"Please install the package "
"python-software-properties to handle "
@@ -1293,8 +1293,8 @@ class PackageKitAptBackend(PackageKitBaseBackend):
self.allow_cancel(False)
self.percentage(0)
if REPOS_SUPPORT == False:
- if "python-software-properties" in self._cache and \
- self._cache["python-software-properties"].isInstalled == False:
+ if ("python-software-properties" in self._cache and
+ not self._cache["python-software-properties"].is_installed):
raise PKError(enums.ERROR_INTERNAL_ERROR,
"Please install the package "
"python-software-properties to handle "
@@ -1526,7 +1526,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
raise PKError(enums.ERROR_PACKAGE_ALREADY_INSTALLED,
"Package %s is already installed" % pkg.name)
pkgs.append(pkg.name[:])
- pkg.markInstall(False, True, True)
+ pkg.mark_install(False, True, True)
resolver.clear(pkg)
resolver.protect(pkg)
try:
@@ -1711,9 +1711,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
ver_list.remove(pkg.candidate)
ver_list.insert(0, pkg.candidate)
for dep_ver in ver_list:
- if apt_pkg.CheckDep(dep_ver.version,
- base_dep.relation,
- base_dep.version):
+ if apt_pkg.check_dep(dep_ver.version,
+ base_dep.relation,
+ base_dep.version):
self._emit_pkg_version(dep_ver)
satisfied = True
break
@@ -1765,7 +1765,6 @@ class PackageKitAptBackend(PackageKitBaseBackend):
for count, id in enumerate(ids):
self.percentage(count / 100 * total)
version = self._get_version_by_id(id)
- provided = [pro[0] for pro in version._cand.ProvidesList]
for pkg in self._cache:
if not self._is_package_visible(pkg, filters):
continue
@@ -1777,7 +1776,7 @@ class PackageKitAptBackend(PackageKitBaseBackend):
satisfied = False
for base_dep in dependency.or_dependencies:
if version.package.name == base_dep.name or \
- base_dep.name in provided:
+ base_dep.name in version.provides:
satisfied = True
break
if satisfied:
@@ -2127,9 +2126,9 @@ class PackageKitAptBackend(PackageKitBaseBackend):
else:
pass
# Read the pin file of Synaptic if available
- self._cache._depcache.ReadPinFile()
+ self._cache._depcache.read_pinfile()
if os.path.exists(SYNAPTIC_PIN_FILE):
- self._cache._depcache.ReadPinFile(SYNAPTIC_PIN_FILE)
+ self._cache._depcache.read_pinfile(SYNAPTIC_PIN_FILE)
# Reset the depcache
self._cache.clear()
commit 5e486b6d271fe9b82ee1e017ba8270d4631f22ec
Author: Sebastian Heinlein <devel at glatzor.de>
Date: Mon Mar 5 20:16:35 2012 +0100
apt: apt.cache.Cache() now reuses the dpkg of the chroot so just copy
the wrapper into the chroot
diff --git a/backends/apt/tests/core.py b/backends/apt/tests/core.py
index c3321dc..424d0d6 100644
--- a/backends/apt/tests/core.py
+++ b/backends/apt/tests/core.py
@@ -56,15 +56,13 @@ class Chroot(object):
os.makedirs(os.path.join(self.path, "etc/apt/apt.conf.d"))
os.makedirs(os.path.join(self.path, "etc/apt/sources.list.d"))
os.makedirs(os.path.join(self.path, "var/log"))
+ os.makedirs(os.path.join(self.path, "usr/bin"))
os.makedirs(os.path.join(self.path, "media"))
# Make apt use the new chroot
- dpkg_wrapper = os.path.join(get_tests_dir(), "dpkg-wrapper.sh")
- config_path = os.path.join(self.path, "etc/apt/apt.conf.d/10chroot")
- with open(config_path, "w") as cnf:
- cnf.write("Dir::Bin::DPkg %s;" % dpkg_wrapper)
+ shutil.copy(os.path.join(get_tests_dir(), "dpkg-wrapper.sh"),
+ os.path.join(self.path, "usr", "bin", "dpkg"))
os.environ["ROOT"] = self.path
- apt_pkg.read_config_file(apt_pkg.config, config_path)
apt_pkg.init_system()
def remove(self):
commit 57fe22e3835133df83355379891cabe7569921ce
Author: Matthias Klumpp <matthias at tenstral.net>
Date: Mon Mar 5 11:57:12 2012 +0100
trivial: Fix typo
diff --git a/etc/PackageKit.conf.in b/etc/PackageKit.conf.in
index c3cef5f..5fb3519 100644
--- a/etc/PackageKit.conf.in
+++ b/etc/PackageKit.conf.in
@@ -272,7 +272,7 @@ UseIdleBandwidth=true
# or cannot shutdown without the session exploding. For instance, listing
# /sbin/dbus-daemon or /usr/sbin/haldaemon would be a really bad idea.
#
-# Seporate entries can be seporated with the ';' character.
+# Separate entries can be separated with the ';' character.
#
# default=/usr/lib*/*/firefox
NoUpdateProcessList=
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index b434ed0..5dfe311 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -6,4 +6,3 @@ contrib/debuginfo-install/egg-debug.c
lib/packagekit-glib/egg-debug.c
lib/packagekit-glib2/egg-debug.c
backends/yum/libzif/egg-debug.c
-
commit d19503785ff626f5c26323a07733d741bcfa78b1
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 1 11:16:40 2012 +0000
trivial: post release version bump
diff --git a/RELEASE b/RELEASE
index ba26119..6ddf9e1 100644
--- a/RELEASE
+++ b/RELEASE
@@ -2,10 +2,10 @@ PackageKit Release Notes
1. Write NEWS entries for PackageKit in the same format as usual.
-git shortlog PACKAGEKIT_0_7_2.. | grep -i -v trivial | grep -v Merge > NEWS.new
+git shortlog PACKAGEKIT_0_7_3.. | grep -i -v trivial | grep -v Merge > NEWS.new
--------------------------------------------------------------------------------
-Version 0.7.3
+Version 0.7.4
~~~~~~~~~~~~~
Released: 2012-xx-xx
@@ -31,8 +31,8 @@ git add po/*.po
4. Commit changes in PackageKit git:
-git commit -a -m "Release version 0.7.3"
-git tag -s -f -m "Release 0.7.3" PACKAGEKIT_0_7_3
+git commit -a -m "Release version 0.7.4"
+git tag -s -f -m "Release 0.7.4" PACKAGEKIT_0_7_4
<gpg password>
git push --tags
git push
@@ -58,7 +58,7 @@ tx push --source
10. Send an email to packagekit at lists.freedesktop.org
=================================================
-PackageKit 0.7.3 released!
+PackageKit 0.7.4 released!
Tarballs available here: http://www.packagekit.org/releases/
diff --git a/configure.ac b/configure.ac
index a40eeb0..f1dcc29 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
m4_define([pk_major_version], [0])
m4_define([pk_minor_version], [7])
-m4_define([pk_micro_version], [3])
+m4_define([pk_micro_version], [4])
m4_define([pk_version],
[pk_major_version.pk_minor_version.pk_micro_version])
More information about the PackageKit-commit
mailing list