drowe67 / freedv-gui

GUI Application for FreeDV – open source digital voice for HF radio
https://freedv.org/
GNU Lesser General Public License v2.1
206 stars 52 forks source link

when cloning a certain branch... #232

Closed cybork42 closed 2 years ago

cybork42 commented 2 years ago

... github will provide files from right taht branch, but all build scripts will still default to use the default repositories, which defaults to master. Maybe it makes sense to enhance the intelligence and awareness of build scripts to look into the .git directory to detect the cloned branch and use that branch for consecutive cloning?

tmiw commented 2 years ago

Copying previous text from the just-closed codec2 issue:

Maybe this is no real issue, but rather an imrpovement suggestion, or even a nonsense idea. When you execute

git clone --branch ms-2020-experiment https://github.com/drowe67/freedv-gui.git

you get what you expect, all source files from that named branch. However and naturally, the build scripts know nothing about being in a branch and still say

git clone https://github.com/drowe67/freedv-gui.git

An improvement suggestion might be to have the build scripts look at the .git file and identify which branch was requested and rather use files from that branch rather than master when cloning anew?

tmiw commented 2 years ago

@cybork42, I took a look at the build scripts in the current master (build_linux.sh, build_osx.sh and build_windows.sh) as well as the Docker scripts and I don't see anything that's specifically cloning freedv-gui again. Well, other than this Docker script, but that takes the desired freedv-gui branch directly from docker/freedv_build_windows.sh (as provided by the user using the --branch command line argument, or master if none provided).

Just so I'm sure we're on the same page, were you thinking that freedv_build_windows.sh would be modified to always default --branch to the current branch? Or did I miss some other git clone reference in the current scripts?

cybork42 commented 2 years ago

@tmiw: you are right, in fact the build script for docker was the one that made me stumble about this issue, and it's the only one script that uses some "branch" arguments. When one performs a docker-compose -f docker-compose-win.yml build, you would expect that all later builds will really use the branch cloned to local storage without mentioning anything special. The additional arguments to ./freedv_build_windows.sh are not really obvious, are they? My suggestion would be to do the following change:

FDV_GIT_REPO=https://github.com/drowe67/freedv-gui.git
# FDV_GIT_BRANCH=master
FDV_GIT_BRANCH=`git branch | cut -c 3-`
echo "building branch $FDV_GIT_BRANCH"
FDV_BOOTSTRAP_WX=0
tmiw commented 2 years ago

@tmiw: you are right, in fact the build script for docker was the one that made me stumble about this issue, and it's the only one script that uses some "branch" arguments. When one performs a docker-compose -f docker-compose-win.yml build, you would expect that all later builds will really use the branch cloned to local storage without mentioning anything special. The additional arguments to ./freedv_build_windows.sh are not really obvious, are they? My suggestion would be to do the following change:

FDV_GIT_REPO=https://github.com/drowe67/freedv-gui.git
# FDV_GIT_BRANCH=master
FDV_GIT_BRANCH=`git branch | cut -c 3-`
echo "building branch $FDV_GIT_BRANCH"
FDV_BOOTSTRAP_WX=0

Actually, I have some changes over at https://github.com/drowe67/freedv-gui/pull/233 that I think will help. Basically, it'll default to the current repo and branch if freedv_build_windows.sh is run from a repo. Otherwise, it'll default to https://github.com/drowe67/freedv-gui.git and master. Let me know if that works for you.

cybork42 commented 2 years ago

can be closed by adopting changes propsed by @tmiw , well done!