     Enum.reject(v2_apps, fn a ->
       elem(a, 0) in changed_apps
     end)
+  end
+
+  # Determine the set of apps removed from v1 to v2
+  defp get_removed_apps(a, b) do
+    as = Enum.map(a, fn app -> elem(app, 0) end) |> MapSet.new
+    bs = Enum.map(b, fn app -> elem(app, 0) end) |> MapSet.new
+    MapSet.difference(as, bs)
+    |> MapSet.to_list
+    |> Enum.map(fn n -> {n, elem(List.keyfind(a, n, 0), 1)} end)
   end
 
   # Generate .appup files for a list of {app, v1, v2}

              [String.to_charlist(upfrom_rel)],
              [String.to_charlist(upfrom_rel)],
              [{:outdir, String.to_charlist(rel_dir)},
               {:path, get_relup_code_paths(added, changed, output_dir)},
               :silent,
               :no_warn_sasl]
            )


  # Get a list of code paths containing only those paths which have beams
  # from the two versions in the release being upgraded
  defp get_relup_code_paths(added, changed, removed, output_dir) do
    added_paths   = get_added_relup_code_paths(added, output_dir, [])
    changed_paths = get_changed_relup_code_paths(changed, output_dir, [], [])
    removed_paths = get_removed_relup_code_paths(removed, output_dir, [])
    added_paths ++ changed_paths ++ removed_paths
  end
  defp get_changed_relup_code_paths([], _output_dir, v1_paths, v2_paths) do
    v2_paths ++ v1_paths
