#402 Allow automated spec file updates
Merged 3 years ago by lholecek. Opened 3 years ago by lholecek.
lholecek/waiverdb remove-version-var-from-spec  into  master

Allow automated spec file updates
Lukas Holecek • 3 years ago  
file modified
+1 -1
@@ -27,9 +27,9 @@ 

  if [ -n "$WAIVERDB_RPM_RELEASE" ] ; then

      # need to hack the version in the spec

      sed --regexp-extended --in-place \

-         -e "/%global upstream_version /c\%global upstream_version ${WAIVERDB_VERSION}" \

          -e "/^Version:/cVersion: ${WAIVERDB_RPM_VERSION}" \

          -e "/^Release:/cRelease: ${WAIVERDB_RPM_RELEASE}%{?dist}" \

+         -e "/^Source0:/cSource0: waiverdb-${WAIVERDB_RPM_VERSION}.${WAIVERDB_RPM_RELEASE}.tar.gz" \

          "$workdir/${name}.spec"

      # also hack the Python module version

      sed --regexp-extended --in-place \

file modified
-1
@@ -18,7 +18,6 @@ 

      exit 1

  fi

  

- sed -i -e "/%global upstream_version /c\%global upstream_version ${version}${prerelease}" waiverdb.spec

  sed -i -e "/^Version:/c\Version:        $version" waiverdb.spec

  if [ -n "$prerelease" ] ; then

      sed -i -e "/^Release:/c\Release:        0.$prerelease%{?dist}" waiverdb.spec

file modified
+6 -4
@@ -6,15 +6,18 @@ 

  

  name=waiverdb

  if [ "$(git tag | wc -l)" -eq 0 ] ; then

-     # never been tagged since the project is just starting out

-     lastversion="0.0"

+     # if this is a shallow git clone, get the latest version from spec file

+     lastversion="$(sed -n '/^Version:/{s/.*:\s*//;p;q}' waiverdb.spec)"

      revbase=""

+     commitcount=99

Why it's 99? :D

  else

      lasttag="$(git describe --tags --abbrev=0 HEAD)"

      lastversion="${lasttag##${name}-}"

      revbase="^$lasttag"

+     commitcount=$(git rev-list "$revbase" HEAD | wc -l)

  fi

- if [ "$(git rev-list $revbase HEAD | wc -l)" -eq 0 ] ; then

+ 

+ if [ "$(git rev-list "$revbase" HEAD | wc -l)" -eq 0 ] ; then

      # building a tag

      rpmver=""

      rpmrel=""
@@ -25,7 +28,6 @@ 

      version="${version%%[a-z]*}" # strip non-numeric suffixes like "rc1"

      # increment the last portion of the version

      version="${version%.*}.$((${version##*.} + 1))"

-     commitcount=$(git rev-list $revbase HEAD | wc -l)

      commitsha=$(git rev-parse --short HEAD)

      rpmver="${version}"

      rpmrel="0.git.${commitcount}.${commitsha}"

file modified
+2 -4
@@ -1,5 +1,3 @@ 

- %global upstream_version 1.2.0

- 

  %if 0%{?fedora} || 0%{?rhel} > 7

  %bcond_without server

  %else
@@ -14,7 +12,7 @@ 

  Summary:        Service for waiving results in ResultsDB

  License:        GPLv2+

  URL:            https://pagure.io/waiverdb

- Source0:        https://files.pythonhosted.org/packages/source/w/%{name}/%{name}-%{upstream_version}.tar.gz

+ Source0:        https://files.pythonhosted.org/packages/source/w/%{name}/%{name}-%{version}.tar.gz

  

  BuildArch:      noarch

  BuildRequires:  make
@@ -101,7 +99,7 @@ 

  Primarily, submitting new waiverdbs.

  

  %prep

- %setup -q -n %{name}-%{upstream_version}

+ %setup -q -n %{name}-%{version}

  

  # We guard against version flask-restful=0.3.6 in requirements.txt,

  # but the version in Fedora is patched to work.

With the extra variable specifying version in the spec file, it cannot
be automatically bumped to a newer version.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1811719#c8

Build 950dfc150f1141a019faaa0c479b28cbdccee02b FAILED!
Rebase or make new commits to rebuild.

Hmm, looks like CI now uses version "0.1" for some reason. Fixing...

rebased onto dc168608ec49359cdd10b46700dd09c82660913f

3 years ago

Build dc168608ec49359cdd10b46700dd09c82660913f FAILED!
Rebase or make new commits to rebuild.

rebased onto b03c3204ca3199ff70cd64141a1887c6ee1ed520

3 years ago

Build b03c3204ca3199ff70cd64141a1887c6ee1ed520 FAILED!
Rebase or make new commits to rebuild.

This CI is horrible. :(

rebased onto 9901f8d6c5936d141c61d9ef8e7e4ee68a747c44

3 years ago

rebased onto 4694120c1430a88977fa21e178505a620ab17eea

3 years ago

Where's a definition for the %{version}?

Why it's 99? :D

Not sure what to put there and honestly I don't care that much - it's just something that the CI uses, I don't think we use this elsewhere.

Where's a definition for the %{version}?

It's the value of Version:.

rebased onto 534ca82

3 years ago

Pull-Request has been merged by lholecek

3 years ago