summaryrefslogtreecommitdiff
path: root/backend/job.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/job.cpp')
-rw-r--r--backend/job.cpp52
1 files changed, 3 insertions, 49 deletions
diff --git a/backend/job.cpp b/backend/job.cpp
index f95b33a..21b3ebc 100644
--- a/backend/job.cpp
+++ b/backend/job.cpp
@@ -7,13 +7,11 @@ module;
#include "config.h"
#include <filesystem>
-#include <gio/gio.h>
#include <cstdint>
#include <stdlib.h>
#include <iostream>
#include <zlib.h>
#include <curl/curl.h>
-#include <glib/gstdio.h>
#include <sqlite3.h>
#include <forward_list>
#include <array>
@@ -33,14 +31,10 @@ namespace katja
{
static std::forward_list<std::unique_ptr<Pkgtools>> repos;
-void pk_backend_initialize(GKeyFile *conf)
+void pk_backend_initialize()
{
- char **groups;
int ret;
std::uint8_t i;
- std::size_t groups_len;
- GKeyFile *key_conf;
- GError *err = nullptr;
sqlite3 *db;
sqlite3_stmt *stmt;
@@ -53,16 +47,6 @@ void pk_backend_initialize(GKeyFile *conf)
std::cerr << path.native() << ": " << sqlite3_errmsg(db) << std::endl;
}
- /* Read the configuration file */
- key_conf = g_key_file_new();
- path = std::filesystem::path(SYSCONFDIR) / "PackageKit" / "Slackware.conf";
- g_key_file_load_from_file(key_conf, path.c_str(), G_KEY_FILE_NONE, &err);
- if (err)
- {
- std::cerr << path.native() << ": " << err->message << std::endl;
- g_error_free(err);
- }
-
std::chrono::time_point<std::chrono::file_clock> file_info = std::filesystem::last_write_time(path);
auto microseconds = std::chrono::duration_cast<std::chrono::microseconds>(file_info.time_since_epoch());
@@ -87,26 +71,6 @@ void pk_backend_initialize(GKeyFile *conf)
std::cerr << "Failed to update database: " << path.native() << std::endl;
}
sqlite3_close_v2(db);
-
- /* Initialize an object for each well-formed repository */
- groups = g_key_file_get_groups(key_conf, &groups_len);
- for (i = 0; i < groups_len; i++)
- {
- char *blacklist = g_key_file_get_string(key_conf, groups[i], "Blacklist", nullptr);
- char *mirror = g_key_file_get_string(key_conf, groups[i], "Mirror", nullptr);
-
- if (g_key_file_has_key(key_conf, groups[i], "Priority", nullptr))
- {
- auto repo = std::make_unique<Slackpkg>(groups[i], mirror, i + 1, blacklist,
- g_key_file_get_string_list(key_conf, groups[i], "Priority", nullptr, nullptr));
- repos.emplace_front(std::move(repo));
- }
- g_free(mirror);
- g_free(blacklist);
- }
- g_free(groups);
-
- g_key_file_free(key_conf);
}
void pk_backend_destroy()
@@ -230,7 +194,6 @@ void pk_backend_get_details(JobData *job_data, char **package_ids)
std::size_t i;
std::regex expr;
std::smatch match_info;
- GError *err = nullptr;
sqlite3_stmt *stmt;
std::string desc;
@@ -368,7 +331,7 @@ out:
void pk_backend_install_packages(JobData *job_data, const std::vector<std::string> package_ids)
{
unsigned i;
- gdouble percent_step;
+ double percent_step;
std::list<std::string> install_list;
sqlite3_stmt *pkglist_stmt = nullptr, *collection_stmt = nullptr;
@@ -478,7 +441,6 @@ void pk_backend_remove_packages(JobData* job_data, const std::vector<std::string
{
unsigned i;
double percent_step;
- GError *err = nullptr;
/* Add percent_step percents per removed package */
percent_step = 100.0 / package_ids.size();
@@ -491,15 +453,7 @@ void pk_backend_remove_packages(JobData* job_data, const std::vector<std::string
std::string cmd_line = "/sbin/removepkg " + tokens[0];
/* Pkgtools return always 0 */
- g_spawn_command_line_sync(cmd_line.c_str(), nullptr, nullptr, nullptr, &err);
-
- if (err)
- {
- std::cerr << err->message << std::endl;
- g_error_free(err);
-
- return;
- }
+ system(cmd_line.c_str());
job_data->set_percentage(100);
}