else if (str == "pattern") {
kind = ResTraits<zypp::Pattern>::kind;
}
+ else if (str == "selection") {
+ kind = ResTraits<zypp::Selection>::kind;
+ }
else if (str == "script") {
kind = ResTraits<zypp::Script>::kind;
}
bool operator()( PoolItem_Ref p)
{
+MIL << p << " ?" << endl;
Source_Ref s = p->source();
if (s.alias() != source.alias()) {
{
PoolItem_Ref poolItem;
Resolvable::Kind kind = string2kind (kind_name);
+ Source_Ref source;
try {
- Source_Ref source = manager->findSource (source_alias);
- if (!source) {
- cerr << "Can't find source '" << source_alias << "'" << endl;
- return poolItem;
- }
+ source = manager->findSource (source_alias);
+ }
+ catch (Exception & excpt_r) {
+ ZYPP_CAUGHT (excpt_r);
+ cerr << "Can't find source '" << source_alias << "'" << endl;
+ return poolItem;
+ }
+ try {
FindPackage info (source, kind);
invokeOnEach( God->pool().byNameBegin( package_name ),
God->pool().byNameEnd( package_name ),
-// functor::chain( resfilter::BySource(source), resfilter::ByKind (kind) ),
- resfilter::ByKind (kind),
+ functor::chain( resfilter::BySource(source), resfilter::ByKind (kind) ),
+// resfilter::ByKind (kind),
functor::functorRef<bool,PoolItem> (info) );
poolItem = info.poolItem;
count = src.resolvables().size();
cout << "Added source '" << alias << "' as #" << snum << ":[" << src.alias() << "] with " << count << " resolvables" << endl;
God->addResolvables( src.resolvables(), (alias == "@system") );
- print_pool ();
+// print_pool ();
cout << "Loaded " << count << " package(s) from " << pathname << endl;
}
} else if (node->equals ("install")) {
string source_alias = node->getProp ("channel");
- string package_name = node->getProp ("package");
+ string name = node->getProp ("name");
+ if (name.empty())
+ name = node->getProp ("package");
string kind_name = node->getProp ("kind");
string soft = node->getProp ("soft");
PoolItem_Ref poolItem;
- poolItem = get_poolItem (source_alias, package_name, kind_name);
+ poolItem = get_poolItem (source_alias, name, kind_name);
if (poolItem) {
- RESULT << "Installing " << package_name << " from channel " << source_alias << endl;;
+ RESULT << "Installing " << name << " from channel " << source_alias << endl;;
poolItem.status().setToBeInstalled(ResStatus::USER);
if (!soft.empty())
poolItem.status().setSoftInstall(true);
// resolver->addPoolItemToInstall (poolItem);
} else {
- cerr << "Unknown package " << source_alias << "::" << package_name << endl;
+ cerr << "Unknown item " << source_alias << "::" << name << endl;
}
} else if (node->equals ("uninstall")) {
- string package_name = node->getProp ("package");
+ string name = node->getProp ("name");
+ if (name.empty())
+ name = node->getProp ("package");
string kind_name = node->getProp ("kind");
string soft = node->getProp ("soft");
PoolItem_Ref poolItem;
- poolItem = get_poolItem ("@system", package_name, kind_name);
+ poolItem = get_poolItem ("@system", name, kind_name);
if (poolItem) {
- RESULT << "Uninstalling " << package_name << endl;
+ RESULT << "Uninstalling " << name << endl;
poolItem.status().setToBeUninstalled(ResStatus::USER);
if (!soft.empty())
poolItem.status().setSoftUninstall(true);
// resolver->addPoolItemToRemove (poolItem);
} else {
- cerr << "Unknown system package " << package_name << endl;
+ cerr << "Unknown system item " << name << endl;
}
} else if (node->equals ("upgrade")) {
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/solver/temporary/HelixSelectionImpl.cc
+ *
+*/
+
+#include "HelixSelectionImpl.h"
+#include "zypp/source/SourceImpl.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+
+using namespace std;
+using namespace zypp::detail;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+//
+// CLASS NAME : HelixSelectionImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+HelixSelectionImpl::HelixSelectionImpl (Source_Ref source_r, const zypp::HelixParser & parsed)
+ : _source (source_r)
+ , _summary(parsed.summary)
+ , _description(parsed.description)
+{
+}
+
+Source_Ref
+HelixSelectionImpl::source() const
+{ return _source; }
+
+/** Selection summary */
+TranslatedText HelixSelectionImpl::summary() const
+{ return _summary; }
+
+/** Selection description */
+TranslatedText HelixSelectionImpl::description() const
+{ return _description; }
+
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/solver/temporary/HelixSelectionImpl.h
+ *
+*/
+#ifndef ZYPP_SOLVER_TEMPORARY_HELIXSELECTIONIMPL_H
+#define ZYPP_SOLVER_TEMPORARY_HELIXSELECTIONIMPL_H
+
+#include "zypp/detail/SelectionImpl.h"
+#include "HelixParser.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+// CLASS NAME : HelixSelectionImpl
+//
+/** Class representing a package
+*/
+class HelixSelectionImpl : public detail::SelectionImplIf
+{
+public:
+
+ class HelixParser;
+ /** Default ctor
+ */
+ HelixSelectionImpl( Source_Ref source_r, const zypp::HelixParser & data );
+
+ /** Selection summary */
+ virtual TranslatedText summary() const;
+ /** Selection description */
+ virtual TranslatedText description() const;
+
+ /** */
+ virtual Source_Ref source() const;
+protected:
+ Source_Ref _source;
+ TranslatedText _summary;
+ TranslatedText _description;
+
+ };
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_SOLVER_TEMPORARY_HELIXSELECTIONIMPL_H
#include "HelixScriptImpl.h"
#include "HelixMessageImpl.h"
#include "HelixPatchImpl.h"
+#include "HelixSelectionImpl.h"
#include "HelixPatternImpl.h"
#include "HelixProductImpl.h"
}
+Selection::Ptr
+HelixSourceImpl::createSelection (const HelixParser & parsed)
+{
+ try
+ {
+ shared_ptr<HelixSelectionImpl> impl(new HelixSelectionImpl(_source, parsed));
+
+ // Collect basic Resolvable data
+ NVRAD dataCollect( parsed.name,
+ Edition( parsed.version, parsed.release, parsed.epoch ),
+ Arch( parsed.arch ),
+ createDependencies (parsed));
+ Selection::Ptr pattern = detail::makeResolvableFromImpl(dataCollect, impl);
+ return pattern;
+ }
+ catch (const Exception & excpt_r)
+ {
+ ERR << excpt_r << endl;
+ throw "Cannot create selection object";
+ }
+ return NULL;
+}
+
+
Pattern::Ptr
HelixSourceImpl::createPattern (const HelixParser & parsed)
{
Patch::Ptr p = createPatch (parsed);
_store.insert (p);
}
+ else if (parsed.kind == ResTraits<Selection>::kind) {
+ Selection::Ptr s = createSelection(parsed);
+ _store.insert (s);
+ }
else if (parsed.kind == ResTraits<Pattern>::kind) {
Pattern::Ptr p = createPattern (parsed);
_store.insert (p);
Script::Ptr createScript (const HelixParser & data);
Patch::Ptr createPatch (const HelixParser & data);
Pattern::Ptr createPattern (const HelixParser & data);
+ Selection::Ptr createSelection (const HelixParser & data);
Product::Ptr createProduct (const HelixParser & data);
Dependencies createDependencies (const HelixParser & data);
HelixScriptImpl.h \
HelixMessageImpl.h \
HelixPatchImpl.h \
+ HelixSelectionImpl.h \
HelixPatternImpl.h \
HelixProductImpl.h
HelixScriptImpl.cc \
HelixMessageImpl.cc \
HelixPatchImpl.cc \
+ HelixSelectionImpl.cc \
HelixPatternImpl.cc \
HelixProductImpl.cc
class Package
attr_accessor :name, :epoch, :version, :release, :architecture
attr_accessor :summary, :description, :group, :rpmsize, :installsize
- attr_accessor :requires, :prerequires, :provides, :conflicts, :obsoletes
+ attr_accessor :requires, :prerequires, :provides, :conflicts, :obsoletes, :suggests, :enhances
attr_accessor :location
attr_accessor :skip
add_dependencies "provides", provides
add_dependencies "conflicts", conflicts
add_dependencies "obsoletes", obsoletes
+ add_dependencies "suggests", suggests
+ add_dependencies "enhances", enhances
@channel.puts "</package>"
end
package.conflicts = parse_dependencies f, "-Con"
when "+Obs"
package.obsoletes = parse_dependencies f, "-Obs"
+ when "+Sug"
+ package.suggests = parse_dependencies f, "-Sug"
+ when "+Enh"
+ package.enhances = parse_dependencies f, "-Enh"
else
STDERR.puts "Unknown '#{key}'"