You are not logged in.

#1 2018-10-07 19:31:44

NuSkool
Member
Registered: 2015-03-23
Posts: 76

Pacman tips and tricks wiki error?

An error in the command? Error caused by different awk, gawk, versions, features? Error in my system setup?

Tried using the provided example with the following results. Would the reworked command fix this in all situations or did I just get lucky?

Wiki quote: https://wiki.archlinux.org/index.php/Pa … l_packages

Dependencies are alphabetically sorted and doubles are removed.
----
$ pacman -Si packages | awk -F'[:<=>]' '/^Depends/ {print $2}' | xargs -n1 | sort -u

My systems awk:

$ which awk
/usr/bin/awk

$ file /usr/bin/awk
/usr/bin/awk: symbolic link to gawk

$ pacman -Q gawk
gawk 4.2.1-1

Info on example package:

$ pacman -Si bash
Repository      : core
Name            : bash
Version         : 4.4.023-1
Description     : The GNU Bourne Again shell
Architecture    : x86_64
URL             : http://www.gnu.org/software/bash/bash.html
Licenses        : GPL
Groups          : base
Provides        : sh
Depends On      : readline>=7.0  glibc  ncurses
Optional Deps   : bash-completion: for tab completion
Conflicts With  : None
Replaces        : None
Download Size   : 1428.30 KiB
Installed Size  : 7321.00 KiB
Packager        : Bartlomiej Piotrowski <bpiotrowski@archlinux.org>
Build Date      : Mon 04 Jun 2018 01:54:11 AM PDT
Validated By    : MD5 Sum  SHA-256 Sum  Signature

The example command output:

$ pacman -Si bash | awk -F'[:<=>]' '/^Depends/ {print $2}' | xargs -n1 | sort -u
readline

Reworked command output:

$ pacman -Si bash | awk -F':' '/^Depends/ {gsub (/[<>.=0-9]/, "") ; print $2}' | xargs -n1 | sort -u
glibc
ncurses
readline

Offline

#2 2018-10-07 19:45:12

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 26,199
Website

Re: Pacman tips and tricks wiki error?

Works for me...

┌─[Veles ~]
└─╼ pacman -Si xterm | awk -F'[:<=>]' '/^Depends/ {print $2}' | xargs -n1 | sort -u
libutempter
libxaw
libxft
libxkbfile
ncurses
xbitmaps
xorg-luit
┌─[Veles ~]
└─╼ pacman -Q gawk
gawk 4.2.1-1

Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#3 2018-10-07 19:51:18

NuSkool
Member
Registered: 2015-03-23
Posts: 76

Re: Pacman tips and tricks wiki error?

I think it may only be a problem with versioned dep's. Try running it on bash?

Offline

#4 2018-10-07 19:57:43

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 2,527

Re: Pacman tips and tricks wiki error?

$ expac -l '\n' -S '%D' bash 
readline>=7.0
glibc
ncurses

Works for me, whether the package has versioned deps or not.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2018-10-07 20:00:03

NuSkool
Member
Registered: 2015-03-23
Posts: 76

Re: Pacman tips and tricks wiki error?

Lol, yea that works but what about the awk example?

Offline

#6 2018-10-07 20:18:18

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 2,527

Re: Pacman tips and tricks wiki error?

The purpose of the awk example is apparently to show you all dependencies up to and including the first one with a versioned dep. It treats anything after a [<=>] as field $3 which it explicitly does not print.

No, I have no idea why that's useful. I guess you can ask Alad, he thinks it's "simpler": https://wiki.archlinux.org/index.php?ti … did=428751


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB