Compare commits

...

9 Commits

Author SHA1 Message Date
Christian Hesse
e2dbf59246 alpm: ignore new options...
... instead of crashing. Also increase required libalpm version to >=15.0.0.
2024-09-30 15:44:32 +03:00
Christian Hesse
0eae057629 alpm: fix function declaration prototype 2024-09-30 15:44:32 +03:00
Christian Hesse
296c61f689 alpm: fix mixed declarations and code 2024-09-30 15:44:32 +03:00
Christian Hesse
bf9eb9cb56 alpm: drop unused variable 2024-09-30 15:44:32 +03:00
a0e3809a56 Read distro repo branch from /etc and append it to the final vendor url 2024-09-28 21:07:23 +03:00
8e8a05c75d Swap version and arch places when parsing vendor/url string
* For proper pkg link results
2024-09-28 21:07:03 +03:00
59bbfdd279 Add missing comma for vendor string parser 2024-09-28 21:06:45 +03:00
a983354078 Make sure to include version string for vendor 2024-09-28 21:06:28 +03:00
a576c6263a Add support for bottle pkg manager 2024-09-28 21:06:07 +03:00
7 changed files with 64 additions and 37 deletions

View File

@ -0,0 +1,9 @@
[options]
# Use default bottle configuration initially
#
Include = /etc/bottle.conf
# Prevent PackageKit from removing itself
#
HoldPkg = packagekit

View File

