mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-25 09:58:41 +01:00
Added for package type
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
968e05a14a
commit
40ccfeb279
7 changed files with 13 additions and 3 deletions
|
@ -5,6 +5,7 @@
|
||||||
- Added:
|
- Added:
|
||||||
* Added PACKAGE_METHOD config to choose the upgrade method
|
* Added PACKAGE_METHOD config to choose the upgrade method
|
||||||
* Added DOWNGRADE_PACKAGES config to allow to downgrade packages (Thanks to marav)
|
* Added DOWNGRADE_PACKAGES config to allow to downgrade packages (Thanks to marav)
|
||||||
|
* Added PACKAGE_TYPE config if you prefer to add your own binary type
|
||||||
|
|
||||||
- Updated:
|
- Updated:
|
||||||
* Updated message for invalid package version
|
* Updated message for invalid package version
|
||||||
|
|
|
@ -15,6 +15,9 @@ DOWNLOAD_ONLY_PATH = "/tmp/slpkg/"
|
||||||
# Change here if you are going to use '.sqf' files.
|
# Change here if you are going to use '.sqf' files.
|
||||||
FILE_LIST_SUFFIX = ".pkgs"
|
FILE_LIST_SUFFIX = ".pkgs"
|
||||||
|
|
||||||
|
# List of suffixes for binary packages.
|
||||||
|
PACKAGE_TYPE = [".tgz", ".txz"]
|
||||||
|
|
||||||
# Configs for displaying colorful menu. Default is true. [true/false]
|
# Configs for displaying colorful menu. Default is true. [true/false]
|
||||||
COLORS = true
|
COLORS = true
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ class Configs: # pylint: disable=[R0902]
|
||||||
|
|
||||||
os_arch: str = platform.machine()
|
os_arch: str = platform.machine()
|
||||||
file_list_suffix: str = '.pkgs'
|
file_list_suffix: str = '.pkgs'
|
||||||
|
package_type = [".tgz", ".txz"]
|
||||||
installpkg: str = 'upgradepkg --install-new'
|
installpkg: str = 'upgradepkg --install-new'
|
||||||
reinstall: str = 'upgradepkg --reinstall'
|
reinstall: str = 'upgradepkg --reinstall'
|
||||||
removepkg: str = 'removepkg'
|
removepkg: str = 'removepkg'
|
||||||
|
@ -86,6 +87,7 @@ class Configs: # pylint: disable=[R0902]
|
||||||
|
|
||||||
os_arch: str = config['os_arch']
|
os_arch: str = config['os_arch']
|
||||||
file_list_suffix: str = config['file_list_suffix']
|
file_list_suffix: str = config['file_list_suffix']
|
||||||
|
package_type = config['package_type']
|
||||||
installpkg: str = config['installpkg']
|
installpkg: str = config['installpkg']
|
||||||
reinstall: str = config['reinstall']
|
reinstall: str = config['reinstall']
|
||||||
removepkg: str = config['removepkg']
|
removepkg: str = config['removepkg']
|
||||||
|
|
|
@ -150,5 +150,8 @@ class FormConfigs(Configs):
|
||||||
'CHECKSUM_MD5 =')
|
'CHECKSUM_MD5 =')
|
||||||
):
|
):
|
||||||
line: str = line.replace('"', '')
|
line: str = line.replace('"', '')
|
||||||
|
elif line.lstrip().startswith('PACKAGE_TYPE ='):
|
||||||
|
line: str = line.replace('"[', '[')
|
||||||
|
line: str = line.replace(']"', ']')
|
||||||
|
line: str = line.replace("'", '"')
|
||||||
patch_toml.write(line)
|
patch_toml.write(line)
|
||||||
|
|
|
@ -175,7 +175,7 @@ class InstallData(Configs):
|
||||||
|
|
||||||
for line in checksums_md5:
|
for line in checksums_md5:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line.endswith(('.txz', '.tgz')):
|
if line.endswith(tuple(self.package_type)):
|
||||||
file: str = line.split('./')[1].split('/')[-1].strip()
|
file: str = line.split('./')[1].split('/')[-1].strip()
|
||||||
checksum: str = line.split('./')[0].strip()
|
checksum: str = line.split('./')[0].strip()
|
||||||
checksums_dict[file] = checksum
|
checksums_dict[file] = checksum
|
||||||
|
|
|
@ -53,7 +53,7 @@ class MultiProcess(Configs): # pylint: disable=[R0902]
|
||||||
failed: str = f'{self.bred}{self.ascii.failed}{self.endc}'
|
failed: str = f'{self.bred}{self.ascii.failed}{self.endc}'
|
||||||
installed: str = ''
|
installed: str = ''
|
||||||
|
|
||||||
if filename.endswith(('.tgz', 'txz')) and not self.option_for_reinstall:
|
if filename.endswith(tuple(self.package_type)) and not self.option_for_reinstall:
|
||||||
installed_package = self.log_packages.glob(filename[:-4])
|
installed_package = self.log_packages.glob(filename[:-4])
|
||||||
for inst in installed_package:
|
for inst in installed_package:
|
||||||
if inst.name == filename[:-4]:
|
if inst.name == filename[:-4]:
|
||||||
|
|
|
@ -28,6 +28,7 @@ class TestConfigs(unittest.TestCase):
|
||||||
self.assertEqual(Path('/var/log/slpkg/upgrade.log'), self.configs.upgrade_log_file)
|
self.assertEqual(Path('/var/log/slpkg/upgrade.log'), self.configs.upgrade_log_file)
|
||||||
|
|
||||||
self.assertEqual('.pkgs', self.configs.file_list_suffix)
|
self.assertEqual('.pkgs', self.configs.file_list_suffix)
|
||||||
|
self.assertEqual(['.tgz', '.txz'], self.configs.package_type)
|
||||||
self.assertEqual('upgradepkg --install-new', self.configs.installpkg)
|
self.assertEqual('upgradepkg --install-new', self.configs.installpkg)
|
||||||
self.assertEqual('upgradepkg --reinstall', self.configs.reinstall)
|
self.assertEqual('upgradepkg --reinstall', self.configs.reinstall)
|
||||||
self.assertEqual('removepkg', self.configs.removepkg)
|
self.assertEqual('removepkg', self.configs.removepkg)
|
||||||
|
|
Loading…
Reference in a new issue