Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f3daf26
Add Deb822 sources support (issue #149)
aybanda May 5, 2025
f71855c
fix: Improve Deb822 source implementation
aybanda May 5, 2025
e4c9451
Another approach and shifting files appropriately after review
aybanda May 5, 2025
82181b5
add rsource_deb822.cc into POTFILES.in
aybanda May 6, 2025
9184ec7
Add Deb822 sources support and remove handleFailedInstallation function
aybanda May 7, 2025
0a23800
Add support for additional Deb822 fields and update integration tests…
aybanda May 9, 2025
2f44455
Fix UTF-8 encoding issues in Deb822 source handling. Implement proper…
aybanda May 9, 2025
4e0fb39
Add rpackagemanager files to Makefile.am
aybanda May 15, 2025
8937715
Add Deb822 source format support header
aybanda May 19, 2025
609320f
Implement Deb822 source format handling
aybanda May 19, 2025
afe0743
Fix package manager and lister for Deb822 support
aybanda May 19, 2025
63b3c5e
Fix compilation issues
aybanda May 20, 2025
94cdb17
Fix: use MultiArchSupported()
aybanda May 20, 2025
fc0042c
Fix: Use SourcesList::SourceRecord for Deb822 conversion functions to…
aybanda May 20, 2025
77dce04
Fix: Add missing source conversion
aybanda May 20, 2025
e5e76db
Fix: Replace non-existent APT::String UTF-8 conversion with standard …
aybanda May 20, 2025
100e52e
Fix: Remove function redefinitions, add missing signedBy member
aybanda May 20, 2025
100d25a
Fix: Remove function redefinitions, replace APT::String::Strip with t…
aybanda May 20, 2025
e8dbdf5
Add dialog before auto-conversion 2) Fix reading from /etc/apt/source…
aybanda May 21, 2025
be78612
Update source record types and string conversion
aybanda May 21, 2025
ea78b57
simplify file handling
aybanda May 22, 2025
c424340
Fix Sections vs Components conversion
aybanda May 22, 2025
d879ae4
Fix SourcesList vs pkgSourceList namespace usage
aybanda May 22, 2025
1c65681
Fix error handling
aybanda May 22, 2025
bc24d2b
Fix build errors
aybanda May 22, 2025
d0184bc
Add debug prints in RGRepositoryEditor::Run to trace source loading
aybanda Jun 1, 2025
45f4f68
Add second debug print in RGRepositoryEditor
aybanda Jun 1, 2025
ecb8bb1
Add debug print after gtk_list_store_set in RGRepositoryEditor::Run
aybanda Jun 1, 2025
942e96d
Read Deb822 .sources files from sourceparts directory to match APT be…
aybanda Jun 20, 2025
6e2c4b7
Preserve extra Deb822 fields and disable auto-conversion of legacy so…
aybanda Jun 20, 2025
1e6168e
fix: always write sources.list in classic format, only .sources use D…
aybanda Jul 8, 2025
0828984
Fix: trailing spaces, empty lines, URL modification, section reorderi…
aybanda Jul 11, 2025
8d568b5
preserve section order, trim extra lines, handle Deb822 enable/disabl…
aybanda Jul 13, 2025
01f2ae9
fix: preserve Deb822 flag when editing sources in repository window t…
aybanda Jul 19, 2025
6f0643e
fix: always scan /etc/apt/sources.list.d/ for Deb822 .sources files, …
aybanda Jul 19, 2025
b679b09
fix: use std::cout for debug output in ReadSources instead of g_print…
aybanda Jul 19, 2025
d86e93d
fix: ensure /etc/apt/sources.list.d/ is always scanned for Deb822 sou…
aybanda Jul 19, 2025
2372c57
debug: add detailed debug prints for Deb822 .sources file discovery a…
aybanda Jul 19, 2025
0eb0093
debug: add detailed debug prints to Deb822 parser to trace stanza and…
aybanda Jul 19, 2025
0683195
debug: add detailed debug prints to Deb822 parser in rsource_deb822.c…
aybanda Jul 19, 2025
bc23446
test: add global print to confirm rsource_deb822.cc is being used at …
aybanda Jul 19, 2025
c439acc
cleanup: remove debug prints and temporary debug code from Deb822 par…
aybanda Jul 19, 2025
cbd4b01
fix: Deb822 round-trip, enabled/disabled state, and field preservatio…
aybanda Jul 19, 2025
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
6 changes: 4 additions & 2 deletions common/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


