PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: packit/packit (python)

Issue:
Provide `upstream_pkg_name` for the templating of `upstream_tag_template`
Sentry Issue: [PCKT-002-PACKIT-SERVICE-73F](https://red-hat-it.sentry.io/issues/4950142977/?referrer=github_integration)

```
KeyError: 'upstream_pkg_name'
(7 additional frame(s) were not displayed)
...
  File "packit_service/worker/jobs.py", line 635, in process_jobs
    self.create_tasks(job_configs, handler_kls, statuses_check_feedback),
  File "packit_service/worker/jobs.py", line 658, in create_tasks
    if self.should_task_be_created_for_job_config_and_handler(
  File "packit_service/worker/jobs.py", line 724, in should_task_be_created_for_job_config_and_handler
    event=self.event.get_dict(),
  File "packit_service/events/anitya/abstract.py", line 151, in get_dict
    d["tag_name"] = self.tag_name
  File "packit_service/events/anitya/abstract.py", line 146, in tag_name
    return self.packages_config.upstream_tag_template.format(version=self.version)
```

Needed for https://src.fedoraproject.org/rpms/azure-cli/blob/rawhide/f/.packit.yaml#_5

Pull request:
feat: pass upstream package name to tag template
Fixes #2603

<!-- release notes footer -->

RELEASE NOTES BEGIN

We have added a support for passing `upstream_package_name` to the `upstream_tag_template` option.

RELEASE NOTES END


Patch:
diff --git a/packit/upstream.py b/packit/upstream.py
index f5ff13ea..8064f1d4 100644
--- a/packit/upstream.py
+++ b/packit/upstream.py
@@ -205,7 +205,10 @@ class Upstream:
              tag
         """
         try:
-            tag = self.package_config.upstream_tag_template.format(version=version_)
+            tag = self.package_config.upstream_tag_template.format(
+                version=version_,
+                upstream_package_name=self.package_config.upstream_package_name,
+            )
         except KeyError as e:
             msg = (
                 f"Invalid upstream_tag_template: {self.package_config.upstream_tag_template} - "


Test patch:
diff --git a/tests/unit/test_upstream.py b/tests/unit/test_upstream.py
index feefd646..fc76f683 100644
--- a/tests/unit/test_upstream.py
+++ b/tests/unit/test_upstream.py
@@ -160,6 +160,13 @@ def test_get_current_version(action_output, version, expected_result, upstream_m
             pytest.raises(PackitException),
             id="no_match_found",
         ),
+        pytest.param(
+            "test_package_name-1.0.0",
+            "{upstream_package_name}-{version}",
+            "1.0.0",
+            does_not_raise(),
+            id="test with upstream_package_name in template",
+        ),
     ],
 )
 def test_get_version_from_tag(
@@ -280,6 +287,13 @@ def test_get_archive_root_dir_from_template(
             pytest.raises(PackitException),
             id="invalid_template",
         ),
+        pytest.param(
+            "1.0.0",
+            "{upstream_package_name}-{version}",
+            "test_package_name-1.0.0",
+            does_not_raise(),
+            id="upstream package name in the template",
+        ),
     ],
 )
 def test_convert_version_to_tag(