@ -1,4 +1,4 @@
alpm_dep = dependency('libalpm', version: '>=14.0.0')
alpm_dep = dependency('libalpm', version: '>=15.0.0')
shared_module(
'pk_backend_alpm',
@ -34,10 +34,10 @@ shared_module(
c_args: [
'-DPK_LOG_PREFIX="PACKAGEKIT"',
'-DG_LOG_DOMAIN="PackageKit-alpm"',
'-DPK_BACKEND_CONFIG_FILE="@0@"'.format(join_paths(get_option('sysconfdir'), 'PackageKit', 'alpm.d', 'pacman.conf')),
'-DPK_BACKEND_CONFIG_FILE="@0@"'.format(join_paths(get_option('sysconfdir'), 'PackageKit', 'alpm.d', 'bottle.conf')),
'-DPK_BACKEND_GROUP_FILE="@0@"'.format(join_paths(get_option('sysconfdir'), 'PackageKit', 'alpm.d', 'groups.list')),
'-DPK_BACKEND_REPO_FILE="@0@"'.format(join_paths(get_option('sysconfdir'), 'PackageKit', 'alpm.d', 'repos.list')),
'-DPK_BACKEND_DEFAULT_PATH="/bin:/usr/bin:/sbin:/usr/sbin"',
'-DPK_BACKEND_DEFAULT_PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"',
],
install: true,
install_dir: pk_plugin_dir,
@ -50,7 +50,7 @@ install_data(
install_data(
'groups.list',
'pacman.conf',
'bottle.conf',
'repos.list',
install_dir: join_paths(get_option('sysconfdir'), 'PackageKit', 'alpm.d')
)

View File

@ -1,12 +0,0 @@
# PackageKit configuration for the alpm backend
# See the pacman.conf(5) manpage for option and repository directives.
[options]
# Use default pacman configuration initially
#
Include = /etc/pacman.conf
# Prevent PackageKit from removing itself
#
HoldPkg = packagekit

View File

@ -605,18 +605,24 @@ pk_alpm_config_parse (PkAlpmConfig *config, const gchar *filename,
continue;
}
if (g_strcmp0 (key, "Usage") == 0 && str != NULL) {
/* Ignore "Usage" key instead of crashing */
/* ignore these instead of crashing */
if (g_strcmp0 (key, "CacheServer") == 0 && str != NULL) {
continue;
}
if (g_strcmp0 (key, "DisableSandbox") == 0) {
continue;
}
if (g_strcmp0 (key, "DownloadUser") == 0 && str != NULL) {
continue;
}
if (g_strcmp0 (key, "ParallelDownloads") == 0 && str != NULL) {
/* Ignore "ParallelDownloads" key instead of crashing */
continue;
}
if (g_strcmp0 (key, "CacheServer") == 0 && str != NULL) {
/* Ignore "CacheServer" key instead of crashing */
if (g_strcmp0 (key, "Usage") == 0 && str != NULL) {
continue;
}
@ -651,7 +657,7 @@ pk_alpm_config_initialize_alpm (PkAlpmConfig *config, GError **error)
if (config->dbpath == NULL) {
config->dbpath = g_strconcat (config->root,
"/var/lib/pacman/" + dir,
"/var/lib/bottle/" + dir,
NULL);
}
@ -676,7 +682,7 @@ pk_alpm_config_initialize_alpm (PkAlpmConfig *config, GError **error)
if (config->gpgdir == NULL) {
config->gpgdir = g_strconcat (config->root,
"/etc/pacman.d/gnupg/" + dir,
"/etc/bottle.d/gnupg/" + dir,
NULL);
}
@ -689,14 +695,14 @@ pk_alpm_config_initialize_alpm (PkAlpmConfig *config, GError **error)
if (config->logfile == NULL) {
config->logfile = g_strconcat (config->root,
"/var/log/pacman.log" + dir,
"/var/log/bottle.log" + dir,
NULL);
}
if (config->is_check) {
g_free(config->logfile);
config->logfile = g_strconcat (config->root,
"/var/log/pacman.PackageKit.log" + dir,
"/var/log/bottle.PackageKit.log" + dir,
NULL);
}
@ -709,7 +715,7 @@ pk_alpm_config_initialize_alpm (PkAlpmConfig *config, GError **error)
if (config->cachedirs == NULL) {
gchar *path = g_strconcat (config->root,
"/var/cache/pacman/pkg/" + dir,
"/var/cache/bottle/pkg/" + dir,
NULL);
config->cachedirs = alpm_list_add (NULL, path);
}

View File

@ -44,6 +44,7 @@ pk_alpm_transaction_sync_targets (PkBackendJob *job, const gchar **packages, gbo
g_auto(GStrv) package = pk_package_id_split (*packages);
gchar *repo = package[PK_PACKAGE_ID_DATA];
gchar *name = package[PK_PACKAGE_ID_NAME];
alpm_pkg_t *dep_to_remove;
const alpm_list_t *i = alpm_get_syncdbs (priv->alpm);
alpm_pkg_t *pkg;
@ -61,7 +62,7 @@ pk_alpm_transaction_sync_targets (PkBackendJob *job, const gchar **packages, gbo
}
pkg = alpm_db_get_pkg (i->data, name);
alpm_pkg_t *dep_to_remove = pk_alpm_pkg_replaces(priv->localdb, pkg);
dep_to_remove = pk_alpm_pkg_replaces(priv->localdb, pkg);
if (dep_to_remove) {
g_debug("scheduling to remove %s for %s", alpm_pkg_get_name(dep_to_remove), name);
alpm_remove_pkg(priv->alpm, dep_to_remove);

View File

@ -361,7 +361,7 @@ pk_alpm_transaction_conv_cb (void *ctx, alpm_question_t *question)
}
static void
pk_alpm_transaction_output_end ()
pk_alpm_transaction_output_end (void)
{
tpkg = NULL;

View File

@ -71,10 +71,32 @@ static gchar **
pk_alpm_pkg_build_urls (alpm_pkg_t *pkg)
{
gchar **urls = g_new0 (gchar *, 2);
urls[0] = g_strdup_printf ("https://archlinux.org/packages/%s/%s/%s/",
alpm_db_get_name (alpm_pkg_get_db (pkg)),
alpm_pkg_get_arch (pkg),
alpm_pkg_get_name (pkg));
// Get the distro branch ( check if evolinx or -staging by reading /etc/os-branch )
char distro[15];
FILE* gdistro;
gdistro = fopen("/etc/os-branch", "r");
if (NULL == gdistro) {
// Print to systemctl status
printf("\n####\n");
printf("# EVOLINX: Please update youre base-(system,chroot,minimal) for new filesystem additions\n");
printf("####\n");
exit(1);
}
urls[0] = g_strdup_printf ("https://files.martinvlba.eu/%s/%s/packages/%s-%s-%s.pkg.tar.gz",
fgets(distro, 15, gdistro),
alpm_db_get_name (alpm_pkg_get_db (pkg)),
alpm_pkg_get_name (pkg),
alpm_pkg_get_version (pkg),
alpm_pkg_get_arch (pkg));
fclose(gdistro);
return urls;
}
@ -285,6 +307,7 @@ pk_alpm_update_databases (PkBackendJob *job, gint force, GError **error)
PkBackend *backend = pk_backend_job_get_backend (job);
PkBackendAlpmPrivate *priv = pk_backend_get_user_data (backend);
alpm_list_t *i;
int ret;
if (!pk_alpm_transaction_initialize (job, 0, NULL, error))
return FALSE;
@ -293,7 +316,7 @@ pk_alpm_update_databases (PkBackendJob *job, gint force, GError **error)
pk_backend_job_set_status (job, PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST);
i = alpm_get_syncdbs (priv->alpm);
int ret = pk_alpm_refresh_databases(job, force, i, error);
ret = pk_alpm_refresh_databases(job, force, i, error);
if (i == NULL)
return pk_alpm_transaction_end (job, error);
@ -355,9 +378,10 @@ static int dep_vercmp(const char *version1, alpm_depmod_t mod,
alpm_pkg_t *
pk_alpm_pkg_replaces (alpm_db_t *db, alpm_pkg_t *pkg)
{
gboolean ret = FALSE;
g_return_val_if_fail (db != NULL, FALSE);
g_return_val_if_fail (pkg != NULL, FALSE);
gboolean ret = FALSE;
for (alpm_list_t *list = alpm_pkg_get_replaces (pkg); list != NULL && !ret; list = list->next) {
alpm_depend_t *depend = list->data;
@ -373,7 +397,6 @@ static alpm_pkg_t *
pk_alpm_pkg_find_update (alpm_pkg_t *pkg, const alpm_list_t *dbs)
{
const gchar *name;
const alpm_list_t *i;
g_return_val_if_fail (pkg != NULL, NULL);
@ -399,13 +422,13 @@ pk_alpm_update_is_pkg_downloaded (alpm_pkg_t *pkg)
{
g_autofree gchar *filename = NULL;
filename = g_strconcat ("/var/cache/pacman/pkg/",
filename = g_strconcat ("/var/cache/bottle/pkg/",
alpm_pkg_get_name (pkg),
"-",
alpm_pkg_get_version (pkg),
"-",
alpm_pkg_get_arch (pkg),
".pkg.tar.xz",
".pkg.tar.gz",
NULL);
return g_file_test (filename, G_FILE_TEST_IS_REGULAR);
}