customized builds

This commit is contained in:
2017-10-10 16:29:22 -03:00
parent 3d5d662152
commit 235c95aa2b
246 changed files with 8857 additions and 1535 deletions

144
src/CMakeLists.txt Normal file
View File

@@ -0,0 +1,144 @@
### CMakeLists automatically created with AutoVala
### Do not edit
set (DATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}")
set (PKGDATADIR "${DATADIR}/pamac")
set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.0.0")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
configure_file (${CMAKE_SOURCE_DIR}/src/Config.vala.base ${CMAKE_BINARY_DIR}/src/Config.vala)
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.0.0")
add_definitions (${DEPS_CFLAGS})
link_libraries ( ${DEPS_LIBRARIES} )
link_directories ( ${DEPS_LIBRARY_DIRS} )
find_package (Vala REQUIRED)
include (ValaVersion)
ensure_vala_version ("0.38" MINIMUM)
include (ValaPrecompile)
set (VALA_PACKAGES ${VALA_PACKAGES} posix)
set (VALA_PACKAGES ${VALA_PACKAGES} gdk-3.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gtk+-3.0)
set (VALA_PACKAGES ${VALA_PACKAGES} libalpm)
set (VALA_PACKAGES ${VALA_PACKAGES} libnotify)
set (VALA_PACKAGES ${VALA_PACKAGES} vte-2.91)
set (VALA_PACKAGES ${VALA_PACKAGES} gio-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} glib-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gobject-2.0)
set (APP_SOURCES ${APP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Config.vala)
set (APP_SOURCES ${APP_SOURCES} alpm_config.vala)
set (APP_SOURCES ${APP_SOURCES} choose_ignorepkgs_dialog.vala)
set (APP_SOURCES ${APP_SOURCES} choose_provider_dialog.vala)
set (APP_SOURCES ${APP_SOURCES} common.vala)
set (APP_SOURCES ${APP_SOURCES} mirrors_config.vala)
set (APP_SOURCES ${APP_SOURCES} package.vala)
set (APP_SOURCES ${APP_SOURCES} pamac_config.vala)
set (APP_SOURCES ${APP_SOURCES} preferences_dialog.vala)
set (APP_SOURCES ${APP_SOURCES} progress_box.vala)
set (APP_SOURCES ${APP_SOURCES} transaction.vala)
set (APP_SOURCES ${APP_SOURCES} transaction_sum_dialog.vala)
if (DISABLE_AUR)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D DISABLE_AUR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_AUR " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_AUR " )
endif ()
if (KDE_TRAY)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D KDE_TRAY)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DKDE_TRAY " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKDE_TRAY " )
endif ()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --vapidir=${CMAKE_SOURCE_DIR}/src/vapis )
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug") OR (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(COMPILE_OPTIONS ${COMPILE_OPTIONS} "-g")
endif()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --library=Pamac --gir Pamac-6.0.gir )
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --gresources=${CMAKE_SOURCE_DIR}/data/pamac.transaction_no_aur.gresource.xml )
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --gresources=${CMAKE_SOURCE_DIR}/data/pamac.transaction.gresource.xml )
vala_precompile(VALA_C Pamac
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
OPTIONS
${COMPILE_OPTIONS}
GENERATE_VAPI
Pamac
GENERATE_HEADER
Pamac
)
SET (VALA_C ${VALA_C} ${pamac_transaction_gresource_xml_C_FILE})
add_library(Pamac SHARED ${VALA_C})
add_dependencies (Pamac pamac_transaction_gresource_xml)
set_target_properties( Pamac PROPERTIES
VERSION
6.0.0
SOVERSION
6 )
install(TARGETS
Pamac
LIBRARY DESTINATION
${CMAKE_INSTALL_LIBDIR}/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/Pamac.h
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/Pamac.vapi
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/vala/vapi/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/Pamac.deps
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/vala/vapi/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/Pamac-6.0.gir
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/gir-1.0/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/Pamac.pc
DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig/
)
if(HAVE_VALADOC)
valadoc(Pamac
${CMAKE_BINARY_DIR}/valadoc/Pamac
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
)
install(DIRECTORY
${CMAKE_BINARY_DIR}/valadoc
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/doc/pamac
)
endif()
install(CODE "MESSAGE (\"
************************************************
* Run 'sudo ldconfig' to complete installation *
************************************************
\") " )

10
src/Config.vala.base Normal file
View File

@@ -0,0 +1,10 @@
namespace PamacConstants {
public const string DATADIR = "@DATADIR@";
public const string PKGDATADIR = "@PKGDATADIR@";
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string RELEASE_NAME = "@RELEASE_NAME@";
public const string VERSION = "@VERSION@";
#if UNITEST
public const string TESTSRCDIR = "@TESTSRCDIR@";
#endif
}

View File

