Coder Social home page Coder Social logo

zqqw / pakku Goto Github PK

View Code? Open in Web Editor NEW
38.0 1.0 3.0 468 KB

Pacman wrapper with AUR support

License: GNU General Public License v3.0

Makefile 2.06% Shell 0.69% Nim 97.25%
nim pakku pacman aur aur-helper archlinux artixlinux artix-linux arch-linux aurhelper

pakku's People

Contributors

bernimoses avatar brunomiguel avatar ckath avatar gavinhungry avatar hochata avatar kitsunyan avatar morganamilo avatar omentic avatar shirleyquirk avatar zqqw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pakku's Issues

Nim 2.0 support

Info update:
The Nim compile option "-d:nimPreviewSlimSystem" allows this to be tested, and with a recent nim-git build at this commit:
commit 53eed2be4515a3ae853ae4d2fbd84daa49c1d6d6
Date: Sun Dec 18 22:31:13 2022 +0800
this works and builds fine - although at that point in Nim it fails on a normal build, without these modifications below! I will probably commit these small changes in preparation for Nim 2.0 but leave the -d:nimPreviewSlimSystem commented out, because that option would not be relevant in old or future versions of Nim, so users can edit the Makefile to enable it if desired - or required.

diff --git a/Makefile b/Makefile
index bae3b09..c9b2639 100644
--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,7 @@ NIM_OPTIONS = \
 	--putenv:'PROG_LOCALSTATEDIR'="${LOCALSTATEDIR}" \
 	--putenv:'PROG_SYSCONFDIR'="${SYSCONFDIR}" \
 	-d:'${NIM_TARGET}' \
+	-d:nimPreviewSlimSystem \
 	--opt:'${NIM_OPTIMIZE}' \
 	--hint'[Conf]':off \
 	--hint'[Processing]':off \
diff --git a/lib/install.nim b/lib/install.nim
index 2a89ade..f2886df 100644
--- a/lib/install.nim
+++ b/lib/install.nim
@@ -1,5 +1,6 @@
 import
   os, posix, sequtils, strutils, sugar
+when not declared(system.stdout): import std/syncio
 
 proc splitCommands(params: seq[string], index: int, res: seq[seq[string]]): seq[seq[string]] =
   if index < params.len:
diff --git a/src/args.nim b/src/args.nim
index deabeff..f17f60b 100644
--- a/src/args.nim
+++ b/src/args.nim
@@ -1,6 +1,7 @@
 import
   options, os, posix, sequtils, sets, strutils, sugar,
   utils
+when not declared(system.stdout): import std/syncio
 
 type
   ArgumentType* {.pure.} = enum
diff --git a/src/common.nim b/src/common.nim
index da36c0d..46831ce 100644
--- a/src/common.nim
+++ b/src/common.nim
@@ -2,6 +2,7 @@ import
   options, os, osproc, posix, sequtils, sets, strutils, sugar, tables,
   args, config, format, lists, package, pacman, utils,
   "wrapper/alpm"
+when not declared(system.stdout): import std/syncio
 
 type
   CacheKind* {.pure.} = enum
diff --git a/src/config.nim b/src/config.nim
index 598b488..a5fab96 100644
--- a/src/config.nim
+++ b/src/config.nim
@@ -1,6 +1,7 @@
 import
   std/[options, posix, re, sequtils, sets, strutils, sugar, tables],
   utils
+when not declared(system.stdout): import std/syncio
 
 type
   ColorMode* {.pure.} = enum
diff --git a/src/feature/syncinfo.nim b/src/feature/syncinfo.nim
index ffb299e..647dac1 100644
--- a/src/feature/syncinfo.nim
+++ b/src/feature/syncinfo.nim
@@ -3,6 +3,7 @@ import
   "../args", "../aur", "../common", "../config", "../format", "../package",
     "../pacman", "../utils",
   "../wrapper/alpm"
+when not declared(system.stdout): import std/syncio
 
 const
   pacmanInfoStrings = [
diff --git a/src/feature/syncinstall.nim b/src/feature/syncinstall.nim
index a728851..ec7e748 100644
--- a/src/feature/syncinstall.nim
+++ b/src/feature/syncinstall.nim
@@ -3,6 +3,7 @@ import
   "../args", "../aur", "../config", "../common", "../format", "../lists", "../package",
     "../pacman", "../utils",
   "../wrapper/alpm"
+when not declared(system.stdout): import std/syncio
 
 type
   Installed = tuple[
diff --git a/src/format.nim b/src/format.nim
index cf4b9db..60c550d 100644
--- a/src/format.nim
+++ b/src/format.nim
@@ -1,6 +1,7 @@
 import
   std/[macros, options, posix, sequtils, strutils, sugar, times, unicode, terminal],
   utils
+when not declared(system.stdout): import std/syncio
 
 type
   PackageLineFormat* = tuple[
diff --git a/src/main.nim b/src/main.nim
index 3960d59..c6745d8 100644
--- a/src/main.nim
+++ b/src/main.nim
@@ -1,6 +1,7 @@
 import
   options, os, posix, re, sequtils, strutils, sugar,
   args, config, format, pacman, utils
+when not declared(system.stdout): import std/syncio
 
 import
   "feature/localquery",
diff --git a/src/package.nim b/src/package.nim
index e48b01f..9cfe49e 100644
--- a/src/package.nim
+++ b/src/package.nim
@@ -1,6 +1,7 @@
 import
   options, os, re, sequtils, sets, strutils, sugar, tables, utils,
   "wrapper/alpm"
+when not declared(system.stdout): import std/syncio
 
 type
   ConstraintOperation* {.pure.} = enum
diff --git a/src/pacman.nim b/src/pacman.nim
index c37a54c..ee20a07 100644
--- a/src/pacman.nim
+++ b/src/pacman.nim
@@ -1,6 +1,7 @@
 import
   macros, options, posix, sequtils, sets, strutils, sugar, tables,
   args, config, utils
+when not declared(system.stdout): import std/syncio
 
 type
   OpGroup* {.pure.} = enum

could not find or read package

==> Finished making: nim-git 1:0.19.6.r4510.c7ccbfac3-1 (Sat 10 Oct 2020 14:27:36 BST)
:: Continue installing? [Y/n] y
[sudo] password for user:
loading packages...
error: '/tmp/pakku-user/nim-git-1:0.19.4.r1821.d24585c49-1-x86_64.pkg.tar.xz': could not find or read package
Trying again:
error: '/tmp/pakku-username/nim-git-1:0.19.4.r1821.d24585c49-1-x86_64.pkg.tar.xz': could not find or read package
The file is there, but has a newer revision name: nim-git-1:0.19.6.r4511.992952d86-1-x86_64.pkg.tar.xz
(This happens when building nim-git with pakku-git compiled with nim-git.)

Workaround: cd to /tmp/pakku-username and manually install with pakku -U

pakku can't resolve a dependancy in 'extra'

pakku -S keysmith-git
complains, "error: unable to satisfy dependency 'frameworkintegration ' required by keysmith-git"
but this package is already installed from 'extra' and compiling it with makepkg (no changes to PKGBUILD) gives no errors.

Pakku v0.14-31-g334e09a
Pacman v6.0.2 - libalpm v13.0.2

man pages won't build with latest asciidoc 10.1.1-1

Having just updated the man pages I thought this was something I had done, but no - and it was building fine recently when I was testing this, downgrading asciidoc to 9.1.1-4 sees it build again.
Adding -v to the a2x command options in pakku/Makefile gives a little more output, but not sure of the fix yet...

${MAN_PAGES:=.in}: ${MAN_PAGES:=.txt}
        @echo "GEN: $@"
        @a2x \
        -v \
        --doctype manpage \

Default editor setting

pakku currently asks for your editor every time you inspect a PKGBUILD. This gets tedious after a while, and I've never had a use case where I wanted to use anything other than my default editor. So I was going to do one of the following:

  • Add a DefaultEditor setting to /etc/pakku.conf
  • Make pakku use $EDITOR without asking

I may take a look at implementing this over the weekend. Would either of these be something you all would be interested in?

Problem with pakku -Sn when built with nim-git

$ pakku -Sn hexedit
checking official repositories...
(1/1) cloning repositories                                                                           00:00 [################################################################] 100%
error: hexedit: failed to get package info

It works with 1.2.6.
let srcInfo = obtainSrcInfo(repoPath.unsafeGet & "/" & git.path) is returning nothing in src/common.nim
execResult(makePkgCmd, "--printsrcinfo") in obtainSrcInfo where makePkgCmd is "/usr/bin/makepkg" doesn't seem to return anything although there is a PKGBUILD in the dir at that point.
execResult itself seems to work OK. The forks, exec, and redirection make it tricky to find out what happens.
I think I have the answer now - it will just take a little while to get it sorted and pushed here.

Update needed due to pacman 14

Hi there,
I'm using pakku as AUR helper. it's simple and lightweight. According to the latest pacman update to version 14, pakku needs to be updated to use libalpm.so.14. otherwise it doesn't work:
pakku error while loading shared libraries: libalpm.so.13: cannot open shared object file: No such file or directory

Thanks a lot.

Pakku may need to be updated to work with pacman 6.1

Seems like the pacman 6.1 upgrade added new libalpm libraries.

Getting a pakku: error while loading shared libraries: libalpm.so.13: cannot open shared object file: No such file or directory when trying to run pakku -Syu.

It is similar to this Morganamilo/paru#1149.

Let me know if anything else is needed to help with this.

Some searches with pakku -Ss fail

Compiling pakku for debug not release:

$ pakku -Ss linux
...
aur/linux-a11y-sound-theme r19.730e525-1 [0 / 0.000000]
    Sound theme for the linux accessibility organization
aur/linux-aarch64-raspberrypi 4.19.76.r791998.gf1da5f42022d-2 [2 / 0.000080]
/src/pakku/src/main.nim(263) main
t/src/pakku/src/main.nim(254) run
/pakku/src/main.nim(92) handleSync
/pakku/src/feature/syncsearch.nim(53) handleSyncSearch
/pakku/src/format.nim(152) printPackageSearch
/pakku/src/format.nim(86) splitLines
/usr/lib/nim/pure/unicode.nim(322) runeOffset
/usr/lib/nim/pure/unicode.nim(62) runeLenAt
/usr/lib/nim/system/fatal.nim(49) sysFatal
Error: unhandled exception: index out of bounds, the container is empty [IndexError]

With this build, many searches work but some fail, like "linux" or "steam". No problems updating, installing or removing packages so far.

Stable releases?

I adopted the pakku package for the time being. Looking at the wiki page on plans, I think there could probably be a 0.15 release now, and fixing AUR comments and removing build dependencies could come in a later version.

@zqqw: would you like maintence of the AUR package? If not, I'm happy to keep it updated.

cstring build warnings

Lots of cstring warnings with current nim-git build, something that will probably need fixing in due course, if anyone does come up with a fix for this in the meanwhile let me know!

/tmp/pakku/pakku-git/src/pakku/src/utils.nim(326, 33) Warning: implicit conversion to 'cstring' from a non-const location: user.name; this will become a compile time error in the future [CStringConv]
/tmp/pakku/pakku-git/src/pakku/src/utils.nim(327, 37) Warning: implicit conversion to 'cstring' from a non-const location: user.name; this will become a compile time error in the future [CStringConv]
/tmp/pakku/pakku-git/src/pakku/src/utils.nim(328, 36) Warning: implicit conversion to 'cstring' from a non-const location: user.name; this will become a compile time error in the future [CStringConv]
/tmp/pakku/pakku-git/src/pakku/src/utils.nim(329, 33) Warning: implicit conversion to 'cstring' from a non-const location: user.home; this will become a compile time error in the future [CStringConv]
/tmp/pakku/pakku-git/src/pakku/src/utils.nim(330, 34) Warning: implicit conversion to 'cstring' from a non-const location: user.shell; this will become a compile time error in the future [CStringConv]

Arch binary building broken

There seems to be a redirect to gitlab, and the existing method to clone the build info dir fails, extra debug printout shows command used, not yet sure what the replacement should be, suggestions welcome:

$ pakku -Sz hexedit
(0/1) cloning repositories                                                               --:-- [c o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  o  ]   0%
/usr/bin/git -C /tmp/pakku-username clone  -q https://git.archlinux.org/svntogit/community.git -b packages/hexedit --single-branch hexedit
fatal: unable to update url base from redirection:
  asked for: https://git.archlinux.org/svntogit/community.git/info/refs?service=git-upload-pack
   redirect: https://gitlab.archlinux.org/explore/groups
(1/1) cloning repositories                                                               00:00 [--------------------------------------------------------] 100%
error: hexedit: failed to clone git repository

segfault with 1.6.8

maybe it's just me, but tried to install pakku on a fresh archlinux and it didnt compile with nim 1.6.8 (installed using choosenim)

Nim 1.5 build issues

==> Starting build()...
NIM: src/pakku
pakku/src/utils.nim(295, 34) Warning: Deprecated since 1.5; TaintedString is deprecated [Deprecated]
pakku/src/feature/syncinstall.nim(210, 52) template/generic instantiation of `createCloneProgress` from here
pakku/src/feature/syncinstall.nim(42, 3) Error: cannot instantiate: 'result:type'
make: *** [Makefile:120: src/pakku] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

Fix for TaintedString warning, but not the last bit:
diff --git a/src/utils.nim b/src/utils.nim
index 1f58b8f..5cd33f6 100644
--- a/src/utils.nim
+++ b/src/utils.nim
@@ -292,13 +292,13 @@ proc execRedirect*(args: varargs[string]): int =
     return -1
   var outp = outputStream(p)
   close(inputStream(p))
-  var line = newStringOfCap(120).TaintedString
+  var line = newStringOfCap(120)
   while true:
     if outp.readLine(line):
       if writeFlag == false:
-        echo line.string
+        echo line
       else:
-        discard write(fd[1], line.string.cstring, len(line.string))
+        discard write(fd[1], line.cstring, len(line))
         discard write(fd[1], "\n".cstring, 1)
     else:
       code = peekExitCode(p)

(TaintedString wasn't really doing much here, it got included with something that I had adapted from elsewhere)

The last bit is something related to the update/terminate closures again, and I'll also try another newer build of nim-git as that was one built on the 14th.

Not building on Arch/Mandriva

getting:

==> Updated version: pakku-git 1:0.14.r31.g334e09a-1
==> Starting build()...
GEN: completion/bash
GEN: completion/zsh
2 out of 8 hunks FAILED
make: *** [Makefile:94: completion/zsh] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
error: failed to build 'pakku-git'

pakku-git is orphaned on AUR

since kitsunyan is still mia, this is the only working pakku for our tiny niche within a niche of Nim and Arch users

would you be willing to adopt an orphan package for mere hours a month?

What are the distro specific features?

The README says options -Sn and -Sz will only work if they have distro specific support. I know @zqqw worked really hard for the Artix support, but there are some isArch, isArtix and isParabola variables defined and I am not sure how they change the behavior or what features they imply.

So, could someone list the supported extra features, by distro? I didn't even know that Pakku had Parabola only features.

Dependency changes while editing the PKGBUILD are ignored.

Hello,

Apparently dependencies are not reparsed after the editing of the dependencies, which make the said editing completely useless.
As far as I am concerned, this is one of the most common editing I do to PKGBUILD, so it would be nice to reparse the deps after editing.

Is this something that would be implemented ?

I am not a daily Nim programmer, but I think I know enough of it that I could look into implementing this if it is acceptable for you.

pakku occasionally incorrectly identifies conflicting packages

I get the following issue on upgrades occasionally:

2023-03-21-202345

I'm going to look into it more later, but I suspect that pakku is somehow taking the conflicts=("${_pkgname}") line to conflict with anything that has a provides=() entry. Very much not sure, though...

LTO - link time optimization

LTO will soon be default in Arch builds. Testing it, this new compiler option works fine with Pakku, Nim has supported it for a long while.

diff --git a/Makefile b/Makefile
index 04ce4cb..f3049bb 100644
--- a/Makefile
+++ b/Makefile
@@ -55,6 +55,8 @@ NIM_OPTIMIZE = size
 NIM_CACHE_DIR = nimcache
 
 NIM_OPTIONS = \
+       --passC:"-flto" \
+       --passL:"-flto" \
        --putenv:'PROG_VERSION'="${RVERSION}" \
        --putenv:'PROG_COPYRIGHT'="${COPYRIGHT}" \
        --putenv:'PROG_PKGLIBDIR'="${PKGLIBDIR}" \

Result, a smaller binary:
Total Installed Size:   0.74 MiB
Net Upgrade Size:      -0.12 MiB

Any way to update like Arch way?

Can this Pakku be updated the easiest/best way to like Arch update way, meant is there binary, say, pakku-s, to fetch the latest binary kept in a repo replacing current pakku one in local location, if not (yet) may ask it as user's feature request?

nim-git build error 2021-5-2

CC: tools.nim
Hint: Release build [BuildMode]
NIM: src/pakku
/pakku/src/common.nim(231, 40) template/generic instantiation of `toHashSet` from here
/usr/lib/nim/pure/collections/sets.nim(241, 33) template/generic instantiation of `incl` from here
/usr/lib/nim/pure/collections/setimpl.nim(49, 21) template/generic instantiation of `rawGet` from here
/usr/lib/nim/pure/collections/hashcommon.nim(74, 14) template/generic instantiation of `genHashImpl` from here
/usr/lib/nim/pure/collections/hashcommon.nim(64, 12) template/generic instantiation of `hash` from here
/usr/lib/nim/pure/hashes.nim(548, 30) template/generic instantiation of `hash` from here
/pakku/src/utils.nim(70, 6) Error: type mismatch: got <Option[package.VersionConstraint], proc (x: float): Hash{.inline, noSideEffect, gcsafe, locks: 0.} | proc (x: pointer): Hash{.inline, noSideEffect, gcsafe, locks: 0.} | proc (x: ptr T): Hash{.inline.} | proc (x: T: Ordinal or enum): Hash{.inline.} | proc (x: ref T): Hash{.inline.} | proc (x: openArray[A]): Hash | proc (x: set[A]): Hash | proc (x: string): Hash{.noSideEffect, gcsafe, locks: <unknown>.} | proc (x: cstring): Hash{.noSideEffect, gcsafe, locks: <unknown>.} | proc (sBuf: string, sPos: int, ePos: int): Hash{.noSideEffect, gcsafe, locks: <unknown>.} | proc (x: T: tuple or object or proc): Hash{.inline.} | proc (aBuf: openArray[A], sPos: int, ePos: int): Hash>
but expected one of: 
proc map[T, R](self: Option[T]; callback: proc (input: T): R): Option[R]
  first type mismatch at position: 2
  required type for callback: proc (input: T): R{.closure.}
  but expression 'hash' is of type: None
proc map[T](self: Option[T]; callback: proc (input: T))
  first type mismatch at position: 2
  required type for callback: proc (input: T){.closure.}
  but expression 'hash' is of type: None
2 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them

expression: map(x[2], hash)
make: *** [Makefile:120: src/pakku] Error 1
==> ERROR: A failure occurred in build().
    Aborting...

You need to modify the nim-git PKGBUILD to build it at present to get this error.

Pakku unable to find packages

It seems like something have broken with Pakku and/or AUR. I'm trying to install the GCC cross-compiler for ARM and I just get an error saying it can't find arm-linux-gnueabihf-gcc-stage2 which is evidently there. It seems to be able to find other things just fine, but not this specific package.

[peter ~ ] 16685 $ pakku -S arm-linux-gnueabihf-gcc
:: Resolving build targets...
checking AUR database for targets...
(1/1) cloning repositories                                                                                                                00:00 [########################################################################################] 100
resolving dependencies...
(1/1) cloning repositories                                                                                                                00:00 [########################################################################################] 100
(2/2) cloning repositories                                                                                                                00:00 [########################################################################################] 100
error: unable to satisfy dependency 'arm-linux-gnueabihf-gcc-stage2>=11.2.0-3' required by arm-linux-gnueabihf-glibc
โ–1โ–‹[peter ~ ] 16686 $ pakku -S arm-linux-gnueabihf-gcc-stage2
:: Resolving build targets...
checking AUR database for targets...
(1/1) cloning repositories                                                                                                                --:-- [########################################################################################] 100
error: target not found: arm-linux-gnueabihf-gcc-stage2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.