Varios fixes:

Added validation for the arch e license fields, so we can
ensure that new submitted packages can be built using 
pacman3. 

Fixed some pkgsubmit problems.
This commit is contained in:
dsa 2007-03-05 05:40:08 +00:00
parent 4fb43ad9ce
commit b728db0f62

View file

@ -21,6 +21,8 @@ if ($_COOKIE["AURSID"]) {
if ($DBUG) { if ($DBUG) {
print "</center><pre>\n"; print "</center><pre>\n";
print_r($_REQUEST); print_r($_REQUEST);
print "<br>";
print_r($_FILES);
print "</pre><center>\n"; print "</pre><center>\n";
} }
@ -86,13 +88,7 @@ if ($_COOKIE["AURSID"]) {
# the uploaded package file. # the uploaded package file.
# #
# Added the .tgz because the old line just moved the tmp file to $upload_file = $UPLOAD_DIR . $_FILES["pfile"]["name"];
# pkgname, but there is a problem below when it try to create the
# directory with the same name - pkgname. In linux/unix, if we
# touch a file like "touch foo" and then try to create a foo dir
# like "mkdir foo" it will give us a error. That was what happening in
# newer installations of AUR.
$upload_file = $UPLOAD_DIR . $pkg_name . ".tgz";
if (move_uploaded_file($_FILES["pfile"]["tmp_name"], $upload_file)) { if (move_uploaded_file($_FILES["pfile"]["tmp_name"], $upload_file)) {
# ok, we can proceed # ok, we can proceed
@ -114,6 +110,7 @@ if ($_COOKIE["AURSID"]) {
# its contents. # its contents.
# #
if (!$error) { if (!$error) {
if (!@mkdir($INCOMING_DIR.$pkg_name)) { if (!@mkdir($INCOMING_DIR.$pkg_name)) {
$error = __("Could not create incoming directory: %s.", $error = __("Could not create incoming directory: %s.",
array($INCOMING_DIR.$pkg_name)); array($INCOMING_DIR.$pkg_name));
@ -124,11 +121,11 @@ if ($_COOKIE["AURSID"]) {
} else { } else {
# try .gz first # try .gz first
# #
@exec("/bin/sh -c 'tar xzf ".$upload_file."'", $trash, $retval); exec("/bin/sh -c 'tar xzf ".$upload_file."'", $trash, $retval);
if (!$retval) { if (!$retval) {
# now try .bz2 format # now try .bz2 format
# #
@exec("/bin/sh -c 'tar xjf ".$upload_file."'", $trash, $retval); exec("/bin/sh -c 'tar xjf ".$upload_file."'", $trash, $retval);
} }
if (!$retval) { if (!$retval) {
$error = __("Unknown file format for uploaded file."); $error = __("Unknown file format for uploaded file.");
@ -162,7 +159,7 @@ if ($_COOKIE["AURSID"]) {
$error = __("Could not create directory %s.", $error = __("Could not create directory %s.",
array($INCOMING_DIR.$pkg_name."/".$pkg_name)); array($INCOMING_DIR.$pkg_name."/".$pkg_name));
} else { } else {
@exec("/bin/sh -c 'mv * ".$pkg_name."'"); exec("/bin/sh -c 'mv * ".$pkg_name."'");
if (!file_exists($INCOMING_DIR.$pkg_name."/".$pkg_name."/PKGBUILD")) { if (!file_exists($INCOMING_DIR.$pkg_name."/".$pkg_name."/PKGBUILD")) {
$error = __("Error exec'ing the mv command."); $error = __("Error exec'ing the mv command.");
} }
@ -301,12 +298,18 @@ if ($_COOKIE["AURSID"]) {
if (!array_key_exists("pkgdesc", $pkgbuild)) { if (!array_key_exists("pkgdesc", $pkgbuild)) {
$error = __("Missing pkgdesc variable in PKGBUILD."); $error = __("Missing pkgdesc variable in PKGBUILD.");
} }
if (!array_key_exists("license", $pkgbuild)) {
$error = __("Missing license variable in PKGBUILD.");
}
if (!array_key_exists("pkgrel", $pkgbuild)) { if (!array_key_exists("pkgrel", $pkgbuild)) {
$error = __("Missing pkgrel variable in PKGBUILD."); $error = __("Missing pkgrel variable in PKGBUILD.");
} }
if (!array_key_exists("pkgver", $pkgbuild)) { if (!array_key_exists("pkgver", $pkgbuild)) {
$error = __("Missing pkgver variable in PKGBUILD."); $error = __("Missing pkgver variable in PKGBUILD.");
} }
if (!array_key_exists("arch", $pkgbuild)) {
$error = __("Missing arch variable in PKGBUILD.");
}
if (!array_key_exists("pkgname", $pkgbuild)) { if (!array_key_exists("pkgname", $pkgbuild)) {
$error = __("Missing pkgname variable in PKGBUILD."); $error = __("Missing pkgname variable in PKGBUILD.");
} else { } else {
@ -562,6 +565,12 @@ if ($_COOKIE["AURSID"]) {
print "<span class='error'>".$error."</span><br />\n"; print "<span class='error'>".$error."</span><br />\n";
print "<br />&nbsp;<br />\n"; print "<br />&nbsp;<br />\n";
} }
if ($warning) {
print "<br><span class='error'>".$warning."</span><br />\n";
print "<br />&nbsp;<br />\n";
}
$pkg_categories = pkgCategories(); $pkg_categories = pkgCategories();
$pkg_locations = pkgLocations(); $pkg_locations = pkgLocations();
@ -643,6 +652,11 @@ if ($_COOKIE["AURSID"]) {
} }
} else { } else {
print __("Package upload successful."); print __("Package upload successful.");
if ($warning) {
print "<span class='warning'>".$warning."</span><br />\n";
print "<br />&nbsp;<br />\n";
}
} }
} else { } else {