Upload new-sources if we have old sources files
@@ -3,6 +3,7 @@ This is the official python interface for packit.
"""
import logging
+from pathlib import Path
from typing import Sequence
from packit.config import Config, PackageConfig
@@ -136,11 +137,25 @@ class PackitAPI:
):
if add_new_sources or force_new_sources:
+
+ make_new_sources = False
+
# btw this is really naive: the name could be the same but the hash can be different
# TODO: we should do something when such situation happens
if force_new_sources or not distgit.is_archive_in_lookaside_cache(
distgit.upstream_archive_name
):
+ make_new_sources = True
+ else:
+ sources_file = Path(distgit.local_project.working_dir) / Path("sources")
+ with open(str(sources_file), mode="r") as sources_file_obj:
+ if (
+ distgit.upstream_archive_name not
+ in sources_file_obj.read()
+ ):
+ make_new_sources = True
+
+ if make_new_sources:
archive = distgit.download_upstream_archive()
distgit.upload_to_lookaside_cache(archive)
