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

Building in non-initialized project without explicit parameter #482

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

FrostyX
Copy link
Member

@FrostyX FrostyX commented Jan 9, 2024

Fix #472

Now, it is possible to build packages without using any parameters.

$ tito --srpm --test
Creating output directory: /tmp/tito
WARNING: Tito project wasn't initialized,using the default configuration
WARNING: Consider `tito init' or the `--without-init' parameter to silent the warnings
WARNING: Unable to lookup latest package tag, building untagged test project
WARNING: .tito/packages/tito doesn't exist in git, using current directory
Building package [tito-0.6.24-1]
Wrote: /tmp/tito/tito-git-9.1e9ec0b.tar.gz

setting SOURCE_DATE_EPOCH=1688774400
Wrote: /tmp/tito/tito-0.6.24-1.git.9.1e9ec0b.fc39.src.rpm

To silence the warnings, it is possible to use the --without-init parameter

$ tito build --srpm --test --without-init
Creating output directory: /tmp/tito
Building package [tito-0.6.24-1]
Wrote: /tmp/tito/tito-git-9.1e9ec0b.tar.gz

setting SOURCE_DATE_EPOCH=1688774400
Wrote: /tmp/tito/tito-0.6.24-1.git.9.1e9ec0b.fc39.src.rpm

If the .tito directory exists, the --without-init parameter does nothing. So when integrating into Copr, the --wihout-init parameter can be used every time for every project. But maybe we should rename it to --ignore-missing-init, --ignore-missing-config, --ignore-init-warnings, or something like that?

One more thing that I realized is that we can only build in non-initialized projects when using --test. Without it, we get

$ tito build --srpm
Creating output directory: /tmp/tito
WARNING: Tito project wasn't initialized,using the default configuration
WARNING: Consider `tito init' or the `--without-init' parameter to silent the warnings
ERROR: Unable to lookup latest package info.
Perhaps you need to tag first?

We will need that for Copr, right @praiskup?

@FrostyX
Copy link
Member Author

FrostyX commented Jan 9, 2024

I renamed the --without-init parameter to --ignore-missing-config. This is now ready for review.

@praiskup
Copy link
Member

praiskup commented Jan 9, 2024

Do we have a project to test this? Otherwise looks good to me.

@FrostyX
Copy link
Member Author

FrostyX commented Jan 9, 2024

I tested by mv .tito .tito.off in this project :-)

src/tito/cli.py Outdated
"Please run 'tito init'" % loader.tito_props_path)

if not self.options.ignore_missing_config:
warn_out("Tito project wasn't initialized,"
Copy link
Member

Choose a reason for hiding this comment

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

nit: missing space separator after comma

@praiskup
Copy link
Member

This is awesome, thank you.

The behavior changed. We now build non-initialized projects without
any additional parameter. The `--without-init` could be confusing
because it could be understood as ignoring `.tito` directory even if
it is there. Which is not true, if `.tito` directory exists, the
parameter does nothing. It is only used to silence warnings.
@FrostyX
Copy link
Member Author

FrostyX commented Jan 11, 2024

Nit fixed, thank you for the review :-)

@FrostyX FrostyX merged commit 18b1bad into rpm-software-management:master Jan 11, 2024
6 of 11 checks passed
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.

Make tito build --srpm work without any .tito/ configuration
2 participants