Author Topic: Pacli, shell script for pacman and yourt  (Read 21077 times)

0 Members and 1 Guest are viewing this topic.

Offline papajoke

  • Vollwertiges Mitglied
  • ***
  • Posts: 135
  • from www.manjaro.fr
  • Branch: stable/testing
  • Desktop: KDE4 and 5 - zsh
  • GPU driver: video-nouveau free
  • Kernel: x64
  • Skill: Intermediate
Re: Pacli, shell script for pacman and yourt
« Reply #210 on: 02. May 2016, 12:33:48 »
Hello excalibur1234
I struggle to understand where is the problem with your changes. They fit easily into pacli.

the only differences are very minor:
- There is just a first line variable declaration for what is local, not global
- In the last line, a call has a general feature to translate text, display it.
Code: [Select]
#13    fix errors
fix_errors()
{
    declare url version arch

    sudo rm -f /var/lib/pacman/db.lck
    sudo pacman-mirrors -g && sudo pacman -Syy

    sudo rm -r /etc/pacman.d/gnupg &>/dev/null

    # manually download and install these packages: gnupg, archlinux-keyring, manjaro-keyring
    arch=$(uname -m)
    version="$(lang=C pacman -Si gnupg | awk -F':' ' /^Ver/ {print $2}' | sed 's# #-#' | head -n 1 )"
    url="http://mirror.netzspielplatz.de/manjaro/packages/stable/core/${arch}/gnupg${version}-${arch}.pkg.tar.xz"
    wget "${url}" && sudo pacman -U "gnupg${version}-${arch}.pkg.tar.xz" --noconfirm && sudo rm "gnupg${version}-${arch}.pkg.tar.xz"

    version="$(lang=C pacman -Si archlinux-keyring | awk -F':' ' /^Ver/ {print $2}' | sed 's# #-#' | head -n 1 )"
    url="http://mirror.netzspielplatz.de/manjaro/packages/stable/core/${arch}/archlinux-keyring${version}-any.pkg.tar.xz"
    wget "${url}" && sudo pacman -U "archlinux-keyring${version}-any.pkg.tar.xz" --noconfirm && sudo rm "archlinux-keyring${version}-any.pkg.tar.xz"

    version="$(lang=C pacman -Si manjaro-keyring | awk -F':' ' /^Ver/ {print $2}' | sed 's# #-#' | head -n 1 )"
    url="http://mirror.netzspielplatz.de/manjaro/packages/stable/core/${arch}/manjaro-keyring${version}-any.pkg.tar.xz"
    wget "${url}" && sudo pacman -U "manjaro-keyring${version}-any.pkg.tar.xz" --noconfirm && sudo rm "manjaro-keyring${version}-any.pkg.tar.xz"
 
    # the following command sometimes prevents an error connecting to the key server
    sudo dirmngr </dev/null
    sudo pacman-key --init && sudo pacman-key --populate archlinux manjaro

    sudo pacman -Sc --noconfirm
    sudo pacman -Syyuu --color always --noconfirm

    print_prompt "$(gettext 'Most common Pacman errors fixed and system updated')." "" 1
}

I did a little test in my code for this function is compatible archlinux, it was just a test, but even with that pacli is no longer compatible arch and I do not think you wish .

The new code affects only the display and pacman functions are written in the same way; pacman code (Heart pacli) is the same. But yes, it's more complicated to manage pacaur and yaourt.

ps: we already have a jvm fork, 3 versions is not possible!
« Last Edit: 02. May 2016, 12:51:01 by papajoke »

Offline excalibur1234

  • Global Moderator
  • *****
  • Posts: 2508
  • Branch: unstable
  • Desktop: net-minimal + LXQt
  • GPU driver: video-nouveau
  • Kernel: 4.6
  • Skill: Intermediate
Re: Pacli, shell script for pacman and yourt
« Reply #211 on: 02. May 2016, 18:37:37 »
the code you posted is not compatible to arch linux. i recommend to just take the new parts and add them to pacli's code:
Code: [Select]
sudo rm -r /etc/pacman.d/gnupg &>/dev/null
sudo pacman -U "gnupg${version}-${arch}.pkg.tar.xz" [b]--noconfirm[/b]  (also for the other 2 commands)
sudo dirmngr </dev/null
sudo pacman -Sc --noconfirm
i have just seen that some of the "fix error" code in pacli is actually quite good. i will probably take some parts of it.


this "fix error" code is still relatively simple to understand. after all, i have written parts of it. but when i talked about hard to understand code i meant e.g. your "package_information" function. even after an hour i was not able to understand it.


there are general reasons (for me) to fork pacli:
- i prefer the KISS principle.
- all code in one bash file means: no installation required. i do not have to wait for an updated package i can simply download that file and run it and everything works.
- all easy to read code in one file means: easier maintenance in the long term.
- easy to read code means: people can fork it and adapt it to their needs easier. more people look at the code.
- i do not need all features (translation support, paclirc, pacaur) of the latest pacli. instead, i want an easy interface. this means less of a hindrance for new users.


me forking pacli does not mean i will never contribute anything to pacli again. when i can contribute something, i will do it. i will just maintain pacli-simple, too. if you do not port the above mentioned changes to pacli, i will try to do it.
Need more information? Search here:   Manjaro Forum   |   Manjaro Wiki   |   Arch Wiki

Offline excalibur1234

  • Global Moderator
  • *****
  • Posts: 2508
  • Branch: unstable
  • Desktop: net-minimal + LXQt
  • GPU driver: video-nouveau
  • Kernel: 4.6
  • Skill: Intermediate
