Bug 1320210

Summary: git.spec: Support for el5 and el6
Product: [Fedora] Fedora Reporter: Konrad Scherer <kmscherer+rhbugzilla>
Component: gitAssignee: Petr Stodulka <pstodulk>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: rawhideCC: chrisw, jbowes, pstodulk, tmz
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-30 20:23:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Patch for el5 and el6 support
none
Conditionalize bash-completion pkg-config usage for EL <= 6
none
Improve el5 and el6 support
none
Conditionalize bash-completion pkg-config usage for EL <= 6 none

Description Konrad Scherer 2016-03-22 14:56:32 UTC
Created attachment 1139089 [details]
Patch for el5 and el6 support

Description of problem:

With the recent CVE against git, I decided to upgrade all my servers to the latest version of git. Unfortunately some of the servers are CentOS 5 and 6 and no recent versions of git or older releases with the CVE patches are available.

I "ported" the git.spec from F25 and verified that it built on CentOS 5,6 and 7 x86_64. The changes are minor and perhaps they will be useful to other poor sysadmins stuck supporting older releases.

Version-Release number of selected component (if applicable):

I used current tip of master branch:

http://pkgs.fedoraproject.org/cgit/rpms/git.git/commit/?id=caed48f0ed1ccdfb945fa267dae797c9be9a5d4f

How reproducible:

Use mock to try to build F25 src rpm from Koji

Steps to Reproduce:

1. Download latest git src rpm from Koji. I used https://kojipkgs.fedoraproject.org//packages/git/2.7.4/1.fc25/src/git-2.7.4-1.fc25.src.rpm

2. rpm -i git-2.7.4-1.fc25.src.rpm

3. mock -r epel-5-x86_64 --buildsrpm --spec git.spec

Actual results:

Rpm build fails

Expected results:

Rpm build succeeds

Additional info:

Patch to git.spec is attached. If there is a preferred way for me to submit this patch, i.e. github or koji, let me know and I will be happy to put the patch through that channel.

Comment 1 Todd Zullinger 2016-03-22 15:43:28 UTC
Without looking at the patch, I've got some changes in a local branch which I've been meaning to discuss with the other (more active) git maintainers.  I also think it's very useful to keep the spec file compatible with older EL releases, to the extent possible.  (I suspect that el5 will eventually become a pain to support, just as el4 did with age).

I'll take a look and see if there are any fixes you've made which I missed.  I built for el6 only most recently, so I could have missed something for el5.

Comment 2 Todd Zullinger 2016-03-22 16:45:51 UTC
Created attachment 1139161 [details]
Conditionalize bash-completion pkg-config usage for EL <= 6

Here's how I'd do the bash completion bits.  It leaves less conditional statements in the body of the spec file.  It also ensures ownership of the bash completion dir (which might eventually need to change in as future fedora releases have this in the filesystem package, IIRC).

Comment 3 Todd Zullinger 2016-03-22 16:48:19 UTC
Created attachment 1139162 [details]
Improve el5 and el6 support

This adds Konrad's two additional fixes for better el5/el6 support.

Comment 4 Konrad Scherer 2016-03-22 18:16:54 UTC
Your patch for the bash-completion is much better. Thanks for the quick response.

Comment 5 Petr Stodulka 2016-03-26 15:55:16 UTC
Created attachment 1140612 [details]
Conditionalize bash-completion pkg-config usage for EL <= 6

Thanks for contribution. It makes sense. However there is little problem with using *pkg-config* to get %bashcompdir. It makes troubles when I want to build package for rawhide (mockbuild). pkg-config works only with installed packages and bash-completion isn't installed from the start of processing. Probably this causes troubles during compilation of the git.

So I rather replace it by path directly: /usr/share/bash-completion/completions

Todd, do You agree with this change or do You prefer different solution? Otherwise patches can be applied. Feel free to apply it in rawhide if you agree.

Petr

Comment 6 Todd Zullinger 2016-03-26 16:52:40 UTC
Hi Petr.  The warning/error output from pkg-config is only when mock (re)builds the src rpm.  During the "real" rpm build, it works as it should since we have "BuildRequires: bash-completion" (conditionally, based on the %{bashcomp_pkgconfig} macro).

This is similar to the errors seen when calling python to determine the site lib in some macros.  It's harmless, but it is a bit noisy.  I can easily fix it with '2>/dev/null' in the pkg-config line (and have done so locally).

Here's my mockbuild output from today:

$ rpm -qplv results_git/2.7.4/1.fc25/git-core-2.7.4-1.fc25.x86_64.rpm | grep bash-completion
drwxr-xr-x    2 root    root        0 Mar 26 12:42 /usr/share/bash-completion
drwxr-xr-x    2 root    root        0 Mar 26 12:42 /usr/share/bash-completion/completions
-rw-r--r--    1 root    root    57390 Mar 26 12:42 /usr/share/bash-completion/completions/git
lrwxrwxrwx    1 root    root        3 Mar 26 12:42 /usr/share/bash-completion/completions/gitk -> git

Let me know if you have different results or any other concerns with the suggested patches.  If not, I'll get them applied to the master branch.

Comment 7 Petr Stodulka 2016-03-26 17:35:47 UTC
Ok now I am confused. I have tried another build (twice) with original patch and it works now.

Earlier, for original patch and even with added line 'BuildRequires: bash-completion' I couldn't build package. Or more precisely - I could without Konrad's patch. When I apply both patches, mockbuild fails (only mockbuild, local build was ok too if I remember well).It failed during %build phase - warning messages above weren't main problem. But I have not saved previous build.log and can't reproduce it again.

So You can apply even original patch.

Comment 8 Todd Zullinger 2016-03-30 20:23:25 UTC
I pushed these to master the other day and they've now been built as part of the 2.8.0 update.  Thanks Konrad and Petr. :)