Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] emerge world -Du <= how to return pkg atom only
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
honeymak
Guru
Guru


Joined: 30 Dec 2002
Posts: 564

PostPosted: Mon Aug 05, 2024 12:53 am    Post subject: [solved] emerge world -Du <= how to return pkg atom only Reply with quote

Code:

These are the packages that would be merged, in order:

Calculating dependencies  .. .... ... done!
Dependency resolution took 54.66 s (backtrack: 0/20).

[ebuild     U  ] dev-python/ensurepip-setuptools-71.0.4::gentoo [70.3.0::gentoo] 2287 KiB
[ebuild     U  ] dev-lang/rust-bin-1.79.0:stable::gentoo [1.77.1:stable::gentoo] USE="rustfmt (-big-endian) -clippy -doc (-prefix) -profiler -rust-analyzer -rust-src -verify-sig" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="sse2" 161148 KiB
[ebuild     U  ] virtual/rust-1.79.0:0/llvm-18::gentoo [1.77.1:0/llvm-17::gentoo] USE="rustfmt -profiler" ABI_X86="(64) -32 (-x32)" 0 KiB
[ebuild     U  ] dev-lang/yasm-1.3.0-r2::gentoo [1.3.0-r1::gentoo] USE="nls" 0 KiB
[ebuild     U  ] dev-python/jaraco-text-3.14.0::gentoo [3.12.1::gentoo] USE="-test" PYTHON_TARGETS="python3_12 (-pypy3) -python3_10 -python3_11 (-python3_13)" 17 KiB
[ebuild     U  ] dev-lang/nasm-2.16.03::gentoo [2.16.01-r1::gentoo] USE="-doc" 1009 KiB
[ebuild     U  ] dev-libs/libinput-1.26.1:0/10::gentoo [1.25.0:0/10::gentoo] USE="-doc -test" INPUT_DEVICES="-wacom" 805 KiB
[ebuild     U  ] dev-python/setuptools-71.0.4::gentoo [70.3.0::gentoo] USE="-test" PYTHON_TARGETS="python3_12 (-pypy3) -python3_10 -python3_11 (-python3_13)" 2366 KiB
[ebuild     U  ] dev-lang/spidermonkey-115.13.0:115::gentoo [115.10.0:115::gentoo] USE="jit -clang -debug -lto -test" 498605 KiB
[ebuild     U  ] dev-libs/elfutils-0.191-r1::gentoo [0.190::gentoo] USE="bzip2 nls utils -debuginfod -lzma -static-libs -test -verify-sig -zstd" ABI_X86="(64) -32 (-x32)" 9092 KiB
[ebuild     U  ] media-libs/raptor-2.0.16:2::gentoo [2.0.15-r8:2::gentoo] USE="-debug -json -static-libs (-curl%*)" ABI_X86="(64) -32 (-x32)" 1710 KiB
[ebuild     U  ] x11-libs/libdrm-2.4.122::gentoo [2.4.121::gentoo] USE="udev -test -tools -valgrind" ABI_X86="(64) -32 (-x32)" VIDEO_CARDS="amdgpu intel nouveau radeon vmware (-exynos) (-freedreno) (-omap) (-tegra) (-vc4) (-vivante)" 470 KiB
[ebuild     U  ] net-wireless/bluez-5.77:0/3::gentoo [5.76-r1:0/3::gentoo] USE="cups mesh obex readline udev -btpclient -debug -deprecated -doc -experimental -extra-tools -midi (-selinux) -systemd -test -test-programs" ABI_X86="(64) -32 (-x32)" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11 (-python3_13)" 2376 KiB
[ebuild     U  ] app-editors/vscode-1.92.0::gentoo [1.91.1::gentoo] USE="egl wayland -kerberos" 141328 KiB

Total: 14 packages (14 upgrades), Size of downloads: 821207 KiB


normal emerge world -Du return this output
how to get the pkg atom only in the output?

or any other equivalent portage cmd can output updates with pkg atom or some sort of format text only?

:oops:
_________________
hackers - make sth real
academics - read sth said to be real


Last edited by honeymak on Wed Aug 07, 2024 7:52 am; edited 2 times in total
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 357

PostPosted: Mon Aug 05, 2024 1:55 am    Post subject: Reply with quote

Maybe something like this
Code:
emerge -puDq @world | awk '{print $NF}'
Back to top
View user's profile Send private message
honeymak
Guru
Guru


Joined: 30 Dec 2002
Posts: 564

PostPosted: Mon Aug 05, 2024 2:00 am    Post subject: Reply with quote

that's not pkg atom
:roll:
_________________
hackers - make sth real
academics - read sth said to be real
Back to top
View user's profile Send private message
bstaletic
Guru
Guru


