mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-07 08:46:21 +01:00
Added --jobs option
This commit is contained in:
parent
d3cd9b8b01
commit
729f695b5c
5 changed files with 38 additions and 14 deletions
|
@ -41,7 +41,7 @@ Usage
|
||||||
|
|
||||||
$ slpkg --help
|
$ slpkg --help
|
||||||
|
|
||||||
Usage: slpkg [OPTIONS] [packages]
|
Usage: slpkg [OPTIONS] <packages>
|
||||||
|
|
||||||
Packaging tool that interacts with the SBo repository.
|
Packaging tool that interacts with the SBo repository.
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ Usage
|
||||||
clean-logs Purge logs of dependencies.
|
clean-logs Purge logs of dependencies.
|
||||||
|
|
||||||
--yes Answer Yes to all questions.
|
--yes Answer Yes to all questions.
|
||||||
|
--jobs Set it for multicore systems.
|
||||||
--resolve-off Turns off dependency resolving.
|
--resolve-off Turns off dependency resolving.
|
||||||
--reinstall Use this option if you want to upgrade.
|
--reinstall Use this option if you want to upgrade.
|
||||||
|
|
||||||
|
|
28
man/slpkg.1
28
man/slpkg.1
|
@ -1,7 +1,7 @@
|
||||||
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.1.0" dslackw
|
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.1.0" dslackw
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.P
|
.P
|
||||||
slpkg - [OPTIONS] [packages]
|
slpkg - [OPTIONS] <packages>
|
||||||
.SH SYNAPSES
|
.SH SYNAPSES
|
||||||
.P
|
.P
|
||||||
slpkg [-h|-v] [update] [build] [install] [remove] [search] [clean-logs] --yes --resolve-off --reinstall
|
slpkg [-h|-v] [update] [build] [install] [remove] [search] [clean-logs] --yes --resolve-off --reinstall
|
||||||
|
@ -12,16 +12,6 @@ Slpkg is a software package manager that installs, updates, and removes packages
|
||||||
Slpkg works in accordance with the standards of the organization SlackBuilds.org to build packages. Also uses the Slackware Linux instructions for installation, upgrading or removing packages.
|
Slpkg works in accordance with the standards of the organization SlackBuilds.org to build packages. Also uses the Slackware Linux instructions for installation, upgrading or removing packages.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.P
|
.P
|
||||||
-h | --help
|
|
||||||
.RS
|
|
||||||
Show help informatio and exit.
|
|
||||||
.RE
|
|
||||||
.P
|
|
||||||
-v | --version
|
|
||||||
.RS
|
|
||||||
Print version and exit.
|
|
||||||
.RE
|
|
||||||
.P
|
|
||||||
update
|
update
|
||||||
.RS
|
.RS
|
||||||
Updates the package list and the database.
|
Updates the package list and the database.
|
||||||
|
@ -57,6 +47,12 @@ Purge logs of dependencies.
|
||||||
Answer Yes to all questions.
|
Answer Yes to all questions.
|
||||||
.RE
|
.RE
|
||||||
.P
|
.P
|
||||||
|
--jobs
|
||||||
|
.RS
|
||||||
|
Acceleration of SlackBuild scripts. When the --jobs 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.
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
--resolve-off
|
--resolve-off
|
||||||
.RS
|
.RS
|
||||||
Turns off dependency resolving.
|
Turns off dependency resolving.
|
||||||
|
@ -66,6 +62,16 @@ Turns off dependency resolving.
|
||||||
.RS
|
.RS
|
||||||
Use this option if you want to upgrade all packages even if the same version is already installed. Do not skip installed packages.
|
Use this option if you want to upgrade all packages even if the same version is already installed. Do not skip installed packages.
|
||||||
.RE
|
.RE
|
||||||
|
.P
|
||||||
|
-h | --help
|
||||||
|
.RS
|
||||||
|
Show help informatio and exit.
|
||||||
|
.RE
|
||||||
|
.P
|
||||||
|
-v | --version
|
||||||
|
.RS
|
||||||
|
Print version and exit.
|
||||||
|
.RE
|
||||||
.SH CONFIGURATION FILES
|
.SH CONFIGURATION FILES
|
||||||
.P
|
.P
|
||||||
Configuration file in the /etc/slpkg/slpkg.json file.
|
Configuration file in the /etc/slpkg/slpkg.json file.
|
||||||
|
|
|
@ -8,7 +8,7 @@ from dataclasses import dataclass
|
||||||
from slpkg.checks import Check
|
from slpkg.checks import Check
|
||||||
from slpkg.search import Search
|
from slpkg.search import Search
|
||||||
from slpkg.version import Version
|
from slpkg.version import Version
|
||||||
from slpkg.cli_menu import usage
|
from slpkg.views.cli_menu import usage
|
||||||
from slpkg.slackbuild import Slackbuilds
|
from slpkg.slackbuild import Slackbuilds
|
||||||
from slpkg.remove_packages import RemovePackages
|
from slpkg.remove_packages import RemovePackages
|
||||||
from slpkg.clean_logs import CleanLogsDependencies
|
from slpkg.clean_logs import CleanLogsDependencies
|
||||||
|
@ -22,6 +22,7 @@ class Argparse:
|
||||||
def flags(self):
|
def flags(self):
|
||||||
self.flags = []
|
self.flags = []
|
||||||
yes = '--yes'
|
yes = '--yes'
|
||||||
|
jobs = '--jobs'
|
||||||
resolve_off = '--resolve-off'
|
resolve_off = '--resolve-off'
|
||||||
reinstall = '--reinstall'
|
reinstall = '--reinstall'
|
||||||
|
|
||||||
|
@ -29,6 +30,10 @@ class Argparse:
|
||||||
self.args.remove(yes)
|
self.args.remove(yes)
|
||||||
self.flags.append(yes)
|
self.flags.append(yes)
|
||||||
|
|
||||||
|
if jobs in self.args:
|
||||||
|
self.args.remove(jobs)
|
||||||
|
self.flags.append(jobs)
|
||||||
|
|
||||||
if resolve_off in self.args:
|
if resolve_off in self.args:
|
||||||
self.args.remove(resolve_off)
|
self.args.remove(resolve_off)
|
||||||
self.flags.append(resolve_off)
|
self.flags.append(resolve_off)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
@ -159,10 +160,20 @@ class Slackbuilds:
|
||||||
folder = f'{path}/{name}/'
|
folder = f'{path}/{name}/'
|
||||||
slackbuild = f'./{name}.SlackBuild'
|
slackbuild = f'./{name}.SlackBuild'
|
||||||
execute = folder + slackbuild
|
execute = folder + slackbuild
|
||||||
|
|
||||||
|
if '--jobs' in self.flags:
|
||||||
|
self.makeflags()
|
||||||
|
|
||||||
stdout = subprocess.call(execute)
|
stdout = subprocess.call(execute)
|
||||||
if stdout > 0:
|
if stdout > 0:
|
||||||
raise SystemExit(stdout)
|
raise SystemExit(stdout)
|
||||||
|
|
||||||
|
def makeflags(self):
|
||||||
|
''' Set number of processors. '''
|
||||||
|
cpus = multiprocessing.cpu_count()
|
||||||
|
os.environ['MAKEFLAGS'] = f'-j {cpus}'
|
||||||
|
print(os.environ['MAKEFLAGS'])
|
||||||
|
|
||||||
def download_sources(self, name: str, sources: str):
|
def download_sources(self, name: str, sources: str):
|
||||||
''' Download the sources. '''
|
''' Download the sources. '''
|
||||||
wget = Wget()
|
wget = Wget()
|
||||||
|
|
|
@ -16,6 +16,7 @@ def usage(status: int):
|
||||||
' search Search packages by name.',
|
' search Search packages by name.',
|
||||||
' clean-logs Purge logs of dependencies.\n',
|
' clean-logs Purge logs of dependencies.\n',
|
||||||
' --yes Answer Yes to all questions.',
|
' --yes Answer Yes to all questions.',
|
||||||
|
' --jobs Set it for multicore systems.',
|
||||||
' --resolve-off Turns off dependency resolving.',
|
' --resolve-off Turns off dependency resolving.',
|
||||||
' --reinstall Use this option if you want to upgrade.\n',
|
' --reinstall Use this option if you want to upgrade.\n',
|
||||||
' -h, --help Show this message and exit.',
|
' -h, --help Show this message and exit.',
|
Loading…
Add table
Reference in a new issue