noinst_LIBRARIES = libsynaptic.a

AM_CPPFLAGS = -I/usr/include/apt-pkg @RPM_HDRS@ @DEB_HDRS@ \
Expand Down Expand Up @@ -34,8 +32,12 @@ libsynaptic_a_SOURCES =\
raptoptions.h\
rsources.cc \
rsources.h \
rsource_deb822.cc \
rsource_deb822.h \
rcacheactor.cc \
rcacheactor.h \
rpackagemanager.cc \
rpackagemanager.h \
rpackagelistactor.cc \
rpackagelistactor.h \
rtagcollbuilder.cc \
Expand Down
174 changes: 174 additions & 0 deletions common/rdeb822source.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
#include "rdeb822source.h"
#include <algorithm>
#include <sstream>
#include <fstream>
#include <filesystem>
#include <iostream> // Added for debug prints
#include <map> // Added for debug prints

RDeb822Source::RDeb822Source()
: enabled(true)
{
}

RDeb822Source::RDeb822Source(const std::string& types, const std::string& uris,
const std::string& suites, const std::string& components)
: types(types), uris(uris), suites(suites), components(components), enabled(true)
{
}

bool RDeb822Source::isValid() const {
return !types.empty() && !uris.empty() && !suites.empty();
}

std::string RDeb822Source::toString() const {
std::stringstream ss;
if (!enabled) {
ss << "Types: " << types << "\n";
ss << "URIs: " << uris << "\n";
ss << "Suites: " << suites << "\n";
if (!components.empty()) {
ss << "Components: " << components << "\n";
}
if (!signedBy.empty()) {
ss << "Signed-By: " << signedBy << "\n";
}
} else {
ss << "# " << types << " " << uris << " " << suites;
if (!components.empty()) {
ss << " " << components;
}
if (!signedBy.empty()) {
ss << " [signed-by=" << signedBy << "]";
}
}
return ss.str();
}

RDeb822Source RDeb822Source::fromString(const std::string& content) {
RDeb822Source source;
std::istringstream iss(content);
std::string line;

while (std::getline(iss, line)) {
line = trim(line);
if (line.empty() || line[0] == '#') continue;

size_t colon = line.find(':');
if (colon == std::string::npos) continue;

std::string key = trim(line.substr(0, colon));
std::string value = trim(line.substr(colon + 1));

if (key == "Types") source.setTypes(value);
else if (key == "URIs") source.setURIs(value);
else if (key == "Suites") source.setSuites(value);
else if (key == "Components") source.setComponents(value);
else if (key == "Signed-By") source.setSignedBy(value);
}

return source;
}

bool RDeb822Source::operator==(const RDeb822Source& other) const {
return types == other.types &&
uris == other.uris &&
suites == other.suites &&
components == other.components &&
signedBy == other.signedBy &&
enabled == other.enabled;
}

bool RDeb822Source::operator!=(const RDeb822Source& other) const {
return !(*this == other);
}

std::string RDeb822Source::trim(const std::string& str) {
const std::string whitespace = " \t\r\n";
size_t start = str.find_first_not_of(whitespace);
if (start == std::string::npos) {
return "";
}
size_t end = str.find_last_not_of(whitespace);
return str.substr(start, end - start + 1);
}

