# Contributor: Jakub Jirutka # Maintainer: Jakub Jirutka global pkgname := 'lua-busted' global _pkgname := 'busted' global pkgver := '2.0_rc12' global _pkgver := "$(pkgver/_/.)-1" global pkgrel := '4' global pkgdesc := '"Elegant Lua unit testing'" global url := '"https://olivinelabs.com/busted/'" global arch := '"noarch'" global license := '"MIT'" # Note: We have replaced dkjson with lua-cjson. global depends := '"lua-cliargs lua-filesystem lua-system lua-cjson lua-say lua-luassert lua-term lua-penlight lua-mediator'" global checkdepends := ''"" global subpackages := ''"" global source := ""$pkgname-$pkgver.tar.gz::https://github.com/Olivine-Labs/$_pkgname/archive/v$_pkgver.tar.gz fix-tests.patch use-cjson.patch"" global builddir := ""$srcdir/$_pkgname-$_pkgver"" # tests fail on x86_64 because cl_standalone.lua output is different, i don't know why --kaniini global options := '"!check'" # luajit is not available for selected arches matchstr $CARCH { ppc64le | s390x { global _luajit := ''""} * { global checkdepends := ""$checkdepends luajit"," _luajit := '"jit'"} } global _luaversions := '"5.1 5.2 5.3'" for _v in [$_luaversions] { global subpackages := ""$subpackages lua$_v-$(pkgname#lua-):_subpackage"" global checkdepends := ""$checkdepends lua$_v"" } proc prepare { default_prepare || return 1 cd $builddir var lver = ''; for lver in [$_luaversions $_luajit] { sed "s|/usr/bin/env lua|/usr/bin/lua$lver|" \ bin/busted > bin/busted-$lver || return 1 } } proc check { cd $builddir mv bin/busted bin/busted.orig var lver = ''; for lver in [$_luaversions $_luajit] { # Some specs invokes bin/busted as subprocess, so we must # ensure that it will run on the correct Lua version. install -m 755 bin/busted-$lver bin/busted || return 1 msg "Running tests on lua$lver..." lua$lver bin/busted spec || return 1 } mv bin/busted.orig bin/busted } proc package { cd $builddir # Executable with shebang `/usr/bin/env lua`. install -m 755 -D bin/busted "$pkgdir"/usr/bin/busted } proc _subpackage { var lver = $(subpkgname:3:3) global pkgdesc := ""$pkgdesc (for Lua $lver)"" global depends := ""lua$lver $(depends//lua-/lua$lver-)"" global install_if := ""$pkgname=$pkgver-r$pkgrel lua$lver"" var destdir = ""$subpkgdir/usr/share/lua/$lver/$_pkgname"" var rockdir = ""$subpkgdir/usr/lib/luarocks/rocks-$lver/$_pkgname/$_pkgver"" cd $builddir mkdir -p $destdir cp -r busted/* $destdir || return 1 mkdir -p $rockdir echo 'rock_manifest = {}' > "$rockdir"/rock_manifest install -m 755 -D bin/busted-$lver "$subpkgdir"/usr/bin/busted-$lver } global sha512sums := '"0cb1f6a66110514dc3675b2e667cca676e6672e895b57ffba438e89a1e0a7f4f8f941cab54ead905758987be15e9885e1eeb82baabc9d18bf29ea56b832b89b1 lua-busted-2.0_rc12.tar.gz c4ec5de43d76da18a7c723744d2930fc78224fe151fd80c141dbb08dce9f10ee94335684a794ad35c902285f40234899e0b12d1995825cb3d250c29ed82bdeec fix-tests.patch 6de3c1181a391956f6ea01994960a5de3292a377be1949556eb6cd11986267e3da707decef1838f42f0236af4b25ce4ce09217abe976caa0110840b69efcab43 use-cjson.patch'" (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgname) op:Equal rhs:{(lua-busted)} spids:[6])] spids: [6] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:_pkgname) op:Equal rhs:{(busted)} spids:[9])] spids: [9] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgver) op:Equal rhs:{(2.0_rc12)} spids:[12])] spids: [12] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_pkgver) op: Equal rhs: { (BracedVarSub token: suffix_op: (PatSub pat: {(_)} replace: {(.)} do_all: False do_prefix: False do_suffix: False ) spids: [16 22] ) (-1) } spids: [15] ) ] spids: [15] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgrel) op:Equal rhs:{(4)} spids:[25])] spids: [25] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("Elegant Lua unit testing"))} spids: [28] ) ] spids: [28] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:url) op: Equal rhs: {(DQ ("https://olivinelabs.com/busted/"))} spids: [33] ) ] spids: [33] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (noarch))} spids:[38])] spids: [38] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:license) op:Equal rhs:{(DQ (MIT))} spids:[43])] spids: [43] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:depends) op: Equal rhs: { (DQ ("lua-cliargs lua-filesystem lua-system lua-cjson lua-say\n") ("\tlua-luassert lua-term lua-penlight lua-mediator") ) } spids: [51] ) ] spids: [51] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:checkdepends) op:Equal rhs:{(DQ )} spids:[57])] spids: [57] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:subpackages) op:Equal rhs:{(DQ )} spids:[61])] spids: [61] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: { (DQ ($ VSub_Name "$pkgname") (-) ($ VSub_Name "$pkgver") (".tar.gz::https://github.com/Olivine-Labs/") ($ VSub_Name "$_pkgname") (/archive/v) ($ VSub_Name "$_pkgver") (".tar.gz\n") ("\tfix-tests.patch\n") ("\tuse-cjson.patch") ) } spids: [65] ) ] spids: [65] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:builddir) op: Equal rhs: {(DQ ($ VSub_Name "$srcdir") (/) ($ VSub_Name "$_pkgname") (-) ($ VSub_Name "$_pkgver"))} spids: [79] ) ] spids: [79] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:options) op:Equal rhs:{(DQ ("!check"))} spids:[91])] spids: [91] ) (Case to_match: {(DQ ($ VSub_Name "$CARCH"))} arms: [ (case_arm pat_list: [{(ppc64le)} {(s390x)}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:_luajit) op:Equal rhs:{(DQ )} spids:[116])] spids: [116] ) ] spids: [109 114 119 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:checkdepends) op: Equal rhs: {(DQ ($ VSub_Name "$checkdepends") (" luajit"))} spids: [125] ) (assign_pair lhs: (LhsName name:_luajit) op: Equal rhs: {(DQ (jit))} spids: [131] ) ] spids: [125] ) ] spids: [122 123 135 -1] ) ] spids: [100 106 137] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_luaversions) op: Equal rhs: {(DQ ("5.1 5.2 5.3"))} spids: [140] ) ] spids: [140] ) (ForEach iter_name: _v iter_words: [{($ VSub_Name "$_luaversions")}] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:subpackages) op: Equal rhs: { (DQ ($ VSub_Name "$subpackages") (" lua") ($ VSub_Name "$_v") (-) (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Pound arg_word:{(lua-)}) spids: [163 167] ) (":_subpackage") ) } spids: [157] ) ] spids: [157] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:checkdepends) op: Equal rhs: {(DQ ($ VSub_Name "$checkdepends") (" lua") ($ VSub_Name "$_v"))} spids: [172] ) ] spids: [172] ) ] spids: [154 179] ) spids: [150 152] ) (FuncDef name: prepare body: (BraceGroup children: [ (AndOr children: [ (C {(default_prepare)}) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (Sentence child: (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:lver) op:Equal spids:[209])] spids: [207] ) terminator: ) (ForEach iter_name: lver iter_words: [{($ VSub_Name "$_luaversions")} {($ VSub_Name "$_luajit")}] do_arg_iter: False body: (DoGroup children: [ (AndOr children: [ (SimpleCommand words: [ {(sed)} {(DQ ("s|/usr/bin/env lua|/usr/bin/lua") ($ VSub_Name "$lver") ("|"))} {(bin/busted)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(bin/busted-) ($ VSub_Name "$lver")} spids: [238] ) ] ) (ControlFlow token: arg_word: {(1)} ) ] op_id: Op_DPipe ) ] spids: [223 250] ) spids: [217 221] ) ] spids: [186] ) spids: [182 185] ) (FuncDef name: check body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(mv)} {(bin/busted)} {(bin/busted.orig)}) (Sentence child: (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:lver) op:Equal spids:[280])] spids: [278] ) terminator: ) (ForEach iter_name: lver iter_words: [{($ VSub_Name "$_luaversions")} {($ VSub_Name "$_luajit")}] do_arg_iter: False body: (DoGroup children: [ (AndOr children: [ (C {(install)} {(-m)} {(755)} {(bin/busted-) ($ VSub_Name "$lver")} {(bin/busted)}) (ControlFlow token: arg_word: {(1)} ) ] op_id: Op_DPipe ) (C {(msg)} {(DQ ("Running tests on lua") ($ VSub_Name "$lver") (...))}) (AndOr children: [ (C {(lua) ($ VSub_Name "$lver")} {(bin/busted)} {(spec)}) (ControlFlow token: arg_word: {(1)} ) ] op_id: Op_DPipe ) ] spids: [294 347] ) spids: [288 292] ) (C {(mv)} {(bin/busted.orig)} {(bin/busted)}) ] spids: [259] ) spids: [255 258] ) (FuncDef name: package body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(install)} {(-m)} {(755)} {(-D)} {(bin/busted)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/bin/busted)} ) ] spids: [364] ) spids: [360 363] ) (FuncDef name: _subpackage body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:lver) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (Slice begin: (ArithWord w:{(Lit_Digits 3)}) length: (ArithWord w:{(Lit_Digits 3)}) ) spids: [408 414] ) ) } spids: [406] ) ] spids: [404] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ($ VSub_Name "$pkgdesc") (" (for Lua ") ($ VSub_Name "$lver") (")"))} spids: [418] ) ] spids: [418] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:depends) op: Equal rhs: { (DQ (lua) ($ VSub_Name "$lver") (" ") (BracedVarSub token: suffix_op: (PatSub pat: {(lua-)} replace: {(lua) ($ VSub_Name "$lver") (-)} do_all: True do_prefix: False do_suffix: False ) spids: [432 441] ) ) } spids: [427] ) ] spids: [427] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:install_if) op: Equal rhs: { (DQ ($ VSub_Name "$pkgname") ("=") ($ VSub_Name "$pkgver") (-r) ($ VSub_Name "$pkgrel") (" lua") ($ VSub_Name "$lver") ) } spids: [445] ) ] spids: [445] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:destdir) op: Equal rhs: { (DQ ($ VSub_Name "$subpkgdir") (/usr/share/lua/) ($ VSub_Name "$lver") (/) ($ VSub_Name "$_pkgname") ) } spids: [459] ) ] spids: [457] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:rockdir) op: Equal rhs: { (DQ ($ VSub_Name "$subpkgdir") (/usr/lib/luarocks/rocks-) ($ VSub_Name "$lver") (/) ($ VSub_Name "$_pkgname") (/) ($ VSub_Name "$_pkgver") ) } spids: [471] ) ] spids: [469] ) (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$destdir"))}) (AndOr children: [ (C {(cp)} {(-r)} {(busted/) (Lit_Other "*")} {(DQ ($ VSub_Name "$destdir"))}) (ControlFlow token: arg_word:{(1)}) ] op_id: Op_DPipe ) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$rockdir"))}) (SimpleCommand words: [{(echo)} {(SQ <"rock_manifest = {}">)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$rockdir")) (/rock_manifest)} spids: [535] ) ] ) (C {(install)} {(-m)} {(755)} {(-D)} {(bin/busted-) ($ VSub_Name "$lver")} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/bin/busted-) ($ VSub_Name "$lver")} ) ] spids: [401] ) spids: [397 400] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha512sums) op: Equal rhs: { (DQ ( "0cb1f6a66110514dc3675b2e667cca676e6672e895b57ffba438e89a1e0a7f4f8f941cab54ead905758987be15e9885e1eeb82baabc9d18bf29ea56b832b89b1 lua-busted-2.0_rc12.tar.gz\n" ) ( "c4ec5de43d76da18a7c723744d2930fc78224fe151fd80c141dbb08dce9f10ee94335684a794ad35c902285f40234899e0b12d1995825cb3d250c29ed82bdeec fix-tests.patch\n" ) ( "6de3c1181a391956f6ea01994960a5de3292a377be1949556eb6cd11986267e3da707decef1838f42f0236af4b25ce4ce09217abe976caa0110840b69efcab43 use-cjson.patch" ) ) } spids: [564] ) ] spids: [564] ) ] )