Commit 3663fa82 authored by Jakub Ružička's avatar Jakub Ružička
Browse files

make-dev-archive: mimic gitlab releases

GitLab is using $NAME-$TAG.tar.gz archive names which includes "v"
prefix in archive name, for example:

    apkg-v0.0.4.tar.gz

Change scripts/make-dev-archive.sh to:

* include "v" prefix in archive name
* use internal apkg version generated by miniver (nicer `git describe`)
* create archive using `git archive` - include all source files

Adapt packaging accordingly.
parent 69b185c6
Pipeline #81630 passed with stage
in 6 minutes and 16 seconds
......@@ -6,6 +6,6 @@ make_archive_script = "scripts/make-dev-archive.sh"
[upstream]
# needed for get-archive
archive_url = "https://gitlab.nic.cz/packaging/{{ project.name }}/-/archive/v{{ version }}/{{ project.name }}-{{ version }}.tar.gz"
archive_url = "https://gitlab.nic.cz/packaging/apkg/-/archive/v{{ version }}/apkg-v{{ version }}.tar.gz"
# script to check latest upstream version
version_script = "scripts/upstream-version.py"
......@@ -12,13 +12,11 @@ depends=('python-docopt'
'python-toml'
'python-blessings')
#checkdepends=('python-pytest')
source=("${pkgname}-${pkgver}.tar.gz")
source=("${pkgname}-v${pkgver}.tar.gz")
sha256sums=('SKIP')
export PBR_VERSION=$pkgver
build() {
cd apkg-$pkgver
cd apkg-v$pkgver
python setup.py build
}
......@@ -28,6 +26,6 @@ build() {
#}
package() {
cd apkg-$pkgver
cd apkg-v$pkgver
python setup.py install --root="$pkgdir" --optimize=1
}
......@@ -5,7 +5,7 @@ Summary: cross-distro packaging automation tool
License: GPL 3.0
URL: https://gitlab.nic.cz/packaging/apkg
Source0: %{name}-%{version}.tar.gz
Source0: %{name}-v%{version}.tar.gz
BuildArch: noarch
......@@ -45,10 +45,7 @@ This package contains apkg module for Python 3.
%prep
%autosetup -n %{name}-%{version} -S git
# We handle requirements ourselves, pkg_resources only bring pain
rm -rf requirements.txt test-requirements.txt
%autosetup -n %{name}-v%{version} -S git
%build
%py3_build
......
#!/bin/bash
#
# Create apkg archive and print path to it.
# create archive from current source using git
set -e
DISTDIR=dist
VERSION=$(python3 -m apkg --version)
if [ -z "$VERSION" ]; then
echo "failed to retrieve current apkg version :("
exit 1
fi
NAMEVER=apkg-v$VERSION
ARCHIVE=$NAMEVER.tar.gz
rm -rf "$DISTDIR"
python3 -m build --sdist
ls dist/apkg-*.tar.gz
git archive --format tgz --output $ARCHIVE --prefix $NAMEVER/ HEAD
# apkg expects stdout to list archive files
echo $ARCHIVE
......@@ -76,12 +76,12 @@ def test_apkg_make_archive_cache(repo_path, caplog):
def test_apkg_get_archive_manual(repo_path, capsys):
VERSION = '0.0.2'
VERSION = '0.0.4'
with cd(repo_path):
assert apkg('get-archive', '--version', VERSION) == 0
out, _ = capsys.readouterr()
# first stdout line should be downloaded archive
assert out.startswith("pkg/archives/upstream/apkg-%s.tar.gz" % VERSION)
assert out.startswith("pkg/archives/upstream/apkg-v%s.tar.gz" % VERSION)
def test_apkg_get_archive_auto(repo_path, capsys):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment