Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SLE-15-SP6] Fixed repository and service probing (bsc#1218977, bsc#1218399) #186

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion configure.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ fi
AX_CHECK_DOCBOOK

# libzypp uses the C++17 standard
CXXFLAGS="${CXXFLAGS} -std=c++17"
# treat missing values in switch statements as errors
CXXFLAGS="${CXXFLAGS} -std=c++17 -Werror=switch"

## and generate the output
@YAST2-OUTPUT@
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings-devel-doc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-pkg-bindings-devel-doc
Version: 4.6.4
Version: 4.6.5
Release: 0
Summary: YaST2 - Documentation for yast2-pkg-bindings package
License: GPL-2.0-only
Expand Down
8 changes: 8 additions & 0 deletions package/yast2-pkg-bindings.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Jan 19 14:23:03 UTC 2024 - Ladislav Slezák <[email protected]>

- Fixed repository and service probing with libzypp 7.31.26
and newer, fixes broken repository handling (bsc#1218977,
bsc#1218399)
- 4.6.5

-------------------------------------------------------------------
Wed Sep 20 08:57:18 UTC 2023 - Ladislav Slezák <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-pkg-bindings.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-pkg-bindings
Version: 4.6.4
Version: 4.6.5
Release: 0
Summary: YaST2 - Package Manager Access
License: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion src/PkgFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class PkgFunctions
bool remoteRepo(const zypp::Url &url);

// conversion methods for type string between Yast and libzypp (for backward compatibility)
std::string zypp2yastType(const std::string &type);
std::string zypp2yastType(const zypp::repo::RepoType &type);
std::string yast2zyppType(const std::string &type);

// helper - create a directory if it doesn't exist
Expand Down
12 changes: 11 additions & 1 deletion src/ServiceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,17 @@ bool ServiceManager::SetService(const std::string &old_alias, const zypp::Servic
std::string ServiceManager::Probe(const zypp::Url &url, const zypp::RepoManager &repomgr) const
{
y2milestone("Probing service at %s...", url.asString().c_str());
std::string ret(repomgr.probeService(url).asString());

std::string ret;

zypp::repo::ServiceType type(repomgr.probeService(url));
switch (type.toEnum())
{
case zypp::repo::ServiceType::NONE_e: ret = "NONE"; break;
case zypp::repo::ServiceType::PLUGIN_e: ret = "plugin"; break;
case zypp::repo::ServiceType::RIS_e: ret = "ris"; break;
}

y2milestone("Detected service type: %s", ret.c_str());

return ret;
Expand Down
2 changes: 1 addition & 1 deletion src/Source_Create.cc
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ YCPValue PkgFunctions::RepositoryProbe(const YCPString& url, const YCPString& pr
// autoprobe type of the repository
zypp::repo::RepoType repotype = ProbeWithCallbacks(probe_url);

ret = zypp2yastType(repotype.asString());
ret = zypp2yastType(repotype);
y2milestone("Detected type: '%s'...", ret.c_str());
}
catch (const zypp::Exception& excpt)
Expand Down
2 changes: 1 addition & 1 deletion src/Source_Get.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PkgFunctions::SourceGeneralData (const YCPInteger& id)
return YCPVoid ();

// convert type to the old strings ("YaST", "YUM" or "Plaindir")
std::string srctype = zypp2yastType(repo->repoInfo().type().asString());
std::string srctype = zypp2yastType(repo->repoInfo().type());

data->add( YCPString("enabled"), YCPBoolean(repo->repoInfo().enabled()));
data->add( YCPString("autorefresh"), YCPBoolean(repo->repoInfo().autorefresh()));
Expand Down
32 changes: 9 additions & 23 deletions src/Source_Misc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,32 +108,18 @@ bool PkgFunctions::aliasExists(const std::string &alias, const std::list<zypp::R
}

// convert libzypp type to yast strings ("YaST", "YUM" or "Plaindir")
std::string PkgFunctions::zypp2yastType(const std::string &type)
std::string PkgFunctions::zypp2yastType(const zypp::repo::RepoType &type)
{
std::string ret(type);

if (type_conversion_table.empty())
switch (type.toEnum())
{
// initialize the conversion map
type_conversion_table["rpm-md"] = "YUM";
type_conversion_table["yast2"] = "YaST";
type_conversion_table["plaindir"] = "Plaindir";
type_conversion_table["NONE"] = "NONE";
case zypp::repo::RepoType::NONE_e: return "NONE";
case zypp::repo::RepoType::RPMMD_e: return "YUM";
case zypp::repo::RepoType::YAST2_e: return "YaST";
case zypp::repo::RepoType::RPMPLAINDIR_e: return "Plaindir";
}

std::map<std::string,std::string>::const_iterator it = type_conversion_table.find(type);

// found in the conversion table
if (it != type_conversion_table.end())
{
ret = it->second;
}
else
{
y2error("Cannot convert type '%s'", type.c_str());
}

return ret;
// never reached, unhandled enums are treated as errors via the -Werror option
return "";
}

std::string PkgFunctions::yast2zyppType(const std::string &type)
Expand All @@ -159,7 +145,7 @@ std::string PkgFunctions::UniqueAlias(const std::string &alias)
{
y2milestone("Alias %s already found: %lld", ret.c_str(), logFindAlias(ret));

// the alias already exists - add a counter
// the alias already exists - add a counter
std::ostringstream ostr;
ostr << alias << "_" << id;

Expand Down
Loading