btfs2: bump to 2.3.3

This commit is contained in:
Chongyun Lee 2023-10-12 13:25:57 +08:00 committed by Uchiha Kakashi
parent b407d6c5da
commit 8ccb420a1a
3 changed files with 140 additions and 4 deletions

View File

@ -3,19 +3,46 @@ TERMUX_PKG_DESCRIPTION="Decentralized file system integrating with TRON network
TERMUX_PKG_LICENSE="Apache-2.0, MIT"
TERMUX_PKG_LICENSE_FILE="LICENSE-APACHE, LICENSE-MIT"
TERMUX_PKG_MAINTAINER="Simbad Marino <cctechmx@gmail.com>"
TERMUX_PKG_VERSION="2.3.2"
TERMUX_PKG_VERSION="2.3.3"
TERMUX_PKG_SRCURL=https://github.com/bittorrent/go-btfs/archive/refs/tags/btfs-v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=4741c4d33ba9f241dbec4d3e71320f6ea0917486c4d6508959d0813d39e7594c
TERMUX_PKG_SHA256=17f2367b2c6f50bf129bef595b15b504c25a0938d6ac27650ee07188d98da927
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_UPDATE_VERSION_REGEXP="\d+\.\d+\.\d+"
TERMUX_PKG_DEPENDS="libc++"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_CONFLICTS="btfs"
TERMUX_PKG_REPLACES="btfs"
TERMUX_PKG_GO_USE_OLDER=true
termux_setup_golang_119() {
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
local TERMUX_GO_VERSION=go1.19.13
local TERMUX_GO_SHA256=4643d4c29c55f53fa0349367d7f1bb5ca554ea6ef528c146825b0f8464e2e668
local TERMUX_GO_PLATFORM=linux-amd64
local TERMUX_BUILDGO_FOLDER="${TERMUX_PKG_CACHEDIR}/${TERMUX_GO_VERSION}"
export GOROOT=$TERMUX_BUILDGO_FOLDER
export PATH="${GOROOT}/bin:${PATH}"
if [ -d "$TERMUX_BUILDGO_FOLDER" ]; then return; fi
local TERMUX_BUILDGO_TAR=$TERMUX_PKG_CACHEDIR/${TERMUX_GO_VERSION}.${TERMUX_GO_PLATFORM}.tar.gz
rm -Rf "$TERMUX_PKG_CACHEDIR/go" "$TERMUX_BUILDGO_FOLDER"
termux_download https://golang.org/dl/${TERMUX_GO_VERSION}.${TERMUX_GO_PLATFORM}.tar.gz \
"$TERMUX_BUILDGO_TAR" \
"$TERMUX_GO_SHA256"
( cd "$TERMUX_PKG_CACHEDIR"; tar xf "$TERMUX_BUILDGO_TAR";
( cd go; . ${TERMUX_PKG_BUILDER_DIR}/fix-hardcoded-etc-resolv-conf.sh )
mv go "$TERMUX_BUILDGO_FOLDER"; rm "$TERMUX_BUILDGO_TAR" )
else
termux_error_exit "This package cannot build on device currently."
fi
}
termux_step_pre_configure() {
termux_setup_golang
termux_setup_golang_119
go mod init || :
go mod tidy
}

View File

@ -0,0 +1,97 @@
--- a/src/net/conf.go
+++ b/src/net/conf.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !js
+//go:build !js && !android
package net
--- a/src/net/conf_android.go
+++ b/src/net/conf_android.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !js
+//go:build android
package net
--- a/src/net/conf_android.go
+++ b/src/net/conf_android.go
@@ -113,10 +113,10 @@ func initConfVal() {
}
if runtime.GOOS != "openbsd" {
- confVal.nss = parseNSSConfFile("/etc/nsswitch.conf")
+ confVal.nss = parseNSSConfFile("@TERMUX_PREFIX@/etc/nsswitch.conf")
}
- confVal.resolv = dnsReadConfig("/etc/resolv.conf")
+ confVal.resolv = dnsReadConfig("@TERMUX_PREFIX@/etc/resolv.conf")
if confVal.resolv.err != nil && !os.IsNotExist(confVal.resolv.err) &&
!os.IsPermission(confVal.resolv.err) {
// If we can't read the resolv.conf file, assume it
@@ -126,7 +126,7 @@ func initConfVal() {
confVal.forceCgoLookupHost = true
}
- if _, err := os.Stat("/etc/mdns.allow"); err == nil {
+ if _, err := os.Stat("@TERMUX_PREFIX@/etc/mdns.allow"); err == nil {
confVal.hasMDNSAllow = true
}
}
--- a/src/net/dnsclient_unix.go
+++ b/src/net/dnsclient_unix.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !js
+//go:build !js && !android
// DNS client: see RFC 1035.
// Has to be linked into package net for Dial.
--- a/src/net/dnsclient_android.go
+++ b/src/net/dnsclient_android.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build !js
+//go:build android
// DNS client: see RFC 1035.
// Has to be linked into package net for Dial.
--- a/src/net/dnsclient_android.go
+++ b/src/net/dnsclient_android.go
@@ -355,7 +355,7 @@ func (conf *resolverConfig) init() {
// resolv.conf twice the first time.
conf.dnsConfig = systemConf().resolv
if conf.dnsConfig == nil {
- conf.dnsConfig = dnsReadConfig("/etc/resolv.conf")
+ conf.dnsConfig = dnsReadConfig("@TERMUX_PREFIX@/etc/resolv.conf")
}
conf.lastChecked = time.Now()
@@ -427,7 +427,7 @@ func (r *Resolver) lookup(ctx context.Context, name string, qtype dnsmessage.Typ
// For consistency with libc resolvers, report no such host.
return dnsmessage.Parser{}, "", &DNSError{Err: errNoSuchHost.Error(), Name: name, IsNotFound: true}
}
- resolvConf.tryUpdate("/etc/resolv.conf")
+ resolvConf.tryUpdate("@TERMUX_PREFIX@/etc/resolv.conf")
resolvConf.mu.RLock()
conf := resolvConf.dnsConfig
resolvConf.mu.RUnlock()
@@ -604,7 +604,7 @@ func (r *Resolver) goLookupIPCNAMEOrder(ctx context.Context, network, name strin
// See comment in func lookup above about use of errNoSuchHost.
return nil, dnsmessage.Name{}, &DNSError{Err: errNoSuchHost.Error(), Name: name, IsNotFound: true}
}
- resolvConf.tryUpdate("/etc/resolv.conf")
+ resolvConf.tryUpdate("@TERMUX_PREFIX@/etc/resolv.conf")
resolvConf.mu.RLock()
conf := resolvConf.dnsConfig
resolvConf.mu.RUnlock()

View File

@ -0,0 +1,12 @@
for f in src/net/conf_android.go src/net/dnsclient_android.go; do
if [ -e "${f}" ]; then
termux_error_exit "Error: file ${f} already exists."
fi
done
cp -T src/net/conf.go src/net/conf_android.go
cp -T src/net/dnsclient_unix.go src/net/dnsclient_android.go
sed -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|" \
${TERMUX_SCRIPTDIR}/packages/btfs2/fix-hardcoded-etc-resolv-conf.diff \
| patch --silent -p1