[aur-dev] [PATCH/RFC 0/6] Promote the use of .AURINFO
Check [1] for a related discussion on aur-general. What this patch series basically does is: * Tell people to use `mkaurball` (which adds .AURINFO after building) instead of `makepkg --source`. * Show a deprecation warning when people use `makepkg --source` anyway. * Add a few changes in order to make the parser work with the slightly updated .AURINFO format used by mkaurball. Comments welcome. [1] https://mailman.archlinux.org/pipermail/aur-general/2014-January/026720.html Lukas Fleischer (6): Rename "depend" field to "depends" in .AURINFO Strip whitespace from .AURINFO lines Detect split packages from .AURINFO Promote the use of mkaurball Add a warning for packages without .AURINFO pkgsubmit.php: Improve visibility of errors web/html/pkgsubmit.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) -- 1.8.5.3
This field has been renamed in a revision of the .AURINFO format. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgsubmit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index a2ec6dd..49fb1b2 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -277,7 +277,7 @@ if ($uid): case 'pkgver': $pkg_version = $value; break; - case 'depend': + case 'depends': $depends[] = $value; break; } -- 1.8.5.3
Indentation can be useful if one wants to structure an .AURINFO file. Remove leading and trailing whitespace from each line before parsing. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgsubmit.php | 1 + 1 file changed, 1 insertion(+) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 49fb1b2..7ae0c1c 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -263,6 +263,7 @@ if ($uid): unset($pkg_version); $depends = array(); foreach (explode("\n", $srcinfo_raw) as $line) { + $line = trim($line); if (empty($line) || $line[0] == '#') { continue; } -- 1.8.5.3
There is an extension to the .AURINFO format that supports split packages. Since there is no support for split packages in the AUR so far, add a check to identify these cases. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgsubmit.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 7ae0c1c..6503c0b 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -262,6 +262,7 @@ if ($uid): # Parse .AURINFO and overwrite PKGBUILD fields accordingly unset($pkg_version); $depends = array(); + $srcinfo_pkgname_count = 0; foreach (explode("\n", $srcinfo_raw) as $line) { $line = trim($line); if (empty($line) || $line[0] == '#') { @@ -270,6 +271,11 @@ if ($uid): list($key, $value) = explode(' = ', $line, 2); switch ($key) { case 'pkgname': + $srcinfo_pkgname_count++; + if ($srcinfo_pkgname_count > 1) { + $error = __("Error - The AUR does not support split packages!"); + } + /* Fall-through case. */ case 'pkgdesc': case 'url': case 'license': -- 1.8.5.3
On Fri, Jan 17, 2014 at 11:46:26AM +0100, Lukas Fleischer wrote:
There is an extension to the .AURINFO format that supports split packages. Since there is no support for split packages in the AUR so far, add a check to identify these cases.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgsubmit.php | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 7ae0c1c..6503c0b 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -262,6 +262,7 @@ if ($uid): # Parse .AURINFO and overwrite PKGBUILD fields accordingly unset($pkg_version); $depends = array(); + $srcinfo_pkgname_count = 0; foreach (explode("\n", $srcinfo_raw) as $line) { $line = trim($line); if (empty($line) || $line[0] == '#') { @@ -270,6 +271,11 @@ if ($uid): list($key, $value) = explode(' = ', $line, 2); switch ($key) { case 'pkgname': + $srcinfo_pkgname_count++; + if ($srcinfo_pkgname_count > 1) { + $error = __("Error - The AUR does not support split packages!"); + } + /* Fall-through case. */
This should let folks get rid of hacks like 'true && pkgname=(...)', but now they'll need to fudge the .AURINFO file by removing any package after the first. Could we instead just warn that we detected a split PKGBUILD and simply merge the first found package into the pkgbase and ignore the rest?
case 'pkgdesc': case 'url': case 'license': -- 1.8.5.3
mkaurball automatically adds .AURINFO meta data when building, so tell people to use that instead of `makepkg --source`. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgsubmit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 6503c0b..5d4b917 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -477,7 +477,7 @@ html_header("Submit"); <div class="box"> <h2><?= __("Submit"); ?></h2> - <p><?= __("Upload your source packages here. Create source packages with `makepkg --source`.") ?></p> + <p><?= __("Upload your source packages here. Create source packages with `mkaurball`.") ?></p> <?php if (empty($_REQUEST['pkgsubmit']) || $error): -- 1.8.5.3
Display a deprecation warning when a package without meta data is submitted. The user can still decide to ignore that warning by resubmitting the package but doing so is not recommended. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgsubmit.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 5d4b917..9dba945 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -24,6 +24,7 @@ if ($uid): # Track upload errors $error = ""; + $ignore_missing_aurinfo = 0; if (isset($_REQUEST['pkgsubmit'])) { @@ -116,6 +117,11 @@ if ($uid): if (!$error && empty($pkgbuild_raw)) { $error = __("Error trying to unpack upload - PKGBUILD does not exist."); } + + if (!$error && empty($srcinfo_raw) && (!isset($_POST['ignore_missing_aurinfo']) || $_POST['ignore_missing_aurinfo'] != 1)) { + $ignore_missing_aurinfo = 1; + $error = __("The source package does not contain any meta data. Please use `mkaurball` to create AUR source packages. Support for source packages without .AURINFO entries will be removed in an upcoming release! You can resubmit the package if you want to proceed anyway."); + } } # if no error, get list of directory contents and process PKGBUILD @@ -492,6 +498,7 @@ html_header("Submit"); <fieldset> <div> <input type="hidden" name="pkgsubmit" value="1" /> + <input type="hidden" name="ignore_missing_aurinfo" value="<?= $ignore_missing_aurinfo ?>" /> <input type="hidden" name="token" value="<?= htmlspecialchars($_COOKIE['AURSID']) ?>" /> </div> <p> -- 1.8.5.3
Make use of the "errorlist" class instead of "pkgoutput" which is no longer defined in the CSS. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgsubmit.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 9dba945..373af35 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -477,10 +477,6 @@ html_header("Submit"); ?> -<?php if ($error): ?> - <p class="pkgoutput"><?= $error ?></p> -<?php endif; ?> - <div class="box"> <h2><?= __("Submit"); ?></h2> <p><?= __("Upload your source packages here. Create source packages with `mkaurball`.") ?></p> @@ -494,6 +490,10 @@ html_header("Submit"); $pkg_categories = pkgCategories(); ?> +<?php if ($error): ?> + <ul class="errorlist"><li><?= $error ?></li></ul> +<?php endif; ?> + <form action="<?= get_uri('/submit/'); ?>" method="post" enctype="multipart/form-data"> <fieldset> <div> -- 1.8.5.3
On Fri, Jan 17, 2014 at 11:46:29AM +0100, Lukas Fleischer wrote:
Make use of the "errorlist" class instead of "pkgoutput" which is no longer defined in the CSS.
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- web/html/pkgsubmit.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 9dba945..373af35 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -477,10 +477,6 @@ html_header("Submit");
?>
-<?php if ($error): ?> - <p class="pkgoutput"><?= $error ?></p> -<?php endif; ?> - <div class="box"> <h2><?= __("Submit"); ?></h2> <p><?= __("Upload your source packages here. Create source packages with `mkaurball`.") ?></p> @@ -494,6 +490,10 @@ html_header("Submit"); $pkg_categories = pkgCategories(); ?>
+<?php if ($error): ?> + <ul class="errorlist"><li><?= $error ?></li></ul> +<?php endif; ?> +
I'm not against this change, but I'll point out that this breaks burp's error reporting (easily fixed, of course). It'd be really nice if we could have a proper API for uploading with nicely formed responses.
<form action="<?= get_uri('/submit/'); ?>" method="post" enctype="multipart/form-data"> <fieldset> <div> -- 1.8.5.3
participants (2)
-
Dave Reisner
-
Lukas Fleischer