Moved --jobs to MAKEFLAGS

This commit is contained in:
Dimitris Zlatanidis 2024-03-20 12:31:37 +02:00
parent 3c7bb05364
commit a3bc27e150
8 changed files with 12 additions and 34 deletions

View file

@ -14,9 +14,11 @@
* Remove rules.toml config file
* Remove --install-data option
* Remove FILE_PATTERN from configs
* Remove --jobs option
- Added:
* Check for upgrade packages using the option --check
* MAKEFLAGS config to specify the number of jobs
- Bugfixes:
* Double view message when update repositories

View file

@ -18,6 +18,9 @@ FILE_LIST_SUFFIX = ".pkgs"
# Configs for displaying colorful menu. Default is true. [true/false]
COLORS = true
# Specify the number of jobs to run concurrently. Default is '-j4'.
MAKEFLAGS = "-j4"
# Dialog is a program that will let you present a variety of questions or
# display messages using dialog boxes from a shell script.
# Default is true. [true/false]

View file

@ -9,7 +9,7 @@ slpkg \c
.P
slpkg [-h|-v] [-u, update] [-U, upgrade] [-c, check-updates] [-I, repo-info]
[-g, configs] [-T, clean-tmp] [-b, build] [-i, install] [-d, download]
[-R, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] -y, --yes, -j, --jobs, -O, --resolve-off,
[-R, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] -y, --yes, -O, --resolve-off,
-r, --reinstall, -k, --skip-installed, -E, --full-reverse, -S, --search, -n, --no-silent, -p, --pkg-version,
-P, --parallel, -o, --repository=\fINAME\fR, -z, --directory=\fIPATH\fR
.SH DESCRIPTION
@ -105,12 +105,6 @@ Répondre oui à toutes les questions. (à utiliser avec : -u, update, -U, upgra
-i, install, -R, remove, -d, download,)
.RE
.P
.B -j, --jobs
.RS
Accélération des scripts SlackBuild. Lorsque l'option \fB--jobs\fR est activée, slpkg détecte automatiquement le nombre de processeurs et l'entre dans la variable MAKEFLAGS.
Certains SlackBuilds échouent lorsque MAKEFLAGS est déclaré ou que le nombre de processeurs (-j) est supérieur à un. (à utiliser avec : -U, upgrade, -b, build, -i, install)
.RE
.P
.B -O, --resolve-off
.RS
Désactive la résolution des dépendances. (à utiliser avec : -U, upgrade, -b, build, -i, install)

View file

@ -9,7 +9,7 @@ slpkg \c
.P
slpkg [-h|-v] [-u, update] [-U, upgrade] [-I, repo-info]
[-g, configs] [-T, clean-tmp] [-b, build] [-i, install] [-d, download]
[-R, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] -y, --yes, -j, --jobs, -c, --check, -O, --resolve-off,
[-R, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] -y, --yes, -c, --check, -O, --resolve-off,
-r, --reinstall, -k, --skip-installed, -E, --full-reverse, -S, --search, -n, --silent, -p, --pkg-version,
-P, --parallel, -o, --repository=\fINAME\fR, -z, --directory=\fIPATH\fR
.SH DESCRIPTION
@ -101,13 +101,6 @@ Answer Yes to all questions. (to be used with: -u, update, -U, upgrade, -b, buil
-i, install, -R, remove, -d, download,)
.RE
.P
.B -j, --jobs
.RS
Acceleration of SlackBuild scripts. When the \fB--jobs\fR flag is set, slpkg automatically detects the number
of processors and enters it into the MAKEFLAGS variable. Some SlackBuilds fail when MAKEFLAGS is declared or
the number of processors (-j) is greater than one. (to be used with: -U, upgrade, -b, build, -i, install)
.RE
.P
.B -c, --check
.RS
Check a procedure before you run it. (to be used with: -u, update, -U, upgrade)

View file

@ -34,6 +34,7 @@ class Configs:
reinstall: str = 'upgradepkg --reinstall'
removepkg: str = 'removepkg'
colors: bool = True
makeflags: str = '-j4'
dialog: bool = True
downloader: str = 'wget'
wget_options: str = '--c -q --progress=bar:force:noscroll --show-progress'
@ -77,6 +78,7 @@ class Configs:
reinstall: str = config['REINSTALL']
removepkg: str = config['REMOVEPKG']
colors: bool = config['COLORS']
makeflags: str = config['MAKEFLAGS']
dialog: str = config['DIALOG']
downloader: str = config['DOWNLOADER']
wget_options: str = config['WGET_OPTIONS']

