[haiku-commits] BRANCH HaikuPM-github.package-management [d7cbcb1] in src: apps/haiku-depot bin/package_repo

  • From: HaikuPM-github.package-management <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 18 Sep 2013 15:45:34 +0200 (CEST)

added 5 changesets to branch 'refs/remotes/HaikuPM-github/package-management'
old head: da33beab7098545ca6267da693f81bee608f5e50
new head: d7cbcb13da916672fa94b06451dc3ec344a432b2
overview: https://github.com/haiku/HaikuPM/compare/da33bea...d7cbcb1

----------------------------------------------------------------------------

93cb796: Context: Add more uniqueness to temp directory names.
  
  - If a single thread attempted to establish multiple package kit
    contexts, it would fail due to a collision between their respective
    temporary directories. As such, use both the thread ID and
    system_time() as a random elements in the directory name to ensure
    this doesn't occur.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

0c5468e: HaikuDepot: Stub out various support classes for package kit use.
  
  - DecisionProvider and JobStateListener will be needed in order to
    interact with the package kit in various ways eventually, though
    the implementations are currently all empty.
  
  - Adjust HaikuDepot's PackageManager class to inherit from
    BPackageManager, so as to be able to actually interface with
    the package repositories.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

2f89f68: MainWindow: Initial hooks into package kit.
  
  - MainWindow now attempts to refresh all available repositories and
    fetch their respective package lists on startup. Much still remains
    to be done, such as factoring this out into a background process so
    it doesn't prevent the window from showing, and making the refresh step
    optional if we already have valid repository information, but this at
    least gets us showing the available package list from HaikuPorts.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

85caa04: Use BPackageInfoContentHandler in package_repo 'update'.
  
  * Ingo has pointed me at this class which already does the collecting
    of package attributes into a PackageInfo - so there's no need to
    do it manually.

                                    [ Oliver Tappe <zooey@xxxxxxxxxxxxxxx> ]

