Commit f4d842c5 authored by Philip Müller's avatar Philip Müller

[merge] fix conflicts

parents b83b0ae7 b351edf5
Pamac is a GUI for libalpm (pacman) with AUR and Appstream support
Pamac is a Package Manager based on libalpm with AUR and Appstream support
#### Features
- Library to access package infos and run transactions
- Python bindings
- CLI
- GTK3 frontend with Dbus daemon
- Tray icon with Updates notifications
- libpamac: Library to access package infos and run transactions
- Python bindings for libpamac
- pamac: a CLI
- pamac-manager/pamac-updater: a Gtk3 GUI
- pamac-tray: a Gtk3 tray icon with updates notifications
- pamac-tray-appindicator: a AppIndicator tray icon with updates notifications
#### Installing from source
......
......@@ -17,7 +17,7 @@ RefreshPeriod = 6
#CheckAURUpdates
## AUR build directory:
BuildDirectory = /tmp
BuildDirectory = /var/tmp
## Number of versions of each package to keep in the cache:
KeepNumPackages = 3
......
......@@ -26,7 +26,7 @@ if __name__ == "__main__":
for pkg in pkgs:
print_pkg_name (pkg)
print ("")
details = db.get_pkg_details(pkgname, appname)
details = db.get_pkg_details(pkgname, appname, False)
print_pkg_details (details)
print ("")
......@@ -36,5 +36,5 @@ if __name__ == "__main__":
for pkg in pkgs:
print_pkg_name (pkg)
print ("")
details = db.get_pkg_details(pkgname, appname)
details = db.get_pkg_details(pkgname, appname, False)
print_pkg_details (details)
......@@ -57,23 +57,23 @@ class GetInfosCase(unittest.TestCase):
def test_pacman_installed(self):
"""pacman installed for tests"""
pkg = self.db.get_pkg_details("pacman", "")
pkg = self.db.get_pkg_details("pacman", "", False)
self.assertEqual("pacman", pkg.get_name())
self.assertIsNotNone(pkg.props.installed_version)
def test_not_installed(self):
"""detect not installed"""
# package not exist
pkg = self.db.get_pkg_details("toto-test", "")
pkg = self.db.get_pkg_details("toto-test", "", False)
self.assertNotEqual("toto-test", pkg.get_name())
self.assertEqual(pkg.props.installed_version, "")
# package exist
pkg = self.db.get_pkg_details("ruby-yard", "")
pkg = self.db.get_pkg_details("ruby-yard", "", False)
self.assertEqual(pkg.props.installed_version, "")
def test_giobject_detail_name(self):
"""attrs .props are same as fonctions"""
pkg = self.db.get_pkg_details("pacman", "")
pkg = self.db.get_pkg_details("pacman", "", False)
self.assertEqual(pkg.props.name, pkg.get_name())
def test_giobject_search_name(self):
......@@ -127,7 +127,7 @@ class GetInfosCase(unittest.TestCase):
with self.subTest(pkg=pkg):
fdesc = f"/var/lib/pacman/local/{pkg.props.name}-{pkg.props.version}/desc"
self.assertTrue(os.path.exists(fdesc))
package = self.db.get_pkg_details(pkg.props.name, "")
package = self.db.get_pkg_details(pkg.props.name, "", False)
result = get_item_desc(fdesc, "%DEPENDS%")
for dep in result:
self.assertIn(dep, package.props.depends)
......@@ -149,7 +149,7 @@ class GetInfosCase(unittest.TestCase):
def test_date_detail_pacman(self):
"""valid date and locale date"""
pkg = self.db.get_pkg_details("pacman", "")
pkg = self.db.get_pkg_details("pacman", "", False)
fdesc = f"/var/lib/pacman/local/{pkg.props.name}-{pkg.props.version}/desc"
self.assertTrue(os.path.exists(fdesc))
result = get_item_desc(fdesc, "%BUILDDATE%")
......@@ -159,7 +159,7 @@ class GetInfosCase(unittest.TestCase):
def test_files(self):
"""files same as pacman db"""
pkg = self.db.get_pkg_details("pacman", "")
pkg = self.db.get_pkg_details("pacman", "", False)
fdesc = f"/var/lib/pacman/local/{pkg.props.name}-{pkg.props.version}/files"
self.assertTrue(os.path.exists(fdesc))
myfiles = self.db.get_pkg_files("pacman")
......@@ -188,7 +188,7 @@ class GetInfosCase(unittest.TestCase):
loop.quit()
self.assertTrue(found)
self.db.search_in_aur_async(
self.db.search_in_aur(
'pamac', on_search_aur_pkgs_ready_callback, None)
loop.run()
......
data/polkit/org.manjaro.pamac.policy.in
src/alpm_utils.vala
src/system_daemon.vala
src/database.vala
src/transaction.vala
src/transaction-gtk.vala
src/installer.vala
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pamac\n"
"Report-Msgid-Bugs-To: guillaume@manjaro.org\n"
"POT-Creation-Date: 2018-09-08 17:58+0200\n"
"POT-Creation-Date: 2018-10-18 11:38+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -21,30 +21,10 @@ msgstr ""
msgid "Authentication is required"
msgstr ""
#: src/alpm_utils.vala
#: src/alpm_utils.vala src/database.vala
msgid "Failed to initialize alpm library"
msgstr ""
#: src/alpm_utils.vala
msgid "Unknown"
msgstr ""
#: src/alpm_utils.vala src/manager_window.vala
msgid "Explicitly installed"
msgstr ""
#: src/alpm_utils.vala src/manager_window.vala
msgid "Installed as a dependency for another package"
msgstr ""
#: src/alpm_utils.vala
msgid "Yes"
msgstr ""
#: src/alpm_utils.vala
msgid "No"
msgstr ""
#: src/alpm_utils.vala
msgid "Failed to synchronize any databases"
msgstr ""
......@@ -53,11 +33,11 @@ msgstr ""
msgid "Failed to init transaction"
msgstr ""
#: src/alpm_utils.vala
#: src/alpm_utils.vala src/transaction.vala src/transaction-gtk.vala
msgid "Failed to prepare transaction"
msgstr ""
#: src/alpm_utils.vala src/cli.vala
#: src/alpm_utils.vala src/transaction.vala src/cli.vala
#, c-format
msgid "target not found: %s"
msgstr ""
......@@ -125,20 +105,51 @@ msgstr ""
msgid "Authentication failed"
msgstr ""
#: src/database.vala src/manager_window.vala
msgid "Explicitly installed"
msgstr ""
#: src/database.vala src/manager_window.vala
msgid "Installed as a dependency for another package"
msgstr ""
#: src/database.vala
msgid "Unknown"
msgstr ""
#: src/database.vala
msgid "Yes"
msgstr ""
#: src/database.vala
msgid "No"
msgstr ""
#: src/transaction.vala
msgid "Refreshing mirrors list"
#, c-format
msgid "Generating %s informations"
msgstr ""
#: src/transaction.vala
msgid "Synchronizing package databases"
msgid "Refreshing mirrors list"
msgstr ""
#: src/transaction.vala
msgid "Starting full system upgrade"
msgstr ""
#: src/transaction.vala src/tray.vala src/manager_window.vala src/cli.vala
msgid "Your system is up-to-date"
#: src/transaction.vala
msgid "Synchronizing package databases"
msgstr ""
#: src/transaction.vala src/cli.vala
#, c-format
msgid "Cloning %s build files"
msgstr ""
#: src/transaction.vala
#, c-format
msgid "Checking %s dependencies"
msgstr ""
#: src/transaction.vala
......@@ -352,6 +363,21 @@ msgstr ""
msgid "Total download size"
msgstr ""
#: src/transaction-gtk.vala src/transaction-cli.vala
#, c-format
msgid "Edit %s build files"
msgstr ""
#: src/transaction-gtk.vala
msgid "Save"
msgstr ""
#: src/transaction-gtk.vala src/manager_window.vala
#: resources/transaction_sum_dialog.ui resources/manager_window.ui
#: resources/choose_ignorepkgs_dialog.ui
msgid "_Cancel"
msgstr ""
#: src/transaction-gtk.vala resources/progress_dialog.ui
#: resources/history_dialog.ui resources/preferences_dialog.ui
msgid "_Close"
......@@ -373,6 +399,10 @@ msgstr ""
msgid "package(s)"
msgstr ""
#: src/tray.vala src/manager_window.vala src/cli.vala
msgid "Your system is up-to-date"
msgstr ""
#: src/tray.vala
msgid "_Quit"
msgstr ""
......@@ -409,6 +439,10 @@ msgstr ""
msgid "Install"
msgstr ""
#: src/manager_window.vala resources/manager_window.ui
msgid "Build"
msgstr ""
#: src/manager_window.vala resources/manager_window.ui
msgid "Remove"
msgstr ""
......@@ -508,6 +542,10 @@ msgstr ""
msgid "Files"
msgstr ""
#: src/manager_window.vala
msgid "Build files"
msgstr ""
#: src/manager_window.vala src/cli.vala
msgid "Install Reason"
msgstr ""
......@@ -616,11 +654,6 @@ msgstr ""
msgid "Install Local Packages"
msgstr ""
#: src/manager_window.vala resources/transaction_sum_dialog.ui
#: resources/manager_window.ui resources/choose_ignorepkgs_dialog.ui
msgid "_Cancel"
msgstr ""
#: src/manager_window.vala
msgid "_Open"
msgstr ""
......@@ -655,33 +688,46 @@ msgid "Enter a number (default=%d)"
msgstr ""
#: src/transaction-cli.vala
msgid "Total installed size"
msgid "[y/N]"
msgstr ""
#: src/transaction-cli.vala
msgid "Total removed size"
msgid "y"
msgstr ""
#: src/transaction-cli.vala
msgid "Commit transaction"
msgid "yes"
msgstr ""
#: src/transaction-cli.vala resources/transaction_sum_dialog.ui
msgid "Edit build files"
msgstr ""
#: src/transaction-cli.vala
msgid "[y/N]"
msgid "Total installed size"
msgstr ""
#: src/transaction-cli.vala
msgid "y"
msgid "Total removed size"
msgstr ""
#: src/transaction-cli.vala
msgid "yes"
msgid "Commit transaction"
msgstr ""
#: src/transaction-cli.vala
#, c-format
msgid "View %s build files diff"
msgstr ""
#: src/cli.vala
msgid "Building packages as root is not allowed"
msgstr ""
#: src/cli.vala
msgid "No PKGBUILD file found in current directory"
msgstr ""
#: src/cli.vala
msgid "Available actions"
msgstr ""
......@@ -758,7 +804,7 @@ msgid "list files owned by the given packages"
msgstr ""
#: src/cli.vala
msgid "Build packages from AUR and install them with their dependencies"
msgid "Clone or sync packages build files from AUR"
msgstr ""
#: src/cli.vala
......@@ -771,6 +817,39 @@ msgstr ""
msgid "dir"
msgstr ""
#: src/cli.vala
msgid "also clone needed dependencies"
msgstr ""
#: src/cli.vala
msgid "overwrite existing files"
msgstr ""
#: src/cli.vala
msgid "Build packages from AUR and install them with their dependencies"
msgstr ""
#: src/cli.vala
msgid ""
"If no package name is given, use the PKGBUILD file in the current directory"
msgstr ""
#: src/cli.vala
msgid ""
"The build directory will be the parent directory, --builddir option will be "
"ignored"
msgstr ""
#: src/cli.vala
msgid "do not clone build files from AUR, only use local files"
msgstr ""
#: src/cli.vala
msgid ""
"ignore a package upgrade, multiple packages can be specified by separating "
"them with a comma"
msgstr ""
#: src/cli.vala
msgid ""
"overwrite conflicting files, multiple patterns can be specified by "
......@@ -825,12 +904,6 @@ msgstr ""
msgid "enable package downgrades"
msgstr ""
#: src/cli.vala
msgid ""
"ignore a package upgrade, multiple packages can be specified by separating "
"them with a comma"
msgstr ""
#: src/cli.vala resources/manager_window.ui
msgid "Version"
msgstr ""
......@@ -908,6 +981,10 @@ msgstr ""
msgid "About"
msgstr ""
#: resources/manager_window.ui
msgid "Select All"
msgstr ""
#: resources/manager_window.ui
msgid "State"
msgstr ""
......@@ -925,11 +1002,11 @@ msgid "Reinstall"
msgstr ""
#: resources/manager_window.ui
msgid "_Apply"
msgid "Reset build files"
msgstr ""
#: resources/manager_window.ui
msgid "Select All"
msgid "_Apply"
msgstr ""
#: resources/preferences_dialog.ui
......
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<template class="PamacTransactionSumDialog" parent="GtkDialog">
......@@ -7,10 +7,13 @@
<property name="border_width">3</property>
<property name="title" translatable="yes">Transaction Summary</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">600</property>
<property name="default_width">900</property>
<property name="icon_name">system-software-install</property>
<property name="type_hint">dialog</property>
<property name="deletable">False</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox6">
<property name="can_focus">False</property>
......@@ -25,6 +28,9 @@
<property name="label" translatable="yes">_Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
</object>
......@@ -39,9 +45,6 @@
<property name="label" translatable="yes">Commit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
<property name="receives_default">False</property>
</object>
<packing>
......@@ -50,11 +53,23 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="edit_button">
<property name="label" translatable="yes">Edit build files</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
......@@ -149,6 +164,7 @@
<action-widgets>
<action-widget response="-6">cancel_button</action-widget>
<action-widget response="-5">apply_button</action-widget>
<action-widget response="-2">edit_button</action-widget>
</action-widgets>
</template>
</interface>
......@@ -134,20 +134,24 @@ internal class AlpmConfig {
}
}
public Alpm.Handle? get_handle (bool files_db = false, bool tmp_db = false, bool copy_dbs = true) {
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";
string tmp_path = "/tmp/pamac";
string tmp_dbpath = "/tmp/pamac/dbs-%s".printf (Environment.get_user_name ());
try {
if (! GLib.FileUtils.test (tmp_dbpath, GLib.FileTest.IS_DIR)) {
Process.spawn_command_line_sync ("mkdir -p %s/sync".printf (tmp_dbpath));
Process.spawn_command_line_sync ("ln -sf %slocal %s".printf (dbpath, tmp_dbpath));
Process.spawn_command_line_sync ("chmod -R 777 %s/sync".printf (tmp_dbpath));
if (copy_dbs) {
Process.spawn_command_line_sync ("bash -c 'cp -p %ssync/*.{db,files} %s/sync'".printf (dbpath, tmp_dbpath));
}
var file = GLib.File.new_for_path (tmp_path);
if (!file.query_exists ()) {
Process.spawn_command_line_sync ("mkdir -p %s".printf (tmp_path));
Process.spawn_command_line_sync ("chmod a+w %s".printf (tmp_path));
}
file = GLib.File.new_for_path (tmp_dbpath);
if (!file.query_exists ()) {
Process.spawn_command_line_sync ("mkdir -p %s".printf (tmp_dbpath));
Process.spawn_command_line_sync ("ln -s %slocal %s".printf (dbpath, tmp_dbpath));
}
Process.spawn_command_line_sync ("cp -au %ssync %s".printf (dbpath, tmp_dbpath));
handle = new Alpm.Handle (rootdir, tmp_dbpath, out error);
if (error == Alpm.Errno.DB_VERSION) {
try {
......
This diff is collapsed.
......@@ -25,37 +25,41 @@ namespace Pamac {
const string rpc_multiinfo = "&type=info";
const string rpc_multiinfo_arg = "&arg[]=";
Json.Array rpc_query (string uri) {
async Json.Array rpc_query (string uri) {
SourceFunc callback = rpc_query.callback;
var results = new Json.Array ();
var session = new Soup.Session ();
// set a 15 seconds timeout because it is also the dbus daemon timeout
session.timeout = 15;
var message = new Soup.Message ("GET", uri);
var parser = new Json.Parser ();
session.send_message (message);
try {
parser.load_from_data ((string) message.response_body.flatten ().data, -1);
} catch (Error e) {
critical (e.message);
}
unowned Json.Node? root = parser.get_root ();
if (root != null) {
if (root.get_object ().get_string_member ("type") == "error") {
stderr.printf ("Failed to query %s from AUR\n", uri);
} else {
results = root.get_object ().get_array_member ("results");
session.queue_message (message, (sess, mess) => {
try {
parser.load_from_data ((string) mess.response_body.flatten ().data, -1);
unowned Json.Node? root = parser.get_root ();
if (root != null) {
if (root.get_object ().get_string_member ("type") == "error") {
stderr.printf ("Failed to query %s from AUR\n", uri);
} else {
results = root.get_object ().get_array_member ("results");
}
}
} catch (Error e) {
critical (e.message);
}
}
Idle.add ((owned) callback);
});
yield;
return results;
}
internal Json.Array aur_search (string[] needles) {
internal async Json.Array aur_search (string[] needles) {
if (needles.length == 0) {
return new Json.Array ();
} else {
Json.Array[] found_array = {};
foreach (unowned string needle in needles) {
found_array += rpc_query (rpc_url + rpc_search + Uri.escape_string (needle));
found_array += yield rpc_query (rpc_url + rpc_search + Uri.escape_string (needle));
}
var result = new Json.Array ();
foreach (unowned Json.Array found in found_array) {
......@@ -81,17 +85,44 @@ namespace Pamac {
}
}
internal Json.Array aur_multiinfo (string[] pkgnames) {
internal async Json.Array aur_multiinfo (string[] pkgnames) {
if (pkgnames.length == 0) {
return new Json.Array ();
}
var builder = new StringBuilder ();
builder.append (rpc_url);
builder.append (rpc_multiinfo);
foreach (unowned string pkgname in pkgnames) {
builder.append (rpc_multiinfo_arg);
builder.append (Uri.escape_string (pkgname));
// query pkgnames hundred by hundred to avoid too long uri error
// example: ros-lunar-desktop
if (pkgnames.length <= 100) {
var builder = new StringBuilder ();
builder.append (rpc_url);
builder.append (rpc_multiinfo);
foreach (unowned string pkgname in pkgnames) {
builder.append (rpc_multiinfo_arg);
builder.append (Uri.escape_string (pkgname));
}
return yield rpc_query (builder.str);
} else {
var result = new Json.Array ();
int index_max = pkgnames.length - 1;
int index = 0;
while (index < index_max) {
var builder = new StringBuilder ();
builder.append (rpc_url);
builder.append (rpc_multiinfo);
for (int i = 0; i < 100; i++) {
unowned string pkgname = pkgnames[index];
builder.append (rpc_multiinfo_arg);
builder.append (Uri.escape_string (pkgname));
index++;
if (index == index_max) {
break;
}
}
var array = yield rpc_query (builder.str);
array.foreach_element ((array, index, node) => {
result.add_element (node);
});
}
return result;
}
return rpc_query (builder.str);
}
}
This diff is collapsed.
......@@ -65,6 +65,7 @@ namespace Pamac {
public string installed_version;
public string desc;
public double popularity;
public string packagebase;
}
struct AURPackageDetailsStruct {
......@@ -99,9 +100,4 @@ namespace Pamac {