From 656d9387a6b35e257aefd39e9d1c380e8babec41 Mon Sep 17 00:00:00 2001 From: Alec Leamas Date: Wed, 13 Oct 2010 12:23:21 +0200 Subject: [PATCH] Separate wsd daemon, simpler bundle directories, -f bundle update flag For fedora, splits off the wsd daemin in separate package. Overall, tools to handle bad Gemfile.lock README notes, -f option to invoke 'bundle update' in make-dist.sh. Minor bugfixes --- pkg/fedora/README.md | 17 ++++++++++--- pkg/fedora/diaspora-bundle.spec | 8 +++---- pkg/fedora/diaspora.spec | 42 +++++++++++++++++++++++++-------- pkg/fedora/make-dist.sh | 27 +++++++++++++-------- pkg/ubuntu/README.md | 17 +++++++++---- 5 files changed, 79 insertions(+), 32 deletions(-) diff --git a/pkg/fedora/README.md b/pkg/fedora/README.md index 346730a3a..8060df3a6 100644 --- a/pkg/fedora/README.md +++ b/pkg/fedora/README.md @@ -1,8 +1,6 @@ ## Diaspora RPM tools -NOTE: This does not work ATM, see discussions on Gemfile.lock in -attached to a commit 12/10 (yea, I know, you calll it 10/12, but you -are wrong ;) +NOTE: This does not work ATM, see http://bugs.joindiaspora.com/issues/372 Creates diaspora source tarballs and RPM packages @@ -89,6 +87,19 @@ The source tarball is as retrieved from diaspora with following differences: - The file .bundle/config is patched. Remove before doing *bundle install* +./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The +root cause is a bad Gemfile in the git repo. Possible fixes includes +using a older version known to work: + + % ./make-dist.sh -c c818885b6 bundle + % ./make-dist.sh -c c818885b6 source + +or forcing a complete update of Gemfile.lock using 'bundle update' (a +potential problematic operation): + + % ./make-dist.sh -f bundle + + Routines uses last available version from master branch at github. The version contains a time stamp and an abbreviated git commit id. Using -c, a specific commit can be used for source build. diff --git a/pkg/fedora/diaspora-bundle.spec b/pkg/fedora/diaspora-bundle.spec index 6f04cff2f..5e66dcc75 100644 --- a/pkg/fedora/diaspora-bundle.spec +++ b/pkg/fedora/diaspora-bundle.spec @@ -73,7 +73,7 @@ pushd bundle/ruby/1.8/ chmod 755 gems/thin-1.2.7/example/async_tailer.ru chmod 644 gems/i18n-0.4.1/MIT-LICENSE chmod 755 gems/abstract-1.0.0/abstract.gemspec - chmod 644 gems/mini_magick-2.1/MIT-LICENSE + chmod 644 gems/mini_magick-2.1/MIT-LICENSE || : chmod 755 gems/thin-1.2.7/lib/thin/controllers/service.sh.erb chmod 644 gems/treetop-1.4.8/spec/compiler/test_grammar.tt popd @@ -201,8 +201,8 @@ pushd bundle/ruby/1.8/gems/selenium-webdriver-0.0.28/lib/selenium/webdriver/ popd } -mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle/master/vendor -cp -ar bundle $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle/master/vendor +mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle/ +cp -ar bundle $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle/ find %{buildroot}/%{_libdir}/diaspora-bundle \ -type d -fprintf dirs '%%%dir "%%p"\n' @@ -220,7 +220,7 @@ cat files >> dirs && cp dirs files %files -f files %defattr(-, diaspora, diaspora, 0755) -%doc COPYRIGHT Gemfile AUTHORS GNU-AGPL-3.0 +%doc COPYRIGHT Gemfile Gemfile.lock AUTHORS GNU-AGPL-3.0 %files -f dev-files devel %defattr(-, root, root, 0644) diff --git a/pkg/fedora/diaspora.spec b/pkg/fedora/diaspora.spec index b4bd62b5d..4c0cca719 100644 --- a/pkg/fedora/diaspora.spec +++ b/pkg/fedora/diaspora.spec @@ -1,5 +1,9 @@ +# Turn off the brp-python-bytecompile script +%global __os_install_post %(echo '%{__os_install_post}' | \ + sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') %global debug_package %{nil} -%define git_release 1010092232_b313272 + +%define git_release HEAD Summary: A social network server Name: diaspora @@ -13,19 +17,30 @@ Source: %{name}-%{version}-%{git_release}.tar.gz Source1: diaspora-wsd Source2: diaspora-setup Source3: diaspora.logconf -Source4: make_rel_symlink.py +Source4: make_rel_symlink.py BuildArch: noarch BuildRoot: %{_rmpdir}/not-used-in-fedora/ Requires: mongodb-server Requires: ruby(abi) = 1.8 -Requires: diaspora-bundle = 0.0-1.1010081636_d1a4ee0.fc13 +Requires: diaspora-bundle = %{version} %description A privacy aware, personally controlled, do-it-all and open source social network server. +%package wsd +Summary: Sys V init script for diaspora websocket daemon +Group: Applications/Communications +Requires: %{name} = %{version} + +%description wsd +Tools to use the diaspora websocket daemon as a service e. g., when +using papche passenger or system-wide installed thin server to run +diaspora. + + %prep %setup -q -n %{name}-%{version}-%{git_release} @@ -34,12 +49,13 @@ 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/master/vendor/bundle|' \ + '/BUNDLE_PATH/s|:.*|: %{_libdir}/diaspora-bundle/bundle|' \ master/.bundle/config cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS . @@ -55,6 +71,9 @@ cp %SOURCE3 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/diaspora mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora +cp -ar master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master +mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads +mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp cp %SOURCE2 $RPM_BUILD_ROOT/%{_datadir}/diaspora mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora @@ -79,11 +98,10 @@ sed -i -e '\|.*/master/config.ru"$|d' \ files -%post -/sbin/chkconfig --add diaspora-wsd +%post wsd +/sbin/chkconfig --add diaspora-wsd || : - -%preun +%preun wsd if [ $1 -eq 0 ] ; then service diaspora-wsd stop &>/dev/null || : /sbin/chkconfig --del diaspora-wsd @@ -102,15 +120,19 @@ rm -fr $RPM_BUILD_ROOT %attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora %attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/uploads %attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/tmp + %{_datadir}/diaspora/master/tmp %{_datadir}/diaspora/master/public/uploads %{_datadir}/diaspora/master/log + %config(noreplace) %{_sysconfdir}/logrotate.d/diaspora + +%files wsd +%defattr(-, root, root, 0755) %{_sysconfdir}/init.d/diaspora-wsd %changelog -* Fri Sep 24 2010 Alec Leamas 0.0-1.1010092232_b313272.fc13 - +* Fri Sep 24 2010 Alec Leamas 0.0-1.1009280542_859ec2d - Initial attempt to create a spec fi+le # rubygem-term-ansicolor in repo (1.0.5) diff --git a/pkg/fedora/make-dist.sh b/pkg/fedora/make-dist.sh index 2ab4ccac5..18dbfff9b 100755 --- a/pkg/fedora/make-dist.sh +++ b/pkg/fedora/make-dist.sh @@ -126,7 +126,8 @@ function checkout() git clone --quiet $GIT_REPO; ( cd diaspora; - git remote add upstream $GIT_REPO + git remote add upstream \ + git://github.com/diaspora/diaspora.git for p in ../../*.patch; do git apply --whitespace=fix $p > /dev/null done &> /dev/null || : @@ -166,9 +167,6 @@ function make_src find $PWD -name .git\* | xargs rm -rf rm -rf .bundle /usr/bin/patch -p1 -s <../../../add-bundle.diff - for p in ../../../*.patch; do - /usr/bin/patch -p1 -s < $p - done &> /dev/null || : ) tar czf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR} && \ rm -rf ${RELEASE_DIR} @@ -183,6 +181,7 @@ function make_bundle() # Usage: make_bundle [ commit, defaults to HEAD] # { +set -x checkout ${1:-'HEAD'} >/dev/null bundle_id=$( git_id dist/diaspora/Gemfile) bundle_name="diaspora-bundle-$VERSION-$bundle_id" @@ -192,11 +191,14 @@ function make_bundle() rm -rf $bundle_name mkdir -p $bundle_name/bundle pushd diaspora > /dev/null + if [ "$BUNDLE_FIX" = 'yes' ]; then + bundle update + fi bundle install --deployment \ --path="../$bundle_name/bundle" \ --without=test rdoc - cp -ar AUTHORS Gemfile GNU-AGPL-3.0 COPYRIGHT \ + cp -ar AUTHORS Gemfile Gemfile.lock GNU-AGPL-3.0 COPYRIGHT \ "../$bundle_name" popd > /dev/null tar czf $bundle_name.tar.gz $bundle_name @@ -204,8 +206,7 @@ function make_bundle() cd .. } echo - echo "Repo: $GIT_REPO" - echo "Bundle: dist/$bundle_name.tar.gz" + echo "Bundle: dist/$bundle_name.tar.gz" } @@ -269,6 +270,8 @@ function usage() -r release Mark with specified release, defaults to 1. -u uri Git repository URI, defaults to $GIT_REPO. + -f For bundle, fix dependencies by running 'bundle update' + before 'bundle install' source Build a diaspora application tarball. bundle Build a bundler(1) bundle for diaspora. @@ -280,8 +283,10 @@ function usage() EOF } + commit='HEAD' -while getopts ":r:c:u:h" opt +BUNDLE_FIX='no' +while getopts ":r:c:fh" opt do case $opt in u) GIT_REPO="$OPTARG" @@ -290,6 +295,8 @@ do ;; r) RELEASE="$OPTARG:" ;; + f) BUNDLE_FIX='yes' + ;; h) usage exit 0 ;; @@ -300,7 +307,7 @@ do done shift $(($OPTIND - 1)) -typeset -r GIT_REPO RELEASE +typeset -r GIT_REPO RELEASE BUNDLE_FIX export LANG=C test $# -gt 1 -o $# -eq 0 && { @@ -310,7 +317,7 @@ test $# -gt 1 -o $# -eq 0 && { case $1 in - "bundle") make_bundle $commit + "bundle") make_bundle $commit $BUNDLE_FIX ;; 'source') make_src $commit ;; diff --git a/pkg/ubuntu/README.md b/pkg/ubuntu/README.md index b676ebf0c..ee78f6df7 100644 --- a/pkg/ubuntu/README.md +++ b/pkg/ubuntu/README.md @@ -1,9 +1,6 @@ ## Package-oriented install for ubuntu. -NOTE: This does not work ATM, see discussions on Gemfile.lock in -attached to a commit 12/10 (yea, I know, you calll it 10/12, but you -are wrong ;) - +NOTE: This does not work ATM, see http://bugs.joindiaspora.com/issues/372 Here are somediaspora-installdiaspora-install scripts to install diaspora on Ubuntu. They are designed to work as a first step towards packaging, but should be usable as is. @@ -52,6 +49,16 @@ OK to use. If it's not, it will build a new. ### Notes +./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The +root cause is a bad Gemfile.lock in the git repo. Possible fixes includes +using a older version known to work: + % ./make-dist.sh -c c818885b6 bundle + % ./make-dist.sh -c c818885b6 source + +or forcing a complete update of Gemfile.lock using 'bundle update' (a +potential problematic operation): + % ./make-dist.sh -f bundle + The application lives in /usr/share/diaspora/master. All writable areas (log, uploads, tmp) are links to /var/lib/diaspora. The config file lives in /etc/diaspora. All files in /usr/share are read-only, owned by root. @@ -59,7 +66,7 @@ in /etc/diaspora. All files in /usr/share are read-only, owned by root. The bundle lives in /usr/lib/diaspora-bundle, readonly, owned by root. Application finds it through the patched .bundle/config in root dir. -Once diaspora ins installed ,makedist.sh et. al. are available in +Once diaspora is installed, makedist.sh et. al. are available in /usr/share/diaspora/master/pkg/ubuntu, so there's no need to checkout the stuff using git in this case.