Initial, buggy file check in

This commit is contained in:
Alec Leamas 2010-10-05 00:11:13 +02:00
parent be909e27d6
commit ee1f2063b4
6 changed files with 687 additions and 0 deletions

27
pkg/fedora/README.fedora Executable file
View file

@ -0,0 +1,27 @@
#Build ruby-1.8.7 on Fedora 13
#============================
set -x
rpmdir=$(rpm --showrc | grep _rpmdir | cut -f2)
echo "Building rpms in $rpmdir"
sudo yum install yum-utils fedora-release-rawhide
yumdownloader --enablerepo=rawhide --source ruby
vers=$( ls ruby-*src.rpm)
vers=$(echo ${vers%.fc*})
vers=$(echo ${vers#ruby-})
echo "Downloaded and uding version $vers"
sudo yum install $( rpm -q --requires -p ruby*src.rpm | grep -v rpmlib)
rpmbuild --rebuild ruby-1.8.7.302-1.fc15.src.rpm
sudo rpm -i $rpmdir/i686/ruby-$vers.i686.rpm
sudo rpm -i $rpmdir/i686/ruby-libs-$vers.i686.rpm
sudo rpm -i $rpmdir/i686/ruby-irb-$vers.i686.rpm
sudo rpm -i $rpmdir/noarch/ruby-rdoc-$rdoc.noarch.rpm
rpmbuild --rebuild rubygems-*.src.rpm
sudo rpm -i $rpmdir/noarch/rubygems-*.noarch.rpm

View file

@ -0,0 +1,213 @@
%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 master/public/stylesheets/brandongrotesque_light/demo.html
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 master/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.svg
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
#sed -i -e "s|\r||" master/public/javascripts/jquery.cycle/src/jquery.cycle.lite.js
#sed -i -e "s|\r||" master/public/javascripts/fancybox/jquery.fancybox-1.3.1.js
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 <leamas.alec@gmail.com> 1.1009271539_08b9aa8
- Initial attempt to create a spec file

102
pkg/fedora/diaspora-ws Executable file
View file

@ -0,0 +1,102 @@
#!/bin/bash
#
# /etc/rc.d/init.d/diaspora-ws
#
# Starts the diaspora websocket server
#
# chkconfig: - 80 80
# description: Diaspora websocket server
### BEGIN INIT INFO
# Provides: diaspora-ws
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: $remote_fs
# Should-Stop: $remote_fs
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start and stop Diaspora websocket server
# Description: The websocket server provides websocket services for
# diaspora.
### END INIT INFO
# Source function library.
. /etc/init.d/functions
if [ -f /etc/sysconfig/diaspora-ws -a $UID -eq 0 ]; then
. /etc/sysconfig/diaspora-ws
fi
cd /usr/share/diaspora
RETVAL=0
prog="Diaspora websocket server"
exec="script/websocket_server.rb"
pidfile="/var/run/diaspora-ws"
lockfile="/var/lock/subsys/diaspora-ws"
logfile=/var/log/diaspora-ws.log
[ -n "$OPTIONS" ] && OPTIONS=" $OPTIONS"
ruby_cmd="ruby -C $PWD $exec$OPTIONS"
start() {
[ $UID -eq 0 ] || exit 4
[ -f $exec ] || exit 5
echo -n $"Starting $prog: "
daemon --pidfile $pidfile "$ruby_cmd >>$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

View file

@ -0,0 +1,12 @@
/var/log/diaspora/*.log {
weekly
rotate 10
copytruncate
delaycompress
compress
notifempty
missingok
postrotate
(/sbin/service diaspora-ws status | grep running /sbin/servive diaspora-ws restart || :) >/dev/null 2>&1
endscript
}

110
pkg/fedora/diaspora.spec Normal file
View file

@ -0,0 +1,110 @@
#
# Build diaspora RPM package.
#
# Packages current HEAD if the diaspora master branch
# to a reasonable Fedora RPM.
#
# If the environment variable GIT_VERSION is set, builds an rpm
# from this version (i. e., uses this commit).
#
%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
#BuildRoot: %{_tmppath}/root-%{name}-%{version}
#Prefix: %{_prefix}
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.
%pre
getent group diaspora >/dev/null || groupadd -r diaspora
getent passwd diaspora >/dev/null || \
useradd -r -g diaspora \
-md /var/diaspora -s /sbin/nologin \
-c "Diaspora daemon" diaspora
exit 0
%prep
%setup -q -n %{name}-%{version}-%{git_release}
mkdir diaspora/tmp || :
%build
find . -name .git* -execdir rm -rf {} \; || :
#find . -name test -execdir rm -rf {} \; || : > /dev/null 2>&1
find . -name \*.css -exec chmod 644 {} \;
find . -name \*.js -exec chmod 644 {} \;
#find . -name \*.treetop -exec chmod 644 {} \;
find . -name \*.rdoc -exec chmod 644 {} \;
#find . -name Rakefile -exec chmod 755 {} \;
#for f in $(find . -name \*.rb); do
# sed -i -e '/^#!/d' $f
# chmod 0644 $f
#done > /dev/null 2>&1
find . -type f -exec \
sed -i 's/^#!\/usr\/local\/bin\/ruby/#!\/usr\/bin\/ruby/g' {} \; > /dev/null
chmod 644 master/public/stylesheets/brandongrotesque_light/demo.html
chmod 644 master/public/stylesheets/brandongrotesque_light/Brandon_light-webfont.svg
sed -i -e "s|\r||" master/public/javascripts/jquery.cycle/src/jquery.cycle.lite.js
sed -i -e "s|\r||" master/public/javascripts/fancybox/jquery.fancybox-1.3.1.js
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -fr $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora/master/vendor
cp master/README.md .
mv master/GNU-AGPL-3.0 .
sed -i '/^cd /s|.*|cd %{_datadir}/diaspora/master|' diaspora-ws
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/log/diaspora
mkdir -p $RPM_BUILD_ROOT/etc/init.d
cp diaspora-ws $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
cp diaspora $RPM_BUILD_ROOT/etc/logrotate.d
%post
/bin/chown diaspora:diaspora %{_localstatedir}/log/diaspora
ln -sf %{_localstatedir}/log/diaspora \
%{_datadir}/diaspora/master/log || :
ln -sf %{_libdir}/diaspora/master/vendor/bundle \
%{_datadir}/diaspora/master/vendor || :
/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
%{_datadir}/diaspora
%{_libdir}/diaspora
%{_localstatedir}/log/diaspora
%config(noreplace) %{_sysconfdir}/logrotate.d/diaspora
%{_sysconfdir}/init.d/diaspora-ws
%changelog
* Fri Sep 24 2010 Alec Leamas <leamas.alec@gmail.com> 1.1009280542_859ec2d
- Initial attempt to create a spec file

223
pkg/fedora/make_dist.sh Executable file
View file

@ -0,0 +1,223 @@
#!/bin/bash
#Usage: make_dist [-b] [-d] [s] [-c <commit>]
#
# -b create a bundler bundle for diaspora
# -d create a diaspora source tarball
# -s synchronize Gemfile.lock VERY INTRUSIVE to RUBY ENVIRONMENT
# -c Use a given commit instead of last available
#
# 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" \
' /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 <email@com> 1.20100925_faf234320
{
set -x
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 <specfile> <version> 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'|' \
<diaspora.spec >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 $bundle_id
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 dispora unless it's already there.
{
mkdir dist || :
(
cd dist
rm -rf diaspora; git clone --quiet $GIT_REPO; \
cd diaspora;
git checkout --quiet -b dist $GIT_VERSION;
git_id -n
)
}
function make_dist
# Create a distribution tarball
{
commit=$(checkout)
patch $VERSION $commit
RELEASE_DIR="diaspora-$VERSION-$commit"
rm -rf dist/${RELEASE_DIR}
mkdir dist/${RELEASE_DIR}
cp diaspora-ws dist/${RELEASE_DIR}
cp diaspora.logconf dist/${RELEASE_DIR}/diaspora
cd dist
mkdir ${RELEASE_DIR}/master
cp -ar diaspora/* ${RELEASE_DIR}/master
mv ${RELEASE_DIR}/master/diaspora.spec ${RELEASE_DIR}
tar czf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR} && rm -rf ${RELEASE_DIR}
}
#set -x
#mkdir dist || :
#pushd dist
# test -d diaspora || {
## git clone $GIT_REPO;
# pushd diaspora
# git checkout -b dist $RELEASE;
# git add upstream $GIT_REPO#
# popd
# }
# pushd diaspora
# git fetch upstream
# git merge upstream/master
# popd
#popd
function make_bundle()
{
bundle_id=$(git_id dist/diaspora/Gemfile)
bundle_name="diaspora-bundle-$VERSION-$bundle_id"
test -e "$bundle_name" || {
cd dist
rm -rf $bundle_name
mkdir -p $bundle_name/bundle
pushd diaspora
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
}
}
function usage()
{
cat <<- EOF
Usage: make_dist [-c commit] <dist|bundle|fix_gemlock>
-c Use a given commit, defaults to last checked in.
dist Build a diaspora application tarball.
bundle Build a bundler(1) bundle for diaspora.
fix_gemlock Try to fix out-of order gemlock, VERY INTRUSIVE.
All results are stored in dist/
EOF
}
set -x
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
;;
"dist") make_dist $commit
;;
"fix_gemfile")
fix_gemfile
;;
*) usage
exit 1
;;
esac