Strange bug trying to automate executable packaging [solved]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
xX_pokeman2003_Xx
Prole
Posts: 7
Joined: Thu Oct 29, 2020 1:49 am

Strange bug trying to automate executable packaging [solved]

Post by xX_pokeman2003_Xx »

Not entirely sure what happened but I managed to get zip files working after not being able to last night. 7zip files do not work fused as they do not store a file structure at the end like zip does. Thank you to everyone who actually helped me(which was 3/4 of the people here.)

This is a bit of an awkward ask, because it doesn't necessarily pertain to Love2D itself(I think). I've made this .bat script to automate the production of my executables.

Code: Select all

@echo off
title MPG3
setlocal EnableDelayedExpansion
cd C:\Users\Pokeman2003\Desktop\Development

:yn
choice
if %errorlevel%==1 goto compile
if %errorlevel%==2 exit

:compile
echo compiling
set return=1
call :countlogic C:\Users\Pokeman2003\Desktop\Development\Archive\p1\build .7z
echo build #%return%
echo %date%>>C:\Users\Pokeman2003\Desktop\Development\Projects\Proj1\code\build.info
echo %time%>>C:\Users\Pokeman2003\Desktop\Development\Projects\Proj1\code\build.info
echo %return%>>C:\Users\Pokeman2003\Desktop\Development\Projects\Proj1\code\build.info
"C:\Program Files\7-Zip\7z.exe" a -r -mx9 -t7z build%return%.7z "C:\Users\Pokeman2003\Desktop\Development\Projects\Proj1\code\*.*"
copy build%return%.7z "C:\Users\Pokeman2003\Desktop\Development\Archive\p1"
copy /b love32.exe+build%return%.7z build%return%.exe
del build%return%.7z
del "C:\Users\Pokeman2003\Desktop\Development\Projects\Proj1\code\build.info"
goto yn

:countlogic
REM echo %1%return%%2
if exist %1%return%%2 set /a return=return+1&goto countlogic
if not exist %1%return% set /a return=%return%
echo Returning %return%.
goto :eof
Sorry for not commenting it. It's a quick and dirty solution that I don't plan to keep. Basically, what you need to know is this command right here:

Code: Select all

"C:\Program Files\7-Zip\7z.exe" a -r -mx9 -t7z build%return%.7z "C:\Users\Pokeman2003\Desktop\Development\Projects\Proj1\code\*.*"
This command singlehandedly creates a .7z file out of my project file. Now, for posterity's sake, build24.7z is my auto, buildbase is manually compiled. Despite having what would appear to be the exact same settings, I'm given an overwhelming urge to punch something.
The reason is rather simple. While you can drag both onto your love.exe and it'll open, for whatever reason, build24.7z(my automatically produced 7zip) REFUSES to work. Merging the files together results in a "No Game" error screen on both my Win64 and Win32 versions of Love. HOWEVER, buildbase.7z, which should be identical, can be merged into the love.exe of my choosing, and will work properly.
Could someone with a lot better knowledge with all of this explain what might be going on?
Attachments
buildbase.7z
(10.67 MiB) Downloaded 60 times
build24.7z
Test file because I hate myself I guess
(10.67 MiB) Downloaded 57 times
Last edited by xX_pokeman2003_Xx on Fri Jan 07, 2022 12:56 am, edited 1 time in total.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Strange bug trying to automate executable packaging

Post by grump »

.7z is not .zip, or is it? Make sure you create a .zip file.
xX_pokeman2003_Xx
Prole
Posts: 7
Joined: Thu Oct 29, 2020 1:49 am

Re: Strange bug trying to automate executable packaging

Post by xX_pokeman2003_Xx »

grump wrote: Thu Jan 06, 2022 5:09 pm .7z is not .zip, or is it? Make sure you create a .zip file.
Well, as it turns out, that doesn't work either! Infact, in an earlier revision of my program, I had that.

