Skip to content

Commit

Permalink
Redid logic in install/uninstall scenes, fixed installer error on Amb…
Browse files Browse the repository at this point in the history
…erELEC, fixed a few bugs.
  • Loading branch information
kloptops authored Oct 25, 2023
2 parents c814c8e + 30345e4 commit 712598e
Show file tree
Hide file tree
Showing 10 changed files with 853 additions and 101 deletions.
5 changes: 4 additions & 1 deletion PortMaster/PortMaster.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash
#
# SPDX-License-Identifier: MIT
#

if [ -d "/opt/system/Tools/PortMaster/" ]; then
controlfolder="/opt/system/Tools/PortMaster"
Expand All @@ -18,7 +21,6 @@ get_controls
## TODO: Change to PortMaster/tty when Johnnyonflame merges the changes in,
CUR_TTY=/dev/tty0


cd "$controlfolder"

export TERM=linux
Expand Down Expand Up @@ -63,6 +65,7 @@ if [ -n "$AUTOINSTALL" ]; then

# Install the latest runtimes.zip
if [ -f "${toolsfolderloc}/PortMaster/autoinstall/runtimes.zip" ]; then
PortMasterDialog "message" "- Installing runtimes.zip, this could take a minute or two."
$ESUDO unzip -o "${toolsfolderloc}/PortMaster/autoinstall/runtimes.zip" -d "${toolsfolderloc}/PortMaster/libs"
$ESUDO rm -f "${toolsfolderloc}/PortMaster/autoinstall/runtimes.zip"
PortMasterDialog "message" "- SUCCESS: runtimes.zip"
Expand Down
6 changes: 3 additions & 3 deletions PortMaster/pugwash
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

## -- BEGIN PORTMASTER INFO --
PORTMASTER_VERSION = '8.4.20'
PORTMASTER_VERSION = '8.4.21'
PORTMASTER_RELEASE_CHANNEL = 'beta'
## -- END PORTMASTER INFO --

Expand Down Expand Up @@ -943,8 +943,8 @@ class PortMasterGUI(pySDL2gui.GUI, harbourmaster.Callback):

def delete_port_size(self, port_name):
# Delete info about a port
if port_name not in self.port_size_files:
for port_file, port_info in port_self.port_size_files[port_name]:
if port_name in self.port_size_files:
for port_file, port_info in self.port_size_files[port_name]:
if port_name in self.port_size_file_lookup[port_file]:
self.port_size_file_lookup[port_file].remove(port_name)

