Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove %version0 from spec file #495

Closed
wants to merge 1 commit into from

Conversation

smooge
Copy link
Collaborator

@smooge smooge commented Nov 27, 2024

This was something to allow for the package to build in Fedora koji and to pass review since it needed to be in the upstream code and the Fedora spec file. Now that we are using packit, it is not needed and should be removed from the spec.

Summary by Sourcery

Build:

  • Remove the %version0 macro from the spec file as it is no longer needed with the use of packit.

This was something to allow for the package to build in Fedora koji
and to pass review since it needed to be in the upstream code and the
Fedora spec file. Now that we are using packit, it is not needed and
should be removed from the spec.

Signed-off-by: Stephen Smoogen <[email protected]>
Copy link
Contributor

sourcery-ai bot commented Nov 27, 2024

Reviewer's Guide by Sourcery

This PR removes a version specification from the spec file that was previously required for Fedora koji builds but is no longer needed due to the migration to packit.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Remove hardcoded version definition from RPM spec file
  • Remove %version0 macro definition that was previously set to 0.2.0
  • Remove comment referencing version.py file
rpm/python-ramalama.spec

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @smooge - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please verify there are no other references to %version0 elsewhere in the spec file to ensure this removal won't cause any issues.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@smooge
Copy link
Collaborator Author

smooge commented Nov 27, 2024

@lsm5 I am not sure what is causing this :

2024-11-27 12:30:16.022 upstream.py       DEBUG  Version: 0.2.0
2024-11-27 12:30:16.022 upstream.py       DEBUG  Sanitized version: 0.2.0
2024-11-27 12:30:16.022 upstream.py       DEBUG  Name + version = ramalama-0.2.0
2024-11-27 12:30:16.022 commands.py       DEBUG  Command: git archive --output rpm/ramalama-0.2.0.tar.gz --prefix ramalama-0.2.0/ HEAD
2024-11-27 12:30:16.045 cmd.py            INFO   git cat-file --batch-check
2024-11-27 12:30:16.045 cmd.py            DEBUG  Popen(['git', 'cat-file', '--batch-check'], cwd=/tmp/tmp2fkdnrc3, stdin=<valid stream>, shell=False, universal_newlines=False)
2024-11-27 12:30:16.059 utils.py          ERROR  Preparation of the repository for creation of an SRPM failed: You need to define Version:, %{commit} or %{tag} before the macro invocation !
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/specfile/spec_parser.py", line 233, in get_rpm_spec
    return rpm.spec(tmp.name, flags)
           ~~~~~~~~^^^^^^^^^^^^^^^^^
ValueError: can't parse specfile


The above exception was the direct cause of the following exception:

All I did was remove version0 from teh spec file in this:

%global pypi_name ramalama
%global forgeurl  https://github.com/containers/%{pypi_name}
%forgemeta

%global summary   RamaLama is a command line tool for working with AI LLM models

%global _python_dist_allow_version_zero 1

Name:             python-%{pypi_name}
# DO NOT TOUCH the Version string!
# The TRUE source of this specfile is:
# https://github.com/containers/ramalama/blob/main/rpm/python-ramalama.spec
# If that's what you're reading, Version must be 0, and will be updated by Packit for
# copr and koji builds.
# If you're reading this on dist-git, the version is automatically filled in by Packit.
Version:          0
License:          MIT
Release:          %{autorelease}
Summary:          %{summary}
URL:              %{forgeurl}
# Tarball fetched from upstream
Source:           %{forgesource}
BuildArch:        noarch

Copy link
Member

@lsm5 lsm5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version0 stuff is needed after all for forgemeta. My bad on the earlier suggestion.

We can either close this PR or maybe set the macro to 0 on line 4 and then also move the comment in the lines above Version: to above where we define version0 .

@lsm5
Copy link
Member

lsm5 commented Nov 27, 2024

@smooge UPDATE: I'm told replacing version0 with tag should make things work for propose-downstream feature of packit (the job that creates update PRs for dist-git). So, I'd suggest making that change and we can verify if things work with the next upstream release.

@smooge
Copy link
Collaborator Author

smooge commented Nov 27, 2024

I am going to close this one at the moment. I need to figure out the syntax changes needed to get this right and read through the packit documentation on tag and such. It is a 4+ day PTO for several of the developers so don't want to have this accidently merged and break things.

@smooge smooge closed this Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants