termux-language-server icon indicating copy to clipboard operation
termux-language-server copied to clipboard

Treat all variables match `_.*` as optional

Open txtsd opened this issue 1 year ago • 4 comments

2024-11-05-16:10:39:44:327516431-960x1052_grim

Any idea how to fix this?

txtsd avatar Nov 05 '24 11:11 txtsd

I found out this happens because of line 4. The variable needs to be quoted, but that is not necessary as far as bash is concerned. Can you make it so that it doesn't have to be quoted?

txtsd avatar Nov 07 '24 08:11 txtsd

You mean _pkgname result in this bug? So we should ignore all variables which name match _.*. I cannot copy text from screenshot to test. Perhaps you can copy the entire code.

Freed-Wu avatar Nov 07 '24 08:11 Freed-Wu

Here it is:

# Maintainer: txtsd <[email protected]>

pkgname=android_translation_layer
_pkgname=${pkgname//-/_}
pkgver=r651.e541d87f
pkgrel=2
_commit=e541d87fc255160ca0559015db0cc57042246fff
pkgdesc='A translation layer for running Android apps on a Linux system'
url='https://gitlab.com/android_translation_layer/android_translation_layer'
arch=(x86_64 aarch64 armv7h)
license=('GPL-3.0-or-later')
# libopensles-standalone is not strictly required but some Android applications depend on it
depends=(
  alsa-lib
  art_standalone
  bionic_translation
  cairo
  ffmpeg
  gcc-libs
  gdk-pixbuf2
  glib2
  glibc
  graphene
  gtk4
  harfbuzz
  libdrm
  libglvnd
  libgudev
  libopensles-standalone
  libportal
  libsoup3
  pango
  skia-sharp-atl
  sqlite
  vulkan-icd-loader
  wayland
  webkitgtk-6.0
)
makedepends=(
  glib2-devel
  java-runtime-common
  jdk8-openjdk
  meson
  openxr
  vulkan-headers
  wayland-protocols
)
source=("${pkgname}-${_commit}.tar.gz::${url}/-/archive/${_commit}/${pkgname}-${_commit}.tar.gz")
sha256sums=('e16cf668e9b2d9c1149f16dcaa785faedfc7dc4a81e2cf62d1f0c35afbba67fa')

prepare() {
  meson subprojects download --sourcedir="${pkgname}-${_commit}"
}

build() {
  arch-meson "${pkgname}-${_commit}" build
  meson compile -C build
}

check() {
  meson test --no-rebuild --print-errorlogs -C build
}

package() {
  depends+=(java-runtime)
  meson install --no-rebuild -C build --destdir "${pkgdir}"
}

txtsd avatar Nov 07 '24 09:11 txtsd

Yes, it is recommended for user defined variables to start with an underscore.

txtsd avatar Nov 07 '24 09:11 txtsd