Expand Down
25 changes: 16 additions & 9 deletions PortMaster/pylibs/default_theme/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@
"port_general_info": {
"parent": "port_info_text_area",
"area": [ 5, 5, -5, -5 ],
"area[4:3]": [ 5, 60, -5, -5 ],
"area[4:3]": [ 5, 90, -5, -5 ],
"area[1:1]": [ 5,88, -5, -5 ],
"area[16:9]": [ 5, 80, -5, -5 ],
"area[427:240]": [ 5, 80, -5, -5 ],
"area[30:17]": [ 5, 80, -5, -5 ],
Expand All @@ -317,6 +318,7 @@
"parent": "port_info_text_area",
"area": [ 5, 65, -5, -45 ],
"area[4:3]": [ 5, 118, -5, -50 ],
"area[1:1]": [ 5, 145, -5, -50 ],
"area[3:2]": [ 5, 65, -5, -25 ],
"area[16:9]": [ 5, 165, -5, -100 ],
"area[1920x1152]": [ 0.05, 0.2, 0.8, 0.7 ],
Expand Down Expand Up @@ -429,7 +431,7 @@
"music": null
},
"option_title": {
"area": [ 0.01, 0.05, 1.0, 0.10 ],
"area": [ 0.01, 0.05, 1.0, 0.14 ],
"text": "{scene.title}",
"font-size": 20,
"font-color": "general_font"
Expand All @@ -439,6 +441,7 @@
"options": [],
"align": "midleft",
"area": [ 0.0, 0.10, 0.5, 0.85 ],
"area[16:9]": [ 0.0, 0.15, 0.5, 0.85 ],
"text-clip": true,
"font-size": 25,
"no-select-color": "list_unselectable",
Expand Down Expand Up @@ -475,16 +478,11 @@
},
"themes_list": {
"#element:background": {},

"port_info": {
"parent": "port_info_area",
"area": [ 0.0, 0.0, 1.0, 1.0 ],
"fill": "panels",
"thickness": 10,
"border": 8,
"text": "",
"font-size": 24,
"font-color": "general_font",
"text-wrap": true
"fill": "panels"
},
"themes_list": {
"parent": "port_info_list_area",
Expand All @@ -511,6 +509,7 @@
"parent": "port_info_text_area",
"area": [ 5, 5, -5, -5 ],
"area[4:3]": [ 5, 60, -5, -5 ],
"area[1:1]": [ 5, 88, -5, -5 ],
"area[16:9]": [ 5, 80, -5, -5 ],
"area[427:240]": [ 5, 80, -5, -5 ],
"area[30:17]": [ 5, 80, -5, -5 ],
Expand All @@ -526,6 +525,7 @@
"parent": "port_info_text_area",
"area": [ 5, 65, -5, -45 ],
"area[4:3]": [ 5, 118, -5, -50 ],
"area[1:1]": [ 5, 145, -5, -5 ],
"area[3:2]": [ 5, 65, -5, -25 ],
"area[16:9]": [ 5, 165, -5, -100 ],
"area[1920x1152]": [ 0.05, 0.2, 0.8, 0.7 ],
Expand Down Expand Up @@ -728,6 +728,13 @@
"featured_ports": {
"#element:background": {},

"port_info": {
"parent": "port_info_area",
"area": [ 0.0, 0.0, 1.0, 1.0 ],
"fill": "panels"
},


"ports_list": {
"parent": "port_info_list_area_featured",
"area": [ 0.0, 0.3, 0.95, 0.6 ],
Expand Down
15 changes: 2 additions & 13 deletions PortMaster/pylibs/harbourmaster/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,11 @@
"020_portmaster.source.json": textwrap.dedent("""
{
"prefix": "pm",
"api": "PortMasterV1",
"api": "PortMasterV2",
"name": "PortMaster",
"url": "https://api.github.com/repos/PortsMaster/PortMaster-Releases/releases/latest",
"last_checked": null,
"version": 1,
"data": {}
}
"""),
"021_runtimes.source.json": textwrap.dedent("""
{
"prefix": "pr",
"api": "GitHubRawReleaseV1",
"name": "PortMaster Runtime",
"url": "https://api.github.com/repos/PortsMaster/PortMaster-Runtime/releases/latest",
"last_checked": null,
"version": 1,
"version": 4,
"data": {}
}
"""),
Expand Down
78 changes: 48 additions & 30 deletions PortMaster/pylibs/harbourmaster/harbour.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ def _load_port_info(self, port_file):
'status': 'Unknown',
}

if port_info.get('source', None) is not None:
changed = True
del port_info['source']

port_info['changed'] = changed

return port_info
Expand Down Expand Up @@ -692,6 +696,10 @@ def load_ports(self):
changed = port_info['changed']
del port_info['changed']

if 'source' in port_info:
del port_info['source']
changed = True

if changed:
if ports_files[port_name].parent.is_dir():
logger.debug(f"Dumping {str(ports_files[port_name])}: {port_info}")
Expand Down Expand Up @@ -734,7 +742,7 @@ def port_info_attrs(self, port_info):
if 'source' in port_info and 'status' in port_info:
source_md5 = port_info['source'].get('md5', None)
status_md5 = port_info['status'].get('md5', None)
if source_md5 is not None and status_md5 is None and source_md5 != status_md5:
if status_md5 is not None and source_md5 != status_md5:
add_list_unique(attrs, 'update available')

return attrs
Expand Down Expand Up @@ -774,58 +782,48 @@ def list_ports(self, filters=[], sort_by='alphabetical', reverse=False):
filters = list(filters)
filters.remove('not installed')

if 'installed' in filters:
for port_name, port_info in self.installed_ports.items():
if port_name.casefold() in tmp_ports:
if not not_installed and 'installed' in filters:
for port_name in self.installed_ports:
if name_cleaner(port_name) in tmp_ports:
continue

new_port_info = port_info_load(port_info)
port_info_merge(new_port_info, self.port_info(port_name))
new_port_info = self.port_info(port_name, installed=True)

if not self.match_filters(filters, new_port_info):
continue

tmp_ports[port_name.casefold()] = new_port_info
tmp_ports[name_cleaner(port_name)] = new_port_info

for port_name, port_info in self.broken_ports.items():
if port_name.casefold() in tmp_ports:
if name_cleaner(port_name) in tmp_ports:
continue

new_port_info = port_info_load(port_info)
port_info_merge(new_port_info, self.port_info(port_name))
new_port_info = self.port_info(port_name, installed=True)

if not self.match_filters(filters, new_port_info):
continue

tmp_ports[port_name.casefold()] = new_port_info
tmp_ports[name_cleaner(port_name)] = new_port_info

for source_prefix, source in self.sources.items():
for port_name in source.ports:
if not_installed and (
port_name.casefold() in self.installed_ports.keys() or
port_name.casefold() in self.broken_ports.keys()):
name_cleaner(port_name) in self.installed_ports.keys() or
name_cleaner(port_name) in self.broken_ports.keys()):
continue

if port_name.casefold() in tmp_ports:
if name_cleaner(port_name) in tmp_ports:
continue

port_info = source.port_info(port_name)

new_port_info = port_info_load(port_info)

if port_name in self.installed_ports:
port_info_merge(new_port_info, self.installed_ports[port_name])

elif port_name in self.broken_ports:
port_info_merge(new_port_info, self.broken_ports[port_name])
new_port_info = self.port_info(port_name, installed=False)

if not self.match_filters(filters, new_port_info):
continue

if not self.match_requirements(port_info):
if not self.match_requirements(new_port_info):
continue

tmp_ports[port_name.casefold()] = new_port_info
tmp_ports[name_cleaner(port_name)] = new_port_info

ports = {
port_name: port_info
Expand Down Expand Up @@ -933,18 +931,34 @@ def porters_list(self):
return list(self.porters().keys())

def port_info(self, port_name, installed=False):
result = None

if installed:
if port_name in self.installed_ports:
return self.installed_ports[name_cleaner(port_name)]
result = port_info_load(self.installed_ports[name_cleaner(port_name)])

if port_name in self.broken_ports:
return self.broken_ports[name_cleaner(port_name)]
elif port_name in self.broken_ports:
result = port_info_load(self.broken_ports[name_cleaner(port_name)])

for source_prefix, source in self.sources.items():
if source.clean_name(port_name) in source.ports:
return source.port_info(port_name)
if result is not None:
port_info_merge(result, source.port_info(port_name))

return None
else:
result = port_info_load(source.port_info(port_name))

if result is None:
return None

if not installed:
if port_name in self.installed_ports:
port_info_merge(result, self.installed_ports[name_cleaner(port_name)])

elif port_name in self.broken_ports:
port_info_merge(result, self.broken_ports[name_cleaner(port_name)])

return result

def port_download_size(self, port_name, check_runtime=True):
for source_prefix, source in self.sources.items():
Expand Down Expand Up @@ -1138,6 +1152,10 @@ def _install_port(self, download_info):
port_info['status'] = download_info['status'].copy()
port_info['status']['status'] = 'Installed'

# This doesnt need to be stored.
if 'source' in port_info:
del port_info['source']

port_info['files'] = {
'port.json': str(port_info_file.relative_to(self.ports_dir)),
}
Expand Down
1 change: 1 addition & 0 deletions PortMaster/pylibs/harbourmaster/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class PlatformArkOS(PlatformGCD_PortMaster, PlatformBase):


class PlatformAmberELEC(PlatformGCD_PortMaster, PlatformBase):
MOVE_PM_BASH = True
ES_NAME = 'emustation'


Expand Down
Loading

0 comments on commit 712598e

Please sign in to comment.