Code Monkey home page Code Monkey logo

obs-service-tar_scm's Introduction

tar_scm (OBS source service) Build Status

This is the git repository for openSUSE:Tools/obs-service-tar_scm, which provides several source services for the Open Build Service which all assist with packaging source code from SCM (source code management) repositories into tarballs. The authoritative source is https://github.com/openSUSE/obs-service-tar_scm.

Services

tar_scm (deprecated)

tar_scm is the legacy source service used to create a source tarball from one of the supported SCM (source code management) tools: git, hg, svn, and bzr.

tar_scm supports many options, e.g. it can adjust resulting tarball parameters, include or exclude particular files when creating the tarball, or generate an rpm changelog from the SCM commit log. For the full list of options please see tar_scm.service.in.

Apart from various SCM like git, hg, bzr or svn, it additionally supports --url option that allows you to specify URL of the upstream tarball to be downloaded.

tar_scm can be used in combination with other services like download_files, recompress or set_version e.g. within the GIT integration workflow.

tar_scm is deprecated in favour of obs_scm.

obs_scm

obs_scm is similar in concept to tar_scm, but instead of directly generating tarballs, it instead uses the new obscpio archive format (see below) as an intermediate space-efficient format in which to store the sources.

It is recommended to use obs_scm in favour to tar_scm, because it provides the following advantages:

  1. When you osc checkout, you'll also get a local checkout directory within the project directory, inside which you can develop as usual and test your changes with local builds, even without having to commit or push your changes anywhere.

  2. It helps to save a lot of disk space on the server side, especially when used in continuous integration (e.g. nightly builds and builds of pull requests).

The usual source tarballs can be regenerated from this at build-time using the tar and recompress source services, so no changes to .spec files are required when switching to obs_scm and obscpio.

Having said that, it may be more efficient to drop the build-time usage of recompress, since at build-time rpmbuild would decompress the same file soon after compressing it. In this case, only the tar source service would be used to reconstruct an uncompressed tarball to be consumed by the .spec file. However this has the side-effect that the resulting .src.rpm will contain an uncompressed tarball too. This is not necessarily a problem because .src.rpm files are compressed anyway, and in fact it may even be more efficient to avoid double compression (i.e. the sources within the .src.rpm, and the .src.rpm itself both being compressed). But this depends very much on the combination of compression formats used for compression of the sources, and for compression of the .src.rpm. Therefore the decision whether to use recompress will depend on what format is desired within the resulting .src.rpm, and on the types of compression being used for both the tarball and by rpmbuild for constructing the source rpms.

obs_scm additionally generates a file named <package>.obsinfo which includes useful information from your SCM system, such as the name, version number, mtime, and commit SHA1. This data is then used by the tar service (see below) to reconstruct a tarball for use by rpmbuild at build-time, and also by the set_version source service in order to set the version in build description files such as .spec or .dsc files.

tar

The tar source service creates a tarball out of a .obscpio archive and a corresponding .obsinfo file which contains metadata about it. Typically this service is run at build-time, e.g.

<service name="tar" mode="buildtime"/>

since storing the .tar file in OBS would duplicate the source data in the .obscpio and defeat the point of using .obscpio in the first place, which is to save space on the OBS server.

See http://openbuildservice.org/2016/04/08/new_git_in_27/ for an example combining usage of the obs_scm and tar source services.

snapcraft

The snapcraft source service can be used to fetch sources before building a snappy app (a.k.a. snap).

It parses a snapcraft.yaml file, looking for any parts in the parts section which have source-type set to one of the supported SCMs. For each one it will fetch the sources via the SCM from the upstream repository, and build a tarball from it.

Finally it will write a new version of snapcraft.yaml which has the source value rewritten from the original URL, to the name of the part, which is also the name of the newly created local file. This allows the snap to be built purely from local files.

appimage

The appimage source service can be used to fetch sources before building an AppImage. It parses an appimage.yml file, looks for an optional build section at the top-level, and for any sub-key named after a supported SCM, it will treat the corresponding value as a URL, fetch the sources via the SCM from the upstream repository, and build a tarball from it. You can find example appimage.yml files under the tests/fixtures/ subdirectory.

gbp

