diff --git a/data/config/pamac.conf b/data/config/pamac.conf index 32fb8b47132ba03b07ff80c76d3c660a0372a1d8..ebc04803d688d8111f86b7301598db9a7b772cb3 100644 --- a/data/config/pamac.conf +++ b/data/config/pamac.conf @@ -11,10 +11,13 @@ RefreshPeriod = 6 #NoUpdateHideIcon ## Allow Pamac to search and install packages from AUR: -#EnableAUR +EnableAUR ## When AUR support is enabled check for updates from AUR: -#CheckAURUpdates +CheckAURUpdates + +## When check updates from AUR support is enabled check for vcs updates: +CheckAURVCSUpdates ## AUR build directory: BuildDirectory = /var/tmp diff --git a/po/POTFILES b/po/POTFILES index 6e45a6e8beaf23d516bb940067d4e7df95ead407..f4d16101e162f3a1ef975807b5235f00a4c2c613 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -9,7 +9,7 @@ src/tray.vala src/manager.vala src/manager_window.vala src/preferences_dialog.vala -src/choose_ignorepkgs_dialog.vala +src/choose_pkgs_dialog.vala src/transaction-cli.vala src/cli.vala resources/choose_provider_dialog.ui @@ -18,4 +18,4 @@ resources/history_dialog.ui resources/transaction_sum_dialog.ui resources/manager_window.ui resources/preferences_dialog.ui -resources/choose_ignorepkgs_dialog.ui +resources/choose_pkgs_dialog.ui diff --git a/po/ar.po b/po/ar.po index f045410ffcd49cfd1b6716b9043c454127c43b3e..516dd5f6bd76e7a1a9ecf81a27e7b23ce244d2ba 100644 --- a/po/ar.po +++ b/po/ar.po @@ -10,7 +10,6 @@ # كريم أولاد الشلØØ© <herr.linux88@gmail.com>, 2013-2014 # Mohamed Shahin <mohamedali180@gmail.com>, 2016 # mohammadA <mohammadAbdulhadi1@gmail.com>, 2018 -# moh t <taiba_mohamed@hotmail.com>, 2018 # philm <philm@manjaro.org>, 2015 # Ù…Øمدأمين الصامت <mohamedamin.samet@gmail.com>, 2017 msgid "" @@ -18,8 +17,8 @@ msgstr "" "Project-Id-Version: manjaro-pamac\n" "Report-Msgid-Bugs-To: guillaume@manjaro.org\n" "POT-Creation-Date: 2018-10-18 11:38+0200\n" -"PO-Revision-Date: 2018-10-26 19:55+0000\n" -"Last-Translator: moh t <taiba_mohamed@hotmail.com>\n" +"PO-Revision-Date: 2018-10-18 09:49+0000\n" +"Last-Translator: Guillaume Benoit <guillaume@manjaro.org>\n" "Language-Team: Arabic (http://www.transifex.com/manjarolinux/manjaro-pamac/language/ar/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -138,7 +137,7 @@ msgstr "لا" #: src/transaction.vala #, c-format msgid "Generating %s informations" -msgstr "توليد %s المعلومات" +msgstr "" #: src/transaction.vala msgid "Refreshing mirrors list" @@ -155,7 +154,7 @@ msgstr "يزامن قاعدة بيانات الØزم" #: src/transaction.vala src/cli.vala #, c-format msgid "Cloning %s build files" -msgstr "استنساخ %s ملÙات البناء" +msgstr "" #: src/transaction.vala #, c-format @@ -384,7 +383,7 @@ msgstr "" #: src/transaction-gtk.vala msgid "Save" -msgstr "ØÙظ" +msgstr "" #: src/transaction-gtk.vala src/manager_window.vala #: resources/transaction_sum_dialog.ui resources/manager_window.ui @@ -407,11 +406,11 @@ msgstr "" #: src/installer.vala src/cli.vala msgid "Remove packages" -msgstr "ازالة الØزم" +msgstr "" #: src/installer.vala src/cli.vala msgid "package(s)" -msgstr "Øزمة(Øزم)" +msgstr "" #: src/tray.vala src/manager_window.vala src/cli.vala msgid "Your system is up-to-date" @@ -459,7 +458,7 @@ msgstr "تثبيت" #: src/manager_window.vala resources/manager_window.ui msgid "Build" -msgstr "بناء" +msgstr "" #: src/manager_window.vala resources/manager_window.ui msgid "Remove" @@ -510,7 +509,7 @@ msgstr "أجنبي" #: src/manager_window.vala msgid "Accessories" -msgstr "مستلزمات" +msgstr "" #: src/manager_window.vala msgid "Audio & Video" @@ -566,7 +565,7 @@ msgstr "ملÙات" #: src/manager_window.vala msgid "Build files" -msgstr "بناء الملÙات" +msgstr "" #: src/manager_window.vala src/cli.vala msgid "Install Reason" @@ -711,15 +710,15 @@ msgstr "أدخل رقمًا (المبدئي=%d)" #: src/transaction-cli.vala msgid "[y/N]" -msgstr "[نعم/لا]" +msgstr "" #: src/transaction-cli.vala msgid "y" -msgstr "نعم" +msgstr "" #: src/transaction-cli.vala msgid "yes" -msgstr "نعم" +msgstr "" #: src/transaction-cli.vala resources/transaction_sum_dialog.ui msgid "Edit build files" @@ -760,7 +759,7 @@ msgstr "" #: src/cli.vala msgid "options" -msgstr "خيارات" +msgstr "" #: src/cli.vala msgid "Search for packages or files, multiple search terms can be specified" @@ -789,7 +788,7 @@ msgstr "" #: src/cli.vala msgid "list installed packages" -msgstr "قائمة الØزم المثبتة" +msgstr "" #: src/cli.vala msgid "" @@ -845,7 +844,7 @@ msgstr "" #: src/cli.vala msgid "overwrite existing files" -msgstr "اعد الكتابة Ùوق الملÙات الموجودة" +msgstr "" #: src/cli.vala msgid "Build packages from AUR and install them with their dependencies" @@ -860,11 +859,11 @@ msgstr "" msgid "" "The build directory will be the parent directory, --builddir option will be " "ignored" -msgstr "دليل البناء Ø³ÙŠØµØ¨Ø Ø§Ù„Ø¯Ù„ÙŠÙ„ الاب الخيار builddir-- سيتجاهل " +msgstr "" #: src/cli.vala msgid "do not clone build files from AUR, only use local files" -msgstr "لا تستنسخ ملÙات البناء من AUR استخدم Ùقط الملÙات المØلية" +msgstr "" #: src/cli.vala msgid "" @@ -884,7 +883,7 @@ msgstr "" #: src/cli.vala msgid "Reinstall packages" -msgstr "اعد تثبيت الØزم" +msgstr "" #: src/cli.vala msgid "" @@ -898,7 +897,7 @@ msgstr "" #: src/cli.vala msgid "Exit code is 100 if updates are available" -msgstr "رمز الخروج 100 اذا وجدت التØديثات" +msgstr "" #: src/cli.vala msgid "also check updates in AUR" @@ -906,7 +905,7 @@ msgstr "" #: src/cli.vala msgid "Upgrade your system" -msgstr "رق نظامك" +msgstr "" #: src/cli.vala msgid "also upgrade packages installed from AUR" @@ -932,11 +931,11 @@ msgstr "إصدار" #: src/cli.vala msgid "Description" -msgstr "وصÙ" +msgstr "" #: src/cli.vala msgid "URL" -msgstr "رابط" +msgstr "" #: src/cli.vala resources/manager_window.ui msgid "Size" diff --git a/po/pamac.pot b/po/pamac.pot index 109d3e5aaac3fe5be2b580aa2da1e2e3cdd7f27b..de78c00061f050d0f269c1b6a600488a737ef6e9 100644 --- a/po/pamac.pot +++ b/po/pamac.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Pamac\n" "Report-Msgid-Bugs-To: guillaume@manjaro.org\n" -"POT-Creation-Date: 2018-10-18 11:38+0200\n" +"POT-Creation-Date: 2018-10-27 11:19+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" @@ -37,7 +37,7 @@ msgstr "" msgid "Failed to prepare transaction" msgstr "" -#: src/alpm_utils.vala src/transaction.vala src/cli.vala +#: src/alpm_utils.vala src/cli.vala #, c-format msgid "target not found: %s" msgstr "" @@ -105,6 +105,11 @@ msgstr "" msgid "Authentication failed" msgstr "" +#: src/database.vala src/transaction-gtk.vala src/manager_window.vala +#: src/transaction-cli.vala src/cli.vala resources/preferences_dialog.ui +msgid "AUR" +msgstr "" + #: src/database.vala src/manager_window.vala msgid "Explicitly installed" msgstr "" @@ -125,11 +130,6 @@ msgstr "" msgid "No" msgstr "" -#: src/transaction.vala -#, c-format -msgid "Generating %s informations" -msgstr "" - #: src/transaction.vala msgid "Refreshing mirrors list" msgstr "" @@ -147,6 +147,11 @@ msgstr "" msgid "Cloning %s build files" msgstr "" +#: src/transaction.vala +#, c-format +msgid "Generating %s informations" +msgstr "" + #: src/transaction.vala #, c-format msgid "Checking %s dependencies" @@ -326,8 +331,9 @@ msgstr "" msgid "Package Manager" msgstr "" -#: src/transaction-gtk.vala -msgid "Copy" +#: src/transaction-gtk.vala src/transaction-cli.vala +#, c-format +msgid "Choose optional dependencies for %s" msgstr "" #: src/transaction-gtk.vala src/transaction-cli.vala @@ -374,7 +380,7 @@ msgstr "" #: src/transaction-gtk.vala src/manager_window.vala #: resources/transaction_sum_dialog.ui resources/manager_window.ui -#: resources/choose_ignorepkgs_dialog.ui +#: resources/choose_pkgs_dialog.ui msgid "_Cancel" msgstr "" @@ -530,10 +536,6 @@ msgstr "" msgid "System Tools" msgstr "" -#: src/manager_window.vala src/cli.vala resources/preferences_dialog.ui -msgid "AUR" -msgstr "" - #: src/manager_window.vala msgid "Dependencies" msgstr "" @@ -563,75 +565,75 @@ msgid "Repository" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Packager" +msgid "Package Base" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Build Date" +msgid "Maintainer" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Install Date" +msgid "First Submitted" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Signatures" +msgid "Last Modified" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Backup files" +msgid "Votes" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Depends On" +msgid "Out of Date" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Optional Dependencies" +msgid "Packager" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Required By" +msgid "Build Date" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Optional For" +msgid "Install Date" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Provides" +msgid "Signatures" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Replaces" +msgid "Backup files" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Conflicts With" +msgid "Depends On" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Package Base" +msgid "Optional Dependencies" msgstr "" -#: src/manager_window.vala -msgid "Maintainer" +#: src/manager_window.vala src/cli.vala +msgid "Required By" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "First Submitted" +msgid "Optional For" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Last Modified" +msgid "Provides" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Votes" +msgid "Replaces" msgstr "" #: src/manager_window.vala src/cli.vala -msgid "Out of Date" +msgid "Conflicts With" msgstr "" #: src/manager_window.vala src/cli.vala @@ -682,6 +684,19 @@ msgstr "" msgid "Worldwide" msgstr "" +#: src/preferences_dialog.vala +msgid "Choose Ignored Upgrades" +msgstr "" + +#: src/transaction-cli.vala src/cli.vala +#, c-format +msgid "Enter a selection (default=%s)" +msgstr "" + +#: src/transaction-cli.vala +msgid "none" +msgstr "" + #: src/transaction-cli.vala #, c-format msgid "Enter a number (default=%d)" @@ -728,6 +743,10 @@ msgstr "" msgid "No PKGBUILD file found in current directory" msgstr "" +#: src/cli.vala +msgid "Check development packages updates as root is not allowed" +msgstr "" + #: src/cli.vala msgid "Available actions" msgstr "" @@ -749,7 +768,7 @@ msgid "file(s)" msgstr "" #: src/cli.vala -msgid "search in AUR instead of repositories" +msgid "also search in AUR" msgstr "" #: src/cli.vala @@ -765,6 +784,14 @@ msgstr "" msgid "List packages, groups, repositories or files" msgstr "" +#: src/cli.vala +msgid "group(s)" +msgstr "" + +#: src/cli.vala +msgid "repo(s)" +msgstr "" + #: src/cli.vala msgid "list installed packages" msgstr "" @@ -785,10 +812,6 @@ msgid "" "list all groups" msgstr "" -#: src/cli.vala -msgid "group(s)" -msgstr "" - #: src/cli.vala msgid "" "list all packages available in the given repos, if no repo is given list all " @@ -796,15 +819,15 @@ msgid "" msgstr "" #: src/cli.vala -msgid "repo(s)" +msgid "list files owned by the given packages" msgstr "" #: src/cli.vala -msgid "list files owned by the given packages" +msgid "Clone or sync packages build files from AUR" msgstr "" #: src/cli.vala -msgid "Clone or sync packages build files from AUR" +msgid "dir" msgstr "" #: src/cli.vala @@ -813,10 +836,6 @@ msgid "" "file is used" msgstr "" -#: src/cli.vala -msgid "dir" -msgstr "" - #: src/cli.vala msgid "also clone needed dependencies" msgstr "" @@ -844,6 +863,10 @@ msgstr "" msgid "do not clone build files from AUR, only use local files" msgstr "" +#: src/cli.vala +msgid "glob" +msgstr "" + #: src/cli.vala msgid "" "ignore a package upgrade, multiple packages can be specified by separating " @@ -856,10 +879,6 @@ msgid "" "separating them with a comma" msgstr "" -#: src/cli.vala -msgid "glob" -msgstr "" - #: src/cli.vala msgid "Reinstall packages" msgstr "" @@ -882,6 +901,20 @@ msgstr "" msgid "also check updates in AUR" msgstr "" +#: src/cli.vala +msgid "also check development packages updates (use with --aur)" +msgstr "" + +#: src/cli.vala +msgid "only print one line per update" +msgstr "" + +#: src/cli.vala +msgid "" +"build directory (use with --devel), if no directory is given the one " +"specified in pamac.conf file is used" +msgstr "" + #: src/cli.vala msgid "Upgrade your system" msgstr "" @@ -938,14 +971,14 @@ msgstr[0] "" msgstr[1] "" #: src/cli.vala -msgid "Enter a selection (default=all)" +msgid "all" msgstr "" #: resources/choose_provider_dialog.ui msgid "Choose a Provider" msgstr "" -#: resources/choose_provider_dialog.ui resources/choose_ignorepkgs_dialog.ui +#: resources/choose_provider_dialog.ui resources/choose_pkgs_dialog.ui msgid "Choose" msgstr "" @@ -1074,6 +1107,10 @@ msgstr "" msgid "Check for updates from AUR" msgstr "" +#: resources/preferences_dialog.ui +msgid "Check for development packages updates" +msgstr "" + #: resources/preferences_dialog.ui msgid "Remove only the versions of uninstalled packages" msgstr "" @@ -1085,7 +1122,3 @@ msgstr "" #: resources/preferences_dialog.ui msgid "Cache" msgstr "" - -#: resources/choose_ignorepkgs_dialog.ui -msgid "Choose Ignored Upgrades" -msgstr "" diff --git a/po/pl_PL.po b/po/pl_PL.po index 1acb01f5d43722816f20ac06a1e822cac9c65e12..abd2246b31a18c190b07922d51ebd675e05b8ac2 100644 --- a/po/pl_PL.po +++ b/po/pl_PL.po @@ -4,7 +4,6 @@ # Guillaume Benoit <guillaume@manjaro.org>, 2013-2018. # # Translators: -# Marcin DomaÅ„ski <marcin.domanski92@gmail.com>, 2018 # Piotr Miller <nwg.piotr@gmail.com>, 2018 # Ulther Ego <ulther@protonmail.com>, 2018 msgid "" @@ -12,8 +11,8 @@ msgstr "" "Project-Id-Version: manjaro-pamac\n" "Report-Msgid-Bugs-To: guillaume@manjaro.org\n" "POT-Creation-Date: 2018-10-18 11:38+0200\n" -"PO-Revision-Date: 2018-10-26 20:16+0000\n" -"Last-Translator: Marcin DomaÅ„ski <marcin.domanski92@gmail.com>\n" +"PO-Revision-Date: 2018-10-18 09:49+0000\n" +"Last-Translator: Guillaume Benoit <guillaume@manjaro.org>\n" "Language-Team: Polish (Poland) (http://www.transifex.com/manjarolinux/manjaro-pamac/language/pl_PL/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -132,7 +131,7 @@ msgstr "Nie" #: src/transaction.vala #, c-format msgid "Generating %s informations" -msgstr "Generowanie %s informacji" +msgstr "" #: src/transaction.vala msgid "Refreshing mirrors list" @@ -149,12 +148,12 @@ msgstr "Synchronizacja pakietów bazy danych" #: src/transaction.vala src/cli.vala #, c-format msgid "Cloning %s build files" -msgstr "Kopiowanie %s plików kompilacji" +msgstr "" #: src/transaction.vala #, c-format msgid "Checking %s dependencies" -msgstr "Sprawdzanie %s zależnoÅ›ci" +msgstr "" #: src/transaction.vala msgid "Preparing" @@ -302,10 +301,10 @@ msgstr " PozostaÅ‚o okoÅ‚o %u sekund" #, c-format msgid "About %lu minute remaining" msgid_plural "About %lu minutes remaining" -msgstr[0] "PozostaÅ‚a %lu minuta" -msgstr[1] "PozostaÅ‚o okoÅ‚o %lu minut" -msgstr[2] "PozostaÅ‚o okoÅ‚o %lu minut" -msgstr[3] "PozostaÅ‚o okoÅ‚o %lu minut" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" +msgstr[3] "" #: src/transaction.vala #, c-format @@ -372,11 +371,11 @@ msgstr "ÅÄ…czny rozmiar pobierania" #: src/transaction-gtk.vala src/transaction-cli.vala #, c-format msgid "Edit %s build files" -msgstr "Edytuj %s pliki budowania" +msgstr "" #: src/transaction-gtk.vala msgid "Save" -msgstr "Zapisz" +msgstr "" #: src/transaction-gtk.vala src/manager_window.vala #: resources/transaction_sum_dialog.ui resources/manager_window.ui @@ -449,7 +448,7 @@ msgstr "Instalacja" #: src/manager_window.vala resources/manager_window.ui msgid "Build" -msgstr "Zbuduj" +msgstr "" #: src/manager_window.vala resources/manager_window.ui msgid "Remove" @@ -554,7 +553,7 @@ msgstr "Pliki" #: src/manager_window.vala msgid "Build files" -msgstr "Zbuduj pliki" +msgstr "" #: src/manager_window.vala src/cli.vala msgid "Install Reason" @@ -646,7 +645,7 @@ msgstr "Nieaktualne" #: src/manager_window.vala src/cli.vala msgid "Make Dependencies" -msgstr "Przygotuj zależnoÅ›ci" +msgstr "" #: src/manager_window.vala src/cli.vala msgid "Check Dependencies" @@ -674,7 +673,7 @@ msgstr "Pakiet alpm" #: src/manager_window.vala msgid "A Gtk3 frontend for libalpm" -msgstr "NakÅ‚adka graficzna GTK3 dla libalpm" +msgstr "" #: src/preferences_dialog.vala resources/preferences_dialog.ui msgid "How often to check for updates, value in hours" @@ -686,11 +685,11 @@ msgstr "Ilość wersji każdego pakietu przechowywanych w cache" #: src/preferences_dialog.vala msgid "Build directory" -msgstr "Katalog budowania" +msgstr "" #: src/preferences_dialog.vala msgid "Worldwide" -msgstr "ogólnoÅ›wiatowy" +msgstr "" #: src/transaction-cli.vala #, c-format @@ -699,44 +698,44 @@ msgstr "Wprowadź liczbÄ™ (domyÅ›lnie=%d)" #: src/transaction-cli.vala msgid "[y/N]" -msgstr "[t/N]" +msgstr "" #: src/transaction-cli.vala msgid "y" -msgstr "t" +msgstr "" #: src/transaction-cli.vala msgid "yes" -msgstr "tak" +msgstr "" #: src/transaction-cli.vala resources/transaction_sum_dialog.ui msgid "Edit build files" -msgstr "Edytuj pliki budowania" +msgstr "" #: src/transaction-cli.vala msgid "Total installed size" -msgstr "CaÅ‚kowity rozmiar instalacji" +msgstr "" #: src/transaction-cli.vala msgid "Total removed size" -msgstr "CaÅ‚kowity rozmiar do usuniÄ™cia" +msgstr "" #: src/transaction-cli.vala msgid "Commit transaction" -msgstr "Przeprowadź transakcjÄ™" +msgstr "" #: src/transaction-cli.vala #, c-format msgid "View %s build files diff" -msgstr "Kopiowanie %s plików budowania" +msgstr "" #: src/cli.vala msgid "Building packages as root is not allowed" -msgstr "Budowanie pakietów jak root jest niedozwolone" +msgstr "" #: src/cli.vala msgid "No PKGBUILD file found in current directory" -msgstr "Nie znaleziono pliku PKGBUILD w obecnym katalogu" +msgstr "" #: src/cli.vala msgid "Available actions" @@ -760,12 +759,12 @@ msgstr "plik(ów)" #: src/cli.vala msgid "search in AUR instead of repositories" -msgstr "szukanie w AUR zamiast w repozytoriach" +msgstr "" #: src/cli.vala msgid "" "search for packages which own the given filenames (filenames can be partial)" -msgstr "szukaj pakietów, które posiadajÄ… podane nazwy plików (nazwy plików mogÄ… być częściowe)" +msgstr "" #: src/cli.vala msgid "Display package details, multiple packages can be specified" @@ -777,23 +776,23 @@ msgstr "WyÅ›wietl pakiety, grupy, repozytoria lub pliki" #: src/cli.vala msgid "list installed packages" -msgstr "lista zainstalowanych pakietów" +msgstr "" #: src/cli.vala msgid "" "list packages that were installed as dependencies but are no longer required" " by any installed package" -msgstr "lista pakietów, które zostaÅ‚y zainstalowane jako zależnoÅ›ci, ale nie sÄ… już wymagane przez żaden zainstalowany pakiet" +msgstr "" #: src/cli.vala msgid "list packages that were not found in the repositories" -msgstr "lista pakietów, które nie zostaÅ‚y znalezione w repozytoriach" +msgstr "" #: src/cli.vala msgid "" "list all packages that are members of the given groups, if no group is given" " list all groups" -msgstr "pokaż wszystkie pakiety bÄ™dÄ…ce czÅ‚onkami danej grupy, jeÅ›li nie podano żadnej grupy to pokaż wszystkie grupy" +msgstr "" #: src/cli.vala msgid "group(s)" @@ -803,7 +802,7 @@ msgstr "grup(y)" msgid "" "list all packages available in the given repos, if no repo is given list all" " repos" -msgstr "pokaż wszystkie pakiety dostÄ™pne w repozytorium, jeÅ›li nie podano repozytorium, pokaż wszystkie repozytoria " +msgstr "" #: src/cli.vala msgid "repo(s)" @@ -811,29 +810,29 @@ msgstr "repozytorium(ów)" #: src/cli.vala msgid "list files owned by the given packages" -msgstr "pokaż pliki należące do podanych pakietów" +msgstr "" #: src/cli.vala msgid "Clone or sync packages build files from AUR" -msgstr "Sklonuj lub zsynchronizuj pliki budowanych pakietów z AUR" +msgstr "" #: src/cli.vala msgid "" "build directory, if no directory is given the one specified in pamac.conf " "file is used" -msgstr "katalog budowania, jeÅ›li nie podano katalogu, użyty zostanie katalog okreÅ›lony w pamac.conf" +msgstr "" #: src/cli.vala msgid "dir" -msgstr "katalog" +msgstr "" #: src/cli.vala msgid "also clone needed dependencies" -msgstr "pobierz także potrzebne zależnoÅ›ci" +msgstr "" #: src/cli.vala msgid "overwrite existing files" -msgstr "nadpisz istniejÄ…ce pliki" +msgstr "" #: src/cli.vala msgid "Build packages from AUR and install them with their dependencies" @@ -842,29 +841,29 @@ msgstr "Buduj pakiety z AUR i instaluj wraz z zależnoÅ›ciami" #: src/cli.vala msgid "" "If no package name is given, use the PKGBUILD file in the current directory" -msgstr "JeÅ›li nie podano nazwy pakietu, użyty zostanie plik PKGBUILD w obecnym katalogu" +msgstr "" #: src/cli.vala msgid "" "The build directory will be the parent directory, --builddir option will be " "ignored" -msgstr "Katalog budowania bÄ™dzie katalogiem nadrzÄ™dnym, opcja --builddir bÄ™dzie ignorowana" +msgstr "" #: src/cli.vala msgid "do not clone build files from AUR, only use local files" -msgstr "nie klonuj plików budowania z AUR, tylko użyj lokalnych plików" +msgstr "" #: src/cli.vala msgid "" "ignore a package upgrade, multiple packages can be specified by separating " "them with a comma" -msgstr "ignoruj aktualizacjÄ™ pakietu, można okreÅ›lić wiele pakietów, oddzielajÄ…c je przecinkiem" +msgstr "" #: src/cli.vala msgid "" "overwrite conflicting files, multiple patterns can be specified by " "separating them with a comma" -msgstr "zastÄ…p pliki bÄ™dÄ…ce w konflikcie, można okreÅ›lić wiele wzorców, oddzielajÄ…c je przecinkiem" +msgstr "" #: src/cli.vala msgid "glob" @@ -878,7 +877,7 @@ msgstr "Przeinstaluj pakiety" msgid "" "remove dependencies that are not required by other packages, if this option " "is used without package name remove all orphans" -msgstr "usuÅ„ zależnoÅ›ci, które nie sÄ… wymagane przez inne pakiety, jeÅ›li ta opcja jest używana bez nazwy pakietu, usuÅ„ wszystkie osierocone pakiety" +msgstr "" #: src/cli.vala msgid "Safely check for updates without modifiying the databases" @@ -886,11 +885,11 @@ msgstr "Bezpiecznie sprawdź aktualizacje bez modyfikowania bazy" #: src/cli.vala msgid "Exit code is 100 if updates are available" -msgstr "Kod zakoÅ„czenia to 100, jeÅ›li aktualizacje sÄ… dostÄ™pne" +msgstr "" #: src/cli.vala msgid "also check updates in AUR" -msgstr "sprawdź również aktualizacje w AUR" +msgstr "" #: src/cli.vala msgid "Upgrade your system" @@ -898,21 +897,21 @@ msgstr "Zaktualizuj system" #: src/cli.vala msgid "also upgrade packages installed from AUR" -msgstr "aktualizuj również pakiety zainstalowane z AUR" +msgstr "" #: src/cli.vala msgid "" "build directory (use with --aur), if no directory is given the one specified" " in pamac.conf file is used" -msgstr "katalog budowania (użyj --aur), jeÅ›li nie podano katalogu, użyty zostanie katalog okreÅ›lony w pamac.conf" +msgstr "" #: src/cli.vala msgid "force the refresh of the databases" -msgstr "wymuÅ› odÅ›wieżenie bazy danych" +msgstr "" #: src/cli.vala msgid "enable package downgrades" -msgstr "możliwe obniżenie wersji pakietu" +msgstr "" #: src/cli.vala resources/manager_window.ui msgid "Version" @@ -933,7 +932,7 @@ msgstr "Rozmiar" #: src/cli.vala #, c-format msgid "No package owns %s" -msgstr "Å»aden pakiet nie posiada %s" +msgstr "" #: src/cli.vala #, c-format @@ -967,7 +966,7 @@ msgstr "PostÄ™p" #: resources/history_dialog.ui msgid "Pamac History" -msgstr "Historia Pamac" +msgstr "" #: resources/transaction_sum_dialog.ui msgid "Transaction Summary" @@ -991,7 +990,7 @@ msgstr "Ustawienia" #: resources/manager_window.ui msgid "About" -msgstr "O" +msgstr "" #: resources/manager_window.ui msgid "Select All" @@ -999,7 +998,7 @@ msgstr "Wybierz wszystko" #: resources/manager_window.ui msgid "State" -msgstr "Stan" +msgstr "" #: resources/manager_window.ui msgid "Popularity" @@ -1015,7 +1014,7 @@ msgstr "Przeinstaluj" #: resources/manager_window.ui msgid "Reset build files" -msgstr "Resetuj pliki budowania" +msgstr "" #: resources/manager_window.ui msgid "_Apply" @@ -1087,7 +1086,7 @@ msgstr "Sprawdź aktualizacje w AUR" #: resources/preferences_dialog.ui msgid "Remove only the versions of uninstalled packages" -msgstr "UsuÅ„ tylko wersje odinstalowanych pakietów" +msgstr "" #: resources/preferences_dialog.ui msgid "Clean cache" diff --git a/resources/choose_pkgs_dialog.ui b/resources/choose_pkgs_dialog.ui new file mode 100644 index 0000000000000000000000000000000000000000..6503abfa648b1f7952323c04f5fcc15a317b5bcb --- /dev/null +++ b/resources/choose_pkgs_dialog.ui @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.0 --> +<interface> + <requires lib="gtk+" version="3.20"/> + <template class="PamacChoosePkgsDialog" parent="GtkDialog"> + <property name="can_focus">False</property> + <property name="border_width">3</property> + <property name="modal">True</property> + <property name="window_position">center-on-parent</property> + <property name="default_width">600</property> + <property name="icon_name">system-software-install</property> + <property name="type_hint">dialog</property> + <property name="urgency_hint">True</property> + <property name="deletable">False</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="cancel_button"> + <property name="label" translatable="yes">_Cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="valid_button"> + <property name="label" translatable="yes">Choose</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> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="shadow_type">in</property> + <property name="min_content_width">300</property> + <property name="min_content_height">250</property> + <child> + <object class="GtkTreeView" id="treeview"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="has_focus">True</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <property name="search_column">1</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection"> + <property name="mode">none</property> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn1"> + <property name="sizing">autosize</property> + <child> + <object class="GtkCellRendererToggle" id="renderertoggle"> + <signal name="toggled" handler="on_renderertoggle_toggled" swapped="no"/> + </object> + <attributes> + <attribute name="active">0</attribute> + </attributes> + </child> + <child> + <object class="GtkCellRendererText" id="renderertext1"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> + </child> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-6">cancel_button</action-widget> + <action-widget response="-5">valid_button</action-widget> + </action-widgets> + </template> +</interface> diff --git a/resources/pamac.manager.gresource.xml b/resources/pamac.manager.gresource.xml index 3e773005c7983025d7c79a4a66ea93950ba23dc8..40f033ec4465044a0951d6f440c2144e52a59588 100644 --- a/resources/pamac.manager.gresource.xml +++ b/resources/pamac.manager.gresource.xml @@ -15,6 +15,5 @@ </gresource> <gresource prefix="/org/manjaro/pamac/preferences"> <file preprocess="xml-stripblanks">preferences_dialog.ui</file> - <file preprocess="xml-stripblanks">choose_ignorepkgs_dialog.ui</file> </gresource> </gresources> diff --git a/resources/pamac.transaction.gresource.xml b/resources/pamac.transaction.gresource.xml index 8963a0b2582a7f66d13afe65aa978dd10c27dbfa..88c33d016fb05346fda9dbbd953d905c80e2f94f 100644 --- a/resources/pamac.transaction.gresource.xml +++ b/resources/pamac.transaction.gresource.xml @@ -4,6 +4,7 @@ <file preprocess="xml-stripblanks">progress_dialog.ui</file> <file preprocess="xml-stripblanks">progress_box.ui</file> <file preprocess="xml-stripblanks">choose_provider_dialog.ui</file> + <file preprocess="xml-stripblanks">choose_pkgs_dialog.ui</file> <file preprocess="xml-stripblanks">transaction_sum_dialog.ui</file> </gresource> </gresources> diff --git a/resources/preferences_dialog.ui b/resources/preferences_dialog.ui index 42824c0c5858a2b14cf4d09c6de5288da8545a25..080c7d6c45d376c25c0284bd40884f53cf18edc3 100644 --- a/resources/preferences_dialog.ui +++ b/resources/preferences_dialog.ui @@ -627,6 +627,24 @@ All AUR users should be familiar with the build process.</property> <property name="position">2</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="check_aur_vcs_updates_checkbutton"> + <property name="label" translatable="yes">Check for development packages updates</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="margin_left">24</property> + <property name="margin_start">24</property> + <property name="hexpand">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> <child> <object class="GtkBox" id="box3"> <property name="visible">True</property> @@ -666,7 +684,7 @@ All AUR users should be familiar with the build process.</property> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">3</property> + <property name="position">4</property> </packing> </child> </object> diff --git a/resources/transaction_sum_dialog.ui b/resources/transaction_sum_dialog.ui index 99710e22ee675f1d53da94983a59aa87d7ff50a4..c99fb57b06a535e51979bea13688aab47b20bd42 100644 --- a/resources/transaction_sum_dialog.ui +++ b/resources/transaction_sum_dialog.ui @@ -150,6 +150,28 @@ </child> </object> </child> + <child> + <object class="GtkTreeViewColumn" id="_repo"> + <property name="sizing">autosize</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext5"/> + <attributes> + <attribute name="text">4</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="_size"> + <property name="sizing">autosize</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext6"/> + <attributes> + <attribute name="text">5</attribute> + </attributes> + </child> + </object> + </child> </object> </child> </object> diff --git a/src/alpm_utils.vala b/src/alpm_utils.vala index cfd0c83a6c2476e18a9ad0d32d8c117900097899..3a76bdb8fb9f577274e3e37377ff83b7493d73f9 100644 --- a/src/alpm_utils.vala +++ b/src/alpm_utils.vala @@ -777,7 +777,8 @@ namespace Pamac { version = trans_pkg.version, installed_version = "", desc = "", - packagebase = "" + packagebase = "", + outofdate = "" }; if (!(trans_pkg.name in to_build)) { to_install_as_dep.insert (trans_pkg.name, trans_pkg.name); diff --git a/src/aur.vala b/src/aur.vala index bb3830bc00380f3a63f605795946fd16333ef172..5c90dc948bd12229a1189f48e6ba67e5ef442796 100644 --- a/src/aur.vala +++ b/src/aur.vala @@ -19,8 +19,7 @@ namespace Pamac { // AUR urls - const string aur_url = "http://aur.archlinux.org"; - const string rpc_url = aur_url + "/rpc/?v=5"; + const string rpc_url = "https://aur.archlinux.org/rpc/?v=5"; const string rpc_search = "&type=search&arg="; const string rpc_multiinfo = "&type=info"; const string rpc_multiinfo_arg = "&arg[]="; diff --git a/src/choose_pkgs_dialog.vala b/src/choose_pkgs_dialog.vala new file mode 100644 index 0000000000000000000000000000000000000000..f0e86caa701c3e892b1cec2d95c804560febf69e --- /dev/null +++ b/src/choose_pkgs_dialog.vala @@ -0,0 +1,49 @@ +/* + * pamac-vala + * + * Copyright (C) 2015-2018 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 { + + [GtkTemplate (ui = "/org/manjaro/pamac/transaction/choose_pkgs_dialog.ui")] + public class ChoosePkgsDialog : Gtk.Dialog { + + [GtkChild] + public Gtk.TreeView treeview; + + public Gtk.ListStore pkgs_list; + + public ChoosePkgsDialog (Gtk.Window window) { + int use_header_bar; + Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header_bar); + Object (transient_for: window, use_header_bar: use_header_bar); + + pkgs_list = new Gtk.ListStore (2, typeof (bool), typeof (string)); + treeview.set_model (pkgs_list); + } + + [GtkCallback] + void on_renderertoggle_toggled (string path) { + Gtk.TreeIter iter; + bool selected; + if (pkgs_list.get_iter_from_string (out iter, path)) { + pkgs_list.get (iter, 0, out selected); + pkgs_list.set (iter, 0, !selected); + } + } + } +} diff --git a/src/cli.vala b/src/cli.vala index b646e8c86d69da079a4fb863e41c99093f734565..f0c49669e983fc857015c4a5943560dc735a49ce 100644 --- a/src/cli.vala +++ b/src/cli.vala @@ -100,7 +100,7 @@ namespace Pamac { } else if (args[2] == "--aur" || args[2] == "-a") { init_database (); database.config.enable_aur = true; - search_in_aur.begin (concatenate_strings (args[3:args.length]), () => { + search_pkgs.begin (concatenate_strings (args[3:args.length]), () => { loop.quit (); }); loop.run (); @@ -109,7 +109,10 @@ namespace Pamac { search_files (args[3:args.length]); } else { init_database (); - search_pkgs (concatenate_strings (args[2:args.length])); + search_pkgs.begin (concatenate_strings (args[2:args.length]), () => { + loop.quit (); + }); + loop.run (); } } else { display_search_help (); @@ -121,13 +124,18 @@ namespace Pamac { } else if (args[2] == "--aur" || args[2] == "-a") { init_database (); database.config.enable_aur = true; - display_aur_infos.begin (args[3:args.length], () => { + display_pkg_infos.begin (args[3:args.length], () => { loop.quit (); }); loop.run (); } else { init_database (); - display_pkg_infos (args[2:args.length]); + // enable aur to display more info for installed pkgs from AUR + database.config.enable_aur = true; + display_pkg_infos.begin (args[2:args.length], () => { + loop.quit (); + }); + loop.run (); } } else { display_info_help (); @@ -337,28 +345,50 @@ namespace Pamac { display_remove_help (); } } else if (args[1] == "checkupdates") { - if (args.length == 2) { - init_database (); - checkupdates.begin (() => { - loop.quit (); - }); - loop.run (); - } else if (args.length == 3) { - if (args[2] == "--help" || args[2] == "-h") { + init_database (); + bool error = false; + bool quiet = false; + int i = 2; + while (i < args.length) { + unowned string arg = args[i]; + if (arg == "--help" || arg == "-h") { display_checkupdates_help (); - } else if (args[2] == "--aur" || args[2] == "-a") { - init_database (); + error = true; + break; + } else if (arg == "--quiet"|| arg == "-q") { + quiet = true; + } else if (arg == "--aur"|| arg == "-a") { database.config.enable_aur = true; database.config.check_aur_updates = true; - checkupdates.begin ((obj, res) => { - loop.quit (); - }); - loop.run (); + } else if (arg == "-aq"|| arg == "-qa") { + database.config.enable_aur = true; + database.config.check_aur_updates = true; + quiet = true; + } else if (arg == "--builddir") { + if (args[i + 1] != null) { + database.config.aur_build_dir = args[i + 1]; + } + i++; + } else if (arg == "--devel") { + if (Posix.geteuid () == 0) { + // can't check as root + stdout.printf (dgettext (null, "Check development packages updates as root is not allowed") + "\n"); + exit_status = 1; + return; + } + database.config.check_aur_vcs_updates = true; } else { display_checkupdates_help (); + error = true; + break; } - } else { - display_checkupdates_help (); + i++; + } + if (!error) { + checkupdates.begin (quiet, () => { + loop.quit (); + }); + loop.run (); } } else if (args[1] == "update" || args[1] == "upgrade") { init_transaction (); @@ -415,8 +445,6 @@ namespace Pamac { void init_database () { var config = new Config ("/etc/pamac.conf"); - config.enable_aur = false; - config.check_aur_updates = false; database = new Database (config); } @@ -547,7 +575,7 @@ namespace Pamac { } void display_version () { - stdout.printf ("Pamac %s\n", VERSION); + stdout.printf ("Pamac %s\n", VERSION); } void display_help () { @@ -607,19 +635,26 @@ namespace Pamac { stdout.printf ("pamac search [%s] <%s>".printf (dgettext (null, "options"), "%s,%s".printf (dgettext (null, "package(s)"), dgettext (null, "file(s)")))); stdout.printf ("\n\n"); stdout.printf (dgettext (null, "options") + ":\n"); - int max_length = 15; - string[] cuts = split_string (dgettext (null, "search in AUR instead of repositories"), max_length + 2); - print_aligned (" -a, --aur", ": %s".printf (cuts[0]), max_length); - int i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "search for packages which own the given filenames (filenames can be partial)"), max_length + 2); - print_aligned (" -f, --files", ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); + int max_length = 0; + string[] options = {" -a, --aur", + " -f, --files"}; + foreach (unowned string option in options) { + int length = option.char_count (); + if (length > max_length) { + max_length = length; + } + } + string[] details = {dgettext (null, "also search in AUR"), + dgettext (null, "search for packages which own the given filenames (filenames can be partial)")}; + int i = 0; + foreach (unowned string option in options) { + string[] cuts = split_string (details[i], max_length + 3); + print_aligned (option, " : %s".printf (cuts[0]), max_length); + int j = 1; + while (j < cuts.length) { + print_aligned ("", "%s".printf (cuts[j]), max_length + 3); + j++; + } i++; } } @@ -630,12 +665,24 @@ namespace Pamac { stdout.printf ("pamac info [%s] <%s>".printf (dgettext (null, "options"), dgettext (null, "package(s)"))); stdout.printf ("\n\n"); stdout.printf (dgettext (null, "options") + ":\n"); - int max_length = 12; - string[] cuts = split_string (dgettext (null, "search in AUR instead of repositories"), max_length + 2); - print_aligned (" -a, --aur", ": %s".printf (cuts[0]), max_length); - int i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); + int max_length = 0; + string[] options = {" -a, --aur"}; + foreach (unowned string option in options) { + int length = option.char_count (); + if (length > max_length) { + max_length = length; + } + } + string[] details = {dgettext (null, "also search in AUR")}; + int i = 0; + foreach (unowned string option in options) { + string[] cuts = split_string (details[i], max_length + 3); + print_aligned (option, " : %s".printf (cuts[0]), max_length); + int j = 1; + while (j < cuts.length) { + print_aligned ("", "%s".printf (cuts[j]), max_length + 3); + j++; + } i++; } } @@ -646,47 +693,34 @@ namespace Pamac { stdout.printf ("pamac list [%s]".printf (dgettext (null, "options"))); stdout.printf ("\n\n"); stdout.printf (dgettext (null, "options") + ":\n"); - int max_length = 30; - string[] cuts = split_string (dgettext (null, "list installed packages"), max_length + 2); - print_aligned (" -i, --installed", ": %s".printf (cuts[0]), max_length); - int i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "list packages that were installed as dependencies but are no longer required by any installed package"), max_length + 2); - print_aligned (" -o, --orphans", ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "list packages that were not found in the repositories"), max_length + 2); - print_aligned (" -m, --foreign", ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "list all packages that are members of the given groups, if no group is given list all groups"), max_length + 2); - print_aligned (" %s [%s]".printf ("-g, --groups", dgettext (null, "group(s)")), ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "list all packages available in the given repos, if no repo is given list all repos"), max_length + 2); - print_aligned (" %s [%s]".printf ("-r, --repos", dgettext (null, "repo(s)")), ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "list files owned by the given packages"), max_length + 2); - print_aligned (" %s <%s>".printf ("-f, --files", dgettext (null, "package(s)")), ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); + int max_length = 0; + string[] options = {" -i, --installed", + " -o, --orphans", + " -m, --foreign", + " %s [%s]".printf ("-g, --groups", dgettext (null, "group(s)")), + " %s [%s]".printf ("-r, --repos", dgettext (null, "repo(s)")), + " %s <%s>".printf ("-f, --files", dgettext (null, "package(s)"))}; + foreach (unowned string option in options) { + int length = option.char_count (); + if (length > max_length) { + max_length = length; + } + } + string[] details = {dgettext (null, "list installed packages"), + dgettext (null, "list packages that were installed as dependencies but are no longer required by any installed package"), + dgettext (null, "list packages that were not found in the repositories"), + dgettext (null, "list all packages that are members of the given groups, if no group is given list all groups"), + dgettext (null, "list all packages available in the given repos, if no repo is given list all repos"), + dgettext (null, "list files owned by the given packages")}; + int i = 0; + foreach (unowned string option in options) { + string[] cuts = split_string (details[i], max_length + 3); + print_aligned (option, " : %s".printf (cuts[0]), max_length); + int j = 1; + while (j < cuts.length) { + print_aligned ("", "%s".printf (cuts[j]), max_length + 3); + j++; + } i++; } } @@ -697,26 +731,28 @@ namespace Pamac { stdout.printf ("pamac clone [%s] <%s>".printf (dgettext (null, "options"), dgettext (null, "package(s)"))); stdout.printf ("\n\n"); stdout.printf (dgettext (null, "options") + ":\n"); - int max_length = 25; - string[] cuts = split_string (dgettext (null, "build directory, if no directory is given the one specified in pamac.conf file is used"), max_length + 2); - print_aligned (" %s <%s>".printf ("--builddir", dgettext (null, "dir")), ": %s".printf (cuts[0]), max_length); - int i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "also clone needed dependencies"), max_length + 2); - print_aligned (" -r,--recurse", ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "overwrite existing files"), max_length + 2); - print_aligned (" --overwrite", ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); + int max_length = 0; + string[] options = {" %s <%s>".printf ("--builddir", dgettext (null, "dir")), + " -r,--recurse", + " --overwrite"}; + foreach (unowned string option in options) { + int length = option.char_count (); + if (length > max_length) { + max_length = length; + } + } + string[] details = {dgettext (null, "build directory, if no directory is given the one specified in pamac.conf file is used"), + dgettext (null, "also clone needed dependencies"), + dgettext (null, "overwrite existing files")}; + int i = 0; + foreach (unowned string option in options) { + string[] cuts = split_string (details[i], max_length + 3); + print_aligned (option, " : %s".printf (cuts[0]), max_length); + int j = 1; + while (j < cuts.length) { + print_aligned ("", "%s".printf (cuts[j]), max_length + 3); + j++; + } i++; } } @@ -731,19 +767,26 @@ namespace Pamac { stdout.printf ("pamac build [%s] [%s]".printf (dgettext (null, "options"), dgettext (null, "package(s)"))); stdout.printf ("\n\n"); stdout.printf (dgettext (null, "options") + ":\n"); - int max_length = 25; - string[] cuts = split_string (dgettext (null, "build directory, if no directory is given the one specified in pamac.conf file is used"), max_length + 2); - print_aligned (" %s <%s>".printf ("--builddir", dgettext (null, "dir")), ": %s".printf (cuts[0]), max_length); - int i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "do not clone build files from AUR, only use local files"), max_length + 2); - print_aligned (" --no-clone", ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); + int max_length = 0; + string[] options = {" %s <%s>".printf ("--builddir", dgettext (null, "dir")), + " --no-clone"}; + foreach (unowned string option in options) { + int length = option.char_count (); + if (length > max_length) { + max_length = length; + } + } + string[] details = {dgettext (null, "build directory, if no directory is given the one specified in pamac.conf file is used"), + dgettext (null, "do not clone build files from AUR, only use local files")}; + int i = 0; + foreach (unowned string option in options) { + string[] cuts = split_string (details[i], max_length + 3); + print_aligned (option, " : %s".printf (cuts[0]), max_length); + int j = 1; + while (j < cuts.length) { + print_aligned ("", "%s".printf (cuts[j]), max_length + 3); + j++; + } i++; } } @@ -754,19 +797,26 @@ namespace Pamac { stdout.printf ("pamac install [%s] <%s>".printf (dgettext (null, "options"), "%s,%s".printf (dgettext (null, "package(s)"), dgettext (null, "group(s)")))); stdout.printf ("\n\n"); stdout.printf (dgettext (null, "options") + ":\n"); - int max_length = 25; - string[] cuts = split_string (dgettext (null, "ignore a package upgrade, multiple packages can be specified by separating them with a comma"), max_length + 2); - print_aligned (" %s <%s>".printf ("--ignore", dgettext (null, "package(s)")), ": %s".printf (cuts[0]), max_length); - int i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "overwrite conflicting files, multiple patterns can be specified by separating them with a comma"), max_length + 2); - print_aligned (" %s <%s>".printf ("--overwrite", dgettext (null, "glob")), ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); + int max_length = 0; + string[] options = {" %s <%s>".printf ("--ignore", dgettext (null, "package(s)")), + " %s <%s>".printf ("--overwrite", dgettext (null, "glob"))}; + foreach (unowned string option in options) { + int length = option.char_count (); + if (length > max_length) { + max_length = length; + } + } + string[] details = {dgettext (null, "ignore a package upgrade, multiple packages can be specified by separating them with a comma"), + dgettext (null, "overwrite conflicting files, multiple patterns can be specified by separating them with a comma")}; + int i = 0; + foreach (unowned string option in options) { + string[] cuts = split_string (details[i], max_length + 3); + print_aligned (option, " : %s".printf (cuts[0]), max_length); + int j = 1; + while (j < cuts.length) { + print_aligned ("", "%s".printf (cuts[j]), max_length + 3); + j++; + } i++; } } @@ -784,12 +834,24 @@ namespace Pamac { stdout.printf ("pamac remove [%s] [%s]".printf (dgettext (null, "options"), "%s,%s".printf (dgettext (null, "package(s)"), dgettext (null, "group(s)")))); stdout.printf ("\n\n"); stdout.printf (dgettext (null, "options") + ":\n"); - int max_length = 15; - string[] cuts = split_string (dgettext (null, "remove dependencies that are not required by other packages, if this option is used without package name remove all orphans"), max_length + 2); - print_aligned ("-o, --orphans", ": %s".printf (cuts[0]), max_length); - int i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); + int max_length = 0; + string[] options = {"-o, --orphans"}; + foreach (unowned string option in options) { + int length = option.char_count (); + if (length > max_length) { + max_length = length; + } + } + string[] details = {dgettext (null, "remove dependencies that are not required by other packages, if this option is used without package name remove all orphans")}; + int i = 0; + foreach (unowned string option in options) { + string[] cuts = split_string (details[i], max_length + 3); + print_aligned (option, " : %s".printf (cuts[0]), max_length); + int j = 1; + while (j < cuts.length) { + print_aligned ("", "%s".printf (cuts[j]), max_length + 3); + j++; + } i++; } } @@ -802,12 +864,30 @@ namespace Pamac { stdout.printf ("pamac checkupdates [%s]".printf (dgettext (null, "options"))); stdout.printf ("\n\n"); stdout.printf (dgettext (null, "options") + ":\n"); - int max_length = 12; - string[] cuts = split_string (dgettext (null, "also check updates in AUR"), max_length + 2); - print_aligned (" -a, --aur", ": %s".printf (cuts[0]), max_length); - int i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); + int max_length = 0; + string[] options = {" -a, --aur", + " --devel", + " -q, --quiet", + " %s <%s>".printf ("--builddir", dgettext (null, "dir"))}; + foreach (unowned string option in options) { + int length = option.char_count (); + if (length > max_length) { + max_length = length; + } + } + string[] details = {dgettext (null, "also check updates in AUR"), + dgettext (null, "also check development packages updates (use with --aur)"), + dgettext (null, "only print one line per update"), + dgettext (null, "build directory (use with --devel), if no directory is given the one specified in pamac.conf file is used")}; + int i = 0; + foreach (unowned string option in options) { + string[] cuts = split_string (details[i], max_length + 3); + print_aligned (option, " : %s".printf (cuts[0]), max_length); + int j = 1; + while (j < cuts.length) { + print_aligned ("", "%s".printf (cuts[j]), max_length + 3); + j++; + } i++; } } @@ -818,56 +898,58 @@ namespace Pamac { stdout.printf ("pamac upgrade,update [%s]".printf (dgettext (null, "options"))); stdout.printf ("\n\n"); stdout.printf (dgettext (null, "options") + ":\n"); - int max_length = 30; - string[] cuts = split_string (dgettext (null, "also upgrade packages installed from AUR"), max_length + 2); - print_aligned (" -a, --aur", ": %s".printf (cuts[0]), max_length); - int i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "build directory (use with --aur), if no directory is given the one specified in pamac.conf file is used"), max_length + 2); - print_aligned (" %s <%s>".printf ("--builddir", dgettext (null, "dir")), ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "force the refresh of the databases"), max_length + 2); - print_aligned (" --force-refresh", ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "enable package downgrades"), max_length + 2); - print_aligned (" --enable-downgrade", ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "ignore a package upgrade, multiple packages can be specified by separating them with a comma"), max_length + 2); - print_aligned (" %s <%s>".printf ("--ignore", dgettext (null, "package(s)")), ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); - i++; - } - cuts = split_string (dgettext (null, "overwrite conflicting files, multiple patterns can be specified by separating them with a comma"), max_length + 2); - print_aligned (" %s <%s>".printf ("--overwrite", dgettext (null, "glob")), ": %s".printf (cuts[0]), max_length); - i = 1; - while (i < cuts.length) { - print_aligned ("", "%s".printf (cuts[i]), max_length + 2); + int max_length = 0; + string[] options = {" -a, --aur", + " %s <%s>".printf ("--builddir", dgettext (null, "dir")), + " --force-refresh", + " --enable-downgrade", + " %s <%s>".printf ("--ignore", dgettext (null, "package(s)")), + " %s <%s>".printf ("--overwrite", dgettext (null, "glob"))}; + foreach (unowned string option in options) { + int length = option.char_count (); + if (length > max_length) { + max_length = length; + } + } + string[] details = {dgettext (null, "also upgrade packages installed from AUR"), + dgettext (null, "build directory (use with --aur), if no directory is given the one specified in pamac.conf file is used"), + dgettext (null, "force the refresh of the databases"), + dgettext (null, "enable package downgrades"), + dgettext (null, "ignore a package upgrade, multiple packages can be specified by separating them with a comma"), + dgettext (null, "overwrite conflicting files, multiple patterns can be specified by separating them with a comma")}; + int i = 0; + foreach (unowned string option in options) { + string[] cuts = split_string (details[i], max_length + 3); + print_aligned (option, " : %s".printf (cuts[0]), max_length); + int j = 1; + while (j < cuts.length) { + print_aligned ("", "%s".printf (cuts[j]), max_length + 3); + j++; + } i++; } } - void search_pkgs (string search_string) { + SearchFunc<Package, string> search_in_pkgs = (pkg, name) => { + return strcmp (pkg.name, name); + }; + + async void search_pkgs (string search_string) { var pkgs = database.search_pkgs (search_string); - if (pkgs.length () == 0) { - exit_status = 1; - return; + var aur_pkgs = new List<AURPackage> (); + if (database.config.enable_aur) { + aur_pkgs = yield database.search_in_aur (search_string); + // sort aur pkgs by popularity + aur_pkgs.sort ((pkg1, pkg2) => { + double diff = pkg2.popularity - pkg1.popularity; + if (diff < 0) { + return -1; + } else if (diff > 0) { + return 1; + } else { + return 0; + } + }); } int version_length = 0; int repo_length = 0; @@ -879,107 +961,129 @@ namespace Pamac { repo_length = pkg.repo.length; } } - int available_width = get_term_width () - (version_length + repo_length + 3); - foreach (unowned Package pkg in pkgs) { - string name = pkg.name; - if (pkg.installed_version != "") { - name = "%s [%s]".printf (pkg.name, dgettext (null, "Installed")); - } - var str_builder = new StringBuilder (); - str_builder.append (name); - str_builder.append (" "); - int diff = available_width - name.char_count (); - if (diff > 0) { - while (diff > 0) { - str_builder.append (" "); - diff--; + if (aur_pkgs.length () > 0) { + foreach (unowned AURPackage aur_pkg in aur_pkgs) { + if (aur_pkg.version.length > version_length) { + version_length = aur_pkg.version.length; } } - str_builder.append ("%-*s %s \n".printf (version_length, pkg.version, pkg.repo)); - stdout.printf ("%s", str_builder.str); - string[] cuts = split_string (pkg.desc, 2, available_width); - foreach (unowned string cut in cuts) { - print_aligned ("", cut, 2); + if (dgettext (null, "AUR").char_count () > repo_length) { + repo_length = dgettext (null, "AUR").char_count (); } } - } - - async void search_in_aur (string search_string) { - var pkgs = yield database.search_in_aur (search_string); - if (pkgs.length () == 0) { - exit_status = 1; - return; - } - int version_length = 0; - foreach (unowned AURPackage pkg in pkgs) { - if (pkg.version.length > version_length) { - version_length = pkg.version.length; + int available_width = get_term_width () - (version_length + repo_length + 4); + if (pkgs.length () > 0) { + foreach (unowned Package pkg in pkgs) { + string name = pkg.name; + if (pkg.installed_version != "") { + name = "%s [%s]".printf (pkg.name, dgettext (null, "Installed")); + } + var str_builder = new StringBuilder (); + str_builder.append (name); + str_builder.append (" "); + int diff = available_width - name.char_count (); + if (diff > 0) { + while (diff > 0) { + str_builder.append (" "); + diff--; + } + } + str_builder.append ("%-*s %s \n".printf (version_length, pkg.version, pkg.repo)); + stdout.printf ("%s", str_builder.str); + string[] cuts = split_string (pkg.desc, 2, available_width); + foreach (unowned string cut in cuts) { + print_aligned ("", cut, 2); + } } } - int aur_length = dgettext (null, "AUR").char_count (); - int available_width = get_term_width () - (version_length + aur_length + 3); - // sort aur pkgs by popularity - var results = new List<AURPackage?> (); - foreach (unowned AURPackage pkg in pkgs) { - results.append (pkg); - } - results.sort ((pkg1, pkg2) => { - double diff = pkg2.popularity - pkg1.popularity; - if (diff < 0) { - return -1; - } else if (diff > 0) { - return 1; - } else { - return 0; + if (aur_pkgs.length () > 0) { + if (pkgs.length () > 0) { + stdout.printf ("\n"); } - }); - foreach (unowned AURPackage pkg in results) { - var str_builder = new StringBuilder (); - string name = pkg.name; - if (pkg.installed_version != "") { - name = "%s [%s]".printf (pkg.name, dgettext (null, "Installed")); - } - str_builder.append (name); - str_builder.append (" "); - int diff = available_width - name.char_count (); - if (diff > 0) { - while (diff > 0) { - str_builder.append (" "); - diff--; + foreach (unowned AURPackage aur_pkg in aur_pkgs) { + unowned List<Package>? found = pkgs.search (aur_pkg.name, search_in_pkgs); + if (found != null) { + // pkg already printed + continue; + } + var str_builder = new StringBuilder (); + string name = aur_pkg.name; + if (aur_pkg.installed_version != "") { + if (aur_pkg.outofdate != "") { + name = "%s [%s] (%s: %s)".printf (aur_pkg.name, dgettext (null, "Installed"), + dgettext (null, "Out of Date"), aur_pkg.outofdate); + } else { + name = "%s [%s]".printf (aur_pkg.name, dgettext (null, "Installed")); + } + } else if (aur_pkg.outofdate != "") { + name = "%s (%s: %s)".printf (aur_pkg.name, dgettext (null, "Out of Date"), aur_pkg.outofdate); + } + str_builder.append (name); + str_builder.append (" "); + int diff = available_width - name.char_count (); + if (diff > 0) { + while (diff > 0) { + str_builder.append (" "); + diff--; + } + } + str_builder.append ("%-*s %s \n".printf (version_length, aur_pkg.version, dgettext (null, "AUR"))); + stdout.printf ("%s", str_builder.str); + string[] cuts = split_string (aur_pkg.desc, 2, available_width); + foreach (unowned string cut in cuts) { + print_aligned ("", cut, 2); } } - str_builder.append ("%-*s %s \n".printf (version_length, pkg.version, dgettext (null, "AUR"))); - stdout.printf ("%s", str_builder.str); - string[] cuts = split_string (pkg.desc, 2, available_width); - foreach (unowned string cut in cuts) { - print_aligned ("", cut, 2); + } + } + + async void display_pkg_infos (string[] pkgnames) { + string[] in_repos = {}; + string[] not_in_repos = {}; + foreach (unowned string pkgname in pkgnames) { + var details = database.get_pkg_details (pkgname, "", false); + if (details.name == "") { + not_in_repos += pkgname; + } else { + in_repos += pkgname; } } + if (in_repos.length > 0) { + yield display_repo_infos (in_repos); + } + if (not_in_repos.length > 0) { + yield display_aur_infos (not_in_repos); + } } - void display_pkg_infos (string[] pkgnames) { - string[] properties = {}; - properties += dgettext (null, "Name"); - properties += dgettext (null, "Version"); - properties += dgettext (null, "Description"); - properties += dgettext (null, "URL"); - properties += dgettext (null, "Licenses"); - properties += dgettext (null, "Repository"); - properties += dgettext (null, "Size"); - properties += dgettext (null, "Groups"); - properties += dgettext (null, "Depends On"); - properties += dgettext (null, "Optional Dependencies"); - properties += dgettext (null, "Required By"); - properties += dgettext (null, "Optional For"); - properties += dgettext (null, "Provides"); - properties += dgettext (null, "Replaces"); - properties += dgettext (null, "Conflicts With"); - properties += dgettext (null, "Packager"); - properties += dgettext (null, "Build Date"); - properties += dgettext (null, "Install Date"); - properties += dgettext (null, "Install Reason"); - properties += dgettext (null, "Signatures"); - properties += dgettext (null, "Backup files"); + async void display_repo_infos (string[] pkgnames) { + string[] properties = { dgettext (null, "Name"), + dgettext (null, "Version"), + dgettext (null, "Description"), + dgettext (null, "URL"), + dgettext (null, "Licenses"), + dgettext (null, "Repository"), + dgettext (null, "Size"), + dgettext (null, "Groups"), + dgettext (null, "Depends On"), + dgettext (null, "Optional Dependencies"), + dgettext (null, "Required By"), + dgettext (null, "Optional For"), + dgettext (null, "Provides"), + dgettext (null, "Replaces"), + dgettext (null, "Conflicts With"), + dgettext (null, "Packager"), + dgettext (null, "Build Date"), + dgettext (null, "Install Date"), + dgettext (null, "Install Reason"), + dgettext (null, "Signatures"), + dgettext (null, "Backup files"), + dgettext (null, "Package Base"), + dgettext (null, "Maintainer"), + dgettext (null, "First Submitted"), + dgettext (null, "Last Modified"), + dgettext (null, "Votes"), + dgettext (null, "Out of Date")}; int max_length = 0; foreach (unowned string prop in properties) { // use char_count to handle special characters @@ -1014,10 +1118,45 @@ namespace Pamac { print_aligned ("", "%s".printf (details.licenses.nth_data (i)), max_length + 2); i++; } - // Repository - print_aligned (properties[5], ": %s".printf (details.repo), max_length); - // Size - print_aligned (properties[6], ": %s".printf (format_size (details.size)), max_length); + if (details.repo != "") { + // Repository + print_aligned (properties[5], ": %s".printf (details.repo), max_length); + // Size + print_aligned (properties[6], ": %s".printf (format_size (details.size)), max_length); + } else { + AURPackageDetails aur_pkg_details = yield database.get_aur_pkg_details (details.name); + // Repository + if (aur_pkg_details.packagebase != "") { + print_aligned (properties[5], ": %s".printf (dgettext (null, "AUR")), max_length); + } + // Size + print_aligned (properties[6], ": %s".printf (format_size (details.size)), max_length); + // Package Base + if (aur_pkg_details.packagebase != "" + && aur_pkg_details.packagebase != details.name) { + print_aligned (properties[21], ": %s".printf (aur_pkg_details.packagebase), max_length); + } + // Maintainer + if (aur_pkg_details.maintainer != "") { + print_aligned (properties[22], ": %s".printf (aur_pkg_details.maintainer), max_length); + } + // First Submitted + if (aur_pkg_details.firstsubmitted != "") { + print_aligned (properties[23], ": %s".printf (aur_pkg_details.firstsubmitted), max_length); + } + // Last Modified + if (aur_pkg_details.lastmodified != "") { + print_aligned (properties[24], ": %s".printf (aur_pkg_details.lastmodified), max_length); + } + // Votes + if (aur_pkg_details.numvotes != 0) { + print_aligned (properties[25], ": %s".printf (aur_pkg_details.numvotes.to_string ()), max_length); + } + // Out of Date + if (aur_pkg_details.outofdate != "") { + print_aligned (properties[26], ": %s".printf (aur_pkg_details.outofdate), max_length); + } + } // Groups if (details.groups.length () > 0) { cuts = split_string (concatenate_strings_list (details.groups), max_length + 2); @@ -1118,7 +1257,7 @@ namespace Pamac { i++; } } - // Maintainer + // Packager cuts = split_string (details.packager, max_length + 2); print_aligned (properties[15], ": %s".printf (cuts[0]), max_length); i = 1; @@ -1160,25 +1299,25 @@ namespace Pamac { } async void display_aur_infos (string[] pkgnames) { - string[] properties = {}; - properties += dgettext (null, "Name"); - properties += dgettext (null, "Package Base"); - properties += dgettext (null, "Version"); - properties += dgettext (null, "Description"); - properties += dgettext (null, "URL"); - properties += dgettext (null, "Licenses"); - properties += dgettext (null, "Depends On"); - properties += dgettext (null, "Make Dependencies"); - properties += dgettext (null, "Check Dependencies"); - properties += dgettext (null, "Optional Dependencies"); - properties += dgettext (null, "Provides"); - properties += dgettext (null, "Replaces"); - properties += dgettext (null, "Conflicts With"); - properties += dgettext (null, "Packager"); - properties += dgettext (null, "First Submitted"); - properties += dgettext (null, "Last Modified"); - properties += dgettext (null, "Votes"); - properties += dgettext (null, "Out of Date"); + string[] properties = { dgettext (null, "Name"), + dgettext (null, "Package Base"), + dgettext (null, "Version"), + dgettext (null, "Description"), + dgettext (null, "URL"), + dgettext (null, "Licenses"), + dgettext (null, "Repository"), + dgettext (null, "Depends On"), + dgettext (null, "Make Dependencies"), + dgettext (null, "Check Dependencies"), + dgettext (null, "Optional Dependencies"), + dgettext (null, "Provides"), + dgettext (null, "Replaces"), + dgettext (null, "Conflicts With"), + dgettext (null, "Maintainer"), + dgettext (null, "First Submitted"), + dgettext (null, "Last Modified"), + dgettext (null, "Votes"), + dgettext (null, "Out of Date")}; int max_length = 0; foreach (unowned string prop in properties) { // use char_count to handle special characters @@ -1220,10 +1359,12 @@ namespace Pamac { print_aligned ("", "%s".printf (details.licenses.nth_data (i)), max_length + 2); i++; } + // Repository + print_aligned (properties[6], ": %s".printf (dgettext (null, "AUR")), max_length); // Depends if (details.depends.length () > 0) { cuts = split_string (concatenate_strings_list (details.depends), max_length + 2); - print_aligned (properties[6], ": %s".printf (cuts[0]), max_length); + print_aligned (properties[7], ": %s".printf (cuts[0]), max_length); i = 1; while (i < cuts.length) { print_aligned ("", "%s".printf (cuts[i]), max_length + 2); @@ -1233,7 +1374,7 @@ namespace Pamac { // Make Depends if (details.makedepends.length () > 0) { cuts = split_string (concatenate_strings_list (details.makedepends), max_length + 2); - print_aligned (properties[7], ": %s".printf (cuts[0]), max_length); + print_aligned (properties[8], ": %s".printf (cuts[0]), max_length); i = 1; while (i < cuts.length) { print_aligned ("", "%s".printf (cuts[i]), max_length + 2); @@ -1243,7 +1384,7 @@ namespace Pamac { // Check Depends if (details.checkdepends.length () > 0) { cuts = split_string (concatenate_strings_list (details.checkdepends), max_length + 2); - print_aligned (properties[8], ": %s".printf (cuts[0]), max_length); + print_aligned (properties[9], ": %s".printf (cuts[0]), max_length); i = 1; while (i < cuts.length) { print_aligned ("", "%s".printf (cuts[i]), max_length + 2); @@ -1258,7 +1399,7 @@ namespace Pamac { depstring = "%s [%s]".printf (depstring, dgettext (null, "Installed")); } cuts = split_string (depstring, max_length + 2); - print_aligned (properties[9], ": %s".printf (cuts[0]), max_length); + print_aligned (properties[10], ": %s".printf (cuts[0]), max_length); i = 1; while (i < cuts.length) { print_aligned ("", "%s".printf (cuts[i]), max_length + 2); @@ -1283,7 +1424,7 @@ namespace Pamac { // Provides if (details.provides.length () > 0) { cuts = split_string (concatenate_strings_list (details.provides), max_length + 2); - print_aligned (properties[10], ": %s".printf (cuts[0]), max_length); + print_aligned (properties[11], ": %s".printf (cuts[0]), max_length); i = 1; while (i < cuts.length) { print_aligned ("", "%s".printf (cuts[i]), max_length + 2); @@ -1293,7 +1434,7 @@ namespace Pamac { // Replaces if (details.replaces.length () > 0) { cuts = split_string (concatenate_strings_list (details.replaces), max_length + 2); - print_aligned (properties[11], ": %s".printf (cuts[0]), max_length); + print_aligned (properties[12], ": %s".printf (cuts[0]), max_length); i = 1; while (i < cuts.length) { print_aligned ("", "%s".printf (cuts[i]), max_length + 2); @@ -1303,7 +1444,7 @@ namespace Pamac { // Conflicts if (details.conflicts.length () > 0) { cuts = split_string (concatenate_strings_list (details.conflicts), max_length + 2); - print_aligned (properties[12], ": %s".printf (cuts[0]), max_length); + print_aligned (properties[13], ": %s".printf (cuts[0]), max_length); i = 1; while (i < cuts.length) { print_aligned ("", "%s".printf (cuts[i]), max_length + 2); @@ -1312,17 +1453,17 @@ namespace Pamac { } // Maintainer if (details.maintainer != "") { - print_aligned (properties[13], ": %s".printf (details.maintainer), max_length); + print_aligned (properties[14], ": %s".printf (details.maintainer), max_length); } // First Submitted - print_aligned (properties[14], ": %s".printf (details.firstsubmitted), max_length); + print_aligned (properties[15], ": %s".printf (details.firstsubmitted), max_length); // Last Modified - print_aligned (properties[15], ": %s".printf (details.lastmodified), max_length); + print_aligned (properties[16], ": %s".printf (details.lastmodified), max_length); // Votes - print_aligned (properties[16], ": %s".printf (details.numvotes.to_string ()), max_length); - // Last Modified + print_aligned (properties[17], ": %s".printf (details.numvotes.to_string ()), max_length); + // Out of Date if (details.outofdate != "") { - print_aligned (properties[17], ": %s".printf (details.outofdate), max_length); + print_aligned (properties[18], ": %s".printf (details.outofdate), max_length); } stdout.printf ("\n"); } @@ -1332,7 +1473,6 @@ namespace Pamac { int name_length = 0; int version_length = 0; int repo_length = 0; - int size_length = 0; foreach (unowned Package pkg in pkgs) { string name = pkg.name; if (print_installed && pkg.installed_version != "") { @@ -1348,19 +1488,6 @@ namespace Pamac { if (pkg.repo.length > repo_length) { repo_length = pkg.repo.length; } - string size = format_size (pkg.size); - if (size.length > size_length) { - size_length = size.length; - } - } - int total_width = name_length + version_length + repo_length + size_length + 4; - int margin = 0; - if (get_term_width () > total_width) { - // divide available space between columns - int available_width = get_term_width () - total_width; - margin = available_width / 4; - // get left space to size - size_length += available_width - (margin * 4); } foreach (unowned Package pkg in pkgs) { // use this code to correctly aligned text with special characters @@ -1371,16 +1498,17 @@ namespace Pamac { } str_builder.append (name); str_builder.append (" "); - int diff = name_length + margin - name.char_count (); + int diff = name_length - name.char_count (); if (diff > 0) { while (diff > 0) { str_builder.append (" "); diff--; } } - str_builder.append ("%-*s %-*s %*s \n".printf (version_length + margin, pkg.version, - repo_length + margin, pkg.repo, - size_length + margin, format_size (pkg.size))); + str_builder.append ("%-*s %-*s %s\n".printf ( + version_length, pkg.version, + repo_length, pkg.repo, + format_size (pkg.size))); stdout.printf ("%s", str_builder.str); } } @@ -1471,18 +1599,52 @@ namespace Pamac { } } - async void checkupdates () { + async void checkupdates (bool quiet) { var updates = yield database.get_updates (); uint updates_nb = updates.repos_updates.length () + updates.aur_updates.length (); if (updates_nb == 0) { + if (quiet) { + return; + } stdout.printf ("%s.\n", dgettext (null, "Your system is up-to-date")); + if (updates.outofdate.length () > 0) { + // print out of date pkgs + stdout.printf ("\n%s:\n", dgettext (null, "Out of Date")); + int name_length = 0; + int version_length = 0; + foreach (unowned AURPackage pkg in updates.outofdate) { + if (pkg.name.length > name_length) { + name_length = pkg.name.length; + } + if (pkg.version.length > version_length) { + version_length = pkg.version.length; + } + } + foreach (unowned AURPackage pkg in updates.outofdate) { + stdout.printf ("%-*s %-*s %s\n", + name_length, pkg.name, + version_length, pkg.version, + dgettext (null, "AUR")); + } + } } else { // special status when updates are available exit_status = 100; + if (quiet) { + foreach (unowned Package pkg in updates.repos_updates) { + stdout.printf ("%s %s\n", pkg.name,pkg.version); + } + foreach (unowned AURPackage pkg in updates.aur_updates) { + // do not show out of date packages + if (pkg.outofdate == "") { + stdout.printf ("%s %s\n", pkg.name, pkg.version); + } + } + return; + } // print pkgs int name_length = 0; int version_length = 0; - int repo_length = 0; foreach (unowned Package pkg in updates.repos_updates) { if (pkg.name.length > name_length) { name_length = pkg.name.length; @@ -1490,9 +1652,6 @@ namespace Pamac { if (pkg.version.length > version_length) { version_length = pkg.version.length; } - if (pkg.repo.length > repo_length) { - repo_length = pkg.repo.length; - } } foreach (unowned AURPackage pkg in updates.aur_updates) { if (pkg.name.length > name_length) { @@ -1502,29 +1661,37 @@ namespace Pamac { version_length = pkg.version.length; } } - if (dgettext (null, "AUR").char_count () > repo_length) { - repo_length = dgettext (null, "AUR").char_count (); - } - int total_width = name_length + version_length + repo_length + 3; - int margin = 0; - if (get_term_width () > total_width) { - // divide available space between columns - int available_width = get_term_width () - total_width; - margin = available_width / 3; - // get left space to repo - repo_length += available_width - (margin * 3); + foreach (unowned AURPackage pkg in updates.outofdate) { + if (pkg.name.length > name_length) { + name_length = pkg.name.length; + } + if (pkg.version.length > version_length) { + version_length = pkg.version.length; + } } string info = ngettext ("%u available update", "%u available updates", updates_nb).printf (updates_nb); stdout.printf ("%s:\n", info); foreach (unowned Package pkg in updates.repos_updates) { - stdout.printf ("%-*s %-*s %s \n", name_length + margin, pkg.name, - version_length + margin, pkg.version, - pkg.repo); + stdout.printf ("%-*s %-*s %s\n", + name_length, pkg.name, + version_length, pkg.version, + pkg.repo); } foreach (unowned AURPackage pkg in updates.aur_updates) { - stdout.printf ("%-*s %-*s %s \n", name_length + margin, pkg.name, - version_length + margin, pkg.version, - dgettext (null, "AUR")); + stdout.printf ("%-*s %-*s %s\n", + name_length, pkg.name, + version_length, pkg.version, + dgettext (null, "AUR")); + } + if (updates.outofdate.length () > 0) { + // print out of date pkgs + stdout.printf ("\n%s:\n", dgettext (null, "Out of Date")); + foreach (unowned AURPackage pkg in updates.outofdate) { + stdout.printf ("%-*s %-*s %s\n", + name_length, pkg.name, + version_length, pkg.version, + dgettext (null, "AUR")); + } } } } @@ -1589,7 +1756,6 @@ namespace Pamac { // print pkgs int name_length = 0; int version_length = 0; - int repo_length = 0; foreach (unowned Package pkg in pkgs) { if (pkg.name.length > name_length) { name_length = pkg.name.length; @@ -1597,33 +1763,22 @@ namespace Pamac { if (pkg.version.length > version_length) { version_length = pkg.version.length; } - if (pkg.repo.length > repo_length) { - repo_length = pkg.repo.length; - } } int num_length = pkgs.length ().to_string ().length + 1; - int total_width = num_length + name_length + version_length + repo_length + 4; - int margin = 0; - if (get_term_width () > total_width) { - // divide available space between columns - int available_width = get_term_width () - total_width; - margin = available_width / 3; - // get left space to repo - repo_length += available_width - (margin * 3); - } stdout.printf ("%s:\n".printf (dngettext (null, "There is %u member in group %s", "There are %u members in group %s", pkgs.length ()).printf (pkgs.length (), grpname))); int num = 1; foreach (unowned Package pkg in pkgs) { - stdout.printf ("%*s %-*s %-*s %s \n", num_length, "%i:".printf (num), - name_length + margin, pkg.name, - version_length + margin, pkg.version, - pkg.repo); + stdout.printf ("%*s %-*s %-*s %s\n", + num_length, "%i:".printf (num), + name_length, pkg.name, + version_length, pkg.version, + pkg.repo); num++; } // get user input while (true) { - stdout.printf ("%s: ", dgettext (null, "Enter a selection (default=all)")); + stdout.printf ("%s: ", dgettext (null, "Enter a selection (default=%s)").printf (dgettext (null, "all"))); string ans = stdin.read_line (); uint64 nb; uint64[] numbers = {}; @@ -1670,6 +1825,7 @@ namespace Pamac { break; } } + stdout.printf ("\n"); } void reinstall_pkgs (string[] names) { @@ -1788,7 +1944,7 @@ namespace Pamac { continue; } else { // clone build files - stdout.printf (dgettext (null, "Cloning %s build files").printf (aur_pkg_details.packagebase) + "...\n"); + stdout.printf (dgettext (null, "Cloning %s build files".printf (pkgname)) + "...\n"); // use packagebase in case of split package File? clone_dir = yield database.clone_build_files (aur_pkg_details.packagebase, overwrite); if (clone_dir == null) { @@ -1832,14 +1988,13 @@ namespace Pamac { var iter = HashTableIter<string, AURPackage> (aur_pkgs); unowned string pkgname; unowned AURPackage aur_pkg; - bool success = true; while (iter.next (out pkgname, out aur_pkg)) { if (aur_pkg.name == "") { print_error (dgettext (null, "target not found: %s").printf (pkgname)); - success = false; + return false; } } - return success; + return true; } void build_pkgs (string[] to_build) { diff --git a/src/common.vala b/src/common.vala index 8d659ed7976748eb4a1d7cbb15a61617a5e53070..cc6dfcd77657a85e192149016b6420111f281130 100644 --- a/src/common.vala +++ b/src/common.vala @@ -66,6 +66,7 @@ namespace Pamac { public string desc; public double popularity; public string packagebase; + public string outofdate; } struct AURPackageDetailsStruct { diff --git a/src/common_daemon.vala b/src/common_daemon.vala index d146e71ca6e53198e6411ed6488919107477e92b..98edbb38cc8c17a7ee6a481ce828633c8888a8ac 100644 --- a/src/common_daemon.vala +++ b/src/common_daemon.vala @@ -66,6 +66,7 @@ namespace Pamac { public string desc; public double popularity; public string packagebase; + public string outofdate; } public struct AURPackageDetailsStruct { diff --git a/src/database.vala b/src/database.vala index d5a0e3fee9ae00fb6d1e224c42a7a4eea69d525d..2bfa3be9f63fee1046815c04564e80b9029073f7 100644 --- a/src/database.vala +++ b/src/database.vala @@ -27,6 +27,15 @@ namespace Pamac { As.Store app_store; string locale; + class AURUpdates { + public List<AURPackage> updates; + public List<AURPackage> outofdate; + public AURUpdates (owned List<AURPackage> updates, owned List<AURPackage> outofdate) { + this.updates = (owned) updates; + this.outofdate = (owned) outofdate; + } + } + public signal void get_updates_progress (uint percent); public signal void refreshed (); @@ -162,6 +171,23 @@ namespace Pamac { return 0; } + public List<string> get_uninstalled_optdeps (string pkgname) { + var optdeps = new List<string> (); + unowned Alpm.Package? pkg = get_syncpkg (pkgname); + if (pkg != null) { + unowned Alpm.List<unowned Alpm.Depend> optdepends = pkg.optdepends; + while (optdepends != null) { + string optdep = optdepends.data.compute_string (); + unowned Alpm.Package? satisfier = Alpm.find_satisfier (alpm_handle.localdb.pkgcache, optdep); + if (satisfier == null) { + optdeps.append ((owned) optdep); + } + optdepends.next (); + } + } + return optdeps; + } + string get_localized_string (HashTable<string,string> hashtable) { unowned string val; if (!hashtable.lookup_extended (locale, null, out val)) { @@ -238,6 +264,16 @@ namespace Pamac { unowned Alpm.Package? sync_pkg = get_syncpkg (alpm_pkg.name); if (sync_pkg != null) { repo_name = sync_pkg.db.name; + } else if (config.enable_aur) { + var loop = new MainLoop (); + get_aur_pkg.begin (alpm_pkg.name, (obj, res) => { + var aur_pkg = get_aur_pkg.end (res); + if (aur_pkg.name != "") { + repo_name = dgettext (null, "AUR"); + } + loop.quit (); + }); + loop.run (); } } else if (alpm_pkg.origin == Alpm.Package.From.SYNCDB) { unowned Alpm.Package? local_pkg = alpm_handle.localdb.get_pkg (alpm_pkg.name); @@ -245,14 +281,8 @@ namespace Pamac { installed_version = local_pkg.version; } repo_name = alpm_pkg.db.name; - } else { - // load pkg or built pkg - unowned Alpm.Package? local_pkg = alpm_handle.localdb.get_pkg (alpm_pkg.name); - if (local_pkg != null) { - installed_version = local_pkg.version; - } } - if (repo_name != "") { + if (repo_name != "" && repo_name != dgettext (null, "AUR")) { // find if pkgname provides only one app As.App[] matching_apps = get_pkgname_matching_apps (alpm_pkg.name); if (matching_apps.length == 1) { @@ -296,6 +326,16 @@ namespace Pamac { unowned Alpm.Package? sync_pkg = get_syncpkg (alpm_pkg.name); if (sync_pkg != null) { repo_name = sync_pkg.db.name; + } else if (config.enable_aur) { + var loop = new MainLoop (); + get_aur_pkg.begin (alpm_pkg.name, (obj, res) => { + var aur_pkg = get_aur_pkg.end (res); + if (aur_pkg.name != "") { + repo_name = dgettext (null, "AUR"); + } + loop.quit (); + }); + loop.run (); } } else if (alpm_pkg.origin == Alpm.Package.From.SYNCDB) { unowned Alpm.Package? local_pkg = alpm_handle.localdb.get_pkg (alpm_pkg.name); @@ -304,7 +344,7 @@ namespace Pamac { } repo_name = alpm_pkg.db.name; } - if (repo_name != "") { + if (repo_name != "" && repo_name != dgettext (null, "AUR")) { As.App[] apps = get_pkgname_matching_apps (alpm_pkg.name); if (apps.length > 0) { // alpm_pkg provide some apps @@ -582,7 +622,8 @@ namespace Pamac { version = "", installed_version = "", desc = "", - packagebase = "" + packagebase = "", + outofdate = "" }; } string installed_version = ""; @@ -590,6 +631,13 @@ namespace Pamac { if (pkg != null) { installed_version = pkg.version; } + // set out of date + string outofdate = ""; + unowned Json.Node? out_node = json_object.get_member ("OutOfDate"); + if (!out_node.is_null ()) { + var time = GLib.Time.local ((time_t) out_node.get_int ()); + outofdate = time.format ("%x"); + } return AURPackageStruct () { name = json_object.get_string_member ("Name"), version = json_object.get_string_member ("Version"), @@ -597,7 +645,8 @@ namespace Pamac { // desc can be null desc = json_object.get_null_member ("Description") ? "" : json_object.get_string_member ("Description"), popularity = json_object.get_double_member ("Popularity"), - packagebase = json_object.get_string_member ("PackageBase") + packagebase = json_object.get_string_member ("PackageBase"), + outofdate = (owned) outofdate }; } @@ -882,10 +931,11 @@ namespace Pamac { var details = PackageDetailsStruct (); unowned Alpm.Package? alpm_pkg = alpm_handle.localdb.get_pkg (pkgname); unowned Alpm.Package? sync_pkg = get_syncpkg (pkgname); + if (alpm_pkg != null) { + installed_version = alpm_pkg.version; + } if (alpm_pkg == null || use_sync_pkg) { alpm_pkg = sync_pkg; - } else { - installed_version = alpm_pkg.version; } if (alpm_pkg != null) { // name @@ -957,6 +1007,16 @@ namespace Pamac { // repo if (sync_pkg != null) { repo = sync_pkg.db.name; + } else if (config.enable_aur) { + var loop = new MainLoop (); + get_aur_pkg.begin (alpm_pkg.name, (obj, res) => { + var aur_pkg = get_aur_pkg.end (res); + if (aur_pkg.name != "") { + repo = dgettext (null, "AUR"); + } + loop.quit (); + }); + loop.run (); } // reason if (alpm_pkg.reason == Alpm.Package.Reason.EXPLICIT) { @@ -1227,10 +1287,11 @@ namespace Pamac { if (process.get_exit_status () == 0) { try { var dis = new DataInputStream (process.get_stdout_pipe ()); + var file = File.new_for_path (Path.build_path ("/", pkgdir_name, ".SRCINFO")); // delete the file before rewrite it - yield srcinfo.delete_async (); + yield file.delete_async (); // creating a DataOutputStream to the file - var dos = new DataOutputStream (yield srcinfo.create_async (FileCreateFlags.REPLACE_DESTINATION)); + var dos = new DataOutputStream (yield file.create_async (FileCreateFlags.REPLACE_DESTINATION)); // writing makepkg output to .SRCINFO yield dos.splice_async (dis, 0); return true; @@ -1468,6 +1529,7 @@ namespace Pamac { public async List<AURPackage> get_aur_updates () { // get local pkgs string[] local_pkgs = {}; + string[] vcs_local_pkgs = {}; unowned Alpm.List<unowned Alpm.Package> pkgcache = alpm_handle.localdb.pkgcache; while (pkgcache != null) { unowned Alpm.Package installed_pkg = pkgcache.data; @@ -1476,12 +1538,22 @@ namespace Pamac { // check if installed_pkg is a local pkg unowned Alpm.Package? pkg = get_syncpkg (installed_pkg.name); if (pkg == null) { - local_pkgs += installed_pkg.name; + if (config.check_aur_vcs_updates && + (installed_pkg.name.has_suffix ("-git") + || installed_pkg.name.has_suffix ("-svn") + || installed_pkg.name.has_suffix ("-bzr") + || installed_pkg.name.has_suffix ("-hg"))) { + vcs_local_pkgs += installed_pkg.name; + } else { + local_pkgs += installed_pkg.name; + } } } pkgcache.next (); } - return get_aur_updates_real (yield aur_multiinfo (local_pkgs)); + Json.Array aur_infos = yield aur_multiinfo (local_pkgs); + AURUpdates aur_updates = yield get_aur_updates_real (aur_infos, vcs_local_pkgs); + return (owned) aur_updates.updates; } public void refresh_tmp_files_dbs () { @@ -1517,6 +1589,7 @@ namespace Pamac { // check updates // count this step as 5% of the total string[] local_pkgs = {}; + string[] vcs_local_pkgs = {}; unowned Alpm.List<unowned Alpm.Package> pkgcache = tmp_handle.localdb.pkgcache; while (pkgcache != null) { unowned Alpm.Package installed_pkg = pkgcache.data; @@ -1530,7 +1603,15 @@ namespace Pamac { // check if installed_pkg is a local pkg pkg = get_syncpkg (installed_pkg.name); if (pkg == null) { - local_pkgs += installed_pkg.name; + if (config.check_aur_vcs_updates && + (installed_pkg.name.has_suffix ("-git") + || installed_pkg.name.has_suffix ("-svn") + || installed_pkg.name.has_suffix ("-bzr") + || installed_pkg.name.has_suffix ("-hg"))) { + vcs_local_pkgs += installed_pkg.name; + } else { + local_pkgs += installed_pkg.name; + } } } } @@ -1541,27 +1622,121 @@ namespace Pamac { if (config.check_aur_updates) { // count this step as 5% of the total get_updates_progress (100); - return new Updates.from_lists ((owned) repos_updates, get_aur_updates_real (yield aur_multiinfo (local_pkgs))); + Json.Array aur_infos = yield aur_multiinfo (local_pkgs); + AURUpdates aur_updates = yield get_aur_updates_real (aur_infos, vcs_local_pkgs); + return new Updates.from_lists ((owned) repos_updates, (owned) aur_updates.updates, (owned) aur_updates.outofdate); } else { get_updates_progress (100); - return new Updates.from_lists ((owned) repos_updates, new List<AURPackage> ()); + return new Updates.from_lists ((owned) repos_updates, new List<AURPackage> (), new List<AURPackage> ()); + } + } + + async List<AURPackage> get_vcs_last_version (string[] vcs_local_pkgs) { + var vcs_packages = new List<AURPackage> (); + foreach (unowned string pkgname in vcs_local_pkgs) { + // get last build files + File? clone_dir = yield clone_build_files (pkgname, false); + if (clone_dir != null) { + // get last sources + // no output to not pollute checkupdates output + var launcher = new SubprocessLauncher (SubprocessFlags.STDOUT_SILENCE | SubprocessFlags.STDERR_SILENCE); + launcher.set_cwd (clone_dir.get_path ()); + string[] cmds = {"makepkg", "--nobuild", "--noprepare"}; + int status = yield launch_subprocess (launcher, cmds); + if (status == 0) { + bool success = yield regenerate_srcinfo (clone_dir.get_basename ()); + if (success) { + var srcinfo = clone_dir.get_child (".SRCINFO"); + try { + // read .SRCINFO + var dis = new DataInputStream (srcinfo.read ()); + string line; + string current_section = ""; + bool current_section_is_pkgbase = true; + string version = ""; + string pkgbase = ""; + string desc = ""; + string[] pkgnames_found = {}; + var pkgnames_table = new HashTable<string, AURPackageStruct?> (str_hash, str_equal); + while ((line = yield dis.read_line_async ()) != null) { + if ("pkgbase = " in line) { + pkgbase = line.split (" = ", 2)[1]; + } else if ("pkgdesc = " in line) { + desc = line.split (" = ", 2)[1]; + if (!current_section_is_pkgbase) { + unowned AURPackageStruct? aur_struct = pkgnames_table.get (current_section); + if (aur_struct != null) { + aur_struct.desc = desc; + } + } + } else if ("pkgver = " in line) { + version = line.split ("pkgver = ", 2)[1]; + } else if ("pkgrel = " in line) { + version += "-"; + version += line.split ("pkgrel = ", 2)[1]; + } else if ("epoch = " in line) { + version = "%s:%s".printf (line.split (" = ", 2)[1], version); + } else if ("pkgname = " in line) { + string pkgname_found = line.split (" = ", 2)[1]; + current_section = pkgname_found; + current_section_is_pkgbase = false; + pkgnames_found += pkgname_found; + if (!pkgnames_table.contains (pkgname_found)) { + string installed_version = ""; + unowned Alpm.Package? pkg = alpm_handle.localdb.get_pkg (pkgname_found); + if (pkg != null) { + installed_version = pkg.version; + } + var aur_struct = AURPackageStruct () { + name = pkgname_found, + version = version, + installed_version = (owned) installed_version, + desc = desc, + packagebase = pkgbase + }; + pkgnames_table.insert (pkgname_found, (owned) aur_struct); + } + } + } + foreach (unowned string pkgname_found in pkgnames_found) { + AURPackageStruct? aur_struct = pkgnames_table.take (pkgname_found); + vcs_packages.append (new AURPackage.from_struct ((owned) aur_struct)); + } + } catch (GLib.Error e) { + stderr.printf ("Error: %s\n", e.message); + continue; + } + } + } + } } + return vcs_packages; } - List<AURPackage> get_aur_updates_real (Json.Array aur_updates_json) { - var aur_updates = new List<AURPackage> (); - aur_updates_json.foreach_element ((array, index, node) => { + async AURUpdates get_aur_updates_real (Json.Array aur_infos, string[] vcs_local_pkgs) { + var updates = new List<AURPackage> (); + var outofdate = new List<AURPackage> (); + if (config.check_aur_vcs_updates) { + var vcs_updates = yield get_vcs_last_version (vcs_local_pkgs); + foreach (unowned AURPackage aur_pkg in vcs_updates) { + if (Alpm.pkg_vercmp (aur_pkg.version, aur_pkg.installed_version) == 1) { + updates.append (aur_pkg); + } + } + } + aur_infos.foreach_element ((array, index, node) => { unowned Json.Object pkg_info = node.get_object (); unowned string name = pkg_info.get_string_member ("Name"); unowned string new_version = pkg_info.get_string_member ("Version"); unowned string old_version = alpm_handle.localdb.get_pkg (name).version; if (Alpm.pkg_vercmp (new_version, old_version) == 1) { - var infos = initialise_aur_struct (pkg_info); - infos.installed_version = old_version; - aur_updates.append (new AURPackage.from_struct ((owned) infos)); + updates.append (new AURPackage.from_struct (initialise_aur_struct (pkg_info))); + } else if (!pkg_info.get_member ("OutOfDate").is_null ()) { + // get out of date packages + outofdate.append (new AURPackage.from_struct (initialise_aur_struct (pkg_info))); } }); - return (owned) aur_updates; + return new AURUpdates ((owned) updates, (owned) outofdate); } } } diff --git a/src/installer.vala b/src/installer.vala index c64cca70aff3db257e2509d4d12162900837bf19..15391a3425e3a389aa8e40b4da3b34d345039002 100644 --- a/src/installer.vala +++ b/src/installer.vala @@ -49,8 +49,8 @@ namespace Pamac { transaction.important_details_outpout.connect (on_important_details_outpout); progress_dialog.box.pack_start (transaction.progress_box); progress_dialog.box.reorder_child (transaction.progress_box, 0); - transaction.term_window.height_request = 200; - progress_dialog.expander.add (transaction.term_window); + transaction.details_window.height_request = 200; + progress_dialog.expander.add (transaction.details_window); progress_dialog.close_button.clicked.connect (on_close_button_clicked); } diff --git a/src/manager_window.vala b/src/manager_window.vala index 086740f37abd73fe9df28afa2bdb425ae54c7cd8..bbb789c07c087bd5a12735ad590c06bdee6c67d8 100644 --- a/src/manager_window.vala +++ b/src/manager_window.vala @@ -391,7 +391,7 @@ namespace Pamac { transaction.generate_mirrors_list_finished.connect (on_generate_mirrors_list_finished); // integrate progress box and term widget - main_stack.add_named (transaction.term_window, "term"); + main_stack.add_named (transaction.details_window, "term"); transaction_infobox.pack_start (transaction.progress_box); // integrate build files notebook properties_stack.add_named (transaction.build_files_notebook, "build_files"); @@ -2677,7 +2677,8 @@ namespace Pamac { [GtkCallback] void on_apply_button_clicked () { - if (filters_stack.visible_child_name == "updates") { + if (filters_stack.visible_child_name == "updates" && + main_stack.visible_child_name == "browse") { force_refresh = false; transaction.no_confirm_upgrade = true; try_lock_and_run (run_sysupgrade); diff --git a/src/meson.build b/src/meson.build index 3e2db2e1c1e08a39d56cf59f8a68acf8604549bb..d35faaef4acae4dd9fef0ea0c65d9116a21337de 100644 --- a/src/meson.build +++ b/src/meson.build @@ -31,8 +31,8 @@ common_vala_args = ['--pkg=posix', '--target-glib=2.38'] common_c_args = ['-DGETTEXT_PACKAGE="pamac"'] common_sources = ['common.vala', 'package.vala', 'pamac_config.vala'] -transaction_gtk_sources = ['transaction-gtk.vala', 'choose_provider_dialog.vala', 'transaction_sum_dialog.vala', 'progress_box.vala'] -preferences_sources = ['preferences_dialog.vala', 'choose_ignorepkgs_dialog.vala'] +transaction_gtk_sources = ['transaction-gtk.vala', 'choose_provider_dialog.vala', 'choose_pkgs_dialog.vala', 'transaction_sum_dialog.vala', 'progress_box.vala'] +preferences_sources = ['preferences_dialog.vala'] executable('pamac-clean-cache', sources: ['pamac_config.vala', 'clean_cache.vala'], diff --git a/src/package.vala b/src/package.vala index 30b2d8e5e6a6d4c643a4bd63d99e8048638db217..e3513fbdcb6721d5618b9cc256499995343b7c3e 100644 --- a/src/package.vala +++ b/src/package.vala @@ -164,13 +164,15 @@ namespace Pamac { public string desc { get {return pkg_struct.desc;} } public double popularity { get {return pkg_struct.popularity;} } public string packagebase { get {return pkg_struct.packagebase;} } + public string outofdate { get {return pkg_struct.outofdate;} } internal AURPackage () { pkg_struct = AURPackageStruct () { name = "", version = "", installed_version = "", desc = "", - packagebase = "" + packagebase = "", + outofdate = "" }; } internal AURPackage.from_struct (owned AURPackageStruct pkg_struct) { @@ -321,15 +323,19 @@ namespace Pamac { public class Updates: Object { List<Package> repos_updates_priv; List<AURPackage> aur_updates_priv; + List<AURPackage> outofdate_priv; public List<Package> repos_updates { get {return repos_updates_priv;} } public List<AURPackage> aur_updates { get {return aur_updates_priv;} } + public List<AURPackage> outofdate { get {return outofdate_priv;} } internal Updates () { repos_updates_priv = new List<Package> (); aur_updates_priv = new List<AURPackage> (); + outofdate_priv = new List<AURPackage> (); } - internal Updates.from_lists (owned List<Package> repos_updates, owned List<AURPackage> aur_updates) { + internal Updates.from_lists (owned List<Package> repos_updates, owned List<AURPackage> aur_updates, owned List<AURPackage> outofdate) { repos_updates_priv = (owned) repos_updates; aur_updates_priv = (owned) aur_updates; + outofdate_priv = (owned) outofdate; } } } diff --git a/src/pamac_config.vala b/src/pamac_config.vala index 30641142c9710cff6271b44e092f1cc120b9445c..62013f6ddbb1f5b7c1ef43dba7b6cd6a05d99d18 100644 --- a/src/pamac_config.vala +++ b/src/pamac_config.vala @@ -28,6 +28,7 @@ namespace Pamac { public bool enable_aur { get; set; } public string aur_build_dir { get; set; } public bool check_aur_updates { get; set; } + public bool check_aur_vcs_updates { get; set; } public bool download_updates { get; set; } public uint64 clean_keep_num_pkgs { get; set; } public bool clean_rm_only_uninstalled { get; set; } @@ -78,6 +79,7 @@ namespace Pamac { enable_aur = false; aur_build_dir = "/var/tmp"; check_aur_updates = false; + check_aur_vcs_updates = false; download_updates = false; clean_keep_num_pkgs = 3; clean_rm_only_uninstalled = false; @@ -89,6 +91,9 @@ namespace Pamac { } if (enable_aur == false) { check_aur_updates = false; + check_aur_vcs_updates = false; + } else if (check_aur_updates == false) { + check_aur_vcs_updates = false; } } @@ -137,6 +142,8 @@ namespace Pamac { } } else if (key == "CheckAURUpdates") { check_aur_updates = true; + } else if (key == "CheckAURVCSUpdates") { + check_aur_vcs_updates = true; } else if (key == "DownloadUpdates") { download_updates = true; } @@ -241,6 +248,17 @@ namespace Pamac { } else { data.append (line + "\n"); } + } else if (line.contains ("CheckAURVCSUpdates")) { + if (new_conf.lookup_extended ("CheckAURVCSUpdates", null, out variant)) { + if (variant.get_boolean ()) { + data.append ("CheckAURVCSUpdates\n"); + } else { + data.append ("#CheckAURVCSUpdates\n"); + } + new_conf.remove ("CheckAURVCSUpdates"); + } else { + data.append (line + "\n"); + } } else if (line.contains ("DownloadUpdates")) { if (new_conf.lookup_extended ("DownloadUpdates", null, out variant)) { if (variant.get_boolean ()) { @@ -307,6 +325,12 @@ namespace Pamac { } else { data.append ("#CheckAURUpdates\n"); } + } else if (key == "CheckAURVCSUpdates") { + if (val.get_boolean ()) { + data.append ("CheckAURVCSUpdates\n"); + } else { + data.append ("#CheckAURVCSUpdates\n"); + } } else if (key == "DownloadUpdates") { if (val.get_boolean ()) { data.append ("DownloadUpdates\n"); diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala index 1dfd4c34dca1a96a2ab37b3d9df0f693314cf276..4b87c52a96be96838ed6f8b15374ab742352bd64 100644 --- a/src/preferences_dialog.vala +++ b/src/preferences_dialog.vala @@ -55,6 +55,8 @@ namespace Pamac { [GtkChild] Gtk.CheckButton check_aur_updates_checkbutton; [GtkChild] + Gtk.CheckButton check_aur_vcs_updates_checkbutton; + [GtkChild] Gtk.Label cache_keep_nb_label; [GtkChild] Gtk.SpinButton cache_keep_nb_spin_button; @@ -144,9 +146,13 @@ namespace Pamac { } check_aur_updates_checkbutton.active = transaction.database.config.check_aur_updates; check_aur_updates_checkbutton.sensitive = transaction.database.config.enable_aur; + check_aur_vcs_updates_checkbutton.active = transaction.database.config.check_aur_vcs_updates; + check_aur_vcs_updates_checkbutton.sensitive = transaction.database.config.enable_aur + && transaction.database.config.check_aur_updates; enable_aur_button.state_set.connect (on_enable_aur_button_state_set); 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); + check_aur_vcs_updates_checkbutton.toggled.connect (on_check_aur_vcs_updates_checkbutton_toggled); } bool on_remove_unrequired_deps_button_state_set (bool new_state) { @@ -221,9 +227,15 @@ namespace Pamac { transaction.start_write_pamac_config (new_pamac_conf); } + void on_check_aur_vcs_updates_checkbutton_toggled () { + var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal); + new_pamac_conf.insert ("CheckAURVCSUpdates", new Variant.boolean (check_aur_vcs_updates_checkbutton.active)); + transaction.start_write_pamac_config (new_pamac_conf); + } + void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, bool enable_aur, string aur_build_dir, bool check_aur_updates, - bool download_updates) { + bool check_aur_vcs_updates, bool download_updates) { remove_unrequired_deps_button.state = recurse; if (refresh_period == 0) { check_updates_button.state = false; @@ -249,6 +261,8 @@ 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; + check_aur_vcs_updates_checkbutton.active = check_aur_vcs_updates; + check_aur_vcs_updates_checkbutton.sensitive = enable_aur && check_aur_updates; } bool on_check_space_button_state_set (bool new_state) { @@ -260,7 +274,7 @@ namespace Pamac { [GtkCallback] void on_add_ignorepkgs_button_clicked () { - var choose_ignorepkgs_dialog = new ChooseIgnorepkgsDialog (this); + transaction.choose_pkgs_dialog.title = dgettext (null, "Choose Ignored Upgrades"); this.get_window ().set_cursor (new Gdk.Cursor.for_display (Gdk.Display.get_default (), Gdk.CursorType.WATCH)); while (Gtk.events_pending ()) { Gtk.main_iteration (); @@ -273,18 +287,19 @@ namespace Pamac { foreach (unowned string ignorepkg in ignorepkgs) { ignorepkgs_set.add (ignorepkg); } + transaction.choose_pkgs_dialog.pkgs_list.clear (); foreach (unowned Package pkg in pkgs) { if (pkg.name in ignorepkgs_set) { - choose_ignorepkgs_dialog.pkgs_list.insert_with_values (null, -1, 0, true, 1, pkg.name); + transaction.choose_pkgs_dialog.pkgs_list.insert_with_values (null, -1, 0, true, 1, pkg.name); ignorepkgs_set.remove (pkg.name); } else { - choose_ignorepkgs_dialog.pkgs_list.insert_with_values (null, -1, 0, false, 1, pkg.name); + transaction.choose_pkgs_dialog.pkgs_list.insert_with_values (null, -1, 0, false, 1, pkg.name); } } this.get_window ().set_cursor (null); - if (choose_ignorepkgs_dialog.run () == Gtk.ResponseType.OK) { + if (transaction.choose_pkgs_dialog.run () == Gtk.ResponseType.OK) { var ignorepkg_string = new StringBuilder (); - choose_ignorepkgs_dialog.pkgs_list.foreach ((model, path, iter) => { + transaction.choose_pkgs_dialog.pkgs_list.foreach ((model, path, iter) => { GLib.Value val; // get value at column 0 to know if it is selected model.get_value (iter, 0, out val); @@ -307,7 +322,7 @@ namespace Pamac { new_alpm_conf.insert ("IgnorePkg", new Variant.string (ignorepkg_string.str)); transaction.start_write_alpm_config (new_alpm_conf); } - choose_ignorepkgs_dialog.destroy (); + transaction.choose_pkgs_dialog.hide (); while (Gtk.events_pending ()) { Gtk.main_iteration (); } diff --git a/src/system_daemon.vala b/src/system_daemon.vala index 39fd8b83444f705c37919f2d443ae4960cd124a2..60fd0a60541b958e345d9f58ab377fae64c3ff06 100644 --- a/src/system_daemon.vala +++ b/src/system_daemon.vala @@ -64,7 +64,7 @@ namespace Pamac { public signal void get_authorization_finished (bool authorized); public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, bool enable_aur, string aur_build_dir, bool check_aur_updates, - bool download_updates); + bool check_aur_vcs_updates, bool download_updates); public signal void write_alpm_config_finished (bool checkspace); public signal void generate_mirrors_list_data (string line); public signal void generate_mirrors_list_finished (); @@ -291,7 +291,7 @@ namespace Pamac { } write_pamac_config_finished (config.recurse, config.refresh_period, config.no_update_hide_icon, config.enable_aur, config.aur_build_dir, config.check_aur_updates, - config.download_updates); + config.check_aur_vcs_updates, config.download_updates); }); } @@ -322,7 +322,7 @@ namespace Pamac { private void generate_mirrors_list () { try { var process = new Subprocess.newv ( - {"pacman-mirrors", "-c", mirrorlist_country}, + {"pacman-mirrors", "--no-color", "-c", mirrorlist_country}, SubprocessFlags.STDOUT_PIPE | SubprocessFlags.STDERR_MERGE); var dis = new DataInputStream (process.get_stdout_pipe ()); string? line; diff --git a/src/transaction-cli.vala b/src/transaction-cli.vala index 539a8a6a43b133565a6e0e29fe2c6679f9f507e0..82ed6719927c0e887fc94cb381d3fd80975a464f 100644 --- a/src/transaction-cli.vala +++ b/src/transaction-cli.vala @@ -183,6 +183,68 @@ namespace Pamac { } } + protected override List<string> choose_optdeps (string pkgname, List<string> optdeps) { + var optdeps_to_install = new List<string> (); + // print pkgs + int num_length = optdeps.length ().to_string ().length + 1; + stdout.printf ("%s:\n".printf (dgettext (null, "Choose optional dependencies for %s").printf (pkgname))); + int num = 1; + foreach (unowned string name in optdeps) { + stdout.printf ("%*s %s\n", + num_length, "%i:".printf (num), + name); + num++; + } + // get user input + while (true) { + stdout.printf ("%s: ", dgettext (null, "Enter a selection (default=%s)").printf (dgettext (null, "none"))); + string ans = stdin.read_line (); + uint64 nb; + uint64[] numbers = {}; + // remvove trailing newline + ans = ans.replace ("\n", ""); + // just return use default + if (ans == "") { + break; + } else { + // split "," + string[] splitted = ans.split (","); + foreach (unowned string part in splitted) { + // check for range + if ("-" in part) { + string[] splitted2 = part.split ("-", 2); + // get all numbers in range + int64 beg_num, end_num; + if (int64.try_parse (splitted2[0], out beg_num)) { + if (int64.try_parse (splitted2[1], out end_num)) { + nb = beg_num; + while (nb <= end_num) { + if (nb >= 1 && nb < optdeps.length ()) { + numbers += nb; + } + nb++; + } + } + } + } else if (uint64.try_parse (part, out nb)) { + if (nb >= 1 && nb < optdeps.length ()) { + numbers += nb; + } + } + } + } + stdout.printf ("\n"); + if (numbers.length > 0) { + foreach (uint64 number in numbers) { + optdeps_to_install.append (optdeps.nth_data ((uint) number -1)); + } + break; + } + } + stdout.printf ("\n"); + return optdeps_to_install; + } + protected override int choose_provider (string depend, string[] providers) { Package[] pkgs = {}; foreach (unowned string pkgname in providers) { @@ -194,7 +256,6 @@ namespace Pamac { // print pkgs int name_length = 0; int version_length = 0; - int repo_length = 0; foreach (unowned Package pkg in pkgs) { if (pkg.name.length > name_length) { name_length = pkg.name.length; @@ -202,27 +263,16 @@ namespace Pamac { if (pkg.version.length > version_length) { version_length = pkg.version.length; } - if (pkg.repo.length > repo_length) { - repo_length = pkg.repo.length; - } } int num_length = providers.length.to_string ().length + 1; - int total_width = num_length + name_length + version_length + repo_length + 4; - int margin = 0; - if (get_term_width () > total_width) { - // divide available space between columns - int available_width = get_term_width () - total_width; - margin = available_width / 3; - // get left space to repo - repo_length += available_width - (margin * 3); - } stdout.printf ("%s:\n".printf (dgettext (null, "Choose a provider for %s").printf (depend))); int num = 1; foreach (unowned Package pkg in pkgs) { - stdout.printf ("%*s %-*s %-*s %-*s \n", num_length, "%i:".printf (num), - name_length + margin, pkg.name, - version_length + margin, pkg.version, - repo_length + margin, pkg.repo); + stdout.printf ("%*s %-*s %-*s %s\n", + num_length, "%i:".printf (num), + name_length, pkg.name, + version_length, pkg.version, + pkg.repo); num++; } // get user input @@ -275,187 +325,204 @@ namespace Pamac { uint64 dsize = 0; uint64 rsize = 0; int64 isize = 0; - int max_name_length = 0; - int max_version_length = 0; - int max_installed_version_length = 0; - int max_size_length = 0; - int margin = 0; + int name_length = 0; + int version_length = 0; + int installed_version_length = 0; + int repo_length = 0; // first pass to compute pkgs size and strings length if (summary.to_remove.length () > 0) { - foreach (unowned Package infos in summary.to_remove) { - rsize += infos.size; - if (infos.name.length > max_name_length) { - max_name_length = infos.name.length; + foreach (unowned Package pkg in summary.to_remove) { + rsize += pkg.size; + if (pkg.name.length > name_length) { + name_length = pkg.name.length; } - if (infos.version.length > max_version_length) { - max_version_length = infos.version.length; + if (pkg.version.length > version_length) { + version_length = pkg.version.length; + } + if (pkg.repo.length > repo_length) { + repo_length = pkg.repo.length; } } } if (summary.aur_conflicts_to_remove.length () > 0) { - foreach (unowned Package infos in summary.aur_conflicts_to_remove) { - rsize += infos.size; - if (infos.name.length > max_name_length) { - max_name_length = infos.name.length; + foreach (unowned Package pkg in summary.aur_conflicts_to_remove) { + rsize += pkg.size; + if (pkg.name.length > name_length) { + name_length = pkg.name.length; + } + if (pkg.version.length > version_length) { + version_length = pkg.version.length; } - if (infos.version.length > max_version_length) { - max_version_length = infos.version.length; + if (pkg.repo.length > repo_length) { + repo_length = pkg.repo.length; } } } if (summary.to_downgrade.length () > 0) { - foreach (unowned Package infos in summary.to_downgrade) { - dsize += infos.download_size; - var pkg = database.get_installed_pkg (infos.name); - isize += ((int64) infos.size - (int64) pkg.size); - if (infos.name.length > max_name_length) { - max_name_length = infos.name.length; + foreach (unowned Package pkg in summary.to_downgrade) { + dsize += pkg.download_size; + var installed_pkg = database.get_installed_pkg (pkg.name); + isize += ((int64) pkg.size - (int64) installed_pkg.size); + if (pkg.name.length > name_length) { + name_length = pkg.name.length; } - if (infos.version.length > max_version_length) { - max_version_length = infos.version.length; + if (pkg.version.length > version_length) { + version_length = pkg.version.length; } - if (infos.installed_version.length > max_installed_version_length) { - max_installed_version_length = infos.installed_version.length; + if (pkg.installed_version.length > installed_version_length) { + installed_version_length = pkg.installed_version.length; } - string size = format_size (infos.download_size); - if (size.length > max_size_length) { - max_size_length = size.length; + if (pkg.repo.length > repo_length) { + repo_length = pkg.repo.length; } } } if (summary.to_build.length () > 0) { - foreach (unowned AURPackage infos in summary.to_build) { - if (infos.name.length > max_name_length) { - max_name_length = infos.name.length; + foreach (unowned AURPackage aur_pkg in summary.to_build) { + if (aur_pkg.name.length > name_length) { + name_length = aur_pkg.name.length; + } + if (aur_pkg.version.length > version_length) { + version_length = aur_pkg.version.length; } - if (infos.version.length > max_version_length) { - max_version_length = infos.version.length; + if (dgettext (null, "AUR").char_count () > repo_length) { + repo_length = dgettext (null, "AUR").char_count (); } } } if (summary.to_install.length () > 0) { - foreach (unowned Package infos in summary.to_install) { - dsize += infos.download_size; - var pkg = database.get_installed_pkg (infos.name); - isize += ((int64) infos.size - (int64) pkg.size); - if (infos.name.length > max_name_length) { - max_name_length = infos.name.length; + foreach (unowned Package pkg in summary.to_install) { + dsize += pkg.download_size; + var installed_pkg = database.get_installed_pkg (pkg.name); + isize += ((int64) pkg.size - (int64) installed_pkg.size); + if (pkg.name.length > name_length) { + name_length = pkg.name.length; } - if (infos.version.length > max_version_length) { - max_version_length = infos.version.length; + if (pkg.version.length > version_length) { + version_length = pkg.version.length; } - string size = format_size (infos.download_size); - if (size.length > max_size_length) { - max_size_length = size.length; + if (pkg.repo.length > repo_length) { + repo_length = pkg.repo.length; } } } if (summary.to_reinstall.length () > 0) { - foreach (unowned Package infos in summary.to_reinstall) { - dsize += infos.download_size; - if (infos.name.length > max_name_length) { - max_name_length = infos.name.length; + foreach (unowned Package pkg in summary.to_reinstall) { + dsize += pkg.download_size; + if (pkg.name.length > name_length) { + name_length = pkg.name.length; } - if (infos.version.length > max_version_length) { - max_version_length = infos.version.length; + if (pkg.version.length > version_length) { + version_length = pkg.version.length; } - string size = format_size (infos.download_size); - if (size.length > max_size_length) { - max_size_length = size.length; + if (pkg.repo.length > repo_length) { + repo_length = pkg.repo.length; } } } if (summary.to_upgrade.length () > 0) { - foreach (unowned Package infos in summary.to_upgrade) { - dsize += infos.download_size; - var pkg = database.get_installed_pkg (infos.name); - isize += ((int64) infos.size - (int64) pkg.size); - if (infos.name.length > max_name_length) { - max_name_length = infos.name.length; + foreach (unowned Package pkg in summary.to_upgrade) { + dsize += pkg.download_size; + var installed_pkg = database.get_installed_pkg (pkg.name); + isize += ((int64) pkg.size - (int64) installed_pkg.size); + if (pkg.name.length > name_length) { + name_length = pkg.name.length; } - if (infos.version.length > max_version_length) { - max_version_length = infos.version.length; + if (pkg.version.length > version_length) { + version_length = pkg.version.length; } - if (infos.installed_version.length > max_installed_version_length) { - max_installed_version_length = infos.installed_version.length; + if (pkg.installed_version.length > installed_version_length) { + installed_version_length = pkg.installed_version.length; } - string size = format_size (infos.download_size); - if (size.length > max_size_length) { - max_size_length = size.length; + if (pkg.repo.length > repo_length) { + repo_length = pkg.repo.length; } } } // second pass to print details - max_installed_version_length += 2; // because of (%s) - int total_width = max_name_length + max_version_length + max_installed_version_length + max_size_length + 6; - if (get_term_width () > total_width) { - // divide available space between columns - int available_width = get_term_width () - total_width; - margin = available_width / 4; - // get left space to size - max_size_length += available_width - (margin * 4); + if (installed_version_length > 0) { + installed_version_length += 2; // because of (%s) } if (summary.to_upgrade.length () > 0) { stdout.printf (dgettext (null, "To upgrade") + " (%u):\n".printf (summary.to_upgrade.length ())); - foreach (unowned Package infos in summary.to_upgrade) { - string size = infos.download_size == 0 ? "" : format_size (infos.download_size); - stdout.printf (" %-*s %-*s %-*s %*s \n", max_name_length + margin, infos.name, - max_version_length + margin, infos.version, - max_installed_version_length + margin, "(%s)".printf (infos.installed_version), - max_size_length + margin, size); + foreach (unowned Package pkg in summary.to_upgrade) { + string size = pkg.download_size == 0 ? "" : format_size (pkg.download_size); + stdout.printf (" %-*s %-*s %-*s %-*s %s\n", + name_length, pkg.name, + version_length, pkg.version, + installed_version_length, "(%s)".printf (pkg.installed_version), + repo_length, pkg.repo, + size); } } if (summary.to_reinstall.length () > 0) { stdout.printf (dgettext (null, "To reinstall") + " (%u):\n".printf (summary.to_reinstall.length ())); - foreach (unowned Package infos in summary.to_reinstall) { - string size = infos.download_size == 0 ? "" : format_size (infos.download_size); - stdout.printf (" %-*s %-*s %*s \n", max_name_length + margin, infos.name, - max_version_length + margin, infos.version, - max_size_length + margin, size); + foreach (unowned Package pkg in summary.to_reinstall) { + string size = pkg.download_size == 0 ? "" : format_size (pkg.download_size); + stdout.printf (" %-*s %-*s %-*s %-*s %s\n", + name_length, pkg.name, + version_length , pkg.version, + installed_version_length, "", + repo_length, pkg.repo, + size); } } if (summary.to_install.length () > 0) { stdout.printf (dgettext (null, "To install") + " (%u):\n".printf (summary.to_install.length ())); - foreach (unowned Package infos in summary.to_install) { - string size = infos.download_size == 0 ? "" : format_size (infos.download_size); - stdout.printf (" %-*s %-*s %*s \n", max_name_length + margin, infos.name, - max_version_length + margin, infos.version, - max_size_length + margin, size); + foreach (unowned Package pkg in summary.to_install) { + string size = pkg.download_size == 0 ? "" : format_size (pkg.download_size); + stdout.printf (" %-*s %-*s %-*s %-*s %s\n", + name_length, pkg.name, + version_length , pkg.version, + installed_version_length, "", + repo_length, pkg.repo, + size); } } if (summary.to_build.length () > 0) { stdout.printf (dgettext (null, "To build") + " (%u):\n".printf (summary.to_build.length ())); - foreach (unowned AURPackage infos in summary.to_build) { - stdout.printf (" %-*s %-*s\n", max_name_length + margin, infos.name, - max_version_length + margin, infos.version); + foreach (unowned AURPackage aur_pkg in summary.to_build) { + stdout.printf (" %-*s %-*s %-*s %s\n", + name_length, aur_pkg.name, + version_length , aur_pkg.version, + installed_version_length, "", + dgettext (null, "AUR")); } } if (summary.to_downgrade.length () > 0) { stdout.printf (dgettext (null, "To downgrade") + " (%u):\n".printf (summary.to_downgrade.length ())); - foreach (unowned Package infos in summary.to_downgrade) { - string size = infos.download_size == 0 ? "" : format_size (infos.download_size); - stdout.printf (" %-*s %-*s %-*s %*s \n", max_name_length + margin, infos.name, - max_version_length + margin, infos.version, - max_installed_version_length + margin, "(%s)".printf (infos.installed_version), - max_size_length + margin, size); + foreach (unowned Package pkg in summary.to_downgrade) { + string size = pkg.download_size == 0 ? "" : format_size (pkg.download_size); + stdout.printf (" %-*s %-*s %-*s %-*s %s\n", + name_length, pkg.name, + version_length, pkg.version, + installed_version_length, "(%s)".printf (pkg.installed_version), + repo_length, pkg.repo, + size); } } bool to_remove_printed = false; if (summary.to_remove.length () > 0) { stdout.printf (dgettext (null, "To remove") + " (%u):\n".printf (summary.to_remove.length ())); to_remove_printed = true; - foreach (unowned Package infos in summary.to_remove) { - stdout.printf (" %-*s %-*s\n", max_name_length + margin, infos.name, - max_version_length + margin, infos.version); + foreach (unowned Package pkg in summary.to_remove) { + stdout.printf (" %-*s %-*s %-*s %s\n", + name_length, pkg.name, + version_length , pkg.version, + installed_version_length, "", + pkg.repo); } } if (summary.aur_conflicts_to_remove.length () > 0) { if (!to_remove_printed) { stdout.printf (dgettext (null, "To remove") + " (%u):\n".printf (summary.aur_conflicts_to_remove.length ())); } - foreach (unowned Package infos in summary.aur_conflicts_to_remove) { - stdout.printf (" %-*s %-*s\n", max_name_length + margin, infos.name, - max_version_length + margin, infos.version); + foreach (unowned Package pkg in summary.aur_conflicts_to_remove) { + stdout.printf (" %-*s %-*s %-*s %s\n", + name_length, pkg.name, + version_length , pkg.version, + installed_version_length, "", + pkg.repo); } } stdout.printf ("\n"); diff --git a/src/transaction-gtk.vala b/src/transaction-gtk.vala index d3097fe8b5c8dc6a43b43113f52976961e8cd73d..da61211c6e3ee2fc582e64829a6948e2df49e825 100644 --- a/src/transaction-gtk.vala +++ b/src/transaction-gtk.vala @@ -26,10 +26,10 @@ namespace Pamac { string current_action; public ProgressBox progress_box; uint pulse_timeout_id; - Vte.Terminal term; - Vte.Pty pty; - public Gtk.ScrolledWindow term_window; + public Gtk.ScrolledWindow details_window; + Gtk.TextView details_textview; public Gtk.Notebook build_files_notebook; + public ChoosePkgsDialog choose_pkgs_dialog; //parent window public Gtk.ApplicationWindow? application_window { get; construct; } // ask_confirmation option @@ -42,7 +42,7 @@ namespace Pamac { } construct { - //creating dialogs + // create dialogs this.application_window = application_window; transaction_sum_dialog = new TransactionSumDialog (application_window); transaction_summary = new GenericSet<string?> (str_hash, str_equal); @@ -50,28 +50,27 @@ namespace Pamac { current_action = ""; progress_box = new ProgressBox (); progress_box.progressbar.text = ""; - //creating terminal - term = new Vte.Terminal (); - term.set_scrollback_lines (-1); - term.expand = true; - term.visible = true; - var black = Gdk.RGBA (); - black.parse ("black"); - term.set_color_cursor (black); - term.button_press_event.connect (on_term_button_press_event); - term.key_press_event.connect (on_term_key_press_event); - // creating pty for term - try { - pty = term.pty_new_sync (Vte.PtyFlags.NO_HELPER); - } catch (Error e) { - stderr.printf ("Error: %s\n", e.message); - } - // add term in a grid with a scrollbar - term_window = new Gtk.ScrolledWindow (null, term.vadjustment); - term_window.expand = true; - term_window.visible = true; - term_window.propagate_natural_height = true; - term_window.add (term); + choose_pkgs_dialog = new ChoosePkgsDialog (application_window); + // create details textview + details_window = new Gtk.ScrolledWindow (null, null); + details_window.visible = true; + details_window.expand = true; + details_textview = new Gtk.TextView (); + details_textview.visible = true; + details_textview.editable = false; + details_textview.wrap_mode = Gtk.WrapMode.NONE; + details_textview.set_monospace (true); + details_textview.input_hints = Gtk.InputHints.NO_EMOJI; + details_textview.top_margin = 8; + details_textview.bottom_margin = 8; + details_textview.left_margin = 8; + details_textview.right_margin = 8; + Gtk.TextIter iter; + details_textview.buffer.get_end_iter (out iter); + // place a mark at iter, the mark will stay there after we + // insert some text at the end because it has right gravity. + details_textview.buffer.create_mark ("scroll", iter, false); + details_window.add (details_textview); // create build files notebook build_files_notebook = new Gtk.Notebook (); build_files_notebook.visible = true; @@ -82,9 +81,9 @@ namespace Pamac { emit_action.connect (display_action); emit_action_progress.connect (display_action_progress); emit_hook_progress.connect (display_hook_progress); - emit_script_output.connect (show_in_term); + emit_script_output.connect (show_details); emit_warning.connect ((msg) => { - show_in_term (msg); + show_details (msg); warning_textbuffer.append (msg + "\n"); }); emit_error.connect (display_error); @@ -114,44 +113,20 @@ namespace Pamac { } } - bool on_term_button_press_event (Gdk.EventButton event) { - // Check if right mouse button was clicked - if (event.type == Gdk.EventType.BUTTON_PRESS && event.button == 3) { - if (term.get_has_selection ()) { - var right_click_menu = new Gtk.Menu (); - var copy_item = new Gtk.MenuItem.with_label (dgettext (null, "Copy")); - copy_item.activate.connect (() => {term.copy_clipboard ();}); - right_click_menu.append (copy_item); - right_click_menu.show_all (); - right_click_menu.popup_at_pointer (event); - return true; - } - } - return false; - } - - bool on_term_key_press_event (Gdk.EventKey event) { - // Check if Ctrl + c keys were pressed - if (((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) && (Gdk.keyval_name (event.keyval) == "c")) { - term.copy_clipboard (); - return true; - } - return false; - } - - void show_in_term (string message) { - term.set_pty (pty); - try { - Process.spawn_async (null, {"echo", message}, null, SpawnFlags.SEARCH_PATH, pty.child_setup, null); - } catch (SpawnError e) { - stderr.printf ("SpawnError: %s\n", e.message); - } + void show_details (string message) { + Gtk.TextIter iter; + details_textview.buffer.get_end_iter (out iter); + details_textview.buffer.insert (ref iter, message, -1); + details_textview.buffer.insert (ref iter, "\n", 1); + // scroll the mark onscreen + unowned Gtk.TextMark mark = details_textview.buffer.get_mark ("scroll"); + details_textview.scroll_mark_onscreen (mark); } void display_action (string action) { if (action != current_action) { current_action = action; - show_in_term (action); + show_details (action); progress_box.action_label.label = action; if (pulse_timeout_id == 0) { progress_box.progressbar.fraction = 0; @@ -163,7 +138,7 @@ namespace Pamac { void display_action_progress (string action, string status, double progress) { if (action != current_action) { current_action = action; - show_in_term (action); + show_details (action); progress_box.action_label.label = action; } progress_box.progressbar.fraction = progress; @@ -173,10 +148,10 @@ namespace Pamac { void display_hook_progress (string action, string details, string status, double progress) { if (action != current_action) { current_action = action; - show_in_term (action); + show_details (action); progress_box.action_label.label = action; } - show_in_term (details); + show_details (details); progress_box.progressbar.fraction = progress; progress_box.progressbar.text = status; } @@ -202,6 +177,30 @@ namespace Pamac { } } + protected override List<string> choose_optdeps (string pkgname, List<string> optdeps) { + var optdeps_to_install = new List<string> (); + choose_pkgs_dialog.title = dgettext (null, "Choose optional dependencies for %s").printf (pkgname); + choose_pkgs_dialog.pkgs_list.clear (); + foreach (unowned string name in optdeps) { + choose_pkgs_dialog.pkgs_list.insert_with_values (null, -1, 0, false, 1, name); + } + if (choose_pkgs_dialog.run () == Gtk.ResponseType.OK) { + choose_pkgs_dialog.pkgs_list.foreach ((model, path, iter) => { + GLib.Value val; + // get value at column 0 to know if it is selected + model.get_value (iter, 0, out val); + if ((bool) val) { + // get value at column 1 to get the pkg name + model.get_value (iter, 1, out val); + optdeps_to_install.append ((string) val); + } + return false; + }); + } + choose_pkgs_dialog.hide (); + return (owned) optdeps_to_install; + } + protected override int choose_provider (string depend, string[] providers) { var choose_provider_dialog = new ChooseProviderDialog (application_window); choose_provider_dialog.title = dgettext (null, "Choose a provider for %s").printf (depend); @@ -283,39 +282,48 @@ namespace Pamac { transaction_sum_dialog.sum_list.clear (); transaction_sum_dialog.edit_button.visible = false; var iter = Gtk.TreeIter (); + bool to_remove_printed = false; if (summary.to_remove.length () > 0) { - foreach (unowned Package infos in summary.to_remove) { - transaction_summary.add (infos.name); + foreach (unowned Package pkg in summary.to_remove) { + transaction_summary.add (pkg.name); transaction_sum_dialog.sum_list.insert_with_values (out iter, -1, - 1, infos.name, - 2, infos.version); + 1, pkg.name, + 2, pkg.version, + 4, pkg.repo); } Gtk.TreePath path = transaction_sum_dialog.sum_list.get_path (iter); uint pos = (path.get_indices ()[0]) - (summary.to_remove.length () - 1); 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") + ":")); + to_remove_printed = true; } if (summary.aur_conflicts_to_remove.length () > 0) { // do not add type enum because it is just infos - foreach (unowned Package infos in summary.aur_conflicts_to_remove) { - transaction_summary.add (infos.name); + foreach (unowned Package pkg in summary.aur_conflicts_to_remove) { + transaction_summary.add (pkg.name); transaction_sum_dialog.sum_list.insert_with_values (out iter, -1, - 1, infos.name, - 2, infos.version); + 1, pkg.name, + 2, pkg.version, + 4, pkg.repo); + } + if (!to_remove_printed) { + Gtk.TreePath path = transaction_sum_dialog.sum_list.get_path (iter); + uint pos = (path.get_indices ()[0]) - (summary.aur_conflicts_to_remove.length () - 1); + 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") + ":")); } - Gtk.TreePath path = transaction_sum_dialog.sum_list.get_path (iter); - uint pos = (path.get_indices ()[0]) - (summary.aur_conflicts_to_remove.length () - 1); - 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 (summary.to_downgrade.length () > 0) { - foreach (unowned Package infos in summary.to_downgrade) { - dsize += infos.download_size; - transaction_summary.add (infos.name); + foreach (unowned Package pkg in summary.to_downgrade) { + dsize += pkg.download_size; + string size = pkg.download_size == 0 ? "" : format_size (pkg.download_size); + transaction_summary.add (pkg.name); transaction_sum_dialog.sum_list.insert_with_values (out iter, -1, - 1, infos.name, - 2, infos.version, - 3, "(%s)".printf (infos.installed_version)); + 1, pkg.name, + 2, pkg.version, + 3, "(%s)".printf (pkg.installed_version), + 4, pkg.repo, + 5, size); } Gtk.TreePath path = transaction_sum_dialog.sum_list.get_path (iter); uint pos = (path.get_indices ()[0]) - (summary.to_downgrade.length () - 1); @@ -324,11 +332,12 @@ namespace Pamac { } if (summary.to_build.length () > 0) { transaction_sum_dialog.edit_button.visible = true; - foreach (unowned AURPackage infos in summary.to_build) { - transaction_summary.add (infos.name); + foreach (unowned AURPackage aur_pkg in summary.to_build) { + transaction_summary.add (aur_pkg.name); transaction_sum_dialog.sum_list.insert_with_values (out iter, -1, - 1, infos.name, - 2, infos.version); + 1, aur_pkg.name, + 2, aur_pkg.version, + 4, dgettext (null, "AUR")); } Gtk.TreePath path = transaction_sum_dialog.sum_list.get_path (iter); uint pos = (path.get_indices ()[0]) - (summary.to_build.length () - 1); @@ -336,12 +345,15 @@ namespace Pamac { transaction_sum_dialog.sum_list.set (iter, 0, "<b>%s</b>".printf (dgettext (null, "To build") + ":")); } if (summary.to_install.length () > 0) { - foreach (unowned Package infos in summary.to_install) { - dsize += infos.download_size; - transaction_summary.add (infos.name); + foreach (unowned Package pkg in summary.to_install) { + dsize += pkg.download_size; + string size = pkg.download_size == 0 ? "" : format_size (pkg.download_size); + transaction_summary.add (pkg.name); transaction_sum_dialog.sum_list.insert_with_values (out iter, -1, - 1, infos.name, - 2, infos.version); + 1, pkg.name, + 2, pkg.version, + 4, pkg.repo, + 5, size); } Gtk.TreePath path = transaction_sum_dialog.sum_list.get_path (iter); uint pos = (path.get_indices ()[0]) - (summary.to_install.length () - 1); @@ -349,12 +361,15 @@ namespace Pamac { transaction_sum_dialog.sum_list.set (iter, 0, "<b>%s</b>".printf (dgettext (null, "To install") + ":")); } if (summary.to_reinstall.length () > 0) { - foreach (unowned Package infos in summary.to_reinstall) { - dsize += infos.download_size; - transaction_summary.add (infos.name); + foreach (unowned Package pkg in summary.to_reinstall) { + dsize += pkg.download_size; + string size = pkg.download_size == 0 ? "" : format_size (pkg.download_size); + transaction_summary.add (pkg.name); transaction_sum_dialog.sum_list.insert_with_values (out iter, -1, - 1, infos.name, - 2, infos.version); + 1, pkg.name, + 2, pkg.version, + 4, pkg.repo, + 5, size); } Gtk.TreePath path = transaction_sum_dialog.sum_list.get_path (iter); uint pos = (path.get_indices ()[0]) - (summary.to_reinstall.length () - 1); @@ -363,13 +378,16 @@ namespace Pamac { } if (summary.to_upgrade.length () > 0) { if (!no_confirm_upgrade) { - foreach (unowned Package infos in summary.to_upgrade) { - dsize += infos.download_size; - transaction_summary.add (infos.name); + foreach (unowned Package pkg in summary.to_upgrade) { + dsize += pkg.download_size; + string size = pkg.download_size == 0 ? "" : format_size (pkg.download_size); + transaction_summary.add (pkg.name); transaction_sum_dialog.sum_list.insert_with_values (out iter, -1, - 1, infos.name, - 2, infos.version, - 3, "(%s)".printf (infos.installed_version)); + 1, pkg.name, + 2, pkg.version, + 3, "(%s)".printf (pkg.installed_version), + 4, pkg.repo, + 5, size); } Gtk.TreePath path = transaction_sum_dialog.sum_list.get_path (iter); uint pos = (path.get_indices ()[0]) - (summary.to_upgrade.length () - 1); @@ -634,13 +652,13 @@ namespace Pamac { dialog.icon_name = "system-software-install"; var textbuffer = new StringBuilder (); if (details.length != 0) { - show_in_term (message + ":"); + show_details (message + ":"); foreach (unowned string detail in details) { - show_in_term (detail); + show_details (detail); textbuffer.append (detail + "\n"); } } else { - show_in_term (message); + show_details (message); textbuffer.append (message); } dialog.deletable = false; @@ -692,7 +710,7 @@ namespace Pamac { } transaction_summary.remove_all (); reset_progress_box (); - show_in_term (""); + show_details (""); } } } diff --git a/src/transaction.vala b/src/transaction.vala index ed75b96659237c6aabde7fd8e44171d24d729f75..7ba011d85010c1e4f4c75a1db8c23bbb9b990fdb 100644 --- a/src/transaction.vala +++ b/src/transaction.vala @@ -83,7 +83,7 @@ namespace Pamac { public signal void set_pkgreason_finished (); public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, bool enable_aur, string aur_build_dir, bool check_aur_updates, - bool download_updates); + bool check_aur_vcs_updates, bool download_updates); public signal void write_alpm_config_finished (bool checkspace); public signal void start_generating_mirrors_list (); public signal void generate_mirrors_list_finished (); @@ -179,46 +179,9 @@ namespace Pamac { return files; } - protected async bool regenerate_srcinfo (string pkgname) { - string pkgdir_name = Path.build_path ("/", database.config.aur_build_dir, pkgname); - // generate .SRCINFO - var launcher = new SubprocessLauncher (SubprocessFlags.STDOUT_PIPE); - launcher.set_cwd (pkgdir_name); - emit_action (dgettext (null, "Generating %s informations").printf (pkgname) + "..."); - // set building to allow cancellation - building = true; - try { - Subprocess process = launcher.spawnv ({"makepkg", "--printsrcinfo"}); - try { - yield process.wait_async (build_cancellable); - if (process.get_if_exited ()) { - if (process.get_exit_status () == 0) { - try { - var dis = new DataInputStream (process.get_stdout_pipe ()); - var file = File.new_for_path (Path.build_path ("/", pkgdir_name, ".SRCINFO")); - // delete the file before rewrite it - yield file.delete_async (); - // creating a DataOutputStream to the file - var dos = new DataOutputStream (yield file.create_async (FileCreateFlags.REPLACE_DESTINATION)); - // writing makepkg output to .SRCINFO - yield dos.splice_async (dis, 0); - building = false; - return true; - } catch (Error e) { - stderr.printf ("Error: %s\n", e.message); - } - } - } - } catch (Error e) { - // cancelled - process.send_signal (Posix.Signal.INT); - process.send_signal (Posix.Signal.KILL); - } - } catch (Error e) { - stderr.printf ("Error: %s\n", e.message); - } - building = false; - return false; + protected virtual List<string> choose_optdeps (string pkgname, List<string> optdeps) { + // do not install optdeps + return new List<string> (); } protected virtual int choose_provider (string depend, string[] providers) { @@ -419,7 +382,6 @@ namespace Pamac { // error continue; } - already_checked_aur_dep.add (pkgname); } if (build_cancellable.is_cancelled ()) { return; @@ -711,6 +673,29 @@ namespace Pamac { this.to_build = to_build; this.temporary_ignorepkgs = temporary_ignorepkgs; this.overwrite_files = overwrite_files; + // choose optdeps + string[] to_add_to_install = {}; + foreach (unowned string name in this.to_install) { + // do not check if reinstall + if (database.get_installed_pkg (name).name == "") { + List<string> uninstalled_optdeps = database.get_uninstalled_optdeps (name); + var real_uninstalled_optdeps = new List<string> (); + foreach (unowned string optdep in uninstalled_optdeps) { + string optdep_name = optdep.split (": ", 2)[0]; + if (!(optdep_name in this.to_install) && !(optdep_name in to_add_to_install)) { + real_uninstalled_optdeps.append (optdep); + } + } + if (real_uninstalled_optdeps.length () > 0) { + foreach (unowned string optdep in choose_optdeps (name, real_uninstalled_optdeps)) { + to_add_to_install += optdep; + } + } + } + } + foreach (unowned string name in to_add_to_install) { + this.to_install += name; + } emit_action (dgettext (null, "Preparing") + "..."); connecting_signals (); trans_prepare_real (); @@ -758,7 +743,7 @@ namespace Pamac { // building building = true; start_building (); - int status = yield run_cmd_line ({"makepkg", "-cf"}, pkgdir, build_cancellable); + int status = yield run_cmd_line ({"makepkg", "-m", "-cf"}, pkgdir, build_cancellable); if (build_cancellable.is_cancelled ()) { status = 1; } @@ -1338,12 +1323,12 @@ namespace Pamac { void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, bool enable_aur, string aur_build_dir, bool check_aur_updates, - bool download_updates) { + bool check_aur_vcs_updates, bool download_updates) { transaction_interface.write_pamac_config_finished.disconnect (on_write_pamac_config_finished); database.config.reload (); write_pamac_config_finished (recurse, refresh_period, no_update_hide_icon, enable_aur, aur_build_dir, check_aur_updates, - download_updates); + check_aur_vcs_updates, download_updates); } void on_write_alpm_config_finished (bool checkspace) { diff --git a/src/transaction_interface.vala b/src/transaction_interface.vala index 08976abffac917229d3a9770aac2ac921266289e..101ce15b54e60f98b27104e9f811c02fb716b95d 100644 --- a/src/transaction_interface.vala +++ b/src/transaction_interface.vala @@ -54,7 +54,7 @@ namespace Pamac { public signal void get_authorization_finished (bool authorized); public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, bool enable_aur, string aur_build_dir, bool check_aur_updates, - bool download_updates); + bool check_aur_vcs_updates, bool download_updates); public signal void write_alpm_config_finished (bool checkspace); public signal void generate_mirrors_list_data (string line); public signal void generate_mirrors_list_finished (); diff --git a/src/transaction_interface_daemon.vala b/src/transaction_interface_daemon.vala index ca3a6e0007f69974601d68d2e72753904f94b2cb..d8c51d235ccea3f4f9202a11949b7eef5199e2fd 100644 --- a/src/transaction_interface_daemon.vala +++ b/src/transaction_interface_daemon.vala @@ -57,7 +57,7 @@ namespace Pamac { public signal void get_authorization_finished (bool authorized); public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, bool enable_aur, string aur_build_dir, bool check_aur_updates, - bool download_updates); + bool check_aur_vcs_updates, bool download_updates); public signal void write_alpm_config_finished (bool checkspace); public signal void generate_mirrors_list_data (string line); public signal void generate_mirrors_list_finished (); @@ -125,11 +125,11 @@ namespace Pamac { void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, bool enable_aur, string aur_build_dir, bool check_aur_updates, - bool download_updates) { + bool check_aur_vcs_updates, bool download_updates) { system_daemon.write_pamac_config_finished.disconnect (on_write_pamac_config_finished); write_pamac_config_finished (recurse, refresh_period, no_update_hide_icon, enable_aur, aur_build_dir, check_aur_updates, - download_updates); + check_aur_vcs_updates, download_updates); } public void start_write_alpm_config (HashTable<string,Variant> new_alpm_conf) { diff --git a/src/transaction_interface_root.vala b/src/transaction_interface_root.vala index d5cffe256e40d1a370965455ecaa21060adc17f5..739550349b4a870b4819c9f3a6d30e7fded24d36 100644 --- a/src/transaction_interface_root.vala +++ b/src/transaction_interface_root.vala @@ -91,7 +91,7 @@ namespace Pamac { pamac_config.reload (); write_pamac_config_finished (pamac_config.recurse, pamac_config.refresh_period, pamac_config.no_update_hide_icon, pamac_config.enable_aur, pamac_config.aur_build_dir, pamac_config.check_aur_updates, - pamac_config.download_updates); + pamac_config.check_aur_vcs_updates, pamac_config.download_updates); } public void start_write_pamac_config (HashTable<string,Variant> new_pamac_conf) { diff --git a/src/transaction_sum_dialog.vala b/src/transaction_sum_dialog.vala index 7780f3ed02d8fd8bb74b412c7e89fecfe333da78..13f70e0eb2a7b7056f1721d12b4ebb24a7a4f49f 100644 --- a/src/transaction_sum_dialog.vala +++ b/src/transaction_sum_dialog.vala @@ -36,7 +36,7 @@ namespace Pamac { Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header_bar); Object (transient_for: window, use_header_bar: use_header_bar); - sum_list = new Gtk.ListStore (4, typeof (string), typeof (string), typeof (string), typeof (string)); + sum_list = new Gtk.ListStore (6, typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string)); treeview.set_model (sum_list); } } diff --git a/src/tray.vala b/src/tray.vala index 70259b80c25f843aece27b93b1d0fb4867ba7ef2..fe8ae2fb614ee97bb17aac6c51984c6963637b99 100644 --- a/src/tray.vala +++ b/src/tray.vala @@ -124,10 +124,7 @@ namespace Pamac { var config = new Config ("/etc/pamac.conf"); if (config.refresh_period != 0) { // get updates - string[] cmds = {"pamac", "checkupdates"}; - if (config.check_aur_updates) { - cmds += "-a"; - } + string[] cmds = {"pamac", "checkupdates", "-q"}; updates_nb = 0; try { var process = new Subprocess.newv (cmds, SubprocessFlags.STDOUT_PIPE); @@ -141,8 +138,6 @@ namespace Pamac { while (dis.read_line () != null) { updates_nb++; } - // remove the first which is not an update - updates_nb--; if (!check_pamac_running () && config.download_updates) { start_system_daemon (config.environment_variables); try { @@ -198,6 +193,7 @@ namespace Pamac { try { close_notification (); notification = new Notify.Notification (_("Package Manager"), info, "system-software-update"); + notification.set_timeout (Notify.EXPIRES_DEFAULT); notification.add_action ("default", _("Details"), execute_updater); notification.show (); } catch (Error e) { diff --git a/src/version.vala b/src/version.vala index 96b673c7b514415ce11b90abf0413681bfeee6ed..21154b2802348cd7aa3f80e2e1baa7ea7e6b93bf 100644 --- a/src/version.vala +++ b/src/version.vala @@ -1 +1 @@ -const string VERSION = "7.2.1"; +const string VERSION = "7.3.0beta";