d7cbcb1: Fix build of <build>package_repo.

                                    [ Oliver Tappe <zooey@xxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

12 files changed, 414 insertions(+), 262 deletions(-)
src/apps/haiku-depot/DecisionProvider.cpp |  19 ++
src/apps/haiku-depot/DecisionProvider.h   |  20 ++
src/apps/haiku-depot/Jamfile              |   8 +-
src/apps/haiku-depot/JobStateListener.cpp |  43 +++++
src/apps/haiku-depot/JobStateListener.h   |  24 +++
src/apps/haiku-depot/MainWindow.cpp       | 263 +++++++++++++-------------
src/apps/haiku-depot/MainWindow.h         |   5 +-
src/apps/haiku-depot/PackageManager.cpp   | 101 +++++++++-
src/apps/haiku-depot/PackageManager.h     |  54 +++++-
src/bin/package_repo/command_update.cpp   | 132 ++-----------
src/kits/package/Context.cpp              |   5 +-
src/tools/package_repo/Jamfile            |   2 +-

############################################################################

Commit:      93cb796e370b6a3e84dc31dba43c24b0e72a94a0
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Wed Sep 18 13:22:53 2013 UTC

Context: Add more uniqueness to temp directory names.

- If a single thread attempted to establish multiple package kit
  contexts, it would fail due to a collision between their respective
  temporary directories. As such, use both the thread ID and
  system_time() as a random elements in the directory name to ensure
  this doesn't occur.

----------------------------------------------------------------------------

diff --git a/src/kits/package/Context.cpp b/src/kits/package/Context.cpp
index eec15b3..7ed7d14 100644
--- a/src/kits/package/Context.cpp
+++ b/src/kits/package/Context.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011, Haiku, Inc. All Rights Reserved.
+ * Copyright 2011-2013, Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -94,7 +94,8 @@ BContext::_Initialize()
        if ((result = tempDirectory.InitCheck()) != B_OK)
                return result;
 
-       BString contextName = BString("pkgkit-context-") << find_thread(NULL);
+       BString contextName = BString("pkgkit-context-") << find_thread(NULL)
+               << "-" << system_time();
        BDirectory baseDirectory;
        result = tempDirectory.CreateDirectory(contextName.String(),
                &baseDirectory);

############################################################################

Commit:      0c5468eef0c381f753da9ef0ca1a050cdba9040d
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Wed Sep 18 13:25:11 2013 UTC

HaikuDepot: Stub out various support classes for package kit use.

- DecisionProvider and JobStateListener will be needed in order to
  interact with the package kit in various ways eventually, though
  the implementations are currently all empty.

- Adjust HaikuDepot's PackageManager class to inherit from
  BPackageManager, so as to be able to actually interface with
  the package repositories.

----------------------------------------------------------------------------

diff --git a/src/apps/haiku-depot/DecisionProvider.cpp 
b/src/apps/haiku-depot/DecisionProvider.cpp
new file mode 100644
index 0000000..9dfb455
--- /dev/null
+++ b/src/apps/haiku-depot/DecisionProvider.cpp
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2011, Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
+ * Copyright 2013, Rene Gollent, rene@xxxxxxxxxxx.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include "DecisionProvider.h"
+
+
+bool
+DecisionProvider::YesNoDecisionNeeded(const BString& description,
+       const BString& question, const BString& yes, const BString& no,
+       const BString& defaultChoice)
+{
+       // TODO: implement
+
+       return true;
+}
diff --git a/src/apps/haiku-depot/DecisionProvider.h 
b/src/apps/haiku-depot/DecisionProvider.h
new file mode 100644
index 0000000..e37791b
--- /dev/null
+++ b/src/apps/haiku-depot/DecisionProvider.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2011, Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
+ * Copyright 2013, Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef DECISION_PROVIDER_H
+#define DECISION_PROVIDER_H
+
+
+#include <package/Context.h>
+
+
+struct DecisionProvider : public BPackageKit::BDecisionProvider {
+       virtual bool YesNoDecisionNeeded(const BString& description,
+               const BString& question, const BString& yes, const BString& no,
+               const BString& defaultChoice);
+};
+
+
+#endif // DECISION_PROVIDER_H
diff --git a/src/apps/haiku-depot/Jamfile b/src/apps/haiku-depot/Jamfile
index ecc6f1f..4117c24 100644
--- a/src/apps/haiku-depot/Jamfile
+++ b/src/apps/haiku-depot/Jamfile
@@ -1,6 +1,6 @@
 SubDir HAIKU_TOP src apps haiku-depot ;
 
-UsePrivateHeaders interface shared ;
+UsePrivateHeaders interface shared package ;
 
 # source directories
 local sourceDirs =
@@ -33,7 +33,9 @@ Application HaikuDepot :
        App.cpp
        BitmapButton.cpp
        BitmapView.cpp
+       DecisionProvider.cpp
        FilterView.cpp
+       JobStateListener.cpp
        main.cpp
        MainWindow.cpp
        Model.cpp
@@ -47,8 +49,8 @@ Application HaikuDepot :
        # text view stuff
        $(textDocumentSources)
 
-       : be translation libcolumnlistview.a libshared.a $(TARGET_LIBSUPC++)
-               localestub
+       : be package translation libcolumnlistview.a libshared.a
+               $(TARGET_LIBSTDC++) $(TARGET_LIBSUPC++) localestub
        : HaikuDepot.rdef
 ;
 
diff --git a/src/apps/haiku-depot/JobStateListener.cpp 
b/src/apps/haiku-depot/JobStateListener.cpp
new file mode 100644
index 0000000..e200c8a
--- /dev/null
+++ b/src/apps/haiku-depot/JobStateListener.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2011, Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
+ * Copyright 2013, Rene Gollent, rene@xxxxxxxxxxx.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include "JobStateListener.h"
+
+
+using BPackageKit::BJob;
+
+
+JobStateListener::JobStateListener()
+{
+}
+
+
+void
+JobStateListener::JobStarted(BJob* job)
+{
+}
+
+
+void
+JobStateListener::JobSucceeded(BJob* job)
+{
+       // TODO: notify user
+}
+
+
+void
+JobStateListener::JobFailed(BJob* job)
+{
+       // TODO: notify user
+}
+
+
+void
+JobStateListener::JobAborted(BJob* job)
+{
+       // TODO: notify user
+}
diff --git a/src/apps/haiku-depot/JobStateListener.h 
b/src/apps/haiku-depot/JobStateListener.h
new file mode 100644
index 0000000..8914adc
--- /dev/null
+++ b/src/apps/haiku-depot/JobStateListener.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2011, Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
+ * Copyright 2013, Rene Gollent, rene@xxxxxxxxxxx.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef JOB_STATE_LISTENER_H
+#define JOB_STATE_LISTENER_H
+
+
+#include <package/Job.h>
+
+
+class JobStateListener : public BPackageKit::BJobStateListener {
+public:
+                                                               
JobStateListener();
+
+       virtual void                            JobStarted(BPackageKit::BJob* 
job);
+       virtual void                            JobSucceeded(BPackageKit::BJob* 
job);
+       virtual void                            JobFailed(BPackageKit::BJob* 
job);
+       virtual void                            JobAborted(BPackageKit::BJob* 
job);
+};
+
+
+#endif // JOB_STATE_LISTENER_H
diff --git a/src/apps/haiku-depot/PackageManager.cpp 
b/src/apps/haiku-depot/PackageManager.cpp
index b332a24..f3d9146 100644
--- a/src/apps/haiku-depot/PackageManager.cpp
+++ b/src/apps/haiku-depot/PackageManager.cpp
@@ -1,19 +1,34 @@
 /*
- * Copyright 2013, Stephan Aßmus <superstippi@xxxxxx>.
- * All rights reserved. Distributed under the terms of the MIT License.
+ * Copyright 2013, Haiku, Inc. All Rights Reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Ingo Weinhold <ingo_weinhold@xxxxxx>
+ *             Stephan Aßmus <superstippi@xxxxxx>
+ *             Rene Gollent, reneGollent.com.
  */
 
-#include "PackageManager.h"
 
-#include <stdio.h>
+#include "PackageManager.h"
 
 #include <Catalog.h>
 
+#include <package/DownloadFileRequest.h>
+#include <package/RefreshRepositoryRequest.h>
+#include <package/solver/SolverPackage.h>
+#include <package/solver/SolverProblem.h>
+#include <package/solver/SolverProblemSolution.h>
+
 
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "PackageManager"
 
 
+using BPackageKit::BRefreshRepositoryRequest;
+using BPackageKit::DownloadFileRequest;
+using namespace BPackageKit::BPrivate;
+
+
 // #pragma mark - PackageAction
 
 
@@ -56,8 +71,18 @@ public:
 // #pragma mark - PackageManager
 
 
-PackageManager::PackageManager()
+PackageManager::PackageManager(BPackageInstallationLocation location)
+       :
+       BPackageManager(location),
+       BPackageManager::UserInteractionHandler(),
+       fDecisionProvider(),
+       fJobStateListener(),
+       fContext(fDecisionProvider, fJobStateListener),
+       fClientInstallationInterface()
 {
+       fInstallationInterface = &fClientInstallationInterface;
+       fRequestHandler = this;
+       fUserInteractionHandler = this;
 }
 
 
@@ -92,3 +117,69 @@ PackageManager::GetPackageActions(const PackageInfo& 
package)
 
        return actionList;
 }