The obs_gbp service can be used to create Debian source artefacts (.dsc, .orig.tar.gz and if non-native .debian.tar.gz or .diff.gz) from Git repositories, following the very popular git-buildpackage workflow. Requires git-buildpackage to be installed.

Archive Formats

tar

The standard tar archive format is used as output format by the tar and tar_scm source services.

obscpio

obscpio archives are cpio archives in newc format. Using these allows the OBS Delta Store to store changes server-side in a space-efficient incremental way, independently of your chosen SCM. Then at build-time, the tar source service converts a file from this format into a regular .tar for use by rpmbuild. This is described in more detail in this blog post:

Installation

The files in this top-level directory need to be installed using the following:

make install

User documentation

There isn't yet any comprehensive user documentation (see issue #238), but in the meantime, in addition to the information in this README, the following resources may be helpful:

Test suite

See the TESTING.md file.

Contributions

See the CONTRIBUTING.md file.

obs-service-tar_scm's People

Contributors

adrianschroeter avatar aspiers avatar bluca avatar bmwiedemann avatar cfelder avatar darix avatar dimstar77 avatar dirkmueller avatar dmacvicar avatar doccaz avatar e4t avatar gollub avatar hawkeye116477 avatar hramrach avatar iartarisi avatar itachisan avatar jblunck avatar jengelh avatar jirislaby avatar jjacque avatar m0ses avatar marcus-h avatar matwey avatar mcepl avatar mwilck avatar nick-wang avatar nmorey avatar olafhering avatar saschpe avatar vogtinator avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

obs-service-tar_scm's Issues

test suite needs optimising

It's currently too hard to get quick feedback from the test suite, as there are too many tests taking too long. We should do some performance profiling on the tests and tackle the bottlenecks.

Support `git describe` in versionformat

For projects using git it seems to make sense to just use git describe directly instead of including all the parts in the format.

Perhaps %gd (gd = git describe)?

Before I was pointed to this functionality I created https://github.com/boombatower/obs-git-update/blob/master/obs-git-update which uses the following.

$(git describe --always --tags --long | sed 's/-/./g')

Which results in something like: v2.2.507.g0524a6f. Can even add flags for always returning a result even if no tags. Nice since all in one does what you normally want and even includes the number of commits past the tag in addition to the commit hash. So in the example v2.2 is latest tag and 507 is the number of commit since that tag, then the abbreviated hash after that.

Thoughts?

required python-yaml is not in SLE12

Maybe an old hat, but:

Problem: nothing provides python-yaml needed by obs-service-tar_scm-0.6.1.1471594222.d257927-121.bax.1.noarch

python-yaml is not in SLE_12.

obs_scm is not idempotent

running obs_scm twice generates a cpio archive with the same name but different content. symlinks and some git files contain different time stamps. So the result is not reproducible. Maybe use last commit timestamp for such files?

tar_scm problem: Files could not be expanded: service error: UnboundLocalError: local variable 'changesauthor' referenced before assignment

Error Message on the Server Side:

Files could not be expanded: service error: UnboundLocalError: local variable 'changesauthor' referenced before assignment

with the current revision 0.7 of obs-service-tar_scm from openSUSE:Tools. Old version 0.6 works.

I just tested the old _service file from the package obs-server below. Local Source Service with osc works on the same _service file. I guess from the error message it's something with the changesgenerate.

<services>
  <service name="tar_scm"
    <param name="versionformat">2.7.51.git%cd.%h</param>
    <param name="url">git://github.com/openSUSE/open-build-service.git</param>
    <param name="scm">git</param>
    <param name="changesgenerate">enable</param>
  </service>
  ...
</services>

tar_scm with git caching results in no working git in buildhost

If using build.opensuse.org to download my current development state from github, using tar_scm with package-meta=true, then after the implementation of caching, I cannot run any "git" commands as part of my specfile/debian rules any more. I get the error:

error: object directory /var/cache/obs/iPZjBpzO5fht/git-cache/.../.git/objects does not exist; check .git/objects/info/alternates.

