Simplify git-annex.cabal and generate sdist with make-sdist.sh.

The `cabal install` is happy as long as the files it needs are
present, but `cabal sdist` will only package up files you tell it to.
So, generate the source tarball ourselves.

The source tarball is generated by make-sdist.sh, which uses cabal
sdist to calculate the package name.  Could also generate the name
from the 'Version:' field in git-annex.cabal.
This commit is contained in:
Nathan Collins 2012-06-12 02:36:05 -07:00
parent 72b0054931
commit 79a71d9ba6
3 changed files with 24 additions and 31 deletions

View file

@ -98,20 +98,12 @@ docs: $(mans)
clean:
rm -rf tmp $(bins) $(mans) test configure *.tix .hpc $(sources) \
doc/.ikiwiki html dist $(clibs) git-annex.cabal
doc/.ikiwiki html dist $(clibs)
# Workaround for cabal sdist not running Setup hooks, so I cannot
# generate a file list there.
# Workaround for `cabal sdist` requiring all included files to be listed
# in .cabal.
sdist: clean $(mans)
# Could make this a .PHONY, but it needs to be rerun each time,
# unless we want to list a *lot* of dependencies.
./git-annex.cabal.template.sh > git-annex.cabal
# Complains about not running 'configure' first, but adding
#
# cabal configure
#
# does not help.
cabal sdist
./make-sdist.sh
# Upload to hackage.
hackage: sdist

24
git-annex.cabal Executable file → Normal file
View file

@ -1,11 +1,5 @@
#!/bin/bash
# Template for git-annex.cabal: the 'Other-Module:' fields are
# dynamically generated.
cat <<EOF
Name: git-annex
Version: 3.20120605
Version: 3.20120606
Cabal-Version: >= 1.8
License: GPL
Maintainer: Joey Hess <joey@kitenet.net>
@ -30,9 +24,6 @@ Description:
versioned files, which is convenient for maintaining documents, Makefiles,
etc that are associated with annexed files but that benefit from full
revision control.
Extra-Source-Files:
git-annex.1 git-annex-shell.1
INSTALL README CHANGELOG NEWS GPL COPYRIGHT
Flag S3
Description: Enable S3 support
@ -44,10 +35,8 @@ Executable git-annex
pcre-light, extensible-exceptions, dataenc, SHA, process, json, HTTP,
base == 4.5.*, monad-control, transformers-base, lifted-base,
IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance
Other-Modules:
Utility.Touch
-- Auto-generated list of all Haskell modules:
`./gen-other-modules.sh | xargs -n1 -i echo ' '{}`
-- Need to list this because it's generated from a .hsc file.
Other-Modules: Utility.Touch
C-Sources: Utility/libdiskfree.c
Extensions: CPP
@ -55,6 +44,7 @@ Executable git-annex
Build-Depends: hS3
CPP-Options: -DWITH_S3
-- XXX: Broken.
Test-Suite test
Type: exitcode-stdio-1.0
Main-Is: test.hs
@ -63,14 +53,10 @@ Test-Suite test
pcre-light, extensible-exceptions, dataenc, SHA, process, json, HTTP,
base == 4.5.*, monad-control, transformers-base, lifted-base,
IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance
Other-Modules: Utility.Touch
C-Sources: Utility/libdiskfree.c
Other-Modules:
Utility.Touch
-- Auto-generated list of all Haskell modules:
`./gen-other-modules.sh | xargs -n1 -i echo ' '{}`
Extensions: CPP
source-repository head
type: git
location: git://git-annex.branchable.com/
EOF

15
make-sdist.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
# Create target directory
cabal sdist
sdist_dir=$(basename dist/*.tar.gz .tar.gz)
rm -f dist/*.tar.gz
mkdir dist/$sdist_dir
find . \( -name .git -or -name dist -or -name cabal-dev \) -prune \
-or -not -name \\*.orig -not -type d -print \
| perl -ne 'print unless length >= 100' \
| xargs cp --parents --target-directory dist/$sdist_dir
cd dist
tar -caf $sdist_dir.tar.gz $sdist_dir