Skip to content

Package Versions

Jay Michalska edited this page Sep 15, 2025 · 1 revision

The core functionality of this feature is to track and manage local package versions. This is achieved by creating LocalPackageVersion objects.

Core Models

  • PackageVersion:
    • This is the base database model.
    • It stores a reference to a package_id and a version string.
    • Represents a version of a package.
  • LocalPackageVersion:
    • This is a Single Table Inheritance (STI) subclass of PackageVersion.
    • It represents a package version that is locally managed within the project.
    • The type column in the package_versions table will be set to LocalPackageVersion for these objects.

Feature Triggering and Workflow

The feature is activated when the OBS:AnityaDistribution attribute is added to a Project. This triggers a chain of events and background jobs to synchronize and manage package versions.

Phase 1: Initial Synchronization

  • Event: Project attribute OBS:AnityaDistribution is set.
  • Trigger: An after_create action gets triggered on the new attribute.
  • Action: A background job, FetchVersionHistoriesJob, is enqueued.
  • FetchVersionHistoriesJob Responsibilities:
    • Iterates through all packages within the Project that now has the OBS:AnityaDistribution attribute.
    • For each package, it queries the OBS backend to fetch the current version.
    • For each version in the fetched history, it creates a LocalPackageVersion object if one does not already exist.

Phase 2: Ongoing Synchronization (Event-driven)

  • Event: Event:VersionChange is triggered on a Package within a Project that has the OBS:AnityaDistribution attribute.
  • Source: This event is typically generated by OBS when a package's version is updated (e.g., a new release is built or committed).
  • Trigger: An after_create action gets triggered on this event.
  • Action: after_create action on Event:VersionChange will be performed.
  • after_create Action Responsibilities:
    • Checks if the associated Project has the OBS:AnityaDistribution attribute set.
    • Extracts the new version number from the event payload.
    • Creates a new LocalPackageVersion object for the package with the new version number.
Clone this wiki locally