Joined: 05 Apr 2014
Posts: 357

PostPosted: Mon Aug 05, 2024 2:12 am    Post subject: Reply with quote

You're right. Does this work for you?
Code:
 emerge -puDq @world | sed 's/.*\] //;s/ \[.*\]$//'
Back to top
View user's profile Send private message
honeymak
Guru
Guru


Joined: 30 Dec 2002
Posts: 564

PostPosted: Mon Aug 05, 2024 2:16 am    Post subject: Reply with quote

that's not pkg atom either

:oops:
_________________
hackers - make sth real
academics - read sth said to be real
Back to top
View user's profile Send private message
spikyatlinux
n00b
n00b


Joined: 18 Sep 2010
Posts: 38

PostPosted: Mon Aug 05, 2024 7:24 am    Post subject: Reply with quote

Perhaps try

Code:
emerge -Du @world | grep '\[ebuild' | awk '{print $4}'
should output cat/pkg-version, or
Code:
emerge -Du @world | grep '\[ebuild' | awk '{print $4}' | sed 's/-[0-9].*//'
same without version

Regards
Back to top
View user's profile Send private message
honeymak
Guru
Guru


Joined: 30 Dec 2002
Posts: 564

PostPosted: Mon Aug 05, 2024 8:04 am    Post subject: Reply with quote

pls read what pkg atom is
and sometimes it's alphanumeric

so your answer is simply wrong
:oops: :P 8) :roll:
_________________
hackers - make sth real
academics - read sth said to be real
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20476

PostPosted: Mon Aug 05, 2024 3:39 pm    Post subject: Reply with quote

For simplicity, this includes version, slot, and repo.
Code:
$ awk '/ebuild/ {print $4}' data.tmp
dev-python/ensurepip-setuptools-71.0.4::gentoo
dev-lang/rust-bin-1.79.0:stable::gentoo
virtual/rust-1.79.0:0/llvm-18::gentoo
dev-lang/yasm-1.3.0-r2::gentoo
dev-python/jaraco-text-3.14.0::gentoo
dev-lang/nasm-2.16.03::gentoo
dev-libs/libinput-1.26.1:0/10::gentoo
dev-python/setuptools-71.0.4::gentoo
dev-lang/spidermonkey-115.13.0:115::gentoo
dev-libs/elfutils-0.191-r1::gentoo
media-libs/raptor-2.0.16:2::gentoo
x11-libs/libdrm-2.4.122::gentoo
net-wireless/bluez-5.77:0/3::gentoo
app-editors/vscode-1.92.0::gentoo
I'm not sure why that works because there are certainly more than 4 spaces before the atom begins. I'd also expect it to change depending on the number of "flags" within the [ebuild ...] sections. I guess it sees each group of spaces as 1. But that isn't reliable given the potential output from emerge.

This seems likely to be more reliable:
Code:
$ awk '/ebuild/ { s=substr($0, 18); e=match(s, " "); print substr(s, 0, e) }' data.tmp
dev-python/ensurepip-setuptools-71.0.4::gentoo
dev-lang/rust-bin-1.79.0:stable::gentoo
virtual/rust-1.79.0:0/llvm-18::gentoo
dev-lang/yasm-1.3.0-r2::gentoo
dev-python/jaraco-text-3.14.0::gentoo
dev-lang/nasm-2.16.03::gentoo
dev-libs/libinput-1.26.1:0/10::gentoo
dev-python/setuptools-71.0.4::gentoo
dev-lang/spidermonkey-115.13.0:115::gentoo
dev-libs/elfutils-0.191-r1::gentoo
media-libs/raptor-2.0.16:2::gentoo
x11-libs/libdrm-2.4.122::gentoo
net-wireless/bluez-5.77:0/3::gentoo
app-editors/vscode-1.92.0::gentoo


EDIT: This drops the slot and repo from the output.
Code:
awk '/ebuild/ { s=substr($0, 18); e=match(s, ":")-1; print substr(s, 0, e) }'

_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9605
Location: beyond the rim

PostPosted: Mon Aug 05, 2024 5:30 pm    Post subject: Reply with quote

honeymak wrote:
pls read what pkg atom is

Well, you can create many very different atoms for any given CPV entry (which is what emerge output contains). Maybe be a bit more specific what you're looking for (generic like cat/pkg, or very specific like =cat/pkg-ver:slot/subslot::repo[conditions] ).
Back to top
View user's profile Send private message
spikyatlinux
n00b
n00b


Joined: 18 Sep 2010
Posts: 38

PostPosted: Mon Aug 05, 2024 6:07 pm    Post subject: Reply with quote

honeymak wrote:
pls read what pkg atom is
and sometimes it's alphanumeric

