index : archweb32 | |
Archlinux32 website | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | buildmaster/to-delete.php | 77 |
diff --git a/buildmaster/to-delete.php b/buildmaster/to-delete.php new file mode 100644 index 0000000..df11750 --- /dev/null +++ b/buildmaster/to-delete.php @@ -0,0 +1,77 @@ +<?php +require_once "../init.php"; +require_once BASE . "/lib/mysql.php"; + + $result = mysql_run_query( + "SELECT " . + "`repositories`.`name` AS `repo`," . + "`binary_packages`.`pkgname`," . + "`binary_packages`.`epoch`," . + "`binary_packages`.`pkgver`," . + "`binary_packages`.`pkgrel`," . + "`binary_packages`.`sub_pkgrel`," . + "`architectures`.`name` AS `arch`" . + " FROM `binary_packages`" . + mysql_join_binary_packages_architectures() . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . + "WHERE `binary_packages_in_repositories`.`is_to_be_deleted` " . + "AND `repositories`.`is_on_master_mirror`" + ); + + $available = explode( + "\n", + shell_exec("find /var/lib/pacman/ -name '*.db' -exec tar -tzf {} \; | sed -n 's,-[^-]\+-[^-]\+/$,,;T;p'") + ); + $available = array_combine( $available, $available); +?> +<html> +<head> +<title>List of packages to be deleted</title> +<link rel="stylesheet" type="text/css" href="/static/style.css"> +</head> +<body> +<?php + +show_warning_on_offline_slave(); + +if ($result -> num_rows > 0) { + + $count = 0; + + while ($row = $result->fetch_assoc()) { + + if (isset($available[$row["pkgname"]])) + $color = "#FF0000"; + else + $color = "#00FF00"; + + $rows[$count] = + "<font color=\"" . $color . "\">" . + $row["repo"] . "/" . + $row["pkgname"] . "-"; + if ($row["epoch"] != "0") + $rows[$count] = + $rows[$count] . + $row["epoch"] . ":"; + $rows[$count] = + $rows[$count] . + $row["pkgver"] . "-" . + $row["pkgrel"] . "." . + $row["sub_pkgrel"] . "-" . + $row["arch"] . ".pkg.tar.xz</font>"; + $count++; + } + + sort($rows); + + foreach ($rows as $row) { + print $row."<br>\n"; + } +} else { + print "No packages are to be deleted.\n"; +} + +?> +</body> +</html> |