diff --git a/pkg/fedora/.bundle/config b/pkg/fedora/.bundle/config new file mode 100644 index 000000000..1c3e2cedf --- /dev/null +++ b/pkg/fedora/.bundle/config @@ -0,0 +1,5 @@ +--- +BUNDLE_FROZEN: "1" +BUNDLE_DISABLE_SHARED_GEMS: "1" +BUNDLE_WITHOUT: test:rdoc +BUNDLE_PATH: vendor/bundle diff --git a/pkg/fedora/Gemfile.lock.patch b/pkg/fedora/Gemfile.lock.patch new file mode 100644 index 000000000..7b96c043e --- /dev/null +++ b/pkg/fedora/Gemfile.lock.patch @@ -0,0 +1,13 @@ +diff --git a/Gemfile.lock b/Gemfile.lock +index 8534f58..44d386e 100644 +--- a/Gemfile.lock ++++ b/Gemfile.lock +@@ -258,7 +258,7 @@ DEPENDENCIES + autotest + bson (= 1.0.7) + bson_ext (= 1.0.7) +- bundler (= 1.0.0) ++ bundler (>= 1.0.0) + capybara (~> 0.3.9) + carrierwave! + cucumber-rails (= 0.3.2) diff --git a/pkg/fedora/README.md b/pkg/fedora/README.md new file mode 100644 index 000000000..d5bd23fe9 --- /dev/null +++ b/pkg/fedora/README.md @@ -0,0 +1,87 @@ +## Diaspora RPM tools + +Creates RPM packages from diaspora git repository. + +An alternative to the capistrano system, providing classic, binary RPM +packages for deployment on Fedora 13. + +#### Synopsis: + +*Prerequisites*: ruby-1.8, rubygem and other packages as described in +http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora + +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 + +Setup links to tarballs from RPM source directory: + % ./make-dist.sh links + +Build rpms: + rpmbuild -ba dist/diaspora.spec + rpmbuild -ba dist/diaspora-bundle.spec + +Install + 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). + /usr/share/diaspora/diaspora-setup + +Start development server: + sudo + su - diaspora + cd master + ./script/server + +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 + + +#### Notes + +Routines uses last available version from master branch at github. The +version contains a time stamp and an abbreviated git commit id. If listed +in filename order, like ls does, latest version will be the last one. + +*make-dist links* creates links also for all files listed in SOURCES. +Typically, this is patches and secondary sources. + +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 +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. + +rpmlint shows many errors, most of which related to that the server +won't start if the .git directories are not included. Needs investigation. + +This has been confirmed to start up and provide basic functionality both using +the thin webserver and apache passenger. + +#### Implementation + + +'make_dist.sh source' script checks out latest version of diaspora into the + 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 +patches, the content of diaspora-bundle. + +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 diaspora. 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 and bundle available as expected by diaspora app. +This is more or less as mandated by LSB and Fedora packaging rules. + + find /usr/share/diaspora/ -type l -exec ls -l {} \; | awk '{print $9, $10, $11}' + /usr/share/diaspora/master/public/uploads -> /var/lib/diaspora/uploads + /usr/share/diaspora/master/log -> /var/log/diaspora + /usr/share/diaspora/master/vendor/bundle -> /usr/lib/diaspora-bundle/master/vendor/bundle diff --git a/pkg/fedora/SOURCES b/pkg/fedora/SOURCES new file mode 100644 index 000000000..4b487fdf5 --- /dev/null +++ b/pkg/fedora/SOURCES @@ -0,0 +1,7 @@ +# These files will be linked to %_sourcedir by 'make-dist links' +.bundle +diaspora-setup +diaspora-ws +Gemfile.patch +perm-fix.patch +source-fix.patch diff --git a/pkg/fedora/diaspora-bundle.spec b/pkg/fedora/diaspora-bundle.spec new file mode 100644 index 000000000..87656f110 --- /dev/null +++ b/pkg/fedora/diaspora-bundle.spec @@ -0,0 +1,209 @@ +%define git_release 1010040945_a09a6d8 +# 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') + +Summary: Rubygem bundle for diaspora +Name: diaspora-bundle +Version: 0.0 +Release: 1.%{git_release}%{?dist} +License: AGPLv3 +Group: Applications/Communications +URL: http://www.joindiaspora.com/ +Vendor: joindiaspora.com +Source: %{name}-%{version}-%{git_release}.tar.gz +Prefix: %{_prefix} +BuildRequires: git +Requires: ruby(abi) = 1.8 + +%description +The ruby apps bundled with diaspora, as provided by +bundle install --deployment and patched for Fedora use. + +%package devel +Summary: Development files (i. e., sources) for diaspora-bundle +Group: Development/Libraries +Requires: %{name} = %{version} + +%description devel +Source file usede to compile native libraries in diaspora-bundle. + + + +%prep +%setup -q -n %{name}-%{version}-%{git_release} + +pushd bundle/ruby/1.8/ + find . -name \*.css -exec chmod 644 {} \; + find . -name \*.js -exec chmod 644 {} \; + find . -name \*.treetop -exec chmod 644 {} \; + find . -name \*.rdoc -exec chmod 644 {} \; + chmod 644 gems/term-ansicolor-1.0.5/CHANGES || : + chmod 755 gems/cucumber-rails-0.3.2/templates/install/script/cucumber || : + chmod 755 gems/ruby-debug-base-0.10.3/Rakefile || : + chmod 644 gems/cucumber-rails-0.3.2/History.txt || : + chmod 644 gems/cucumber-rails-0.3.2/templates/install/step_definitions/capybara_steps.rb.erb || : + chmod 644 gems/rack-1.2.1/test/cgi/lighttpd.conf || : + chmod 644 gems/term-ansicolor-1.0.5/VERSION || : + chmod 644 gems/mini_magick-2.1/Rakefile || : + chmod 755 gems/linecache-0.43/Rakefile || : + chmod 644 gems/ffi-0.6.3/ext/ffi_c/libffi/ltmain.sh || : + chmod 644 gems/term-ansicolor-1.0.5/README || : + chmod 755 gems/mini_magick-2.1/test/not_an_image.php || : + chmod 755 gems/rake-0.8.7/test/data/statusreturn/Rakefile || : + chmod 755 gems/ruby-debug-0.10.3/Rakefile || : + chmod 644 gems/gherkin-2.2.4/tasks/compile.rake || : + chmod 755 gems/rake-0.8.7/test/data/file_creation_task/Rakefile || : + chmod 644 gems/term-ansicolor-1.0.5/Rakefile || : + chmod 755 gems/mime-types-1.16/Rakefile || : + for f in $(find . -name \*.rb); do + sed -i -e '/^#!/d' $f + chmod 0644 $f + done > /dev/null 2>&1 + find . -type f -print0 | + xargs --null sed -i 's|^#!/usr/local/bin/ruby|#!/usr/bin/ruby|' + + chmod 755 gems/thin-1.2.7/example/async_chat.ru + 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 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 + + +%build + +pushd bundle/ruby/1.8/ + test -d gems/gherkin-*/ext && { + pushd gems/gherkin-*/ext + # Recompile all shared libraries using -O2 optimalization flagcd + for lexer_dir in */ ; do + pushd $lexer_dir + sed -i 's/ -O0 / -O2 /' extconf.rb + # Remove #line lines from C sources + sed -i '/^#line/d' *.c + CONFIGURE_ARGS="--with-cflags='%{optflags}'" ruby extconf.rb + make clean && make RPM_OPT_FLAGS="$RPM_OPT_FLAGS" + make install RUBYARCHDIR="../../lib" + mv ../../lib/${lexer_dir%/}.so . + pushd ../../lib + ln -sf ../ext/${lexer_dir%/}/${lexer_dir%/}.so . + popd + popd + done + popd + } + + test -d gems/ffi-0.6.3/lib && { + pushd gems/ffi-0.6.3/lib + rm ffi_c.so + ln -s ../ext/ffi_c/ffi_c.so . + popd + } + + pushd gems/thin-1.2.7/lib + rm thin_parser.so + ln -s ../ext/thin_parser/thin_parser.so . + popd + + pushd gems/bson_ext-1.0.7/ext/bson_ext + rm cbson.so + ln -s ../cbson/cbson.so . + popd + + pushd gems/ruby-debug-base-0.10.3/lib + rm ruby_debug.so + ln -s ../ext/ruby_debug.so . + popd + + #in repo + pushd gems/eventmachine-0.12.10/lib + rm rubyeventmachine.so + rm fastfilereaderext.so + ln -s ../ext/rubyeventmachine.so . + ln -s ../ext/fastfilereader/fastfilereaderext.so . + popd + + pushd gems/bcrypt-ruby-2.1.2/lib + rm bcrypt_ext.so + ln -s ../ext/mri/bcrypt_ext.so . + popd + + # in repo + pushd gems/nokogiri-1.4.3.1/lib/nokogiri + rm nokogiri.so + ln -sf ../../ext/nokogiri/nokogiri.so . + popd + + pushd gems/json-1.4.6/ext/json/ext/json/ext + rm generator.so + ln -s ../../generator/generator.so + rm parser.so + ln -s ../../parser/parser.so . + popd + + #in repo + pushd gems/linecache-0.43/lib/ + rm trace_nums.so + ln -s ../ext/trace_nums.so . + popd + + pushd bundler/gems/em-http-request-6f66010cda90/lib + rm em_buffer.so + ln -s ../ext/buffer/em_buffer.so . + rm http11_client.so + ln -s ../ext/http11_client/http11_client.so . + popd +popd + + +%install +find . -name .git | xargs rm -rf +find . -name .gitignore -delete +find . -name \*.o -delete || : + +test -d bundle/ruby/1.8/gems/selenium-webdriver-0.0.28 && { +pushd bundle/ruby/1.8/gems/selenium-webdriver-0.0.28/lib/selenium/webdriver/ +%ifarch %ix86 x86_64 +%ifarch %ix86 + rm -rf firefox/native/linux/amd64 +%else + rm -rf firefox/native/linux/i386 +%endif +%else + rm -rf firefox/native/linux/i386 + rm -rf firefox/native/linux/amd64 +%endif +popd +} + +[ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT +mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle/master/vendor + +cp -ar bundle $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle/master/vendor +find %{buildroot}/%{_libdir}/diaspora-bundle \ + -type d -fprintf dirs '%%%dir "%%p"\n' +find -L %{buildroot}/%{_libdir}/diaspora-bundle \ + -regextype posix-awk -type f -not -regex '.*[.]c$|.*[.]h$|.*[.]cpp$' -fprintf files '"%%p"\n' +find %{buildroot}/%{_libdir}/diaspora-bundle -regextype posix-awk \ + -type f -regex '.*[.]c$|.*[.]h$|.*[.]cpp$' -fprintf dev-files '"%%p"\n' +sed -i -e 's|%{buildroot}||' -e 's|//|/|' files dev-files dirs +cat files >> dirs && cp dirs files + +%clean +[ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT + +%files -f files +%defattr(-, root, root, 0755) +%doc COPYRIGHT Gemfile AUTHORS GNU-AGPL-3.0 + +%files -f dev-files devel +%defattr(-, root, root, 0644) +%doc COPYRIGHT AUTHORS GNU-AGPL-3.0 + +%changelog +* Sat Oct 02 2010 Alec Leamas 1.1009271539_08b9aa8 + - Initial attempt to create a spec file diff --git a/pkg/fedora/diaspora-setup b/pkg/fedora/diaspora-setup new file mode 100755 index 000000000..0df7ceb2f --- /dev/null +++ b/pkg/fedora/diaspora-setup @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Do what's needed to initiate diaspora. +# +# See http://github.com/diaspora/diaspora/issues/issue/395 +# +# Note: This is really sort of prototyping. This should be done in ruby, +# on a web page. + +test $UID = "0" || { + echo "You need to be root to do this, giving up" + exit 2 +} + +cd /usr/share/diaspora/master + +if rake db:seed:dev; then + echo "Database config OK, new user tom/evankort in place" +else + cat <<- EOF + + Database config failed. You might want to remove all db files with + rm -rf /var/lib/mongodb/* and/or resetting the config file by + cp config/app_config.yml.example config/app_config.yml before + making a new try. + EOF + exit 1 +fi + +# %attr(0777, diaspora, diaspora) doesn't work in specfile due to umask 022. +chmod 777 /var/lib/diaspora/uploads + +hostname=$( awk '/pod_url:/ { print $2; exit }' >$logfile 2>&1 &" + RETVAL=$? + echo + if test $RETVAL = 0; then + touch $lockfile + pgrep -f "$ruby_cmd" > $pidfile || { + echo "Warning: cannot find running diaspora-webserver" + exit 7 + } + fi +} + +stop() { + [ $UID -eq 0 ] || exit 4 + echo -n $"Stopping $prog: " + killproc -p $pidfile $exec + RETVAL=$? + [ $RETVAL -eq 0 ] && rm -f $lockfile + echo +} + +# +# See how we were called. +# +case "$1" in + start) + start + ;; + stop) + stop + ;; + force-reload|restart) + stop + sleep 1 + start + RETVAL=$? + ;; + condrestart|try-restart) + if [ -f $lockfile ]; then + stop + sleep 3 + start + fi + ;; + status) + status -p $pidfile $exec + RETVAL=$? + ;; + *) + echo $"Usage: $0 {condrestart|try-restart|start|stop|restart|force-reload|status}" + RETVAL=2 + [ "$1" = 'usage' ] && RETVAL=0 +esac + +exit $RETVAL + diff --git a/pkg/fedora/diaspora.logconf b/pkg/fedora/diaspora.logconf new file mode 100644 index 000000000..48eca3916 --- /dev/null +++ b/pkg/fedora/diaspora.logconf @@ -0,0 +1,13 @@ +/var/log/diaspora/*.log { + create 755 diaspora apache + weekly + rotate 10 + copytruncate + delaycompress + compress + notifempty + missingok + postrotate + ( /sbin/service diaspora-ws condrestart ) >/dev/null 2>&1 + endscript +} diff --git a/pkg/fedora/diaspora.spec b/pkg/fedora/diaspora.spec new file mode 100644 index 000000000..318ab9523 --- /dev/null +++ b/pkg/fedora/diaspora.spec @@ -0,0 +1,108 @@ +%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 +Group: Applications/Communications +URL: http://www.joindiaspora.com/ +Vendor: joindiaspora.com +Source: %{name}-%{version}-%{git_release}.tar.gz +Source1: diaspora-ws +Source2: diaspora-setup +BuildArch: noarch + +# See http://github.com/diaspora/diaspora/issues/issue/393 +Patch0: source-fix.patch + +BuildRequires: git + +Requires(pre): shadow-utils +Requires: mongodb-server +Requires: ruby(abi) = 1.8 +Requires: diaspora-bundle = %{version} + +%description +A privacy aware, personally controlled, do-it-all and +open source social network server. + +%prep +%setup -q -n %{name}-%{version}-%{git_release} +pushd master +%patch0 -p1 + +# See: http://github.com/diaspora/diaspora/issues/issue/392 +git apply %{_sourcedir}/perm-fix.patch +popd +find . -perm /u+x -type f -exec \ + sed -i 's|^#!/usr/local/bin/ruby|#!/usr/bin/ruby|' {} \; > /dev/null + +%build +rm -rf master/vendor/bundle +mkdir master/tmp || : +pushd master + tar cf public/source.tar --exclude='source.tar' -X .gitignore * +popd + +%pre +getent group diaspora >/dev/null || groupadd -r diaspora +getent passwd diaspora >/dev/null || \ + useradd -r -g apache \ + -md /usr/share/diaspora -s /sbin/nologin \ + -c "Diaspora daemon" diaspora +exit 0 + +%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 . + +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 +mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora +cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora +cp master/.gitignore $RPM_BUILD_ROOT/%{_datadir}/diaspora/master +cp diaspora-setup $RPM_BUILD_ROOT/%{_datadir}/diaspora +mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads + +%post +rm -f %{_datadir}/diaspora/master/vendor/bundle +rm -f %{_datadir}/diaspora/master/log +rm -f %{_datadir}/diaspora/master/public/uploads + +ln -s %{_localstatedir}/log/diaspora \ + %{_datadir}/diaspora/master/log || : +ln -s %{_libdir}/diaspora-bundle/master/vendor/bundle \ + %{_datadir}/diaspora/master/vendor || : +ln -s %{_localstatedir}/lib/diaspora/uploads \ + %{_datadir}/diaspora/master/public/uploads || : +/sbin/chkconfig --add diaspora-ws + +%preun +if [ $1 -eq 0 ] ; then + service diaspora-ws stop >/dev/null 2>&1 || : + /sbin/chkconfig --del diaspora-ws +fi + +%clean +[ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT + +%files +%defattr(-, root, root, 0755) +%doc README.md GNU-AGPL-3.0 +%attr(0555, diaspora, diaspora) %{_datadir}/diaspora +%attr(-, diaspora, diaspora) %{_localstatedir}/log/diaspora +%attr(-, diaspora, diaspora) %{_localstatedir}/lib/diaspora/uploads +%config(noreplace) %{_sysconfdir}/logrotate.d/diaspora +%{_sysconfdir}/init.d/diaspora-ws + +%changelog +* Fri Sep 24 2010 Alec Leamas 1.1009280542_859ec2d + - Initial attempt to create a spec file diff --git a/pkg/fedora/make-dist.sh b/pkg/fedora/make-dist.sh new file mode 100755 index 000000000..6d0795618 --- /dev/null +++ b/pkg/fedora/make-dist.sh @@ -0,0 +1,275 @@ +#!/bin/bash + +#Usage: See function usage() at bottom. +# +# +# Create a diaspora distribution +# +# Builds a diaspora distribution containing the application and bundled +# libraries. Normally checks out latest version of the master branch. +# +GIT_REPO='http://github.com/diaspora/diaspora.git' +RELEASE='HEAD' +VERSION='0.0' + +function git_id +# +# Echo package-friendly source id. +# +# Usage: git_id [-n] [file or directory] +# +{ + nl="\n" + file_or_dir="$PWD" + test "$1" = '-n' && { nl=""; shift; } + test -n "$1" && file_or_dir="$1" + if [ -d $file_or_dir ]; then + file="" + dir=$file_or_dir + else + file=$(basename $file_or_dir) + dir=$(dirname $file_or_dir) + fi + + export LANG=C + ( + cd $dir + git log -1 --abbrev-commit --date=iso $file | + awk -v nl="$nl" \ + ' BEGIN { commit = "" } + /^commit/ { if ( commit == "") commit = $2 } + /^Date:/ { split( $2, d, "-") + split( $3, t, ":") + } + END { printf( "%s%s%s%s%s_%s%s", + substr( d[1],3), d[2], d[3], + t[1], t[2], + commit, nl) + }' + ) +} + + +function fix_alphatag() +# Patch version on top comment first id line: +# Uses %define git_release to get release. +#* Fri Sep 24 2010 name surname 1.20100925_faf234320 +{ + dist=$(rpm --eval %dist) + awk -v dist="$dist" -v version="$2" \ + ' BEGIN { done = 0 } + /%define/ { if ($2 = "git_release") release = $3 } + /^[*]/ { if (done) + print + else + { + gsub( "1[.].*", "") + printf( "%s%s-1.%s%s\n", + $0, version, release,dist) + done = 1 + } + next + } + { print }' \ + < $1 > $1.tmp && cp $1.tmp $1 && rm $1.tmp +} + +function fix_bundle_deps +# usage: fix_bundle_deps release +# Patches Requires: diaspora-bundle = 0.0-20101021-aefsf323148 +{ + awk -v vers="$2-$3" \ + ' /Requires:/ { if ($2 == "diaspora-bundle") + printf( "%s %s = %s\n", $1,$2,vers) + else + print + next + } + { print}' \ + < $1 > $1.tmp && cp $1.tmp $1 && rm $1.tmp +} + +function patch() +# Patch git_release, Requires: diaspora-bundle and top comment version. +# Usage: patch VERSION RELEASE +{ + sed -e "/^%define/s|HEAD|$2|" \ + -e '/^Version:/s|.*|Version: '$1'|' \ + dist/diaspora.spec + fix_alphatag dist/diaspora.spec $1 + #mkdir dist/diaspora/tmp || : + bundle_id=$(git_id dist/diaspora/Gemfile) + fix_bundle_deps dist/diaspora.spec $1 "1.$bundle_id.fc13" + sed -e "/^%define/s|HEAD|$bundle_deps|" \ + -e '/^Version:/s|.*|Version: '$1'|' \ + < diaspora-bundle.spec > dist/diaspora-bundle.spec + + cp dist/diaspora.spec dist/diaspora/diaspora.spec +} + +function checkout() +# Checkout last version of diaspora unless it's already there. +# Usage: checkout [commit id, defaults to HEAD] +# Returns: commit for current branch's HEAD. +{ + mkdir dist >/dev/null 2>&1 || : + ( + cd dist + test -d diaspora || { + git clone --quiet $GIT_REPO; + ( + cd diaspora; + git remote add upstream \ + git://github.com/diaspora/diaspora.git + ) + } + cd diaspora; + git fetch --quiet upstream + git merge --quiet upstream/master + git checkout --quiet ${1:-'HEAD'} + git_id -n + ) +} + + +function make_dist +# Create a distribution tarball +{ + commit=$(checkout ${1:-'HEAD'}) + echo "Creating source tarball for $commit" + patch $VERSION $commit + + 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 + cp -r ../.bundle ${RELEASE_DIR}/master + mv ${RELEASE_DIR}/master/diaspora.spec ${RELEASE_DIR} + tar czf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR} && rm -rf ${RELEASE_DIR} + cd .. + bundle_id=$(git_id dist/diaspora/Gemfile) + echo "Source: dist/${RELEASE_DIR}.tar.gz" + echo "Required bundle: $bundle_id" + echo "Source specfile: dist/diaspora.spec" + echo "Bundle specfile: dist/diaspora-bundle.spec" +} + +function make_bundle() +{ + checkout ${1:-'HEAD'} >/dev/null + bundle_id=$(git_id dist/diaspora/Gemfile) + bundle_name="diaspora-bundle-$VERSION-$bundle_id" + test -e "dist/$bundle_name.tar.gz" || { + echo "Creating bundle $bundle_name" + cd dist + rm -rf $bundle_name + mkdir -p $bundle_name/bundle + pushd diaspora > /dev/null + test -e ../../Gemfile.lock.patch && + git apply ../../Gemfile.lock.patch > /dev/null 2>&1 + rm -rf devise.tmp + git clone http://github.com/BadMinus/devise.git devise.tmp + ( cd devise.tmp; gem build devise.gemspec) + gem install --install-dir "../$bundle_name/bundle/ruby/1.8" \ + --no-rdoc --no-ri \ + --ignore-dependencies \ + devise.tmp/devise-1.1.rc1.gem && + rm -rf devise.tmp + + bundle install --deployment \ + --path="../$bundle_name/bundle" \ + --without=test rdoc + + cp AUTHORS Gemfile GNU-AGPL-3.0 COPYRIGHT "../$bundle_name" + popd + tar czf $bundle_name.tar.gz $bundle_name + } + echo + echo "Bundle: dist/$bundle_name.tar.gz" +} + +function make_links() +# Usage: make_links [source commit] +{ + dest=$(rpm --eval %_sourcedir) + test -z "$dest" && { + echo "Can't find RPM source directory, giving up." + exit 2 + } + echo "Linking sources to $dest" + + src_commit="$1" + test -z "$src_commit" && { + src_commit=$(checkout) + } + src="dist/diaspora-$VERSION-$src_commit.tar.gz" + ln -sf $PWD/$src $dest + + bundle_commit=$(git_id dist/diaspora/Gemfile) + bundle="dist/diaspora-bundle-$VERSION-$bundle_commit.tar.gz" + ln -sf $PWD/$bundle $dest + + for file in $( egrep -v '^#' SOURCES); do + ln -sf $PWD/$file $dest/$file + done + + cd $dest + find . -type l -not -readable -exec rm {} \; +} + +function usage() +{ + cat <<- EOF + + Usage: make_dist [-c commit] + + -c Use a given commit, defaults to last checked in. + dist Build a diaspora application tarball. + bundle Build a bundler(1) bundle for diaspora. + links Symlink bundle and source tarballs to rpm source dir. + + All results are stored in dist/ + EOF +} + + +test "$1" = "-h" -o $# = 0 && { + usage; + exit 0 +} + +test "$1" = "-c" && { + test -z "$2" && { + usage; + exit 1 + } + commit="$2" + shift; shift +} + + + case $1 in + + "bundle") make_bundle $commit + ;; + + 'source') make_dist $commit + ;; + + 'links') make_links $commit + ;; + + "fix_gemfile") + fix_gemfile + ;; + + *) usage + exit 1 + ;; + esac + + + diff --git a/pkg/fedora/perm-fix.patch b/pkg/fedora/perm-fix.patch new file mode 100644 index 000000000..b6fabed52 --- /dev/null +++ b/pkg/fedora/perm-fix.patch @@ -0,0 +1,120 @@ +diff --git a/public/javascripts/fancybox/blank.gif b/public/javascripts/fancybox/blank.gif +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_close.png b/public/javascripts/fancybox/fancy_close.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_loading.png b/public/javascripts/fancybox/fancy_loading.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_nav_left.png b/public/javascripts/fancybox/fancy_nav_left.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_nav_right.png b/public/javascripts/fancybox/fancy_nav_right.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_shadow_e.png b/public/javascripts/fancybox/fancy_shadow_e.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_shadow_n.png b/public/javascripts/fancybox/fancy_shadow_n.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_shadow_ne.png b/public/javascripts/fancybox/fancy_shadow_ne.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_shadow_nw.png b/public/javascripts/fancybox/fancy_shadow_nw.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_shadow_s.png b/public/javascripts/fancybox/fancy_shadow_s.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_shadow_se.png b/public/javascripts/fancybox/fancy_shadow_se.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_shadow_sw.png b/public/javascripts/fancybox/fancy_shadow_sw.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_shadow_w.png b/public/javascripts/fancybox/fancy_shadow_w.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_title_left.png b/public/javascripts/fancybox/fancy_title_left.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_title_main.png b/public/javascripts/fancybox/fancy_title_main.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_title_over.png b/public/javascripts/fancybox/fancy_title_over.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancy_title_right.png b/public/javascripts/fancybox/fancy_title_right.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancybox-x.png b/public/javascripts/fancybox/fancybox-x.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancybox-y.png b/public/javascripts/fancybox/fancybox-y.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/fancybox.png b/public/javascripts/fancybox/fancybox.png +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/jquery.easing-1.3.pack.js b/public/javascripts/fancybox/jquery.easing-1.3.pack.js +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/jquery.fancybox-1.3.1.css b/public/javascripts/fancybox/jquery.fancybox-1.3.1.css +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/jquery.fancybox-1.3.1.js b/public/javascripts/fancybox/jquery.fancybox-1.3.1.js +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/jquery.fancybox-1.3.1.pack.js b/public/javascripts/fancybox/jquery.fancybox-1.3.1.pack.js +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fancybox/jquery.mousewheel-3.0.2.pack.js b/public/javascripts/fancybox/jquery.mousewheel-3.0.2.pack.js +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/fileuploader.js b/public/javascripts/fileuploader.js +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/jquery.cycle/jquery.cycle.lite.min.js b/public/javascripts/jquery.cycle/jquery.cycle.lite.min.js +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/jquery.infieldlabel.js b/public/javascripts/jquery.infieldlabel.js +old mode 100755 +new mode 100644 +diff --git a/public/javascripts/web_socket.js b/public/javascripts/web_socket.js +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/blueprint/src/grid.css b/public/stylesheets/blueprint/src/grid.css +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/blueprint/src/print.css b/public/stylesheets/blueprint/src/print.css +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/blueprint/src/reset.css b/public/stylesheets/blueprint/src/reset.css +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.eot b/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.eot +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.svg b/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.svg +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.ttf b/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.ttf +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.woff b/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.woff +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/brandongrotesque_light/demo.html b/public/stylesheets/brandongrotesque_light/demo.html +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/brandongrotesque_light/stylesheet.css b/public/stylesheets/brandongrotesque_light/stylesheet.css +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/fileuploader.css b/public/stylesheets/fileuploader.css +old mode 100755 +new mode 100644 +diff --git a/public/stylesheets/loading.gif b/public/stylesheets/loading.gif +old mode 100755 +new mode 100644 diff --git a/pkg/fedora/source-fix.patch b/pkg/fedora/source-fix.patch new file mode 100644 index 000000000..55dffae43 --- /dev/null +++ b/pkg/fedora/source-fix.patch @@ -0,0 +1,21 @@ +diff --git a/script/server b/script/server +index da43895..c5357a3 100755 +--- a/script/server ++++ b/script/server +@@ -7,9 +7,13 @@ then + echo "Mongod not started" + else + mkdir -p -v log/thin/ +- #force AGPL +- tar cf ../_source.tar -X .gitignore * +- mv ../_source.tar public/source.tar ++ #force AGPL ++ test -w public -a ! -e public/source.tar && ++ tar cf public/source.tar --exclude='source.tar' -X .gitignore * ++ test -e public/source.tar || { ++ echo "Can't find, or even create, public/source.tar. Giving up" ++ exit 2 ++ } + bundle exec ruby ./script/websocket_server.rb& + bundle exec thin start $@ + fi