Skip to content

Commit

Permalink
Allow any real release to override beta
Browse files Browse the repository at this point in the history
  • Loading branch information
pkegg committed Jul 14, 2021
1 parent d13ab4b commit df0e825
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions packages/351elec/sources/scripts/get-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def main():

if args.force_update:
message_stream(f"\nForcing update to {current_release}...")
elif args.existing_release and args.existing_release >= current_release:
elif not download_needed(args.existing_release, current_release):
message_stream(
f"\nExisting release ({args.existing_release}) >= current release ({current_release}). No download needed\n")
message_stream_close()
Expand Down Expand Up @@ -105,6 +105,19 @@ def main():
message_stream(
f"\nFile: {os.path.basename(downloaded_file)} downloaded successfully.\n")

def download_needed(existing_release, current_release):

if not existing_release:
return True

# If the current release is a real release and existing device release is not, still download.
# This allows 'downgrading' from beta back to any release
if parse_release(current_release, "release") and not parse_release(existing_release, "release"):
return True

if existing_release < current_release:
return True
return False

# Create any needed directories
def initialize_directories(update_dir, check):
Expand Down Expand Up @@ -385,10 +398,11 @@ def get_args():

if args.band == "daily":
args.band = "release"
if not args.device and os.path.isfile(DEVICE_FILE):
args.device = load_file_to_string(DEVICE_FILE).strip()
else:
args.device="RG351P"
if not args.device:
if os.path.isfile(DEVICE_FILE):
args.device = load_file_to_string(DEVICE_FILE).strip()
else:
args.device="RG351P"

if not args.existing_release:
args.existing_release = get_existing_release()
Expand Down

0 comments on commit df0e825

Please sign in to comment.