so your answer is simply wrong
:oops: :P 8) :roll:


manpage says
Code:
Atom Bases
              The base atom is just a full category/packagename. Another name for a full category/packagename is a "catpkg". You will find this shorthand-name used frequently in Gentoo. Here are some base atoms, a.k.a "catpkgs":

                   net-misc/dhcp
                   sys-apps/sed
                   sys-libs/zlib

       Atom Versions
              It is nice to be more specific and say that only certain versions of atoms are acceptable.  Note that versions must be combined with a prefix (see below).  Hence you may add a version number as a postfix to the base.

              Examples:
                   sys-apps/sed-4.0.5
                   sys-libs/zlib-1.1.4-r1
                   net-misc/dhcp-3.0_p2

              Versions are normally made up of two or three numbers separated by periods, such as 1.2 or 4.5.2.  This string may be followed by a character such as 1.2a or 4.5.2z.  Note that this letter is  not  meant  to  indicate  alpha,
              beta,  etc...  status.   For  that,  use  the  optional  suffix; either _alpha, _beta, _pre (pre-release), _rc (release candidate), or _p (patch).  This means for the 3rd pre-release of a package, you would use something like
              1.2_pre3.  The suffixes here can be arbitrarily chained without limitation.

       Atom Prefix Operators [> >= = <= <]
              Sometimes you want to be able to depend on general versions rather than specifying exact versions all the time.  Hence we provide standard boolean operators:

              Examples:
                   >media-libs/libgd-1.6
                   >=media-libs/libgd-1.6
                   =media-libs/libgd-1.6
                   <=media-libs/libgd-1.6
                   <media-libs/libgd-1.6

       Extended Atom Prefixes [!~] and Postfixes [*]
              Now to get even fancier, we provide the ability to define blocking packages and version range matching.  Also note that these extended prefixes/postfixes may be combined in any way with the atom classes defined above.

              ~      means match any revision of the base version specified.  So in the example below, we would match versions ’1.0.2a’, ’1.0.2a-r1’, ’1.0.2a-r2’, etc...

                     Example:
                          ~net-libs/libnet-1.0.2a

              !      means block packages from being installed at the same time.

                     Example:
                          !app-text/dos2unix

              !!     means block packages from being installed at the same time and explicitly disallow them from being temporarily installed simultaneously during a series of upgrades. This syntax is supported beginning with EAPI 2.

                     Example:
                          !!<sys-apps/portage-2.1.4_rc1

              *      means match any version of the package so long as the specified base is matched.  So with a version of ’2*’, we can match ’2.1’, ’2.2’, ’2.2.1’, etc... and not match version ’1.0’, ’3.0’, ’4.1’, etc... The version part                     that comes before the ’*’ must be a valid version in the absence of the ’*’.  For example, ’2’ is a valid version and ’2.’ is not. Therefore, ’2*’ is allowed and ’2.*’ is not.

                     Examples:
                          =dev-libs/glib-2*
                          !=net-fs/samba-2*

       Atom Slots
              Beginning with EAPI 1, any atom can be constrained to match a specific SLOT. This is accomplished by appending a colon followed by a SLOT:

              Examples:
                   x11-libs/qt:3
                   ~x11-libs/qt-3.3.8:3
                   >=x11-libs/qt-3.3.8:3
                   =x11-libs/qt-3.3*:3
and so on so please describe what you need exactly, perhaps with an example :lol:
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3683
Location: Rasi, Finland

PostPosted: Mon Aug 05, 2024 9:17 pm    Post subject: Reply with quote

Code:
awk -v 'FS=[\\]\\[]' '($3 != "") {print $3}'

_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
honeymak
Guru
Guru


Joined: 30 Dec 2002
Posts: 564

PostPosted: Mon Aug 05, 2024 10:53 pm    Post subject: Reply with quote

anyway
that means emerge does not return pkg atom easily

:cry:
_________________
hackers - make sth real
academics - read sth said to be real
Back to top
View user's profile Send private message
kimchi_sg
Advocate
Advocate


Joined: 26 Nov 2004
Posts: 3038

PostPosted: Mon Aug 05, 2024 11:36 pm    Post subject: Reply with quote

honeymak wrote:
anyway
that means emerge does not return pkg atom easily

:cry:

Code:
# portageq
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22598

PostPosted: Mon Aug 05, 2024 11:59 pm    Post subject: Reply with quote

You were asked above what you are trying to achieve. I suggest you answer that. You seem to have a very particular set of requirements for what you think constitutes a valid answer, and explaining why you want this at all may help us satisfy your requirements.
Back to top
View user's profile Send private message
honeymak
Guru
Guru


Joined: 30 Dec 2002
Posts: 564

