You are not logged in.

#1 2006-09-17 15:26:43

test1000
Member
Registered: 2005-04-03
Posts: 834

ID for a given pkgname with AUR

How do I download _comments_ for X package in AUR? Maybe what I need to know is how do I translate 'packagename' to http://aur.archlinux.org/packages.php?d … =1&ID=2243 << correct number

I mean i want the ID for a given pkgname if that was no very clear.

This so I can add it to yaourt, and don't have to check the comments section in aur with a browser since many times, fixes are posted there...


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#2 2006-09-17 19:21:54

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: ID for a given pkgname with AUR

The ID are assigned in the order that the packages are first submitted to AUR. In your example, x-develop was the 2243rd package submitted to AUR. I can't think of any way to translate the pkgname to ID except by keeping a list of all the packages in AUR with their corresponding ID.

Offline

#3 2006-09-17 19:45:42

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: ID for a given pkgname with AUR

Snowman wrote:

ID except by keeping a list of all the packages in AUR with their corresponding ID.

I believe when I built the original version of aurbuild, I used the search function and scraped the ID from an URL in the link.

Yeah, see here:
http://wiki.archlinux.org/index.php?tit … 2#aurbuild

page="http://aur.archlinux.org/packages.php?K=" + name
reg="'/packages.php><span>" + name
ID=getsubstring(page, reg, "ID=", "&")

However, Penguin has probably come up with a much better way to do it, so I'd check the sources of his version of aurbuild. The primary issue is that span class='black' -- I don't think that works for safe or flagged packages (green, red).

Dusty

Offline

#4 2006-09-17 20:32:33

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: ID for a given pkgname with AUR

after you do the basic keyword search, parse the results page in data1 and data2 groups. For each of those groups you can get the full id url (direct link to the package main page) by matching >pkgnames[0-9].*

Offline

#5 2006-09-17 21:34:35

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: ID for a given pkgname with AUR

thanks guys, got it working. I didn't look at what is data1 and data2 but this worked:

data1=`lynx -nolist -source "http://aur.archlinux.org/packages.php?K=${PKG}"|grep data1`

aurID=`echo "$data1"|egrep -o "ID.*${PKG}"|cut -c 4-|cut -c -4`

lynx -dump -nolist "http://aur.archlinux.org/packages.php?do_Details=1&ID=${aurID}"|sed -n '/Comments$/,/Add Comment$/p'|sed 's/pad.gif//'

i suppose it would be even neater with color coding etc, but that will have to be looked at another time smile

edit: changed it to be a bit neater

lynx -dump -nolist "http://aur.archlinux.org/packages.php?do_Details=1&ID=${aurID}"|sed -n '/Comments$/,/Add Comment$/p'|sed 's/pad.gif//'|sed 's/Comment by:/^[[1;37mComment by:^[[1;39m/g'|sed 's/[]//g'|sed 's/  Comments//'|sed 's/Add Comment//'

Although i'd rather the whole 'Comment by: username' line was in another color, but i'm not so good with sed/regexp. Suggestions welcome smile


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

Board footer

Powered by FluxBB