reuse more code

This commit is contained in:
Chris Cromer 2017-10-26 13:45:40 -03:00
parent ebdad3636f
commit 4ba5978027
29 changed files with 267 additions and 786 deletions

View File

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
<policyconfig>
<vendor>Pamac</vendor>
<vendor_url>https://github.com/cromnix/pamac-classic/</vendor_url>
<icon_name>package-x-generic</icon_name>
<action id="org.pamac.commit">
<message>Authentication is required</message>
<message xml:lang="ar">صلاحيات مطلوبة</message>
<message xml:lang="ast">Ríquese l'autenticación</message>
<message xml:lang="az-AZ">Kimlik tələb olunur</message>
<message xml:lang="bg">Изисква се идентификация</message>
<message xml:lang="ca">Cal autenticació</message>
<message xml:lang="ca-ES">Cal autenticació</message>
<message xml:lang="cs">Je vyžadováno ověření</message>
<message xml:lang="da">Godkendelse er påkrævet</message>
<message xml:lang="de">Authentifizierung erforderlich</message>
<message xml:lang="el">Απαιτείται πιστοποίηση</message>
<message xml:lang="el-GR">Απαιτείται πιστοποίηση</message>
<message xml:lang="es">Se necesita autenticación</message>
<message xml:lang="es-419">Se requiere autenticación</message>
<message xml:lang="es-MX">Se requiere autenticación</message>
<message xml:lang="eu">Autentifikazioa behar da</message>
<message xml:lang="fa-IR">تائید هویت شکست خورد</message>
<message xml:lang="fr">Authentification nécessaire</message>
<message xml:lang="gl">A autenticación é necesaria</message>
<message xml:lang="he">נדרש אישור</message>
<message xml:lang="hi">प्रमाणीकरण की आवश्यकता है</message>
<message xml:lang="hr">Potrebna je autorizacija</message>
<message xml:lang="hu">Hitelesítés szükséges</message>
<message xml:lang="id">Membutuhkan Otentifikasi</message>
<message xml:lang="is">Auðkenningar er krafist</message>
<message xml:lang="it">Autenticazione richiesta</message>
<message xml:lang="ja">認証が必要です</message>
<message xml:lang="ko">인증이 필요합니다</message>
<message xml:lang="lt">Reikalingas tapatybės nustatymas</message>
<message xml:lang="nb">Autentisering kreves</message>
<message xml:lang="nl">Verificatie vereist</message>
<message xml:lang="nl-NL">Authenticatie vereist</message>
<message xml:lang="pl">Wymagane jest uwierzytelnienie</message>
<message xml:lang="pt">Autenticação necessária</message>
<message xml:lang="pt-BR">Autenticação necessária</message>
<message xml:lang="pt-PT">Autenticação necessária</message>
<message xml:lang="ru">Запрошена авторизация</message>
<message xml:lang="sk">Vyžaduje sa overenie totožnosti</message>
<message xml:lang="sl">Zahtevana je overitev</message>
<message xml:lang="sr-Latn">Autentifikacija je neophodna</message>
<message xml:lang="sv">Autentisering krävs</message>
<message xml:lang="tr">Kimlik doğrulaması gerekli</message>
<message xml:lang="uk">Потрібна авторизація</message>
<message xml:lang="zh-CN">需要验证</message>
<message xml:lang="zh-TW">需要授權</message>
<defaults>
<allow_any>no</allow_any>
<allow_inactive>auth_admin_keep</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
</action>
</policyconfig>

View File

@ -29,7 +29,7 @@ define: KDE_TRAY
vapidir: src/vapis
vala_binary: src/pamac-clean-cache/pamac-clean-cache
version: 6.3.1
version: 6.3.3
vala_local_package: Pamac
vala_package: posix
vala_check_package: gtk+-3.0
@ -40,7 +40,7 @@ vala_check_package: gtk+-3.0
*vala_source: pamac_config.vala
vala_binary: src/pamac-install/pamac-install
version: 6.3.1
version: 6.3.3
use_gresource: pamac_installer_gresource_xml
vala_local_package: Pamac
vala_check_package: gtk+-3.0
@ -51,7 +51,7 @@ vala_check_package: gtk+-3.0
*vala_source: progress_dialog.vala
vala_binary: src/pamac-manager/pamac-manager
version: 6.3.1
version: 6.3.3
alias: pamac-updater
use_gresource: pamac_manager_gresource_xml
vala_local_package: Pamac
@ -64,7 +64,7 @@ vala_check_package: gtk+-3.0
*vala_source: manager_window.vala
vala_binary: src/pamac-system-daemon/pamac-system-daemon
version: 6.3.1
version: 6.3.3
vala_local_package: Pamac
if NOT DISABLE_AUR
vala_local_package: AUR
@ -85,13 +85,14 @@ vala_check_package: polkit-gobject-1
*vala_source: system_daemon.vala
vala_binary: src/pamac-tray/pamac-tray
version: 6.3.1
version: 6.3.3
vala_local_package: Pamac
if NOT DISABLE_AUR
vala_local_package: AUR
end
vala_package: posix
vala_check_package: json-glib-1.0
vala_check_package: libalpm
vala_check_package: libnotify
if KDE_TRAY
vala_check_package: appindicator3-0.1
@ -106,12 +107,12 @@ vala_source: tray-appindicator.vala
else
vala_source: tray-gtk.vala
end
*vala_source: alpm_config.vala
*vala_source: pamac_config.vala
*vala_source: tray.vala
*vala_source: user_daemon.vala
vala_binary: src/pamac-user-daemon/pamac-user-daemon
version: 6.3.1
version: 6.3.3
vala_local_package: Pamac
if NOT DISABLE_AUR
vala_local_package: AUR
@ -129,7 +130,7 @@ vala_check_package: libsoup-2.4
vala_library: src/pamac
version: 6.3.1
version: 6.3.3
*namespace: Pamac
use_gresource: pamac_transaction_gresource_xml
vala_package: posix
@ -155,7 +156,7 @@ vala_check_package: vte-2.91
*vala_source: transaction_sum_dialog.vala
vala_library: src/aur/aur
version: 6.3.1
version: 6.3.3
*namespace: AUR
vala_check_package: json-glib-1.0
vala_check_package: libsoup-2.4
@ -191,9 +192,9 @@ vala_check_package: libsoup-2.4
*translate: vala src/pamac-system-daemon/mirrors_config.vala
*translate: vala src/pamac-system-daemon/pamac_config.vala
*translate: vala src/pamac-system-daemon/system_daemon.vala
*translate: vala src/pamac-tray/alpm_config.vala
*translate: vala src/pamac-tray/pamac_config.vala
*translate: vala src/pamac-tray/tray.vala
*translate: vala src/pamac-tray/user_daemon.vala
*translate: vala src/pamac-user-daemon/alpm_config.vala
*translate: vala src/pamac-user-daemon/user_daemon.vala
*translate: vala src/pamac_config.vala

