saltstack-formulas / salter

Salter orchestrates software profiles onto Linux/MacOS/FreeBSD/Windows without fuss.
Apache License 2.0
6 stars 5 forks source link

allow skip broken on centos yum install #54

Closed noelmcloughlin closed 4 years ago

noelmcloughlin commented 4 years ago

This PR fixes a git conflict on CentOS7 when using yum.

---> Package zip.x86_64 0:3.0-11.el7 will be installed
--> Processing Conflict: git2u-2.16.5-1.ius.el7.x86_64 conflicts git < 2.16.5
--> Processing Conflict: git2u-perl-Git-2.16.5-1.ius.el7.noarch conflicts perl-Git < 2.16.5
--> Processing Conflict: git2u-core-2.16.5-1.ius.el7.x86_64 conflicts git-core < 2.16.5
--> Finished Dependency Resolution
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

PR progress checklist (to be filled in by reviewers)


What type of PR is this?

Workaround yum warning on CentOS

Primary type

Secondary type

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

CentOS 7 only ships git v1.8 so typically we install git 2.x from IUS repo. This causes a problem with salter.sh bootstrap command because its trying to install git but there is conflict. One solution is to not install git (it maybe already installed) but that approach impacts all OS. The most clean solution is to allows skip-broken because only a limited number of packages are being installed at the step that fails.

Pillar / config required to test the proposed change

Debug log showing how the proposed changes work

--> Running transaction check
---> Package dwz.x86_64 0:0.11-3.el7 will be installed
---> Package perl-srpm-macros.noarch 0:1-8.el7 will be installed
---> Package python-srpm-macros.noarch 0:3-32.el7 will be installed
---> Package redhat-rpm-config.noarch 0:9.1.0-88.el7.centos will be installed
---> Package zip.x86_64 0:3.0-11.el7 will be installed
--> Finished Dependency Resolution

Packages skipped because of dependency problems:
    git-1.8.3.1-20.el7.x86_64 from base
    perl-Git-1.8.3.1-20.el7.noarch from base

Dependencies Resolved

===============================================================================================================
 Package                         Arch                Version                           Repository         Size
===============================================================================================================
Installing:
 redhat-rpm-config               noarch              9.1.0-88.el7.centos               base               81 k
Installing for dependencies:
 dwz                             x86_64              0.11-3.el7                        base               99 k
 perl-srpm-macros                noarch              1-8.el7                           base              4.6 k
 python-srpm-macros              noarch              3-32.el7                          base              8.4 k
 zip                             x86_64              3.0-11.el7                        base              260 k
Skipped (dependency problems):
 git                             x86_64              1.8.3.1-20.el7                    base              4.4 M
 perl-Git                        noarch              1.8.3.1-20.el7                    base               55 k

Transaction Summary
===============================================================================================================
Install                        1 Package  (+4 Dependent packages)
Skipped (dependency problems)  2 Packages

Total download size: 453 k
Installed size: 1.2 M
Downloading packages:
(1/5): python-srpm-macros-3-32.el7.noarch.rpm                                           | 8.4 kB  00:00:00     
(2/5): dwz-0.11-3.el7.x86_64.rpm                                                        |  99 kB  00:00:00     
(3/5): redhat-rpm-config-9.1.0-88.el7.centos.noarch.rpm                                 |  81 kB  00:00:00     
(4/5): zip-3.0-11.el7.x86_64.rpm                                                        | 260 kB  00:00:00     
(5/5): perl-srpm-macros-1-8.el7.noarch.rpm                                              | 4.6 kB  00:00:01     
---------------------------------------------------------------------------------------------------------------
Total                                                                          274 kB/s | 453 kB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-srpm-macros-3-32.el7.noarch                                                          1/5 
  Installing : dwz-0.11-3.el7.x86_64                                                                       2/5 
  Installing : zip-3.0-11.el7.x86_64                                                                       3/5 
  Installing : perl-srpm-macros-1-8.el7.noarch                                                             4/5 
  Installing : redhat-rpm-config-9.1.0-88.el7.centos.noarch                                                5/5 
  Verifying  : perl-srpm-macros-1-8.el7.noarch                                                             1/5 
  Verifying  : zip-3.0-11.el7.x86_64                                                                       2/5 
  Verifying  : dwz-0.11-3.el7.x86_64                                                                       3/5 
  Verifying  : python-srpm-macros-3-32.el7.noarch                                                          4/5 
  Verifying  : redhat-rpm-config-9.1.0-88.el7.centos.noarch                                                5/5 

Installed:
  redhat-rpm-config.noarch 0:9.1.0-88.el7.centos                                                               

Dependency Installed:
  dwz.x86_64 0:0.11-3.el7      perl-srpm-macros.noarch 0:1-8.el7      python-srpm-macros.noarch 0:3-32.el7     
  zip.x86_64 0:3.0-11.el7     

Skipped (dependency problems):
  git.x86_64 0:1.8.3.1-20.el7                         perl-Git.noarch 0:1.8.3.1-20.el7 

Testing checklist

Additional context

aboe76 commented 4 years ago

why not install git from scl?

https://wiki.centos.org/SpecialInterestGroup/SCLo/CollectionsList

https://www.softwarecollections.org/en/scls/rhscl/rh-git29/

javierbertoli commented 4 years ago

I'm not a user of salter ('though I'm following it to see if it suits any of my needs) so perhaps the question is irrelevant or missing something:

Is there any reason to force the requirement to be git >= 2.x instead of just git and use the default provided by the OSes? While building the images to test salt formulas, I use the default git package provided by the OSes and it works OK to build and install Salt in +30 distros variants, using Salt's bootstrap, even performing git-based installs.

Furthermore, running

grep -Ri "git " | grep -v \\.git|less

in this repo only shows some pretty basic git commands: I see clone, checkout, config, init and pull, if I'm not wrong.

Am I missing something? Sorry for the noise if that's the case.

noelmcloughlin commented 4 years ago

Is there any reason to force the requirement to be git >= 2.x instead of just git and use the default provided by the OSes?

This is a valid criticism - I'm being a bit selfish here. The need was related to this repo originating from a closed-source company internal repo which was a monolith when I was asked to take it over few years ago. My strategy was to push everything upstream (saltstack-formulas) and try to make something like a package manager (for formulas). This largely succeeded although I need to keep a heartbeat on supported formulas to make sure they don't break.

However in my workplace we still have the original repo but its a skeleton based on idea at https://github.com/noelmcloughlin/salter-overlay-demo

In that design I used this command which requires git v2.

https://github.com/noelmcloughlin/salter-overlay-demo/blob/e4e0da2f3208cd64fb98bf76fe20fcf813fbf490/scripts/overlay-salt.sh#L55

git pull salter master --allow-unrelated-histories

I want to support some method to drop in private formulas/pillars onto the solution without exposing the private stuff on the WWW. I wanted to do everything possible to avoid forking - but maybe I should just fork.

I could make time to see if I could come up with a better solution.

noelmcloughlin commented 4 years ago

why not install git from scl?

Is that more standard solution? I'm not that familiar with scl.

aboe76 commented 4 years ago

why not install git from scl?

Is that more standard solution? I'm not that familiar with scl.

Hi @noelmcloughlin SCL is something from redhat/centos to overcome the issues of stale software. So it should work better without interfering with the original packaging.

javierbertoli commented 4 years ago

I want to support some method to drop in private formulas/pillars onto the solution without exposing the private stuff on the WWW. I wanted to do everything possible to avoid forking - but maybe I should just fork.

For drop in you mean 'add' in a certain path or 'merge' over existing pillars? Because if it's the former, perhaps submodules or subtreesmight help?

noelmcloughlin commented 4 years ago

So it should work better without interfering with the original packaging.

Thanks @aboe I will look at this instead.

noelmcloughlin commented 4 years ago

perhaps submodules or subtreesmight help?

It might.

The real motivation was

Mostly I want to merge in (if I recall correctly)

noelmcloughlin commented 4 years ago

Thanks @Aboe I will look at this instead.

I think I prefer --allow-skip-broken - the implementation only uses this for one specific task (install a few packages). Let me think further and compare approaches.

noelmcloughlin commented 4 years ago

Hi @aboe76 I have to fallback to --skip-broken because it serves the need best. I tried SCL but it binds to active bash session and all new bash sessions spawned by the script lose the bond and cannot find git or pickup wong git. I'm just trying to fix one dependant project short term on Cent7 for one command - this is once off option for a few packages.

aboe76 commented 4 years ago

@noelmcloughlin ok merged it.

noelmcloughlin commented 4 years ago

Thanks guys