PDA

View Full Version : Developers backgrounder? svn, etc.



pfarrell
2008-03-15, 18:19
In a couple of other threads, I've been discussing the MySql connection. Since the motto is "patches welcome" I figured I'd checkout the current code from svn, and try some stuff.

Before I did that, I checked the wiki, http://wiki.slimdevices.com/index.cgi?DeveloperGuide

and its a bit stale. So I decided to just go for broke and do a full checkout.

It appears that a simple checkout of the repository is huge. Lots of old versions, branches, etc.

I did a
svn checkout http://svn.slimdevices.com/repos/slim/ slim

I really don't need all that, can someone suggest a point farther down the tree, that is more limited, say to just current code.

It looks like
http://svn.slimdevices.com/repos/slim/trunk/server/
is close, but I expect I really want to work with testing or unstable.

Thanks
pat

erland
2008-03-16, 00:21
svn checkout http://svn.slimdevices.com/repos/slim/trunk/server unstable
svn checkout http://svn.slimdevices.com/repos/slim/branches/7.0/server 7.0.x
svn checkout http://svn.slimdevices.com/repos/slim/tags/7.0.0/server 7.0.0


You typically never want to checkout just "repos/slim". Typically you would checkout the "trunk" (next major release) or one of the branches under "branches" (minor releases, for example 7.0.1). If you want to see what exists, just open up the urls in a web browser.

The above mentioned examples only checkout the "server" directory, if you are going to on things like the debian installer or SoftSqueeze you probably want to remove the /server part of the checkout commands.

I think the corresponding Jive checkout commands would look something like this, but I'm not completely sure:


svn checkout http://svn.slimdevices.com/repos/jive/trunk/squeezeplay jive_unstable
svn checkout http://svn.slimdevices.com/repos/jive/branches/7.0/jive jive_7.0.x

mherger
2008-03-16, 01:09
> svn checkout http://svn.slimdevices.com/repos/slim/trunk/server unstable
> svn checkout http://svn.slimdevices.com/repos/slim/branches/7.0/server
> 7.0.x
> svn checkout http://svn.slimdevices.com/repos/slim/tags/7.0.0/server
> 7.0.0

Please note that we're soon going to change the branching schema. A
_draft_ is available on the wiki.

http://wiki.slimdevices.com/index.cgi?RepositoryStructure

Michael

pfarrell
2008-03-16, 08:34
When is RSN for the SVN reconfig?

And is there one point that I should checkout? or do I really need all three described upthread?

Related: there is talk about automated testing as a future wish. Did that become real? Can I execute some tests to make sure that my changes change only what I want to change?

erland
2008-03-16, 09:14
And is there one point that I should checkout? or do I really need all three described upthread?

I suppose it depends on what you like to do.
- If you are going to work on new major features and changes, it should be enough to have the "unstable" (or "trunk" as it is currently called in svn)
- If you are going to work on correcting bugs and small feature changes in 7.0.1 it would be enough to get the "7.0.x" (or "branches/7.0" as it is currently called in svn)



Related: there is talk about automated testing as a future wish. Did that become real? Can I execute some tests to make sure that my changes change only what I want to change?
I'm not sure about the current state, but there was some work in progress mentioned earlier in the following threads:
http://forums.slimdevices.com/showthread.php?t=37269
http://forums.slimdevices.com/showthread.php?t=33007

dean
2008-03-16, 09:25
On Mar 16, 2008, at 9:14 AM, erland wrote:
> pfarrell;280382 Wrote:
>>
>> And is there one point that I should checkout? or do I really need
>> all
>> three described upthread?
>>
> I suppose it depends on what you like to do.
> - If you are going to work on new major features and changes, it
> should
> be enough to have the "unstable" (or "trunk" as it is currently called
> in svn)
> - If you are going to work on correcting bugs and small feature
> changes
> in 7.0.1 it would be enough to get the "7.0.x" (or "branches/7.0" as
> it
> is currently called in svn)
I'd recommend working on the trunk, there are likely to be no changes
to the 7.0 branch, it's effectively done.