Re: Pacli, shell script for pacman and yourt
« Reply #212 on: 02. May 2016, 21:22:23 »
i just made the changes in "fix errors" option.


some suggestion Chrysostomus can think about:
my current "install package" option looks like this, please note the marked parts:
Code: [Select]
sudo pacman -S $(package-query -Sl -f "%n  [b]%v [/b] -  %d" | [b]sort [/b]| fzf -e -m [b]+s[/b] --reverse --prompt='Select packages to install (use TAB to toggle selection) > ' | awk '{print $1}') --color always
- the %v displays the version number of all package. this enables users to search for a version number, too. i like it this way. how about you?
- the sort sorts the entire list alphabetically. this makes the whole command a little slower.
- the +s flag prevents fzf from sorting the search results. together with sort this displays the search results alphabetically. i like this more than the current search result layout (sorted by string length). what do you think about it?
Need more information? Search here:   Manjaro Forum   |   Manjaro Wiki   |   Arch Wiki

Offline Chrysostomus

  • Maintainer
  • ***
  • Posts: 1634
  • Neckbeards are cool
    • Git
  • Branch: unstable
  • Desktop: Gnome, bspwm
  • GPU Card: Intel HD4000
  • GPU driver: free
  • Kernel: linux44-x64
  • Skill: Intermediate
Re: Pacli, shell script for pacman and yourt
« Reply #213 on: 05. May 2016, 09:14:39 »
I think alphabetical sorting is good. Not sure about version numbers, could you elaborate use case? Are there many packages with several versions in the repos?

I think we should rethink having descriptions in the search. It is a bit of a double edged sword. On the other hand it is great, but it also makes searching for packages with common or short names really difficult. Try installing vi or firefox and you'll see what I mean.

Offline excalibur1234

  • Global Moderator
  • *****
  • Posts: 2508
  • Branch: unstable
  • Desktop: net-minimal + LXQt
  • GPU driver: video-nouveau
  • Kernel: 4.6
  • Skill: Intermediate
Re: Pacli, shell script for pacman and yourt
« Reply #214 on: 05. May 2016, 12:51:31 »
i can remember a time when i searched for the latest firefox version in the repos. but pacli did not show version numbers and therefore i had to work around the problem using yaourt -Sii manually.

i agree that having descriptions can be good and bad. you could enter multiple search terms e.g. "vi text" to find the text editor vi.
do it as you like it!


recently, i have added even more options to fzf. example:
Code: [Select]
fzf -m -e +s -i -0 --cycle --reverse --margin=4%,1%,1%,2% --inline-info --header="Use TAB to toggle Selection. Cancel list selection with CTRL+C or ESC" --prompt='Search and select packages to install > '

-i makes the search term case insensitive
-0 exits fzf when no search results are displayed and you press enter
--cycle makes it possible to press UpArrow key and jump to the end of the search result list
--margin makes fzf look a litte nicer
--inline-info displays the no. of search results in the same line as the search term
--header displays an extra line at the top. this was already done manually by papajoker

use all or just some of these flags, if you like them.
Need more information? Search here:   Manjaro Forum   |   Manjaro Wiki   |   Arch Wiki

Offline excalibur1234

  • Global Moderator
  • *****
  • Posts: 2508
  • Branch: unstable
  • Desktop: net-minimal + LXQt
  • GPU driver: video-nouveau
  • Kernel: 4.6
  • Skill: Intermediate
Re: Pacli, shell script for pacman and yourt
« Reply #215 on: 05. May 2016, 12:53:47 »
how should we proceed in the future?

i have just modified option "pacman log" and "list local package files" in pacli-simple. should i just add them to pacli or should i create a pull request and you can decide what you like and modify it to fit better to pacli?
Need more information? Search here:   Manjaro Forum   |   Manjaro Wiki   |   Arch Wiki

Offline papajoke

  • Vollwertiges Mitglied
  • ***
  • Posts: 135
  • from www.manjaro.fr
  • Branch: stable/testing
  • Desktop: KDE4 and 5 - zsh
  • GPU driver: video-nouveau free
  • Kernel: x64
  • Skill: Intermediate
Re: Pacli, shell script for pacman and yourt
« Reply #216 on: 05. May 2016, 16:41:19 »
for me, you add to pacli (no pull request)

+1 for pacman logs (and you can remove Pacman history : 120 )

Offline excalibur1234

  • Global Moderator
  • *****
  • Posts: 2508
  • Branch: unstable
  • Desktop: net-minimal + LXQt
  • GPU driver: video-nouveau
  • Kernel: 4.6
  • Skill: Intermediate
Re: Pacli, shell script for pacman and yourt
« Reply #217 on: 07. May 2016, 15:59:40 »
ok, i just updated all of pacli's options, which i could. i created new issues for the rest.


if you guys need new ideas, i have changed the UI of pacli-simple a bit. now, options/commands can also be run by entering the marked letters or words.

additionally, i changed the code to make it possible to run pacli's options directly in your terminal without the need of a UI. when i wanted to remove a package before that change i need to do this:
Code: [Select]
$ pacli
ENTER
$ 4
ENTER
...
$ 0
ENTER
now, i can do the same with this command (note that "r" is the marked letter in the "Remove Package + Deps" option of pacli):
Code: [Select]
$ pacli r
ENTER
...
i like this feature a lot!
Need more information? Search here:   Manjaro Forum   |   Manjaro Wiki   |   Arch Wiki