--disabled and --no-refresh.
dnl ==================================================
m4_define([ZYPPER_MAJOR], [0])
m4_define([ZYPPER_MINOR], [6])
-m4_define([ZYPPER_PATCH], [9])
+m4_define([ZYPPER_PATCH], [10])
dnl ==================================================
.TP
\fI\-r, -\-repo\fR <FILE.repo>
Read URI and alias from a file
+.TP
+\fI\-t, \-\-type\fR <TYPE>
+Type of repository (YaST, YUM, or Plaindir).
+.TP
+\fI\-d, \-\-disabled\fR
+Add the service as disabled.
+.TP
+\fI\-n, \-\-no\-refresh\fR
+Do not automatically refresh the metadata.
.TP
.B service-delete (sd) <URI|alias|number>
-------------------------------------------------------------------
+Wed Nov 15 14:40:11 CET 2006 - mvidner@suse.cz
+
+- service-add: added options --type (especially for Plaindir,
+ #174369), --disabled, and --no-refresh.
+- 0.6.10
+
+-------------------------------------------------------------------
Mon Nov 13 15:47:50 CET 2006 - mvidner@suse.cz
- Fixed service-rename leaving the old name around.
(for example install -t was thinking -t stood for --terse).
- If "install"ing more resolvables at a time, don't commit one by one.
- 0.6.6
+
-------------------------------------------------------------------
Wed Nov 8 20:08:30 CET 2006 - jkupec@suse.cz
return outstr;
}
-void add_source_by_url( const zypp::Url &url, std::string alias )
+void add_source_by_url( const zypp::Url &url, const string &alias,
+ const string &type, bool enabled, bool refresh )
{
cerr_vv << "Constructing SourceManager" << endl;
SourceManager_Ptr manager = SourceManager::sourceManager();
Pathname path;
Pathname cache;
bool is_base = false;
- if (alias.empty ())
- alias = timestamp();
+ string myalias = alias.empty() ? timestamp() : alias;
// more products?
// try
cerr_vv << "Creating source" << endl;
- Source_Ref source = SourceFactory().createFrom( url, path, alias, cache, is_base );
+ Source_Ref source;
+ if (type.empty()) {
+ source = SourceFactory().createFrom( url, path, myalias, cache, is_base );
+ }
+ else {
+ source = SourceFactory().createFrom( type,
+ url, path, myalias, cache, is_base,
+ refresh );
+ }
cerr_vv << "Adding source" << endl;
SourceManager::SourceId sourceId = manager->addSource( source );
- //if (enableSource)
+ if (enabled)
source.enable();
- //else
- // source.disable();
+ else
+ source.disable();
- //source.setAutorefresh (autoRefresh);
+ source.setAutorefresh (refresh);
sourceIds.push_back( sourceId );
cout << "Added Installation Sources:" << endl;
void init_system_sources();
void include_source_by_url( const zypp::Url &url );
bool parse_repo_file (const std::string& file, std::string& url, std::string& alias);
-void add_source_by_url( const zypp::Url &url, std::string alias );
+void add_source_by_url( const zypp::Url &url, const std::string &alias,
+ const std::string &type = "",
+ bool enabled = true, bool refresh = true );
void remove_source( const std::string& anystring );
void rename_source( const std::string& anystring, const std::string& newalias );
void list_system_sources();
};
#endif
-
+// Local Variables:
+// mode: c++
+// c-basic-offset: 2
+// End:
}
else if (command == "service-add" || command == "sa") {
static struct option service_add_options[] = {
+ {"type", required_argument, 0, 't'},
{"disabled", no_argument, 0, 'd'},
{"no-refresh", no_argument, 0, 'n'},
{"repo", required_argument, 0, 'r'},
" Command options:\n"
"\t--repo,-r <FILE.repo>\tRead the URL and alias from a file\n"
"\t\t\t\t(even remote)\n"
+ "\t--type,-t <TYPE>\tType of repository (YaST, YUM, or Plaindir)\n"
+ "\t--disabled,-d\t\tAdd the service as disabled\n"
+ "\t--no-refresh,-n\t\tDo not automatically refresh the metadata\n"
;
}
else if (command == "service-list" || command == "sl") {
else if (command == "service-add" || command == "sa")
{
- if (copts.count("disabled")) {
- cerr_v << "FAKE Disabled" << endl;
- }
- if (copts.count("no-refresh")) {
- cerr_v << "FAKE No Refresh" << endl;
+ // TODO: repect values in .repo, have these as overrides
+ bool enabled = ! copts.count("disabled");
+ bool refresh = ! copts.count("no-refresh");
+
+ string type = copts.count("type")? copts["type"].front() : "";
+ if (type != "" && type != "YaST" && type != "YUM" && type != "Plaindir") {
+ cerr << "Warning, unknown metadata type " << type << endl;
}
string repoalias, repourl;
try {
// also stores it
- add_source_by_url(url, alias);
+ add_source_by_url(url, alias, type, enabled, refresh);
}
catch ( const Exception & excpt_r )
{