mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Fix: FS#12698 - AUR does not ignore comment lines in PKGBUILD source field.
The web interface was handling comments in the PKGBUILD variable fields (such as 'source','depends',etc...) differently from makepkg, because makepkg ignores the rest of the current line if there is a # character, while the web interface parsed that as well, and listed the words of the comment as source files. Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
parent
2da9b55d9f
commit
5b01327f57
1 changed files with 13 additions and 6 deletions
|
@ -73,6 +73,7 @@ if ($_COOKIE["AURSID"]):
|
||||||
$fp = fopen($pkg_dir."/PKGBUILD", "r");
|
$fp = fopen($pkg_dir."/PKGBUILD", "r");
|
||||||
$line_no = 0;
|
$line_no = 0;
|
||||||
$lines = array();
|
$lines = array();
|
||||||
|
$decomment = array();
|
||||||
$continuation_line = 0;
|
$continuation_line = 0;
|
||||||
$current_line = "";
|
$current_line = "";
|
||||||
$paren_depth = 0;
|
$paren_depth = 0;
|
||||||
|
@ -89,6 +90,8 @@ if ($_COOKIE["AURSID"]):
|
||||||
# assumed continuation
|
# assumed continuation
|
||||||
# continue appending onto existing line_no
|
# continue appending onto existing line_no
|
||||||
#
|
#
|
||||||
|
$decomment = explode("#",$line,2);
|
||||||
|
$line = $decomment[0];
|
||||||
$current_line .= $line . " ";
|
$current_line .= $line . " ";
|
||||||
$continuation_line = 1;
|
$continuation_line = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -331,10 +334,12 @@ if ($_COOKIE["AURSID"]):
|
||||||
# Insert sources
|
# Insert sources
|
||||||
$sources = explode(" ", $new_pkgbuild['source']);
|
$sources = explode(" ", $new_pkgbuild['source']);
|
||||||
foreach ($sources as $src) {
|
foreach ($sources as $src) {
|
||||||
|
if ($src != "" ) {
|
||||||
$q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
|
$q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
|
||||||
$q .= $pdata["ID"] . ", '" . mysql_real_escape_string($src) . "')";
|
$q .= $pdata["ID"] . ", '" . mysql_real_escape_string($src) . "')";
|
||||||
db_query($q, $dbh);
|
db_query($q, $dbh);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
header('Location: packages.php?ID=' . $pdata['ID']);
|
header('Location: packages.php?ID=' . $pdata['ID']);
|
||||||
|
|
||||||
|
@ -377,10 +382,12 @@ if ($_COOKIE["AURSID"]):
|
||||||
# Insert sources
|
# Insert sources
|
||||||
$sources = explode(" ", $new_pkgbuild['source']);
|
$sources = explode(" ", $new_pkgbuild['source']);
|
||||||
foreach ($sources as $src) {
|
foreach ($sources as $src) {
|
||||||
|
if ($src != "" ) {
|
||||||
$q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
|
$q = "INSERT INTO PackageSources (PackageID, Source) VALUES (";
|
||||||
$q .= $packageID . ", '" . mysql_real_escape_string($src) . "')";
|
$q .= $packageID . ", '" . mysql_real_escape_string($src) . "')";
|
||||||
db_query($q, $dbh);
|
db_query($q, $dbh);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
header('Location: packages.php?ID=' . $packageID);
|
header('Location: packages.php?ID=' . $packageID);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue