#166 fedora: also check for the spec file in the existence check
Merged 2 years ago by zbyszek. Opened 2 years ago by zbyszek.
fedora-rust/ zbyszek/rust2rpm existence-check-spec-file  into  main

file modified
+13 -3
@@ -252,11 +252,21 @@ 

      url = requests.compat.urljoin(DIST_GIT_URL, f"rpms/{package}")

      req = requests.get(url, headers={"User-Agent": "rust2rpm"})

      json = req.json()

-     if "name" in json:

-         return json

-     else:

+     if 'name' not in json:

          return None

  

+     # E.g. https://src.fedoraproject.org/rpms/rust-tiny_http0.6/blob/rawhide/f/rust-tiny_http0.6.spec

+     full_url = json['full_url']

+     spec_url = requests.compat.urljoin(full_url, f'blob/rawhide/f/rust-{package}.spec')

+     req = requests.head(url, headers={"User-Agent": "rust2rpm"})

+ 

+     if not req.ok:

+         # The repo exists, but doesn't have the spec file. We most

+         # likely want to create a spec file to add to that repo.

+         return None

+ 

+     return json

+ 

  def make_diff_metadata(crate, version, patch=False, store=False):

      if _is_path(crate):

          # Only things that look like a paths are considered local arguments

Fixes https://pagure.io/fedora-rust/rust2rpm/issue/165.
the following workflow wasn't well supported by the check:

  • request compat package repo
  • fedpkg clone it
  • try to run rust2rpm for it
  • Get this message:
    Crate tiny_http0.6 is already packaged in Fedora (...)
    Re-run with --no-existence-check if you still want to convert it.

rebased onto 73f5d59

2 years ago

Pull-Request has been merged by zbyszek

2 years ago
Metadata