summaryrefslogtreecommitdiffstats
path: root/checkpkgist.php
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-07-28 09:25:24 +0200
committerRemi Collet <fedora@famillecollet.com>2014-07-28 09:25:24 +0200
commit0e306b2c719a577f220d1084b481b2f8fcee8d6e (patch)
tree029d15de22aece519c6ef9aa52291b4c2156c6d7 /checkpkgist.php
parent6eb9e049223f363ba89fae0e0a34a0aa62cd7a20 (diff)
checkpkgist: use data retrieved by rpmphp
Diffstat (limited to 'checkpkgist.php')
-rwxr-xr-xcheckpkgist.php29
1 files changed, 26 insertions, 3 deletions
diff --git a/checkpkgist.php b/checkpkgist.php
index 77c52b2..f1257c7 100755
--- a/checkpkgist.php
+++ b/checkpkgist.php
@@ -88,13 +88,36 @@ $verb = (in_array('-v', $_SERVER['argv']) || in_array('--verbose', $_SERVER['a
$quiet = (in_array('-q', $_SERVER['argv']) || in_array('--quiet', $_SERVER['argv']));
$client = new PkgClient();
-$pkgs = file_get_contents(__DIR__."/checkpkgist.json");
+$pkgs = file_get_contents(__DIR__."/rpmphp.json");
if (!$pkgs) {
- die("Missing configuration file\n");
+ die("Missing configuration file rpmphp\n");
}
$pkgs = json_decode($pkgs, true, 5, JSON_PARSER_NOTSTRICT);
if (!$pkgs) {
- die("Bad configuration file\n");
+ die("Bad configuration file rpmphp\n");
+}
+$pkg2 = file_get_contents(__DIR__."/checkpkgist.json");
+if (!$pkg2) {
+ die("Missing configuration file checkpkgist\n");
+}
+$pkg2 = json_decode($pkg2, true, 5, JSON_PARSER_NOTSTRICT);
+if (!$pkg2) {
+ die("Bad configuration file checkpkgist\n");
+}
+
+$change = false;
+foreach ($pkg2 as $pkg => $rpm) {
+ if (isset($pkgs[$pkg])) {
+ unset($pkg2[$pkg]);
+ $change = true;
+ } else {
+ $pkgs[$pkg] = $pkg2[$pkg];
+ }
+}
+if ($change) {
+ if (file_put_contents(__DIR__."/checkpkgist.json", json_encode($pkg2, JSON_PRETTY_PRINT))) {
+ printf("Configuration file changes saved\n");
+ }
}
if ($sort) {