diff --git a/pkg/fedora/.gitignore b/pkg/fedora/.gitignore index 3fab5f9c0..bedbdc760 100644 --- a/pkg/fedora/.gitignore +++ b/pkg/fedora/.gitignore @@ -1,2 +1,3 @@ TODO dist +.stgit* diff --git a/pkg/fedora/README.md b/pkg/fedora/README.md index f58f6206d..331580962 100644 --- a/pkg/fedora/README.md +++ b/pkg/fedora/README.md @@ -1,8 +1,8 @@ ## Diaspora RPM tools -Creates RPM packages from diaspora git repository. +Creates RPM packages from diaspora git repository. -An alternative to the capistrano system, providing classic, binary RPM +An alternative to the capistrano system, providing classic, binary RPM packages for deployment on Fedora 13. @@ -12,7 +12,7 @@ packages for deployment on Fedora 13. http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora or http://github.com/diaspora/diaspora/wiki/Installing-on-CentOS-Fedora -Create source tarballs like dist/diaspora-0.0-1010041233_fade4231.tar.gz +Create source tarballs like dist/diaspora-0.0-1010041233_fade4231.tar.gz and dist/diaspora-bundle-0.0-1010041233_fade4231.tar.gz: % ./make-dist.sh source % ./make-dist.sh bundle @@ -28,7 +28,7 @@ Install (as root): rpm -U ~/rmpbuild/rpms/i686/diaspora-bundle-0.0-1.1010042345_4343fade43.fc13.i686 rpm -U ~/rmpbuild/rpms/noarch/diaspora-0.0-1.1010042345_4343fade43.fc13.noarch -Initiate (as root). +Initiate (as root). /usr/share/diaspora/diaspora-setup Start development server: @@ -37,7 +37,7 @@ Start development server: cd /usr/share/diaspora/master ./script/server -See http://github.com/diaspora/diaspora/wiki/Using-apache for +See http://github.com/diaspora/diaspora/wiki/Using-apache for apache/passenger setup. After configuration, start with: /sbin/service diaspora-ws start /sbin/service httpd restart @@ -57,15 +57,15 @@ source from git. The spec-files in dist/ are patched by ./make-dist.sh source to reference correct versions of diaspora and diaspora-bundle. The diaspora-bundle -is only updated if Gemfile is updated, upgrading diaspora doesn't +is only updated if Gemfile is updated, upgrading diaspora doesn't always require a new diaspora-bundle. Editing spec files should be done in this directory, changes in dist/ are lost when doing ./make-dist source. The topmost comment's version is patched to reflect the complete version -of current specfile by 'make-dist source'. WRite the comment in this +of current specfile by 'make-dist source'. WRite the comment in this directory, copy-paste previous version nr. It will be updated. -This has been confirmed to start up and provide basic functionality both using +This has been confirmed to start up and provide basic functionality both using the thin webserver and apache passenger, and on 32/64 bit systems. #### Implementation @@ -74,16 +74,16 @@ the thin webserver and apache passenger, and on 32/64 bit systems. dist/diaspora directory. This content is, after some patches, the diaspora package. 'make-dir.sh bundle' makes a 'bundle install --deployment' in the diaspora dir. -The resulting bundle is stored in vendor/bundle. This is, after some more +The resulting bundle is stored in vendor/bundle. This is, after some more patches, the content of diaspora-bundle. -Here is also support for running the diaspora websocket service as a system +Here is also support for running the diaspora websocket service as a system service through /sbin/service and some install scripts. - + Diaspora files are stored in /usr/share/diaspora, and owned by root. The bundle, containing some C extensions, is architecture-dependent and lives in /usr/lib[64]/diaspora. Log files are in /var/log/diaspora. Symlinks in -/usr/share diaspora makes log, bundle and tmp dir available as expected by +/usr/share diaspora makes log, bundle and tmp dir available as expected by diaspora app. This is more or less as mandated by LSB and Fedora packaging rules. find . -type l -exec ls -l {} \; | awk '{print $9, $10, $11}' @@ -91,7 +91,7 @@ diaspora app. This is more or less as mandated by LSB and Fedora packaging rule ./log -> /var/log/diaspora ./tmp -> /var/lib/diaspora/tmp ./vendor/bundle -> /usr/lib/diaspora-bundle/master/vendor/bundle - + #### Discussion @@ -108,11 +108,11 @@ original README.md: not 777. - Splitting in two packages makes sense IMHO. The bundle is not changed that often, - but is quite bug: ~18M without test packages (the default) or ~55M with test - packages. The application is just ~7.5M, and is fast to deploy even with these + but is quite big: ~30M without test packages (the default) or ~55M with test + packages. The application is just ~3M, and is fast to deploy even with these tools (yes, I know, capistrano is much faster...) - Many, roughly 50% of the packages in the bundle are already packaged for Fedora i. e., they could be removed from the bundle and added as dependencies instead. - This is likely to make things more stable in the long run. + This is likely to make things more stable in the long run. diaspora.spec has a list. diff --git a/pkg/fedora/SOURCES b/pkg/fedora/SOURCES index 4f85fc9c7..a6f24b8ce 100644 --- a/pkg/fedora/SOURCES +++ b/pkg/fedora/SOURCES @@ -1,3 +1,4 @@ # These files will be linked to %_sourcedir by 'make-dist links' diaspora-setup diaspora-ws +diaspora.logconf diff --git a/pkg/fedora/add-bundle.patch b/pkg/fedora/add-bundle.diff similarity index 100% rename from pkg/fedora/add-bundle.patch rename to pkg/fedora/add-bundle.diff diff --git a/pkg/fedora/diaspora.spec b/pkg/fedora/diaspora.spec index bb45bac67..97486c3bc 100644 --- a/pkg/fedora/diaspora.spec +++ b/pkg/fedora/diaspora.spec @@ -1,17 +1,18 @@ -%global debug_package %{nil} +%global debug_package %{nil} %define git_release HEAD Summary: A social network server Name: diaspora Version: 0.0.1 Release: 1.%{git_release}%{?dist} -License: AGPLv3 +License: AGPLv3 Group: Applications/Communications URL: http://www.joindiaspora.com/ Vendor: joindiaspora.com Source: %{name}-%{version}-%{git_release}.tar.gz Source1: diaspora-ws Source2: diaspora-setup +Source3: diaspora.logconf BuildArch: noarch Requires: mongodb-server @@ -32,26 +33,26 @@ find . -perm /u+x -type f -exec \ %build rm -rf master/vendor/bundle mkdir master/tmp || : -pushd master - tar cf public/source.tar --exclude='source.tar' -X .gitignore * -popd %install -[ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora -cp master/README.md . -mv master/GNU-AGPL-3.0 . +rm -fr $RPM_BUILD_ROOT + +cp master/GNU-AGPL-3.0 master/COPYRIGHT master/README.md master/AUTHORS . +cp master/pkg/fedora/README.md README-Fedora.md -mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora mkdir -p $RPM_BUILD_ROOT/etc/init.d -sed -i '/^cd /s|.*|cd %{_datadir}/diaspora/master|' diaspora-ws -cp diaspora-ws $RPM_BUILD_ROOT/etc/init.d -mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d -cp diaspora.logconf $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/diaspora +cp %SOURCE1 $RPM_BUILD_ROOT/etc/init.d +sed -i '/^cd /s|.*|cd %{_datadir}/diaspora/master|' \ + $RPM_BUILD_ROOT/etc/init.d/diaspora-ws + +mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d +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/.gitignore master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master -cp diaspora-setup $RPM_BUILD_ROOT/%{_datadir}/diaspora +cp %SOURCE2 $RPM_BUILD_ROOT/%{_datadir}/diaspora + +mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp @@ -91,7 +92,7 @@ fi %files -f files %defattr(-, root, root, 0755) -%doc README.md GNU-AGPL-3.0 +%doc AUTHORS README.md GNU-AGPL-3.0 COPYRIGHT README-Fedora.md %attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config.ru %attr(-, diaspora, diaspora) %{_datadir}/diaspora/master/config/environment.rb %attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora diff --git a/pkg/fedora/make-dist.sh b/pkg/fedora/make-dist.sh index 19e52feb8..a5a0f85c6 100755 --- a/pkg/fedora/make-dist.sh +++ b/pkg/fedora/make-dist.sh @@ -118,7 +118,7 @@ function checkout() git://github.com/diaspora/diaspora.git for p in ../../*.patch; do git apply --whitespace=fix $p > /dev/null - done + done &>/dev/null || : ) } cd diaspora; @@ -141,17 +141,18 @@ function make_dist RELEASE_DIR="diaspora-$VERSION-$commit" rm -rf dist/${RELEASE_DIR} mkdir dist/${RELEASE_DIR} - cp diaspora-ws diaspora-setup diaspora.logconf dist/${RELEASE_DIR} cd dist mkdir ${RELEASE_DIR}/master cp -ar diaspora/* diaspora/.git* ${RELEASE_DIR}/master mv ${RELEASE_DIR}/master/diaspora.spec ${RELEASE_DIR} ( - cd ${RELEASE_DIR}; - find . -name .gitkeep -delete - cd master + cd ${RELEASE_DIR}/master + git show --name-only > config/gitversion + tar cf public/source.tar \ + --exclude='source.tar' -X .gitignore * + find $PWD -name .git\* | xargs rm -rf rm -rf .bundle - git apply ../../../add-bundle.patch + /usr/bin/patch -p1 <../../../add-bundle.diff ) tar czf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR} && \ rm -rf ${RELEASE_DIR} @@ -198,23 +199,36 @@ function make_links() echo "Can't find RPM source directory, giving up." exit 2 } - echo "Linking sources to $dest" src_commit="${1:-$( checkout)}" + echo "Linking sources for $src_commit to $dest" src="dist/diaspora-$VERSION-$src_commit.tar.gz" + test -e $src || + cat <<- EOF + Warning: $src does not exist + (last version not built?) + EOF ln -sf $PWD/$src $dest bundle_commit=$(git_id dist/diaspora/Gemfile) bundle="dist/diaspora-bundle-$VERSION-$bundle_commit.tar.gz" + test -e $bundle || + cat <<- EOF + Warning: $bundle does not exist + (last version not built?) + EOF ln -sf $PWD/$bundle $dest for file in $( grep -v '^#' SOURCES); do - ln -sf $PWD/$file $dest/$file + if [ -e "$file" ]; then + ln -sf $PWD/$file $dest/$file + else + echo "Warning: $file (listed in SOURCES) does not exist" + fi done - cd $dest - find . -type l -not -readable -exec rm {} \; + ( cd $dest; find . -type l -not -readable -exec rm {} \;) } function usage() @@ -259,10 +273,6 @@ case $1 in 'links') make_links $commit ;; - "fix_gemfile") - fix_gemfile - ;; - *) usage exit 1 ;;