bool RDeb822Source::ParseDeb822File(const std::string& path, std::vector<Deb822Entry>& entries) {
std::cout << "DEBUG: [Deb822Parser] Opening file: " << path << std::endl;
std::ifstream file(path);
if (!file.is_open()) {
std::cout << "DEBUG: [Deb822Parser] Failed to open file: " << path << std::endl;
return false;
}
std::string line;
std::map<std::string, std::string> fields;
int stanza_count = 0;
while (std::getline(file, line)) {
std::cout << "DEBUG: [Deb822Parser] Read line: '" << line << "'" << std::endl;
if (line.empty()) {
if (!fields.empty()) {
std::cout << "DEBUG: [Deb822Parser] End of stanza, fields found:" << std::endl;
for (const auto& kv : fields) {
std::cout << " '" << kv.first << "': '" << kv.second << "'" << std::endl;
}
Deb822Entry entry;
// Check required fields
if (fields.find("Types") == fields.end() || fields.find("URIs") == fields.end() || fields.find("Suites") == fields.end()) {
std::cout << "DEBUG: [Deb822Parser] Missing required field in stanza, skipping." << std::endl;
fields.clear();
continue;
}
entry.Types = fields["Types"];
entry.URIs = fields["URIs"];
entry.Suites = fields["Suites"];
entry.Components = fields.count("Components") ? fields["Components"] : "";
entry.SignedBy = fields.count("Signed-By") ? fields["Signed-By"] : "";
entry.Enabled = true; // Default to enabled
entries.push_back(entry);
stanza_count++;
fields.clear();
}
continue;
}
if (line[0] == '#') {
std::cout << "DEBUG: [Deb822Parser] Skipping comment line." << std::endl;
continue;
}
size_t colon = line.find(':');
if (colon == std::string::npos) {
std::cout << "DEBUG: [Deb822Parser] No colon found in line, skipping." << std::endl;
continue;
}
std::string key = line.substr(0, colon);
std::string value = line.substr(colon + 1);
// Trim whitespace
key.erase(0, key.find_first_not_of(" \t"));
key.erase(key.find_last_not_of(" \t") + 1);
value.erase(0, value.find_first_not_of(" \t"));
value.erase(value.find_last_not_of(" \t") + 1);
std::cout << "DEBUG: [Deb822Parser] Parsed field: '" << key << "' = '" << value << "'" << std::endl;
fields[key] = value;
}
// Handle last stanza if file does not end with blank line
if (!fields.empty()) {
std::cout << "DEBUG: [Deb822Parser] End of file, last stanza fields:" << std::endl;
for (const auto& kv : fields) {
std::cout << " '" << kv.first << "': '" << kv.second << "'" << std::endl;
}
Deb822Entry entry;
if (fields.find("Types") == fields.end() || fields.find("URIs") == fields.end() || fields.find("Suites") == fields.end()) {
std::cout << "DEBUG: [Deb822Parser] Missing required field in last stanza, skipping." << std::endl;
} else {
entry.Types = fields["Types"];
entry.URIs = fields["URIs"];
entry.Suites = fields["Suites"];
entry.Components = fields.count("Components") ? fields["Components"] : "";
entry.SignedBy = fields.count("Signed-By") ? fields["Signed-By"] : "";
entry.Enabled = true;
entries.push_back(entry);
stanza_count++;
}
}
std::cout << "DEBUG: [Deb822Parser] Parsed " << stanza_count << " stanzas from file: " << path << std::endl;
return true;
}
38 changes: 38 additions & 0 deletions common/rdeb822source.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
class RDeb822Source {
public:
RDeb822Source();
RDeb822Source(const std::string& types, const std::string& uris,
const std::string& suites, const std::string& components = "");

bool isValid() const;
std::string toString() const;
static RDeb822Source fromString(const std::string& content);
bool operator==(const RDeb822Source& other) const;
bool operator!=(const RDeb822Source& other) const;

// Getters
std::string getTypes() const { return types; }
std::string getURIs() const { return uris; }
std::string getSuites() const { return suites; }
std::string getComponents() const { return components; }
std::string getSignedBy() const { return signedBy; }
bool isEnabled() const { return enabled; }

// Setters
void setTypes(const std::string& t) { types = t; }
void setURIs(const std::string& u) { uris = u; }
void setSuites(const std::string& s) { suites = s; }
void setComponents(const std::string& c) { components = c; }
void setSignedBy(const std::string& s) { signedBy = s; }
void setEnabled(bool e) { enabled = e; }

static std::string trim(const std::string& str);

private:
std::string types; // Changed from type to types
std::string uris; // Changed from uri to uris
std::string suites; // Changed from dist to suites
std::string components; // Changed from sections to components
std::string signedBy;
bool enabled;
};
6 changes: 1 addition & 5 deletions common/rpackagelister.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2106,11 +2106,7 @@ bool RPackageLister::xapianSearch(string searchString)

bool RPackageLister::isMultiarchSystem()
{
#ifdef WITH_APT_MULTIARCH_SUPPORT
return (APT::Configuration::getArchitectures().size() > 1);
#else
return false;
#endif
return _system->MultiArchSupported();
}

// vim:ts=3:sw=3:et
Loading