You are not logged in.

#1 2020-10-03 19:35:36

oneofone
Member
Registered: 2020-10-03
Posts: 2

PKGBUILD: Review Request: tastyworks-bin

I should've posted here before I published it on aur, however it works locally for me but I'd like some reviews if possible.

It is slightly based on https://aur.archlinux.org/packages/tastyworks but the actual file structure changed a bit.

https://aur.archlinux.org/packages/tastyworks-bin/

# Maintainer: Ahmed W. <oneofone@gmail.com>
# copied a few parts from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=tastyworks

pkgname=tastyworks-bin
pkgver='1.9.2'
pkgrel='1'
pkgdesc="One of the fastest, most reliable, and most secure trading platforms in the world."
arch=('x86_64')
url='https://tastyworks.com/'
license=('custom:commercial')
depends=('java-runtime')

source=(https://download.tastyworks.com/desktop-1.x.x/${pkgver}/tastyworks-${pkgver}-${pkgrel}_amd64.deb)
sha256sums=('a59d74919ce035c772bd2c0577b495827e20773d21eb0f164b4791cd954adac5')

build() {
	tar xf data.tar.xz

	# Remove additional bundled Java "runtime"
	rm -rf opt/tastyworks/lib/runtime
	sed -i 's|app.runtime=$ROOTDIR/lib/runtime|app.runtime=/usr/lib/jvm/default-runtime|' opt/tastyworks/lib/app/tastyworks.cfg

	DF="opt/tastyworks/lib/tastyworks-tastyworks.desktop"

	# Set correct information for the application .desktop launcher
	sed -i 's|Name=tastyworks|Name=TastyWorks|'                  $DF
	sed -i 's|Comment=tastyworks|Comment=Trading Platform|'      $DF
	sed -i 's|Exec=.*|Exec=/usr/bin/tastyworks-bin|'             $DF
	sed -i 's|Icon=.*|Icon=tastyworks-bin|'                      $DF
	sed -i 's|Categories=tastyworks|Categories=Network|'         $DF

	# Add the correct startup window manager class
	# This *should* fix gnome from creating more than one dock entry for the program
	echo 'StartupWMClass=tasty.javafx.launcher.LauncherFxApp' >> $DF
	sed -i '/^[[:space:]]*$/d'                                   $DF
}

package() {
	install -d "${pkgdir}/usr/bin"
	ln -sf "/usr/lib/${pkgname}/bin/tastyworks" "${pkgdir}/usr/bin/${pkgname}"

	install -d "${pkgdir}/usr/lib/${pkgname}/lib/app"
	cp -r           "${srcdir}/opt/tastyworks/lib/app/"                          "${pkgdir}/usr/lib/${pkgname}/lib/"
	install -Dm 644 "${srcdir}/opt/tastyworks/lib/libapplauncher.so"             "${pkgdir}/usr/lib/${pkgname}/lib/libapplauncher.so"

	install -Dm 755 "${srcdir}/opt/tastyworks/bin/tastyworks"                    "${pkgdir}/usr/lib/${pkgname}/bin/tastyworks"

	install -Dm 644 "${srcdir}/opt/tastyworks/lib/tastyworks-tastyworks.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"
	install -Dm 644 "${srcdir}/opt/tastyworks/share/doc/copyright"               "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
	install -Dm 644 "${srcdir}/opt/tastyworks/lib/tastyworks.png"                "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
}

//edit

namcap output:

┏━ oneofone@voyager ❰/u/s/p/tastyworks❱ ❰master|✔❱
┗━● namcap PKGBUILD *zst
tastyworks-bin W: ELF file ('usr/lib/tastyworks-bin/bin/tastyworks') lacks FULL RELRO, check LDFLAGS.
tastyworks-bin W: ELF file ('usr/lib/tastyworks-bin/lib/libapplauncher.so') lacks FULL RELRO, check LDFLAGS.
tastyworks-bin W: ELF file ('usr/lib/tastyworks-bin/bin/tastyworks') lacks PIE.
tastyworks-bin W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/lib/tastyworks-bin/bin/tastyworks')
tastyworks-bin W: Unused shared library '/usr/lib/libm.so.6' by file ('usr/lib/tastyworks-bin/lib/libapplauncher.so')
tastyworks-bin E: Dependency glibc detected and not included (libraries ['usr/lib/ld-linux-x86-64.so.2', 'usr/lib/libm.so.6', 'usr/lib/libdl.so.2', 'usr/lib/libc.so.6', 'usr/lib/libpthread.so.0'] needed in files ['usr/lib/tastyworks-bin/lib/libapplauncher.so'])

Last edited by oneofone (2020-10-03 19:37:17)

Offline

#2 2020-10-03 23:15:55

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: PKGBUILD: Review Request: tastyworks-bin

Why not leave it all in /opt? Personally, I would just extract data.tar.xz directly to $pkgdir in the package function, skipping the build function all together.

Other than that, the main thing i would point out is that sed can take multiple expressions. Running it 6 times doesn't make sense when you could just run it once.

Online

#3 2020-10-03 23:33:30

oneofone
Member
Registered: 2020-10-03
Posts: 2

Re: PKGBUILD: Review Request: tastyworks-bin

Scimmia wrote:

Why not leave it all in /opt? Personally, I would just extract data.tar.xz directly to $pkgdir in the package function, skipping the build function all together.

Other than that, the main thing i would point out is that sed can take multiple expressions. Running it 6 times doesn't make sense when you could just run it once.

namcap was complaining about binaries in non-standard path /opt and looked at few different packages for binaries and they seemed to use /usr/* instead.

good point about sed.

Offline

#4 2020-10-03 23:37:51

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: PKGBUILD: Review Request: tastyworks-bin

namcap is a guide, nothing more. /opt is fine.

Online

#5 2020-10-04 00:50:07

loqs
Member
Registered: 2014-03-06
Posts: 17,195

Re: PKGBUILD: Review Request: tastyworks-bin

Why the need for tastyworks-bin? If tastyworks is not being updated and is already flagged out of date why not submit an orphan request.
-bin packages usually denote a prebuilt binary build from the software's author.
Edit:
Arch_package_guidelines#Directories covers standard directory layout and paths that can not be used.

Last edited by loqs (2020-10-04 00:52:39)

Online

Board footer

Powered by FluxBB