Build legacy versions for both 64 and 32 bit windows platforms

This commit is contained in:
deajan 2025-04-08 14:52:32 +02:00
parent fbcf65e1bf
commit 26f3cda4d5
5 changed files with 34 additions and 11 deletions

View file

@ -8,8 +8,8 @@ These builds will be "legacy" builds, 64 bit builds are sufficient.
### Windows
We need Python 3.7 to compile on Windows 7 / Server 2008 R2
These builds will be "legacy" builds. We will need 32 and 64 bit legacy builds.
These builds will be "legacy" builds.
Also, last restic version to run on Windows 7 is 0.16.2, see https://github.com/restic/restic/issues/4636 (basically go1.21 is not windows 7 compatible anymore)
So we actually need to compile restic ourselves with go1.20.12
So we actually need to compile restic ourselves with go1.20.12 which is done via restic_legacy_build.cmd script

View file

@ -1 +1 @@
This folder should contain restic binaries directly downloaded from github.com/restic/restic for Linux / macOS and Windows
This folder should contain restic binaries directly downloaded from github.com/restic/restic for Linux / macOS and Windows and restic legacy builds

View file

@ -66,11 +66,8 @@ def download_restic_binaries(arch: str = "amd64") -> bool:
print(f"DOWNLOADING RESTIC {dest_file}")
# Also we need to move any earlier file that may not be current version to archives
for file in dest_dir.glob(f"restic_*{fname}{suffix}"):
# We need to keep legacy binary for Windows 7 32 bits
if (
not file.name == "restic_0.16.2_windows_386.exe"
and not file.name == "restic_0.16.2_windows_amd64.exe"
):
# We need to keep legacy binary for Windows 7 / Server 2008
if "legacy" in file.name:
try:
archive_file = dest_dir.joinpath("ARCHIVES").joinpath(file.name)
if archive_file.is_file():

View file

@ -3,7 +3,9 @@
:: This is an example compiler script
SET PYTHON64=c:\python313-64\python.exe
SET PYTHON32=c:\python37-32\python.exe
SET PYTHON64-LEGACY=c:\python37-64\python.exe
SET PYTHON32=c:\python313-32\python.exe
SET PYTHON32-LEGACY=c:\python37-32\python.exe
cd C:\GIT\npbackup
@ -15,6 +17,7 @@ SET PYTHONPATH=c:\GIT\npbackup
"%PYTHON64%" RESTIC_SOURCE_FILES/update_restic.py || GOTO ERROR
:: BUILD 64-BIT VERSION
"%PYTHON64%" -m pip install --upgrade pip || GOTO ERROR
"%PYTHON64%" -m pip install pytest
"%PYTHON64%" -m pip install --upgrade -r npbackup/requirements.txt || GOTO ERROR
@ -23,7 +26,16 @@ SET PYTHONPATH=c:\GIT\npbackup
"%PYTHON64%" bin\compile.py --sign "C:\ODJ\KEYS\NetInventEV.dat" %*
:: BUILD 64-BIT LEGACY VERSION
"%PYTHON64%" -m pip install --upgrade pip || GOTO ERROR
"%PYTHON64%" -m pip install pytest
"%PYTHON64%" -m pip install --upgrade -r npbackup/requirements.txt || GOTO ERROR
"%PYTHON64%" -m pytest C:\GIT\npbackup\tests || GOTO ERROR
"%PYTHON64%" bin\compile.py --sign "C:\ODJ\KEYS\NetInventEV.dat" %*
:: BUILD 32-BIT VERSION
"%PYTHON32%" -m pip install --upgrade pip || GOTO ERROR
"%PYTHON32%" -m pip install pytest
"%PYTHON32%" -m pip install --upgrade -r npbackup/requirements.txt || GOTO ERROR
@ -32,6 +44,16 @@ SET PYTHONPATH=c:\GIT\npbackup
"%PYTHON32%" bin\compile.py --sign "C:\ODJ\KEYS\NetInventEV.dat" %*
"%PYTHON64%" RESTIC_SOURCE_FILES/update_restic.py || GOTO ERROR
:: BUILD 32-BIT LEGACY VERSION
"%PYTHON64%" -m pip install --upgrade pip || GOTO ERROR
"%PYTHON64%" -m pip install pytest
"%PYTHON64%" -m pip install --upgrade -r npbackup/requirements.txt || GOTO ERROR
"%PYTHON64%" -m pytest C:\GIT\npbackup\tests || GOTO ERROR
"%PYTHON64%" bin\compile.py --sign "C:\ODJ\KEYS\NetInventEV.dat" %*
GOTO END
:ERROR

View file

@ -26,12 +26,16 @@ def get_restic_internal_binary(arch: str) -> str:
binary = None
if os.path.isdir(RESTIC_SOURCE_FILES_DIR):
if os.name == "nt":
if IS_LEGACY and arch == "x86":
if IS_LEGACY:
# Last compatible restic binary for Windows 7, see https://github.com/restic/restic/issues/5065
# We build a legacy version of restic for windows 7 and Server 2008R2
logger.info(
"Dealing with special case for Windows 7 32 bits that doesn't run with restic >= 0.16.2"
)
binary = "restic_0.16.2_windows_386.exe"
if arch == "x86":
binary = "restic_*_windows_legacy_386.exe"
else:
binary = "restic_*_windows_legacy_amd64.exe"
elif arch == "x86":
binary = "restic_*_windows_386.exe"
else: