From a279bae720218cd340df123cb214b70da5b123b6 Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Mon, 25 Oct 2010 10:31:13 +0200 Subject: [PATCH] Separate doc dir collecting copyrights and readmes. --- pkg/fedora/.gitignore | 1 + pkg/fedora/diaspora-bundle.spec | 4 +-- pkg/fedora/diaspora.spec | 3 +-- pkg/fedora/make-dist.sh | 42 ++++++++++++++++++++++-------- pkg/ubuntu/diaspora-bundle-install | 6 ++--- 5 files changed, 36 insertions(+), 20 deletions(-) diff --git a/pkg/fedora/.gitignore b/pkg/fedora/.gitignore index bedbdc760..2a21dd54d 100644 --- a/pkg/fedora/.gitignore +++ b/pkg/fedora/.gitignore @@ -1,3 +1,4 @@ TODO dist .stgit* +vendor diff --git a/pkg/fedora/diaspora-bundle.spec b/pkg/fedora/diaspora-bundle.spec index dee189a26..b3496262b 100644 --- a/pkg/fedora/diaspora-bundle.spec +++ b/pkg/fedora/diaspora-bundle.spec @@ -38,8 +38,6 @@ Source file usede to compile native libraries in diaspora-bundle. %setup -q -n %{name}-%{version}-%{git_release} %build -mkdir -p vendor/cache -mv *.gem vendor/cache bundle install --local --deployment --without ri rdoc pushd vendor/bundle/ruby/1.8/gems @@ -218,7 +216,7 @@ cat files >> dirs && cp dirs files %files -f files %defattr(-, diaspora, diaspora, 0755) -%doc COPYRIGHT Gemfile Gemfile.lock AUTHORS GNU-AGPL-3.0 +%doc COPYRIGHT Gemfile Gemfile.lock AUTHORS GNU-AGPL-3.0 docs %files -f dev-files devel %defattr(-, root, root, 0644) diff --git a/pkg/fedora/diaspora.spec b/pkg/fedora/diaspora.spec index 1d61026e5..8a30492c8 100644 --- a/pkg/fedora/diaspora.spec +++ b/pkg/fedora/diaspora.spec @@ -49,13 +49,12 @@ find . -perm /u+x -type f -exec \ %build rm -rf master/vendor/bundle -mkdir master/tmp || : %install rm -fr $RPM_BUILD_ROOT sed -i \ - '/BUNDLE_PATH/s|:.*|: %{_libdir}/diaspora-bundle/bundle|' \ + '/BUNDLE_PATH/s|:.*|: %{_libdir}/diaspora-bundle/vendor/bundle|' \ master/.bundle/config cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS . diff --git a/pkg/fedora/make-dist.sh b/pkg/fedora/make-dist.sh index 5857114c7..a0f91b515 100755 --- a/pkg/fedora/make-dist.sh +++ b/pkg/fedora/make-dist.sh @@ -138,7 +138,7 @@ function checkout() cd diaspora; git fetch --quiet upstream git merge --quiet upstream/master - git checkout --quiet ${1:-'HEAD'} + [ -n "$1" ] && git reset --hard --quiet $1 git_id -n ) } @@ -183,9 +183,9 @@ function read_git_urls() function fix_gemfile() { - gemfile=$1 + local gemfile=$1 for url in $(read_git_urls $gemfile); do - name=${url##*/} + local name=${url##*/} name=${name%.*} rm -rf vendor/git/$name git clone --bare --quiet $url vendor/git/$name && @@ -194,6 +194,22 @@ function fix_gemfile() done } +function make_docs() +{ + local gems=$1 + local dest=$2 + + for gem in $(ls $gems); do + local name=$(basename $gem) + [ -r $gem/README* ] && { + local readme=$(basename $gem/README*) + cp -a $gem/$readme $dest/$readme.$name + } + [ -r $gem/COPYRIGHT ] && \ + cp -a $gem/COPYRIGHT $dest/COPYRIGHT.$name + done +} + function make_bundle() # Create the bundle tarball @@ -201,8 +217,8 @@ function make_bundle() # { checkout ${1:-'HEAD'} >/dev/null - bundle_id=$( git_id dist/diaspora/Gemfile) - bundle_name="diaspora-bundle-$VERSION-$bundle_id" + local bundle_id=$( git_id dist/diaspora/Gemfile) + local bundle_name="diaspora-bundle-$VERSION-$bundle_id" test -e "dist/$bundle_name.tar.gz" || { echo "Creating bundle $bundle_name" cd dist @@ -213,17 +229,21 @@ function make_bundle() rm -rf .bundle bundle update fi + [ -d 'vendor/git' ] || mkdir vendor/git fix_gemfile ./Gemfile bundle install --path vendor/gems bundle package + + mkdir -p "../$bundle_name/docs" + mkdir -p "../$bundle_name/vendor" cp -ar AUTHORS Gemfile Gemfile.lock GNU-AGPL-3.0 COPYRIGHT \ - vendor/cache - cd vendor - mv cache $bundle_name - tar czf ../../$bundle_name.tar.gz $bundle_name - mv $bundle_name cache - cd .. + ../$bundle_name + make_docs "vendor/gems" "../$bundle_name/docs" + mv vendor/cache ../$bundle_name/cache + + tar czf ../$bundle_name.tar.gz $bundle_name + mv ../$bundle_name/cache cache cd .. cd .. } diff --git a/pkg/ubuntu/diaspora-bundle-install b/pkg/ubuntu/diaspora-bundle-install index 88924b930..9a4c9a10a 100755 --- a/pkg/ubuntu/diaspora-bundle-install +++ b/pkg/ubuntu/diaspora-bundle-install @@ -23,11 +23,9 @@ mv $(basename $1 .tar.gz) diaspora-bundle mkdir -p /usr/share/doc/diaspora-bundle || : cd /usr/lib/diaspora-bundle -cp AUTHORS GNU-AGPL-3.0 COPYRIGHT Gemfile Gemfile.lock \ +cp -a AUTHORS GNU-AGPL-3.0 COPYRIGHT Gemfile Gemfile.lock \ /usr/share/doc/diaspora-bundle - -mkdir -p vendor/cache -mv *.gem vendor/cache +cp -ar docs /usr/share/doc/diaspora-bundle bundle install --local --deployment --without ri rdoc