MCPcopy Index your code
hub / github.com/BasicProtein/AugmentCode-Free / generate_checksums

Method generate_checksums

build.py:682–734  ·  view source on GitHub ↗

Generate comprehensive checksums for all build artifacts

(self)

Source from the content-addressed store, hash-verified

680 self.build_env = build_env
681
682 def generate_checksums(self) -> bool:
683 """Generate comprehensive checksums for all build artifacts"""
684 logger.step("Generating Checksums")
685
686 if not self.build_env.dist_dir.exists():
687 logger.error("Distribution directory not found")
688 return False
689
690 checksums = {}
691
692 # Process all build artifacts
693 for file_path in self.build_env.dist_dir.iterdir():
694 if file_path.is_file() and not file_path.name.startswith('checksums'):
695 try:
696 with open(file_path, 'rb') as f:
697 content = f.read()
698
699 checksums[file_path.name] = {
700 'size': len(content),
701 'sha256': hashlib.sha256(content).hexdigest(),
702 'md5': hashlib.md5(content).hexdigest(),
703 'sha1': hashlib.sha1(content).hexdigest()
704 }
705
706 logger.success(f"Checksums calculated: {file_path.name}")
707
708 except Exception as e:
709 logger.error(f"Failed to calculate checksums for {file_path.name}: {e}")
710 return False
711
712 # Write comprehensive checksum file
713 checksum_content = f"# {PROJECT_NAME} v{VERSION} File Checksums\n"
714 checksum_content += f"# Generated: {BUILD_TIMESTAMP}\n"
715 checksum_content += f"# Author: {AUTHOR}\n\n"
716
717 for filename, hashes in checksums.items():
718 checksum_content += f"File: {filename}\n"
719 checksum_content += f"Size: {hashes['size']:,} bytes\n"
720 checksum_content += f"SHA256: {hashes['sha256']}\n"
721 checksum_content += f"SHA1: {hashes['sha1']}\n"
722 checksum_content += f"MD5: {hashes['md5']}\n"
723 checksum_content += "-" * 80 + "\n\n"
724
725 with open(self.build_env.dist_dir / 'checksums.txt', 'w', encoding='utf-8') as f:
726 f.write(checksum_content)
727
728 # Write SHA256SUMS file (standard format)
729 with open(self.build_env.dist_dir / 'SHA256SUMS', 'w', encoding='utf-8') as f:
730 for filename, hashes in checksums.items():
731 f.write(f"{hashes['sha256']} {filename}\n")
732
733 logger.success(f"Checksums generated for {len(checksums)} files")
734 return True
735
736class ReleaseNotesGenerator:
737 """Generate comprehensive release notes"""

Callers

nothing calls this directly

Calls 3

stepMethod · 0.80
errorMethod · 0.80
successMethod · 0.80

Tested by

no test coverage detected