rpm-software-management / tito

A tool for managing rpm based git projects.
GNU General Public License v2.0
379 stars 128 forks source link

Building in non-initialized project without explicit parameter #482

Closed FrostyX closed 8 months ago

FrostyX commented 8 months ago

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 commented 8 months ago

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

praiskup commented 8 months ago

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

FrostyX commented 8 months ago

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

praiskup commented 8 months ago

This is awesome, thank you.

FrostyX commented 8 months ago

Nit fixed, thank you for the review :-)