@@ -76,6 +76,7 @@ add_subdirectory(src) | |||
add_subdirectory(src/aur) | |||
add_subdirectory(src/pamac-user-daemon) | |||
add_subdirectory(src/pamac-tray) | |||
add_subdirectory(src/pamac-clean-cache) | |||
add_subdirectory(src/pamac-install) | |||
add_subdirectory(src/pamac-manager) | |||
add_subdirectory(src/pamac-system-daemon) |
@@ -9,3 +9,9 @@ RefreshPeriod = 6 | |||
## When there are no updates available, hide the tray icon: | |||
#NoUpdateHideIcon | |||
## Number of versions of each package to keep in the cache: | |||
KeepNumPackages = 3 | |||
## Remove only the versions of uninstalled packages when clean cache: | |||
#OnlyRmUninstalled |
@@ -24,3 +24,9 @@ BuildDirectory = /tmp | |||
## Do not ask for confirmation when building packages: | |||
#NoConfirmBuild | |||
## Number of versions of each package to keep in the cache: | |||
KeepNumPackages = 3 | |||
## Remove only the versions of uninstalled packages when clean cache: | |||
#OnlyRmUninstalled |
@@ -3,4 +3,4 @@ Description=Clean packages cache | |||
[Service] | |||
Type=oneshot | |||
ExecStart=/usr/bin/paccache -r | |||
ExecStart=/usr/bin/pamac-clean-cache |
@@ -33,6 +33,17 @@ end | |||
vapidir: src/vapis | |||
vala_binary: src/pamac-clean-cache/pamac-clean-cache | |||
version: 6.0.1 | |||
vala_local_package: Pamac | |||
vala_package: posix | |||
vala_check_package: gtk+-3.0 | |||
*vala_check_package: gio-2.0 | |||
*vala_check_package: glib-2.0 | |||
*vala_check_package: gobject-2.0 | |||
*vala_source: clean_cache.vala | |||
*vala_source: pamac_config.vala | |||
vala_binary: src/pamac-install/pamac-install | |||
version: 6.0.1 | |||
use_gresource: pamac_installer_gresource_xml | |||
@@ -105,10 +116,10 @@ end | |||
vala_binary: src/pamac-user-daemon/pamac-user-daemon | |||
version: 6.0.1 | |||
vala_local_package: Pamac | |||
if NOT DISABLE_AUR | |||
vala_local_package: AUR | |||
end | |||
vala_local_package: Pamac | |||
vala_package: posix | |||
vala_check_package: gtk+-3.0 | |||
vala_check_package: json-glib-1.0 | |||
@@ -171,6 +182,8 @@ vala_check_package: libsoup-2.4 | |||
*translate: vala src/common.vala | |||
*translate: vala src/mirrors_config.vala | |||
*translate: vala src/package.vala | |||
*translate: vala src/pamac-clean-cache/clean_cache.vala | |||
*translate: vala src/pamac-clean-cache/pamac_config.vala | |||
*translate: vala src/pamac-install/installer.vala | |||
*translate: vala src/pamac-install/progress_dialog.vala | |||
*translate: vala src/pamac-manager/history_dialog.vala |
@@ -3,4 +3,4 @@ | |||
include (Translations) | |||
add_translations_directory("pamac") | |||
add_translations_catalog("pamac" ../src/pamac-install ../src/pamac-manager ../src/pamac-system-daemon ../src/pamac-tray ../src/pamac-user-daemon ../src ../src/aur ../data/interface ) | |||
add_translations_catalog("pamac" ../src/pamac-clean-cache ../src/pamac-install ../src/pamac-manager ../src/pamac-system-daemon ../src/pamac-tray ../src/pamac-user-daemon ../src ../src/aur ../data/interface ) |
@@ -1,3 +1,5 @@ | |||
src/pamac-clean-cache/clean_cache.vala | |||
src/pamac-clean-cache/pamac_config.vala | |||
src/pamac-install/installer.vala | |||
src/pamac-install/progress_dialog.vala | |||
src/pamac-manager/history_dialog.vala |
@@ -0,0 +1,89 @@ | |||
### 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.1") | |||
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}") | |||
set (DOLLAR "$") | |||
configure_file (${CMAKE_SOURCE_DIR}/src/pamac-clean-cache/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-clean-cache/Config.vala) | |||
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\") | |||
set (VERSION "6.0.1") | |||
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} posix) | |||
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} clean_cache.vala) | |||
set (APP_SOURCES ${APP_SOURCES} pamac_config.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() | |||
vala_precompile(VALA_C pamac-clean-cache | |||
${APP_SOURCES} | |||
PACKAGES | |||
${VALA_PACKAGES} | |||
CUSTOM_VAPIS | |||
${CUSTOM_VAPIS_LIST} | |||
OPTIONS | |||
${COMPILE_OPTIONS} | |||
) | |||
add_executable(pamac-clean-cache ${VALA_C}) | |||
set ( pamac-clean-cache_DEPENDENCIES ${pamac-clean-cache_DEPENDENCIES} Pamac ) | |||
add_dependencies( pamac-clean-cache ${pamac-clean-cache_DEPENDENCIES} ) | |||
install(TARGETS | |||
pamac-clean-cache | |||
RUNTIME DESTINATION | |||
${CMAKE_INSTALL_BINDIR} | |||
) | |||
if(HAVE_VALADOC) | |||
valadoc(pamac-clean-cache | |||
${CMAKE_BINARY_DIR}/valadoc/pamac-clean-cache | |||
${APP_SOURCES} | |||
PACKAGES | |||
${VALA_PACKAGES} | |||
CUSTOM_VAPIS | |||
${CUSTOM_VAPIS_LIST} | |||
) | |||
install(DIRECTORY | |||
${CMAKE_BINARY_DIR}/valadoc | |||
DESTINATION | |||
${CMAKE_INSTALL_DATAROOTDIR}/doc/pamac | |||
) | |||
endif() |
@@ -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 | |||
} |
@@ -0,0 +1,33 @@ | |||
/* | |||
* 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/>. | |||
*/ | |||
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; | |||
} |
@@ -0,0 +1 @@ | |||
../pamac_config.vala |
@@ -30,6 +30,8 @@ namespace Pamac { | |||
public bool search_aur { get; private set; } | |||
public string aur_build_dir { get; private set; } | |||
public bool check_aur_updates { get; private set; } | |||
public uint64 keep_num_pkgs { get; private set; } | |||
public bool rm_only_uninstalled { get; private set; } | |||
public unowned HashTable<string,string> environment_variables { | |||
get { | |||
return _environment_variables; | |||
@@ -75,6 +77,8 @@ namespace Pamac { | |||
search_aur = false; | |||
aur_build_dir = "/tmp"; | |||
check_aur_updates = false; | |||
keep_num_pkgs = 3; | |||
rm_only_uninstalled = false; | |||
parse_file (conf_path); | |||
} | |||
@@ -118,6 +122,13 @@ namespace Pamac { | |||
} | |||
} else if (key == "CheckAURUpdates") { | |||
check_aur_updates = true; | |||
} else if (key == "KeepNumPackages") { | |||
if (splitted.length == 2) { | |||
unowned string val = splitted[1]._strip (); | |||
keep_num_pkgs = uint64.parse (val); | |||
} | |||
} else if (key == "OnlyRmUninstalled") { | |||
rm_only_uninstalled = true; | |||
} | |||
} | |||
} catch (GLib.Error e) { | |||
@@ -213,6 +224,24 @@ namespace Pamac { | |||
} else { | |||
data.append (line + "\n"); | |||
} | |||
} else if (line.contains ("KeepNumPackages")) { | |||
if (new_conf.lookup_extended ("KeepNumPackages", null, out variant)) { | |||
data.append ("KeepNumPackages = %llu\n".printf (variant.get_uint64 ())); | |||
new_conf.remove ("KeepNumPackages"); | |||
} else { | |||
data.append (line + "\n"); | |||
} | |||
} else if (line.contains ("OnlyRmUninstalled")) { | |||
if (new_conf.lookup_extended ("OnlyRmUninstalled", null, out variant)) { | |||
if (variant.get_boolean ()) { | |||
data.append ("OnlyRmUninstalled\n"); | |||
} else { | |||
data.append ("#OnlyRmUninstalled\n"); | |||
} | |||
new_conf.remove ("OnlyRmUninstalled"); | |||
} else { | |||
data.append (line + "\n"); | |||
} | |||
} else { | |||
data.append (line + "\n"); | |||
} | |||
@@ -266,6 +295,14 @@ namespace Pamac { | |||
} else { | |||
data.append ("#CheckAURUpdates\n"); | |||
} | |||
} else if (key == "KeepNumPackages") { | |||
data.append ("KeepNumPackages = %llu\n".printf (val.get_uint64 ())); | |||
} else if (key == "OnlyRmUninstalled") { | |||
if (val.get_boolean ()) { | |||
data.append ("OnlyRmUninstalled\n"); | |||
} else { | |||
data.append ("#OnlyRmUninstalled\n"); | |||
} | |||
} | |||
} | |||
} |
@@ -427,12 +427,12 @@ namespace Pamac { | |||
}); | |||
} | |||
public void clean_cache (uint keep_nb, bool only_uninstalled, GLib.BusName sender) { | |||
public void clean_cache (uint64 keep_nb, bool only_uninstalled, GLib.BusName sender) { | |||
check_authorization.begin (sender, (obj, res) => { | |||
bool authorized = check_authorization.end (res); | |||
if (authorized) { | |||
string[] commands = {"paccache", "-rq"}; | |||
commands += "-k%u".printf (keep_nb); | |||
string[] commands = {"paccache", "--nocolor", "-rq"}; | |||
commands += "-k%llu".printf (keep_nb); | |||
if (only_uninstalled) { | |||
commands += "-u"; | |||
} |
@@ -15,9 +15,9 @@ configure_file (${CMAKE_SOURCE_DIR}/src/pamac-user-daemon/Config.vala.base ${CMA | |||
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\") | |||
set (VERSION "6.0.1") | |||
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 ) | |||
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) | |||
@@ -36,8 +36,10 @@ 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 (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) | |||
@@ -67,8 +69,10 @@ OPTIONS | |||
) | |||
add_executable(pamac-user-daemon ${VALA_C}) | |||
set ( pamac-user-daemon_DEPENDENCIES ${pamac-user-daemon_DEPENDENCIES} AUR ) | |||
set ( pamac-user-daemon_DEPENDENCIES ${pamac-user-daemon_DEPENDENCIES} Pamac ) | |||
if (NOT DISABLE_AUR) | |||
set ( pamac-user-daemon_DEPENDENCIES ${pamac-user-daemon_DEPENDENCIES} AUR ) | |||
endif () | |||
add_dependencies( pamac-user-daemon ${pamac-user-daemon_DEPENDENCIES} ) | |||
@@ -33,6 +33,8 @@ namespace Pamac { | |||
public string aur_build_dir { get; private set; } | |||
public bool check_aur_updates { get; private set; } | |||
#endif | |||
public uint64 keep_num_pkgs { get; private set; } | |||
public bool rm_only_uninstalled { get; private set; } | |||
public unowned HashTable<string,string> environment_variables { | |||
get { | |||
return _environment_variables; | |||
@@ -81,6 +83,8 @@ namespace Pamac { | |||
aur_build_dir = "/tmp"; | |||
check_aur_updates = false; | |||
#endif | |||
keep_num_pkgs = 3; | |||
rm_only_uninstalled = false; | |||
parse_file (conf_path); | |||
} | |||
@@ -127,6 +131,13 @@ namespace Pamac { | |||
} else if (key == "CheckAURUpdates") { | |||
check_aur_updates = true; | |||
#endif | |||
} else if (key == "KeepNumPackages") { | |||
if (splitted.length == 2) { | |||
unowned string val = splitted[1]._strip (); | |||
keep_num_pkgs = uint64.parse (val); | |||
} | |||
} else if (key == "OnlyRmUninstalled") { | |||
rm_only_uninstalled = true; | |||
} | |||
} | |||
} catch (GLib.Error e) { |
@@ -103,6 +103,8 @@ namespace Pamac { | |||
previous_refresh_period = transaction.refresh_period; | |||
} | |||
no_update_hide_icon_checkbutton.active = transaction.no_update_hide_icon; | |||
cache_keep_nb_spin_button.value = transaction.keep_num_pkgs; | |||
cache_only_uninstalled_checkbutton.active = transaction.rm_only_uninstalled; | |||
// populate ignorepkgs_liststore | |||
ignorepkgs_liststore = new Gtk.ListStore (1, typeof (string)); | |||
@@ -116,6 +118,8 @@ namespace Pamac { | |||
check_updates_button.state_set.connect (on_check_updates_button_state_set); | |||
refresh_period_spin_button.value_changed.connect (on_refresh_period_spin_button_value_changed); | |||
no_update_hide_icon_checkbutton.toggled.connect (on_no_update_hide_icon_checkbutton_toggled); | |||
cache_keep_nb_spin_button.value_changed.connect (on_cache_keep_nb_spin_button_value_changed); | |||
cache_only_uninstalled_checkbutton.toggled.connect (on_cache_only_uninstalled_checkbutton_toggled); | |||
transaction.write_pamac_config_finished.connect (on_write_pamac_config_finished); | |||
AlpmPackage pkg = transaction.find_installed_satisfier ("pacman-mirrors"); | |||
@@ -197,6 +201,19 @@ namespace Pamac { | |||
transaction.start_write_pamac_config (new_pamac_conf); | |||
} | |||
void on_cache_keep_nb_spin_button_value_changed () { | |||
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal); | |||
new_pamac_conf.insert ("KeepNumPackages", new Variant.uint64 (cache_keep_nb_spin_button.get_value_as_int ())); | |||
transaction.start_write_pamac_config (new_pamac_conf); | |||
} | |||
void on_cache_only_uninstalled_checkbutton_toggled () { | |||
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal); | |||
new_pamac_conf.insert ("OnlyRmUninstalled", new Variant.boolean (cache_only_uninstalled_checkbutton.active)); | |||
transaction.start_write_pamac_config (new_pamac_conf); | |||
} | |||
void on_no_update_hide_icon_checkbutton_toggled () { | |||
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal); | |||
new_pamac_conf.insert ("NoUpdateHideIcon", new Variant.boolean (no_update_hide_icon_checkbutton.active)); | |||
@@ -399,8 +416,7 @@ namespace Pamac { | |||
[GtkCallback] | |||
void on_cache_clean_button_clicked () { | |||
transaction.clean_cache ((uint) cache_keep_nb_spin_button.get_value_as_int (), | |||
cache_only_uninstalled_checkbutton.active); | |||
transaction.clean_cache (transaction.keep_num_pkgs, transaction.rm_only_uninstalled); | |||
} | |||
} | |||
} |
@@ -74,7 +74,7 @@ namespace Pamac { | |||
public abstract void start_write_alpm_config (HashTable<string,Variant> new_alpm_conf) throws IOError; | |||
public abstract void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf) throws IOError; | |||
public abstract void start_generate_mirrors_list () throws IOError; | |||
public abstract void clean_cache (uint keep_nb, bool only_uninstalled) throws IOError; | |||
public abstract void clean_cache (uint64 keep_nb, bool only_uninstalled) throws IOError; | |||
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; | |||
@@ -144,6 +144,8 @@ namespace Pamac { | |||
public bool search_aur { get { return pamac_config.search_aur; } } | |||
public string aur_build_dir { get { return pamac_config.aur_build_dir; } } | |||
#endif | |||
public uint64 keep_num_pkgs { get { return pamac_config.keep_num_pkgs; } } | |||
public bool rm_only_uninstalled { get { return pamac_config.rm_only_uninstalled; } } | |||
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; } } | |||
@@ -505,7 +507,7 @@ namespace Pamac { | |||
} | |||
} | |||
public void clean_cache (uint keep_nb, bool only_uninstalled) { | |||
public void clean_cache (uint64 keep_nb, bool only_uninstalled) { | |||
try { | |||
system_daemon.clean_cache (keep_nb, only_uninstalled); | |||
} catch (IOError e) { |