+
+
+status_t
+PackageManager::RefreshRepository(const BRepositoryConfig& repoConfig)
+{
+       return BRefreshRepositoryRequest(fContext, repoConfig).Process();
+}
+
+
+status_t
+PackageManager::DownloadPackage(const BString& fileURL,
+       const BEntry& targetEntry, const BString& checksum)
+{
+       return DownloadFileRequest(fContext, fileURL, targetEntry, checksum)
+               .Process();
+}
+
+
+void
+PackageManager::HandleProblems()
+{
+       // TODO: implement
+}
+
+
+void
+PackageManager::ConfirmChanges(bool fromMostSpecific)
+{
+       // TODO: implement
+}
+
+
+void
+PackageManager::Warn(status_t error, const char* format, ...)
+{
+       // TODO: implement
+}
+
+
+void
+PackageManager::ProgressStartApplyingChanges(InstalledRepository& repository)
+{
+       // TODO: implement
+}
+
+
+void
+PackageManager::ProgressTransactionCommitted(InstalledRepository& repository,
+       const char* transactionDirectoryName)
+{
+       // TODO: implement
+}
+
+
+void
+PackageManager::ProgressApplyingChangesDone(InstalledRepository& repository)
+{
+       // TODO: implement
+}
+
+
+void
+PackageManager::_PrintResult(InstalledRepository& installationRepository)
+{
+       // TODO: implement
+}
diff --git a/src/apps/haiku-depot/PackageManager.h 
b/src/apps/haiku-depot/PackageManager.h
index d0211fe..903966f 100644
--- a/src/apps/haiku-depot/PackageManager.h
+++ b/src/apps/haiku-depot/PackageManager.h
@@ -1,11 +1,18 @@
 /*
  * Copyright 2013, Stephan Aßmus <superstippi@xxxxxx>.
+ * Copyright 2011, Ingo Weinhold, <ingo_weinhold@xxxxxx>
+ * Copyright 2013, Rene Gollent, <rene@xxxxxxxxxxx>
+ *
  * All rights reserved. Distributed under the terms of the MIT License.
  */
 #ifndef PACKAGE_MANAGER_H
 #define PACKAGE_MANAGER_H
 
+#include <package/DaemonClient.h>
+#include <package/manager/PackageManager.h>
 
+#include "DecisionProvider.h"
+#include "JobStateListener.h"
 #include "PackageInfo.h"
 
 
@@ -32,15 +39,56 @@ private:
 typedef BReference<PackageAction> PackageActionRef;
 typedef List<PackageActionRef, false> PackageActionList;
 
+using BPackageKit::BContext;
+using BPackageKit::BPackageInstallationLocation;
+using BPackageKit::BRepositoryConfig;
+using BPackageKit::BPrivate::BDaemonClient;
+using BPackageKit::BManager::BPrivate::BPackageManager;
 
