I've been working with the source services to provide a tighter integration between OBS and a version control system. I'd like to be able to get configuration parameters for a source service from the project config. That way, I can copy the _service file between two projects, and the project config determines, for example, which SCM branch to use. That way I can have something like: project (uses the main development branch) project:branch (uses a 'bugfix' branch) That way, the project config (one place to edit) can hold the branch to use, instead of the _service file(s) - which can be numerous, depending on the number of packages in a project. Since the project config is in /srv/obs/projects/<project>.cfg, it's a simple matter of to scan the <project>.cfg file for a special term - like %git_branch, and return a value which is used to generate the tarball from the version control system. The problem is that I need a way to make the project name available to the source service. This patch does most of the work: It adds --obsproject <prjname> as an argument to the source service script.
From there, it's necessary to edit the source service scripts to they can ignore the --obsproject option, as it is always provided (much like $myworkdir).
--- bs_service.org 2011-09-13 13:07:20.955737006 -0600 +++ bs_service 2011-09-13 14:25:12.602314611 -0600 @@ -147,6 +147,9 @@ push @run, "--$param->{'name'}"; push @run, $param->{'_content'}; } + # Push out the project so we can check against it. + push @run, "--obsproject"; + push @run, "$projid"; push @run, "--outdir"; push @run, "$myworkdir/.tmp"; BSUtil::cleandir("$myworkdir/.tmp"); --- /home/ttelford/tar_scm 2011-09-13 16:00:16.499841484 -0600 +++ tar_scm 2011-09-13 13:40:51.000000000 -0600 @@ -70,6 +70,10 @@ fi shift ;; + *-obsproject) + PROJECT="$2" + shift + ;; *) echo Unknown parameter $1. echo 'Usage: tar_scm --scm $SCM --url $URL --outdir $OUT' -- Troy Telford -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org