View File

@ -11,9 +11,9 @@ src/pamac-system-daemon/pamac_config.vala
src/pamac-system-daemon/system_daemon.vala
src/pamac-tray/tray-appindicator.vala
src/pamac-tray/tray-gtk.vala
src/pamac-tray/alpm_config.vala
src/pamac-tray/pamac_config.vala
src/pamac-tray/tray.vala
src/pamac-tray/user_daemon.vala
src/pamac-user-daemon/alpm_config.vala
src/pamac-user-daemon/user_daemon.vala
src/alpm_config.vala

View File

@ -7,7 +7,7 @@ set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.3.1")
set (VERSION "6.3.3")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
@ -15,7 +15,7 @@ configure_file (${CMAKE_SOURCE_DIR}/src/Config.vala.base ${CMAKE_BINARY_DIR}/src
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Pamac.pc ${CMAKE_CURRENT_BINARY_DIR}/Pamac.pc)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Pamac.deps ${CMAKE_CURRENT_BINARY_DIR}/Pamac.deps)
set (VERSION "6.3.1")
set (VERSION "6.3.3")
add_definitions (${DEPS_CFLAGS})
link_libraries ( ${DEPS_LIBRARIES} )
link_directories ( ${DEPS_LIBRARY_DIRS} )
@ -86,7 +86,7 @@ add_dependencies( Pamac ${Pamac_DEPENDENCIES} )
target_link_libraries( Pamac m )
set_target_properties( Pamac PROPERTIES
VERSION
6.3.1
6.3.3
SOVERSION
6 )

View File

@ -6,7 +6,7 @@ includedir=@DOLLAR@{exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}
Name: Pamac
Description: Pamac
Version: 6.3.1
Version: 6.3.3
Libs: -L@DOLLAR@{libdir} -lPamac
Cflags: -I@DOLLAR@{includedir}
Requires: gdk-3.0 gtk+-3.0 libalpm libnotify vte-2.91 gio-2.0 glib-2.0 gobject-2.0

View File