-class PackageManager {
+
+class PackageManager : public BPackageManager,
+       private BPackageManager::RequestHandler,
+       private BPackageManager::UserInteractionHandler {
 public:
-                                                               
PackageManager();
+                                                               PackageManager(
+                                                                       
BPackageInstallationLocation location);
        virtual                                         ~PackageManager();
 
        virtual PackageState            GetPackageState(const PackageInfo& 
package);
        virtual PackageActionList       GetPackageActions(const PackageInfo& 
package);
-};
 
+private:
+       // RequestHandler
+       virtual status_t                        RefreshRepository(
+                                                                       const 
BRepositoryConfig& repoConfig);
+       virtual status_t                        DownloadPackage(const BString& 
fileURL,
+                                    const BEntry& targetEntry,
+                                    const BString& checksum);
+
+private:
+       // UserInteractionHandler
+       virtual void                            HandleProblems();
+       virtual void                            ConfirmChanges(bool 
fromMostSpecific);
+
+       virtual void                            Warn(status_t error, const 
char* format, ...);
+       virtual void                            ProgressStartApplyingChanges(
+                                                                       
InstalledRepository& repository);
+       virtual void                            ProgressTransactionCommitted(
+                                                                       
InstalledRepository& repository,
+                                                                       const 
char* transactionDirectoryName);
+       virtual void                            ProgressApplyingChangesDone(
+                                                                       
InstalledRepository& repository);
+
+private:
+                       void                            
_PrintResult(InstalledRepository&
+                                                                       
installationRepository);
+
+private:
+                       DecisionProvider        fDecisionProvider;
+                       JobStateListener        fJobStateListener;
+                       BContext                        fContext;
+                       BPackageManager::ClientInstallationInterface
+                                                                       
fClientInstallationInterface;
+};
 
 #endif // PACKAGE_MANAGER_H

############################################################################

Commit:      2f89f68ee722eb2d22bbff75783ed3bc1f8013dc
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Wed Sep 18 13:28:41 2013 UTC

MainWindow: Initial hooks into package kit.

- MainWindow now attempts to refresh all available repositories and
  fetch their respective package lists on startup. Much still remains
  to be done, such as factoring this out into a background process so
  it doesn't prevent the window from showing, and making the refresh step
  optional if we already have valid repository information, but this at
  least gets us showing the available package list from HaikuPorts.

----------------------------------------------------------------------------

diff --git a/src/apps/haiku-depot/MainWindow.cpp 
b/src/apps/haiku-depot/MainWindow.cpp
index 1c2a18a..efd6fcb 100644
--- a/src/apps/haiku-depot/MainWindow.cpp
+++ b/src/apps/haiku-depot/MainWindow.cpp
@@ -1,10 +1,13 @@
 /*
  * Copyright 2013, Stephan Aßmus <superstippi@xxxxxx>.
+ * Copyright 2013, Rene Gollent, rene@xxxxxxxxxxx.
  * All rights reserved. Distributed under the terms of the MIT License.
  */
 
 #include "MainWindow.h"
 
+#include <map>
+
 #include <stdio.h>
 
 #include <Alert.h>
@@ -17,24 +20,42 @@
 #include <MenuItem.h>
 #include <Messenger.h>
 #include <ScrollView.h>
+#include <StringList.h>
 #include <TabView.h>
 
+#include <package/Context.h>
+#include <package/RefreshRepositoryRequest.h>
+#include <package/PackageRoster.h>
+#include <package/solver/SolverPackage.h>
+
+#include "DecisionProvider.h"
 #include "FilterView.h"
+#include "JobStateListener.h"
 #include "PackageInfoView.h"
 #include "PackageListView.h"
 
 
