Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mingw tarball shenanigans #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Valmar33
Copy link

No description provided.

@Valmar33
Copy link
Author

Well, shaninigans on my end...

@Tk-Glitch
Copy link
Member

I can offer an alternative path for people having issues with their ISP regarding sourceforge, but I can't decently offer it as the default since it's not an official source. By the way, do you also face the issue with the sf git repo (https://git.code.sf.net/p/mingw-w64/mingw-w64)?

@imaami
Copy link

imaami commented Nov 28, 2020

Sorry for not pushing this into a branch, feel free to copypaste or whatever. This little bash script of mine works for pulling from the git repo and making a tarball. I've verified that the resulting tarball contains 100% the same payload as the upstream tarball.

#!/bin/bash

#
# Do a shallow clone of the given upstream ref and create a tarball with 'git archive'.
# The output file is written to the current working directory.
#
mingw_tarball_from_git() {
	local mingw_ref="$1"
	local dir_name="mingw-w64-${mingw_ref}"
	local this_dir out_file temp_dir retval

	this_dir="$(realpath -e .)" &&
	out_file="${this_dir}/${dir_name}.tar.gz" &&
	temp_dir="$(mktemp -dp "${this_dir}" "${dir_name}.tmp-XXXXXXXX")" && {
		git clone -c 'advice.detachedHead=false' -b "${mingw_ref}" --depth=1 --single-branch \
		          'https://git.code.sf.net/p/mingw-w64/mingw-w64.git' "${temp_dir}" >/dev/null &&
		git -C "${temp_dir}" archive --prefix="${dir_name}/" -o "${out_file}" HEAD
		result="$?"

		if (( result == 0 )); then
			echo "${out_file}"
		fi

		rm -fr "${temp_dir}" >/dev/null
		return "${result}"
	}
}

#
# Everything below this is just to demonstrate usage.
#

mingw_ver="$1"
[[ "${mingw_ver}" ]] || mingw_ver='v8.0.0'

if out_file="$(mingw_tarball_from_git "${mingw_ver}")"; then
	printf 'Output file: %s\n' "${out_file}" >&2
else
	printf 'ERROR\n' >&2
fi

@Tk-Glitch
Copy link
Member

You can already switch to git from config, so this doesn't solve the issue that some ISPs are locking people out of sourceforge. We'd need to know if sourceforge git (git.code.sf.net) is also unusable for @Valmar33 , and in case it isn't, they should just switch to git in their .cfg as a workaround/alternative. The idea behind defaulting to the release tarballs is just that it's faster than pulling it from git (let alone pulling then packaging).

@netbospl
Copy link
Contributor

netbospl commented May 9, 2021

I didn't experienced any issues using tarballs.
Personally, I don't think there is anything to fix with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants