[arch-projects] [AUR] Querying package ID from main repo
I'd really like to be able to pull package ID numbers from the main site DB and put that in the AUR. From what I see, it seems like a simple SELECT statement (prefixed by a db_connect() or select_db() if on the same host). It's pretty trivial, and since handing out dumps of the main repo db just seems to be a no-no, how about someone look through the main site's code and finding that statement and throwing it in? For the record, I don't care about searching for packages on the search page, just being able to pull the ID of the package so I can provide a good link to the dependencies is enough (current method just searches, seems kinda half-assed). If I had a db dump/site code, here's sort of what I'd implement: db_connect( ... ); $q = "SELECT ID FROM Packages WHERE Name = 'pkgname'"; // table/columns may differ db_query($q); that should give a numerical result which I can link directly to on the package page, eg http://archlinux.org/packages/13418 If anyone can pull out the package ID, i can show what to change in the AUR (trivial really). - tardo
On 10/24/07, tardo <tardo@nagi-fanboi.net> wrote:
I'd really like to be able to pull package ID numbers from the main site DB and put that in the AUR. From what I see, it seems like a simple SELECT statement (prefixed by a db_connect() or select_db() if on the same host). It's pretty trivial, and since handing out dumps of the main repo db just seems to be a no-no, how about someone look through the main site's code and finding that statement and throwing it in?
Are you suggesting we grant the aur access to the primary site database so it can pull package data itself? I really don't like that idea, and for two reasons. 1. It is too tightly coupled. If the aur were ever to move to another host, it would fail. 2. From a security standpoint, it isn't optimal.
For the record, I don't care about searching for packages on the search page, just being able to pull the ID of the package so I can provide a good link to the dependencies is enough (current method just searches, seems kinda half-assed).
What are you talking about? Just getting a link on the aur page for the upstream package depends?
that should give a numerical result which I can link directly to on the package page, eg http://archlinux.org/packages/13418 If anyone can pull out the package ID, i can show what to change in the AUR (trivial really).
That would only be a one time solution. A single DB dump is probably not the answer. *thinking out loud* Maybe something similar to the aurjson functionality I wrote for the aur that is in my aur devel branch. A name goes in, and some very simple package data comes out (id being one of them)....hmm..but that would be more requests, since it would happen on page load instead of when(if) the user clicks the link. I say we just stick with the current search mechanism for now, and just think about this one some more.
eliott wrote:
On 10/24/07, tardo <tardo@nagi-fanboi.net> wrote:
I'd really like to be able to pull package ID numbers from the main site DB and put that in the AUR. From what I see, it seems like a simple SELECT statement (prefixed by a db_connect() or select_db() if on the same host). It's pretty trivial, and since handing out dumps of the main repo db just seems to be a no-no, how about someone look through the main site's code and finding that statement and throwing it in?
Are you suggesting we grant the aur access to the primary site database so it can pull package data itself? I really don't like that idea, and for two reasons. 1. It is too tightly coupled. If the aur were ever to move to another host, it would fail. 2. From a security standpoint, it isn't optimal.
This was actually originally contemplated, and a read-only account exists for the main db for this purpose, but has never been used. Not saying that actually makes it a good decision, just mentioning that it exists.
For the record, I don't care about searching for packages on the search page, just being able to pull the ID of the package so I can provide a good link to the dependencies is enough (current method just searches, seems kinda half-assed).
What are you talking about? Just getting a link on the aur page for the upstream package depends?
I think I'd rather attack this problem by creating a page on the main site which lets you get at a package directly by name. It more cleanly maintains the separation of the systems, and would allow any system like the AUR to be able to link to a particular package's page on the main site. But I could see some arguments for other ways, too. Just giving some input. - P
Paul Mattal wrote:
eliott wrote:
On 10/24/07, tardo <tardo@nagi-fanboi.net> wrote:
I'd really like to be able to pull package ID numbers from the main site DB and put that in the AUR. From what I see, it seems like a simple SELECT statement (prefixed by a db_connect() or select_db() if on the same host). It's pretty trivial, and since handing out dumps of the main repo db just seems to be a no-no, how about someone look through the main site's code and finding that statement and throwing it in?
Are you suggesting we grant the aur access to the primary site database so it can pull package data itself? I really don't like that idea, and for two reasons. 1. It is too tightly coupled. If the aur were ever to move to another host, it would fail. 2. From a security standpoint, it isn't optimal.
This was actually originally contemplated, and a read-only account exists for the main db for this purpose, but has never been used.
Not saying that actually makes it a good decision, just mentioning that it exists.
Granting SELECT only access to a user account is technically read-only. I'm not aware of any security implications in this, and if AUR was moved to another host, it's simply a matter of changing the host parameter in db_connect() ... (assuming remote host allows remote connections).
For the record, I don't care about searching for packages on the search page, just being able to pull the ID of the package so I can provide a good link to the dependencies is enough (current method just searches, seems kinda half-assed).
What are you talking about? Just getting a link on the aur page for the upstream package depends?
Yes. That's it.
I think I'd rather attack this problem by creating a page on the main site which lets you get at a package directly by name. It more cleanly maintains the separation of the systems, and would allow any system like the AUR to be able to link to a particular package's page on the main site.
+1 I actually just tried this right now using a hunch, and lo and behold it worked. Apparently http://archlinux.org/packages/$pkgname works (odd.. didn't work before...) - tardo
OK I realize why it didn't work before. Apparently if the pkgname has a '-' in it, it won't parse right. e.g. http://archlinux.org/packages/apache/ works http://archlinux.org/packages/gnome-icon-theme/ doesn't work. Can someone patch this? - tardo
participants (3)
-
eliott
-
Paul Mattal
-
tardo