Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update version in Debtransform lines. #29

Closed
hurricanehrndz opened this issue Feb 6, 2016 · 3 comments · Fixed by #88
Closed

Update version in Debtransform lines. #29

hurricanehrndz opened this issue Feb 6, 2016 · 3 comments · Fixed by #88

Comments

@hurricanehrndz
Copy link

_replace_tag function only Updates the Version tag line (i.e. Version:)

set_version service should update the version numbers in debtransfrom-tar lines.

For example:

Debtransform-Tar: package-%version.tar.gz  
Debtransform-Tar: package-$version.tar.gz 

Should have %version or $version updated to the actual version from any previous services.

@hurricanehrndz hurricanehrndz changed the title For debian packaging Update version in Debtransform lines. Feb 6, 2016
@hurricanehrndz
Copy link
Author

nm, issue is with recompress service.

@noscript
Copy link

DEBTRANSFORM-TAR is pretty much useless when used together with tar_scm, as the resulting tarball is always going to have some part of the filename set dynamically, which is actually important for set_version to work.

Being able to access version information DEBTRANSFORM-TAR is a must-have.

@jjacque
Copy link

jjacque commented Nov 5, 2019

Hi, i guess DEBTRANSFORM-TAR is not useless when your sources contain multiple archives (ie vendor.tar.gz generated by obs-service-go_modules).
I did a patch to be able to use:
Debtransform-Tar: archive-prefix-${Version}.tar.gz and have it modified by set_version.
Here it is, even if i confess it's a pretty naive implem.

diff -ru a/set_version b/set_version
--- a/set_version	2019-11-03 22:54:25.000000000 +0100
+++ b/set_version	2019-11-05 22:49:16.813779064 +0100
@@ -281,6 +281,24 @@
             f.write(contents_new)
 
 
+def _replace_dsc_debtransform(filename, string):
+    with codecs.open(filename, 'r+', 'utf8') as f:
+        contents = f.read()
+        f.seek(0)
+        tag = 'Debtransform-Tar'
+        contents_new, subs = re.subn(
+            r'^{tag}:([ \t\f\v]*)([-\w\.]*)\${{Version}}([-\w\.]*)'.format(
+                tag=tag),
+            r'{tag}:\g<1>\g<2>{string}\g<3>'.format(
+                tag=tag, string=string),
+            contents, flags=re.MULTILINE)
+        if DEBUG:
+            print("dsc debtransform updated: ", contents_new)
+        if subs > 0:
+            f.truncate()
+            f.write(contents_new)
+
+
 def _replace_debian_changelog_version(fname, version_new):
     # first, modify a copy of filename and then move it
     # get current version
@@ -405,6 +423,7 @@
             _replace_tag(filename, 'Version', version + "-0")
         else:
             _replace_tag(filename, 'Version', version)
+            _replace_dsc_debtransform(filename, version)
 
     for f in filter(lambda x: x.endswith(("debian.changelog")), files):
         filename = outdir + "/" + f

gleichdick added a commit to gleichdick/obs-service-set_version that referenced this issue Jan 6, 2024
`@VERSION@` will be replaced with the actual version in .dsc files.
This is useful to specify source archives as `DEBTRANSFORM-TAR` which
are generated by obs-scm service.

Fixes openSUSE#29.
gleichdick added a commit to gleichdick/obs-service-set_version that referenced this issue Jan 6, 2024
`@VERSION@` will be replaced with the actual version in .dsc files.
This is useful to specify source archives as `DEBTRANSFORM-TAR` which
are generated by obs-scm service.
In addition, `@VERSION-RELEASE@` will expand to the version with the
release ("-0") appended for non-native debian packages.

Fixes openSUSE#29.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants