tooling/CONVENTIONS.md
Adam Williamson 6f499e16b7 Update pagure.io references to forge.fp.o appropriately
Signed-off-by: Adam Williamson <awilliam@redhat.com>
2026-07-08 08:31:14 -07:00

4.4 KiB

Fedora Release Engineering Scripts - Naming Conventions

This document establishes standardized naming conventions for all scripts in the reorganized scripts/ directory structure. These conventions improve consistency, readability, and maintainability.

🎯 Core Principles

  1. Consistency: All scripts follow the same naming patterns
  2. Clarity: Names clearly indicate script purpose and type
  3. Maintainability: Predictable naming makes navigation easier
  4. Future-proof: Standards that scale as the repository grows

📝 Naming Rules

File Names

Use snake_case (underscores) for all script names

  • Correct: mass_rebuild.py, find_failures.py, stage_release.sh
  • Incorrect: mass-rebuild.py, find-failures.py, stage-release.sh

Rationale: Snake_case is more consistent with Python conventions and easier to work with programmatically.

Always include appropriate file extensions

  • Python scripts: .py
  • Shell scripts: .sh
  • Configuration files: .conf, .ini, .yaml, etc.
  • Templates: .j2 (Jinja2), .tmpl, etc.
  • Executables: No extension only if truly meant to be CLI tools

Examples:

  • mass_rebuild.py (Python script)
  • create_repos.sh (Shell script)
  • compose_config.conf (Configuration)
  • email_template.j2 (Jinja2 template)

Use lowercase for all file and directory names

  • Correct: mass_rebuilds/, koji_import.py
  • Incorrect: Mass_Rebuilds/, Koji_Import.py

Use descriptive, action-oriented names

  • Good: find_failed_builds.py, retire_orphaned_packages.py
  • Poor: script.py, util.py, helper.sh

Directory Names

Use lowercase with hyphens for multi-word directory names

  • Correct: mass-rebuilds/, quality-assurance/, release-process/
  • Incorrect: mass_rebuilds/, qualityAssurance/, release_process/

Rationale: Hyphens in directory names are more readable in URLs and file paths, while underscores in filenames work better with import statements and variable names.

📋 Specific Patterns

Script Categories

Build & Compose Scripts

build_current.py          # Build current compose
build_previous.py         # Build previous release
koji_import.py            # Import builds to Koji
koji_compare.py           # Compare Koji builds
compose_info_builder.py   # Build compose metadata

Package Management Scripts

find_failures.py          # Find failed builds
block_retired.py          # Block retired packages
retire_packages.py        # Retire package list
orphan_packages.py        # Orphan package list

Release Process Scripts

mass_rebuild.py           # Mass rebuild orchestration
stage_release.sh          # Stage release for publication
sign_packages.py          # Sign package batches
create_torrents.py        # Generate release torrents

Quality Assurance Scripts

check_builds.py           # Check build health
test_compose.py           # Test compose quality
validate_paths.py         # Validate upgrade paths

🔄 Migration Guidelines

Renaming Existing Scripts

When migrating scripts to the new structure, rename according to these patterns:

Before → After

# Hyphens to underscores
mass-rebuild.py           → mass_rebuild.py
check-latest-build.py     → check_latest_build.py
find-bad-builds.py        → find_bad_builds.py

# Add missing extensions
mashcompose               → mash_compose.py
buildepelbeta            → build_epel_beta.sh
torrent-generator        → generate_torrents.py

# Improve clarity
build-current.py         → build_current_compose.py
clean-amis.py           → clean_ami_images.py
get_retired_packages.sh  → find_retired_packages.sh

FAQ

Q: Should configuration files follow the same naming?
A: Yes, but use appropriate extensions (.conf, .yaml, .ini) instead of .py/.sh.

Q: How do we handle template files?
A: Use clear extensions like .j2 for Jinja2, .tmpl for generic templates.

Q: Do you have any helper where we can check about renaming?
A: Yes, please consider looking into rename_script_helper, and validate_conventions scripts from the misc directory.

📚 References


Maintainer: Fedora Release Engineering Team
Questions: File issues in fedora-releng repository