Packaging update

Handle git gems by cloning repo to local one, rewriting Gemfile
urls and sending both repos and gems in source packages.
Separate doc dir w licensec.
Gemfile, Gemfile.lock now lives in bundle, linked to application.
Rewrite http git urls to git: to make it uniform & simpler
This commit is contained in:
Alec Leamas 2010-10-30 09:55:28 +02:00
parent 68cba5da98
commit d572f8fafc
10 changed files with 77 additions and 82 deletions

View file

@ -27,7 +27,7 @@ gem 'roxml', :git => 'git://github.com/Empact/roxml.git'
gem 'addressable', :require => 'addressable/uri' gem 'addressable', :require => 'addressable/uri'
gem 'json' gem 'json'
gem 'mini_fb' gem 'mini_fb'
gem 'http_accept_language', :git => 'http://github.com/iain/http_accept_language.git' gem 'http_accept_language', :git => 'git://github.com/iain/http_accept_language.git'
#Standards #Standards
gem 'pubsubhubbub' gem 'pubsubhubbub'

View file

@ -230,7 +230,7 @@ sv:
friend_request_pending: "vänförfrågan är skickad" friend_request_pending: "vänförfrågan är skickad"
you_have_a_friend_request_from_this_person: "du har en väntande vänförfrågan från den här personen" you_have_a_friend_request_from_this_person: "du har en väntande vänförfrågan från den här personen"
new: new:
new_person: "Ny Person" new_person: "Ny person"
back_to_list: "Tillbaka till listan" back_to_list: "Tillbaka till listan"
edit: edit:
cancel: "Avbryt" cancel: "Avbryt"

View file

