[aur-general] AurJson - orphan packages
Hi, I was wondering if there's a way to know if a package is orphan using the AurJson interface. If that's not the case, I think I will find a feature request for something like: "Uploader":"pseudonym" in "info/results", with "pseudonym" set as "orphan" if the package is orphan (I hope nobody has taken the pseudonym "orphan" on AUR...). Does that look fine to you? -- catwell
Le Sun, 13 Sep 2009 18:23:02 +0200, Pierre Chapuis <catwell@archlinux.us> a écrit :
Of course I meant: "I will file a feature request"... Another possibility might be to add a boolean like OutOfDate, but the solution I proposed would also enable scripts to find the uploader of a package, which might be useful later. As far as I'm concerned, I don't really care since I only want to know if the package is orphan... -- catwell
2009/9/14 Pierre Chapuis <catwell@archlinux.us>:
I'm CC-ing this to the aur-dev, as I think it belongs there. The following patch adds the Orphan field to the aurjson output. For username we would need to hit the database once more (maybe, have to think more SQL for that), but the Orphan-ness is quite straightforward to evaluate. So let's just do that first. This patch, however, might clash with one patch I sent in a few days ago [1], since that one hasn't been applied to the repo, yet. Anyway, neither of those are hard to see where they should go... Any comments? Cheers, Greg [1] http://mailman.archlinux.org/pipermail/aur-dev/2009-September/000868.html
Signed-off-by: Gergely Imreh <imrehg@gmail.com> --- web/lib/aurjson.class.php | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index 29fc424..85a3b89 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -19,8 +19,9 @@ include_once("aur.inc"); class AurJSON { private $dbh = false; private $exposed_methods = array('search','info'); - private $fields = array('ID','Name','Version','CategoryID','Description', - 'LocationID', 'URL','URLPath','License','NumVotes','OutOfDate'); + private $fields = array('ID','Name','Version','MaintainerUID','CategoryID', + 'Description','LocationID', 'URL','URLPath','License','NumVotes', + 'OutOfDate'); /** * Handles post data, and routes the request. @@ -139,6 +140,8 @@ class AurJSON { if ( $result && (mysql_num_rows($result) > 0) ) { $row = mysql_fetch_assoc($result); mysql_free_result($result); + $row['Orphan'] = ($row['MaintainerUID'] == "0" ? "1" : "0"); + unset($row['MaintainerUID']); return $this->json_results('info', $row); } else { -- 1.6.4.2
Le Mon, 14 Sep 2009 22:46:15 +0800, Gergely Imreh <imrehg@gmail.com> a écrit :
Looks good enough for me, since it would allow me to do what I wanted (include orphan detection in the script I use to watch the AUR packages I use). Thanks for the quick response! -- catwell
participants (2)
-
Gergely Imreh
-
Pierre Chapuis