The reason seems to be that the $builddir/.git folder is mostly empty with only a reference in .git/objects/info/alternates pointing to /var/cache/obs/... (which I guess doesn't exist in the build host)

Here is an example package with this problem: https://build.opensuse.org/package/show/home:ailin_nemui:irssi-git-test/irssi-git

cleanup: many tests don't expect commits during fixture initialisation

While working on #127 , I noticed that some tests explicitly call fix.create_commits() before running tar_scm_std(), and don't expect commits to have been made during fixture initialisation (init makes two commits with a tag).
Raising this as a very low priority tracker - it should be possible to speed up the tests by removing the explicit create_commits() calls, or (my preference) dropping the fixture initialisation commit calls.

Honor submodules=disable as before

Please honour disabled submodules directive as they were in the Bash version of the code. Making that directive a no-op with a rewrite is just wrong.

need to determine support / test matrices

We need to be clearer about which OS+Python+SCM stacks we support. Any supported stack should have CI, but additionally we should have CI for stacks which we want to add support in the future, e.g. Python 3.5. /cc @adrianschroeter @M0ses

Python versions

Currently Travis tests against Python 2.6 and 2.7 only. We need to start testing against Python 3.x, which requires deciding exactly which 3.x versions to support, and also ideally we could drop Python 2.6 which is ancient.

Distributions

Currently OBS tries to build obs-service-tar_scm against a huge number of distros, but not all of them succeed. Which ones do we need to work?

SCMs

Does anyone actually use tar_scm with bzr?

Rebase git repo history on Adam's older tar_scm git repo

I have a git repo dating back to early 2012 when I was working on the tar_scm test suite. I need to publish this so that we can rebase the current series of commits on top of it. Sorry for not mentioning this before this repo was created.

changesgenerate rewrites a previous entry in default run mode

Changes generate doesn't use _service:blah.changes as a reference file, instead it looks for $name.spec, in case changesgenerate is set to enable $name.spec is not needed (not updated usually), hence we have here as a result:
contents of $name.changes + generated.changes for current run

Avoid repackaging if requested

As in title.

TL;DR: An option to avoid tar repackaging would be nice.

The long story
In some PKGBUILDs (Arch Linux build description file), SCM sources get downloaded without repackaging, as the build system (makepkg) take care of download and else.

For download, OBS doesn't allow download during build time, and that's fine (we can just use a source service like this ๐Ÿ˜œ), but the problem is that almost every service repackage the sources, at least in tar format.
This last thing is not good for Arch standards, as for SCM makepkg expects to download sources in a folder and create a clean source folder from it.

Having SCM sources repackaged requires packagers to change PKGBUILDs in order to track them.
This isn't a big fuss, however it breaks the usual build style of Arch packages.

A possible implementation would be to add a value in the service file for checking if repackaging is needed, in order to avoid it in case.
Default can be setted as true, to keep actual build consistent.

Travis CI runs for Python 2.6 actually test against 2.7

As noted in #63, the Python 2.6 Travis build is actually using /opt/python/2.7.9/bin/python2.7 by mistake, due to #73. Proposed solution: tweak GNUmakefile so that it uses the default python in $PATH unless that points at a Python 3.x interpreter - if it does, it should fall back on the $(call first_in_path,$(PYTHONS)) approach.

allow user name for svn repos

I'm successfully using this service to retrieve sources via svn+ssh:// URL.
Right now I had to access a svn repo via https://. Unfortunately it seems impossible to get svn acknowleding somthing like https://[email protected]/repo.

Thus I extended the service to accept a username parameter. It relies on subversion's (cleartext) password caching mechanism, thus you need to access the svn repo once interactively as user root. (In case you are worried about clear text caching: This goes along the lines of using svn+ssh with unprotected private key for readonly user).

I was successful with the attached diff

I would be happy to document this feature (where?) if it get's integrated into this service.

BTW: one could add a passwordparameter as well. This would remove the need for root access on the obs instance. If this is a read only account it shouldn't be a big deal either, since possible contents of the repo are available in the expanded source tar file as well.

extract generic SCM test code into a separate framework

A lot of the test code is to do with setting up an environment for testing SCM-related things. This requires setting up fixtures, i.e. real git / svn / bzr / hg repositories, with real commits. It strikes me that this code could be reused by any project which needs repositories as fixtures (including some of my own projects). So it would probably make sense to extract this code into a separate SCM testing framework, provided as a Python module for easy reuse.

split scm test framework into separate Python module

The test suite has a lot of framework-like code which allows creation of fixture repos for the various SCMs and subsequent testing of those repos. This should be reusable by any Python project which operates on SCM repos. Splitting this code out into a separate module would not only benefit other projects, but also reduce the complexity of the tar_scm test suite, since only the bits specific to tar_scm would remain, and they would use the API of the new generic SCM testing module.

How to define these kinds of version format in openSUSE Build Service

Hello, everyone! ๐Ÿ˜ƒ

I am trying openSUSE Build Service recently, and encounter some problems in packaging for Arch Linux. How to write the file _service to define these kinds of version format in OBS:

  • First one๏ผš

The source file is a Git repo, and the $pkgver(the version string of the package) is defined as the output of

git describe --always | sed 's|-|.|g'

The example is goldendict-git , refer to https://aur.archlinux.org/packages/go/goldendict-git/PKGBUILD

The current $pkgver is 1.5.0.RC.436.g450130c

I don't know how to write the file _service to auto fill the $pkgver so that OBS can update the $pkgver automatically by executing osc service rr.

This is what I'm writing:

 <services>
    <service name="tar_scm">
      <param name="scm">git</param>
      <param name="url">git://github.com/goldendict/goldendict.git</param>
      <param name="versionformat">g%h</param>
      <param name="versionprefix">1.5.0.RC.436</param>
      <param name="filename">goldendict</param>
    </service>
    <service name="recompress">
      <param name="file">*.tar</param>
      <param name="compression">gz</param>
    </service>
    <service name="set_version"/>
  </services>

  • Second one๏ผš

The source file is a Git repo, and the $pkgver is defined as the output of

printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"

The example is oh-my-zsh-git, refer to https://aur.archlinux.org/packages/oh/oh-my-zsh-git/PKGBUILD

The current $pkgver is 2774.96e4e5d

I don't know how to write the file _service to auto fill the $pkgver so that OBS can update the $pkgver automatically by executing osc service rr.

This is what I'm writing:

<services>
  <service name="tar_scm">
    <param name="scm">git</param>
    <param name="url">git://github.com/robbyrussell/oh-my-zsh.git</param>
    <param name="versionformat">%h</param>
    <param name="versionprefix">2774</param>
    <param name="filename">oh-my-zsh</param>
  </service>
  <service name="recompress">
    <param name="file">*.tar</param>
    <param name="compression">gz</param>
  </service>
  <service name="set_version"/>
</services>

After searching for the Issues, I found that @matwey has opened a pull request #26 about adding @REVISION@(or @TAG_OFFSET@ in an appropriate way) to versionformat. I think it's approach to my requirement. Maybe this issue would be a feature request which requests for something like @TAG_OFFSET@.

Assuming that @TAG_OFFSET@ has been implemented, the first one could be

<param name="versionformat">@PARENT_TAG@.@[email protected]%h</param>

and the second one could be

<param name="versionformat">@TAG_OFFSET@.%h</param>

Any help is appreciated!

Yours sincerely ๐Ÿ™‡

Reference:

Crashes on run with a traceback indicating $HOME doesn't exist (OBS 2.7)

On my private OBS instances, I've been attempting to use the tar_scm source service, only for it to fail with the following error: Files could not be expanded: KeyError: 'HOME'.

A little bit of digging led to the following recorded traceback:


service tar_scm failed:
Traceback (most recent call last):
  File "/usr/lib/obs/service//tar_scm", line 19, in <module>
    import TarSCM
  File "/usr/lib/obs/service/TarSCM/__init__.py", line 4, in <module>
    from TarSCM.tasks      import tasks
  File "/usr/lib/obs/service/TarSCM/tasks.py", line 10, in <module>
    import TarSCM.scm
  File "/usr/lib/obs/service/TarSCM/scm/__init__.py", line 1, in <module>
    from TarSCM.scm.git import git
  File "/usr/lib/obs/service/TarSCM/scm/git.py", line 5, in <module>
    from TarSCM.scm.base import scm
  File "/usr/lib/obs/service/TarSCM/scm/base.py", line 16, in <module>
    from TarSCM.changes import changes
  File "/usr/lib/obs/service/TarSCM/changes.py", line 11, in <module>
    from TarSCM.config import config
  File "/usr/lib/obs/service/TarSCM/config.py", line 20, in <module>
    class config():
  File "/usr/lib/obs/service/TarSCM/config.py", line 25, in config
    os.path.join(os.environ['HOME'],'.obs','tar_scm')
  File "/usr/lib64/python2.7/UserDict.py", line 40, in __getitem__
    raise KeyError(key)
KeyError: 'HOME'

On my OBS appliances, I have the following version of the service:

build:~ # rpm -qa | grep tar_scm
obs-service-tar_scm-0.7.0.1477567374.d44d677-138.1.noarch

Let the service figure out the version from the tag

If I specify versionformat=@PARENT_TAG@, I get a prettty looking tarball with the right version in the name, but for some reason that same version doesn't get used in the .spec file and I even see this error:

ERROR: no version is given and can't get detected automatically

It would be cool to have a way to tell the service to just use the git tag that I already specified in

Next release?

Just a short question: When are you planning the next release? It is some time ago when the previous release has been released.

Best
Christian

Not a git repository test failure

Test failure using Ubuntu 12.04 and git version 1.7.9.5

>>>>>>>>>>>
Running bash /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/../tar_scm '--url' 'file:///home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/repo' '--scm' 'git' '--submodules' 'enable' '--outdir' '/home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/out' 2>&1

--v-v-- begin STDOUT from tar_scm --v-v--
no revision specified; defaulting to master
check local cache if configured
cache miss: /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/cache/repo/9a3129702c3d24d10112eb0faf8a727fd2ea849387b84f4c9a1c19d8c7b110c5/.git
mktemp -u -d tmp.XXXXXXXXXX
new git checkout to tmp.MeMBR7OwBC
Fetching from file:///home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/repo ...
Cloning into 'tmp.MeMBR7OwBC'...
Submodule 'submod1' (file:///home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/submodules/submod1) registered for path 'submod1'
Cloning into 'submod1'...
Submodule path 'submod1': checked out '378a223f61dc89ce00e25e10ce4a58a30713e560'
mv #1: tmp.MeMBR7OwBC -> /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/cache/repo/9a3129702c3d24d10112eb0faf8a727fd2ea849387b84f4c9a1c19d8c7b110c5
Cached file:///home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/repo at /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/cache/repo/9a3129702c3d24d10112eb0faf8a727fd2ea849387b84f4c9a1c19d8c7b110c5
fatal: Not a git repository: /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/cache/incoming/tmp.MeMBR7OwBC/.git/modules/submod1
ERROR: git checkout -b tar_scm_tmp failed; aborting!
--^-^-- end   STDOUT from tar_scm --^-^--

----------------------------------------------------------------------
Ran 98 tests in 250.811s

FAILED (failures=1)
Left temporary files in /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp

The initialisation needs to wipe the tmp directory after a failure in a previous run. Running the tests a 2nd time after the above failure goes wrong even after using 'git clean' before hand:

william@tiger:~/obs-service-tar_scm/obs-service-tar_scm$ git clean -f
william@tiger:~/obs-service-tar_scm/obs-service-tar_scm$ time python tests/test.py 
......................................E
Stdout:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
test_submodule_update
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

--v-v-- begin setUp for submodule_update --v-v--
GitFixtures: setting up fixtures
created repo /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/repo
Creating 2 commits ...
cwd is /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/repo
Wrote 1 to a
Wrote 1 to subdir/b
cwd is /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/repo
Wrote 2 to a
Wrote 2 to subdir/b
Recorded rev 2: id tag2, timestamp 1392375414, SHA1 c994e04 in /home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/repo
Created 2 commits; now at 2
Starting submodule_update test
--^-^-- end   setUp for submodule_update --^-^--

--v-v-- begin tearDown for submodule_update --v-v--
--^-^-- end   tearDown for submodule_update --^-^--

...........................................................
======================================================================
ERROR: test_submodule_update (gittests.GitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/william/obs-service-tar_scm/obs-service-tar_scm/tests/gittests.py", line 63, in test_submodule_update
    fix.create_submodule(submod_name)
  File "/home/william/obs-service-tar_scm/obs-service-tar_scm/tests/gitfixtures.py", line 62, in create_submodule
    self.create_repo(path)
  File "/home/william/obs-service-tar_scm/obs-service-tar_scm/tests/gitfixtures.py", line 26, in create_repo
    os.makedirs(repo_path)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/home/william/obs-service-tar_scm/obs-service-tar_scm/tests/tmp/git/submodule_update/submodules/submod1'

slow tests should be skippable

Even if we do #146 there are bound to be some tests which are unavoidably slow. For example svn has terrible performance :-) So we need a mechanism for skipping the slow tests. This should be a simple matter of writing a decorator to skip slow tests. (BTW we use unittest2 so that newer features are available on 2.6.)

v-prefixed tags in git

Hello,

I am sorry if this already has been discussed, or I missed something.
Some developers are used v-prefixed tags for versions, for instance v0.4.5, when @PARENT_TAG@ is used, tar_scm creates an archive like the following repo-v0.4.5.tar.gz.
Which is incompatible with set_version which thinks that the version is v0.4.5 and writes:

Version: v0.4.5

to the spec file.

strange tagging in git results in unusable version

When you do strange things like lightweight-tagging an annotated tag object, you get output from git describe like so:

$ git describe --tags --abbrev=0
warning: tag '1.0.0' is really 'v1.0.0' here
1.0.0

tar_scm currently just takes this whole output, including the newline, as the parent tag, which is suboptimal.

The warning is printed to stderr, so it would seem to be better not to use stderr=STDOUT in the subprocess call. Alternatively, error out in these cases.

ANSI escape colors do not work in OBS

Some of the error messages that tar_sm prints out use ANSI escaping to colorize text:

\e[0;31mThe git repository has no tags, thus @PARENT_TAG@ can not be expanded\e[0m

Those ANSI escapes do not work when the error is shown in OBS and they are just printed out with the rest of the message. They will just make the error output look less readable.

PARENT_TAG code fails when repo contains no tags

Commit 7c0cc6d falls into the classic shell-coding trap of assuming that an external command succeeds when it is not guaranteed to. In the case there are no tags in the repo, tar_scm will (almost silently) fail, with this warning buried in the output as the only clue that something went wrong:

fatal: No names found, cannot describe anything

Support GPG signature verification

git commits and tags can be be GPG signed using the -S and -s parameters respectively. Verification can be performed using git verify-commit/verify-tag.

tar_scm should provide the ability to verify commit/tag GPG signatures against a public key stored in the project repository.

need better linting

Currently we only have PEP8. flake8 finds other issues, and pylint is even more comprehensive. I've started a linting branch to harness these. The "only" work remaining is to fix all the pylint issues, but there are loads of them.

Help needed with Travis -- adding http proxy support

could someone help me here? I'm getting these on Travis:

--v-v-- begin STDERR from tar_scm --v-v--
REPOCACHE: /home/travis/build/openSUSE/obs-service-tar_scm/tests/tmp/svn/changesgenerate_corrupt_servicedata/cache
HASH: b3df65c63f2798521380b3cffa60121af932a7884fe338d9a1f35419d2c3e5ce
using /tmp/tmpndADGe
Traceback (most recent call last):
  File "/home/travis/build/openSUSE/obs-service-tar_scm/tests/../tar_scm.py", line 1489, in <module>
    main()
  File "/home/travis/build/openSUSE/obs-service-tar_scm/tests/../tar_scm.py", line 1367, in main
    singletask(use_obs_scm, args)
  File "/home/travis/build/openSUSE/obs-service-tar_scm/tests/../tar_scm.py", line 1398, in singletask
    define_global_scm_command(args.scm)
  File "/home/travis/build/openSUSE/obs-service-tar_scm/tests/../tar_scm.py", line 138, in define_global_scm_command
    re.M | re.I)
  File "/home/travis/virtualenv/python2.6.9/lib/python2.6/re.py", line 137, in match
    return _compile(pattern, flags).match(string)
TypeError: expected string or buffer
Cleaning: /tmp/tmpndADGe
--^-^-- end   STDERR from tar_scm --^-^--

... but these do not occur when I run "make check" locally. What am I doing wrong? It appears to be having trouble understanding a line continuation.

I also may need assistance with some of the unit tests, as the expected command line WILL change depending on whether the http proxy is defined or not.

Does not work with OBS 2.6.1

The .service file uses <param> elements, but OBS expects to find <parameter> elements. Added .service file check in OBS 2.6.1 results in an error when running _service.

How to use tar_scm to just checkout github releases

After studying the issues here and all other available information, that I could get one source services, I'm still not able to find a decent example of how to just do releases. #55 and #60 are pointing in the right direction, but still do not offer a solution for my (simple!) case.

Sure, that this needs a combination of certain source services, but this module is closest to what I'm after. Do you have an example at hand, where @PARENT_TAG@ (I guess) is used, the common leading 'v' is stripped, and a decent changelog entry is done?

TIA, Pete

How to handle this problem.

Hi all,
I use osc service run to download my project from github and to tar & compress it.

But what I got are a wrong named tar file and some error message.

The wrong named tar file is: _service:tar_scm:ocfs2-test-1.0.4+git.1425366927.4243065.tar.
Obviously, if the tar file's name has not the prefix of "_service:tar_scm", everything is OK.

I don't know why I got this strange tar file name.Please give some advice.

The error message is:

n2:~/home:ZRen:branches:network:ha-clustering:Factory/ocfs2-test # osc service run 
Cloning into '/tmp/tmp__uzs5/tmpW2q6lt/ocfs2-test'...
HEAD is now at 4243065 Bring README back text format
Cleaning: /tmp/tmp__uzs5/tmpW2q6lt /tmp/tmp__uzs5/ocfs2-test-1.0.4+git.1425366927.4243065
ls: cannot access ocfs2-test*.tar: No such file or directory
ls: cannot access _service:*:ocfs2-test*.tar: No such file or directory
Unknown file ocfs2-test*.tar
Aborting: service call failed: /usr/lib/obs/service/recompress --file 'ocfs2-test*.tar' --compression 'bz2' --outdir /tmp/tmpVzmTUc

And my "_service" file is:

<services>
  <service name="tar_scm" mode="enabled">
    <param name="url">https://github.com/ganghe/ocfs2-test</param>
    <param name="scm">git</param>
    <param name="exclude">.git</param>
    <param name="versionformat">1.0.4+git.%ct.%h</param>
    <param name="revision">suse</param>
  </service>

  <service name="recompress" mode="enabled">
    <param name="file">ocfs2-test*.tar</param>
    <param name="compression">bz2</param>
  </service>

  <service name="set_version" mode="enabled">
    <param name="basename">ocfs2-test</param>
  </service>

Parent tag regex format issue

Is there any reason why when i want to use @PARENT_TAG@ it is required to have a dot after it? This enforcement prevents me from building a version string that have the tag followed by anything else, for example underscore _.

Would it be possible to remove this limitation and only do a replacement on the @PARENT_TAG@ ?

For example if i specify the following in versionformat

<param name="versionformat">@PARENT_TAG@_%ct.%h</param>`

it will render to the following

Version:        1400180477.8d48089

But

<param name="versionformat">@PARENT_TAG@.%ct.%h</param>`

it will render to the

Version:        1.2.3.1400180477.8d48089

subdir / tries to tar the whole root directory

<services>
    <service name="tar_scm">
        <param name="scm">git</param>
        <param name="subdir">/</param>
        <param name="url">git://github.com/$OWNER/$REPO</param>
        <param name="filename">$FILENAME</param>
        <param name="versionprefix">0.git</param>
        <param name="revision">$REVISION</param>
    </service>
    <service name="recompress">
        <param name="file">*.tar</param>
        <param name="compression">gz</param>
    </service>
    <service name="set_version" />
</services>

The above _service file tries to tar the whole / instead of just the cloned directory. This used to work sometime in the past. The workaround is to drop completely the subdir param

changesgenerate should honour subdir

If the subdir parameter didn't change since the last tar_scm run, then changesgenerate should only list changes affecting the subtree specified by the subdir parameter.

Issues running obs_scm service.

I'm guessing its likely I did something wrong here but in case this is a bug

Issue 1:

simon@tek-master ~/src/obs/openSUSE/X11:Enlightenment:Nightly/efl โžค osc service run obs_scm
Please specify valid --scm=... options

Aborting: service call failed: /usr/lib/obs/service/obs_scm --outdir /home/simon/src/obs/openSUSE/X11:Enlightenment:Nightly/efl/tmpfFw2_L.obs_scm.service
simon@tek-master ~/src/obs/openSUSE/X11:Enlightenment:Nightly/efl โžค

Issue 2:

simon@tek-master ~/src/obs/openSUSE/X11:Enlightenment:Nightly/efl โžค

/usr/lib/obs/service/obs_scm --outdir /home/simon/src/obs/openSUSE/X11:Enlightenment:Nightly/efl/tmpfFw2_L.obs_scm.service --scm=git

Traceback (most recent call last):
File "/usr/lib/obs/service/obs_scm", line 28, in
main()
File "/usr/lib/obs/service/obs_scm", line 25, in main
TarSCM.run()
File "/usr/lib/obs/service/TarSCM/init.py", line 30, in run
task_list.process_list()
File "/usr/lib/obs/service/TarSCM/tasks.py", line 75, in process_list
self._process_single_task(task)
File "/usr/lib/obs/service/TarSCM/tasks.py", line 108, in _process_single_task
scm_object.fetch_upstream()
File "/usr/lib/obs/service/TarSCM/scm/base.py", line 61, in fetch_upstream
self._calc_dir_to_clone_to(clone_prefix)
File "/usr/lib/obs/service/TarSCM/scm/base.py", line 163, in _calc_dir_to_clone_to
url_path = urllib.parse.urlparse(self.url)[2].rstrip('/')
NameError: global name 'urllib' is not defined
`

This is on tumbleweed and Leap 42.2 with everything installed from the openSUSE:Tools repo.

simon@tek-master ~ โžค rpm -qi obs-service-tar_scm
Name : obs-service-tar_scm
Version : 0.7.0.1484082405.7671be8
Release : 148.1
Architecture: noarch
Install Date: Tue 14 Mar 2017 11:22:42 AM ACDT
Group : Development/Tools/Building
Size : 135509
License : GPL-2.0+
Signature : DSA/SHA1, Wed 01 Mar 2017 02:18:38 AM ACDT, Key ID 85753aa5eefefde9
Source RPM : obs-service-tar_scm-0.7.0.1484082405.7671be8-148.1.src.rpm
Build Date : Wed 01 Mar 2017 02:18:33 AM ACDT
Build Host : build84
Relocations : (not relocatable)
Vendor : obs://build.opensuse.org/openSUSE:Tools
URL : https://github.com/openSUSE/obs-service-tar_scm
Summary : An OBS source service: checkout or update a tar ball from svn/git/hg
Description :
This is a source service for openSUSE Build Service.

It supports downloading from svn, git, hg and bzr repositories.
Distribution: openSUSE:Tools / openSUSE_42.2

Service file can be found here https://build.opensuse.org/package/view_file/X11:Enlightenment:Nightly/efl/_service?expand=1

need way to transform things like @PARENT_TAG@

some projects have tags which result in things like from git describe --tags:

v8.4.0.rc1-9121-gcfd5870
release-2.1.0-1186-g507ed2d

it would be nice to be able to transform the result of versionformat.

<services>
  <service name="obs_scm">
    <param name="url">https://gitlab.com/gitlab-org/gitlab-ce.git</param>
    <param name="versionformat">@PARENT_TAG@~git@TAG_OFFSET@.%h</param>
    <param name="revision">master</param>
    <param name="scm">git</param>
    <param name="changesgenerate">enable</param>
  </service>
[snip]
</services>

could be handled with something like

    <param name="versionformat" match='v(.*)' replace='$1'>@PARENT_TAG@~git@TAG_OFFSET@.%h</param>
    <param name="versionformat" match='release-(.*)' replace='$1'>@PARENT_TAG@~git@TAG_OFFSET@.%h</param>

i know executing user provided regexp can be dangerous, so i am open to better solutions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.