@ -74,6 +74,14 @@ class AlpmConfig {
reload ();
}
public unowned GLib.List<string> get_holdpkgs () {
return holdpkgs;
}
public unowned GLib.List<string> get_syncfirsts () {
return syncfirsts;
}
public void reload () {
// set default options
cachedirs = new GLib.List<string> ();
@ -127,6 +135,85 @@ class AlpmConfig {
}
}
public Alpm.Handle? get_handle (bool files_db = false, bool tmp_db = false) {
Alpm.Errno error = 0;
Alpm.Handle? handle = null;
if (tmp_db) {
string tmp_dbpath = "/tmp/pamac-checkdbs";
try {
Process.spawn_command_line_sync ("mkdir -p %s/sync".printf (tmp_dbpath));
Process.spawn_command_line_sync ("ln -sf %s/local %s".printf (dbpath, tmp_dbpath));
Process.spawn_command_line_sync ("chmod -R 777 %s/sync".printf (tmp_dbpath));
handle = new Alpm.Handle (rootdir, tmp_dbpath, out error);
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
} else {
handle = new Alpm.Handle (rootdir, dbpath, out error);
}
if (error == Alpm.Errno.DB_VERSION) {
try {
Process.spawn_command_line_sync ("pacman-db-upgrade", null, null, null);
} catch (SpawnError e) {
stdout.printf ("Error: %s\n", e.message);
}
handle = new Alpm.Handle (rootdir, dbpath, out error);
}
if (handle == null) {
stderr.printf ("Failed to initialize alpm library" + " (%s)\n".printf (Alpm.strerror (error)));
return null;
}
// define options
if (files_db) {
handle.dbext = ".files";
}
if (!tmp_db) {
handle.logfile = logfile;
}
handle.gpgdir = gpgdir;
handle.arch = arch;
handle.deltaratio = deltaratio;
handle.usesyslog = usesyslog;
handle.checkspace = checkspace;
handle.defaultsiglevel = siglevel;
localfilesiglevel = merge_siglevel (siglevel, localfilesiglevel, localfilesiglevel_mask);
remotefilesiglevel = merge_siglevel (siglevel, remotefilesiglevel, remotefilesiglevel_mask);
handle.localfilesiglevel = localfilesiglevel;
handle.remotefilesiglevel = remotefilesiglevel;
foreach (unowned string cachedir in cachedirs) {
handle.add_cachedir (cachedir);
}
foreach (unowned string hookdir in hookdirs) {
handle.add_hookdir (hookdir);
}
foreach (unowned string ignoregroup in ignoregroups) {
handle.add_ignoregroup (ignoregroup);
}
foreach (unowned string ignorepkg in ignorepkgs) {
handle.add_ignorepkg (ignorepkg);
}
foreach (unowned string noextract in noextracts) {
handle.add_noextract (noextract);
}
foreach (unowned string noupgrade in noupgrades) {
handle.add_noupgrade (noupgrade);
}
// register dbs
foreach (unowned AlpmRepo repo in repo_order) {
repo.siglevel = merge_siglevel (siglevel, repo.siglevel, repo.siglevel_mask);
unowned Alpm.DB db = handle.register_syncdb (repo.name, repo.siglevel);
foreach (unowned string url in repo.urls) {
db.add_server (url.replace ("$repo", repo.name).replace ("$arch", handle.arch));
}
if (repo.usage == 0) {
db.usage = Alpm.DB.Usage.ALL;
} else {
db.usage = repo.usage;
}
}
return handle;
}
void parse_file (string path, string? section = null) {
string? current_section = section;
var file = GLib.File.new_for_path (path);
@ -250,6 +337,66 @@ class AlpmConfig {
}
}
public void write (HashTable<string,Variant> new_conf) {
var file = GLib.File.new_for_path (conf_path);
if (file.query_exists ()) {
try {
// Open file for reading and wrap returned FileInputStream into a
// DataInputStream, so we can read line by line
var dis = new DataInputStream (file.read ());
string? line;
string[] data = {};
// Read lines until end of file (null) is reached
while ((line = dis.read_line ()) != null) {
if (line.length == 0) {
data += "\n";
continue;
}
if (line.contains ("IgnorePkg")) {
if (new_conf.contains ("IgnorePkg")) {
string val = new_conf.get ("IgnorePkg").get_string ();
if (val == "") {
data += "#IgnorePkg =\n";
} else {
data += "IgnorePkg = %s\n".printf (val);
}
new_conf.remove ("IgnorePkg");
} else {
data += line + "\n";
}
} else if (line.contains ("CheckSpace")) {
if (new_conf.contains ("CheckSpace")) {
bool val = new_conf.get ("CheckSpace").get_boolean ();
if (val) {
data += "CheckSpace\n";
} else {
data += "#CheckSpace\n";
}
new_conf.remove ("CheckSpace");
} else {
data += line + "\n";
}
} else {
data += line + "\n";
}
}
// delete the file before rewrite it
file.delete ();
// creating a DataOutputStream to the file
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
foreach (unowned string new_line in data) {
// writing a short string to the stream
dos.put_string (new_line);
}
reload ();
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", conf_path);
}
}
Alpm.DB.Usage define_usage (string conf_string) {
Alpm.DB.Usage usage = 0;
foreach (unowned string directive in conf_string.split(" ")) {
@ -335,4 +482,8 @@ class AlpmConfig {
}
siglevel &= ~Alpm.Signature.Level.USE_DEFAULT;
}
Alpm.Signature.Level merge_siglevel(Alpm.Signature.Level sigbase, Alpm.Signature.Level sigover, Alpm.Signature.Level sigmask) {
return (sigmask != 0) ? (sigover & sigmask) | (sigbase & ~sigmask) : sigover;
}
}

View File

@ -6,7 +6,7 @@ includedir=@DOLLAR@{exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}
Name: AUR
Description: AUR
Version: 6.3.1
Version: 6.3.3
Libs: -L@DOLLAR@{libdir} -lAUR
Cflags: -I@DOLLAR@{includedir}
Requires: json-glib-1.0 libsoup-2.4 glib-2.0

View File

@ -7,7 +7,7 @@ set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.3.1")
set (VERSION "6.3.3")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
@ -15,7 +15,7 @@ configure_file (${CMAKE_SOURCE_DIR}/src/aur/Config.vala.base ${CMAKE_BINARY_DIR}
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/AUR.pc ${CMAKE_CURRENT_BINARY_DIR}/AUR.pc)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/AUR.deps ${CMAKE_CURRENT_BINARY_DIR}/AUR.deps)
set (VERSION "6.3.1")
set (VERSION "6.3.3")
add_definitions (${DEPS_CFLAGS})
link_libraries ( ${DEPS_LIBRARIES} )
link_directories ( ${DEPS_LIBRARY_DIRS} )
@ -65,7 +65,7 @@ add_library(AUR SHARED ${VALA_C})
set_target_properties( AUR PROPERTIES
VERSION
6.3.1
6.3.3
SOVERSION
6 )

View File

@ -4,7 +4,7 @@ cfg_aur.set('PKGDATADIR', join_paths(get_option('prefix'),get_option('datadir'),
cfg_aur.set('GETTEXT_PACKAGE', 'pamac')
cfg_aur.set('RELEASE_NAME', 'pamac')
cfg_aur.set('PREFIX', get_option('prefix'))
cfg_aur.set('VERSION', '6.3.1')
cfg_aur.set('VERSION', '6.3.3')
cfg_aur.set('TESTSRCDIR', meson.source_root())
cfgfile_2 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_aur)
@ -27,7 +27,7 @@ endif
aur_vala_args += ['--gir=AUR-6.0.gir']
AUR_library = shared_library('AUR',aur_sources,dependencies: aur_deps,vala_args: aur_vala_args,c_args: aur_c_args,version: '6.3.1',soversion: '6',install: true)
AUR_library = shared_library('AUR',aur_sources,dependencies: aur_deps,vala_args: aur_vala_args,c_args: aur_c_args,version: '6.3.3',soversion: '6',install: true)
aur_requires = []
aur_requires += ['json-glib-1.0']
@ -35,7 +35,7 @@ aur_requires += ['libsoup-2.4']
aur_requires += ['glib-2.0']
pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries : AUR_library,
version : '6.3.1',
version : '6.3.3',
name : 'AUR',
filebase : 'AUR',
description : 'AUR',

View File

@ -4,7 +4,7 @@ cfg_pamac.set('PKGDATADIR', join_paths(get_option('prefix'),get_option('datadir'
cfg_pamac.set('GETTEXT_PACKAGE', 'pamac')
cfg_pamac.set('RELEASE_NAME', 'pamac')
cfg_pamac.set('PREFIX', get_option('prefix'))
cfg_pamac.set('VERSION', '6.3.1')
cfg_pamac.set('VERSION', '6.3.3')
cfg_pamac.set('TESTSRCDIR', meson.source_root())
cfgfile_1 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac)
@ -46,7 +46,7 @@ pamac_deps += [meson.get_compiler('c').find_library('m', required : false)]
pamac_vala_args += ['--gir=Pamac-6.0.gir']
Pamac_library = shared_library('Pamac',pamac_sources,dependencies: pamac_deps,vala_args: pamac_vala_args,c_args: pamac_c_args,version: '6.3.1',soversion: '6',install: true)
Pamac_library = shared_library('Pamac',pamac_sources,dependencies: pamac_deps,vala_args: pamac_vala_args,c_args: pamac_c_args,version: '6.3.3',soversion: '6',install: true)
pamac_requires = []
pamac_requires += ['gdk-3.0']
@ -59,7 +59,7 @@ pamac_requires += ['glib-2.0']
pamac_requires += ['gobject-2.0']
pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries : Pamac_library,
version : '6.3.1',
version : '6.3.3',
name : 'Pamac',
filebase : 'Pamac',
description : 'Pamac',

View File

@ -75,5 +75,57 @@ namespace Pamac {
GLib.stderr.printf ("File '%s' doesn't exist.\n", path);
}
}
public void write (HashTable<string,Variant> new_conf) {
var file = GLib.File.new_for_path (conf_path);
if (file.query_exists ()) {
try {
// Open file for reading and wrap returned FileInputStream into a
// DataInputStream, so we can read line by line
var dis = new DataInputStream (file.read ());
string? line;
var data = new GLib.List<string> ();
// Read lines until end of file (null) is reached
while ((line = dis.read_line ()) != null) {
if (line.length == 0) {
data.append ("\n");
continue;
}
unowned Variant variant;
if (line.contains ("Method")) {
if (new_conf.lookup_extended ("Method", null, out variant)) {
data.append ("Method = %s\n".printf (variant.get_string ()));
} else {
data.append (line + "\n");
}
} else if (line.contains ("OnlyCountry")) {
if (new_conf.lookup_extended ("OnlyCountry", null, out variant)) {
if (variant.get_string () == "ALL") {
data.append ("#%s\n".printf (line));
} else {
data.append ("OnlyCountry = %s\n".printf (variant.get_string ()));
}
} else {
data.append (line + "\n");
}
} else {
data.append (line + "\n");
}
}
// delete the file before rewrite it
file.delete ();
// creating a DataOutputStream to the file
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
foreach (unowned string new_line in data) {
// writing a short string to the stream
dos.put_string (new_line);
}
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", file.get_path ());
}
}
}
}

View File

@ -7,13 +7,13 @@ set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.3.1")
set (VERSION "6.3.3")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
configure_file (${CMAKE_SOURCE_DIR}/src/pamac-clean-cache/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-clean-cache/Config.vala)
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
set (VERSION "6.3.1")
set (VERSION "6.3.3")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src )
link_libraries ( ${DEPS_LIBRARIES} -lPamac )

View File

@ -4,7 +4,7 @@ cfg_pamac_clean_cache.set('PKGDATADIR', join_paths(get_option('prefix'),get_opti
cfg_pamac_clean_cache.set('GETTEXT_PACKAGE', 'pamac')
cfg_pamac_clean_cache.set('RELEASE_NAME', 'pamac')
cfg_pamac_clean_cache.set('PREFIX', get_option('prefix'))
cfg_pamac_clean_cache.set('VERSION', '6.3.1')
cfg_pamac_clean_cache.set('VERSION', '6.3.3')
cfg_pamac_clean_cache.set('TESTSRCDIR', meson.source_root())
cfgfile_5 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_clean_cache)

View File

@ -7,13 +7,13 @@ set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.3.1")
set (VERSION "6.3.3")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
configure_file (${CMAKE_SOURCE_DIR}/src/pamac-install/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-install/Config.vala)
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
set (VERSION "6.3.1")
set (VERSION "6.3.3")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src )
link_libraries ( ${DEPS_LIBRARIES} -lPamac )

View File

@ -4,7 +4,7 @@ cfg_pamac_install.set('PKGDATADIR', join_paths(get_option('prefix'),get_option('
cfg_pamac_install.set('GETTEXT_PACKAGE', 'pamac')
cfg_pamac_install.set('RELEASE_NAME', 'pamac')
cfg_pamac_install.set('PREFIX', get_option('prefix'))
cfg_pamac_install.set('VERSION', '6.3.1')
cfg_pamac_install.set('VERSION', '6.3.3')
cfg_pamac_install.set('TESTSRCDIR', meson.source_root())
cfgfile_6 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_install)

View File

@ -7,13 +7,13 @@ set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.3.1")
set (VERSION "6.3.3")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
configure_file (${CMAKE_SOURCE_DIR}/src/pamac-manager/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-manager/Config.vala)
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
set (VERSION "6.3.1")
set (VERSION "6.3.3")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src )
link_libraries ( ${DEPS_LIBRARIES} -lPamac )

View File

@ -4,7 +4,7 @@ cfg_pamac_manager.set('PKGDATADIR', join_paths(get_option('prefix'),get_option('
cfg_pamac_manager.set('GETTEXT_PACKAGE', 'pamac')
cfg_pamac_manager.set('RELEASE_NAME', 'pamac')
cfg_pamac_manager.set('PREFIX', get_option('prefix'))
cfg_pamac_manager.set('VERSION', '6.3.1')
cfg_pamac_manager.set('VERSION', '6.3.3')
cfg_pamac_manager.set('TESTSRCDIR', meson.source_root())
cfgfile_7 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_manager)

View File

@ -7,13 +7,13 @@ set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.3.1")
set (VERSION "6.3.3")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
configure_file (${CMAKE_SOURCE_DIR}/src/pamac-system-daemon/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-system-daemon/Config.vala)
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
set (VERSION "6.3.1")
set (VERSION "6.3.3")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/aur )
link_libraries ( ${DEPS_LIBRARIES} -lPamac -lAUR )

View File

@ -1,489 +0,0 @@
/*
* alpm_config
*
* Copyright (C) 2017 Chris Cromer <cromer@cromnix.org>
* Copyright (C) 2014-2017 Guillaume Benoit <guillaume@manjaro.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a get of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
[Compact]
class AlpmRepo {
public string name;
public Alpm.Signature.Level siglevel;
public Alpm.Signature.Level siglevel_mask;
public Alpm.DB.Usage usage;
public GLib.List<string> urls;
public AlpmRepo (string name) {
this.name = name;
siglevel = Alpm.Signature.Level.USE_DEFAULT;
usage = 0;
urls = new GLib.List<string> ();
}
public static int compare_name (AlpmRepo a, AlpmRepo b) {
return strcmp (a.name, b.name);
}
public static int search_name (AlpmRepo a, string name) {
return strcmp (a.name, name);
}
}
class AlpmConfig {
string conf_path;
string? rootdir;
string? dbpath;
string? logfile;
string? gpgdir;
string? arch;
double deltaratio;
int usesyslog;
public int checkspace;
GLib.List<string> cachedirs;
GLib.List<string> hookdirs;
GLib.List<string> ignoregroups;
GLib.List<string> ignorepkgs;
GLib.List<string> noextracts;
GLib.List<string> noupgrades;
GLib.List<string> holdpkgs;
GLib.List<string> syncfirsts;
Alpm.Signature.Level siglevel;
Alpm.Signature.Level localfilesiglevel;
Alpm.Signature.Level remotefilesiglevel;
Alpm.Signature.Level siglevel_mask;
Alpm.Signature.Level localfilesiglevel_mask;
Alpm.Signature.Level remotefilesiglevel_mask;
GLib.List<AlpmRepo> repo_order;
public AlpmConfig (string path) {
conf_path = path;
reload ();
}
public unowned GLib.List<string> get_holdpkgs () {
return holdpkgs;
}
public unowned GLib.List<string> get_syncfirsts () {
return syncfirsts;
}
public void reload () {
// set default options
cachedirs = new GLib.List<string> ();
hookdirs = new GLib.List<string> ();
ignoregroups = new GLib.List<string> ();
ignorepkgs = new GLib.List<string> ();
noextracts = new GLib.List<string> ();
noupgrades = new GLib.List<string> ();
holdpkgs = new GLib.List<string> ();
syncfirsts = new GLib.List<string> ();
usesyslog = 0;
checkspace = 0;
deltaratio = 0.7;
siglevel = Alpm.Signature.Level.PACKAGE | Alpm.Signature.Level.PACKAGE_OPTIONAL | Alpm.Signature.Level.DATABASE | Alpm.Signature.Level.DATABASE_OPTIONAL;
localfilesiglevel = Alpm.Signature.Level.USE_DEFAULT;
remotefilesiglevel = Alpm.Signature.Level.USE_DEFAULT;
repo_order = new GLib.List<AlpmRepo> ();
// parse conf file
parse_file (conf_path);
// if rootdir is set and dbpath/logfile are not
// set, then set those as well to reside under the root.
if (rootdir != null) {
if (dbpath == null) {
dbpath = Path.build_path ("/", rootdir, "var/lib/pacman/");
}
if (logfile == null) {
logfile = Path.build_path ("/", rootdir, "var/log/pacman.log");
}
} else {
rootdir = "/";
if (dbpath == null) {
dbpath = "/var/lib/pacman/";
}
if (logfile == null) {
logfile = "/var/log/pacman.log";
}
}
if (cachedirs.length () == 0) {
cachedirs.append ("/var/cache/pacman/pkg/");
}
if (hookdirs.length () == 0) {
hookdirs.append ("/etc/pacman.d/hooks/");
}
if (gpgdir == null) {
// gpgdir it is not relative to rootdir, even if
// rootdir is defined because it contains configuration data.
gpgdir = "/etc/pacman.d/gnupg/";
}
if (arch == null) {
arch = Posix.utsname().machine;
}
}
public Alpm.Handle? get_handle (bool files_db = false, bool tmp_db = false) {
Alpm.Errno error = 0;
Alpm.Handle? handle = null;
if (tmp_db) {
string tmp_dbpath = "/tmp/pamac-checkdbs";
try {
Process.spawn_command_line_sync ("mkdir -p %s/sync".printf (tmp_dbpath));
Process.spawn_command_line_sync ("ln -sf %s/local %s".printf (dbpath, tmp_dbpath));
Process.spawn_command_line_sync ("chmod -R 777 %s/sync".printf (tmp_dbpath));
handle = new Alpm.Handle (rootdir, tmp_dbpath, out error);
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
} else {
handle = new Alpm.Handle (rootdir, dbpath, out error);
}
if (error == Alpm.Errno.DB_VERSION) {
try {
Process.spawn_command_line_sync ("pacman-db-upgrade", null, null, null);
} catch (SpawnError e) {
stdout.printf ("Error: %s\n", e.message);
}
handle = new Alpm.Handle (rootdir, dbpath, out error);
}
if (handle == null) {
stderr.printf ("Failed to initialize alpm library" + " (%s)\n".printf (Alpm.strerror (error)));
return null;
}
// define options
if (files_db) {
handle.dbext = ".files";
}
if (!tmp_db) {
handle.logfile = logfile;
}
handle.gpgdir = gpgdir;
handle.arch = arch;
handle.deltaratio = deltaratio;
handle.usesyslog = usesyslog;
handle.checkspace = checkspace;
handle.defaultsiglevel = siglevel;
localfilesiglevel = merge_siglevel (siglevel, localfilesiglevel, localfilesiglevel_mask);
remotefilesiglevel = merge_siglevel (siglevel, remotefilesiglevel, remotefilesiglevel_mask);
handle.localfilesiglevel = localfilesiglevel;
handle.remotefilesiglevel = remotefilesiglevel;
foreach (unowned string cachedir in cachedirs) {
handle.add_cachedir (cachedir);
}
foreach (unowned string hookdir in hookdirs) {
handle.add_hookdir (hookdir);
}
foreach (unowned string ignoregroup in ignoregroups) {
handle.add_ignoregroup (ignoregroup);
}
foreach (unowned string ignorepkg in ignorepkgs) {
handle.add_ignorepkg (ignorepkg);
}
foreach (unowned string noextract in noextracts) {
handle.add_noextract (noextract);
}
foreach (unowned string noupgrade in noupgrades) {
handle.add_noupgrade (noupgrade);
}
// register dbs
foreach (unowned AlpmRepo repo in repo_order) {
repo.siglevel = merge_siglevel (siglevel, repo.siglevel, repo.siglevel_mask);
unowned Alpm.DB db = handle.register_syncdb (repo.name, repo.siglevel);
foreach (unowned string url in repo.urls) {
db.add_server (url.replace ("$repo", repo.name).replace ("$arch", handle.arch));
}
if (repo.usage == 0) {
db.usage = Alpm.DB.Usage.ALL;
} else {
db.usage = repo.usage;
}
}
return handle;
}
void parse_file (string path, string? section = null) {
string? current_section = section;
var file = GLib.File.new_for_path (path);
if (file.query_exists ()) {
try {
// Open file for reading and wrap returned FileInputStream into a
// DataInputStream, so we can read line by line
var dis = new DataInputStream (file.read ());
string? line;
// Read lines until end of file (null) is reached
while ((line = dis.read_line ()) != null) {
if (line.length == 0) {
continue;
}
// ignore whole line and end of line comments
string[] splitted = line.split ("#", 2);
line = splitted[0].strip ();
if (line.length == 0) {
continue;
}
if (line[0] == '[' && line[line.length-1] == ']') {
current_section = line[1:-1];
if (current_section != "options") {
var repo = new AlpmRepo (current_section);
if (repo_order.find_custom (repo, AlpmRepo.compare_name) == null) {
repo_order.append ((owned) repo);
}
}
continue;
}
splitted = line.split ("=", 2);
unowned string key = splitted[0]._strip ();
unowned string? val = null;
if (splitted.length == 2) {
val = splitted[1]._strip ();
}
if (key == "Include") {
parse_file (val, current_section);
}
if (current_section == "options") {
if (key == "RootDir") {
rootdir = val;
} else if (key == "DBPath") {
dbpath = val;
} else if (key == "CacheDir") {
foreach (unowned string dir in val.split (" ")) {
cachedirs.append (dir);
}
} else if (key == "HookDir") {
foreach (unowned string dir in val.split (" ")) {
hookdirs.append (dir);
}
} else if (key == "LogFile") {
logfile = val;
} else if (key == "GPGDir") {
gpgdir = val;
} else if (key == "LogFile") {
logfile = val;
} else if (key == "Architecture") {
if (val == "auto") {
arch = Posix.utsname ().machine;
} else {
arch = val;
}
} else if (key == "UseDelta") {
deltaratio = double.parse (val);
} else if (key == "UseSysLog") {
usesyslog = 1;
} else if (key == "CheckSpace") {
checkspace = 1;
} else if (key == "SigLevel") {
process_siglevel (val, ref siglevel, ref siglevel_mask);
} else if (key == "LocalFileSigLevel") {
process_siglevel (val, ref localfilesiglevel, ref localfilesiglevel_mask);
} else if (key == "RemoteFileSigLevel") {
process_siglevel (val, ref remotefilesiglevel, ref remotefilesiglevel_mask);
} else if (key == "HoldPkg") {
foreach (unowned string name in val.split (" ")) {
holdpkgs.append (name);
}
} else if (key == "SyncFirst") {
foreach (unowned string name in val.split (" ")) {
syncfirsts.append (name);
}
} else if (key == "IgnoreGroup") {
foreach (unowned string name in val.split (" ")) {
ignoregroups.append (name);
}
} else if (key == "IgnorePkg") {
foreach (unowned string name in val.split (" ")) {
ignorepkgs.append (name);
}
} else if (key == "Noextract") {
foreach (unowned string name in val.split (" ")) {
noextracts.append (name);
}
} else if (key == "NoUpgrade") {
foreach (unowned string name in val.split (" ")) {
noupgrades.append (name);
}
}
} else {
unowned GLib.List<AlpmRepo>? found = repo_order.search (current_section, (SearchFunc) AlpmRepo.search_name);
if (found != null) {
unowned AlpmRepo repo = found.data;
if (key == "Server") {
repo.urls.append (val);
} else if (key == "SigLevel") {
process_siglevel (val, ref repo.siglevel, ref repo.siglevel_mask);
} else if (key == "Usage") {
repo.usage = define_usage (val);
}
}
}
}
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", path);
}
}
public void write (HashTable<string,Variant> new_conf) {
var file = GLib.File.new_for_path (conf_path);
if (file.query_exists ()) {
try {
// Open file for reading and wrap returned FileInputStream into a
// DataInputStream, so we can read line by line
var dis = new DataInputStream (file.read ());
string? line;
string[] data = {};
// Read lines until end of file (null) is reached
while ((line = dis.read_line ()) != null) {
if (line.length == 0) {
data += "\n";
continue;
}
if (line.contains ("IgnorePkg")) {
if (new_conf.contains ("IgnorePkg")) {
string val = new_conf.get ("IgnorePkg").get_string ();
if (val == "") {
data += "#IgnorePkg =\n";
} else {
data += "IgnorePkg = %s\n".printf (val);
}
new_conf.remove ("IgnorePkg");
} else {
data += line + "\n";
}
} else if (line.contains ("CheckSpace")) {
if (new_conf.contains ("CheckSpace")) {
bool val = new_conf.get ("CheckSpace").get_boolean ();
if (val) {
data += "CheckSpace\n";
} else {
data += "#CheckSpace\n";
}
new_conf.remove ("CheckSpace");
} else {
data += line + "\n";
}
} else {
data += line + "\n";
}
}
// delete the file before rewrite it
file.delete ();
// creating a DataOutputStream to the file
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
foreach (unowned string new_line in data) {
// writing a short string to the stream
dos.put_string (new_line);
}
reload ();
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", conf_path);
}
}
Alpm.DB.Usage define_usage (string conf_string) {
Alpm.DB.Usage usage = 0;
foreach (unowned string directive in conf_string.split(" ")) {
if (directive == "Sync") {
usage |= Alpm.DB.Usage.SYNC;
} else if (directive == "Search") {
usage |= Alpm.DB.Usage.SEARCH;
} else if (directive == "Install") {
usage |= Alpm.DB.Usage.INSTALL;
} else if (directive == "Upgrade") {
usage |= Alpm.DB.Usage.UPGRADE;
} else if (directive == "All") {
usage |= Alpm.DB.Usage.ALL;
}
}
return usage;
}
void process_siglevel (string conf_string, ref Alpm.Signature.Level siglevel, ref Alpm.Signature.Level siglevel_mask) {
foreach (unowned string directive in conf_string.split(" ")) {
bool affect_package = false;
bool affect_database = false;
if ("Package" in directive) {
affect_package = true;
} else if ("Database" in directive) {
affect_database = true;
} else {
affect_package = true;
affect_database = true;
}
if ("Never" in directive) {
if (affect_package) {
siglevel &= ~Alpm.Signature.Level.PACKAGE;
siglevel_mask |= Alpm.Signature.Level.PACKAGE;
}
if (affect_database) {
siglevel &= ~Alpm.Signature.Level.DATABASE;
siglevel_mask |= Alpm.Signature.Level.DATABASE;
}
} else if ("Optional" in directive) {
if (affect_package) {
siglevel |= (Alpm.Signature.Level.PACKAGE | Alpm.Signature.Level.PACKAGE_OPTIONAL);
siglevel_mask |= (Alpm.Signature.Level.PACKAGE | Alpm.Signature.Level.PACKAGE_OPTIONAL);
}
if (affect_database) {
siglevel |= (Alpm.Signature.Level.DATABASE | Alpm.Signature.Level.DATABASE_OPTIONAL);
siglevel_mask |= (Alpm.Signature.Level.DATABASE | Alpm.Signature.Level.DATABASE_OPTIONAL);
}
} else if ("Required" in directive) {
if (affect_package) {
siglevel |= Alpm.Signature.Level.PACKAGE;
siglevel_mask |= Alpm.Signature.Level.PACKAGE;
siglevel &= ~Alpm.Signature.Level.PACKAGE_OPTIONAL;
siglevel_mask |= Alpm.Signature.Level.PACKAGE_OPTIONAL;
}
if (affect_database) {
siglevel |= Alpm.Signature.Level.DATABASE;
siglevel_mask |= Alpm.Signature.Level.DATABASE;
siglevel &= ~Alpm.Signature.Level.DATABASE_OPTIONAL;
siglevel_mask |= Alpm.Signature.Level.DATABASE_OPTIONAL;
}
} else if ("TrustedOnly" in directive) {
if (affect_package) {
siglevel &= ~(Alpm.Signature.Level.PACKAGE_MARGINAL_OK | Alpm.Signature.Level.PACKAGE_UNKNOWN_OK);
siglevel_mask |= (Alpm.Signature.Level.PACKAGE_MARGINAL_OK | Alpm.Signature.Level.PACKAGE_UNKNOWN_OK);
}
if (affect_database) {
siglevel &= ~(Alpm.Signature.Level.DATABASE_MARGINAL_OK | Alpm.Signature.Level.DATABASE_UNKNOWN_OK);
siglevel_mask |= (Alpm.Signature.Level.DATABASE_MARGINAL_OK | Alpm.Signature.Level.DATABASE_UNKNOWN_OK);
}
} else if ("TrustAll" in directive) {
if (affect_package) {
siglevel |= (Alpm.Signature.Level.PACKAGE_MARGINAL_OK | Alpm.Signature.Level.PACKAGE_UNKNOWN_OK);
siglevel_mask |= (Alpm.Signature.Level.PACKAGE_MARGINAL_OK | Alpm.Signature.Level.PACKAGE_UNKNOWN_OK);
}
if (affect_database) {
siglevel |= (Alpm.Signature.Level.DATABASE_MARGINAL_OK | Alpm.Signature.Level.DATABASE_UNKNOWN_OK);
siglevel_mask |= (Alpm.Signature.Level.DATABASE_MARGINAL_OK | Alpm.Signature.Level.DATABASE_UNKNOWN_OK);
}
} else {
GLib.stderr.printf("unrecognized siglevel: %s\n", conf_string);
}
}
siglevel &= ~Alpm.Signature.Level.USE_DEFAULT;
}
Alpm.Signature.Level merge_siglevel(Alpm.Signature.Level sigbase, Alpm.Signature.Level sigover, Alpm.Signature.Level sigmask) {
return (sigmask != 0) ? (sigover & sigmask) | (sigbase & ~sigmask) : sigover;
}
}

View File

@ -0,0 +1 @@
../alpm_config.vala

View File

@ -4,7 +4,7 @@ cfg_pamac_system_daemon.set('PKGDATADIR', join_paths(get_option('prefix'),get_op
cfg_pamac_system_daemon.set('GETTEXT_PACKAGE', 'pamac')
cfg_pamac_system_daemon.set('RELEASE_NAME', 'pamac')
cfg_pamac_system_daemon.set('PREFIX', get_option('prefix'))
cfg_pamac_system_daemon.set('VERSION', '6.3.1')
cfg_pamac_system_daemon.set('VERSION', '6.3.3')
cfg_pamac_system_daemon.set('TESTSRCDIR', meson.source_root())
cfgfile_8 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_system_daemon)

View File

@ -1,131 +0,0 @@
/*
* pamac-vala
*
* Copyright (C) 2017 Chris Cromer <cromer@cromnix.org>
* Copyright (C) 2014-2017 Guillaume Benoit <guillaume@manjaro.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a get of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Pamac {
class MirrorsConfig {
string conf_path;
public string choosen_generation_method { get; private set; }
public string choosen_country { get; private set; }
public MirrorsConfig (string path) {
conf_path = path;
reload ();
}
public void reload () {
// set default options
choosen_generation_method = "rank";
choosen_country = "ALL";
parse_file (conf_path);
}
void parse_file (string path) {
var file = GLib.File.new_for_path (path);
if (file.query_exists ()) {
try {
// Open file for reading and wrap returned FileInputStream into a
// DataInputStream, so we can read line by line
var dis = new DataInputStream (file.read ());
string? line;
// Read lines until end of file (null) is reached
while ((line = dis.read_line ()) != null) {
if (line.length == 0) {
continue;
}
// ignore whole line and end of line comments
string[] splitted = line.split ("#", 2);
line = splitted[0].strip ();
if (line.length == 0) {
continue;
}
splitted = line.split ("=", 2);
unowned string key = splitted[0]._strip ();
unowned string? val = null;
if (splitted.length == 2) {
val = splitted[1]._strip ();
}
if (key == "Method") {
choosen_generation_method = val;
} else if (key == "OnlyCountry") {
choosen_country = val;
}
}
} catch (Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", path);
}
}
public void write (HashTable<string,Variant> new_conf) {
var file = GLib.File.new_for_path (conf_path);
if (file.query_exists ()) {
try {
// Open file for reading and wrap returned FileInputStream into a
// DataInputStream, so we can read line by line
var dis = new DataInputStream (file.read ());
string? line;
var data = new GLib.List<string> ();
// Read lines until end of file (null) is reached
while ((line = dis.read_line ()) != null) {
if (line.length == 0) {
data.append ("\n");
continue;
}
unowned Variant variant;
if (line.contains ("Method")) {
if (new_conf.lookup_extended ("Method", null, out variant)) {
data.append ("Method = %s\n".printf (variant.get_string ()));
} else {
data.append (line + "\n");
}
} else if (line.contains ("OnlyCountry")) {
if (new_conf.lookup_extended ("OnlyCountry", null, out variant)) {
if (variant.get_string () == "ALL") {
data.append ("#%s\n".printf (line));
} else {
data.append ("OnlyCountry = %s\n".printf (variant.get_string ()));
}
} else {
data.append (line + "\n");
}
} else {
data.append (line + "\n");
}
}
// delete the file before rewrite it
file.delete ();
// creating a DataOutputStream to the file
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
foreach (unowned string new_line in data) {
// writing a short string to the stream
dos.put_string (new_line);
}
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", file.get_path ());
}
}
}
}

View File

@ -0,0 +1 @@
../mirrors_config.vala

View File

@ -7,13 +7,13 @@ set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.3.1")
set (VERSION "6.3.3")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
configure_file (${CMAKE_SOURCE_DIR}/src/pamac-tray/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-tray/Config.vala)
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
set (VERSION "6.3.1")
set (VERSION "6.3.3")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/aur )
link_libraries ( ${DEPS_LIBRARIES} -lPamac -lAUR )
@ -25,6 +25,7 @@ include (ValaPrecompile)
set (VALA_PACKAGES ${VALA_PACKAGES} posix)
set (VALA_PACKAGES ${VALA_PACKAGES} json-glib-1.0)
set (VALA_PACKAGES ${VALA_PACKAGES} libalpm)
set (VALA_PACKAGES ${VALA_PACKAGES} libnotify)
if (KDE_TRAY)
set (VALA_PACKAGES ${VALA_PACKAGES} appindicator3-0.1)
@ -41,9 +42,9 @@ if (KDE_TRAY)
else ()
set (APP_SOURCES ${APP_SOURCES} tray-gtk.vala)
endif ()
set (APP_SOURCES ${APP_SOURCES} alpm_config.vala)
set (APP_SOURCES ${APP_SOURCES} pamac_config.vala)
set (APP_SOURCES ${APP_SOURCES} tray.vala)
set (APP_SOURCES ${APP_SOURCES} user_daemon.vala)
set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_BINARY_DIR}/src/Pamac.vapi)
if (NOT DISABLE_AUR)

View File

@ -0,0 +1 @@
../alpm_config.vala

View File

@ -4,12 +4,13 @@ cfg_pamac_tray.set('PKGDATADIR', join_paths(get_option('prefix'),get_option('dat
cfg_pamac_tray.set('GETTEXT_PACKAGE', 'pamac')
cfg_pamac_tray.set('RELEASE_NAME', 'pamac')
cfg_pamac_tray.set('PREFIX', get_option('prefix'))
cfg_pamac_tray.set('VERSION', '6.3.1')
cfg_pamac_tray.set('VERSION', '6.3.3')
cfg_pamac_tray.set('TESTSRCDIR', meson.source_root())
cfgfile_4 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_tray)
pamac_tray_deps = [json_glib_1_0_dep]
pamac_tray_deps += [libalpm_dep]
pamac_tray_deps += [libnotify_dep]
if KDE_TRAY
pamac_tray_deps += [appindicator3_0_1_dep]
@ -25,9 +26,9 @@ pamac_tray_sources += ['tray-appindicator.vala']
else
pamac_tray_sources += ['tray-gtk.vala']
endif
pamac_tray_sources += ['alpm_config.vala']
pamac_tray_sources += ['pamac_config.vala']
pamac_tray_sources += ['tray.vala']
pamac_tray_sources += ['user_daemon.vala']
pamac_tray_vala_args = ['--pkg','posix']
pamac_tray_vala_args += ['--vapidir='+join_paths(meson.source_root(),'src/vapis')]
pamac_tray_dependencies = [Pamac_library]

View File

@ -27,6 +27,18 @@ const string noupdate_info = _("Your system is up-to-date");
namespace Pamac {
[DBus (name = "org.pamac.user")]
interface UserDaemon : Object {
public abstract void refresh_handle () throws IOError;
public abstract string get_lockfile () throws IOError;
#if DISABLE_AUR
public abstract void start_get_updates () throws IOError;
#else
public abstract void start_get_updates (bool check_aur_updates) throws IOError;
#endif
[DBus (no_reply = true)]
public abstract void quit () throws IOError;
public signal void get_updates_finished (Updates updates);
}
public abstract class TrayIcon: Gtk.Application {
Notify.Notification notification;

View File

@ -1,61 +0,0 @@
/*
* pamac-vala
*
* Copyright (C) 2017 Chris Cromer <cromer@cromnix.org>
* Copyright (C) 2014-2017 Guillaume Benoit <guillaume@manjaro.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a get of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Pamac {
[DBus (name = "org.pamac.user")]
interface UserDaemon : Object {
public abstract void refresh_handle () throws IOError;
#if DISABLE_AUR
public abstract void start_get_updates () throws IOError;
#else
public abstract void start_get_updates (bool check_aur_updates) throws IOError;
#endif
[DBus (no_reply = true)]
public abstract void quit () throws IOError;
public signal void get_updates_finished (Updates updates);
public abstract string get_lockfile () throws IOError;
}
[DBus (name = "org.pamac.system")]
interface SystemDaemon : Object {
[DBus (no_reply = true)]
public signal void get_updates_finished (Updates updates);
public signal void emit_event (uint primary_event, uint secondary_event, string[] details);
public signal void emit_providers (string depend, string[] providers);
public signal void emit_progress (uint progress, string pkgname, uint percent, uint n_targets, uint current_target);
public signal void emit_download (string filename, uint64 xfered, uint64 total);
public signal void emit_totaldownload (uint64 total);
public signal void emit_log (uint level, string msg);
public signal void set_pkgreason_finished ();
public signal void refresh_finished (bool success);
public signal void trans_prepare_finished (bool success);
public signal void trans_commit_finished (bool success);
public signal void get_authorization_finished (bool authorized);
#if DISABLE_AUR
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon);
#else
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates);
#endif
public signal void write_alpm_config_finished (bool checkspace);
public signal void write_mirrors_config_finished (string choosen_country, string choosen_generation_method);
public signal void generate_mirrors_list_data (string line);
public signal void generate_mirrors_list_finished ();
}
}

View File

@ -7,13 +7,13 @@ set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.3.1")
set (VERSION "6.3.3")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
configure_file (${CMAKE_SOURCE_DIR}/src/pamac-user-daemon/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-user-daemon/Config.vala)
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
set (VERSION "6.3.1")
set (VERSION "6.3.3")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/aur )
link_libraries ( ${DEPS_LIBRARIES} -lPamac -lAUR )

View File

@ -1 +1 @@
../pamac-system-daemon/alpm_config.vala
../alpm_config.vala

View File

@ -4,7 +4,7 @@ cfg_pamac_user_daemon.set('PKGDATADIR', join_paths(get_option('prefix'),get_opti
cfg_pamac_user_daemon.set('GETTEXT_PACKAGE', 'pamac')
cfg_pamac_user_daemon.set('RELEASE_NAME', 'pamac')
cfg_pamac_user_daemon.set('PREFIX', get_option('prefix'))
cfg_pamac_user_daemon.set('VERSION', '6.3.1')
cfg_pamac_user_daemon.set('VERSION', '6.3.3')
cfg_pamac_user_daemon.set('TESTSRCDIR', meson.source_root())
cfgfile_3 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_user_daemon)