Hello, I was trying to compile pakku in Artix Linux with the latest stable 
packaged version of Nim, pakku is also available in Arch and other Arch related 
distros. I resolved the compile errors and have so far resolved some of the 
other deprecation warnings too. But I get a run time error in 
src/feature/syncinstall.nim after bin pkg updates and when AUR pkg updates are 
just starting to be processed. An assignment fails due to incompatible types 
but the types seem to be the same, also it worked before and compiles fine. 
I've tried various things, and though I specified the exact type of table with 
toTable, make a test table of the same type, taken from reading the output of 
some error messages, but it fails at run time. Changing it to a ref table 
variable won't compile, giving a type mismatch error.

> let satisfied = toTable[package.PackageReference, syncinstall.SatisfyResult] 
> (pkgInfos.map(p => ((p.name, none(string), none(VersionConstraint)),
>     
> 
> (false, p.name, some(p)))))
> 
> testtable2 = initTable[package.PackageReference, 
> syncinstall.SatisfyResult](1024)
> 
> testtable2 = satisfied

This does not work!!! It didn't work without the 1024 either, I've been trying 
various random stuff. I don't know much Nim but it looks like it should work. 
That's basically what the original code does but it gives satisfied to a proc 
argument of that type instead. Sorry I don't really know how to explain this 
more concisely as the types and values are part of a larger app, and you need 
to have an AUR package in need of updating for 'satisfied' to contain a value, 
but it still fails when empty. It isn't that big really though and builds 
quickly.

Any ideas for a simple fix? I could possibly make it not be a table and put the 
info in something like my testing seq [WrapperTuple] but that would mean 
altering all the other places it gets used too.

The pakku author kitsunyan is (wisely? :) ) AWOL at present. This is the most 
up to date source: 
[https://github.com/brunomiguel/pakku](https://github.com/brunomiguel/pakku)

$ nim -V Nim Compiler Version 1.0.4 [Linux: amd64] Compiled at 2019-11-27 
Copyright (c) 2006-2019 by Andreas Rumpf

active boot switches: -d:release -d:nativeStackTrace

Extract from modified src/feature/syncinstall.nim #[

from src/package.nim:
    

PackageReference* = tuple[
    name: string, description: Option[string], constraint: 
Option[VersionConstraint]

]

from this file:
    

SatisfyResult = tuple[
    installed: bool, name: string, buildPkgInfo: Option[PackageInfo]

]

]# # let satisfied = pkgInfos.map(p => ((p.name, none(string), 
none(VersionConstraint)),

# (false, p.name, some(p)))).toTable

> let satisfied = toTable[package.PackageReference, syncinstall.SatisfyResult] 
> (pkgInfos.map(p => ((p.name, none(string), none(VersionConstraint)),
>     (false, p.name, some(p)))))
> 
> let unsatisfied = lc[x | (i <\- pkgInfos, x <\- i.allDepends), 
> PackageReference].deduplicate

# echo "pkgInfos =n", pkgInfos # echo "pkgInfos.map =n", pkgInfos.map(p => 
((p.name, none(string), none(VersionConstraint)), (false, p.name, some(p)))) # 
echo satisfied.type.name

# echo "satisfied =n", repr (satisfied)
    var

# testtable2 = newTable[PackageReference, SatisfyResult]() #Error: type 
mismatch: got <Table[tuple of (string, Option[system.string], 
Option[package.VersionConstraint]), tuple of (bool, string, 
Option[package.PackageInfo])]>

#but expected 'TableRef[package.PackageReference, syncinstall.SatisfyResult]'
    testtable2 = initTable[package.PackageReference, 
syncinstall.SatisfyResult](1024) testtable1: Table[PackageReference, 
SatisfyResult] testnewseq1 = newSeq[WrapperTuple]()

# echo "testtable1 =n", repr (testtable1) # echo name (satisfied)

# name (pkgInfos)
    testnewseq1 = pkgInfos.map(p => ((p.name, none(string), 
none(VersionConstraint)), (false, p.name, some(p)))) echo "testnewseq1 =n", 
testnewseq1 echo "satisfied =n", satisfied

#Error: type mismatch: got <seq[tuple of (tuple of (string, 
Option[system.string], Option[package.VersionConstraint]), tuple of (bool, 
string, Option[package.PackageInfo]))]> # but expected 'seq[SatisfyResult]'

#This worked with wrappertuple. And the table content looks just the same but 
in a table.
    echo "testtable2 assignment" testtable2 = satisfied echo "testtable1 
assignment" testtable1 = satisfied echo "did that work?"

