<commit_before>%
%  08-pacman.pl
%  marelle-deps
%

% installs_with_pacman(Pkg).
%   Pkg installs with apt package of same name on all Ubuntu/Debian flavours
:- multifile installs_with_pacman/1.

% installs_with_pacman(Pkg, PacName).
%   Pkg installs with apt package called AptName on all Ubuntu/Debian
%   flavours. PacName can also be a list of packages.
:- multifile installs_with_pacman/2.

installs_with_pacman(P, P) :- installs_with_pacman(P).

:- dynamic pacman_updated/0.

pkg('pacman-update').
met('pacman-update', linux(arch)) :- pacman_updated.
meet('pacman-update', linux(arch)) :-
    bash('sudo pacman -Syu'),
    assertz(apt_updated).

% attempt to install a package with pacman
install_pacman(Pkg) :-
    bash(['sudo pacman -S --noconfirm ', Pkg]).

% succeed only if the package is already installed
check_pacman(Pkg) :-
    bash(['pacman -Qs ', Pkg]).

met(P, linux(arch)) :-
    installs_with_pacman(P, PkgName), !,
    check_pacman(PkgName).

meet(P, linux(arch)) :-
    installs_with_pacman(P, PkgName), !,
    install_pacman(PkgName).<commit_msg>Fix the pacman update once mechanism.<commit_after>%
%  08-pacman.pl
%  marelle-deps
%

% installs_with_pacman(Pkg).
%   Pkg installs with apt package of same name on all Ubuntu/Debian flavours
:- multifile installs_with_pacman/1.

% installs_with_pacman(Pkg, PacName).
%   Pkg installs with apt package called AptName on all Ubuntu/Debian
%   flavours. PacName can also be a list of packages.
:- multifile installs_with_pacman/2.

installs_with_pacman(P, P) :- installs_with_pacman(P).

:- dynamic pacman_updated/0.

pkg('pacman-update').
met('pacman-update', linux(arch)) :- pacman_updated.
meet('pacman-update', linux(arch)) :-
    bash('sudo pacman -Syu'),
    assertz(pacman_updated).

depends(P, linux(arch), ['pacman-update']) :-
    installs_with_pacman(P, _).

% attempt to install a package with pacman
install_pacman(Pkg) :-
    bash(['sudo pacman -S --noconfirm ', Pkg]).

% succeed only if the package is already installed
check_pacman(Pkg) :-
    bash(['pacman -Qs ', Pkg]).

met(P, linux(arch)) :-
    installs_with_pacman(P, PkgName), !,
    check_pacman(PkgName).

meet(P, linux(arch)) :-
    installs_with_pacman(P, PkgName), !,
    install_pacman(PkgName).
{'fraction_non_alphanumeric': 0.13636363636363635, 'fraction_numerical': 0.004456327985739751, 'mean_word_length': 4.233100233100233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '445619', 'n_tokens_mistral': 921, 'n_tokens_neox': 825, 'n_words': 190}