Skip to content

Commit

Permalink
release: touch aclocal.m4/Makefile.in/configure when creating source …
Browse files Browse the repository at this point in the history
…tarball
  • Loading branch information
madebr committed Dec 27, 2024
1 parent df9552d commit 0b79762
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion build-scripts/build-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,12 @@ def __init__(self):
def add_file(self, file: NodeInArchive):
self._tree[file.arcpath] = file

def __iter__(self) -> typing.Iterable[NodeInArchive]:
yield from self._tree.values()

def __contains__(self, value: str) -> bool:
return value in self._tree

def get_latest_mod_time(self) -> datetime.datetime:
return max(item.time for item in self._tree.values() if item.time)

Expand Down Expand Up @@ -586,12 +592,22 @@ def _external_repo_path_filter(cls, path: str) -> bool:
def create_source_archives(self) -> None:
source_collector = SourceCollector(root=self.root, commit=self.commit, executer=self.executer, filter=self._path_filter)
print(f"Collecting sources of {self.project}...")
archive_tree = source_collector.get_archive_file_tree()
archive_tree: ArchiveFileTree = source_collector.get_archive_file_tree()
latest_mod_time = archive_tree.get_latest_mod_time()
archive_tree.add_file(NodeInArchive.from_text(arcpath=REVISION_TXT, text=f"{self.revision}\n", time=latest_mod_time))
archive_tree.add_file(NodeInArchive.from_text(arcpath=f"{GIT_HASH_FILENAME}", text=f"{self.commit}\n", time=latest_mod_time))
archive_tree.add_file_mapping(arc_dir="", file_mapping=self.release_info["source"].get("files", {}), file_mapping_root=self.root, context=self.get_context(), time=latest_mod_time)

if "Makefile.am" in archive_tree:
patched_time = latest_mod_time + datetime.timedelta(minutes=1)
print(f"Makefile.am detected -> touching aclocal.m4, */Makefile.in, configure")
for node_data in archive_tree:
arc_name = os.path.basename(node_data.arcpath)
arc_name_we, arc_name_ext = os.path.splitext(arc_name)
if arc_name in ("aclocal.m4", "configure", "Makefile.in"):
print(f"Bumping time of {node_data.arcpath}")
node_data.time = patched_time

archive_base = f"{self.project}-{self.version}"
zip_path = self.dist_path / f"{archive_base}.zip"
tgz_path = self.dist_path / f"{archive_base}.tar.gz"
Expand Down

0 comments on commit 0b79762

Please sign in to comment.