Code: Select all

"C:\Program Files\7-Zip\7z.exe" a -r -mx4 -tzip build%return%.love "C:\Users\Pokeman2003\Desktop\Development\Projects\Proj1\code\*.*"
You see, the problem is that not only does manually merging a 7zip file work fine(it's undocumented but Love2D does appear to fully support this, considering I can do it manually and it'll work every time) but the zip file created acts the same exact way! This means that even if I decided to do the less efficient thing and create another file to delete later, it's STILL not going to work.
And before you say "well just don't use 7zip", non-option, I need to zip these files up automatically, and I'm not about to use powershell.

I apologize for any aggression that might be noticeable, it's not intended, I'm just not having a good day. I tried to prevent it from bleeding through but I feel like I might've missed something. Attached are .zip files of the same exact process, but with the requested zip format, just to undeniably PROVE that it's not the fact the extension is .7z.
Attachments
build25.love
(10.8 MiB) Downloaded 63 times
buildbase.love
(10.75 MiB) Downloaded 53 times
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Strange bug trying to automate executable packaging

Post by grump »

build24 and build25 do both work for me in Linux. The 7z file takes much longer to start though.

I wouldn't count on 7z being supported everywhere. If you only ship fused Windows builds then it's probably okay. If you want to be on the safe side, use .zip files. The small size difference seems negligible.
xX_pokeman2003_Xx
Prole
Posts: 7
Joined: Thu Oct 29, 2020 1:49 am

Re: Strange bug trying to automate executable packaging

Post by xX_pokeman2003_Xx »

grump wrote: Thu Jan 06, 2022 8:52 pm build24 and build25 do both work for me in Linux. The 7z file takes much longer to start though.

I wouldn't count on 7z being supported everywhere. If you only ship fused Windows builds then it's probably okay. If you want to be on the safe side, use .zip files. The small size difference seems negligible.
Let me break this down.
Build24 and 25 work on Linux:Are you fusing them? The entire problem for me is fusing them. If this is a case of "works on my machine" for everyone except me, I'm going to be angry.
The 7z file takes much longer to start though:Yeah. I'm aware. But it also saves me space for my archives, so I'm going to use it. Obviously, I'll ship something like a .zip file instead for regular usage.
Dont count on 7zip being supported everywhere...:I'm going to be shipping this as Windows exclusively, mostly down to the annoying requirements to get it working on MacOS, and the unfortunate problem of Linux's whole "recompile thing for optimizations exclusive to that machine" business.
The size difference seems negligible:I already have 25 of these 10 megabyte folders. I'm saving 25 megabytes. That's more than enough for me to be okay with the size difference.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Strange bug trying to automate executable packaging

Post by grump »

xX_pokeman2003_Xx wrote: Thu Jan 06, 2022 9:12 pm I'm going to be angry.
You seem angry already.

25 whole megabytes. That was a considerable amount of storage space back in 1995.

Build your fused game with zip files to rule out one source of error. That's all I have for you.
xX_pokeman2003_Xx wrote: Thu Jan 06, 2022 9:12 pm the unfortunate problem of Linux's whole "recompile thing for optimizations exclusive to that machine" business.
Wut? The precompiled Windows binaries have those "optimizations exclusive to that machine" (whatever those may be) built in? Damn.
xX_pokeman2003_Xx
Prole
Posts: 7
Joined: Thu Oct 29, 2020 1:49 am

Re: Strange bug trying to automate executable packaging

Post by xX_pokeman2003_Xx »

grump wrote: Thu Jan 06, 2022 9:57 pm
xX_pokeman2003_Xx wrote: Thu Jan 06, 2022 9:12 pm I'm going to be angry.
You seem angry already.

25 whole megabytes. That was a considerable amount of storage space back in 1995.

