Skip to content

Commit 6e84202

Browse files
committed
scraper: change build method to fix FTBS
Changed the build method by using Golang's module support and creating a module from the upstream sources. Fixes the current build errors due to a transitive depedency which requires upgrading Go to 1.17+. This simplifies applying the patch and rolling back (downgrading) the TGDB module dependency. As a bonus, we can use the normal way of retrieving the sources and generating the scriptmodule `.pkg` info file. Fixed also the `golang` installation, the new version was not installed automatically due to a insufficient version check.
1 parent a9602fc commit 6e84202

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

scriptmodules/supplementary/golang.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ function _get_goroot_golang() {
1818
}
1919

2020
function install_bin_golang() {
21+
local target_version=1.11.13
2122
local version
2223
if [[ -e "$md_inst/bin/go" ]]; then
23-
local version=$(GOROOT="$md_inst" "$md_inst/bin/go" version | sed 's/.*\(go1[^ ]*\).*/\1/')
24+
local version=$(GOROOT="$md_inst" "$md_inst/bin/go" version | sed 's/.*go\(1[^ ]*\).*/\1/')
2425
fi
2526
printMsgs "console" "Current Go version: $version"
26-
if [[ ! "${version}" < "go1.11.13" ]]; then
27+
if compareVersions "$version" ge "$target_version" ; then
2728
return 0
2829
fi
2930

@@ -40,6 +41,6 @@ function install_bin_golang() {
4041
if isPlatform "aarch64"; then
4142
arch="arm64"
4243
fi
43-
printMsgs "console" "Downloading go1.11.13.linux-$arch.tar.gz"
44-
downloadAndExtract "https://storage.googleapis.com/golang/go1.11.13.linux-$arch.tar.gz" "$md_inst" --strip-components 1 --exclude="go/test"
44+
printMsgs "console" "Downloading go$target_version.linux-$arch.tar.gz"
45+
downloadAndExtract "https://storage.googleapis.com/golang/go${target_version}.linux-$arch.tar.gz" "$md_inst" --strip-components 1 --exclude="go/test"
4546
}

scriptmodules/supplementary/scraper.sh

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,23 @@ function depends_scraper() {
2121
}
2222

2323
function sources_scraper() {
24-
local goroot="$(_get_goroot_golang)"
25-
GOPATH="$md_build" GOROOT="$goroot" "$goroot/bin/go" get -u github.com/sselph/scraper
26-
# Use an older version of the TGDB go REST bindings, since the new one is not compatible with scraper
27-
git -C "$md_build/src/github.com/J-Swift/thegamesdb-swagger-client-go/" checkout 43ed8a0b364ed2d8521d0
28-
# Fix ScreenScraper scraping with the patch from PR-#265
29-
git -C "$md_build/src/github.com/sselph/scraper" apply "$md_data/00-fix-screenscraper-response-parsing-265.diff"
30-
# manually set repo_dir for packaging info / version checking
31-
__mod_info[$md_id/repo_dir]="$md_build/src/github.com/sselph/scraper"
24+
gitPullOrClone
25+
applyPatch "$md_data/00-fix-screenscraper-response-parsing-265.diff"
3226
}
3327

3428
function build_scraper() {
3529
local goroot="$(_get_goroot_golang)"
36-
GOPATH="$md_build" GOROOT="$goroot" "$goroot/bin/go" build github.com/sselph/scraper
30+
GOROOT="$goroot" "$goroot/bin/go" mod init github.com/sselph/scraper
31+
GOROOT="$goroot" "$goroot/bin/go" get github.com/J-Swift/thegamesdb-swagger-client-go@43ed8a0b364ed2d8521d0
32+
GOROOT="$goroot" "$goroot/bin/go" build -o scraper
3733
}
3834

3935
function install_scraper() {
4036
md_ret_files=(
4137
'scraper'
42-
'src/github.com/sselph/scraper/LICENSE'
43-
'src/github.com/sselph/scraper/README.md'
44-
'src/github.com/sselph/scraper/hash.csv'
38+
'LICENSE'
39+
'README.md'
40+
'hash.csv'
4541
)
4642
}
4743

0 commit comments

Comments
 (0)