Commit 13f51597 authored by guinux's avatar guinux

fixes

parent c09096ef
......@@ -143,10 +143,10 @@ internal class AlpmConfig {
var file = GLib.File.new_for_path (tmp_dbpath);
if (!file.query_exists ()) {
Process.spawn_command_line_sync ("mkdir -p %s/sync".printf (tmp_dbpath));
Process.spawn_command_line_sync ("chmod -R 777 %s/sync".printf (tmp_dbpath));
Process.spawn_command_line_sync ("chmod -R ugo+w %s".printf (tmp_dbpath));
}
Process.spawn_command_line_sync ("ln -sf %slocal %s".printf (dbpath, tmp_dbpath));
Process.spawn_command_line_sync ("cp -au %ssync %s".printf (dbpath, tmp_dbpath));
Process.spawn_command_line_sync ("cp -ru %ssync %s".printf (dbpath, tmp_dbpath));
handle = new Alpm.Handle (rootdir, tmp_dbpath, out error);
if (error == Alpm.Errno.DB_VERSION) {
try {
......
......@@ -174,7 +174,7 @@ namespace Pamac {
var file = GLib.File.new_for_path (tmp_dbpath);
if (file.query_exists ()) {
try {
Process.spawn_command_line_sync ("cp -au %s/sync %s".printf (tmp_dbpath, alpm_handle.dbpath));
Process.spawn_command_line_sync ("cp -ru %s/sync %s".printf (tmp_dbpath, alpm_handle.dbpath));
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
......@@ -665,6 +665,12 @@ namespace Pamac {
// emit warnings here
alpm_handle.logcb = (Alpm.LogCallBack) cb_log;
// fake aur db
string tmp_dbpath = "/tmp/pamac-checkdbs";
try {
Process.spawn_command_line_sync ("cp %s/sync/aur.db %ssync".printf (tmp_dbpath, alpm_handle.dbpath));
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
alpm_handle.register_syncdb ("aur", 0);
// add to_build in to_install for the fake trans prepare
foreach (unowned string name in to_build) {
......@@ -790,11 +796,6 @@ namespace Pamac {
pkgs_to_remove.next ();
}
trans_release ();
try {
Process.spawn_command_line_sync ("rm -f %ssync/aur.db".printf (alpm_handle.dbpath));
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
// get standard handle
refresh_handle ();
// warnings already emitted
......@@ -808,6 +809,11 @@ namespace Pamac {
trans_release ();
}
}
try {
Process.spawn_command_line_sync ("rm -f %ssync/aur.db".printf (alpm_handle.dbpath));
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
if (!success) {
// get standard handle
refresh_handle ();
......
......@@ -185,10 +185,12 @@ namespace Pamac {
display_build_help ();
} else if (args[2] == "--builddir") {
init_transaction ();
transaction.database.config.aur_build_dir = args[3];
database.config.enable_aur = true;
database.config.aur_build_dir = args[3];
build_pkgs (args[4:args.length]);
} else {
init_transaction ();
database.config.enable_aur = true;
build_pkgs (args[2:args.length]);
}
} else {
......@@ -289,10 +291,10 @@ namespace Pamac {
exit_status = 1;
return;
}
transaction.database.config.enable_aur = true;
transaction.database.config.check_aur_updates = true;
database.config.enable_aur = true;
database.config.check_aur_updates = true;
} else if (arg == "--builddir") {
transaction.database.config.aur_build_dir = args[i+1];
database.config.aur_build_dir = args[i+1];
i++;
} else if (arg == "--force-refresh") {
force_refresh = true;
......
......@@ -69,12 +69,13 @@ namespace Pamac {
public void refresh () {
alpm_config = new AlpmConfig ("/etc/pacman.conf");
alpm_handle = alpm_config.get_handle ();
// use tmp dbs
alpm_handle = alpm_config.get_handle (false, true);
if (alpm_handle == null) {
critical (dgettext (null, "Failed to initialize alpm library"));
return;
} else {
files_handle = alpm_config.get_handle (true);
files_handle = alpm_config.get_handle (true, true);
}
refreshed ();
}
......@@ -120,7 +121,7 @@ namespace Pamac {
return country;
}
public string get_db_path () {
internal string get_tmp_db_path () {
return alpm_handle.dbpath;
}
......@@ -128,10 +129,6 @@ namespace Pamac {
return alpm_handle.checkspace == 1 ? true : false;
}
public string get_lockfile () {
return alpm_handle.lockfile;
}
public List<string> get_ignorepkgs () {
var result = new List<string> ();
unowned Alpm.List<unowned string> ignorepkgs = alpm_handle.ignorepkgs;
......@@ -1407,9 +1404,8 @@ namespace Pamac {
return get_aur_updates_real (yield aur_multiinfo (local_pkgs));
}
public async void refresh_tmp_files_dbs () {
var tmp_files_handle = alpm_config.get_handle (true, true);
unowned Alpm.List<unowned Alpm.DB> syncdbs = tmp_files_handle.syncdbs;
public void refresh_tmp_files_dbs () {
unowned Alpm.List<unowned Alpm.DB> syncdbs = files_handle.syncdbs;
while (syncdbs != null) {
unowned Alpm.DB db = syncdbs.data;
db.update (0);
......
......@@ -374,8 +374,6 @@ namespace Pamac {
scroll_to_top = false;
refresh_packages_list ();
});
// refresh files dbs in tmp in background
database.refresh_tmp_files_dbs.begin ();
transaction = new TransactionGtk (database, this);
transaction.start_preparing.connect (on_start_preparing);
......@@ -424,11 +422,14 @@ namespace Pamac {
// create screenshots tmp dir
string screenshots_tmp_dir = "/tmp/pamac-app-screenshots";
try {
Process.spawn_command_line_sync ("mkdir -p %s".printf (screenshots_tmp_dir));
Process.spawn_command_line_sync ("chmod -R 777 %s".printf (screenshots_tmp_dir));
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
var file = GLib.File.new_for_path (screenshots_tmp_dir);
if (!file.query_exists ()) {
try {
Process.spawn_command_line_sync ("mkdir -p %s".printf (screenshots_tmp_dir));
Process.spawn_command_line_sync ("chmod -R ugo+w %s".printf (screenshots_tmp_dir));
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
}
}
......
......@@ -291,8 +291,8 @@ namespace Pamac {
list.append (name_version);
list.append (" ");
}
Process.spawn_command_line_sync ("rm -f %ssync/aur.db".printf (database.get_db_path ()));
Process.spawn_command_line_sync ("bsdtar -cf %ssync/aur.db -C %s %s".printf (database.get_db_path (), aurdb_path, list.str));
Process.spawn_command_line_sync ("rm -f %ssync/aur.db".printf (database.get_tmp_db_path ()));
Process.spawn_command_line_sync ("bsdtar -cf %ssync/aur.db -C %s %s".printf (database.get_tmp_db_path (), aurdb_path, list.str));
} catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message);
}
......
......@@ -28,6 +28,7 @@ namespace Pamac {
[DBus (name = "org.manjaro.pamac.system")]
interface SystemDaemon : Object {
public abstract void set_environment_variables (HashTable<string,string> variables) throws Error;
public abstract string get_lockfile () throws Error;
public abstract void start_download_updates () throws Error;
[DBus (no_reply = true)]
public abstract void quit () throws Error;
......@@ -154,7 +155,7 @@ namespace Pamac {
}
// refresh files dbs in tmp
var database = new Database (config);
database.refresh_tmp_files_dbs.begin ();
database.refresh_tmp_files_dbs ();
} else {
set_icon (noupdate_icon_name);
set_tooltip (noupdate_info);
......@@ -304,11 +305,15 @@ namespace Pamac {
Notify.init (_("Package Manager"));
start_system_daemon (config.environment_variables);
// start and stop daemon just to connect to signal
string lockfile_str = "/var/lib/pacman/db.lck";
try {
lockfile_str = system_daemon.get_lockfile ();
} catch (Error e) {
stderr.printf ("Error: %s\n", e.message);
}
stop_system_daemon ();
var database = new Database (config);
lockfile = GLib.File.new_for_path (database.get_lockfile ());
lockfile = GLib.File.new_for_path (lockfile_str);
Timeout.add (200, check_extern_lock);
// wait 30 seconds before check updates
Timeout.add_seconds (30, () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment