Bug 1052117

Summary: ShellCheck source dir is named shellcheck-version/ not ShellCheck-version/
Product: [Fedora] Fedora Reporter: Jens Petersen <petersen>
Component: ShellCheckAssignee: Dridi Boukelmoune <dridi.boukelmoune>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dridi.boukelmoune, haskell-devel, petersen
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ShellCheck-0.3.4-1.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-11-06 10:08: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:
Embargoed:
Bug Depends On: 1136297    
Bug Blocks:    

Description Jens Petersen 2014-01-13 11:05:07 UTC
Description of problem:
It is unfortunate the current source code dir of ShellCheck
is named in lowercase while the package name is CamelCase.
I assume this comes about because the project is called
shellcheck on github... I think it would be good to point
this out to the author.  I think it might also be problematic
if/when he ever wants to publish the package on Hackage.

Version: 0.2.0

Steps to Reproduce:
1. fedpkg prep
2. ls

Actual results:
ShellCheck/shellcheck-0.2.0
ShellCheck/shellcheck-0.2.0/ShellCheck.cabal

Expected results:
ShellCheck/ShellCheck-0.2.0
ShellCheck/ShellCheck-0.2.0/ShellCheck.cabal

Additional info:
A simple temporary workaround would be to rename
the dir in the spec file:

%prep
%setup -q -n shellcheck-%{version}
mv {shellcheck,ShellCheck}-%{version}

Then at least the Fedora Haskell "toolchain" scripts
will be break when they hit ShellCheck.
I don't think there is any offer Haskell cabal-based
package in Fedora which has this problem.

Alternatively the upstream cabal package could be
renamed to shellcheck but then the Fedora package
should really be renamed accordingly.  So easiest
would be to make the upstream project/tarball name
consistent with the package name.

Comment 1 Dridi Boukelmoune 2014-02-04 23:39:38 UTC
I'm in the process of upgrading to 0.3.1, but I'll get in touch with upstream once it's done.

A tarball in the expected form is available at:
http://hackage.haskell.org/package/ShellCheck-0.3.1/ShellCheck-0.3.1.tar.gz

But it doesn't contain the test/ folder and the Makefile:
https://github.com/koalaman/shellcheck/archive/v0.3.1.tar.gz

So for this release I'll go with the workaround, but it won't work "as is" because of the way %setup seems to work. Anyway I've made a new build for rawhide, I hope this temporarily solves the issue:
http://koji.fedoraproject.org/koji/taskinfo?taskID=6492554

Comment 2 Jens Petersen 2014-02-05 01:29:08 UTC
Thanks a lot - sounds good, worksforme. :)

Will future hackage releases include those missing files?

Comment 3 Dridi Boukelmoune 2014-02-05 06:36:52 UTC
(In reply to Jens Petersen from comment #2)
> Will future hackage releases include those missing files?

That's my goal, it's basically missing everything but the Haskell sources and the cabal file. I suspect it has been generated with some cabal-related tooling that needs to be told to include the missing files (forgot to mention the brand new man page too).

Comment 4 Jens Petersen 2014-02-05 08:39:07 UTC
Okay let me know if I can be of any help: I could
point at some other example .cabal files if it helps.

Comment 5 Dridi Boukelmoune 2014-02-05 10:21:26 UTC
Yes please, my cabal/build knowledge is rather limited, as you can see in my Setup.hs file here:
http://pkgs.fedoraproject.org/cgit/ShellCheck.git/tree/ShellCheck.spec?&id=b0905b2#n65

Thanks to you I've just noticed a similar one now exists upstream:
https://github.com/koalaman/shellcheck/blob/197b3e3/Setup.hs

Comment 6 Jens Petersen 2014-02-06 01:10:21 UTC
Cool - you added building the manpage with pandoc. :)
Unfortunately currently there is no pandoc on arm
so you may want to disable the pandoc dep on armv7hl...
(this should get fixed hopefully soon in Rawhide at least.)

Also I think you could simply the spec a bit:

diff --git a/ShellCheck.spec b/ShellCheck.spec
index 8d8bffd..44ffc8a 100644
--- a/ShellCheck.spec
+++ b/ShellCheck.spec
@@ -60,25 +60,18 @@ This package provides the Haskell %{name} library development files.
 %setup -q -n shellcheck-%{version}
 
 # workaround until the tarball root directory becomes %%{name}-%%{version}
-# see also "cd %%{_builddir}/%%{name}-%%{version}" in other sections
-ln -s shellcheck-%{version} ../%{name}-%{version}
-
-cat >Setup.hs <<EOF
-import Distribution.Simple
-
-main = defaultMain
-EOF
+if [ ! -d ../%{name}-%{version} ]; then
+  ln -s shellcheck-%{version} ../%{name}-%{version}
+fi
 
 
 %build
-cd %{_builddir}/%{name}-%{version}
 %ghc_lib_build
 
 make shellcheck.1
 
 
 %install
-cd %{_builddir}/%{name}-%{version}
 %ghc_lib_install
 
 mkdir   -p %{buildroot}%{_mandir}/man1

Comment 7 Jens Petersen 2014-02-06 01:35:23 UTC
Sorry you also need:

===
diff --git a/ShellCheck.spec b/ShellCheck.spec
index 8d8bffd..c010758 100644
--- a/ShellCheck.spec
+++ b/ShellCheck.spec
@@ -81,8 +81,8 @@ make shellcheck.1
 cd %{_builddir}/%{name}-%{version}
 %ghc_lib_install
 
-mkdir   -p %{buildroot}%{_mandir}/man1
-install -t %{buildroot}%{_mandir}/man1 shellcheck.1
+install -D -p -m 0644 shellcheck.1 %{buildroot}%{_mandir}/man1/shellcheck.1
+
 
 
 %check
===

to fix the manpage permission.


For a .cabal file example including test cases and even building a manpage
I recommend looking at pandoc - it might be a bit long or do more than
you need but I think it is a reasonable example.

http://hackage.haskell.org/package/pandoc ->
http://hackage.haskell.org/package/pandoc-1.12.3.3/pandoc.cabal
or
https://github.com/jgm/pandoc/blob/master/pandoc.cabal

Comment 8 Dridi Boukelmoune 2014-02-09 22:48:19 UTC
(In reply to Jens Petersen from comment #6)
> Cool - you added building the manpage with pandoc. :)

Of course I did, since I originally wrote and submitted it upstream !

> Unfortunately currently there is no pandoc on arm
> so you may want to disable the pandoc dep on armv7hl...
> (this should get fixed hopefully soon in Rawhide at least.)

Yeah, by the time I'd seen that, it was too late for me to fix until today.

New (scratch) build, merged with your diffs:
http://koji.fedoraproject.org/koji/taskinfo?taskID=6509906

I'll submit that as the next update.

(In reply to Jens Petersen from comment #7)
> For a .cabal file example including test cases and even building a manpage
> I recommend looking at pandoc - it might be a bit long or do more than
> you need but I think it is a reasonable example.
> 
> http://hackage.haskell.org/package/pandoc ->
> http://hackage.haskell.org/package/pandoc-1.12.3.3/pandoc.cabal
> or
> https://github.com/jgm/pandoc/blob/master/pandoc.cabal

Thanks, my next course of action is to actually fix this bug and make sure the tarball on hackage meets both our requirements :)

Comment 9 Dridi Boukelmoune 2014-06-01 18:34:07 UTC
Sorry for being unresponsive so long, but I have sent a patch upstream today:
https://github.com/koalaman/shellcheck/pull/169

Comment 10 Jens Petersen 2014-09-02 01:28:48 UTC
No worries: I added ShellCheck to https://fedoraproject.org/wiki/Upstream_release_monitoring
just now, so you should get alerts of new releases via bugzilla
from now on.

I hope QuickCheck 2.6 may be sufficient for the time being
since I don't think a newer version will appear in Fedora
until next year.

Comment 11 Dridi Boukelmoune 2014-09-02 09:03:56 UTC
(In reply to Jens Petersen from comment #10)
> No worries: I added ShellCheck to
> https://fedoraproject.org/wiki/Upstream_release_monitoring
> just now, so you should get alerts of new releases via bugzilla
> from now on.

I could have sworn I had already added it, thanks!

> I hope QuickCheck 2.6 may be sufficient for the time being
> since I don't think a newer version will appear in Fedora
> until next year.

Sure, I will try that instead like I said in bug 1081471.

Comment 12 Dridi Boukelmoune 2014-09-02 10:03:06 UTC
Actually, 0.3.4 depends on QuickCheck > 2.2, it's the master branch that depends on 2.7.4+.

I've misread the build log when it failed.

Comment 13 Jens Petersen 2014-10-01 03:43:44 UTC
I believe this is fixed in ShellCheck-0.3.4-1.fc22, thanks!