[Pkg-libvirt-commits] [Git][libvirt-team/osinfo-db][debian/sid] 2 commits: Add helper script to create upstream tarballs

Guido Günther gitlab at salsa.debian.org
Fri Oct 16 08:51:07 BST 2020



Guido Günther pushed to branch debian/sid at Libvirt Packaging Team / osinfo-db


Commits:
bf293919 by Pino Toscano at 2020-09-27T08:55:00+02:00
Add helper script to create upstream tarballs

Since we cannot use the upstream tarballs (see [1]), add a simple
Python script to clone the upstream repository and create a tarball
based on the last tag in it. The approach is based on what
Guido Günther described in [2].

Following the upstream tag is preferred, as we can package exactly what
upstream considered as "release", instead of a snapshot at a random
time.

Cloning the upstream repository every time seems wasteful, however:
- its size is only few MB (less than 5 ATM)
- we are sure to use the unmodified sources, with no potentially
  conflicting tags from an existing local clone

Document this limitation and the new script in README.source.

[1] https://gitlab.com/libosinfo/osinfo-db/-/issues/50
[2] https://salsa.debian.org/libvirt-team/osinfo-db/-/merge_requests/4#note_139324

Gbp-Dch: Short

- - - - -
acbefe22 by Guido Günther at 2020-10-16T07:50:56+00:00
Merge branch 'get-orig-source' into 'debian/sid'

Add helper script to create upstream tarballs

See merge request libvirt-team/osinfo-db!7
- - - - -


3 changed files:

- debian/README.source
- debian/copyright
- + debian/get-orig-source.py


Changes:

=====================================
debian/README.source
=====================================
@@ -26,4 +26,10 @@ git-pbuilder(1) manpage. In short:
     cd os-info-db-tools
     gbp buildpackage --git-pbuilder
 
+The upstream tarballs are not used, since they do not contain all the sources
+(reported as upstream bug https://gitlab.com/libosinfo/osinfo-db/-/issues/50).
+Hence, to generate an upstream tarball you need to use the provided
+debian/get-orig-source.py script, which will create one from the upstream git
+repository at the latest tag available.
+
  -- Guido Günther <agx at sigxcpu.org>, Wed,  2 Dec 2015 18:51:15 +0100


=====================================
debian/copyright
=====================================
@@ -8,6 +8,7 @@ License: GPL-2+
 
 Files: debian/*
 Copyright: 2016 Guido Günther <agx at sigxcpu.org>
+           2020 Pino Toscano <pino at debian.org>
 License: GPL-2+
 
 License: GPL-2+


=====================================
debian/get-orig-source.py
=====================================
@@ -0,0 +1,34 @@
+#!/usr/bin/env python3
+
+# SPDX-FileCopyrightText: 2020 Pino Toscano <pino at debian.org>
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+import subprocess
+import tempfile
+import xml.etree.ElementTree as ET
+
+import git
+
+OSINFO_DB_REPO = 'https://gitlab.com/libosinfo/osinfo-db.git'
+
+scriptdir = os.path.dirname(os.path.realpath(__file__))
+uscan_args = ['uscan', '--dehs', '--skip-signature',
+              '--watchfile', os.path.join(scriptdir, 'watch')]
+uscan_proc = subprocess.run(uscan_args, stdout=subprocess.PIPE,
+                            stderr=subprocess.DEVNULL)
+uscan_xml = uscan_proc.stdout.decode('utf-8')
+root = ET.fromstring(uscan_xml)
+upstream_version = root.find('upstream-version').text
+print('Downloading version {} ...'.format(upstream_version))
+
+with tempfile.TemporaryDirectory() as tmpdir:
+    repo = git.Repo.clone_from(OSINFO_DB_REPO, os.path.join(tmpdir, 'git'))
+    tmparchive = os.path.join(tmpdir, 'archive.tar')
+    with open(tmparchive, 'wb') as tmpfile:
+        repo.archive(tmpfile, treeish='v{}'.format(upstream_version),
+                     prefix='osinfo-db-{}/'.format(upstream_version))
+    outarchive = 'osinfo-db_0.{}.orig.tar.xz'.format(upstream_version)
+    with open(tmparchive, 'r') as tmpfile, open(outarchive, 'w') as outfile:
+        subprocess.run(['xz', '-c'], stdin=tmpfile, stdout=outfile)
+    print('Written {}'.format(outarchive))



View it on GitLab: https://salsa.debian.org/libvirt-team/osinfo-db/-/compare/cb18080e10f8a1ae91358f2ea8887df109dc220b...acbefe22b5e9e5bc47054923e5a76bf2084fc33b

-- 
View it on GitLab: https://salsa.debian.org/libvirt-team/osinfo-db/-/compare/cb18080e10f8a1ae91358f2ea8887df109dc220b...acbefe22b5e9e5bc47054923e5a76bf2084fc33b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-libvirt-commits/attachments/20201016/e470c7e2/attachment-0001.html>


More information about the Pkg-libvirt-commits mailing list