If you do want to switch to another branch later on (after the reorg),
you should be able to do that with an svn switch command without
having to check out everything again.

-dean

pfarrell
2008-03-16, 11:06
I suppose it depends on what you like to do.

I want to start as small as possible.
Learn my way around the current codebase, etc.

All I want to do now is implement
http://bugs.slimdevices.com/show_bug.cgi?id=4713

It should be five to ten lines of code.

I'd like to put it in someplace so that it will get included in a future release. I'm not in a hurry for this to be retrifitted into 7.0, its fine to be 7.0.1 or even 7.0.2

erland
2008-03-16, 11:31
I'd like to put it in someplace so that it will get included in a future release. I'm not in a hurry for this to be retrifitted into 7.0, its fine to be 7.0.1 or even 7.0.2
The best is probably to base it on "trunk" (the unstable branch).

gharris999
2008-03-16, 12:40
This is what I do in order to make the trunk svn code work as a service on my fedora 8 box. This creates the closest approximation to a "production" installation using the trunk code and still allows me to have a runnable release version on the same box.

1st, I install the SC7 release from the yum repo. This creates the appropriate user accounts and a squeezecenter service.

2nd, I do a clean check out of the trunk code using this script:


#!/bin/sh

if [ -e '/usr/share/squeezecenter_trunk/server' ]
then
echo 'Code squeezecenter_trunk already installed!'
echo 'Updating trunk code'
if [ ! -e '/var/log/squeezecenter_trunk' ]
then
mkdir /var/log/squeezecenter_trunk
fi
svn up /usr/share/squeezecenter_trunk >>/var/log/squeezecenter_trunk/svn.log
exit 1
fi

if [ ! -e '/usr/share/squeezecenter_trunk' ]
then
echo 'Creating directory for SqueezeCenter (trunk)'
mkdir /usr/share/squeezecenter_trunk
chown -R squeezecenter:squeezecenter /usr/share/squeezecenter_trunk
fi

echo 'Preparing the log dir'
mkdir /var/log/squeezecenter_trunk
chown -R squeezecenter:squeezecenter /var/log/squeezecenter_trunk

echo 'Downloading SqueezeCenter (trunk) svn code...'
svn co http://svn.slimdevices.com/repos/slim/trunk /usr/share/squeezecenter_trunk >/var/log/squeezecenter_trunk/svn.log
echo 'Fixing file permissions...'
chown -R squeezecenter:squeezecenter /usr/share/squeezecenter_trunk

echo 'Preparing new squeezecenter_trunk service'
echo 'Note: /etc/rc.d/init.d/squeezecenter_trunk will need to be hand edited before service is ready to run!

cp /etc/rc.d/init.d/squeezecenter /etc/rc.d/init.d/squeezecenter_trunk
cd /etc/rc.d/rc3.d
ln -s ../init.d/squeezecenter_trunk ./S80squeezecenter_trunk
cd /etc/rc.d/rc5.d
ln -s ../init.d/squeezecenter_trunk ./S80squeezecenter_trunk

echo 'Preparing /etc/sysconfig/squeezecenter_trunk'

echo '# Edit this to suit your setup' >/etc/sysconfig/squeezecenter_trunk
echo 'SQUEEZECENTER_USER="squeezecenter"' >>/etc/sysconfig/squeezecenter_trunk
echo 'SQUEEZECENTER_HOME="/usr/share/squeezecenter_trunk/server"' >>/etc/sysconfig/squeezecenter_trunk
echo 'SQUEEZECENTER_CFG_DIR="/var/lib/squeezecenter_trunk/prefs"' >>/etc/sysconfig/squeezecenter_trunk
echo 'SQUEEZECENTER_LOG_DIR="/var/log/squeezecenter_trunk"' >>/etc/sysconfig/squeezecenter_trunk
echo 'SQUEEZECENTER_CACHE_DIR="/var/lib/squeezecenter_trunk/cache"' >>/etc/sysconfig/squeezecenter_trunk
echo 'SQUEEZECENTER_ARGS="--daemon --prefsdir=$SQUEEZECENTER_CFG_DIR --logdir=$SQUEEZECENTER_LOG_DIR --cachedir=$SQUEEZECENTER_CACHE_DIR"' >>/etc/sysconfig/squeezecenter_trunk

echo 'Preparing the data dir'
cp -R /var/lib/squeezecenter /var/lib/squeezecenter_trunk
chown -R squeezecenter:squeezecenter /var/lib/squeezecenter_trunk

echo 'Preparing /etc/squeezecenter_trunk'
cp -R /etc/squeezecenter /etc/squeezecenter_trunk
rm -f /etc/squeezecenter_trunk/server.conf
ln -s /var/lib/squeezecenter_trunk/prefs/server.prefs /etc/squeezecenter_trunk/server.conf
chown -R squeezecenter:squeezecenter /etc/squeezecenter_trunk

echo 'Setting up the squeezecenter_trunk service to autorun..'
chkconfig --level 35 squeezecenter off
chkconfig --level 35 squeezecenter_trunk on

echo 'Make sure to hand edit /var/lib/squeezecenter_trunk/prefs/server.prefs and'
echo '/etc/rc.d/init.d/squeezecenter_trunk before attempting to run the squeezecenter_trunk service.'
echo 'Done!'


3rd, I modify the /etc/rc.d/init.d/squeezecenter_trunk service script to this:



#!/bin/bash
#
# squeezecenter_trunk Startup script for the SqueezeCenter Music Server
#
# chkconfig: 345 80 30
# description: SqueezeCenter_trunk powers the Squeezebox, Transporter and SLIMP3 network music \
# players and is the best software to stream your music to any software MP3 \
# player. It supports MP3, AAC, WMA, FLAC, Ogg Vorbis, WAV and more!
# processname: squeezecenter_trunk
# config: /etc/squeezecenter_trunk/squeezecenter.conf
# config: /etc/sysconfig/squeezecenter_trunk

#
### BEGIN INIT INFO
# Provides: squeezecenter_trunk
# Required-Start: $syslog $remote_fs
# Should-Start: $time ypbind sendmail
# Required-Stop: $syslog $remote_fs
# Should-Stop: $time ypbind sendmail
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Startup script for the SqueezeCenter_trunk Music Server
# Description: SqueezeCenter_trunk powers the Squeezebox, Transporter and SLIMP3 network music \
# players and is the best software to stream your music to any software MP3 \
# player. It supports MP3, AAC, WMA, FLAC, Ogg Vorbis, WAV and more!
### END INIT INFO
#

if [ -f /etc/redhat-release ] ; then

# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check for existence of needed config file and read it
SQUEEZECENTER_CONFIG=/etc/sysconfig/squeezecenter_trunk
test -r $SQUEEZECENTER_CONFIG || { echo "$SQUEEZECENTER_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }

# Read config
. $SQUEEZECENTER_CONFIG

# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
SQUEEZECENTER_BIN="$SQUEEZECENTER_HOME/slimserver.pl"
test -x $SQUEEZECENTER_BIN || { echo "$SQUEEZECENTER_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }

LOCKFILE="/var/lock/subsys/squeezecenter_trunk"
RETVAL=0

start() {
echo -n "Starting SqueezeCenter_trunk: "
daemon --user $SQUEEZECENTER_USER $SQUEEZECENTER_BIN $SQUEEZECENTER_ARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}

stop() {
echo -n "Stopping SqueezeCenter_trunk: "
# Support old versions of RHEL and still fix bug 5620
KILLPROC_ARGS=""
if [ `grep -c 'Usage: killproc.*-d delay' /etc/init.d/functions` -ge 1 ]; then
KILLPROC_ARGS="-d 6"
fi
killproc $KILLPROC_ARGS $SQUEEZECENTER_BIN
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
# If killproc fails, try killall (fix for RHEL4)
killall slimserver.pl
RETVAL=$?
[ $RETVAL -eq 0 ] && echo_success
[ $RETVAL -ne 0 ] && echo_failure
fi
echo
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
return $RETVAL
}

restart() {
stop
sleep 2
start
}

condrestart() {
[ -f $LOCKFILE ] && restart || :
}

fdr_status() {
status $SQUEEZECENTER_BIN
RETVAL=$?
}

elif [ -f /etc/SuSE-release ] ; then

# Check for existence of needed config file and read it
SQUEEZECENTER_CONFIG=/etc/sysconfig/squeezecenter_trunk
test -r $SQUEEZECENTER_CONFIG || { echo "$SQUEEZECENTER_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }

# Read config
. $SQUEEZECENTER_CONFIG

# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
SQUEEZECENTER_BIN="$SQUEEZECENTER_HOME/slimserver.pl"
test -x $SQUEEZECENTER_BIN || { echo "$SQUEEZECENTER_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }

# Source rc.status and reset
. /etc/rc.status
rc_reset

start() {
echo -n "Starting SqueezeCenter: "
export HOME=$SQUEZECENTER_HOME
startproc -u $SQUEEZECENTER_USER $SQUEEZECENTER_BIN $SQUEEZECENTER_ARGS
rc_status -v
}

stop() {
echo -n "Stopping SqueezeCenter: "
killproc -TERM $SQUEEZECENTER_BIN
rc_status -v
}

restart() {
$0 stop
$0 start
rc_status
}

condrestart() {
$0 status
if test $? = 0; then
$0 restart
else
rc_reset
fi
rc_status
}

fdr_status() {
/sbin/checkproc $SQUEEZECENTER_BIN
rc_status -v
}

else
exit 1
fi

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
restart
;;
condrestart|try-restart)
condrestart
;;
status)
fdr_status
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
exit 1
esac

[ -f /etc/redhat-release ] && exit $RETVAL
[ -f /etc/SuSE-release ] && rc_exit

Then, I modify /var/lib/squeezecenter_trunk/prefs/server.prefs so that the line containing " irmap: /usr/share/squeezecenter/IR/Default.map" instead reads: " irmap: /usr/share/squeezecenter_trunk/server/IR/Default.map"

I think that's all you have to do. One ought to be able to then start the service with: "service squeezecenter_trunk start"

Finally, to subsequently update the trunk, just perform a "svn up /usr/share/squeezecenter_trunk >>/var/log/squeezecenter_trunk/svn.log"

PS: I'd be curious to know if anyone thinks that these instructions are good enough/complete enough to be included in the wiki.

pfarrell
2008-03-16, 19:59
PS: I'd be curious to know if anyone thinks that these instructions are good enough/complete enough to be included in the wiki.

I believe that any documentation along these lines is good. Its a wiki, it can be improved and edited forever.

The last time I changed any code was back in the 5.4 days, and its a lot less approachable now. Or perhaps I've gotten dumber over the years. :-)

farallon
2008-03-25, 23:13
Here's what I've done to get a working SC tree via SVN on a Buffalo LinkStation debian box.



cd /usr/src
# -N is non-recursive checkout (this saves us from grabbing non-useful architectures)
svn co -N http://svn.slimdevices.com/repos/slim/trunk squeezecenter
svn up -N squeezecenter/platforms squeezecenter/server
svn up squeezecenter/platforms/debian
cd squeezecenter/server
svn up -N Bin
svn up CPAN Firmware Graphics HTML IR MySQL Plugins SQL Slim lib


For testing and experimenation, I just run it via


./slimserver.pl --user=squeezecenter


For a more permanent install, I make a local package:


squeezecenter/buildme.pl --build debian --buildDir /usr/src/sc_obj --sourcedir /usr/src/squeezecenter --destdir /usr/src/sc_bin
cd sc_bin
dpkg -i <.deb file>


- R

dean
2008-03-26, 05:58
On Mar 25, 2008, at 11:13 PM, farallon wrote:
>
> Here's what I've done to get a working SC tree via SVN on a Buffalo
> LinkStation debian box.
>


This would be great to add to the wiki, once it's unlocked and up again.

-dean