[aur-dev] [PATCH] Add support for TU ninja edits
Trusted Users now have the ability to overwrite packages without changing ownership. This allows for adding small fixes to PKGBUILDs without disowning the package. Implements FS#32807. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgsubmit.php | 10 ++++++++-- web/lib/aur.inc.php | 5 +++++ web/lib/pkgbasefuncs.inc.php | 7 ++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index f07580b..969eb35 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -346,9 +346,15 @@ if ($uid): * base, the database ID needs to be preserved * so that any votes are retained. */ - $was_orphan = (pkgbase_maintainer_uid($base_id) === NULL); + $maintainer_uid = pkgbase_maintainer_uid($base_id); + $was_orphan = ($maintainer_uid === NULL); - pkgbase_update($base_id, $pkgbase_info['pkgbase'], $uid); + if ($was_orphan) { + /* Adopt orphan packages. */ + $maintainer_uid = $uid; + } + + pkgbase_update($base_id, $pkgbase_info['pkgbase'], $maintainer_uid, $uid); if ($category_id > 1) { pkgbase_update_category($base_id, $category_id); diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index ff46455..9fc3378 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -293,6 +293,11 @@ function html_footer($ver="") { * @return int 0 if the user can't submit, 1 if the user can submit */ function can_submit_pkgbase($name="", $sid="") { + $atype = account_from_sid($_COOKIE["AURSID"]); + if ($atype == "Trusted User" || $atype == "Developer") { + return 1; + } + if (!$name || !$sid) {return 0;} $dbh = DB::connect(); $q = "SELECT MaintainerUID "; diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php index 9f80ef2..9dbdff6 100644 --- a/web/lib/pkgbasefuncs.inc.php +++ b/web/lib/pkgbasefuncs.inc.php @@ -934,17 +934,18 @@ function pkgbase_create($name, $category_id, $uid) { * * @param string $name Name of the updated package base * @param int $base_id The package base ID of the affected package - * @param int $uid User ID of the package uploader + * @param int $maintainer_uid User ID of the package mainainer + * @param int $packager_uid User ID of the package uploader * * @return void */ -function pkgbase_update($base_id, $name, $uid) { +function pkgbase_update($base_id, $name, $maintainer_uid, $packager_uid) { $dbh = DB::connect(); $q = sprintf("UPDATE PackageBases SET " . "Name = %s, ModifiedTS = UNIX_TIMESTAMP(), " . "MaintainerUID = %d, PackagerUID = %d, OutOfDateTS = NULL " . "WHERE ID = %d", - $dbh->quote($name), $uid, $uid, $base_id); + $dbh->quote($name), $maintainer_uid, $packager_uid, $base_id); $dbh->exec($q); } -- 1.9.3
On 31.05.2014 12:04, Lukas Fleischer wrote:
Trusted Users now have the ability to overwrite packages without changing ownership. This allows for adding small fixes to PKGBUILDs without disowning the package.
This sounds like it is bound to cause regressions. I keep my aur packages in a git repo and if updates come I do my work there. Ninja edits will only really be useful if the maintainer isn't responsive so chances are they won't even notice the edit. Next time they bump the package they probably won't add the ninja edit so it will be lost.
On 31/05/14 09:18 AM, Florian Pritz wrote:
On 31.05.2014 12:04, Lukas Fleischer wrote:
Trusted Users now have the ability to overwrite packages without changing ownership. This allows for adding small fixes to PKGBUILDs without disowning the package.
This sounds like it is bound to cause regressions.
I keep my aur packages in a git repo and if updates come I do my work there. Ninja edits will only really be useful if the maintainer isn't responsive so chances are they won't even notice the edit. Next time they bump the package they probably won't add the ninja edit so it will be lost.
It can send a notification email with the diff if it doesn't already do that.
On 31.05.2014 15:24, Daniel Micay wrote:
On 31/05/14 09:18 AM, Florian Pritz wrote:
I keep my aur packages in a git repo and if updates come I do my work there. Ninja edits will only really be useful if the maintainer isn't responsive so chances are they won't even notice the edit. Next time they bump the package they probably won't add the ninja edit so it will be lost.
It can send a notification email with the diff if it doesn't already do that.
You think people are going to read that if they don't read other messages? Or is this features supposed to be used without first trying to get the maintainer to fix the package? (e.g. send them a mail)
On 31/05/14 09:34 AM, Florian Pritz wrote:
On 31.05.2014 15:24, Daniel Micay wrote:
On 31/05/14 09:18 AM, Florian Pritz wrote:
I keep my aur packages in a git repo and if updates come I do my work there. Ninja edits will only really be useful if the maintainer isn't responsive so chances are they won't even notice the edit. Next time they bump the package they probably won't add the ninja edit so it will be lost.
It can send a notification email with the diff if it doesn't already do that.
You think people are going to read that if they don't read other messages? Or is this features supposed to be used without first trying to get the maintainer to fix the package? (e.g. send them a mail)
One use case would be updating a package before the maintainer gets around to it. Security vulnerabilities make prompt updates very important, and a maintainer lagging a bit behind now and then isn't enough of a reason to disown the package.
On Sat, 31 May 2014 at 15:18:20, Florian Pritz wrote:
On 31.05.2014 12:04, Lukas Fleischer wrote:
Trusted Users now have the ability to overwrite packages without changing ownership. This allows for adding small fixes to PKGBUILDs without disowning the package.
This sounds like it is bound to cause regressions.
I keep my aur packages in a git repo and if updates come I do my work there. Ninja edits will only really be useful if the maintainer isn't responsive so chances are they won't even notice the edit. Next time they bump the package they probably won't add the ninja edit so it will be lost.
Agreed, I will discard this patch. The feature can still be added after switching to Git repositories. Users will then notice ninja edits because Git refuses to do non-fast-forwards by default (and non-fast-forwards will be disabled on the server anyway).
participants (3)
-
Daniel Micay
-
Florian Pritz
-
Lukas Fleischer