diff options
author | Remi Collet <fedora@famillecollet.com> | 2014-07-28 09:25:24 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2014-07-28 09:25:24 +0200 |
commit | e6c73ccbf140010983f230d2c9dcce64a2dce7fc (patch) | |
tree | 927b67fd62de0fadcf6b620a0e5877cded27a6e5 /checkpkgist/checkpkgist.php | |
parent | 66d80e5f50bde4b4224b579e5a2f59a74aa58721 (diff) |
checkpkgist: use data retrieved by rpmphp
Diffstat (limited to 'checkpkgist/checkpkgist.php')
-rwxr-xr-x | checkpkgist/checkpkgist.php | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/checkpkgist/checkpkgist.php b/checkpkgist/checkpkgist.php index 77c52b2..f1257c7 100755 --- a/checkpkgist/checkpkgist.php +++ b/checkpkgist/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) { |