View file

@ -47,8 +47,6 @@ class Menu(Configs):
self.data: dict = {}
self.flag_yes: str = '--yes'
self.flag_short_yes: str = '-y'
self.flag_jobs: str = '--jobs'
self.flag_short_jobs: str = '-j'
self.flag_check: str = '-c'
self.flag_short_check: str = '--check'
self.flag_resolve_off: str = '--resolve-off'
@ -87,8 +85,6 @@ class Menu(Configs):
self.options: tuple = (
self.flag_yes,
self.flag_short_yes,
self.flag_jobs,
self.flag_short_jobs,
self.flag_check,
self.flag_short_check,
self.flag_resolve_off,
@ -132,8 +128,6 @@ class Menu(Configs):
'upgrade': [
self.flag_yes,
self.flag_short_yes,
self.flag_jobs,
self.flag_short_jobs,
self.flag_check,
self.flag_short_check,
self.flag_resolve_off,
@ -160,8 +154,6 @@ class Menu(Configs):
'build': [
self.flag_yes,
self.flag_short_yes,
self.flag_jobs,
self.flag_short_jobs,
self.flag_resolve_off,
self.flag_short_resolve_off,
self.flag_search,
@ -178,8 +170,6 @@ class Menu(Configs):
'install': [
self.flag_yes,
self.flag_short_yes,
self.flag_jobs,
self.flag_short_jobs,
self.flag_resolve_off,
self.flag_short_resolve_off,
self.flag_reinstall,

View file

@ -8,7 +8,6 @@ import shutil
from pathlib import Path
from collections import OrderedDict
from multiprocessing import cpu_count
from slpkg.checksum import Md5sum
from slpkg.configs import Configs
@ -57,9 +56,6 @@ class Slackbuilds(Configs):
self.option_for_skip_installed: bool = self.utils.is_option(
('-k', '--skip-installed'), flags)
self.option_for_jobs: bool = self.utils.is_option(
('-j', '--jobs'), flags)
self.slackbuilds: list = self.utils.apply_package_pattern(data, slackbuilds)
# Patch the TAG from configs if changed.
@ -254,8 +250,7 @@ class Slackbuilds(Configs):
self.slackware_command: str = self.reinstall
def set_makeflags(self) -> None:
if self.option_for_jobs:
os.environ['MAKEFLAGS'] = f'-j {cpu_count()}'
os.environ['MAKEFLAGS'] = f'-j {self.makeflags}'
def choose_package_dependencies(self) -> None:
if self.dependencies and self.dialog:

View file

@ -32,8 +32,8 @@ class Usage(Configs):
f' slpkg [{self.cyan}COMMAND{self.endc}] [-b, build, -i, install, -R, remove <packages>]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-d, download, -f, find, -w, view <packages>]\n'
f' slpkg [{self.cyan}COMMAND{self.endc}] [-s, search, -e, dependees, -t, tracking <packages>]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-y, --yes, -j, --jobs, -c, --check]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-O, --resolve-off, -r, --reinstall -k, --skip-installed]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-y, --yes, -c, --check, -O, --resolve-off]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-r, --reinstall -k, --skip-installed]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-E, --full-reverse, -S, --search, -n, --silent]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-p, --pkg-version, -P, --parallel, -m, --no-case]\n'
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-o, --repository=NAME, -z, --directory=PATH]\n'
@ -66,7 +66,6 @@ class Usage(Configs):
f' {self.cyan}-t, tracking{self.endc} <packages> Tracking the packages dependencies.\n'
f'\n{self.bold}OPTIONS:{self.endc}\n'
f' {self.yellow}-y, --yes{self.endc} Answer Yes to all questions.\n'
f' {self.yellow}-j, --jobs{self.endc} Set it for multicore systems.\n'
f' {self.yellow}-c, --check{self.endc} Check a procedure before you run it.\n'
f' {self.yellow}-O, --resolve-off{self.endc} Turns off dependency resolving.\n'
f' {self.yellow}-r, --reinstall{self.endc} Upgrade packages of the same version.\n'