#[ No it didn't. resolving dependencies... testnewseq1 = @[(packref: 
subtitleripper, satres: (installed: false, name: "subtitleripper", 
buildPkgInfo: Some((baseIndex: 0, baseCount: 1, archs: @["x86_64"], url: 
Some("[http://subtitlerippe](http://subtitlerippe) r.sourceforge.net/"), 
licenses: @["GPL"], groups: @[], pgpKeys: @[], depends: @[netpbm], makeDepends: 
@[make, gcc], checkDepends: @[], optional: @[], provides: @[], conflicts: @[ ], 
replaces: @[], repo: "aur", base: "subtitleripper", name: "subtitleripper", 
version: "0.5.2-2", description: Some("DVD subtitle to text converter"), 
maintainer: Some("init"), firstSubmitted: Some(1484683508), lastModified: 
Some(1574810177), outOfDate: None[int64], votes: 3, popularity: 0.382473, 
gitUrl: 
"[https://aur.archlinux.org/subtitleripper.git";](https://aur.archlinux.org/subtitleripper.git&quot),
 gitSubdir: None[TaintedString]))))] satisfied = {subtitleripper: (installed: 
false, name: "subtitleripper", buildPkgInfo: Some((baseIndex: 0, baseCount: 1, 
archs: @["x86_64"], url: 
Some("[http://subtitleripper.sourceforge.net/](http://subtitleripper.sourceforge.net/)"
 ), licenses: @["GPL"], groups: @[], pgpKeys: @[], depends: @[netpbm], 
makeDepends: @[make, gcc], checkDepends: @[], optional: @[], provides: @[], 
conflicts: @[], replaces: @[], r epo: "aur", base: "subtitleripper", name: 
"subtitleripper", version: "0.5.2-2", description: Some("DVD subtitle to text 
converter"), maintainer: Some("init"), firstSubmitted: Som e(1484683508), 
lastModified: Some(1574810177), outOfDate: None[int64], votes: 3, popularity: 
0.382473, gitUrl: 
"[https://aur.archlinux.org/subtitleripper.git";](https://aur.archlinux.org/subtitleripper.git&quot),
 gitSubdir: None[Tai ntedString])))} testtable2 assignment

/home/name/projects/pakku/pakku-git3/src/pakku/src/main.nim(263) main|   
---|---  
/home/name/projects/pakku/pakku-git3/src/pakku/src/main.nim(254) run|   
/home/name/projects/pakku/pakku-git3/src/pakku/src/main.nim(132) handleSync|   
/home/name/projects/pakku/pakku-git3/src/pakku/src/feature/syncinstall.nim(1442)
 handleSyncInstall|   
/home/name/projects/pakku/pakku-git3/src/pakku/src/feature/syncinstall.nim(1212)
 handleInstall|   
/home/name/projects/pakku/pakku-git3/src/pakku/src/feature/syncinstall.nim(735) 
resolveDependencies|   
/home/name/projects/pakku/pakku-git3/src/pakku/src/feature/syncinstall.nim(307) 
findDependencies|   
/usr/lib/nim/system/assign.nim(147) genericSeqAssign|   
/usr/lib/nim/system/assign.nim(111) genericAssign|   
/usr/lib/nim/system/assign.nim(76) genericAssignAux|   
/usr/lib/nim/system/assign.nim(100) genericAssignAux|   
/usr/lib/nim/system/assign.nim(24) genericAssignAux|   
/usr/lib/nim/system/assign.nim(20) genericAssignAux|   
/usr/lib/nim/system/assign.nim(100) genericAssignAux|   
/usr/lib/nim/system/assign.nim(24) genericAssignAux|   
/usr/lib/nim/system/assign.nim(20) genericAssignAux|   
/usr/lib/nim/system/assign.nim(100) genericAssignAux|   
/usr/lib/nim/system/assign.nim(24) genericAssignAux|   
/usr/lib/nim/system/assign.nim(20) genericAssignAux|   
/usr/lib/nim/system/assign.nim(97) genericAssignAux|   
/usr/lib/nim/system/fatal.nim(39) sysFatal|   
  
Error: unhandled exception: invalid object assignment [ObjectAssignmentError] ]*

> findDependencies(config, handle, dbs, satisfied, unsatisfied, @[],
>     additionalPkgInfos, @[], nodepsCount, assumeInstalled, printMode, noaur)

my diff of brunomiguel's fork to make pakku build OK: 
[https://yadi.sk/d/YShVi29cWcPzqQ](https://yadi.sk/d/YShVi29cWcPzqQ)

diff of my modified with test code src/feature/syncinstall.nim 
[https://yadi.sk/d/ajv_r4yyLt3CFQ](https://yadi.sk/d/ajv_r4yyLt3CFQ)

Reply via email to