@ -18,7 +18,7 @@ Prerequisites:
- A personal environment to build RPM:s, also described in - A personal environment to build RPM:s, also described in
[RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora) [RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora)
Install g++ (possibly unnnecessary?): Install g++ (unnecessary?):
% yum install gcc-c++ % yum install gcc-c++
Create source tarballs like dist/diaspora-0.0-1010041233_fade4231.tar.gz Create source tarballs like dist/diaspora-0.0-1010041233_fade4231.tar.gz
@ -73,7 +73,7 @@ to the bundle's bundle directory. Reasonable defaults are to install
diaspora in /usr/share/diaspora and bundle in /usr/lib/diaspora-bundle. With these, diaspora in /usr/share/diaspora and bundle in /usr/lib/diaspora-bundle. With these,
the link is the link is
% rm -rf /usr/share/diaspora/master/vendor/bundle % rm -rf /usr/share/diaspora/master/vendor/bundle
% ln -sf /usr/lib/diaspora-bundle/bundle \ % ln -sf /usr/lib/diaspora-bundle/vendor/bundle \
> /usr/share/diaspora/master/vendor > /usr/share/diaspora/master/vendor
% %
@ -93,6 +93,9 @@ The source tarball is as retrieved from diaspora with following differences:
- The file .bundle/config is patched. Remove before doing - The file .bundle/config is patched. Remove before doing
*bundle install* *bundle install*
The bundle is basically the output from 'bundle package'. The git-based
gems are also added into vendor/git.
./make-dist.sh bundle|source occasionally fails on bad Gemfile.lock. The ./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 root cause is a bad Gemfile in the git repo. Possible fixes includes
using a older version known to work: using a older version known to work:
@ -128,9 +131,10 @@ at [ftp://mumin.dnsalias.net/pub/leamas/diaspora/builds](ftp://mumin.dnsalias.ne
'make-dist.sh source' script checks out latest version of diaspora into the '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. 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. 'make-dir.sh bundle' makes a *bundle package* 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. patches, the content of diaspora-bundle tarball. Target systems makes a
*bundle install --local* to use it.
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. service through /sbin/service and some install scripts.

View file

@ -38,16 +38,7 @@ Source file usede to compile native libraries in diaspora-bundle.
%setup -q -n %{name}-%{version}-%{git_release} %setup -q -n %{name}-%{version}-%{git_release}
%build %build
bundle install --local --deployment --without ri rdoc test bundle install --local --deployment --without ri rdoc
for gem in vendor/git/*; do
gem install --local \
--force \
--no-rdoc \
--no-ri \
--install-dir vendor/bundle/ruby/1.8/bundler \
$gem
done
pushd vendor/bundle/ruby/1.8/gems pushd vendor/bundle/ruby/1.8/gems
# In repo (2.2.4) # In repo (2.2.4)
@ -154,7 +145,7 @@ pushd vendor/bundle/ruby/1.8/gems
chmod 644 cucumber-rails-0.3.2/templates/install/step_definitions/capybara_steps.rb.erb || : chmod 644 cucumber-rails-0.3.2/templates/install/step_definitions/capybara_steps.rb.erb || :
chmod 644 ffi-0.6.3/ext/ffi_c/libffi/ltmain.sh || : chmod 644 ffi-0.6.3/ext/ffi_c/libffi/ltmain.sh || :
chmod 644 gherkin-2.2.4/tasks/compile.rake || : chmod 644 gherkin-2.2.4/tasks/compile.rake || :
chmod 644 i18n-0.4.1/MIT-LICENSE chmod 644 i18n-0.4.1/MIT-LICENSE || :
chmod 755 linecache-0.43/Rakefile || : chmod 755 linecache-0.43/Rakefile || :
chmod 755 mime-types-1.16/Rakefile || : chmod 755 mime-types-1.16/Rakefile || :
chmod 755 mini_magick-2.1/test/not_an_image.php || : chmod 755 mini_magick-2.1/test/not_an_image.php || :
@ -168,7 +159,7 @@ pushd vendor/bundle/ruby/1.8/gems
for file in CHANGES VERSION README Rakefile; do for file in CHANGES VERSION README Rakefile; do
chmod 644 term-ansicolor-1.0.5/$file || : chmod 644 term-ansicolor-1.0.5/$file || :
done done
chmod 755 thin-1.2.7/lib/thin/controllers/service.sh.erb chmod 755 thin-1.2.7/lib/thin/controllers/service.sh.erb ||:
chmod 755 thin-1.2.7/example/async_chat.ru || : chmod 755 thin-1.2.7/example/async_chat.ru || :
chmod 755 thin-1.2.7/example/async_tailer.ru || : chmod 755 thin-1.2.7/example/async_tailer.ru || :
chmod 644 treetop-1.4.8/spec/compiler/test_grammar.tt || : chmod 644 treetop-1.4.8/spec/compiler/test_grammar.tt || :
@ -208,13 +199,14 @@ popd
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle mkdir -p $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle
cp -ar vendor $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle cp -ar vendor $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle
cp -a Gemfile Gemfile.lock $RPM_BUILD_ROOT/%{_libdir}/diaspora-bundle
find %{buildroot}/%{_libdir}/diaspora-bundle \ find %{buildroot}/%{_libdir}/diaspora-bundle \
-type d -fprintf dirs '%%%dir "%%p"\n' -type d -fprintf dirs '%%%dir "%%p"\n'
find -L %{buildroot}/%{_libdir}/diaspora-bundle -regextype posix-awk \ find -L %{buildroot}/%{_libdir}/diaspora-bundle -regextype posix-awk \
-type f -not -regex '.*[.]c$|.*[.]h$|.*[.]cpp$|.*Makefile$' \ -type f -not -regex '.*[.]c$|.*[.]h$|.*[.]cpp$|.*Makefile$' \
-fprintf files '"%%p"\n' -fprintf files '"%%p"\n'
find %{buildroot}/%{_libdir}/diaspora-bundle -regextype posix-awk \ find -L %{buildroot}/%{_libdir}/diaspora-bundle -regextype posix-awk \
-type f -regex '.*[.]c$|.*[.]h$|.*[.]cpp$|.*Makefile$' \ -type f -regex '.*[.]c$|.*[.]h$|.*[.]cpp$|.*Makefile$' \
-fprintf dev-files '"%%p"\n' -fprintf dev-files '"%%p"\n'
sed -i -e 's|%{buildroot}||' -e 's|//|/|' files dev-files dirs sed -i -e 's|%{buildroot}||' -e 's|//|/|' files dev-files dirs
@ -225,7 +217,7 @@ cat files >> dirs && cp dirs files
%files -f files %files -f files
%defattr(-, diaspora, diaspora, 0755) %defattr(-, diaspora, diaspora, 0755)
%doc COPYRIGHT Gemfile Gemfile.lock AUTHORS GNU-AGPL-3.0 docs %doc COPYRIGHT AUTHORS GNU-AGPL-3.0 docs
%files -f dev-files devel %files -f dev-files devel
%defattr(-, root, root, 0644) %defattr(-, root, root, 0644)

View file

@ -4,6 +4,7 @@
# #
# Usage: # ./diaspora-setup [external hostname] # Usage: # ./diaspora-setup [external hostname]
# #
export PATH=$PATH:/usr/local/bin
arg_hostname="$1" arg_hostname="$1"
@ -22,10 +23,17 @@ test -n "$services" && {
cd /usr/share/diaspora/master cd /usr/share/diaspora/master
libdir=$(rpm --eval %_libdir)
rm -rf vendor
ln -s $libdir/diaspora-bundle/vendor .
ln -sf $libdir/diaspora-bundle/Gemfile .
ln -sf $libdir/diaspora-bundle/Gemfile.lock .
test -e config/app_config.yml || test -e config/app_config.yml ||
cp config/app_config.yml.example config/app_config.yml cp config/app_config.yml.example config/app_config.yml
if rake db:seed:dev; then if bundle exec rake db:seed:dev; then
echo "Database config OK, new user tom/evankorth in place" echo "Database config OK, new user tom/evankorth in place"
else else
cat <<- EOF cat <<- EOF

View file

@ -71,6 +71,7 @@ cp %SOURCE3 $RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/diaspora
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora mkdir -p $RPM_BUILD_ROOT/%{_datadir}/diaspora
cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora cp -ar master $RPM_BUILD_ROOT/%{_datadir}/diaspora
cp -ar master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master cp -ar master/.bundle $RPM_BUILD_ROOT/%{_datadir}/diaspora/master
rm -rf $RPM_BUILD_ROOT/%{_datadir}/diaspora/master/vendor/*
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/uploads
mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/lib/diaspora/tmp
cp %SOURCE2 $RPM_BUILD_ROOT/%{_datadir}/diaspora cp %SOURCE2 $RPM_BUILD_ROOT/%{_datadir}/diaspora

View file

@ -161,6 +161,7 @@ function make_src
cp -ar diaspora/* diaspora/.git* ${RELEASE_DIR}/master cp -ar diaspora/* diaspora/.git* ${RELEASE_DIR}/master
( (
cd ${RELEASE_DIR}/master cd ${RELEASE_DIR}/master
rm -rf vendor/bundle/* vendor/git/* vendor/cache/* gem-tmp
git show --name-only > config/gitversion git show --name-only > config/gitversion
tar czf public/source.tar.gz \ tar czf public/source.tar.gz \
--exclude='source.tar.gz' -X .gitignore * --exclude='source.tar.gz' -X .gitignore *
@ -175,69 +176,43 @@ function make_src
echo "Required bundle: $(git_id dist/diaspora/Gemfile)" echo "Required bundle: $(git_id dist/diaspora/Gemfile)"
} }
function build_git_gems() function build_git_gems()
# Usage: build_git_gems <Gemfile> <tmpdir> <gemdir> # Usage: build_git_gems <Gemfile> <tmpdir> <gemdir>
# Horrible hack, in wait for bundler handling git gems OK. # Horrible hack, in wait for bundler handling git gems OK.
{ {
mkdir gem-tmp || : [ -d 'gem-tmp' ] || mkdir gem-tmp
cd gem-tmp cd gem-tmp
rm -rf * rm -rf *
grep 'git:' ../$1 | sed 's/,/ /' | awk ' grep 'git:' ../$1 | sed 's/,/ /g' | awk '
/^.*git:\/\/.*$/ { /^.*git:\/\/.*$/ {
gsub( "=>", "") gsub( "=>", " ")
gsub( ",", "")
if ( $1 != "gem") { if ( $1 != "gem") {
print "Strange git: line (ignored) :" $0 print "Strange git: line (ignored) :" $0
next next
} }
name = $2 name = $2
suffix = ""
url="" url=""
for (i = 3; i <= NF; i += 1) { for (i = 3; i <= NF; i += 1) {
key = $i key = $i
i += 1 i += 1
if (key == ":git") if (key == ":git")
url = $i url = $i
else if ( key == ":ref") {
suffix = "; cd " name
suffix = suffix "; git reset --hard " $i
suffix = suffix "; cd .."
}
else if ( key == ":branch")
suffix = "; git checkout " $i
} }
cmd = sprintf( "git clone --bare --quiet %s\n", url)
print "Running: ", cmd print "Running: ", cmd
cmd = sprintf( "git clone --quiet %s %s %s\n",
url, name, suffix)
system( cmd) system( cmd)
}' }'
sed -i 's/Date.today/"2010-10-24"/' carrierwave/carrierwave.gemspec mv devise-mongo_mapper.git devise-mongo_mapper
for dir in *; do for dir in *; do
cd $dir if [ ! -e $dir/*.gemspec ]; then
gem build *.gemspec cp -ar $dir ../$2
cp *.gem ../../$2 fi
cd ..
done done
cd .. cd ..
# rm -rf gem-tmp # rm -rf gem-tmp
} }
function make_docs()
{
local gemfile=$1
for url in $(read_git_urls $gemfile); do
local name=${url##*/}
name=${name%.*}
rm -rf vendor/git/$name
git clone --bare --quiet $url vendor/git/$name &&
sed -i "s#$url#vendor/git/$name#" $gemfile ||
echo "Cannot fix git repo \"$url\""
done
}
function make_docs() function make_docs()
{ {
local gems=$1 local gems=$1
@ -245,19 +220,19 @@ function make_docs()
for gem in $(ls $gems); do for gem in $(ls $gems); do
local name=$(basename $gem) local name=$(basename $gem)
[ -r $gems/$gem/README* ] && { [ -r "$gems/$gem/README*" ] && {
local readme=$(basename $gems/$gem/README*) local readme=$(basename $gems/$gem/README*)
cp -a $gems/$gem/$readme $dest/$readme.$name cp -a $gems/$gem/$readme $dest/$readme.$name
} }
[ -r $gems/$gem/COPYRIGHT ] && \ [ -r "$gems/$gem/COPYRIGHT" ] && \
cp -a $gems/$gem/COPYRIGHT $dest/COPYRIGHT.$name cp -a $gems/$gem/COPYRIGHT $dest/COPYRIGHT.$name
[ -r $gems/$gem/LICENSE ] && \ [ -r "$gems/$gem/LICENSE" ] && \
cp -a $gems/$gem/LICENSE $dest/LICENSE.$name cp -a $gems/$gem/LICENSE $dest/LICENSE.$name
[ -r $gems/$gem/License ] && \ [ -r "$gems/$gem/License" ] && \
cp -a $gems/$gem/License $dest/License.$name cp -a $gems/$gem/License $dest/License.$name
[ -r $gems/$gem/MIT-LICENSE ] && \ [ -r "$gems/$gem/MIT-LICENSE" ] && \
cp -a $gems/$gem/MIT-LICENSE $dest/MIT-LICENSE.$name cp -a $gems/$gem/MIT-LICENSE $dest/MIT-LICENSE.$name
[ -r $gems/$gem/COPYING ] && \ [ -r "$gems/$gem/COPYING" ] && \
cp -a $gems/$gem/COPYING $dest/COPYING.$name cp -a $gems/$gem/COPYING $dest/COPYING.$name
done done
} }
@ -276,23 +251,35 @@ function make_bundle()
cd dist cd dist
rm -rf $bundle_name rm -rf $bundle_name
cd diaspora cd diaspora
rm Gemfile.lock
rm -rf .bundle
if [ "$BUNDLE_FIX" = 'yes' ]; then if [ "$BUNDLE_FIX" = 'yes' ]; then
rm -f Gemfile.lock
rm -rf .bundle
bundle update bundle update
fi fi
[ -d 'vendor/git' ] || mkdir vendor/git
bundle install [ -d 'git-repos' ] || mkdir git-repos
rm -rf git-repos/*
git checkout Gemfile
build_git_gems Gemfile git-repos
sed -i 's|git://.*/|git-repos/|g' Gemfile
# see: http://bugs.joindiaspora.com/issues/440
bundle install --path=vendor/bundle || {
bundle install --path=vendor/bundle || {
echo "bundle install failed, giving up" >&2
exit 3
}
}
bundle package bundle package
mkdir vendor/git
build_git_gems Gemfile vendor/git
mkdir -p "../$bundle_name/docs" mkdir -p "../$bundle_name/docs"
mkdir -p "../$bundle_name/vendor" mkdir -p "../$bundle_name/vendor"
cp -ar AUTHORS Gemfile Gemfile.lock GNU-AGPL-3.0 COPYRIGHT \ cp -ar AUTHORS Gemfile Gemfile.lock GNU-AGPL-3.0 COPYRIGHT \
../$bundle_name ../$bundle_name
make_docs "vendor/gems" "../$bundle_name/docs"
make_docs "vendor/bundle/ruby/1.8/gems/" "../$bundle_name/docs"
mv vendor/cache ../$bundle_name/vendor mv vendor/cache ../$bundle_name/vendor
mv vendor/gems ../$bundle_name/vendor
mv git-repos ../$bundle_name
cd .. cd ..
tar czf $bundle_name.tar.gz $bundle_name tar czf $bundle_name.tar.gz $bundle_name
mv $bundle_name/vendor/cache diaspora/vendor/cache mv $bundle_name/vendor/cache diaspora/vendor/cache
@ -360,16 +347,16 @@ function usage()
-h Print this message. -h Print this message.
-c commit Use a given commit, defaults to last checked in. -c commit Use a given commit, defaults to last checked in.
-r release Mark with specified release, defaults to 1. -r release For prepare, mark with release nr, defaults to 1.
-u uri Git repository URI, defaults to -u uri Git repository URI, defaults to
$GIT_REPO. $GIT_REPO.
-f For bundle, fix dependencies by running 'bundle update' -f For bundle, fix dependencies by running 'bundle update'
before 'bundle install' before 'bundle install'
source Build a diaspora application tarball. source Build a diaspora application tarball.
bundle Build a bundler(1) bundle for diaspora. bundle Build a bundler(1) bundle for diaspora.
prepare Symlink bundle and source tarballs to rpm source dir, prepare Symlink bundle and source tarballs to rpm source dir,
create patched rpm spec files. create patched rpm spec files.
All results are stored in dist/ All results are stored in dist/