PostPosted: Tue Aug 06, 2024 12:05 am    Post subject: Reply with quote

nope
this is not what i wanted either

:cry:
_________________
hackers - make sth real
academics - read sth said to be real
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22598

PostPosted: Tue Aug 06, 2024 12:37 am    Post subject: Reply with quote

You want us to keep guessing blindly until we find the specific package format you want?
Back to top
View user's profile Send private message
honeymak
Guru
Guru


Joined: 30 Dec 2002
Posts: 564

PostPosted: Tue Aug 06, 2024 12:50 am    Post subject: Reply with quote

ooooops.......that means no solution to me already
so just keep it that way

:cry:

just close this thread
_________________
hackers - make sth real
academics - read sth said to be real
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20476

PostPosted: Tue Aug 06, 2024 3:25 am    Post subject: Reply with quote

Guess what I want because I won't tell you.

:lol:

You can edit the topic and add something to the title to indicate that it is closed or whatever you like.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3683
Location: Rasi, Finland

PostPosted: Tue Aug 06, 2024 5:51 pm    Post subject: Reply with quote

Darn. Topic kinda ended already. :(

However since I'm in the mood, I improved my earlier awk command - it now prints ==> <newversion> at the end if the package in question is going to be up- or downgraded:
Code:
awk -v 'FS=[\\]\\[]' '($3 != "") {printf substr($3,2,length($3)-1); if ($4 != "") print " ==> " $4; else print ""}'
Probably fails if used with --verbose or --quiet.
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9605
Location: beyond the rim

PostPosted: Tue Aug 06, 2024 8:35 pm    Post subject: Reply with quote

honeymak wrote:
anyway
that means emerge does not return pkg atom easily

When you don't specify which type of atom you're looking for (or for what purpose), then of course not.
Back to top
View user's profile Send private message
honeymak
Guru
Guru


Joined: 30 Dec 2002
Posts: 564

PostPosted: Tue Aug 06, 2024 11:47 pm    Post subject: Reply with quote

for example,

Code:

app-crypt/gcr


this is a pkg atom
but when you check this atom, most of the time it has 2 pkgs installed/returned as a result to you

while other pkg atom cases return with some alphanumeric pattern and some return more than one version installed (maybe slot or maybe not)

:oops:
_________________
hackers - make sth real
academics - read sth said to be real
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3836

PostPosted: Wed Aug 07, 2024 6:04 am    Post subject: Reply with quote

Imho, processing output with qatom command from app-portage/portage-utils should do the trick.
Code:
The following fields are supported, which  are  inline  with  the
              variables from ebuild(5).

              CATEGORY
                     The category of the package.

              P      The package name and version without the ebuild revision.

              PN     The package name.

              PV     The package version without the ebuild revision.

              PVR    The  package  version  including ebuild revision, which is
                     also printed when zero, unlike for PF.

              PF     The package name, version  and  revision  when  not  zero.
                     Thus, a zero revision -r0 is not printed.

              PR     The  ebuild revision, when force printed, outputs -r0 when
                     unset.

              SLOT   The package slot, when force printed, outputs -  when  un‐
                     set.

              REPO   The package repository.

              pfx    The package prefixes, that is version specifiers.

              sfx    The package suffices, currently that is just the asterisk.
Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
honeymak
Guru
Guru


Joined: 30 Dec 2002
Posts: 564

PostPosted: Wed Aug 07, 2024 6:11 am    Post subject: Reply with quote

then how to use qatom with the output of emerge world -Dupv?

8) :oops: :roll:
_________________
hackers - make sth real
academics - read sth said to be real
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3836

PostPosted: Wed Aug 07, 2024 6:48 am    Post subject: Reply with quote

Template to get on the right track:
Code:
emerge -Dup @world 2>/dev/null|grep '\[ebuild'|awk '{print $4}'|while read line;do qatom -F '%{CATEGORY} %{PN}' $line;done
EDIT: one pipe less;
Code:
emerge -Dup @world 2>/dev/null|awk '/\[ebuild/{print $4}'|while read line;do qatom -F '%{CATEGORY} %{PN}' $line;done
EDIT2: even simpler;
Code:
emerge -Dup @world 2>/dev/null|awk '/\[ebuild/{print $4}'|xargs qatom -F '%{CATEGORY} %{PN}'
Can't say more with what seems specified as a requirement.

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3683
Location: Rasi, Finland

PostPosted: Wed Aug 07, 2024 7:43 am    Post subject: Reply with quote

honeymak wrote:
for example,

Code:

app-crypt/gcr
Code:
emerge -pDu | awk -v 'FS=[\\]\\[]' '($3 != "") {print $3}' | xargs qatom --format '%{CATEGORY}/%{PN}'
Does this work for you?
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum