-- called by /home/master/builder/bin/get-package-updates DELETE `package_sources`,`build_assignments`,`binary_packages`,`binary_packages_in_repositories` FROM `repositories` JOIN `binary_packages_in_repositories` ON `repositories`.`id`=`binary_packages_in_repositories`.`repository` AND `repositories`.`stability` IN (5,6) JOIN `binary_packages` ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id` JOIN `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`id` JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id` AND `package_sources`.`pkgbase`=from_base64("aGFza2VsbC1oZWRnZWhvZw==") LEFT JOIN (`build_assignments` AS `keep_ba` JOIN `binary_packages` AS `keep_bp` ON `keep_ba`.`id`=`keep_bp`.`build_assignment` JOIN `binary_packages_in_repositories` AS `keep_bpir` ON `keep_bp`.`id`=`keep_bpir`.`package` JOIN `repositories` AS `keep_r` ON `keep_bpir`.`repository`=`keep_r`.`id` AND `keep_r`.`stability` IN (5,6)) ON `keep_ba`.`package_source`=`package_sources`.`id` WHERE `keep_r`.`id` IS NULL; DELETE `build_assignments`,`binary_packages`,`binary_packages_in_repositories` FROM `repositories` JOIN `binary_packages_in_repositories` ON `repositories`.`id`=`binary_packages_in_repositories`.`repository` AND `repositories`.`stability` IN (5,6) JOIN `binary_packages` ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id` JOIN `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`id` JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id` AND `package_sources`.`pkgbase`=from_base64("aGFza2VsbC1oZWRnZWhvZw==") LEFT JOIN (`binary_packages` AS `keep_bp` JOIN `binary_packages_in_repositories` AS `keep_bpir` ON `keep_bp`.`id`=`keep_bpir`.`package` JOIN `repositories` AS `keep_r` ON `keep_bpir`.`repository`=`keep_r`.`id` AND NOT (`keep_r`.`stability` IN (5,6))) ON `keep_bp`.`build_assignment`=`build_assignments`.`id` WHERE `keep_r`.`id` IS NULL; DELETE `binary_packages`,`binary_packages_in_repositories` FROM `repositories` JOIN `binary_packages_in_repositories` ON `repositories`.`id`=`binary_packages_in_repositories`.`repository` AND `repositories`.`stability` IN (5,6) JOIN `binary_packages` ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id` JOIN `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`id` JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id` AND `package_sources`.`pkgbase`=from_base64("aGFza2VsbC1oZWRnZWhvZw==") LEFT JOIN (`binary_packages_in_repositories` AS `keep_bpir` JOIN `repositories` AS `keep_r` ON `keep_bpir`.`repository`=`keep_r`.`id` AND `keep_r`.`stability` IN (5,6)) ON `keep_bpir`.`package`=`binary_packages`.`id` WHERE `keep_r`.`id` IS NULL; DELETE `binary_packages_in_repositories` FROM `repositories` JOIN `binary_packages_in_repositories` ON `repositories`.`id`=`binary_packages_in_repositories`.`repository` AND `repositories`.`stability` IN (5,6) JOIN `binary_packages` ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id` JOIN `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`id` JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id` AND `package_sources`.`pkgbase`=from_base64("aGFza2VsbC1oZWRnZWhvZw=="); UPDATE `binary_packages_in_repositories` JOIN `binary_packages` ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id` JOIN `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`id` JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id` JOIN `upstream_repositories` ON `package_sources`.`upstream_package_repository`=`upstream_repositories`.`id` SET `binary_packages_in_repositories`.`is_to_be_deleted`=0 WHERE `package_sources`.`pkgbase`=from_base64("aGFza2VsbC1oZWRnZWhvZw==") AND `upstream_repositories`.`name`=from_base64("ZXh0cmE=");