View file

@ -28,13 +28,5 @@ cp -a AUTHORS GNU-AGPL-3.0 COPYRIGHT Gemfile Gemfile.lock \
cp -ar docs /usr/share/doc/diaspora-bundle cp -ar docs /usr/share/doc/diaspora-bundle
bundle install --local --deployment --without ri rdoc bundle install --local --deployment --without ri rdoc
for gem in vendor/git/*; do
gem install --local \
--force \
--no-rdoc \
--no-ri \
--install-dir vendor/bundle/ruby/1.8/bundler \
$gem
done

View file

@ -14,7 +14,8 @@ grep -v '^#' /etc/apt/sources.list | grep -q universe || {
release=$( lsb_release -a | awk '/Release:/ {print $2}') release=$( lsb_release -a | awk '/Release:/ {print $2}')
sudo apt-get update sudo apt-get update
sudo apt-get install -qy build-essential libxslt1-dev libxml2 \ sudo apt-get install --no-install-recommends -qy\
build-essential libxslt1-dev libxml2 \
ruby-full mongodb rake python-software-properties git-core \ ruby-full mongodb rake python-software-properties git-core \
imagemagick libmagick9-dev imagemagick libmagick9-dev
if [ "$release" = "10.04" ]; then if [ "$release" = "10.04" ]; then

View file

@ -4,6 +4,7 @@
# #
# Usage: sudo diaspora-setup [external hostname] # Usage: sudo diaspora-setup [external hostname]
# #
export PATH=$PATH:/usr/local/bin
test "$( perl -e 'print $<')" = "0" || { test "$( perl -e 'print $<')" = "0" || {
echo "You need to be root to do this, giving up" echo "You need to be root to do this, giving up"
@ -24,10 +25,19 @@ service mongodb start || :
cd /usr/share/diaspora/master cd /usr/share/diaspora/master
libdir="/usr/lib"
[[ $(arch) == "x86_64" ]] && libdir="/usr/lib64"
rm -rf vendor
ln -s $libdir/diaspora-bundle/vendor .
ln -sf $libdir/diaspora-bundle/Gemfile .
ln -sf $libdir/diaspora-bundle/Gemfile.lock .
test -e config/app_config.yml || test -e config/app_config.yml ||
cp config/app_config.yml.example config/app_config.yml cp config/app_config.yml.example config/app_config.yml
if rake db:seed:dev; then if bundle exec rake db:seed:dev; then
echo "Database config OK, new user tom/evankorth in place" echo "Database config OK, new user tom/evankorth in place"
else else
cat <<- EOF cat <<- EOF