Raw code
This commit is contained in:
parent
04984d576a
commit
42e8c8f11b
12 changed files with 390 additions and 299 deletions
1
pkg/.gitignore
vendored
Normal file
1
pkg/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
dist
|
||||
13
pkg/README.md
Normal file
13
pkg/README.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
## Diaspora install and packaging tools
|
||||
|
||||
This directory contains stuff to install and run diaspora.
|
||||
|
||||
- ubuntu-setup.bash: script which installs all of Diasporas
|
||||
dependencies and starts the server.
|
||||
|
||||
- source: stuff to package Diaspora into traditional tarballs
|
||||
which can be installed.
|
||||
|
||||
- ubuntu: Scripts and tools to install generic tarballs on Ubuntu
|
||||
|
||||
- fedora: Scripts and tools to create fedora RPMS:s from tarballs
|
||||
|
|
@ -18,16 +18,20 @@ Prerequisites:
|
|||
- A personal environment to build RPM:s, also described in
|
||||
[RPM installation Fedora](http://github.com/diaspora/diaspora/wiki/Rpm-installation-on-fedora)
|
||||
|
||||
Install g++ (unnecessary?):
|
||||
Install g++ and gcc:
|
||||
% yum install gcc-c++
|
||||
|
||||
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
|
||||
Bootstrap the distribution from git:
|
||||
% sudo apt-get install git-core
|
||||
% git clone git://github.com/diaspora/diaspora.git
|
||||
% cd diaspora/pkg/ubuntu
|
||||
|
||||
Setup links to tarballs from RPM source directory and create spec files:
|
||||
% ./make-dist.sh prepare
|
||||
Create and install the diaspora bundle and application in
|
||||
diaspora/pkg/source according to
|
||||
[source README](http://github.com/diaspora/diaspora/blob/master/source/fedora/README.md)
|
||||
|
||||
Setup links from tarballs to RPM source directory and create spec files:
|
||||
% ./prepare-rpm.sh
|
||||
|
||||
Build rpms:
|
||||
rpmbuild -ba dist/diaspora.spec
|
||||
|
|
@ -51,63 +55,10 @@ apache/passenger setup. After configuration, start with:
|
|||
/sbin/service diaspora-wsd start
|
||||
/sbin/service httpd restart
|
||||
|
||||
#### Generic source synopsis
|
||||
|
||||
Generate source tarball:
|
||||
% ./make-dist.sh source
|
||||
Using repo: http://github.com/diaspora/diaspora.git
|
||||
Commit id: 1010092232_b313272
|
||||
Source: dist/diaspora-0.0-1010092232_b313272.tar.gz
|
||||
Required bundle: 1010081636_d1a4ee0
|
||||
%
|
||||
|
||||
The source tarball could be used as-is, by unpacking add making a
|
||||
*bundle install*. An alternative is to generate a canned bundle like:
|
||||
% ./make-dist.sh bundle
|
||||
[ lot's of output...]
|
||||
Bundle: dist/diaspora-bundle-0.0-1010081636_d1a4ee0.tar.gz
|
||||
%
|
||||
|
||||
This file can be installed anywhere. To use it, add a symlink from vendor/bundle
|
||||
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,
|
||||
the link is
|
||||
% rm -rf /usr/share/diaspora/master/vendor/bundle
|
||||
% ln -sf /usr/lib/diaspora-bundle/vendor/bundle \
|
||||
> /usr/share/diaspora/master/vendor
|
||||
%
|
||||
|
||||
The directories tmp, log, and public/uploads needs to be writable. If using
|
||||
apache passenger, read the docs on uid used and file ownership.
|
||||
|
||||
Note that the bundle version required is printed each time a new source
|
||||
is generated.
|
||||
|
||||
#### Notes
|
||||
|
||||
The source tarball is as retrieved from diaspora with following differences:
|
||||
|
||||
- The .git directories are removed (freeing more than 50% of the size).
|
||||
- A new file /master/config/gitversion is created.
|
||||
- The file public/source.tar.gz is generated.
|
||||
- The file .bundle/config is patched. Remove before doing
|
||||
*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
|
||||
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
|
||||
potentially problematic operation):
|
||||
% ./make-dist.sh -f bundle
|
||||
|
||||
*make-dist prepare* creates links also for all files listed in SOURCES.
|
||||
Typically, this is secondary sources. *make-dist.sh sources*
|
||||
prepare-rpm.sh prepare creates links also for all files listed in SOURCES.
|
||||
Typically, this is secondary sources. *make-dist.sh source*
|
||||
applies all patches named *.patch in this directory after checking out
|
||||
source from git.
|
||||
|
||||
|
|
|
|||
1
pkg/fedora/dist
Symbolic link
1
pkg/fedora/dist
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../source/dist
|
||||
0
pkg/fedora/dist/.gitkeep
vendored
0
pkg/fedora/dist/.gitkeep
vendored
165
pkg/fedora/prepare-rpm.sh
Executable file
165
pkg/fedora/prepare-rpm.sh
Executable file
|
|
@ -0,0 +1,165 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Create RPM spec files matching diaspora tarballs
|
||||
#
|
||||
# Usage: See function usage() at bottom.
|
||||
#
|
||||
GIT_REPO='http://github.com/diaspora/diaspora.git'
|
||||
VERSION='0.0'
|
||||
RELEASE='1'
|
||||
|
||||
. ../source/funcs.sh
|
||||
|
||||
|
||||
function fix_alphatag()
|
||||
# Patch version on top comment first id line:
|
||||
# Usage: fix_alphatag <file> <version> <commit_id> <release>
|
||||
# Patches:\
|
||||
# * Fri Sep 24 2010 name surname <email@com> 1.20100925_faf23207
|
||||
{
|
||||
local dist=$(rpm --eval %dist)
|
||||
awk -v dist="$dist" -v version="$2" -v commit="$3" -v release="$4" \
|
||||
' BEGIN { done = 0 }
|
||||
/^[*]/ { if (done)
|
||||
print
|
||||
else
|
||||
{
|
||||
s = sprintf( "-%s.%s%s\n", release, commit, dist)
|
||||
gsub( "-[0-9][.][^ ]*$", s)
|
||||
done = 1
|
||||
# add new gsub for version...
|
||||
print
|
||||
}
|
||||
next
|
||||
}
|
||||
{ print }' < $1 > $1.tmp && mv -f $1.tmp $1
|
||||
}
|
||||
|
||||
|
||||
function fix_bundle_deps
|
||||
# usage: fix_bundle_deps <specfile> <version> <commit>
|
||||
# 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 && mv -f $1.tmp $1
|
||||
}
|
||||
|
||||
|
||||
function patch()
|
||||
# Patch spec-files with current version-release
|
||||
# Usage: patch <version> <commit> <release>
|
||||
{
|
||||
sed -e "/^%define/s|HEAD|$2|" \
|
||||
-e '/^Version:/s|.*|Version: '$1'|' \
|
||||
<diaspora.spec >dist/diaspora.spec
|
||||
fix_alphatag dist/diaspora.spec $1 $2 $3
|
||||
local bundle_id=$(git_id dist/diaspora/Gemfile)
|
||||
local dist_tag=$(rpm --eval %dist)
|
||||
fix_bundle_deps dist/diaspora.spec $1 "$RELEASE.${bundle_id}$dist_tag"
|
||||
sed -e "/^%define/s|HEAD|$bundle_id|" \
|
||||
-e '/^Version:/s|.*|Version: '$1'|' \
|
||||
< diaspora-bundle.spec > dist/diaspora-bundle.spec
|
||||
|
||||
cp dist/diaspora.spec dist/diaspora/diaspora.spec
|
||||
}
|
||||
|
||||
|
||||
function prepare_rpm()
|
||||
# Usage: prepare_rpm < commit>
|
||||
{
|
||||
local dest=$(rpm --eval %_sourcedir)
|
||||
test -z "$dest" && {
|
||||
echo "Can't find RPM source directory, giving up."
|
||||
exit 2
|
||||
}
|
||||
|
||||
local commit=$( checkout $1)
|
||||
echo "Release: $RELEASE.$commit"
|
||||
echo "Rpm source dir: $dest"
|
||||
|
||||
patch $VERSION $commit $RELEASE
|
||||
|
||||
local src="dist/diaspora-$VERSION-$commit.tar.gz"
|
||||
test -e $src ||
|
||||
cat <<- EOF
|
||||
Warning: $src does not exist
|
||||
(last version not built?)
|
||||
EOF
|
||||
ln -sf $PWD/$src $dest
|
||||
|
||||
local bundle_commit=$( git_id dist/diaspora/Gemfile)
|
||||
local 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
|
||||
|
||||
local file
|
||||
for file in $( grep -v '^#' SOURCES); do
|
||||
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 {} \;)
|
||||
echo "Source specfile: dist/diaspora.spec"
|
||||
echo "Bundle specfile: dist/diaspora-bundle.spec"
|
||||
}
|
||||
|
||||
|
||||
function usage()
|
||||
{
|
||||
cat <<- EOF
|
||||
|
||||
Usage: prepare-rpm [options]
|
||||
|
||||
Options:
|
||||
|
||||
-h Print this message.
|
||||
-r release For prepare, mark with release nr, defaults to 1.
|
||||
|
||||
Symlink bundle and source tarballs to rpm source dir, create
|
||||
patched rpm spec files.
|
||||
|
||||
All results are stored in dist/
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
commit='HEAD'
|
||||
BUNDLE_FIX='no'
|
||||
while getopts ":r:h" opt
|
||||
do
|
||||
case $opt in
|
||||
r) RELEASE="$OPTARG:"
|
||||
;;
|
||||
h) usage
|
||||
exit 0
|
||||
;;
|
||||
*) usage
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
typeset -r GIT_REPO RELEASE BUNDLE_FIX
|
||||
export LANG=C
|
||||
|
||||
test $# -gt 0 && {
|
||||
usage;
|
||||
exit 2;
|
||||
}
|
||||
prepare_rpm
|
||||
74
pkg/source/README.md
Normal file
74
pkg/source/README.md
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
## Diaspora source tarball generation
|
||||
|
||||
Creates diaspora source tarballs.
|
||||
|
||||
#### Generic source synopsis
|
||||
|
||||
Generate source tarball:
|
||||
% ./make-dist.sh source
|
||||
Using repo: http://github.com/diaspora/diaspora.git
|
||||
Commit id: 1010092232_b313272
|
||||
Source: dist/diaspora-0.0-1010092232_b313272.tar.gz
|
||||
Required bundle: 1010081636_d1a4ee0
|
||||
%
|
||||
|
||||
The source tarball could be used as-is, by unpacking add making a
|
||||
*bundle install*. An alternative is to generate a canned bundle like:
|
||||
% ./make-dist.sh bundle
|
||||
[ lot's of output...]
|
||||
Bundle: dist/diaspora-bundle-0.0-1010081636_d1a4ee0.tar.gz
|
||||
%
|
||||
|
||||
This file can be installed anywhere. To use it, add a symlinks from app
|
||||
to the bundle'. Reasonable defaults are to install diaspora in
|
||||
/usr/share/diaspora and bundle in /usr/lib/diaspora-bundle. With these,
|
||||
the link setups is
|
||||
% cd /usr/share/diaspora/master
|
||||
% rm -rf vendor
|
||||
% ln -sf /usr/lib/diaspora-bundle/vendor vendor
|
||||
% ln -sf /usr/lib/diaspora-bundle/Gemfile .
|
||||
% ln -sf /usr/lib/diaspora-bundle/Gemfile.lock .
|
||||
|
||||
|
||||
The directories tmp, log, and public/uploads needs to be writable. If using
|
||||
apache passenger, read the docs on uid used and file ownership.
|
||||
|
||||
Note that the bundle version required is printed each time a new source
|
||||
is generated.
|
||||
|
||||
#### Notes
|
||||
|
||||
The source tarball is as retrieved from diaspora with following differences:
|
||||
|
||||
- The .git directories are removed (freeing more than 50% of the size).
|
||||
- A new file /master/config/gitversion is created.
|
||||
- The file public/source.tar.gz is generated.
|
||||
- The file .bundle/config is patched. Remove before doing
|
||||
*bundle install*
|
||||
|
||||
The bundle is basically the output from 'bundle package'. The git-based
|
||||
gems are also added into git-gems. Bundle also houses the two files
|
||||
Gemfile and Gemfile.lock
|
||||
|
||||
*make-dist.sh source* applies all patches named *.patch in this directory
|
||||
after checking out source from git.
|
||||
|
||||
./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
|
||||
potentially problematic operation):
|
||||
% ./make-dist.sh -f bundle
|
||||
|
||||
#### 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 package* in the diaspora dir.
|
||||
The resulting bundle is stored in vendor/bundle. This is, after some more
|
||||
patches, the content of diaspora-bundle tarball. Target systems makes a
|
||||
*bundle install --local* to use it.
|
||||
78
pkg/source/funcs.sh
Normal file
78
pkg/source/funcs.sh
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# Common stuff for pkg scripts
|
||||
#
|
||||
|
||||
function git_id
|
||||
#
|
||||
# Echo package-friendly source id.
|
||||
#
|
||||
# Usage: git_id [-n] [file or directory]
|
||||
#
|
||||
{
|
||||
local nl="\n"
|
||||
local file_or_dir="$PWD"
|
||||
test "$1" = '-n' && { nl=""; shift; }
|
||||
test -n "$1" && file_or_dir="$1"
|
||||
if [ -d $file_or_dir ]; then
|
||||
local file=""
|
||||
local dir=$file_or_dir
|
||||
else
|
||||
local file=$(basename $file_or_dir)
|
||||
local dir=$(dirname $file_or_dir)
|
||||
fi
|
||||
|
||||
(
|
||||
cd $dir
|
||||
git log -1 --abbrev-commit --date=iso $file |
|
||||
awk -v nl="$nl" \
|
||||
' BEGIN { commit = ""; d[1] = "" }
|
||||
/^commit/ { if ( commit == "") commit = $2 }
|
||||
/^Date:/ { if (d[1] == "") {
|
||||
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 checkout()
|
||||
# Checkout last version of diaspora unless it's already there.
|
||||
# Uses global GIT_REPO to determine repo url
|
||||
# Usage: checkout [commit id, defaults to HEAD]
|
||||
# Returns: commit for current branch's HEAD.
|
||||
{
|
||||
mkdir dist &>/dev/null || :
|
||||
(
|
||||
local last_repo=''
|
||||
cd dist
|
||||
|
||||
test -e '.last-repo' &&
|
||||
last_repo=$( cat '.last-repo')
|
||||
test "$last_repo" != $GIT_REPO &&
|
||||
rm -rf diaspora
|
||||
test -d diaspora || {
|
||||
git clone --quiet $GIT_REPO;
|
||||
(
|
||||
cd diaspora;
|
||||
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 || :
|
||||
)
|
||||
}
|
||||
echo -n "$GIT_REPO" > '.last-repo'
|
||||
|
||||
cd diaspora;
|
||||
git fetch --quiet upstream
|
||||
git merge --quiet upstream/master
|
||||
[ -n "$1" ] && git reset --hard --quiet $1
|
||||
git_id -n
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -1,180 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Create a diaspora distribution
|
||||
# Create diaspora distribution tarballs.
|
||||
#
|
||||
# Usage: See function usage() at bottom.
|
||||
#
|
||||
GIT_REPO='http://github.com/diaspora/diaspora.git'
|
||||
VERSION='0.0'
|
||||
RELEASE='1'
|
||||
|
||||
|
||||
function git_id
|
||||
#
|
||||
# Echo package-friendly source id.
|
||||
#
|
||||
# Usage: git_id [-n] [file or directory]
|
||||
#
|
||||
{
|
||||
local nl="\n"
|
||||
local file_or_dir="$PWD"
|
||||
test "$1" = '-n' && { nl=""; shift; }
|
||||
test -n "$1" && file_or_dir="$1"
|
||||
if [ -d $file_or_dir ]; then
|
||||
local file=""
|
||||
local dir=$file_or_dir
|
||||
else
|
||||
local file=$(basename $file_or_dir)
|
||||
local dir=$(dirname $file_or_dir)
|
||||
fi
|
||||
|
||||
(
|
||||
cd $dir
|
||||
git log -1 --abbrev-commit --date=iso $file |
|
||||
awk -v nl="$nl" \
|
||||
' BEGIN { commit = ""; d[1] = "" }
|
||||
/^commit/ { if ( commit == "") commit = $2 }
|
||||
/^Date:/ { if (d[1] == "") {
|
||||
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:
|
||||
# Usage: fix_alphatag <file> <version> <commit_id> <release>
|
||||
# Patches:\
|
||||
# * Fri Sep 24 2010 name surname <email@com> 1.20100925_faf23207
|
||||
{
|
||||
local dist=$(rpm --eval %dist)
|
||||
awk -v dist="$dist" -v version="$2" -v commit="$3" -v release="$4" \
|
||||
' BEGIN { done = 0 }
|
||||
/^[*]/ { if (done)
|
||||
print
|
||||
else
|
||||
{
|
||||
s = sprintf( "-%s.%s%s\n", release, commit, dist)
|
||||
gsub( "-[0-9][.][^ ]*$", s)
|
||||
done = 1
|
||||
# add new gsub for version...
|
||||
print
|
||||
}
|
||||
next
|
||||
}
|
||||
{ print }' < $1 > $1.tmp && mv -f $1.tmp $1
|
||||
}
|
||||
|
||||
|
||||
function fix_bundle_deps
|
||||
# usage: fix_bundle_deps <specfile> <version> <commit>
|
||||
# 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 && mv -f $1.tmp $1
|
||||
}
|
||||
|
||||
|
||||
function patch()
|
||||
# Patch spec-files with current version-release
|
||||
# Usage: patch <version> <commit> <release>
|
||||
{
|
||||
sed -e "/^%define/s|HEAD|$2|" \
|
||||
-e '/^Version:/s|.*|Version: '$1'|' \
|
||||
<diaspora.spec >dist/diaspora.spec
|
||||
fix_alphatag dist/diaspora.spec $1 $2 $3
|
||||
local bundle_id=$(git_id dist/diaspora/Gemfile)
|
||||
local dist_tag=$(rpm --eval %dist)
|
||||
fix_bundle_deps dist/diaspora.spec $1 "$RELEASE.${bundle_id}$dist_tag"
|
||||
sed -e "/^%define/s|HEAD|$bundle_id|" \
|
||||
-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 || :
|
||||
(
|
||||
local last_repo=''
|
||||
cd dist
|
||||
|
||||
test -e '.last-repo' &&
|
||||
last_repo=$( cat '.last-repo')
|
||||
test "$last_repo" != $GIT_REPO &&
|
||||
rm -rf diaspora
|
||||
test -d diaspora || {
|
||||
git clone --quiet $GIT_REPO;
|
||||
(
|
||||
cd diaspora;
|
||||
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 || :
|
||||
)
|
||||
}
|
||||
echo -n "$GIT_REPO" > '.last-repo'
|
||||
|
||||
cd diaspora;
|
||||
git fetch --quiet upstream
|
||||
git merge --quiet upstream/master
|
||||
[ -n "$1" ] && git reset --hard --quiet $1
|
||||
git_id -n
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
function make_src
|
||||
# Create a distribution tarball
|
||||
# Usage: make src <commit>
|
||||
{
|
||||
echo "Using repo: $GIT_REPO"
|
||||
|
||||
commit=$(checkout ${1:-'HEAD'})
|
||||
echo "Commit id: $commit"
|
||||
|
||||
RELEASE_DIR="diaspora-$VERSION-$commit"
|
||||
rm -rf dist/${RELEASE_DIR}
|
||||
mkdir dist/${RELEASE_DIR}
|
||||
cd dist
|
||||
mkdir ${RELEASE_DIR}/master
|
||||
cp -ar diaspora/* diaspora/.git* ${RELEASE_DIR}/master
|
||||
(
|
||||
cd ${RELEASE_DIR}/master
|
||||
rm -rf vendor/bundle/* vendor/git/* vendor/cache/* gem-tmp
|
||||
git show --name-only > config/gitversion
|
||||
tar czf public/source.tar.gz \
|
||||
--exclude='source.tar.gz' -X .gitignore *
|
||||
find $PWD -name .git\* | xargs rm -rf
|
||||
rm -rf .bundle
|
||||
/usr/bin/patch -p1 -s <../../../add-bundle.diff
|
||||
)
|
||||
tar czf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR} && \
|
||||
rm -rf ${RELEASE_DIR}
|
||||
cd ..
|
||||
echo "Source: dist/${RELEASE_DIR}.tar.gz"
|
||||
echo "Required bundle: $(git_id dist/diaspora/Gemfile)"
|
||||
}
|
||||
. ./funcs.sh
|
||||
|
||||
function build_git_gems()
|
||||
# Usage: build_git_gems <Gemfile> <tmpdir> <gemdir>
|
||||
|
|
@ -213,6 +46,38 @@ function build_git_gems()
|
|||
# rm -rf gem-tmp
|
||||
}
|
||||
|
||||
function make_src
|
||||
# Create a distribution tarball
|
||||
# Usage: make src <commit>
|
||||
{
|
||||
echo "Using repo: $GIT_REPO"
|
||||
|
||||
commit=$(checkout ${1:-'HEAD'})
|
||||
echo "Commit id: $commit"
|
||||
|
||||
RELEASE_DIR="diaspora-$VERSION-$commit"
|
||||
rm -rf dist/${RELEASE_DIR}
|
||||
mkdir dist/${RELEASE_DIR}
|
||||
cd dist
|
||||
mkdir ${RELEASE_DIR}/master
|
||||
cp -ar diaspora/* diaspora/.git* ${RELEASE_DIR}/master
|
||||
(
|
||||
cd ${RELEASE_DIR}/master
|
||||
rm -rf vendor/bundle/* vendor/git/* vendor/cache/* gem-tmp
|
||||
git show --name-only > config/gitversion
|
||||
tar czf public/source.tar.gz \
|
||||
--exclude='source.tar.gz' -X .gitignore *
|
||||
find $PWD -name .git\* | xargs rm -rf
|
||||
rm -rf .bundle
|
||||
/usr/bin/patch -p1 -s <../../../add-bundle.diff
|
||||
)
|
||||
tar czf ${RELEASE_DIR}.tar.gz ${RELEASE_DIR} && \
|
||||
rm -rf ${RELEASE_DIR}
|
||||
cd ..
|
||||
echo "Source: dist/${RELEASE_DIR}.tar.gz"
|
||||
echo "Required bundle: $(git_id dist/diaspora/Gemfile)"
|
||||
}
|
||||
|
||||
function make_docs()
|
||||
{
|
||||
local gems=$1
|
||||
|
|
@ -238,6 +103,7 @@ function make_docs()
|
|||
}
|
||||
|
||||
|
||||
|
||||
function make_bundle()
|
||||
# Create the bundle tarball
|
||||
# Usage: make_bundle [ commit, defaults to HEAD]
|
||||
|
|
@ -285,69 +151,21 @@ function make_bundle()
|
|||
mv $bundle_name/vendor/cache diaspora/vendor/cache
|
||||
cd ..
|
||||
}
|
||||
git checkout Gemfile
|
||||
echo
|
||||
echo "Bundle: dist/$bundle_name.tar.gz"
|
||||
}
|
||||
|
||||
|
||||
function prepare_rpm()
|
||||
# Usage: prepare_rpm < commit>
|
||||
{
|
||||
local dest=$(rpm --eval %_sourcedir)
|
||||
test -z "$dest" && {
|
||||
echo "Can't find RPM source directory, giving up."
|
||||
exit 2
|
||||
}
|
||||
|
||||
local commit=$( checkout $1)
|
||||
echo "Release: $RELEASE.$commit"
|
||||
echo "Rpm source dir: $dest"
|
||||
|
||||
patch $VERSION $commit $RELEASE
|
||||
|
||||
local src="dist/diaspora-$VERSION-$commit.tar.gz"
|
||||
test -e $src ||
|
||||
cat <<- EOF
|
||||
Warning: $src does not exist
|
||||
(last version not built?)
|
||||
EOF
|
||||
ln -sf $PWD/$src $dest
|
||||
|
||||
local bundle_commit=$( git_id dist/diaspora/Gemfile)
|
||||
local 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
|
||||
|
||||
local file
|
||||
for file in $( grep -v '^#' SOURCES); do
|
||||
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 {} \;)
|
||||
echo "Source specfile: dist/diaspora.spec"
|
||||
echo "Bundle specfile: dist/diaspora-bundle.spec"
|
||||
}
|
||||
|
||||
|
||||
function usage()
|
||||
{
|
||||
cat <<- EOF
|
||||
|
||||
Usage: make-dist [options] <dist|bundle|prepare>
|
||||
Usage: make-dist [options] <dist|bundle>
|
||||
|
||||
Options:
|
||||
|
||||
-h Print this message.
|
||||
-c commit Use a given commit, defaults to last checked in.
|
||||
-r release For prepare, mark with release nr, defaults to 1.
|
||||
-u uri Git repository URI, defaults to
|
||||
$GIT_REPO.
|
||||
-f For bundle, fix dependencies by running 'bundle update'
|
||||
|
|
@ -355,8 +173,6 @@ function usage()
|
|||
|
||||
source Build a diaspora application tarball.
|
||||
bundle Build a bundler(1) bundle for diaspora.
|
||||
prepare Symlink bundle and source tarballs to rpm source dir,
|
||||
create patched rpm spec files.
|
||||
|
||||
All results are stored in dist/
|
||||
|
||||
|
|
@ -366,15 +182,13 @@ function usage()
|
|||
|
||||
commit='HEAD'
|
||||
BUNDLE_FIX='no'
|
||||
while getopts ":r:c:u:fh" opt
|
||||
while getopts ":c:u:fh" opt
|
||||
do
|
||||
case $opt in
|
||||
u) GIT_REPO="$OPTARG"
|
||||
;;
|
||||
c) commit="${OPTARG:0:7}"
|
||||
;;
|
||||
r) RELEASE="$OPTARG:"
|
||||
;;
|
||||
f) BUNDLE_FIX='yes'
|
||||
;;
|
||||
h) usage
|
||||
|
|
@ -387,7 +201,7 @@ do
|
|||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
typeset -r GIT_REPO RELEASE BUNDLE_FIX
|
||||
typeset -r GIT_REPO BUNDLE_FIX
|
||||
export LANG=C
|
||||
|
||||
test $# -gt 1 -o $# -eq 0 && {
|
||||
|
|
@ -401,8 +215,6 @@ case $1 in
|
|||
;;
|
||||
'source') make_src $commit
|
||||
;;
|
||||
'prepare') prepare_rpm $commit $release
|
||||
;;
|
||||
*) usage
|
||||
exit 1
|
||||
;;
|
||||
|
|
@ -5,23 +5,20 @@ work as a first step towards packaging, but should be usable as is.
|
|||
|
||||
### Synopsis
|
||||
|
||||
|
||||
Bootstrap the distribution from git:
|
||||
% sudo apt-get install git-core
|
||||
% git clone git://github.com/diaspora/diaspora.git
|
||||
% cd diaspora/pkg/ubuntu
|
||||
|
||||
Create and install the diaspora bundle and application in
|
||||
diaspora/pkg/source according to
|
||||
[source README](http://github.com/diaspora/diaspora/blob/master/source/fedora/README.md)
|
||||
|
||||
Install the dependencies (a good time for a coffe break):
|
||||
% sudo ./diaspora-install-deps
|
||||
|
||||
Create and install the diaspora bundle and application:
|
||||
% ./make-dist.sh bundle
|
||||
% sudo ./diaspora-bundle-install dist/diaspora-bundle-*.tar.gz
|
||||
|
||||
% ./make-dist.sh source
|
||||
% sudo ./diaspora-install dist/diaspora-0.0*.tar.gz
|
||||
|
||||
Initiate and start the server;
|
||||
Install, initiate and start the server;
|
||||
% sudo ./diaspora-install
|
||||
% sudo ./diaspora-setup
|
||||
% sudo su - diaspora
|
||||
% cd /usr/share/diaspora/master
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
../fedora/make-dist.sh
|
||||
Loading…
Reference in a new issue