Build your fused game with zip files to rule out one source of error. That's all I have for you.
xX_pokeman2003_Xx wrote: Thu Jan 06, 2022 9:12 pm the unfortunate problem of Linux's whole "recompile thing for optimizations exclusive to that machine" business.
Wut? The precompiled Windows binaries have those "optimizations exclusive to that machine" (whatever those may be) built in? Damn.
I'm frustrated by a poor day. When I'm angry, I completely lose my temper. I'm not quite there yet, thankfully.
25 whole megabytes is still 25 whole megabytes saved when I'm working off of an 80 gigabyte hard drive I found in my garage.
I appreciate the advice, for the zip file, but unfortunately I have to be a broken record here and keep telling you that even if I worked with zip files exclusively, that doesn't solve my problem. Please, either offer solutions to the problem at hand(fusing archives made by command line 7zip isn't working, and I cannot figure out why) or please stop buggering me. I have low will power as it is.
"Optimizations exclusive to that machine" refers to a common Linux practice to compile binaries that specifically work with your exact machine. If you actually read what you quoted, I even specified Linux. This is why Linux does not have portable executables out of the box, unlike Windows, and hence why I'm targetting Windows over Linux, as I don't like using most non-CLI Linux distros, and I'm really worried about how insecure my code is normally, let alone when people infinitely smarter than I am get ahold of my code.
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Strange bug trying to automate executable packaging

Post by ReFreezed »

Your first 'copy' command doesn't have the /b option.

Also, all files work for me when dropping them on love.exe (on Windows 7), none of the build24 files work for me after fusing, and both of the build25 files do work after fusing.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
xX_pokeman2003_Xx
Prole
Posts: 7
Joined: Thu Oct 29, 2020 1:49 am

Re: Strange bug trying to automate executable packaging

Post by xX_pokeman2003_Xx »

ReFreezed wrote: Thu Jan 06, 2022 10:52 pm Your first 'copy' command doesn't have the /b option.

Also, all files work for me when dropping them on love.exe (on Windows 7), none of the build24 files work for me after fusing, and both of the build25 files do work after fusing.
That's weird, the build24's buildbase file works fine for fusing for me, and the build25 autogenned one doesn't work for me at all.
The first copy command is just an overglorified move command, since Microsoft has not given me really any other tools to do this. It's just copying the file to an build library for me to use later. It doesn't make sense to use /b in that case, because I'm not merging files together.
I appreciate the input. Perhaps I did something wrong when I tested this at 3 in the morning. I'll report back what I did.
MrFariator
Party member
Posts: 513
Joined: Wed Oct 05, 2016 11:53 am

Re: Strange bug trying to automate executable packaging

Post by MrFariator »

If it might be of any help, the .bat file I use for automating builds does the following:

Code: Select all

:: set paths
set TPATH="E:\Build_destination_of_your_choice\"
set WPATH="E:\Build_destination_of_your_choice\win64"

:: robocopy the relevant löve files (DLLs, mostly) to where we will be building
@echo off
robocopy .\Distribution\win64 %WPATH%
@echo on

:: windows just seems to behave more nicely if you have a tiny sleep after commands like robocopy
sleep 1 

:: compress game files and create zip
:: the -xr command just takes a file that contains a list of files or folders not to include
7z.exe a -tzip %TPATH%\game.zip .\Source\* -xr@build_exclusion_list_release.txt

:: rename the created archive to .love
ren %TPATH%\game.zip "Game.love"

:: build win64 fused
copy /b "Binaries\love.exe"+"%TPATH%\Game.love" "%TPATH%\win64\Game.exe"

:: package it up in a .zip for distribution/archival
7z.exe a -tzip "Distribution\RELEASE\Game-RELEASE-%YYYY%-%MM%-%DD%-%HH%%Min%%Sec%" %TPATH%\win64

sleep 2

:: remove the zip/love file created
del "%TPATH%\Game.love"
Of note, I use robocopy instead of the copy command to do the moving of files.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 52 guests