Mailinglist Archive: opensuse-buildservice (89 mails)

< Previous Next >
Re: [opensuse-buildservice] OBS source_service usage with upstream git sources -- syntax for .spec file's dynamic Source:/Version:/Release: values?
# dev@xxxxxxx / 2015-04-24 15:33:45 -0700:
I am creating a pkg, intending to use upstream git repo for its
source.

Manually pulling the source repo into local obs workspace, tar.gz'ing
it, works as expected. I need to prepare for frequent updates of
multiple packages' upstream git sources, and wish to automate the
process.

For triggerable automation of the process, OBS' Source Services are
appropriate,

8 Source Services

http://openbuildservice.org/help/manuals/obs-reference-guide/cha.obs.source_service.html

i have a different tool for this, bs-update[0,1,2].
it's an alternative to a few source services with a few advantages
(i'm not biased, promise! :). if you want to give it a shot, here's
a sales pitch in the form of a complete configuration file for it.

basic behavior is (copied from the manpage):

given a build service api url, project and package names, a tarball
url, and a version number, bs-update will

1. fetch the tarball from the url,
2. check out the package from the build service,
3. update the tarball source with the downloaded tarball,
4. update package descriptions (specfile, PKGBUILD, etc),
5. commit the changes.

end quote.

steps 1, 2 are trivial, and there are hooks into steps 3, 4.

i've set up a basic cryptodev-linux package updated with bs-update
at home:roman-neuhauser:playpen/cryptodev-linux. you can try it
out with

% osc co home:roman-neuhauser:playpen/cryptodev-linux
% cd home:roman-neuhauser:playpen/cryptodev-linux
% ln -s dot.bs-update .bs-update
% bs-update -C HEAD

################################################################
# this is a configuration file for bs-update. to use this file:
#
# % ln -s dot.bs-update .bs-update
# % bs-update HEAD
#
### bsu_specfile_hook
# bs-update expects a specfile template (foo.spec.in) inside the tarball
# by default. if the specfile comes from elsewhere, you need to define
# a `bsu_specfile_hook` function. this hook will be called after the
# tarball has been downloaded, in the root of the checked out package.
# if the template lives in the BS package, the hook has nothing to do
# (but still has to exist).
#
### bsu_tarball_hook
# the top-level directory contained in tarballs generated from
# the tarball/master url will have a funky name. this fixes it.
# see bs-update(1) for more info.
#
### bsu_version_hook
# version string is normally derived from command line arguments,
# but if you're going to use bs-update with 'HEAD' (see above)
# the version string would be just that.
# again, see the bs-update manpage for more info.

bsu_bs_project=home:roman-neuhauser:playpen
bsu_bs_package=cryptodev-linux
bsu_dloadurl=https://github.com/cryptodev-linux/cryptodev-linux/tarball/master
bsu_specfiles=(cryptodev-linux.spec)

bsu_specfile_hook()
{
:
}

bsu_tarball_hook()
{
local tarball=./${1?}
local dir=${tarball%.tar.gz}
mkdir $dir
tar -xzf $tarball --strip-components=1 -C $dir
tar -czf $tarball -- ${dir#./}
rm -rf $dir
}

bsu_version_hook()
{
printf "1.7+$(date -u +%Y%m%d%H%M)"
}

# you can get bs-update from any of:
# [0] https://github.com/roman-neuhauser/bs-update
# [1] https://build.opensuse.org/package/show/home:roman-neuhauser/bs-update
# [2] http://software.opensuse.org/package/bs-update?search_term=bs-update

--
roman
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-buildservice+owner@xxxxxxxxxxxx

< Previous Next >
References