+
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "MainWindow"
 
 
+using namespace BPackageKit;
+
+
+typedef std::map<BString, PackageInfoRef> PackageInfoMap;
+typedef std::map<BString, BObjectList<PackageInfo> > PackageLocationMap;
+typedef std::map<BString, DepotInfo> DepotInfoMap;
+
+
 MainWindow::MainWindow(BRect frame)
        :
        BWindow(frame, B_TRANSLATE_SYSTEM_NAME("HaikuDepot"),
                B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
-               B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
+               B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
+       fPackageManager(B_PACKAGE_INSTALLATION_LOCATION_HOME)
 {
-       _InitDummyModel();
+       _InitModel();
 
        BMenuBar* menuBar = new BMenuBar(B_TRANSLATE("Main Menu"));
        _BuildMenu(menuBar);
@@ -185,130 +206,118 @@ MainWindow::_ClearPackage()
 
 
 void
-MainWindow::_InitDummyModel()
+MainWindow::_InitModel()
 {
-       // TODO: The Model needs to be filled initially by the Package Kit APIs.
-       // It already caches information locally. Error handlers need to be
-       // installed to display problems to the user. When a package is selected
-       // for display, extra information is retrieved like screen-shots, user-
-       // ratings and so on. This triggers notifications which in turn updates
-       // the UI.
-
-       DepotInfo depot(B_TRANSLATE("Default"));
-
-       // WonderBrush
-       PackageInfoRef wonderbrush(new(std::nothrow) PackageInfo(
-               BitmapRef(new SharedBitmap(601), true),
-               "WonderBrush",
-               "2.1.2",
-               PublisherInfo(
-                       BitmapRef(),
-                       "YellowBites",
-                       "superstippi@xxxxxx",
-                       "http://www.yellowbites.com";),
-               "A vector based graphics editor.",
-               "WonderBrush is YellowBites' software for doing graphics design 
"
-               "on Haiku. It combines many great under-the-hood features with "
-               "powerful tools and an efficient and intuitive interface.",
-               "2.1.2 - Initial Haiku release."), true);
-       wonderbrush->AddCategory(fModel.CategoryGraphics());
-       wonderbrush->AddCategory(fModel.CategoryProductivity());
-
-       depot.AddPackage(wonderbrush);
-
-       // Paladin
-       PackageInfoRef paladin(new(std::nothrow) PackageInfo(
-               BitmapRef(new SharedBitmap(602), true),
-               "Paladin",
-               "1.2.0",
-               PublisherInfo(
-                       BitmapRef(),
-                       "DarkWyrm",
-                       "bpmagic@xxxxxxxxxxxxxxx",
-                       "http://darkwyrm-haiku.blogspot.com";),
-               "A C/C++ IDE based on Pe.",
-               "If you like BeIDE, you'll like Paladin even better. "
-               "The interface is streamlined, it has some features sorely "
-               "missing from BeIDE, like running a project in the Terminal, "
-               "and has a bundled text editor based upon Pe.",
-               ""), true);
-       paladin->AddCategory(fModel.CategoryDevelopment());
-
-       depot.AddPackage(paladin);
-
-       // Sequitur
-       PackageInfoRef sequitur(new(std::nothrow) PackageInfo(
-               BitmapRef(new SharedBitmap(604), true),
-               "Sequitur",
-               "2.1.0",
-               PublisherInfo(
-                       BitmapRef(),
-                       "Angry Red Planet",
-                       "hackborn@xxxxxxxxxxxxxxxxxx",
-                       "http://www.angryredplanet.com";),
-               "BeOS-native MIDI sequencer.",
-               "Sequitur is a BeOS-native MIDI sequencer with a MIDI 
processing "
-               "add-on architecture. It allows you to record, compose, store, "
-               "and play back music from your computer. Sequitur is designed 
for "
-               "people who like to tinker with their music. It facilitates 
rapid, "
-               "dynamic, and radical processing of your performance.",
-
-               "== Sequitur 2.1 Release Notes ==\n"
-               "04 August 2002\n\n"
-               "Features\n\n"
-               " * Important fix to file IO that prevents data corruption.\n\n"
-               " * Dissolve filter could cause crash when operating on notes "
-               "with extremely short durations. (thanks to David Shipman)\n\n"
-               " * New tool bar ARP Curves (select Tool Bars->Show->ARP Curves 
"
-               "in a track window) contains new tools for shaping events. Each 
"
-               "tool is documented in the Tool Guide, but in general they are "
-               "used to shape control change, pitch bend, tempo and velocity "
-               "events (and notes if you're feeling creative), and the curve "
-               "can be altered by pressing the 'z' and 'x' keys.\n\n"
-               "All curve tools make use of a new tool seed for drawing "
-               "bezier curves; see section 6.3.2. of the user's guide for an "
-               "explanation of the Curve seed.\n\n"
-               " * New menu items in the Song window: '''Edit->Expand Marked 
Range''' "
-               "and '''Edit->Contract Marked Range'''. These items are only 
active if "
-               "the loop markers are on. The Expand command shifts everything "
-               "from the left marker to the end of the song over by the total "
-               "loop range. The Contract command deletes the area within the "
-               "loop markers, then shifts everything after the right marker "
-               "left by the total loop range. If no tracks are selected, the "
-               "entire song is shifted. Otherwise, only the selected tracks 
are "
-               "affected.\n\n"
-               " * System exclusive commands can now be added to devices. 
There "
-               "is no user interface for doing so, although developer tools 
are "
-               "provided here. Currently, the E-mu Proteus 2000 and E-mu EOS "
-               "devices include sysex commands for controlling the FX.\n\n"
-               " * A new page has been added to the Preferences window, Views. 
"
-               "This page lets you set the height for the various views in "
-               "Sequitur, such as pitch bend, control change, etc.\n\n"
-               " * Multiple instances of the same MIDI device are given unique 
"
-               "names. For example, two instances of SynC Modular will be "
-               "named \"SynC Modular 1\" and \"SynC Modular 2\" so they can be 
"
-               "accessed independently. (thanks to David Shipman)\n\n"
-               " * In the track window, holding down the CTRL key now accesses 
"
-               "an alternate set of active tools. (Assign these tools by "
-               "holding down the CTRL key and clicking on the desired 
tool)\n\n"
-               " * Right mouse button can now be mapped to any tool. (thanks "
-               "to David Shipman)\n\n"
-               " * The Vaccine.P and Vaccine.V filters have been deprecated "
-               "(although they are still available here). They are replaced by 
"
-               "the Vaccine filter. In addition to injecting a motion into the 
"
-               "pitch and velocity of notes, this new filter can inject it "
-               "into control change, pitch bend, tempo change and channel "
-               "pressure events. The new tool Broken Down Line uses this "
-               "filter.\n\n"
-               " * ''Note to filter developers:'' The filter API has changed. 
You "
-               "will need to recompile your filters."), true);
-       sequitur->AddCategory(fModel.CategoryAudio());
-
-       depot.AddPackage(sequitur);
-
-       // Finish off
-       fModel.AddDepot(depot);
-
-       fModel.SetPackageState(wonderbrush, UNINSTALLED);
-       fModel.SetPackageState(paladin, ACTIVATED);
+       BPackageRoster roster;
+
+       BStringList repositoryNames;
+       status_t result = roster.GetRepositoryNames(repositoryNames);
+
+       // TODO: notify user
+       if (result != B_OK)
+               return;
+
+       DepotInfoMap depots;
+
+       DecisionProvider decisionProvider;
+       JobStateListener listener;
+       BContext context(decisionProvider, listener);
+
+       for (int32 i = 0; i < repositoryNames.CountStrings(); ++i) {
+               const BString& repoName = repositoryNames.StringAt(i);
+               BRepositoryConfig repoConfig;
+               result = roster.GetRepositoryConfig(repoName, &repoConfig);
+               if (result != B_OK) {
+                       // TODO: notify user
+                       continue;
+               }
+
+               BRefreshRepositoryRequest refreshRequest(context, repoConfig);
+               result = refreshRequest.Process();
+               if (result != B_OK) {
+                       // TODO: notify user
+                       continue;
+               }
+
+               depots[repoName] = DepotInfo(repoName);
+       }
+
+       fPackageManager.Init(PackageManager::B_ADD_INSTALLED_REPOSITORIES
+                       | PackageManager::B_ADD_REMOTE_REPOSITORIES);
+
+       BObjectList<BSolverPackage> packages;
+       result = fPackageManager.Solver()->FindPackages("",
+               BSolver::B_FIND_CASE_INSENSITIVE | BSolver::B_FIND_IN_NAME
+                       | BSolver::B_FIND_IN_SUMMARY | 
BSolver::B_FIND_IN_DESCRIPTION
+                       | BSolver::B_FIND_IN_PROVIDES,
+               packages);
+       if (result != B_OK) {
+               // TODO: notify user
+               return;
+       }
+
+       if (packages.IsEmpty())
+               return;
+
+       PackageLocationMap packageLocations;
+       PackageInfoMap foundPackages;
+               // if a given package is installed locally, we will potentially
+               // get back multiple entries, one for each local installation
+               // location, and one for each remote repository the package
+               // is available in. The above map is used to ensure that in such
+               // cases we consolidate the information, rather than displaying
+               // duplicates
+       for (int32 i = 0; i < packages.CountItems(); i++) {
+               BSolverPackage* package = packages.ItemAt(i);
+               const BPackageInfo& repoPackageInfo = package->Info();
+               PackageInfoRef modelInfo;
+               PackageInfoMap::iterator it = foundPackages.find(
+                       repoPackageInfo.Name());
+               if (it != foundPackages.end())
+                       modelInfo = it->second;
+               else {
+                       modelInfo.SetTo(new(std::nothrow) PackageInfo(NULL,
+                               repoPackageInfo.Name(), 
repoPackageInfo.Version().ToString(),
+                               PublisherInfo(BitmapRef(), 
repoPackageInfo.Vendor(), "", ""),
+                               repoPackageInfo.Summary(), 
repoPackageInfo.Description(), ""),
+                       true);
+                       if (modelInfo.Get() == NULL)
+                               return;
+               }
+
+               BSolverRepository* repository = package->Repository();
+               if (dynamic_cast<BPackageManager::RemoteRepository*>(repository)
+                               != NULL) {
+                       depots[repository->Name()].AddPackage(modelInfo);
+               } else {
+                       const char* installationLocation = NULL;
+                       if (repository == static_cast<const BSolverRepository*>(
+                                       fPackageManager.SystemRepository())) {
+                               installationLocation = "system";
+                       } else if (repository == static_cast<const 
BSolverRepository*>(
+                                       fPackageManager.CommonRepository())) {
+                               installationLocation = "common";
+                       } else if (repository == static_cast<const 
BSolverRepository*>(
+                                       fPackageManager.HomeRepository())) {
+                               installationLocation = "home";
+                       }
+
+                       if (installationLocation != NULL)
+                               
packageLocations[installationLocation].AddItem(modelInfo.Get());
+               }
+       }
+
+       for (DepotInfoMap::iterator it = depots.begin(); it != depots.end(); 
++it)
+               fModel.AddDepot(it->second);
+
+       for (PackageLocationMap::iterator it = packageLocations.begin();
+                it != packageLocations.end(); ++it) {
+               for (int32 i = 0; i < it->second.CountItems(); i++) {
+                       fModel.SetPackageState(it->second.ItemAt(i), ACTIVATED);
+                               // TODO: indicate the specific installation 
location
+                               // and verify that the package is in fact 
activated
+                               // by querying the package roster
+               }
+       }
+
 }
diff --git a/src/apps/haiku-depot/MainWindow.h 
b/src/apps/haiku-depot/MainWindow.h
index 7b59771..7342f7b 100644
--- a/src/apps/haiku-depot/MainWindow.h
+++ b/src/apps/haiku-depot/MainWindow.h
@@ -38,7 +38,7 @@ private:
                        void                            _AdoptPackage(const 
PackageInfoRef& package);
                        void                            _ClearPackage();
 
-                       void                            _InitDummyModel();
+                       void                            _InitModel();
 
 private:
                        FilterView*                     fFilterView;
@@ -49,7 +49,8 @@ private:
                        Model                           fModel;
                        PackageList                     fVisiblePackages;
 
-                       PackageManager          fPackageManager;
+                       PackageManager
+                                                               fPackageManager;
 };
 
 #endif // MAIN_WINDOW_H

############################################################################

Commit:      85caa0459d645a614139d3692f68436e83abc0ab
Author:      Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
Date:        Wed Sep 18 11:37:08 2013 UTC

Use BPackageInfoContentHandler in package_repo 'update'.

* Ingo has pointed me at this class which already does the collecting
  of package attributes into a PackageInfo - so there's no need to
  do it manually.

----------------------------------------------------------------------------

diff --git a/src/bin/package_repo/command_update.cpp 
b/src/bin/package_repo/command_update.cpp
index 6714b33..790041c 100644
--- a/src/bin/package_repo/command_update.cpp
+++ b/src/bin/package_repo/command_update.cpp
@@ -24,6 +24,7 @@
 #include <package/hpkg/RepositoryWriter.h>
 #include <package/hpkg/StandardErrorOutput.h>
 #include <package/PackageInfo.h>
+#include <package/PackageInfoContentHandler.h>
 #include <package/RepositoryInfo.h>
 
 #include "package_repo.h"
@@ -77,9 +78,14 @@ parsePackageListFile(const char* packageListFileName,
 
 
 struct PackageInfosCollector : BRepositoryContentHandler {
-       PackageInfosCollector(PackageInfos& packageInfos)
+       PackageInfosCollector(PackageInfos& packageInfos,
+               BHPKG::BErrorOutput* errorOutput)
                :
-               fPackageInfos(packageInfos)
+               fPackageInfos(packageInfos),
+               fErrorOutput(errorOutput),
+               fRepositoryInfo(),
+               fPackageInfo(),
+               fPackageInfoContentHandler(fPackageInfo, fErrorOutput)
        {
        }
 
@@ -92,121 +98,7 @@ struct PackageInfosCollector : BRepositoryContentHandler {
        virtual status_t HandlePackageAttribute(
                const BPackageInfoAttributeValue& value)
        {
-               switch (value.attributeID) {
-                       case B_PACKAGE_INFO_NAME:
-                               fPackageInfo.SetName(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_SUMMARY:
-                               fPackageInfo.SetSummary(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_DESCRIPTION:
-                               fPackageInfo.SetDescription(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_VENDOR:
-                               fPackageInfo.SetVendor(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_PACKAGER:
-                               fPackageInfo.SetPackager(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_BASE_PACKAGE:
-                               fPackageInfo.SetBasePackage(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_FLAGS:
-                               fPackageInfo.SetFlags(value.unsignedInt);
-                               break;
-
-                       case B_PACKAGE_INFO_ARCHITECTURE:
-                               
fPackageInfo.SetArchitecture(BPackageArchitecture(
-                                       value.unsignedInt));
-                               break;
-
-                       case B_PACKAGE_INFO_VERSION:
-                               fPackageInfo.SetVersion(value.version);
-                               break;
-
-                       case B_PACKAGE_INFO_COPYRIGHTS:
-                               fPackageInfo.AddCopyright(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_LICENSES:
-                               fPackageInfo.AddLicense(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_URLS:
-                               fPackageInfo.AddURL(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_SOURCE_URLS:
-                               fPackageInfo.AddSourceURL(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_PROVIDES:
-                               fPackageInfo.AddProvides(value.resolvable);
-                               break;
-
-                       case B_PACKAGE_INFO_REQUIRES:
-                               
fPackageInfo.AddRequires(value.resolvableExpression);
-                               break;
-
-                       case B_PACKAGE_INFO_SUPPLEMENTS:
-                               
fPackageInfo.AddSupplements(value.resolvableExpression);
-                               break;
-
-                       case B_PACKAGE_INFO_CONFLICTS:
-                               
fPackageInfo.AddConflicts(value.resolvableExpression);
-                               break;
-
-                       case B_PACKAGE_INFO_FRESHENS:
-                               
fPackageInfo.AddFreshens(value.resolvableExpression);
-                               break;
-
-                       case B_PACKAGE_INFO_REPLACES:
-                               fPackageInfo.AddReplaces(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_GLOBAL_WRITABLE_FILES:
-                               fPackageInfo.AddGlobalWritableFileInfo(
-                                       value.globalWritableFileInfo);
-                               break;
-
-                       case B_PACKAGE_INFO_USER_SETTINGS_FILES:
-                               fPackageInfo.AddUserSettingsFileInfo(
-                                       value.userSettingsFileInfo);
-                               break;
-
-                       case B_PACKAGE_INFO_USERS:
-                               fPackageInfo.AddUser(value.user);
-                               break;
-
-                       case B_PACKAGE_INFO_GROUPS:
-                               fPackageInfo.AddGroup(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_POST_INSTALL_SCRIPTS:
-                               fPackageInfo.AddPostInstallScript(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_INSTALL_PATH:
-                               fPackageInfo.SetInstallPath(value.string);
-                               break;
-
-                       case B_PACKAGE_INFO_CHECKSUM:
-                               fPackageInfo.SetChecksum(value.string);
-                               break;
-
-                       default:
-                               printf("Error: Invalid package attribute 
section: unexpected "
-                                       "package attribute id %d 
encountered\n", value.attributeID);
-                               return B_BAD_DATA;
-               }
-
-               return B_OK;
+               return fPackageInfoContentHandler.HandlePackageAttribute(value);
        }
 
        virtual status_t HandlePackageDone(const char* packageName)
@@ -237,9 +129,11 @@ struct PackageInfosCollector : BRepositoryContentHandler {
        }
 
 private:
+       PackageInfos& fPackageInfos;
+       BHPKG::BErrorOutput* fErrorOutput;
        BRepositoryInfo fRepositoryInfo;
        BPackageInfo fPackageInfo;
-       PackageInfos& fPackageInfos;
+       BPackageInfoContentHandler fPackageInfoContentHandler;
 };
 
 
@@ -372,7 +266,7 @@ command_update(int argc, const char* const* argv)
 
        // collect package infos and repository info from source repository
        PackageInfos packageInfos;
-       PackageInfosCollector packageInfosCollector(packageInfos);
+       PackageInfosCollector packageInfosCollector(packageInfos, &errorOutput);
        error = repositoryReader.ParseContent(&packageInfosCollector);
        if (error != B_OK)
                return 1;

############################################################################

Commit:      d7cbcb13da916672fa94b06451dc3ec344a432b2
Author:      Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
Date:        Wed Sep 18 11:37:33 2013 UTC

Fix build of <build>package_repo.

----------------------------------------------------------------------------

diff --git a/src/tools/package_repo/Jamfile b/src/tools/package_repo/Jamfile
index e5f2484..3de9559 100644
--- a/src/tools/package_repo/Jamfile
+++ b/src/tools/package_repo/Jamfile
@@ -14,6 +14,6 @@ BuildPlatformMain <build>package_repo :
        command_list.cpp
        package_repo.cpp
        :
-       libpackage_build.so $(HOST_LIBBE) $(HOST_LIBSUPC++)
+       libpackage_build.so $(HOST_LIBBE) $(HOST_LIBSUPC++) $(HOST_LIBSTDC++)
 ;
 


Other related posts:

  • » [haiku-commits] BRANCH HaikuPM-github.package-management [d7cbcb1] in src: apps/haiku-depot bin/package_repo - HaikuPM-github . package-management