@@ -1,129 +0,0 @@
ALPM_VALA_FLAGS = --pkg=libalpm \
--pkg=gio-2.0 \
--vapidir=../vapi \
-X -D_FILE_OFFSET_BITS=64
COMMON_VALA_FLAGS = -X -w \
--pkg=posix \
-X -DGETTEXT_PACKAGE="pamac" \
--target-glib=2.38
TRANSACTION_VALA_FLAGS = --pkg=gtk+-3.0 \
--pkg=gdk-3.0 \
--pkg=vte-2.91 \
-X -lm
PAMAC_LIB_FLAGS = -X -I. \
-X -L. \
-X -lpamac \
--vapidir=./ \
--pkg=pamac \
COMMON_SOURCES = common.vala \
package.vala \
pamac_config.vala
TRANSACTION_SOURCES = transaction.vala \
choose_provider_dialog.vala \
transaction_sum_dialog.vala \
progress_box.vala
PREFERENCES_SOURCES = preferences_dialog.vala \
choose_ignorepkgs_dialog.vala \
mirrors_config.vala
TRANSACTION_GRESOURCE_FILE = ../resources/pamac.transaction.gresource.xml
MANAGER_GRESOURCE_FILE = ../resources/pamac.manager.gresource.xml
INSTALLER_GRESOURCE_FILE = ../resources/pamac.installer.gresource.xml
binaries: pamac-user-daemon pamac-system-daemon pamac-tray pamac-manager pamac-install
clean:
rm -f *.c pamac.h pamac.vapi libpamac.so pamac-user-daemon pamac-system-daemon pamac-tray pamac-tray-appindicator pamac-manager pamac-install
pamac-tray: $(COMMON_SOURCES) alpm_config.vala tray.vala tray-gtk.vala
valac -o pamac-tray \
$(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \
--pkg=libnotify \
$(COMMON_SOURCES) \
tray-gtk.vala \
tray.vala
pamac-tray-appindicator: $(COMMON_SOURCES) alpm_config.vala tray.vala tray-appindicator.vala
valac -o pamac-tray-appindicator \
$(COMMON_VALA_FLAGS) \
--pkg=gtk+-3.0 \
--pkg=appindicator3-0.1 \
--pkg=libnotify \
$(COMMON_SOURCES) \
tray-appindicator.vala \
tray.vala
pamac-user-daemon: ../vapi/libalpm.vapi alpm_config.vala common.vala package.vala aur.vala user_daemon.vala
valac -o pamac-user-daemon \
$(COMMON_VALA_FLAGS) \
$(ALPM_VALA_FLAGS) \
--pkg=json-glib-1.0 \
--pkg=libsoup-2.4 \
--thread \
alpm_config.vala \
common.vala \
package.vala \
aur.vala \
user_daemon.vala
pamac-system-daemon: ../vapi/libalpm.vapi ../vapi/polkit-gobject-1.vapi ../vapi/libcurl.vapi alpm_config.vala $(COMMON_SOURCES) aur.vala mirrors_config.vala system_daemon.vala
valac -o pamac-system-daemon \
$(COMMON_VALA_FLAGS) \
$(ALPM_VALA_FLAGS) \
--pkg=polkit-gobject-1 \
--pkg=libcurl \
--pkg=json-glib-1.0 \
--pkg=libsoup-2.4 \
--thread \
alpm_config.vala \
$(COMMON_SOURCES) \
aur.vala \
mirrors_config.vala \
system_daemon.vala
libpamac.so: $(COMMON_SOURCES) $(TRANSACTION_SOURCES) $(PREFERENCES_SOURCES) ../resources/transaction_resources.c
valac -o libpamac.so \
-X -fPIC \
-X --shared \
-H pamac.h \
--vapi=pamac.vapi \
--library=libpamac \
$(COMMON_VALA_FLAGS) \
$(TRANSACTION_VALA_FLAGS) \
--gresources=$(TRANSACTION_GRESOURCE_FILE) \
../resources/transaction_resources.c \
$(COMMON_SOURCES) \
$(TRANSACTION_SOURCES) \
$(PREFERENCES_SOURCES)
pamac-manager: libpamac.so ../resources/manager_resources.c history_dialog.vala manager_window.vala manager.vala
valac -o pamac-manager \
$(COMMON_VALA_FLAGS) \
$(PAMAC_LIB_FLAGS) \
--pkg=gtk+-3.0 \
--pkg=gdk-3.0 \
--gresources=$(MANAGER_GRESOURCE_FILE) \
../resources/manager_resources.c \
history_dialog.vala \
manager_window.vala \
manager.vala
pamac-install: libpamac.so ../resources/installer_resources.c progress_dialog.vala installer.vala
valac -o pamac-install \
$(COMMON_VALA_FLAGS) \
$(PAMAC_LIB_FLAGS) \
--pkg=gtk+-3.0 \
--gresources=$(INSTALLER_GRESOURCE_FILE) \
../resources/installer_resources.c \
progress_dialog.vala \
installer.vala

9
src/Pamac.deps Normal file
View File

@@ -0,0 +1,9 @@
posix
gdk-3.0
gtk+-3.0
libalpm
libnotify
vte-2.91
gio-2.0
glib-2.0
gobject-2.0

12
src/Pamac.pc Normal file
View File

@@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
real_prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@DOLLAR@{prefix}
libdir=@DOLLAR@{exec_prefix}/${CMAKE_INSTALL_LIBDIR}
includedir=@DOLLAR@{exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}
Name: Pamac
Description: Pamac
Version: 6.0.0
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

9
src/PamacUserDaemon.deps Normal file
View File

@@ -0,0 +1,9 @@
posix
gdk-3.0
gtk+-3.0
libalpm
libnotify
vte-2.91
gio-2.0
glib-2.0
gobject-2.0

12
src/PamacUserDaemon.pc Normal file
View File

@@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
real_prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@DOLLAR@{prefix}
libdir=@DOLLAR@{exec_prefix}/${CMAKE_INSTALL_LIBDIR}
includedir=@DOLLAR@{exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}
Name: PamacUserDaemon
Description: PamacUserDaemon
Version: 5.2.1
Libs: -L@DOLLAR@{libdir} -lPamacUserDaemon
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

@@ -1,6 +1,7 @@
/*
* 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
@@ -73,14 +74,6 @@ 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> ();
@@ -134,85 +127,6 @@ 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);
@@ -336,66 +250,6 @@ 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(" ")) {
@@ -481,8 +335,4 @@ 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;
}
}

3
src/aur/AUR.deps Normal file
View File

@@ -0,0 +1,3 @@
json-glib-1.0
libsoup-2.4
glib-2.0

12
src/aur/AUR.pc Normal file
View File

@@ -0,0 +1,12 @@
prefix=@CMAKE_INSTALL_PREFIX@
real_prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@DOLLAR@{prefix}
libdir=@DOLLAR@{exec_prefix}/${CMAKE_INSTALL_LIBDIR}
includedir=@DOLLAR@{exec_prefix}/${CMAKE_INSTALL_INCLUDEDIR}
Name: AUR
Description: AUR
Version: 6.0.0
Libs: -L@DOLLAR@{libdir} -lAUR
Cflags: -I@DOLLAR@{includedir}
Requires: json-glib-1.0 libsoup-2.4 glib-2.0

117
src/aur/CMakeLists.txt Normal file
View File

@@ -0,0 +1,117 @@
### CMakeLists automatically created with AutoVala
### Do not edit
set (DATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}")
set (PKGDATADIR "${DATADIR}/pamac")
set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.0.0")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
configure_file (${CMAKE_SOURCE_DIR}/src/aur/Config.vala.base ${CMAKE_BINARY_DIR}/src/aur/Config.vala)
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.0.0")
add_definitions (${DEPS_CFLAGS})
link_libraries ( ${DEPS_LIBRARIES} )
link_directories ( ${DEPS_LIBRARY_DIRS} )
find_package (Vala REQUIRED)
include (ValaVersion)
ensure_vala_version ("0.38" MINIMUM)
include (ValaPrecompile)
set (VALA_PACKAGES ${VALA_PACKAGES} json-glib-1.0)
set (VALA_PACKAGES ${VALA_PACKAGES} libsoup-2.4)
set (VALA_PACKAGES ${VALA_PACKAGES} glib-2.0)
set (APP_SOURCES ${APP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Config.vala)
set (APP_SOURCES ${APP_SOURCES} aur.vala)
if (DISABLE_AUR)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D DISABLE_AUR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_AUR " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_AUR " )
endif ()
if (KDE_TRAY)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D KDE_TRAY)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DKDE_TRAY " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKDE_TRAY " )
endif ()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --vapidir=${CMAKE_SOURCE_DIR}/src/vapis )
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug") OR (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(COMPILE_OPTIONS ${COMPILE_OPTIONS} "-g")
endif()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --library=AUR --gir AUR-6.0.gir )
vala_precompile(VALA_C AUR
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
OPTIONS
${COMPILE_OPTIONS}
GENERATE_VAPI
AUR
GENERATE_HEADER
AUR
)
add_library(AUR SHARED ${VALA_C})
set_target_properties( AUR PROPERTIES
VERSION
6.0.0
SOVERSION
6 )
install(TARGETS
AUR
LIBRARY DESTINATION
${CMAKE_INSTALL_LIBDIR}/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/AUR.h
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/AUR.vapi
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/vala/vapi/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/AUR.deps
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/vala/vapi/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/AUR-6.0.gir
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/gir-1.0/
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/AUR.pc
DESTINATION
${CMAKE_INSTALL_LIBDIR}/pkgconfig/
)
if(HAVE_VALADOC)
valadoc(AUR
${CMAKE_BINARY_DIR}/valadoc/AUR
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
)
install(DIRECTORY
${CMAKE_BINARY_DIR}/valadoc
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/doc/pamac
)
endif()

10
src/aur/Config.vala.base Normal file
View File

@@ -0,0 +1,10 @@
namespace AURConstants {
public const string DATADIR = "@DATADIR@";
public const string PKGDATADIR = "@PKGDATADIR@";
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string RELEASE_NAME = "@RELEASE_NAME@";
public const string VERSION = "@VERSION@";
#if UNITEST
public const string TESTSRCDIR = "@TESTSRCDIR@";
#endif
}

View File

@@ -1,6 +1,7 @@
/*
* 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

View File

@@ -1,6 +1,7 @@
/*
* pamac-vala
*
* Copyright (C) 2017 Chris Cromer <cromer@cromnix.org>
* Copyright (C) 2015-2017 Guillaume Benoit <guillaume@manjaro.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -17,9 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//using GIO
namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/preferences/choose_ignorepkgs_dialog.ui")]
[GtkTemplate (ui = "/org/pamac/preferences/interface/choose_ignorepkgs_dialog.ui")]
class ChooseIgnorepkgsDialog : Gtk.Dialog {
[GtkChild]

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -17,9 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//using GIO
namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/transaction/choose_provider_dialog.ui")]
[GtkTemplate (ui = "/org/pamac/transaction/interface/choose_provider_dialog.ui")]
class ChooseProviderDialog : Gtk.Dialog {
public ChooseProviderDialog (Gtk.ApplicationWindow? window) {

View File

@@ -1,32 +0,0 @@
/*
* pamac-vala
*
* 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/>.
*/
int main () {
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
string rm_only_uninstalled_str = "";
if (pamac_config.rm_only_uninstalled) {
rm_only_uninstalled_str = "-u";
}
try {
Process.spawn_command_line_sync ("paccache -q --nocolor %s -r -k %llu".printf (rm_only_uninstalled_str, pamac_config.keep_num_pkgs));
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
return 0;
}

View File

@@ -1,6 +1,7 @@
/*
* pamac-vala
*
* Copyright (C) 2017 Chris Cromer <cromer@cromnix.org>
* Copyright (C) 2014-2015 Guillaume Benoit <guillaume@manjaro.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -33,14 +34,20 @@ namespace Pamac {
public UpdateInfos[] to_reinstall;
public UpdateInfos[] to_remove;
public UpdateInfos[] to_build;
#if DISABLE_AUR
#else
public UpdateInfos[] aur_conflicts_to_remove;
public string[] aur_pkgbases_to_build;
#endif
}
public struct Updates {
public bool is_syncfirst;
public AlpmPackage[] repos_updates;
#if DISABLE_AUR
#else
public AURPackage[] aur_updates;
#endif
}
public struct ErrorInfos {

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -74,57 +75,5 @@ 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

@@ -1,6 +1,7 @@
/*
* 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
@@ -53,6 +54,8 @@ namespace Pamac {
public string[] backups;
}
#if DISABLE_AUR
#else
public struct AURPackage {
public string name;
public string version;
@@ -82,4 +85,5 @@ namespace Pamac {
public string[] replaces;
public string[] conflicts;
}
#endif
}

View File

@@ -0,0 +1 @@
add_dependencies(pamac-install Pamac)

View File

@@ -0,0 +1,90 @@
### CMakeLists automatically created with AutoVala
### Do not edit
set (DATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}")
set (PKGDATADIR "${DATADIR}/pamac")
set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.0.0")
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.0.0")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src )
link_libraries ( ${DEPS_LIBRARIES} -lPamac )
link_directories ( ${DEPS_LIBRARY_DIRS} ${CMAKE_BINARY_DIR}/src )
find_package (Vala REQUIRED)
include (ValaVersion)
ensure_vala_version ("0.38" MINIMUM)
include (ValaPrecompile)
set (VALA_PACKAGES ${VALA_PACKAGES} gtk+-3.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gio-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} glib-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gobject-2.0)
set (APP_SOURCES ${APP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Config.vala)
set (APP_SOURCES ${APP_SOURCES} installer.vala)
set (APP_SOURCES ${APP_SOURCES} progress_dialog.vala)
set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_BINARY_DIR}/src/Pamac.vapi)
if (DISABLE_AUR)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D DISABLE_AUR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_AUR " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_AUR " )
endif ()
if (KDE_TRAY)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D KDE_TRAY)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DKDE_TRAY " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKDE_TRAY " )
endif ()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --vapidir=${CMAKE_SOURCE_DIR}/src/vapis )
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug") OR (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(COMPILE_OPTIONS ${COMPILE_OPTIONS} "-g")
endif()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --gresources=${CMAKE_SOURCE_DIR}/data/pamac.installer.gresource.xml )
vala_precompile(VALA_C pamac-install
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
OPTIONS
${COMPILE_OPTIONS}
)
SET (VALA_C ${VALA_C} ${pamac_installer_gresource_xml_C_FILE})
add_executable(pamac-install ${VALA_C})
add_dependencies (pamac-install pamac_installer_gresource_xml)
install(TARGETS
pamac-install
RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}
)
if(HAVE_VALADOC)
valadoc(pamac-install
${CMAKE_BINARY_DIR}/valadoc/pamac-install
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
)
install(DIRECTORY
${CMAKE_BINARY_DIR}/valadoc
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/doc/pamac
)
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeDepends.txt)

View File

@@ -0,0 +1,10 @@
namespace Constants {
public const string DATADIR = "@DATADIR@";
public const string PKGDATADIR = "@PKGDATADIR@";
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string RELEASE_NAME = "@RELEASE_NAME@";
public const string VERSION = "@VERSION@";
#if UNITEST
public const string TESTSRCDIR = "@TESTSRCDIR@";
#endif
}

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -26,7 +27,7 @@ namespace Pamac {
bool important_details;
public Installer () {
application_id = "org.manjaro.pamac.installer";
application_id = "org.pamac.installer";
flags |= ApplicationFlags.HANDLES_OPEN;
}
@@ -98,7 +99,7 @@ namespace Pamac {
bool check_pamac_running () {
Application app;
bool run = false;
app = new Application ("org.manjaro.pamac.manager", 0);
app = new Application ("org.pamac.manager", 0);
try {
app.register ();
} catch (GLib.Error e) {

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -17,9 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//using GIO
namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/installer/progress_dialog.ui")]
[GtkTemplate (ui = "/org/pamac/installer/interface/progress_dialog.ui")]
class ProgressDialog : Gtk.ApplicationWindow {
[GtkChild]

View File

@@ -0,0 +1,3 @@
add_dependencies(pamac-manager Pamac)
include (InstallSymlink)
install_symlink(pamac-manager ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/pamac-updater)

View File

@@ -0,0 +1,92 @@
### CMakeLists automatically created with AutoVala
### Do not edit
set (DATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}")
set (PKGDATADIR "${DATADIR}/pamac")
set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.0.0")
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.0.0")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src )
link_libraries ( ${DEPS_LIBRARIES} -lPamac )
link_directories ( ${DEPS_LIBRARY_DIRS} ${CMAKE_BINARY_DIR}/src )
find_package (Vala REQUIRED)
include (ValaVersion)
ensure_vala_version ("0.38" MINIMUM)
include (ValaPrecompile)
set (VALA_PACKAGES ${VALA_PACKAGES} gtk+-3.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gio-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} glib-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gobject-2.0)
set (APP_SOURCES ${APP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Config.vala)
set (APP_SOURCES ${APP_SOURCES} history_dialog.vala)
set (APP_SOURCES ${APP_SOURCES} manager.vala)
set (APP_SOURCES ${APP_SOURCES} manager_window.vala)
set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_BINARY_DIR}/src/Pamac.vapi)
if (DISABLE_AUR)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D DISABLE_AUR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_AUR " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_AUR " )
endif ()
if (KDE_TRAY)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D KDE_TRAY)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DKDE_TRAY " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKDE_TRAY " )
endif ()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --vapidir=${CMAKE_SOURCE_DIR}/src/vapis )
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug") OR (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(COMPILE_OPTIONS ${COMPILE_OPTIONS} "-g")
endif()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --gresources=${CMAKE_SOURCE_DIR}/data/pamac.manager_no_aur.gresource.xml )
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --gresources=${CMAKE_SOURCE_DIR}/data/pamac.manager.gresource.xml )
vala_precompile(VALA_C pamac-manager
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
OPTIONS
${COMPILE_OPTIONS}
)
SET (VALA_C ${VALA_C} ${pamac_manager_gresource_xml_C_FILE})
add_executable(pamac-manager ${VALA_C})
add_dependencies (pamac-manager pamac_manager_gresource_xml)
install(TARGETS
pamac-manager
RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}
)
if(HAVE_VALADOC)
valadoc(pamac-manager
${CMAKE_BINARY_DIR}/valadoc/pamac-manager
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
)
install(DIRECTORY
${CMAKE_BINARY_DIR}/valadoc
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/doc/pamac
)
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeDepends.txt)

View File

@@ -0,0 +1,10 @@
namespace Constants {
public const string DATADIR = "@DATADIR@";
public const string PKGDATADIR = "@PKGDATADIR@";
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string RELEASE_NAME = "@RELEASE_NAME@";
public const string VERSION = "@VERSION@";
#if UNITEST
public const string TESTSRCDIR = "@TESTSRCDIR@";
#endif
}

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -17,9 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//using GIO
namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/manager/history_dialog.ui")]
[GtkTemplate (ui = "/org/pamac/manager/interface/history_dialog.ui")]
class HistoryDialog : Gtk.Dialog {
[GtkChild]

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -25,7 +26,7 @@ namespace Pamac {
bool started;
public Manager () {
application_id = "org.manjaro.pamac.manager";
application_id = "org.pamac.manager";
flags = ApplicationFlags.HANDLES_COMMAND_LINE;
}
@@ -96,7 +97,7 @@ namespace Pamac {
bool check_pamac_running () {
Application app;
bool run = false;
app = new Application ("org.manjaro.pamac.installer", 0);
app = new Application ("org.pamac.installer", 0);
try {
app.register ();
} catch (GLib.Error e) {

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -17,7 +18,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const string VERSION = "5.2.1";
//using GIO
const string VERSION = Constants.VERSION;
namespace Pamac {
@@ -36,7 +39,11 @@ namespace Pamac {
}
}
[GtkTemplate (ui = "/org/manjaro/pamac/manager/manager_window.ui")]
#if DISABLE_AUR
[GtkTemplate (ui = "/org/pamac/manager/interface/manager_window_no_aur.ui")]
#else
[GtkTemplate (ui = "/org/pamac/manager/interface/manager_window.ui")]
#endif
class ManagerWindow : Gtk.ApplicationWindow {
// icons
Gdk.Pixbuf? installed_icon;
@@ -59,10 +66,13 @@ namespace Pamac {
Gtk.TreeView packages_treeview;
[GtkChild]
Gtk.TreeViewColumn packages_state_column;
#if DISABLE_AUR
#else
[GtkChild]
Gtk.TreeView aur_treeview;
[GtkChild]
Gtk.TreeViewColumn aur_state_column;
#endif
[GtkChild]
public Gtk.Stack filters_stack;
[GtkChild]
@@ -126,7 +136,10 @@ namespace Pamac {
Gtk.MenuItem remove_item;
Gtk.MenuItem details_item;
GLib.List<string> selected_pkgs;
#if DISABLE_AUR
#else
GLib.List<string> selected_aur;
#endif
// liststores
Gtk.ListStore search_list;
@@ -134,7 +147,10 @@ namespace Pamac {
Gtk.ListStore states_list;
Gtk.ListStore repos_list;
Gtk.ListStore packages_list;
#if DISABLE_AUR
#else
Gtk.ListStore aur_list;
#endif
public Queue<string> display_package_queue;
string current_package_displayed;
@@ -155,7 +171,10 @@ namespace Pamac {
public ManagerWindow (Gtk.Application application) {
Object (application: application);
#if DISABLE_AUR
#else
support_aur (false);
#endif
button_back.visible = false;
transaction_infobox.visible = false;
refreshing = false;
@@ -241,6 +260,8 @@ namespace Pamac {
});
packages_state_renderer.activated.connect (on_packages_state_icon_activated);
#if DISABLE_AUR
#else
aur_list = new Gtk.ListStore (6,
typeof (uint), //origin
typeof (string), //name
@@ -285,16 +306,17 @@ namespace Pamac {
cellrenderer.set ("pixbuf", pixbuf);
});
aur_state_renderer.activated.connect (on_aur_state_icon_activated);
#endif
try {
installed_icon = new Gdk.Pixbuf.from_resource ("/org/manjaro/pamac/manager/package-installed-updated.png");
uninstalled_icon = new Gdk.Pixbuf.from_resource ("/org/manjaro/pamac/manager/package-available.png");
to_install_icon = new Gdk.Pixbuf.from_resource ("/org/manjaro/pamac/manager/package-install.png");
to_reinstall_icon = new Gdk.Pixbuf.from_resource ("/org/manjaro/pamac/manager/package-reinstall.png");
to_remove_icon = new Gdk.Pixbuf.from_resource ("/org/manjaro/pamac/manager/package-remove.png");
to_upgrade_icon = new Gdk.Pixbuf.from_resource ("/org/manjaro/pamac/manager/package-upgrade.png");
installed_locked_icon = new Gdk.Pixbuf.from_resource ("/org/manjaro/pamac/manager/package-installed-locked.png");
available_locked_icon = new Gdk.Pixbuf.from_resource ("/org/manjaro/pamac/manager/package-available-locked.png");
installed_icon = new Gdk.Pixbuf.from_resource ("/org/pamac/manager/pixmaps/package-installed-updated.png");
uninstalled_icon = new Gdk.Pixbuf.from_resource ("/org/pamac/manager/pixmaps/package-available.png");
to_install_icon = new Gdk.Pixbuf.from_resource ("/org/pamac/manager/pixmaps/package-install.png");
to_reinstall_icon = new Gdk.Pixbuf.from_resource ("/org/pamac/manager/pixmaps/package-reinstall.png");
to_remove_icon = new Gdk.Pixbuf.from_resource ("/org/pamac/manager/pixmaps/package-remove.png");
to_upgrade_icon = new Gdk.Pixbuf.from_resource ("/org/pamac/manager/pixmaps/package-upgrade.png");
installed_locked_icon = new Gdk.Pixbuf.from_resource ("/org/pamac/manager/pixmaps/package-installed-locked.png");
available_locked_icon = new Gdk.Pixbuf.from_resource ("/org/pamac/manager/pixmaps/package-available-locked.png");
} catch (GLib.Error e) {
stderr.printf (e.message);
}
@@ -302,8 +324,11 @@ namespace Pamac {
transaction = new Transaction (this as Gtk.ApplicationWindow);
transaction.start_downloading.connect (on_start_downloading);
transaction.stop_downloading.connect (on_stop_downloading);
#if DISABLE_AUR
#else
transaction.start_building.connect (on_start_building);
transaction.stop_building.connect (on_stop_building);
#endif
transaction.important_details_outpout.connect (on_important_details_outpout);
transaction.finished.connect (on_transaction_finished);
transaction.write_pamac_config_finished.connect (on_write_pamac_config_finished);
@@ -316,7 +341,10 @@ namespace Pamac {
main_stack.add_named (transaction.term_window, "term");
transaction_infobox.pack_start (transaction.progress_box);
#if DISABLE_AUR
#else
support_aur (transaction.enable_aur);
#endif
display_package_queue = new Queue<string> ();
@@ -333,10 +361,15 @@ namespace Pamac {
return false;
}
#if DISABLE_AUR
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) {
}
#else
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur) {
support_aur (enable_aur);
}
#endif
void on_set_pkgreason_finished () {
transaction.unlock ();
@@ -346,12 +379,17 @@ namespace Pamac {
if (transaction.get_installed_pkg (current_package_displayed).name != ""
|| transaction.get_sync_pkg (current_package_displayed).name != "") {
display_package_properties (current_package_displayed);
#if DISABLE_AUR
#else
} else {
display_aur_properties (current_package_displayed);
#endif
}
}
}
}
#if DISABLE_AUR
#else
void support_aur (bool enable_aur) {
if (enable_aur) {
if (filters_stack.visible_child_name == "search") {
@@ -361,6 +399,7 @@ namespace Pamac {
packages_stackswitcher.visible = false;
}
}
#endif
void try_lock_and_run (TransactionAction action) {
if (transaction.get_lock ()) {
@@ -411,7 +450,11 @@ namespace Pamac {
// fix an possible visibility issue
transaction_infobox.show_all ();
} else {
#if DISABLE_AUR
uint total_pending = transaction.to_install.length + transaction.to_remove.length;
#else
uint total_pending = transaction.to_install.length + transaction.to_remove.length + transaction.to_build.length;
#endif
if (total_pending == 0) {
transaction.progress_box.action_label.label = "";
cancel_button.sensitive = false;
@@ -601,6 +644,8 @@ namespace Pamac {
reinstall_togglebutton.visible = true;
reinstall_togglebutton.active = transaction.to_install.contains (details.name);
}
#if DISABLE_AUR
#else
} else {
transaction.get_aur_details.begin (details.name, (obj, res) => {
AURPackageDetails aur_details = transaction.get_aur_details.end (res);
@@ -616,6 +661,7 @@ namespace Pamac {
}
}
});
#endif
}
} else if (details.origin == 3) { //Alpm.Package.From.SYNCDB
remove_togglebutton.visible = false;
@@ -726,6 +772,8 @@ namespace Pamac {
}
}
#if DISABLE_AUR
#else
void set_aur_details (string pkgname) {
name_label.set_text ("");
desc_label.set_text ("");
@@ -826,6 +874,7 @@ namespace Pamac {
this.get_window ().set_cursor (null);
});
}
#endif
[GtkCallback]
void on_install_togglebutton_toggled () {
@@ -833,14 +882,20 @@ namespace Pamac {
install_togglebutton.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
if (transaction.get_pkg_origin (current_package_displayed) == 3) { //Alpm.Package.From.SYNCDB
transaction.to_install.add (current_package_displayed);
#if DISABLE_AUR
#else
} else {
transaction.to_build.add (current_package_displayed);
#endif
}
} else {
install_togglebutton.get_style_context ().remove_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
if (transaction.to_install.remove (current_package_displayed)) {
#if DISABLE_AUR
#else
} else {
transaction.to_build.remove (current_package_displayed);
#endif
}
}
set_pendings_operations ();
@@ -871,14 +926,20 @@ namespace Pamac {
AlpmPackage find_pkg = transaction.get_sync_pkg (current_package_displayed);
if (find_pkg.name != "") {
transaction.to_install.add (current_package_displayed);
#if DISABLE_AUR
#else
} else {
// availability in AUR was checked in set_package_details
transaction.to_build.add (current_package_displayed);
#endif
}
} else {
reinstall_togglebutton.get_style_context ().remove_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
transaction.to_install.remove (current_package_displayed);
#if DISABLE_AUR
#else
transaction.to_build.remove (current_package_displayed);
#endif
}
set_pendings_operations ();
}
@@ -915,6 +976,8 @@ namespace Pamac {
this.get_window ().set_cursor (null);
}
#if DISABLE_AUR
#else
void populate_aur_list (AURPackage[] pkgs) {
// populate liststore
aur_treeview.freeze_notify ();
@@ -941,14 +1004,21 @@ namespace Pamac {
aur_treeview.thaw_notify ();
this.get_window ().set_cursor (null);
}
#endif
void refresh_packages_list () {
switch (filters_stack.visible_child_name) {
case "search":
#if DISABLE_AUR
#else
aur_list.clear ();
#endif
filters_stack.visible = true;
set_pendings_operations ();
#if DISABLE_AUR
#else
packages_stackswitcher.visible = transaction.enable_aur;
#endif
if (packages_stack.visible_child_name == "updated") {
packages_stack.visible_child_name = "repos";
}
@@ -983,7 +1053,10 @@ namespace Pamac {
break;
case "updates":
packages_list.clear ();
#if DISABLE_AUR
#else
aur_list.clear ();
#endif
var attention_val = GLib.Value (typeof (bool));
attention_val.set_boolean (false);
filters_stack.child_set_property (filters_stack.get_child_by_name ("updates"),
@@ -1007,11 +1080,14 @@ namespace Pamac {
set_package_details (current_package_displayed);
}
#if DISABLE_AUR
#else
void display_aur_properties (string pkgname) {
current_package_displayed = pkgname;
files_scrolledwindow.visible = false;
set_aur_details (current_package_displayed);
}
#endif
[GtkCallback]
void on_packages_treeview_row_activated (Gtk.TreeView treeview, Gtk.TreePath path, Gtk.TreeViewColumn column) {
@@ -1057,6 +1133,8 @@ namespace Pamac {
while (Gtk.events_pending ()) {
Gtk.main_iteration ();
}
#if DISABLE_AUR
#else
transaction.get_aur_details.begin (depstring, (obj, res) => {
this.get_window ().set_cursor (null);
if (transaction.get_aur_details.end (res).name != "") {
@@ -1073,6 +1151,7 @@ namespace Pamac {
}
}
});
#endif
}
}
}
@@ -1127,6 +1206,8 @@ namespace Pamac {
set_pendings_operations ();
}
#if DISABLE_AUR
#else
[GtkCallback]
void on_aur_treeview_row_activated (Gtk.TreeView treeview, Gtk.TreePath path, Gtk.TreeViewColumn column) {
if (column.title == dgettext (null, "Name")) {
@@ -1171,6 +1252,7 @@ namespace Pamac {
}
set_pendings_operations ();
}
#endif
[GtkCallback]
public void on_button_back_clicked () {
@@ -1179,6 +1261,8 @@ namespace Pamac {
AlpmPackage pkg = transaction.get_installed_pkg (pkgname);
if (pkg.name == "") {
pkg = transaction.get_sync_pkg (pkgname);
#if DISABLE_AUR
#else
}
if (pkg.name == "") {
transaction.get_aur_details.begin (pkgname, (obj, res) => {
@@ -1194,6 +1278,7 @@ namespace Pamac {
}
}
});
#endif
} else {
display_package_properties (pkgname);
}
@@ -1208,9 +1293,12 @@ namespace Pamac {
transaction.to_install.add (pkgname);
}
}
#if DISABLE_AUR
#else
foreach (unowned string pkgname in selected_aur) {
transaction.to_build.add (pkgname);
}
#endif
set_pendings_operations ();
}
@@ -1219,9 +1307,12 @@ namespace Pamac {
if (selected_pkgs.length () == 1) {
display_package_properties (selected_pkgs.data);
main_stack.visible_child_name = "details";
#if DISABLE_AUR
#else
} else if (selected_aur.length () == 1) {
display_aur_properties (selected_aur.data);
main_stack.visible_child_name = "details";
#endif
}
}
@@ -1246,6 +1337,8 @@ namespace Pamac {
transaction.to_remove.remove (pkgname);
}
}
#if DISABLE_AUR
#else
foreach (unowned string pkgname in selected_aur) {
if (transaction.to_build.remove (pkgname)) {
} else {
@@ -1253,6 +1346,7 @@ namespace Pamac {
transaction.temporary_ignorepkgs.add (pkgname);
}
}
#endif
set_pendings_operations ();
}
@@ -1261,10 +1355,13 @@ namespace Pamac {
transaction.temporary_ignorepkgs.remove (pkgname);
transaction.to_update.add (pkgname);
}
#if DISABLE_AUR
#else
foreach (unowned string pkgname in selected_aur) {
transaction.temporary_ignorepkgs.remove (pkgname);
transaction.to_update.add (pkgname);
}
#endif
set_pendings_operations ();
}
@@ -1289,11 +1386,14 @@ namespace Pamac {
populate_packages_list (transaction.search_pkgs.end (res));
});
break;
#if DISABLE_AUR
#else
case "aur":
transaction.search_in_aur.begin (search_string, (obj, res) => {
populate_aur_list (transaction.search_in_aur.end (res));
});
break;
#endif
default:
break;
}
@@ -1302,6 +1402,8 @@ namespace Pamac {
default:
break;
}
#if DISABLE_AUR
#else
if (packages_stack.visible_child_name == "aur") {
var attention_val = GLib.Value (typeof (bool));
attention_val.set_boolean (false);
@@ -1309,6 +1411,7 @@ namespace Pamac {
"needs-attention",
attention_val);
}
#endif
}
[GtkCallback]
@@ -1325,7 +1428,10 @@ namespace Pamac {
}
GLib.List<Gtk.TreePath> selected_paths = selection.get_selected_rows (null);
selected_pkgs = new GLib.List<string> ();
#if DISABLE_AUR
#else
selected_aur = new GLib.List<string> ();
#endif
deselect_item.sensitive = false;
upgrade_item.sensitive = false;
install_item.sensitive = false;
@@ -1400,6 +1506,8 @@ namespace Pamac {
return false;
}
#if DISABLE_AUR
#else
[GtkCallback]
bool on_aur_treeview_button_press_event (Gdk.EventButton event) {
aur_treeview.grab_focus ();
@@ -1473,6 +1581,7 @@ namespace Pamac {
}
return false;
}
#endif
[GtkCallback]
void on_search_entry_activate () {
@@ -1556,6 +1665,8 @@ namespace Pamac {
// get custom sort by relevance
packages_list.set_sort_column_id (Gtk.TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID, 0);
populate_packages_list (pkgs);
#if DISABLE_AUR
#else
if (transaction.search_aur) {
if (pkgs.length == 0) {
transaction.search_in_aur.begin (search_string, (obj, res) => {
@@ -1575,15 +1686,22 @@ namespace Pamac {
});
}
}
#endif
});
#if DISABLE_AUR
#else
aur_list.clear ();
#endif
break;
#if DISABLE_AUR
#else
case "aur":
transaction.search_in_aur.begin (search_string, (obj, res) => {
populate_aur_list (transaction.search_in_aur.end (res));
});
packages_list.clear ();
break;
#endif
default:
break;
}
@@ -1647,6 +1765,8 @@ namespace Pamac {
}
}
populate_packages_list (pkgs);
#if DISABLE_AUR
#else
if (transaction.to_build.length != 0) {
packages_stackswitcher.visible = true;
AURPackage[] aur_pkgs = {};
@@ -1677,6 +1797,7 @@ namespace Pamac {
});
}
}
#endif
}
}
}
@@ -1817,18 +1938,16 @@ namespace Pamac {
[GtkCallback]
void on_about_button_clicked () {
string[] authors = {"Guillaume Benoit"};
Gtk.show_about_dialog (
this,
"program_name", "Pamac",
"icon_name", "system-software-install",
"logo_icon_name", "system-software-install",
"comments", dgettext (null, "A Gtk3 frontend for libalpm"),
"copyright", "Copyright © 2017 Guillaume Benoit",
"authors", authors,
"copyright", "Copyright © 2017 Chris Cromer\nCopyright © 2017 Guillaume Benoit",
"version", VERSION,
"license_type", Gtk.License.GPL_3_0,
"website", "http://github.com/manjaro/pamac");
"website", "http://github.com/cromnix/pamac-classic");
}
[GtkCallback]
@@ -1837,7 +1956,11 @@ namespace Pamac {
if (transaction_running || sysupgrade_running) {
main_stack.visible_child_name = "term";
} else {
#if DISABLE_AUR
uint total_pending = transaction.to_install.length + transaction.to_remove.length;
#else
uint total_pending = transaction.to_install.length + transaction.to_remove.length + transaction.to_build.length;
#endif
if (total_pending == 0) {
main_stack.visible_child_name = "term";
} else {
@@ -1901,7 +2024,10 @@ namespace Pamac {
} else if (sysupgrade_running) {
sysupgrade_running = false;
transaction.cancel ();
#if DISABLE_AUR
#else
transaction.to_build.remove_all ();
#endif
} else {
transaction.clear_lists ();
set_pendings_operations ();
@@ -1910,8 +2036,11 @@ namespace Pamac {
if (transaction.get_installed_pkg (current_package_displayed).name != ""
|| transaction.get_sync_pkg (current_package_displayed).name != "") {
display_package_properties (current_package_displayed);
#if DISABLE_AUR
#else
} else {
display_aur_properties (current_package_displayed);
#endif
}
}
while (Gtk.events_pending ()) {
@@ -1938,7 +2067,11 @@ namespace Pamac {
if (filters_stack.visible_child_name == "updates") {
transaction.to_update.remove_all ();
packages_stackswitcher.visible = false;
#if DISABLE_AUR
if ((updates.repos_updates.length) == 0) {
#else
if ((updates.repos_updates.length + updates.aur_updates.length) == 0) {
#endif
filters_stack.visible = false;
if (!refreshing && !transaction_running && !sysupgrade_running) {
transaction_infobox.visible = false;
@@ -1954,6 +2087,8 @@ namespace Pamac {
}
populate_packages_list (updates.repos_updates);
}
#if DISABLE_AUR
#else
if (updates.aur_updates.length > 0) {
packages_stackswitcher.visible = true;
foreach (unowned AURPackage pkg in updates.aur_updates) {
@@ -1966,9 +2101,15 @@ namespace Pamac {
packages_stack.visible_child_name = "aur";
}
}
#endif
set_pendings_operations ();
}
} else if ((updates.repos_updates.length + updates.aur_updates.length) > 0) {
}
#if DISABLE_AUR
else if ((updates.repos_updates.length) > 0) {
#else
else if ((updates.repos_updates.length + updates.aur_updates.length) > 0) {
#endif
this.get_window ().set_cursor (null);
var attention_val = GLib.Value (typeof (bool));
attention_val.set_boolean (true);
@@ -1986,6 +2127,8 @@ namespace Pamac {
cancel_button.sensitive = false;
}
#if DISABLE_AUR
#else
void on_start_building () {
cancel_button.sensitive = true;
}
@@ -1993,6 +2136,7 @@ namespace Pamac {
void on_stop_building () {
cancel_button.sensitive = false;
}
#endif
void on_important_details_outpout (bool must_show) {
if (must_show) {
@@ -2016,8 +2160,11 @@ namespace Pamac {
if (transaction.get_installed_pkg (current_package_displayed).name != ""
|| transaction.get_sync_pkg (current_package_displayed).name != "") {
display_package_properties (current_package_displayed);
#if DISABLE_AUR
#else
} else {
display_aur_properties (current_package_displayed);
#endif
}
} else if (main_stack.visible_child_name == "term") {
button_back.visible = true;
@@ -2028,7 +2175,10 @@ namespace Pamac {
run_sysupgrade ();
} else if (sysupgrade_running) {
sysupgrade_running = false;
#if DISABLE_AUR
#else
transaction.to_build.remove_all ();
#endif
transaction.unlock ();
refresh_packages_list ();
} else {

View File

@@ -0,0 +1 @@
add_dependencies(pamac-system-daemon AUR Pamac)

View File

@@ -0,0 +1,98 @@
### CMakeLists automatically created with AutoVala
### Do not edit
set (DATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}")
set (PKGDATADIR "${DATADIR}/pamac")
set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.0.0")
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.0.0")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/aur )
link_libraries ( ${DEPS_LIBRARIES} -lPamac -lAUR )
link_directories ( ${DEPS_LIBRARY_DIRS} ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/aur )
find_package (Vala REQUIRED)
include (ValaVersion)
ensure_vala_version ("0.38" MINIMUM)
include (ValaPrecompile)
set (VALA_PACKAGES ${VALA_PACKAGES} posix)
set (VALA_PACKAGES ${VALA_PACKAGES} gtk+-3.0)
set (VALA_PACKAGES ${VALA_PACKAGES} json-glib-1.0)
set (VALA_PACKAGES ${VALA_PACKAGES} libalpm)
set (VALA_PACKAGES ${VALA_PACKAGES} libcurl)
set (VALA_PACKAGES ${VALA_PACKAGES} libsoup-2.4)
set (VALA_PACKAGES ${VALA_PACKAGES} polkit-gobject-1)
set (VALA_PACKAGES ${VALA_PACKAGES} gio-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} glib-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gobject-2.0)
set (APP_SOURCES ${APP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Config.vala)
set (APP_SOURCES ${APP_SOURCES} alpm_config.vala)
set (APP_SOURCES ${APP_SOURCES} mirrors_config.vala)
set (APP_SOURCES ${APP_SOURCES} pamac_config.vala)
set (APP_SOURCES ${APP_SOURCES} system_daemon.vala)
set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_BINARY_DIR}/src/Pamac.vapi)
if (NOT DISABLE_AUR)
set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_BINARY_DIR}/src/aur/AUR.vapi)
endif ()
if (DISABLE_AUR)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D DISABLE_AUR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_AUR " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_AUR " )
endif ()
if (KDE_TRAY)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D KDE_TRAY)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DKDE_TRAY " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKDE_TRAY " )
endif ()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --vapidir=${CMAKE_SOURCE_DIR}/src/vapis )
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug") OR (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(COMPILE_OPTIONS ${COMPILE_OPTIONS} "-g")
endif()
vala_precompile(VALA_C pamac-system-daemon
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
OPTIONS
${COMPILE_OPTIONS}
)
add_executable(pamac-system-daemon ${VALA_C})
install(TARGETS
pamac-system-daemon
RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}
)
if(HAVE_VALADOC)
valadoc(pamac-system-daemon
${CMAKE_BINARY_DIR}/valadoc/pamac-system-daemon
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
)
install(DIRECTORY
${CMAKE_BINARY_DIR}/valadoc
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/doc/pamac
)
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeDepends.txt)

View File

@@ -0,0 +1,10 @@
namespace Constants {
public const string DATADIR = "@DATADIR@";
public const string PKGDATADIR = "@PKGDATADIR@";
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string RELEASE_NAME = "@RELEASE_NAME@";
public const string VERSION = "@VERSION@";
#if UNITEST
public const string TESTSRCDIR = "@TESTSRCDIR@";
#endif
}

View File

@@ -0,0 +1,489 @@
/*
* 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,131 @@
/*
* 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,285 @@
/*
* 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 Config {
string conf_path;
HashTable<string,string> _environment_variables;
public bool recurse { get; private set; }
public uint64 refresh_period { get; private set; }
public bool no_update_hide_icon { get; private set; }
public bool enable_aur { get; private set; }
public bool search_aur { get; private set; }
public string aur_build_dir { get; private set; }
public bool check_aur_updates { get; private set; }
public unowned HashTable<string,string> environment_variables {
get {
return _environment_variables;
}
}
public Config (string path) {
conf_path = path;
//get environment variables
_environment_variables = new HashTable<string,string> (str_hash, str_equal);
var utsname = Posix.utsname();
_environment_variables.insert ("HTTP_USER_AGENT", "pamac (%s %s)".printf (utsname.sysname, utsname.machine));
unowned string? variable = Environment.get_variable ("http_proxy");
if (variable != null) {
_environment_variables.insert ("http_proxy", variable);
}
variable = Environment.get_variable ("https_proxy");
if (variable != null) {
_environment_variables.insert ("https_proxy", variable);
}
variable = Environment.get_variable ("ftp_proxy");
if (variable != null) {
_environment_variables.insert ("ftp_proxy", variable);
}
variable = Environment.get_variable ("socks_proxy");
if (variable != null) {
_environment_variables.insert ("socks_proxy", variable);
}
variable = Environment.get_variable ("no_proxy");
if (variable != null) {
_environment_variables.insert ("no_proxy", variable);
}
// set default option
refresh_period = 6;
reload ();
}
public void reload () {
// set default options
recurse = false;
no_update_hide_icon = false;
enable_aur = false;
search_aur = false;
aur_build_dir = "/tmp";
check_aur_updates = false;
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 ();
if (key == "RemoveUnrequiredDeps") {
recurse = true;
} else if (key == "RefreshPeriod") {
if (splitted.length == 2) {
unowned string val = splitted[1]._strip ();
refresh_period = uint64.parse (val);
}
} else if (key == "NoUpdateHideIcon") {
no_update_hide_icon = true;
} else if (key == "EnableAUR") {
enable_aur = true;
} else if (key == "SearchInAURByDefault") {
search_aur = true;
} else if (key == "BuildDirectory") {
if (splitted.length == 2) {
aur_build_dir = splitted[1]._strip ();
}
} else if (key == "CheckAURUpdates") {
check_aur_updates = true;
}
}
} 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);
var data = new GLib.List<string> ();
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) {
data.append ("\n");
continue;
}
unowned Variant variant;
if (line.contains ("RemoveUnrequiredDeps")) {
if (new_conf.lookup_extended ("RemoveUnrequiredDeps", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("RemoveUnrequiredDeps\n");
} else {
data.append ("#RemoveUnrequiredDeps\n");
}
new_conf.remove ("RemoveUnrequiredDeps");
} else {
data.append (line + "\n");
}
} else if (line.contains ("RefreshPeriod")) {
if (new_conf.lookup_extended ("RefreshPeriod", null, out variant)) {
data.append ("RefreshPeriod = %llu\n".printf (variant.get_uint64 ()));
new_conf.remove ("RefreshPeriod");
} else {
data.append (line + "\n");
}
} else if (line.contains ("NoUpdateHideIcon")) {
if (new_conf.lookup_extended ("NoUpdateHideIcon", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("NoUpdateHideIcon\n");
} else {
data.append ("#NoUpdateHideIcon\n");
}
new_conf.remove ("NoUpdateHideIcon");
} else {
data.append (line + "\n");
}
} else if (line.contains ("EnableAUR")) {
if (new_conf.lookup_extended ("EnableAUR", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("EnableAUR\n");
} else {
data.append ("#EnableAUR\n");
}
new_conf.remove ("EnableAUR");
} else {
data.append (line + "\n");
}
} else if (line.contains ("SearchInAURByDefault")) {
if (new_conf.lookup_extended ("SearchInAURByDefault", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("SearchInAURByDefault\n");
} else {
data.append ("#SearchInAURByDefault\n");
}
new_conf.remove ("SearchInAURByDefault");
} else {
data.append (line + "\n");
}
} else if (line.contains ("BuildDirectory")) {
if (new_conf.lookup_extended ("BuildDirectory", null, out variant)) {
data.append ("BuildDirectory = %s\n".printf (variant.get_string ()));
new_conf.remove ("BuildDirectory");
} else {
data.append (line + "\n");
}
} else if (line.contains ("CheckAURUpdates")) {
if (new_conf.lookup_extended ("CheckAURUpdates", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("CheckAURUpdates\n");
} else {
data.append ("#CheckAURUpdates\n");
}
new_conf.remove ("CheckAURUpdates");
} else {
data.append (line + "\n");
}
} else {
data.append (line + "\n");
}
}
// delete the file before rewrite it
file.delete ();
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", conf_path);
}
// create lines for unexisted options
if (new_conf.size () != 0) {
data.append ("\n");
var iter = HashTableIter<string,Variant> (new_conf);
unowned string key;
unowned Variant val;
while (iter.next (out key, out val)) {
if (key == "RemoveUnrequiredDeps") {
if (val.get_boolean ()) {
data.append ("RemoveUnrequiredDeps\n");
} else {
data.append ("#RemoveUnrequiredDeps\n");
}
} else if (key == "RefreshPeriod") {
data.append ("RefreshPeriod = %llu\n".printf (val.get_uint64 ()));
} else if (key =="NoUpdateHideIcon") {
if (val.get_boolean ()) {
data.append ("NoUpdateHideIcon\n");
} else {
data.append ("#NoUpdateHideIcon\n");
}
} else if (key == "EnableAUR") {
if (val.get_boolean ()) {
data.append ("EnableAUR\n");
} else {
data.append ("#EnableAUR\n");
}
} else if (key == "SearchInAURByDefault") {
if (val.get_boolean ()) {
data.append ("SearchInAURByDefault\n");
} else {
data.append ("#SearchInAURByDefault\n");
}
} else if (key == "BuildDirectory") {
data.append ("BuildDirectory = %s\n".printf (val.get_string ()));
} else if (key == "CheckAURUpdates") {
if (val.get_boolean ()) {
data.append ("CheckAURUpdates\n");
} else {
data.append ("#CheckAURUpdates\n");
}
}
}
}
// write the file
try {
// 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);
}
}
}
}

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -37,7 +38,7 @@ public class AlpmAction {
}
namespace Pamac {
[DBus (name = "org.manjaro.pamac.system")]
[DBus (name = "org.pamac.system")]
public class SystemDaemon: Object {
private AlpmConfig alpm_config;
private Alpm.Handle? alpm_handle;
@@ -48,25 +49,40 @@ namespace Pamac {
private bool refreshed;
private bool force_refresh;
private bool enable_downgrade;
#if DISABLE_AUR
#else
private bool check_aur_updates;
private bool aur_updates_checked;
#endif
private HashTable<string,Variant> new_alpm_conf;
private Alpm.TransFlag flags;
private string[] to_install;
private string[] to_remove;
private string[] to_load;
#if DISABLE_AUR
#else
private string[] to_build;
private UpdateInfos[] to_build_infos;
private GLib.List<string> aur_pkgbases_to_build;
private GenericSet<string?> aur_desc_list;
private GenericSet<string?> already_checked_aur_dep;
#endif
private HashTable<string, string> to_install_as_dep;
#if DISABLE_AUR
#else
private string aurdb_path;
#endif
private string[] temporary_ignorepkgs;
#if DISABLE_AUR
#else
private UpdateInfos[] aur_conflicts_to_remove;
#endif
private ThreadPool<AlpmAction> thread_pool;
private BusName lock_id;
#if DISABLE_AUR
#else
private Json.Array aur_updates_results;
#endif
private GLib.File lockfile;
public ErrorInfos current_error;
public Timer timer;
@@ -86,8 +102,12 @@ namespace Pamac {
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);
@@ -95,12 +115,18 @@ namespace Pamac {
public SystemDaemon () {
alpm_config = new AlpmConfig ("/etc/pacman.conf");
#if DISABLE_AUR
#else
aur_pkgbases_to_build = new GLib.List<string> ();
aur_desc_list = new GenericSet<string?> (str_hash, str_equal);
already_checked_aur_dep = new GenericSet<string?> (str_hash, str_equal);
#endif
to_install_as_dep = new HashTable<string, string> (str_hash, str_equal);
#if DISABLE_AUR
#else
aurdb_path = "/tmp/pamac-aur";
aur_updates_results = new Json.Array ();
#endif
timer = new Timer ();
lock_id = new BusName ("");
refresh_handle ();
@@ -297,7 +323,7 @@ namespace Pamac {
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
authority.check_authorization.begin (
subject,
"org.manjaro.pamac.commit",
"org.pamac.commit",
null,
Polkit.CheckAuthorizationFlags.ALLOW_USER_INTERACTION,
null,
@@ -338,8 +364,12 @@ namespace Pamac {
pamac_config.write (new_pamac_conf);
pamac_config.reload ();
}
#if DISABLE_AUR
write_pamac_config_finished (pamac_config.recurse, pamac_config.refresh_period, pamac_config.no_update_hide_icon);
#else
write_pamac_config_finished (pamac_config.recurse, pamac_config.refresh_period, pamac_config.no_update_hide_icon,
pamac_config.enable_aur, pamac_config.search_aur, pamac_config.aur_build_dir, pamac_config.check_aur_updates);
#endif
});
}
@@ -583,6 +613,8 @@ namespace Pamac {
return pkg;
}
#if DISABLE_AUR
#else
private AURPackage initialise_aur_struct (Json.Object json_object) {
string installed_version = "";
unowned Alpm.Package? pkg = alpm_handle.localdb.get_pkg (json_object.get_string_member ("Name"));
@@ -743,6 +775,7 @@ namespace Pamac {
yield check_aur_dep_list (dep_to_check);
}
}
#endif
private void get_updates () {
AlpmPackage[] updates_infos = {};
@@ -762,8 +795,12 @@ namespace Pamac {
if (updates_infos.length != 0) {
var updates = Updates () {
is_syncfirst = true,
#if DISABLE_AUR
repos_updates = (owned) updates_infos
#else
repos_updates = (owned) updates_infos,
aur_updates = {}
#endif
};
get_updates_finished (updates);
} else {
@@ -778,6 +815,8 @@ namespace Pamac {
var infos = initialise_pkg_struct (candidate);
infos.installed_version = installed_pkg.version;
updates_infos += (owned) infos;
#if DISABLE_AUR
#else
} else {
if (check_aur_updates && (!aur_updates_checked)) {
// check if installed_pkg is a local pkg
@@ -794,10 +833,13 @@ namespace Pamac {
local_pkgs += installed_pkg.name;
}
}
#endif
}
}
pkgcache.next ();
}
#if DISABLE_AUR
#else
if (check_aur_updates) {
// get aur updates
if (!aur_updates_checked) {
@@ -820,16 +862,26 @@ namespace Pamac {
get_updates_finished (updates);
}
} else {
#endif
var updates = Updates () {
is_syncfirst = false,
#if DISABLE_AUR
repos_updates = (owned) updates_infos
#else
repos_updates = (owned) updates_infos,
aur_updates = {}
#endif
};
get_updates_finished (updates);
#if DISABLE_AUR
#else
}
#endif
}
}
#if DISABLE_AUR
#else
private AURPackage[] get_aur_updates_infos () {
AURPackage[] aur_updates_infos = {};
aur_updates_results.foreach_element ((array, index, node) => {
@@ -845,9 +897,14 @@ namespace Pamac {
});
return aur_updates_infos;
}
#endif
#if DISABLE_AUR
public void start_get_updates () {
#else
public void start_get_updates (bool check_aur_updates_) {
check_aur_updates = check_aur_updates_;
#endif
try {
thread_pool.add (new AlpmAction (get_updates));
} catch (ThreadError e) {
@@ -1165,6 +1222,8 @@ namespace Pamac {
trans_prepare_finished (success);
}
#if DISABLE_AUR
#else
private void build_prepare () {
// create a fake aur db
try {
@@ -1343,13 +1402,22 @@ namespace Pamac {
}
}
}
#endif
#if DISABLE_AUR
public void start_trans_prepare (Alpm.TransFlag flags_,
string[] to_install_,
string[] to_remove_,
string[] to_load_,
GLib.BusName sender) {
#else
public void start_trans_prepare (Alpm.TransFlag flags_,
string[] to_install_,
string[] to_remove_,
string[] to_load_,
string[] to_build_,
GLib.BusName sender) {
#endif
if (lock_id != sender) {
trans_prepare_finished (false);
return;
@@ -1358,6 +1426,8 @@ namespace Pamac {
to_install = to_install_;
to_remove = to_remove_;
to_load = to_load_;
#if DISABLE_AUR
#else
to_build = to_build_;
to_build_infos = {};
aur_pkgbases_to_build = new GLib.List<string> ();
@@ -1370,12 +1440,16 @@ namespace Pamac {
}
});
} else {
#endif
try {
thread_pool.add (new AlpmAction (trans_prepare));
} catch (ThreadError e) {
stderr.printf ("Thread Error %s\n", e.message);
}
#if DISABLE_AUR
#else
}
#endif
}
public void choose_provider (int provider) {
@@ -1430,6 +1504,8 @@ namespace Pamac {
pkgs_to_remove.next ();
}
UpdateInfos[] conflicts_to_remove = {};
#if DISABLE_AUR
#else
foreach (unowned UpdateInfos infos in aur_conflicts_to_remove){
conflicts_to_remove += infos;
}
@@ -1438,15 +1514,20 @@ namespace Pamac {
foreach (unowned string name in aur_pkgbases_to_build) {
pkgbases_to_build += name;
}
#endif
var summary = TransactionSummary () {
to_install = (owned) to_install,
to_upgrade = (owned) to_upgrade,
to_downgrade = (owned) to_downgrade,
to_reinstall = (owned) to_reinstall,
#if DISABLE_AUR
to_remove = (owned) to_remove
#else
to_remove = (owned) to_remove,
to_build = to_build_infos,
aur_conflicts_to_remove = conflicts_to_remove,
aur_pkgbases_to_build = pkgbases_to_build
#endif
};
return summary;
}
@@ -1976,7 +2057,7 @@ private void cb_log (Alpm.LogLevel level, string fmt, va_list args) {
void on_bus_acquired (DBusConnection conn) {
system_daemon = new Pamac.SystemDaemon ();
try {
conn.register_object ("/org/manjaro/pamac/system", system_daemon);
conn.register_object ("/org/pamac/system", system_daemon);
}
catch (IOError e) {
stderr.printf ("Could not register service\n");
@@ -1990,7 +2071,7 @@ void main () {
Intl.textdomain (GETTEXT_PACKAGE);
Bus.own_name (BusType.SYSTEM,
"org.manjaro.pamac.system",
"org.pamac.system",
BusNameOwnerFlags.NONE,
on_bus_acquired,
null,

View File

@@ -0,0 +1 @@
add_dependencies(pamac-tray Pamac AUR)

View File

@@ -0,0 +1,106 @@
### CMakeLists automatically created with AutoVala
### Do not edit
set (DATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}")
set (PKGDATADIR "${DATADIR}/pamac")
set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.0.0")
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.0.0")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/aur )
link_libraries ( ${DEPS_LIBRARIES} -lPamac -lAUR )
link_directories ( ${DEPS_LIBRARY_DIRS} ${CMAKE_BINARY_DIR}/src ${CMAKE_BINARY_DIR}/src/aur )
find_package (Vala REQUIRED)
include (ValaVersion)
ensure_vala_version ("0.38" MINIMUM)
include (ValaPrecompile)
set (VALA_PACKAGES ${VALA_PACKAGES} posix)
set (VALA_PACKAGES ${VALA_PACKAGES} json-glib-1.0)
set (VALA_PACKAGES ${VALA_PACKAGES} libnotify)
if (KDE_TRAY)
set (VALA_PACKAGES ${VALA_PACKAGES} appindicator3-0.1)
else ()
set (VALA_PACKAGES ${VALA_PACKAGES} gtk+-3.0)
endif ()
set (VALA_PACKAGES ${VALA_PACKAGES} gio-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} glib-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gobject-2.0)
set (APP_SOURCES ${APP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Config.vala)
if (KDE_TRAY)
set (APP_SOURCES ${APP_SOURCES} tray-appindicator.vala)
else ()
set (APP_SOURCES ${APP_SOURCES} tray-gtk.vala)
endif ()
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)
set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_BINARY_DIR}/src/aur/AUR.vapi)
endif ()
if (DISABLE_AUR)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D DISABLE_AUR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_AUR " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_AUR " )
endif ()
if (KDE_TRAY)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D KDE_TRAY)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DKDE_TRAY " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKDE_TRAY " )
endif ()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --vapidir=${CMAKE_SOURCE_DIR}/src/vapis )
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug") OR (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(COMPILE_OPTIONS ${COMPILE_OPTIONS} "-g")
endif()
vala_precompile(VALA_C pamac-tray
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
OPTIONS
${COMPILE_OPTIONS}
)
add_executable(pamac-tray ${VALA_C})
install(TARGETS
pamac-tray
RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}
)
if(HAVE_VALADOC)
valadoc(pamac-tray
${CMAKE_BINARY_DIR}/valadoc/pamac-tray
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
)
install(DIRECTORY
${CMAKE_BINARY_DIR}/valadoc
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/doc/pamac
)
endif()
if (KDE_TRAY)
else ()
endif ()
include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeDepends.txt)

View File

@@ -0,0 +1,10 @@
namespace Constants {
public const string DATADIR = "@DATADIR@";
public const string PKGDATADIR = "@PKGDATADIR@";
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string RELEASE_NAME = "@RELEASE_NAME@";
public const string VERSION = "@VERSION@";
#if UNITEST
public const string TESTSRCDIR = "@TESTSRCDIR@";
#endif
}

View File

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

View File

@@ -1,6 +1,7 @@
/*
* 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

View File

@@ -1,6 +1,7 @@
/*
* 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

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -25,15 +26,7 @@ const string noupdate_icon_name = "pamac-tray-no-update";
const string noupdate_info = _("Your system is up-to-date");
namespace Pamac {
[DBus (name = "org.manjaro.pamac.user")]
interface UserDaemon : Object {
public abstract void refresh_handle () throws IOError;
public abstract string get_lockfile () throws IOError;
public abstract void start_get_updates (bool check_aur_updates) throws IOError;
[DBus (no_reply = true)]
public abstract void quit () throws IOError;
public signal void get_updates_finished (Updates updates);
}
[DBus (name = "org.pamac.user")]
public abstract class TrayIcon: Gtk.Application {
Notify.Notification notification;
@@ -44,7 +37,7 @@ namespace Pamac {
GLib.File lockfile;
public TrayIcon () {
application_id = "org.manjaro.pamac.tray";
application_id = "org.pamac.tray";
flags = ApplicationFlags.FLAGS_NONE;
}
@@ -52,7 +45,7 @@ namespace Pamac {
void start_daemon () {
try {
daemon = Bus.get_proxy_sync (BusType.SESSION, "org.manjaro.pamac.user", "/org/manjaro/pamac/user");
daemon = Bus.get_proxy_sync (BusType.SESSION, "org.pamac.user", "/org/pamac/user");
daemon.get_updates_finished.connect (on_get_updates_finished);
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
@@ -117,7 +110,11 @@ namespace Pamac {
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
if (pamac_config.refresh_period != 0) {
try {
#if DISABLE_AUR
daemon.start_get_updates ();
#else
daemon.start_get_updates (pamac_config.enable_aur && pamac_config.check_aur_updates);
#endif
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
@@ -126,7 +123,11 @@ namespace Pamac {
}
void on_get_updates_finished (Updates updates) {
#if DISABLE_AUR
uint updates_nb = updates.repos_updates.length;
#else
uint updates_nb = updates.repos_updates.length + updates.aur_updates.length;
#endif
if (updates_nb == 0) {
set_icon (noupdate_icon_name);
set_tooltip (noupdate_info);
@@ -187,7 +188,7 @@ namespace Pamac {
bool check_pamac_running () {
Application app;
bool run = false;
app = new Application ("org.manjaro.pamac.manager", 0);
app = new Application ("org.pamac.manager", 0);
try {
app.register ();
} catch (GLib.Error e) {
@@ -197,7 +198,7 @@ namespace Pamac {
if (run) {
return run;
}
app = new Application ("org.manjaro.pamac.installer", 0);
app = new Application ("org.pamac.installer", 0);
try {
app.register ();
} catch (GLib.Error e) {

View File

@@ -0,0 +1,61 @@
/*
* 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

@@ -0,0 +1 @@
add_dependencies(pamac-user-daemon Pamac AUR)

View File

@@ -0,0 +1,92 @@
### CMakeLists automatically created with AutoVala
### Do not edit
set (DATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}")
set (PKGDATADIR "${DATADIR}/pamac")
set (GETTEXT_PACKAGE "pamac")
set (RELEASE_NAME "pamac")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "6.0.0")
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.0.0")
add_definitions (${DEPS_CFLAGS})
include_directories ( ${CMAKE_BINARY_DIR}/src/aur ${CMAKE_BINARY_DIR}/src )
link_libraries ( ${DEPS_LIBRARIES} -lAUR -lPamac )
link_directories ( ${DEPS_LIBRARY_DIRS} ${CMAKE_BINARY_DIR}/src/aur ${CMAKE_BINARY_DIR}/src )
find_package (Vala REQUIRED)
include (ValaVersion)
ensure_vala_version ("0.38" MINIMUM)
include (ValaPrecompile)
set (VALA_PACKAGES ${VALA_PACKAGES} posix)
set (VALA_PACKAGES ${VALA_PACKAGES} gtk+-3.0)
set (VALA_PACKAGES ${VALA_PACKAGES} json-glib-1.0)
set (VALA_PACKAGES ${VALA_PACKAGES} libalpm)
set (VALA_PACKAGES ${VALA_PACKAGES} libsoup-2.4)
set (VALA_PACKAGES ${VALA_PACKAGES} gio-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} glib-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gobject-2.0)
set (APP_SOURCES ${APP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Config.vala)
set (APP_SOURCES ${APP_SOURCES} alpm_config.vala)
set (APP_SOURCES ${APP_SOURCES} user_daemon.vala)
set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_BINARY_DIR}/src/aur/AUR.vapi)
set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_BINARY_DIR}/src/Pamac.vapi)
if (DISABLE_AUR)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D DISABLE_AUR)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_AUR " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_AUR " )
endif ()
if (KDE_TRAY)
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D KDE_TRAY)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DKDE_TRAY " )
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKDE_TRAY " )
endif ()
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --vapidir=${CMAKE_SOURCE_DIR}/src/vapis )
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug") OR (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
set(COMPILE_OPTIONS ${COMPILE_OPTIONS} "-g")
endif()
vala_precompile(VALA_C pamac-user-daemon
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
OPTIONS
${COMPILE_OPTIONS}
)
add_executable(pamac-user-daemon ${VALA_C})
install(TARGETS
pamac-user-daemon
RUNTIME DESTINATION
${CMAKE_INSTALL_BINDIR}
)
if(HAVE_VALADOC)
valadoc(pamac-user-daemon
${CMAKE_BINARY_DIR}/valadoc/pamac-user-daemon
${APP_SOURCES}
PACKAGES
${VALA_PACKAGES}
CUSTOM_VAPIS
${CUSTOM_VAPIS_LIST}
)
install(DIRECTORY
${CMAKE_BINARY_DIR}/valadoc
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/doc/pamac
)
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeDepends.txt)

View File

@@ -0,0 +1,10 @@
namespace Constants {
public const string DATADIR = "@DATADIR@";
public const string PKGDATADIR = "@PKGDATADIR@";
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string RELEASE_NAME = "@RELEASE_NAME@";
public const string VERSION = "@VERSION@";
#if UNITEST
public const string TESTSRCDIR = "@TESTSRCDIR@";
#endif
}

View File

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

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -23,69 +24,17 @@ const string GETTEXT_PACKAGE = "pamac";
Pamac.UserDaemon user_daemon;
MainLoop loop;
private int alpm_pkg_compare_name (Alpm.Package pkg_a, Alpm.Package pkg_b) {
return strcmp (pkg_a.name, pkg_b.name);
}
private string global_search_string;
private int alpm_pkg_sort_search_by_relevance (Alpm.Package pkg_a, Alpm.Package pkg_b) {
if (global_search_string != null) {
// display exact match first
if (pkg_a.name == global_search_string) {
return 0;
}
if (pkg_b.name == global_search_string) {
return 1;
}
if (pkg_a.name.has_prefix (global_search_string + "-")) {
if (pkg_b.name.has_prefix (global_search_string + "-")) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 0;
}
if (pkg_b.name.has_prefix (global_search_string + "-")) {
if (pkg_a.name.has_prefix (global_search_string + "-")) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 1;
}
if (pkg_a.name.has_prefix (global_search_string)) {
if (pkg_b.name.has_prefix (global_search_string)) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 0;
}
if (pkg_b.name.has_prefix (global_search_string)) {
if (pkg_a.name.has_prefix (global_search_string)) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 1;
}
if (pkg_a.name.contains (global_search_string)) {
if (pkg_b.name.contains (global_search_string)) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 0;
}
if (pkg_b.name.contains (global_search_string)) {
if (pkg_a.name.contains (global_search_string)) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 1;
}
}
return strcmp (pkg_a.name, pkg_b.name);
}
namespace Pamac {
[DBus (name = "org.manjaro.pamac.user")]
[DBus (name = "org.pamac.user")]
public class UserDaemon: Object {
private AlpmConfig alpm_config;
private Alpm.Handle? alpm_handle;
private Alpm.Handle? files_handle;
#if DISABLE_AUR
#else
private bool check_aur_updates;
private bool aur_updates_checked;
#endif
private Json.Array aur_updates_results;
private HashTable<string, Json.Array> aur_search_results;
private HashTable<string, Json.Object> aur_infos;
@@ -94,9 +43,12 @@ namespace Pamac {
public UserDaemon () {
alpm_config = new AlpmConfig ("/etc/pacman.conf");
#if DISABLE_AUR
#else
aur_updates_results = new Json.Array ();
aur_search_results = new HashTable<string, Json.Array> (str_hash, str_equal);
aur_infos = new HashTable<string, Json.Object> (str_hash, str_equal);
#endif
refresh_handle ();
}
@@ -348,6 +300,8 @@ namespace Pamac {
return result;
}
#if DISABLE_AUR
#else
private AURPackage initialise_aur_struct (Json.Object json_object) {
string installed_version = "";
unowned Alpm.Package? pkg = alpm_handle.localdb.get_pkg (json_object.get_string_member ("Name"));
@@ -522,6 +476,7 @@ namespace Pamac {
details.conflicts = (owned) conflicts;
return details;
}
#endif
public string[] get_repos_names () {
string[] repos_names = {};
@@ -563,7 +518,7 @@ namespace Pamac {
unowned Alpm.List<unowned Alpm.Group> groupcache = alpm_handle.localdb.groupcache;
while (groupcache != null) {
unowned Alpm.Group group = groupcache.data;
if (!(group.name in groups_names)) {
if (!(group.name in groups_names)) {
groups_names += group.name;
}
groupcache.next ();
@@ -574,7 +529,7 @@ namespace Pamac {
groupcache = db.groupcache;
while (groupcache != null) {
unowned Alpm.Group group = groupcache.data;
if (!(group.name in groups_names)) {
if (!(group.name in groups_names)) {
groups_names += group.name;
}
groupcache.next ();
@@ -867,6 +822,8 @@ namespace Pamac {
var infos = initialise_pkg_struct (candidate);
infos.installed_version = installed_pkg.version;
updates_infos += (owned) infos;
#if DISABLE_AUR
#else
} else {
if (check_aur_updates && (!aur_updates_checked)) {
// check if installed_pkg is a local pkg
@@ -883,10 +840,13 @@ namespace Pamac {
local_pkgs += installed_pkg.name;
}
}
#endif
}
}
pkgcache.next ();
}
#if DISABLE_AUR
#else
if (check_aur_updates) {
// get aur updates
if (!aur_updates_checked) {
@@ -907,15 +867,25 @@ namespace Pamac {
get_updates_finished (updates);
}
} else {
#endif
var updates = Updates () {
#if DISABLE_AUR
repos_updates = (owned) updates_infos
#else
repos_updates = (owned) updates_infos,
aur_updates = {}
#endif
};
get_updates_finished (updates);
#if DISABLE_AUR
#else
}
#endif
return 0;
}
#if DISABLE_AUR
#else
private AURPackage[] get_aur_updates_infos () {
AURPackage[] aur_updates_infos = {};
aur_updates_results.foreach_element ((array, index, node) => {
@@ -931,9 +901,14 @@ namespace Pamac {
});
return aur_updates_infos;
}
#endif
#if DISABLE_AUR
public void start_get_updates () {
#else
public void start_get_updates (bool check_aur_updates_) {
check_aur_updates = check_aur_updates_;
#endif
new Thread<int> ("get updates thread", get_updates);
}
@@ -945,10 +920,65 @@ namespace Pamac {
}
}
private int alpm_pkg_compare_name (Alpm.Package pkg_a, Alpm.Package pkg_b) {
return strcmp (pkg_a.name, pkg_b.name);
}
private string global_search_string;
private int alpm_pkg_sort_search_by_relevance (Alpm.Package pkg_a, Alpm.Package pkg_b) {
if (global_search_string != null) {
// display exact match first
if (pkg_a.name == global_search_string) {
return 0;
}
if (pkg_b.name == global_search_string) {
return 1;
}
if (pkg_a.name.has_prefix (global_search_string + "-")) {
if (pkg_b.name.has_prefix (global_search_string + "-")) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 0;
}
if (pkg_b.name.has_prefix (global_search_string + "-")) {
if (pkg_a.name.has_prefix (global_search_string + "-")) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 1;
}
if (pkg_a.name.has_prefix (global_search_string)) {
if (pkg_b.name.has_prefix (global_search_string)) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 0;
}
if (pkg_b.name.has_prefix (global_search_string)) {
if (pkg_a.name.has_prefix (global_search_string)) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 1;
}
if (pkg_a.name.contains (global_search_string)) {
if (pkg_b.name.contains (global_search_string)) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 0;
}
if (pkg_b.name.contains (global_search_string)) {
if (pkg_a.name.contains (global_search_string)) {
return strcmp (pkg_a.name, pkg_b.name);
}
return 1;
}
}
return strcmp (pkg_a.name, pkg_b.name);
}
void on_bus_acquired (DBusConnection conn) {
user_daemon = new Pamac.UserDaemon ();
try {
conn.register_object ("/org/manjaro/pamac/user", user_daemon);
conn.register_object ("/org/pamac/user", user_daemon);
}
catch (IOError e) {
stderr.printf ("Could not register service\n");
@@ -962,7 +992,7 @@ void main () {
Intl.textdomain (GETTEXT_PACKAGE);
Bus.own_name (BusType.SESSION,
"org.manjaro.pamac.user",
"org.pamac.user",
BusNameOwnerFlags.NONE,
on_bus_acquired,
null,

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -25,10 +26,13 @@ namespace Pamac {
public bool recurse { get; private set; }
public uint64 refresh_period { get; private set; }
public bool no_update_hide_icon { get; private set; }
#if DISABLE_AUR
#else
public bool enable_aur { get; private set; }
public bool search_aur { get; private set; }
public string aur_build_dir { get; private set; }
public bool check_aur_updates { get; private set; }
#endif
public unowned HashTable<string,string> environment_variables {
get {
return _environment_variables;
@@ -70,10 +74,13 @@ namespace Pamac {
// set default options
recurse = false;
no_update_hide_icon = false;
#if DISABLE_AUR
#else
enable_aur = false;
search_aur = false;
aur_build_dir = "/tmp";
check_aur_updates = false;
#endif
parse_file (conf_path);
}
@@ -107,6 +114,8 @@ namespace Pamac {
}
} else if (key == "NoUpdateHideIcon") {
no_update_hide_icon = true;
#if DISABLE_AUR
#else
} else if (key == "EnableAUR") {
enable_aur = true;
} else if (key == "SearchInAURByDefault") {
@@ -117,6 +126,7 @@ namespace Pamac {
}
} else if (key == "CheckAURUpdates") {
check_aur_updates = true;
#endif
}
}
} catch (GLib.Error e) {
@@ -126,159 +136,5 @@ 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);
var data = new GLib.List<string> ();
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) {
data.append ("\n");
continue;
}
unowned Variant variant;
if (line.contains ("RemoveUnrequiredDeps")) {
if (new_conf.lookup_extended ("RemoveUnrequiredDeps", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("RemoveUnrequiredDeps\n");
} else {
data.append ("#RemoveUnrequiredDeps\n");
}
new_conf.remove ("RemoveUnrequiredDeps");
} else {
data.append (line + "\n");
}
} else if (line.contains ("RefreshPeriod")) {
if (new_conf.lookup_extended ("RefreshPeriod", null, out variant)) {
data.append ("RefreshPeriod = %llu\n".printf (variant.get_uint64 ()));
new_conf.remove ("RefreshPeriod");
} else {
data.append (line + "\n");
}
} else if (line.contains ("NoUpdateHideIcon")) {
if (new_conf.lookup_extended ("NoUpdateHideIcon", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("NoUpdateHideIcon\n");
} else {
data.append ("#NoUpdateHideIcon\n");
}
new_conf.remove ("NoUpdateHideIcon");
} else {
data.append (line + "\n");
}
} else if (line.contains ("EnableAUR")) {
if (new_conf.lookup_extended ("EnableAUR", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("EnableAUR\n");
} else {
data.append ("#EnableAUR\n");
}
new_conf.remove ("EnableAUR");
} else {
data.append (line + "\n");
}
} else if (line.contains ("SearchInAURByDefault")) {
if (new_conf.lookup_extended ("SearchInAURByDefault", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("SearchInAURByDefault\n");
} else {
data.append ("#SearchInAURByDefault\n");
}
new_conf.remove ("SearchInAURByDefault");
} else {
data.append (line + "\n");
}
} else if (line.contains ("BuildDirectory")) {
if (new_conf.lookup_extended ("BuildDirectory", null, out variant)) {
data.append ("BuildDirectory = %s\n".printf (variant.get_string ()));
new_conf.remove ("BuildDirectory");
} else {
data.append (line + "\n");
}
} else if (line.contains ("CheckAURUpdates")) {
if (new_conf.lookup_extended ("CheckAURUpdates", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("CheckAURUpdates\n");
} else {
data.append ("#CheckAURUpdates\n");
}
new_conf.remove ("CheckAURUpdates");
} else {
data.append (line + "\n");
}
} else {
data.append (line + "\n");
}
}
// delete the file before rewrite it
file.delete ();
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", conf_path);
}
// create lines for unexisted options
if (new_conf.size () != 0) {
data.append ("\n");
var iter = HashTableIter<string,Variant> (new_conf);
unowned string key;
unowned Variant val;
while (iter.next (out key, out val)) {
if (key == "RemoveUnrequiredDeps") {
if (val.get_boolean ()) {
data.append ("RemoveUnrequiredDeps\n");
} else {
data.append ("#RemoveUnrequiredDeps\n");
}
} else if (key == "RefreshPeriod") {
data.append ("RefreshPeriod = %llu\n".printf (val.get_uint64 ()));
} else if (key =="NoUpdateHideIcon") {
if (val.get_boolean ()) {
data.append ("NoUpdateHideIcon\n");
} else {
data.append ("#NoUpdateHideIcon\n");
}
} else if (key == "EnableAUR") {
if (val.get_boolean ()) {
data.append ("EnableAUR\n");
} else {
data.append ("#EnableAUR\n");
}
} else if (key == "SearchInAURByDefault") {
if (val.get_boolean ()) {
data.append ("SearchInAURByDefault\n");
} else {
data.append ("#SearchInAURByDefault\n");
}
} else if (key == "BuildDirectory") {
data.append ("BuildDirectory = %s\n".printf (val.get_string ()));
} else if (key == "CheckAURUpdates") {
if (val.get_boolean ()) {
data.append ("CheckAURUpdates\n");
} else {
data.append ("#CheckAURUpdates\n");
}
}
}
}
// write the file
try {
// 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);
}
}
}
}

View File

@@ -1,6 +1,7 @@
/*
* pamac-vala
*
* Copyright (C) 2017 Chris Cromer <cromer@cromnix.org>
* Copyright (C) 2015-2017 Guillaume Benoit <guillaume@manjaro.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -19,7 +20,11 @@
namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/preferences/preferences_dialog.ui")]
#if DISABLE_AUR
[GtkTemplate (ui = "/org/pamac/preferences/interface/preferences_dialog_no_aur.ui")]
#else
[GtkTemplate (ui = "/org/pamac/preferences/interface/preferences_dialog.ui")]
#endif
class PreferencesDialog : Gtk.Dialog {
[GtkChild]
@@ -46,6 +51,8 @@ namespace Pamac {
Gtk.ComboBoxText mirrors_list_generation_method_comboboxtext;
[GtkChild]
Gtk.Button generate_mirrors_list_button;
#if DISABLE_AUR
#else
[GtkChild]
Gtk.Switch enable_aur_button;
[GtkChild]
@@ -56,6 +63,7 @@ namespace Pamac {
Gtk.FileChooserButton aur_build_dir_file_chooser;
[GtkChild]
Gtk.CheckButton check_aur_updates_checkbutton;
#endif
[GtkChild]
Gtk.Label cache_keep_nb_label;
[GtkChild]
@@ -74,7 +82,10 @@ namespace Pamac {
this.transaction = transaction;
refresh_period_label.set_markup (dgettext (null, "How often to check for updates, value in hours") +":");
cache_keep_nb_label.set_markup (dgettext (null, "Number of versions of each package to keep in the cache") +":");
#if DISABLE_AUR
#else
aur_build_dir_label.set_markup (dgettext (null, "Build directory") +":");
#endif
remove_unrequired_deps_button.active = transaction.recurse;
check_space_button.active = transaction.get_checkspace ();
if (transaction.refresh_period == 0) {
@@ -135,6 +146,8 @@ namespace Pamac {
transaction.write_mirrors_config_finished.connect (on_write_mirrors_config_finished);
}
#if DISABLE_AUR
#else
enable_aur_button.active = transaction.enable_aur;
search_aur_checkbutton.active = transaction.search_aur;
search_aur_checkbutton.sensitive = transaction.enable_aur;
@@ -153,6 +166,7 @@ namespace Pamac {
search_aur_checkbutton.toggled.connect (on_search_aur_checkbutton_toggled);
aur_build_dir_file_chooser.file_set.connect (on_aur_build_dir_set);
check_aur_updates_checkbutton.toggled.connect (on_check_aur_updates_checkbutton_toggled);
#endif
}
bool on_remove_unrequired_deps_button_state_set (bool new_state) {
@@ -189,6 +203,8 @@ namespace Pamac {
transaction.start_write_pamac_config (new_pamac_conf);
}
#if DISABLE_AUR
#else
bool on_enable_aur_button_state_set (bool new_state) {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("EnableAUR", new Variant.boolean (new_state));
@@ -213,9 +229,14 @@ namespace Pamac {
new_pamac_conf.insert ("CheckAURUpdates", new Variant.boolean (check_aur_updates_checkbutton.active));
transaction.start_write_pamac_config (new_pamac_conf);
}
#endif
#if DISABLE_AUR
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) {
#else
void on_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
remove_unrequired_deps_button.state = recurse;
if (refresh_period == 0) {
check_updates_button.state = false;
@@ -233,6 +254,8 @@ namespace Pamac {
ignorepkgs_box.sensitive = true;
}
no_update_hide_icon_checkbutton.active = no_update_hide_icon;
#if DISABLE_AUR
#else
enable_aur_button.state = enable_aur;
search_aur_checkbutton.active = search_aur;
search_aur_checkbutton.sensitive = enable_aur;
@@ -240,6 +263,7 @@ namespace Pamac {
aur_build_dir_file_chooser.sensitive = enable_aur;
check_aur_updates_checkbutton.active = check_aur_updates;
check_aur_updates_checkbutton.sensitive = enable_aur;
#endif
}
bool on_check_space_button_state_set (bool new_state) {

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -17,9 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//using GIO
namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/transaction/progress_box.ui")]
[GtkTemplate (ui = "/org/pamac/transaction/interface/progress_box.ui")]
public class ProgressBox : Gtk.Box {
[GtkChild]

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -18,7 +19,7 @@
*/
namespace Pamac {
[DBus (name = "org.manjaro.pamac.user")]
[DBus (name = "org.pamac.user")]
interface UserDaemon : Object {
public abstract void refresh_handle () throws IOError;
public abstract AlpmPackage get_installed_pkg (string pkgname) throws IOError;
@@ -35,21 +36,31 @@ namespace Pamac {
public abstract AlpmPackage get_sync_pkg (string pkgname) throws IOError;
public abstract AlpmPackage find_sync_satisfier (string depstring) throws IOError;
public abstract async AlpmPackage[] search_pkgs (string search_string) throws IOError;
#if DISABLE_AUR
#else
public abstract async AURPackage[] search_in_aur (string search_string) throws IOError;
#endif
public abstract string[] get_repos_names () throws IOError;
public abstract async AlpmPackage[] get_repo_pkgs (string repo) throws IOError;
public abstract string[] get_groups_names () throws IOError;
public abstract async AlpmPackage[] get_group_pkgs (string groupname) throws IOError;
public abstract AlpmPackageDetails get_pkg_details (string pkgname) throws IOError;
public abstract string[] get_pkg_files (string pkgname) throws IOError;
#if DISABLE_AUR
#else
public abstract async AURPackageDetails get_aur_details (string pkgname) throws IOError;
#endif
public abstract string[] get_pkg_uninstalled_optdeps (string pkgname) 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);
}
[DBus (name = "org.manjaro.pamac.system")]
[DBus (name = "org.pamac.system")]
interface SystemDaemon : Object {
public abstract void set_environment_variables (HashTable<string,string> variables) throws IOError;
public abstract string[] get_mirrors_countries () throws IOError;
@@ -65,13 +76,21 @@ namespace Pamac {
public abstract void start_set_pkgreason (string pkgname, uint reason) throws IOError;
public abstract void start_refresh (bool force) throws IOError;
public abstract void start_sysupgrade_prepare (bool enable_downgrade, string[] temporary_ignorepkgs) throws IOError;
#if DISABLE_AUR
public abstract void start_trans_prepare (int transflags, string[] to_install, string[] to_remove, string[] to_load) throws IOError;
#else
public abstract void start_trans_prepare (int transflags, string[] to_install, string[] to_remove, string[] to_load, string[] to_build) throws IOError;
#endif
public abstract void choose_provider (int provider) throws IOError;
public abstract TransactionSummary get_transaction_summary () throws IOError;
public abstract void start_trans_commit () throws IOError;
public abstract void trans_release () throws IOError;
public abstract void trans_cancel () 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);
@@ -86,8 +105,12 @@ namespace Pamac {
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);
@@ -112,14 +135,17 @@ namespace Pamac {
public Mode mode;
Pamac.Config pamac_config;
#if DISABLE_AUR
#else
public bool check_aur_updates { get { return pamac_config.check_aur_updates; } }
public bool enable_aur { get { return pamac_config.enable_aur; } }
public bool search_aur { get { return pamac_config.search_aur; } }
public string aur_build_dir { get { return pamac_config.aur_build_dir; } }
#endif
public unowned GLib.HashTable<string,string> environment_variables { get {return pamac_config.environment_variables; } }
public bool no_update_hide_icon { get { return pamac_config.no_update_hide_icon; } }
public bool recurse { get { return pamac_config.recurse; } }
public uint64 refresh_period { get { return pamac_config.refresh_period; } }
public bool search_aur { get { return pamac_config.search_aur; } }
public string aur_build_dir { get { return pamac_config.aur_build_dir; } }
//Alpm.TransFlag
int flags;
@@ -127,10 +153,16 @@ namespace Pamac {
public GenericSet<string?> to_install;
public GenericSet<string?> to_remove;
public GenericSet<string?> to_load;
#if DISABLE_AUR
#else
public GenericSet<string?> to_build;
#endif
public GenericSet<string?> to_update;
#if DISABLE_AUR
#else
Queue<string> to_build_queue;
string[] aur_pkgs_to_install;
#endif
GenericSet<string?> previous_to_install;
GenericSet<string?> previous_to_remove;
public GenericSet<string?> transaction_summary;
@@ -145,8 +177,11 @@ namespace Pamac {
bool sysupgrade_after_trans;
bool enable_downgrade;
bool no_confirm_commit;
#if DISABLE_AUR
#else
bool build_after_sysupgrade;
bool building;
#endif
uint64 previous_xfered;
uint64 download_rate;
uint64 rates_nb;
@@ -159,20 +194,30 @@ namespace Pamac {
public ProgressBox progress_box;
Vte.Terminal term;
Vte.Pty pty;
#if DISABLE_AUR
#else
Cancellable build_cancellable;
#endif
public Gtk.ScrolledWindow term_window;
//parent window
public Gtk.ApplicationWindow? application_window { get; private set; }
public signal void start_downloading ();
public signal void stop_downloading ();
#if DISABLE_AUR
#else
public signal void start_building ();
public signal void stop_building ();
#endif
public signal void important_details_outpout (bool must_show);
public signal void finished (bool success);
public signal void set_pkgreason_finished ();
#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 ();
@@ -189,9 +234,15 @@ namespace Pamac {
to_install = new GenericSet<string?> (str_hash, str_equal);
to_remove = new GenericSet<string?> (str_hash, str_equal);
to_load = new GenericSet<string?> (str_hash, str_equal);
#if DISABLE_AUR
#else
to_build = new GenericSet<string?> (str_hash, str_equal);
#endif
to_update = new GenericSet<string?> (str_hash, str_equal);
#if DISABLE_AUR
#else
to_build_queue = new Queue<string> ();
#endif
previous_to_install = new GenericSet<string?> (str_hash, str_equal);
previous_to_remove = new GenericSet<string?> (str_hash, str_equal);
transaction_summary = new GenericSet<string?> (str_hash, str_equal);
@@ -224,14 +275,20 @@ namespace Pamac {
term_window.visible = true;
term_window.propagate_natural_height = true;
term_window.add (term);
#if DISABLE_AUR
#else
build_cancellable = new Cancellable ();
#endif
// progress data
previous_textbar = "";
previous_filename = "";
sysupgrade_after_trans = false;
no_confirm_commit = false;
#if DISABLE_AUR
#else
build_after_sysupgrade = false;
building = false;
#endif
timer = new Timer ();
success = false;
warning_textbuffer = new StringBuilder ();
@@ -374,6 +431,8 @@ namespace Pamac {
}
}
#if DISABLE_AUR
#else
async int spawn_in_term (string[] args, string? working_directory = null) {
SourceFunc callback = spawn_in_term.callback;
int status = 1;
@@ -403,6 +462,7 @@ namespace Pamac {
}
return status;
}
#endif
void reset_progress_box (string action) {
show_in_term (action);
@@ -649,6 +709,8 @@ namespace Pamac {
return pkgs;
}
#if DISABLE_AUR
#else
public async AURPackage[] search_in_aur (string search_string) {
AURPackage[] pkgs = {};
try {
@@ -658,6 +720,7 @@ namespace Pamac {
}
return pkgs;
}
#endif
public string[] get_repos_names () {
string[] repos_names = {};
@@ -738,6 +801,8 @@ namespace Pamac {
}
}
#if DISABLE_AUR
#else
public async AURPackageDetails get_aur_details (string pkgname) {
var pkg = AURPackageDetails () {
name = "",
@@ -754,11 +819,16 @@ namespace Pamac {
}
return pkg;
}
#endif
public void start_get_updates () {
user_daemon.get_updates_finished.connect (on_get_updates_finished);
try {
#if DISABLE_AUR
user_daemon.start_get_updates ();
#else
user_daemon.start_get_updates (pamac_config.enable_aur && pamac_config.check_aur_updates);
#endif
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
success = false;
@@ -769,7 +839,11 @@ namespace Pamac {
void start_get_updates_for_sysupgrade () {
system_daemon.get_updates_finished.connect (on_get_updates_for_sysupgrade_finished);
try {
#if DISABLE_AUR
system_daemon.start_get_updates ();
#else
system_daemon.start_get_updates (pamac_config.enable_aur && pamac_config.check_aur_updates);
#endif
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
success = false;
@@ -820,6 +894,14 @@ namespace Pamac {
// run as a standard transaction
run ();
} else {
#if DISABLE_AUR
if (updates.repos_updates.length != 0) {
sysupgrade_simple (enable_downgrade);
} else {
finish_transaction ();
stop_progressbar_pulse ();
}
#else
if (updates.aur_updates.length != 0) {
clear_lists ();
foreach (unowned AURPackage infos in updates.aur_updates) {
@@ -843,13 +925,17 @@ namespace Pamac {
stop_progressbar_pulse ();
}
}
#endif
}
}
public void clear_lists () {
to_install.remove_all ();
to_remove.remove_all ();
#if DISABLE_AUR
#else
to_build.remove_all ();
#endif
to_load.remove_all ();
}
@@ -858,9 +944,15 @@ namespace Pamac {
previous_to_remove.remove_all ();
}
#if DISABLE_AUR
void start_trans_prepare (int transflags, string[] to_install, string[] to_remove, string[] to_load) {
try {
system_daemon.start_trans_prepare (transflags, to_install, to_remove, to_load);
#else
void start_trans_prepare (int transflags, string[] to_install, string[] to_remove, string[] to_load, string[] to_build) {
try {
system_daemon.start_trans_prepare (transflags, to_install, to_remove, to_load, to_build);
#endif
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
stop_progressbar_pulse ();
@@ -876,7 +968,10 @@ namespace Pamac {
string[] to_install_ = {};
string[] to_remove_ = {};
string[] to_load_ = {};
#if DISABLE_AUR
#else
string[] to_build_ = {};
#endif
foreach (unowned string name in to_install) {
to_install_ += name;
}
@@ -886,12 +981,19 @@ namespace Pamac {
foreach (unowned string path in to_load) {
to_load_ += path;
}
#if DISABLE_AUR
#else
foreach (unowned string name in to_build) {
to_build_ += name;
}
#endif
connecting_system_daemon ();
connecting_dbus_signals ();
#if DISABLE_AUR
start_trans_prepare (flags, to_install_, to_remove_, to_load_);
#else
start_trans_prepare (flags, to_install_, to_remove_, to_load_, to_build_);
#endif
}
void choose_provider (string depend, string[] providers) {
@@ -959,6 +1061,8 @@ namespace Pamac {
transaction_sum_dialog.sum_list.get_iter (out iter, new Gtk.TreePath.from_indices (pos));
transaction_sum_dialog.sum_list.set (iter, 0, "<b>%s</b>".printf (dgettext (null, "To remove") + ":"));
}
#if DISABLE_AUR
#else
if (summary.aur_conflicts_to_remove.length > 0) {
// do not add type enum because it is just infos
foreach (unowned UpdateInfos infos in summary.aur_conflicts_to_remove) {
@@ -972,6 +1076,7 @@ namespace Pamac {
transaction_sum_dialog.sum_list.get_iter (out iter, new Gtk.TreePath.from_indices (pos));
transaction_sum_dialog.sum_list.set (iter, 0, "<b>%s</b>".printf (dgettext (null, "To remove") + ":"));
}
#endif
if (summary.to_downgrade.length > 0) {
type |= Type.STANDARD;
foreach (unowned UpdateInfos infos in summary.to_downgrade) {
@@ -987,6 +1092,8 @@ namespace Pamac {
transaction_sum_dialog.sum_list.get_iter (out iter, new Gtk.TreePath.from_indices (pos));
transaction_sum_dialog.sum_list.set (iter, 0, "<b>%s</b>".printf (dgettext (null, "To downgrade") + ":"));
}
#if DISABLE_AUR
#else
if (summary.to_build.length > 0) {
type |= Type.BUILD;
// populate build queue
@@ -1006,6 +1113,7 @@ namespace Pamac {
transaction_sum_dialog.sum_list.get_iter (out iter, new Gtk.TreePath.from_indices (pos));
transaction_sum_dialog.sum_list.set (iter, 0, "<b>%s</b>".printf (dgettext (null, "To build") + ":"));
}
#endif
if (summary.to_install.length > 0) {
type |= Type.STANDARD;
foreach (unowned UpdateInfos infos in summary.to_install) {
@@ -1070,6 +1178,8 @@ namespace Pamac {
}
}
#if DISABLE_AUR
#else
async void build_aur_packages () {
string pkgname = to_build_queue.pop_head ();
string action = dgettext (null, "Building %s").printf (pkgname) + "...";
@@ -1143,17 +1253,24 @@ namespace Pamac {
finish_transaction ();
}
}
#endif
public void cancel () {
#if DISABLE_AUR
#else
if (building) {
build_cancellable.cancel ();
} else {
#endif
try {
system_daemon.trans_cancel ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
#if DISABLE_AUR
#else
}
#endif
show_in_term ("\n" + dgettext (null, "Transaction cancelled") + ".\n");
progress_box.action_label.label = "";
warning_textbuffer = new StringBuilder ();
@@ -1639,11 +1756,14 @@ namespace Pamac {
while (Gtk.events_pending ()) {
Gtk.main_iteration ();
}
#if DISABLE_AUR
#else
if (type == Type.BUILD) {
// there only AUR packages to build
release ();
on_trans_commit_finished (true);
} else {
#endif
// backup to_install and to_remove
foreach (unowned string name in to_install) {
previous_to_install.add (name);
@@ -1654,7 +1774,10 @@ namespace Pamac {
to_install.remove_all ();
to_remove.remove_all ();
start_commit ();
#if DISABLE_AUR
#else
}
#endif
} else {
transaction_sum_dialog.hide ();
unowned string action = dgettext (null, "Transaction cancelled");
@@ -1662,15 +1785,21 @@ namespace Pamac {
progress_box.action_label.label = action;
release ();
transaction_summary.remove_all ();
#if DISABLE_AUR
#else
to_build_queue.clear ();
#endif
sysupgrade_after_trans = false;
success = false;
finish_transaction ();
}
#if DISABLE_AUR
#else
} else if (build_after_sysupgrade) {
// there only AUR packages to build
release ();
on_trans_commit_finished (true);
#endif
} else {
//var err = ErrorInfos ();
//err.message = dgettext (null, "Nothing to do") + "\n";
@@ -1694,6 +1823,8 @@ namespace Pamac {
if (success) {
show_warnings ();
to_load.remove_all ();
#if DISABLE_AUR
#else
if (to_build_queue.get_length () != 0) {
show_in_term ("");
clear_previous_lists ();
@@ -1707,22 +1838,29 @@ namespace Pamac {
}
});
} else {
#endif
clear_previous_lists ();
if (sysupgrade_after_trans) {
sysupgrade_after_trans = false;
sysupgrade (false);
#if DISABLE_AUR
#else
} else if (build_after_sysupgrade) {
build_after_sysupgrade = false;
disconnecting_dbus_signals ();
// build aur updates in to_build
run ();
#endif
} else {
unowned string action = dgettext (null, "Transaction successfully finished");
show_in_term (action + ".\n");
progress_box.action_label.label = action;
finish_transaction ();
}
#if DISABLE_AUR
#else
}
#endif
} else {
// if it is an authentication or a download error, database was not modified
var err = get_current_error ();
@@ -1739,7 +1877,10 @@ namespace Pamac {
to_load.remove_all ();
}
clear_previous_lists ();
#if DISABLE_AUR
#else
to_build_queue.clear ();
#endif
warning_textbuffer = new StringBuilder ();
handle_error (err);
}
@@ -1753,16 +1894,24 @@ namespace Pamac {
set_pkgreason_finished ();
}
#if DISABLE_AUR
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) {
#else
void on_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
system_daemon.write_pamac_config_finished.disconnect (on_write_pamac_config_finished);
pamac_config.reload ();
flags = (1 << 4); //Alpm.TransFlag.CASCADE
if (pamac_config.recurse) {
flags |= (1 << 5); //Alpm.TransFlag.RECURSE
}
#if DISABLE_AUR
write_pamac_config_finished (recurse, refresh_period, no_update_hide_icon);
#else
write_pamac_config_finished (recurse, refresh_period, no_update_hide_icon,
enable_aur, search_aur, aur_build_dir, check_aur_updates);
#endif
}
void on_write_alpm_config_finished (bool checkspace) {
@@ -1789,7 +1938,7 @@ namespace Pamac {
void connecting_user_daemon () {
try {
user_daemon = Bus.get_proxy_sync (BusType.SESSION, "org.manjaro.pamac.user", "/org/manjaro/pamac/user");
user_daemon = Bus.get_proxy_sync (BusType.SESSION, "org.pamac.user", "/org/pamac/user");
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
}
@@ -1797,7 +1946,7 @@ namespace Pamac {
void connecting_system_daemon () {
try {
system_daemon = Bus.get_proxy_sync (BusType.SYSTEM, "org.manjaro.pamac.system", "/org/manjaro/pamac/system");
system_daemon = Bus.get_proxy_sync (BusType.SYSTEM, "org.pamac.system", "/org/pamac/system");
// Set environment variables
system_daemon.set_environment_variables (pamac_config.environment_variables);
} catch (IOError e) {

View File

@@ -1,6 +1,7 @@
/*
* 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
@@ -17,9 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//using GIO
namespace Pamac {
[GtkTemplate (ui = "/org/manjaro/pamac/transaction/transaction_sum_dialog.ui")]
[GtkTemplate (ui = "/org/pamac/transaction/interface/transaction_sum_dialog.ui")]
class TransactionSumDialog : Gtk.Dialog {
[GtkChild]

3
src/vapis/CMakeLists.txt Normal file
View File

@@ -0,0 +1,3 @@
### CMakeLists automatically created with AutoVala
### Do not edit

File diff suppressed because it is too large Load Diff

1444
src/vapis/libalpm.vapi Normal file

File diff suppressed because it is too large Load Diff

400
src/vapis/libcurl.vapi Normal file
View File

@@ -0,0 +1,400 @@
/*
* licurl-vala
* Vala bindings for libcurl
*
* Copyright (C) 2016 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 2 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/>.
*/
[CCode (cheader_filename = "curl/curl.h")]
namespace Curl {
[CCode (cprefix = "curl_")]
public static Curl.Code global_init (long flags);
public static void global_cleanup ();
public static unowned string version ();
[CCode (cname = "CURL", cprefix = "curl_easy_", free_function = "curl_easy_cleanup")]
[Compact]
public class Easy {
[CCode (cname = "curl_easy_init")]
public Easy();
[PrintfFormat]
public Curl.Code getinfo (Curl.Info info, ...);
public Curl.Code easy_pause (int bitmask);
public Curl.Code perform ();
public void reset ();
[PrintfFormat]
public Curl.Code setopt (Curl.Option option, ...);
public static unowned string strerror (Curl.Code errornum);
}
[CCode (cname = "CURLcode", cprefix = "CURLE_", has_type_id = false)]
public enum Code {
OK,
UNSUPPORTED_PROTOCOL,
FAILED_INIT,
URL_MALFORMAT,
NOT_BUILT_IN,
COULDNT_RESOLVE_PROXY,
COULDNT_RESOLVE_HOST,
COULDNT_CONNECT,
FTP_WEIRD_SERVER_REPLY,
REMOTE_ACCESS_DENIED,
FTP_WEIRD_PASS_REPLY,
FTP_WEIRD_PASV_REPLY,
FTP_WEIRD_227_FORMAT,
FTP_CANT_GET_HOST,
FTP_COULDNT_SET_TYPE,
PARTIAL_FILE,
FTP_COULDNT_RETR_FILE,
QUOTE_ERROR,
HTTP_RETURNED_ERROR,
WRITE_ERROR,
UPLOAD_FAILED,
READ_ERROR,
OUT_OF_MEMORY,
OPERATION_TIMEDOUT,
FTP_PORT_FAILED,
FTP_COULDNT_USE_REST,
RANGE_ERROR,
HTTP_POST_ERROR,
SSL_CONNECT_ERROR,
BAD_DOWNLOAD_RESUME,
FILE_COULDNT_READ_FILE,
LDAP_CANNOT_BIND,
LDAP_SEARCH_FAILED,
FUNCTION_NOT_FOUND,
ABORTED_BY_CALLBACK,
BAD_FUNCTION_ARGUMENT,
INTERFACE_FAILED,
TOO_MANY_REDIRECTS,
UNKNOWN_OPTION,
TELNET_OPTION_SYNTAX,
PEER_FAILED_VERIFICATION,
GOT_NOTHING,
SSL_ENGINE_NOTFOUND,
SSL_ENGINE_SETFAILED,
SEND_ERROR,
RECV_ERROR,
SSL_CERTPROBLEM,
SSL_CIPHER,
SSL_CACERT,
BAD_CONTENT_ENCODING,
LDAP_INVALID_URL,
FILESIZE_EXCEEDED,
USE_SSL_FAILED,
SEND_FAIL_REWIND,
SSL_ENGINE_INITFAILED,
LOGIN_DENIED,
TFTP_NOTFOUND,
TFTP_PERM,
REMOTE_DISK_FULL,
TFTP_ILLEGAL,
TFTP_UNKNOWNID,
REMOTE_FILE_EXISTS,
TFTP_NOSUCHUSER,
CONV_FAILED,
CONV_REQD,
SSL_CACERT_BADFILE,
REMOTE_FILE_NOT_FOUND,
SSH,
SSL_SHUTDOWN_FAILED,
AGAIN,
SSL_CRL_BADFILE,
SSL_ISSUER_ERROR,
FTP_PRET_FAILED,
RTSP_CSEQ_ERROR,
RTSP_SESSION_ERROR,
FTP_BAD_FILE_LIST,
CHUNK_FAILED
}
[CCode (cname = "CURLINFO", cprefix = "CURLINFO_", has_type_id = false)]
public enum Info {
NONE,
EFFECTIVE_URL,
RESPONSE_CODE,
TOTAL_TIME,
NAMELOOKUP_TIME,
CONNECT_TIME,
PRETRANSFER_TIME,
SIZE_UPLOAD,
SIZE_DOWNLOAD,
SPEED_DOWNLOAD,
SPEED_UPLOAD,
HEADER_SIZE,
REQUEST_SIZE,
SSL_VERIFYRESULT,
FILETIME,
CONTENT_LENGTH_DOWNLOAD,
CONTENT_LENGTH_UPLOAD,
STARTTRANSFER_TIME,
CONTENT_TYPE,
REDIRECT_TIME,
REDIRECT_COUNT,
PRIVATE,
HTTP_CONNECTCODE,
HTTPAUTH_AVAIL,
PROXYAUTH_AVAIL,
OS_ERRNO,
NUM_CONNECTS,
SSL_ENGINES,
COOKIELIST,
LASTSOCKET,
FTP_ENTRY_PATH,
REDIRECT_URL,
PRIMARY_IP,
APPCONNECT_TIME,
CERTINFO,
CONDITION_UNMET,
RTSP_SESSION_ID,
RTSP_CLIENT_CSEQ,
RTSP_SERVER_CSEQ,
RTSP_CSEQ_RECV,
PRIMARY_PORT,
LOCAL_IP,
LOCAL_PORT,
LASTONE
}
[CCode (cname = "CURL_NETRC_OPTION", cprefix = "CURL_NETRC_", has_type_id = false)]
public enum NetRCOption {
IGNORED,
OPTIONAL,
REQUIRED,
LAST
}
[CCode (cname = "CURLoption", cprefix = "CURLOPT_", has_type_id = false)]
public enum Option {
FILE,
WRITEDATA,
URL,
PORT,
PROXY,
USERPWD,
PROXYUSERPWD,
RANGE,
INFILE,
READDATA,
ERRORBUFFER,
WRITEFUNCTION,
READFUNCTION,
TIMEOUT,
INFILESIZE,
POSTFIELDS,
REFERER,
FTPPORT,
USERAGENT,
LOW_SPEED_LIMIT,
LOW_SPEED_TIME,
RESUME_FROM,
COOKIE,
HTTPHEADER,
RTSPHEADER,
HTTPPOST,
SSLCERT,
KEYPASSWD,
CRLF,
QUOTE,
WRITEHEADER,
HEADERDATA,
COOKIEFILE,
SSLVERSION,
TIMECONDITION,
TIMEVALUE,
CUSTOMREQUEST,
STDERR,
POSTQUOTE,
WRITEINFO,
VERBOSE,
HEADER,
NOPROGRESS,
NOBODY,
FAILONERROR,
UPLOAD,
POST,
DIRLISTONLY,
APPEND,
NETRC,
FOLLOWLOCATION,
TRANSFERTEXT,
PUT,
XFERINFOFUNCTION,
XFERINFODATA,
AUTOREFERER,
PROXYPORT,
POSTFIELDSIZE,
HTTPPROXYTUNNEL,
INTERFACE,
KRBLEVEL,
SSL_VERIFYPEER,
CAINFO,
MAXREDIRS,
FILETIME,
TELNETOPTIONS,
MAXCONNECTS,
FRESH_CONNECT,
FORBID_REUSE,
RANDOM_FILE,
EGDSOCKET,
CONNECTTIMEOUT,
HEADERFUNCTION,
HTTPGET,
SSL_VERIFYHOST,
COOKIEJAR,
SSL_CIPHER_LIST,
HTTP_VERSION,
FTP_USE_EPSV,
SSLCERTTYPE,
SSLKEY,
SSLKEYTYPE,
SSLENGINE,
SSLENGINE_DEFAULT,
DNS_CACHE_TIMEOUT,
PREQUOTE,
DEBUGFUNCTION,
DEBUGDATA,
COOKIESESSION,
CAPATH,
BUFFERSIZE,
NOSIGNAL,
SHARE,
PROXYTYPE,
ACCEPT_ENCODING,
PRIVATE,
HTTP200ALIASES,
UNRESTRICTED_AUTH,
FTP_USE_EPRT,
HTTPAUTH,
SSL_CTX_FUNCTION,
SSL_CTX_DATA,
FTP_CREATE_MISSING_DIRS,
PROXYAUTH,
FTP_RESPONSE_TIMEOUT,
IPRESOLVE,
MAXFILESIZE,
INFILESIZE_LARGE,
RESUME_FROM_LARGE,
MAXFILESIZE_LARGE,
NETRC_FILE,
USE_SSL,
POSTFIELDSIZE_LARGE,
TCP_NODELAY,
FTPSSLAUTH,
IOCTLFUNCTION,
IOCTLDATA,
FTP_ACCOUNT,
COOKIELIST,
IGNORE_CONTENT_LENGTH,
FTP_SKIP_PASV_IP,
FTP_FILEMETHOD,
LOCALPORT,
LOCALPORTRANGE,
CONNECT_ONLY,
CONV_FROM_NETWORK_FUNCTION,
CONV_TO_NETWORK_FUNCTION,
CONV_FROM_UTF8_FUNCTION,
MAX_SEND_SPEED_LARGE,
MAX_RECV_SPEED_LARGE,
FTP_ALTERNATIVE_TO_USER,
SOCKOPTFUNCTION,
SOCKOPTDATA,
SSL_SESSIONID_CACHE,
SSH_AUTH_TYPES,
SSH_PUBLIC_KEYFILE,
SSH_PRIVATE_KEYFILE,
FTP_SSL_CCC,
TIMEOUT_MS,
CONNECTTIMEOUT_MS,
HTTP_TRANSFER_DECODING,
HTTP_CONTENT_DECODING,
NEW_FILE_PERMS,
NEW_DIRECTORY_PERMS,
POSTREDIR,
SSH_HOST_PUBLIC_KEY_MD5,
OPENSOCKETFUNCTION,
OPENSOCKETDATA,
COPYPOSTFIELDS,
PROXY_TRANSFER_MODE,
SEEKFUNCTION,
SEEKDATA,
CRLFILE,
ISSUERCERT,
ADDRESS_SCOPE,
CERTINFO,
USERNAME,
PASSWORD,
PROXYUSERNAME,
PROXYPASSWORD,
NOPROXY,
TFTP_BLKSIZE,
SOCKS5_GSSAPI_SERVICE,
SOCKS5_GSSAPI_NEC,
PROTOCOLS,
REDIR_PROTOCOLS,
SSH_KNOWNHOSTS,
SSH_KEYFUNCTION,
SSH_KEYDATA,
MAIL_FROM,
MAIL_RCPT,
FTP_USE_PRET,
RTSP_REQUEST,
RTSP_SESSION_ID,
RTSP_STREAM_URI,
RTSP_TRANSPORT,
RTSP_CLIENT_CSEQ,
RTSP_SERVER_CSEQ,
INTERLEAVEDATA,
INTERLEAVEFUNCTION,
WILDCARDMATCH,
CHUNK_BGN_FUNCTION,
CHUNK_END_FUNCTION,
FNMATCH_FUNCTION,
CHUNK_DATA,
FNMATCH_DATA,
RESOLVE,
TLSAUTH_USERNAME,
TLSAUTH_PASSWORD,
TLSAUTH_TYPE,
TRANSFER_ENCODING,
CLOSESOCKETFUNCTION,
CLOSESOCKETDATA,
LASTENTRY
}
[CCode (cname = "curl_TimeCond", cprefix = "CURL_TIMECOND_", has_type_id = false)]
public enum TimeCond {
NONE,
IFMODSINCE,
IFUNMODSINCE,
LASTMOD,
LAST
}
[CCode (cname = "curl_progress_callback", has_target = false)]
public delegate int ProgressCallback (void* user_data, uint64 dltotal, uint64 dlnow, uint64 ultotal, uint64 ulnow);
[CCode (cname = "CURLAUTH_ANY", cheader_filename = "curl/curl.h")]
public const int CURLAUTH_ANY;
[CCode (cname = "CURL_ERROR_SIZE")]
public const int ERROR_SIZE;
[CCode (cname = "CURL_GLOBAL_SSL")]
public const int GLOBAL_SSL;
}

View File

@@ -0,0 +1,220 @@
/* polkit-gobject-1.vapi generated by vapigen, do not modify. */
[CCode (cprefix = "Polkit", gir_namespace = "Polkit", gir_version = "1.0", lower_case_cprefix = "polkit_")]
namespace Polkit {
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_action_description_get_type ()")]
public class ActionDescription : GLib.Object {
[CCode (has_construct_function = false)]
protected ActionDescription ();
public unowned string get_action_id ();
public unowned string get_annotation (string key);
[CCode (array_length = false, array_null_terminated = true)]
public unowned string[] get_annotation_keys ();
public unowned string get_description ();
public unowned string get_icon_name ();
public Polkit.ImplicitAuthorization get_implicit_active ();
public Polkit.ImplicitAuthorization get_implicit_any ();
public Polkit.ImplicitAuthorization get_implicit_inactive ();
public unowned string get_message ();
public unowned string get_vendor_name ();
public unowned string get_vendor_url ();
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_authority_get_type ()")]
public class Authority : GLib.Object, GLib.AsyncInitable, GLib.Initable {
[CCode (has_construct_function = false)]
protected Authority ();
public async bool authentication_agent_response (string cookie, Polkit.Identity identity, GLib.Cancellable? cancellable) throws GLib.Error;
public bool authentication_agent_response_sync (string cookie, Polkit.Identity identity, GLib.Cancellable? cancellable = null) throws GLib.Error;
public async Polkit.AuthorizationResult check_authorization (Polkit.Subject subject, string action_id, Polkit.Details? details, Polkit.CheckAuthorizationFlags flags, GLib.Cancellable? cancellable) throws GLib.Error;
public Polkit.AuthorizationResult check_authorization_sync (Polkit.Subject subject, string action_id, Polkit.Details? details, Polkit.CheckAuthorizationFlags flags, GLib.Cancellable? cancellable = null) throws GLib.Error;
public async GLib.List<Polkit.ActionDescription> enumerate_actions (GLib.Cancellable? cancellable) throws GLib.Error;
public GLib.List<Polkit.ActionDescription> enumerate_actions_sync (GLib.Cancellable? cancellable = null) throws GLib.Error;
public async GLib.List<Polkit.TemporaryAuthorization> enumerate_temporary_authorizations (Polkit.Subject subject, GLib.Cancellable? cancellable) throws GLib.Error;
public GLib.List<Polkit.TemporaryAuthorization> enumerate_temporary_authorizations_sync (Polkit.Subject subject, GLib.Cancellable? cancellable = null) throws GLib.Error;
public static Polkit.Authority @get ();
public static async Polkit.Authority get_async (GLib.Cancellable? cancellable) throws GLib.Error;
public Polkit.AuthorityFeatures get_backend_features ();
public unowned string get_backend_name ();
public unowned string get_backend_version ();
public string get_owner ();
public static Polkit.Authority get_sync (GLib.Cancellable? cancellable = null) throws GLib.Error;
public async bool register_authentication_agent (Polkit.Subject subject, string locale, string object_path, GLib.Cancellable? cancellable) throws GLib.Error;
public bool register_authentication_agent_sync (Polkit.Subject subject, string locale, string object_path, GLib.Cancellable? cancellable = null) throws GLib.Error;
public async bool register_authentication_agent_with_options (Polkit.Subject subject, string locale, string object_path, GLib.Variant? options, GLib.Cancellable? cancellable) throws GLib.Error;
public bool register_authentication_agent_with_options_sync (Polkit.Subject subject, string locale, string object_path, GLib.Variant? options, GLib.Cancellable? cancellable = null) throws GLib.Error;
public async bool revoke_temporary_authorization_by_id (string id, GLib.Cancellable? cancellable) throws GLib.Error;
public bool revoke_temporary_authorization_by_id_sync (string id, GLib.Cancellable? cancellable = null) throws GLib.Error;
public async bool revoke_temporary_authorizations (Polkit.Subject subject, GLib.Cancellable? cancellable) throws GLib.Error;
public bool revoke_temporary_authorizations_sync (Polkit.Subject subject, GLib.Cancellable? cancellable = null) throws GLib.Error;
public async bool unregister_authentication_agent (Polkit.Subject subject, string object_path, GLib.Cancellable? cancellable) throws GLib.Error;
public bool unregister_authentication_agent_sync (Polkit.Subject subject, string object_path, GLib.Cancellable? cancellable = null) throws GLib.Error;
public Polkit.AuthorityFeatures backend_features { get; }
public string backend_name { get; }
public string backend_version { get; }
public string owner { owned get; }
public signal void changed ();
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_authorization_result_get_type ()")]
public class AuthorizationResult : GLib.Object {
[CCode (has_construct_function = false)]
public AuthorizationResult (bool is_authorized, bool is_challenge, Polkit.Details? details);
public unowned Polkit.Details get_details ();
public bool get_dismissed ();
public bool get_is_authorized ();
public bool get_is_challenge ();
public bool get_retains_authorization ();
public unowned string get_temporary_authorization_id ();
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_details_get_type ()")]
public class Details : GLib.Object {
[CCode (has_construct_function = false)]
public Details ();
[CCode (array_length = false, array_null_terminated = true)]
public string[] get_keys ();
public void insert (string key, string? value);
public unowned string lookup (string key);
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_permission_get_type ()")]
public class Permission : GLib.Permission, GLib.AsyncInitable, GLib.Initable {
[CCode (cname = "polkit_permission_new", has_construct_function = false)]
public async Permission (string action_id, Polkit.Subject? subject, GLib.Cancellable? cancellable) throws GLib.Error;
public unowned string get_action_id ();
public unowned Polkit.Subject get_subject ();
[CCode (has_construct_function = false, type = "GPermission*")]
public Permission.sync (string action_id, Polkit.Subject? subject, GLib.Cancellable? cancellable = null) throws GLib.Error;
public string action_id { get; construct; }
public Polkit.Subject subject { get; construct; }
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_system_bus_name_get_type ()")]
public class SystemBusName : GLib.Object, Polkit.Subject {
[CCode (has_construct_function = false)]
protected SystemBusName ();
public unowned string get_name ();
public Polkit.Subject get_process_sync (GLib.Cancellable? cancellable = null) throws GLib.Error;
public static Polkit.Subject @new (string name);
public void set_name (string name);
public string name { get; set construct; }
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_temporary_authorization_get_type ()")]
public class TemporaryAuthorization : GLib.Object {
[CCode (has_construct_function = false)]
protected TemporaryAuthorization ();
public unowned string get_action_id ();
public unowned string get_id ();
public Polkit.Subject get_subject ();
public uint64 get_time_expires ();
public uint64 get_time_obtained ();
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_unix_group_get_type ()")]
public class UnixGroup : GLib.Object, Polkit.Identity {
[CCode (has_construct_function = false)]
protected UnixGroup ();
public int get_gid ();
public static Polkit.Identity @new (int gid);
public static Polkit.Identity new_for_name (string name) throws GLib.Error;
public void set_gid (int gid);
public int gid { get; set construct; }
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_unix_netgroup_get_type ()")]
public class UnixNetgroup : GLib.Object, Polkit.Identity {
[CCode (has_construct_function = false)]
protected UnixNetgroup ();
public unowned string get_name ();
public static Polkit.Identity @new (string name);
public void set_name (string name);
public string name { get; set construct; }
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_unix_process_get_type ()")]
public class UnixProcess : GLib.Object, Polkit.Subject {
[CCode (has_construct_function = false)]
protected UnixProcess ();
public int get_owner () throws GLib.Error;
public int get_pid ();
public uint64 get_start_time ();
public int get_uid ();
public static Polkit.Subject @new (int pid);
public static Polkit.Subject new_for_owner (int pid, uint64 start_time, int uid);
public static Polkit.Subject new_full (int pid, uint64 start_time);
public void set_pid (int pid);
public void set_start_time (uint64 start_time);
public void set_uid (int uid);
public int pid { get; set construct; }
public uint64 start_time { get; set construct; }
public int uid { get; set construct; }
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_unix_session_get_type ()")]
public class UnixSession : GLib.Object, GLib.AsyncInitable, GLib.Initable, Polkit.Subject {
[CCode (has_construct_function = false)]
protected UnixSession ();
public unowned string get_session_id ();
public static Polkit.Subject @new (string session_id);
public static async Polkit.Subject new_for_process (int pid, GLib.Cancellable? cancellable) throws GLib.Error;
public static Polkit.Subject new_for_process_sync (int pid, GLib.Cancellable? cancellable = null) throws GLib.Error;
public void set_session_id (string session_id);
public int pid { construct; }
public string session_id { get; set construct; }
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_unix_user_get_type ()")]
public class UnixUser : GLib.Object, Polkit.Identity {
[CCode (has_construct_function = false)]
protected UnixUser ();
public unowned string get_name ();
public int get_uid ();
public static Polkit.Identity @new (int uid);
public static Polkit.Identity new_for_name (string name) throws GLib.Error;
public void set_uid (int uid);
public int uid { get; set construct; }
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_identity_get_type ()")]
public interface Identity : GLib.Object {
public abstract bool equal (Polkit.Identity b);
public static Polkit.Identity from_string (string str) throws GLib.Error;
public abstract uint hash ();
public abstract string to_string ();
}
[CCode (cheader_filename = "polkit/polkit.h", type_id = "polkit_subject_get_type ()")]
public interface Subject : GLib.Object {
public abstract bool equal (Polkit.Subject b);
public abstract async bool exists (GLib.Cancellable? cancellable) throws GLib.Error;
public abstract bool exists_sync (GLib.Cancellable? cancellable = null) throws GLib.Error;
public static Polkit.Subject from_string (string str) throws GLib.Error;
public abstract uint hash ();
public abstract string to_string ();
}
[CCode (cheader_filename = "polkit/polkit.h", cprefix = "POLKIT_AUTHORITY_FEATURES_", type_id = "polkit_authority_features_get_type ()")]
[Flags]
public enum AuthorityFeatures {
NONE,
TEMPORARY_AUTHORIZATION
}
[CCode (cheader_filename = "polkit/polkit.h", cprefix = "POLKIT_CHECK_AUTHORIZATION_FLAGS_", type_id = "polkit_check_authorization_flags_get_type ()")]
[Flags]
public enum CheckAuthorizationFlags {
NONE,
ALLOW_USER_INTERACTION
}
[CCode (cheader_filename = "polkit/polkit.h", cprefix = "POLKIT_IMPLICIT_AUTHORIZATION_", type_id = "polkit_implicit_authorization_get_type ()")]
public enum ImplicitAuthorization {
UNKNOWN,
NOT_AUTHORIZED,
AUTHENTICATION_REQUIRED,
ADMINISTRATOR_AUTHENTICATION_REQUIRED,
AUTHENTICATION_REQUIRED_RETAINED,
ADMINISTRATOR_AUTHENTICATION_REQUIRED_RETAINED,
AUTHORIZED;
public static bool from_string (string string, Polkit.ImplicitAuthorization out_implicit_authorization);
public static unowned string to_string (Polkit.ImplicitAuthorization implicit_authorization);
}
[CCode (cheader_filename = "polkit/polkit.h", cprefix = "POLKIT_ERROR_")]
public errordomain Error {
FAILED,
CANCELLED,
NOT_SUPPORTED,
NOT_AUTHORIZED;
public static GLib.Quark quark ();
}
[CCode (cheader_filename = "polkit/polkit.h")]
public static Polkit.Identity identity_from_string (string str) throws GLib.Error;
[CCode (cheader_filename = "polkit/polkit.h")]
public static Polkit.Subject subject_from_string (string str) throws GLib.Error;
}