You are not logged in.

#1 2016-02-01 12:53:54

michis
Member
Registered: 2015-12-12
Posts: 77

[Solved] AUR - search for recently orphaned packages

Is there a way to search for recently orphaned packages in the AUR?

In the web search there is no such search option, or at least I can not find it.
There is the option to list all orphaned packages. Would be nice to be able to sort it by orphan-date.

I think this could help users that want to adopt packages finding new candidates.

Last edited by michis (2016-02-02 20:01:00)

Offline

#2 2016-02-01 13:09:45

michis
Member
Registered: 2015-12-12
Posts: 77

Re: [Solved] AUR - search for recently orphaned packages

Ok, there is the option to sort by 'Last modified'.
If orphaning a package counts as a modification then sorting by last modified will do what i am looking for.

So, new question is:
Does orphaning a package count as modification that is recognized by the 'Last modified' search filter?

Offline

#3 2016-02-01 13:47:37

Spyhawk
Member
Registered: 2006-07-07
Posts: 485

Re: [Solved] AUR - search for recently orphaned packages

No. The last modified field is only updated when a new PKGBUILD is uploaded afaik.

Offline

#4 2016-02-01 18:33:45

michis
Member
Registered: 2015-12-12
Posts: 77

Re: [Solved] AUR - search for recently orphaned packages

Ok, then back to the original question...

michis wrote:

Is there a way to search for recently orphaned packages in the AUR?

Offline

#5 2016-02-01 21:55:52

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: [Solved] AUR - search for recently orphaned packages

Here's a "poor man's" way to do it. Install python3-aur and save this script as e.g. "aur-orphans":

#!/usr/bin/env python3
import AUR.RPC
aur = AUR.RPC.AUR(full_info=False)
for p in aur.get('msearch', None):
  print(p['Name'])

Use the script to create dated orphan lists:

aur-orphans.py | sort > $(date +%F).txt

Run the script again another day to generate a new list and use comm to see the new orphans:

comm -13 old_list.txt new_list.txt

It should be easy to wrap that all up in a nice little script.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#6 2016-02-01 22:08:25

michis
Member
Registered: 2015-12-12
Posts: 77

Re: [Solved] AUR - search for recently orphaned packages

smile Thanks Xyne, I'll try it out..

Offline

#7 2016-02-01 23:01:56

michis
Member
Registered: 2015-12-12
Posts: 77

Re: [Solved] AUR - search for recently orphaned packages

Xyne wrote:
aur-orphans.py | sort > $(date +%F).txt

Is the sort command necessary? Seems the output of the python script is already sorted...

Offline

#8 2016-02-01 23:52:30

michis
Member
Registered: 2015-12-12
Posts: 77

Re: [Solved] AUR - search for recently orphaned packages

ok, it is ... comm: file 1 is not in sorted order

Xyne wrote:

It should be easy to wrap that all up in a nice little script.

This is what I have so far...

#!/bin/bash

old_list=$HOME/.old-aur-orphaned.txt
new_list=$HOME/.new-aur-orphaned.txt

if [ ! -f ${old_list} ]; then
  echo "First run, creating initial list of orphaned packages."
  /usr/local/bin/aur-orphans | sort > ${old_list}
  exit 0
fi

echo "Creating list of current orphaned packages"
/usr/local/bin/aur-orphans | sort > ${new_list}

echo "Orphaned packages since last run:"
comm -13 ${old_list} ${new_list}
mv ${new_list} ${old_list}

Thanks again.

Last edited by michis (2016-02-01 23:53:55)

Offline

#9 2016-02-02 00:10:48

michis
Member
Registered: 2015-12-12
Posts: 77

Re: [Solved] AUR - search for recently orphaned packages

Replaced your python script with cower

#!/bin/bash

old_list=$HOME/.old-aur-orphaned.txt
new_list=$HOME/.new-aur-orphaned.txt

if [ ! -f ${old_list} ]; then
  echo "First run, creating initial list of orphaned packages."
  cower -qm "" | sort > ${old_list}
  exit 0
fi

echo "Creating list of current orphaned packages"
cower -qm "" | sort > ${new_list}

echo "Orphaned packages since last run:"
comm -13 ${old_list} ${new_list}
mv ${new_list} ${old_list}

This should work i think, but I am wondering if it's worth to file a feature request for an option to sort orphaned packages by orphan-date in the AUR web-interface?

Offline

#10 2016-02-02 00:49:17

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: [Solved] AUR - search for recently orphaned packages

michis wrote:

Replaced your python script with cower

Just in case it was because of the speed, I have added an option to increase it in the backend. It's now consistently just a little faster at retrieving the list than cower on my system tongue

Anyway, use whatever works best for you.

edit
And yeah, post a request to the aur-dev mailing list. There are a few ideas under consideration for the RPC interface so now is the time to throw your own into the mix.

Last edited by Xyne (2016-02-02 00:51:11)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#11 2016-02-02 12:46:11

michis
Member
Registered: 2015-12-12
Posts: 77

Re: [Solved] AUR - search for recently orphaned packages

Xyne wrote:
michis wrote:

Replaced your python script with cower

Just in case it was because of the speed, ...

The reason was: only one script, only one extra package (cower) needed. wink

Xyne wrote:

And yeah, post a request to the aur-dev mailing list. There are a few ideas under consideration for the RPC interface so now is the time to throw your own into the mix.

Maybe i'll do it, yet undecided.

Little improvement of the output.
Now it prints highlighted package names and the package descriptions.

#!/bin/bash
#
# This script lists new orphaned AUR packages since it's last execution.
# Dependencies: coreutils grep cower

old_list=$HOME/.old-aur-orphaned.txt
new_list=$HOME/.new-aur-orphaned.txt

if [ ! -f ${old_list} ]; then
  echo "First run, creating initial list of orphaned packages."
  cower -qm "" | sort > ${old_list}
  exit 0
fi

echo "Creating list of current orphaned packages"
cower -qm "" | sort > ${new_list}
orphans=$(comm -13 ${old_list} ${new_list})

echo "Orphaned packages since last run:"
cower --color=always -i ${orphans} 2>/dev/null | grep -E "Name|Description"

mv ${new_list} ${old_list}

EDIT: Since the script works for me now, I'll mark the thread as solved.

Last edited by michis (2016-02-02 20:00:39)

Offline

Board footer

Powered by FluxBB