[opensuse-buildservice] OBS source_service usage with upstream git sources -- syntax for .spec file's dynamic Source:/Version:/Release: values?
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_... For my current test pkg, osc mkpac pgnd-cryptodev cd ./pgnd-cryptodev 'add' the obs source_service template osc add git://github.com/openSUSE/obs-build.git edit for the target git source's URL edit _service - <param name="url">git://github.com/openSUSE/obs-build.git</param> + <param name="url">https://github.com/cryptodev-linux/cryptodev-linux.git</param> The docs state The default mode of a service is to always run after each commit on the server side and locally before every local build. Iiuc, all that the workspace package dir requires, is project/ package/ _service package.spec and a local osc build ... should trigger the source pull. Since the upstream's git revision is (1) changing frequently, and (2) typically added to the local package's version etc strings, what's the correct form & syntax for the Source: Version: Release: variables, as well as the package name value %setup -q -n XXX in the .spec file be? e.g. edit pgnd-cryptodev.spec %define basepkgname cryptodev Name: pgnd-%{basepkgname} Version: ??? Release: ??? Summary: cryptodev test Group: Productivity/Networking/Security Url: http://cryptodev-linux.org/ License: GPL2 Source: ??? Provides: ??? BuildRequires: kernel-desktop-devel BuildRoot: /tmp/%{basepkgname}-%{version}-build %description cryptodev test install %prep %setup -q -n ??? %build make %install make install DESTDIR="%buildroot" %clean %post %postun %files %changelog One good example would be useful, and helpful if added to the docs -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
Found this as a best example so far https://saschpe.wordpress.com/2013/11/08/obs-introducting-the-refresh_patche... informs this 1st attempt edit _service <services> <service name="tar_scm" mode="disabled"> <param name="url">https://github.com/cryptodev-linux/cryptodev-linux.git</param> <param name="scm">git</param> <param name="exclude">.git</param> <param name="versionformat">1-git.%h</param> <param name="revision">remotes/origin/master</param> </service> <service name="recompress" mode="disabled"> <param name="file">*.tar</param> <param name="compression">gz</param> </service> <service name="set_version" mode="disabled"> <param name="basename">pgnd-cryptodev</param> </service> </services> on service exec returns, osc service dr Cloning into '/tmp/tmp5RQuOB/tmpz2895f/cryptodev-linux'... ERROR(1): '' HEAD is now at da73010 tests/Makefile: fix arg passing to CC in implicit rule Cleaning: /tmp/tmp5RQuOB/tmpz2895f /tmp/tmp5RQuOB/cryptodev-linux-1git.da73010 Compressed cryptodev-linux-1git.da73010.tar to cryptodev-linux-1git.da73010.tar.gz No version found or defined at /usr/lib/obs/service/set_version line 196. Aborting: service call failed: /usr/lib/obs/service/set_version --basename pgnd-cryptodev --outdir /tmp/tmpBEHSGo Some data's clearly passed, but not all. The package name format is wrong. How to config the above in keeping with the package naming conventions is not clear. No version is apparently passed &/or used. Looking for a bit more. -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
For interest, Stumbled on https://en.opensuse.org/openSUSE:Build_Service_private_instance_software_liv... Removing params to allow defaults, as defined in link above - <param name="versionformat">-git.%h</param> - <param name="revision">remotes/origin/master</param> Changing basename to git repo basename, not pkg-name basename - <param name="basename">pgnd-cryptodev</param> + <param name="basename">cryptodev-linux</param> With resulting edit _service <services> <service name="tar_scm" mode="disabled"> <param name="url">https://github.com/cryptodev-linux/cryptodev-linux.git</param> <param name="scm">git</param> <param name="exclude">.git</param> </service> <service name="recompress" mode="disabled"> <param name="file">*.tar</param> <param name="compression">gz</param> </service> <service name="set_version" mode="disabled"> <param name="basename">cryptodev-linux</param> </service> </services> service exec osc service dr now returns Cloning into '/tmp/tmpdJndCH/tmp4paj9s/cryptodev-linux'... HEAD is now at da73010 tests/Makefile: fix arg passing to CC in implicit rule Cleaning: /tmp/tmpdJndCH/tmp4paj9s /tmp/tmpdJndCH/cryptodev-linux-1428749261.da73010 Compressed cryptodev-linux-1428749261.da73010.tar to cryptodev-linux-1428749261.da73010.tar.gz The package tree locally now contains ls -al total 76K drwxrwxr-x+ 3 root root 4.0K Apr 24 17:15 ./ drwxrwxr-x+ 4 root root 4.0K Apr 24 15:04 ../ -rw-r--r--+ 1 root root 54K Apr 24 17:15 cryptodev-linux-1428749261.da73010.tar.gz drwxrwxr-x+ 2 root root 4.0K Apr 24 16:46 .osc/ -rw-r--r--+ 1 root root 696 Apr 24 17:15 pgnd-cryptodev.spec -rw-rw-r--+ 1 root root 485 Apr 24 17:12 _service -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
Release is usually overwritten by non-local OBS build, Version could be set automatically via <service name="set_version"/>, Source could be set via <param name="filename">blah</param>, f.e.: <services> <service name="tar_scm"> <param name="url">git://github.com/DAP-DarkneSS/HuffmanArchiver.git</param> <param name="scm">git</param> <param name="filename">huffmanarchiver</param> // Debian hates capital letters. <param name="versionprefix">0.1.1+git</param> </service> <service name="recompress"> <param name="file">*.tar</param> <param name="compression">bz2</param> // And xz/lzma too :) </service> <service name="set_version"/> </services> -- Best regards, Dmitriy DA(P).DarkneSS Perlow @ Linux x64 -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
# dev@pgnd.us / 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_...
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@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
participants (3)
-
Dmitriy Perlow
-
PGNd
-
Roman Neuhauser