#95 Added simple placeholder macros for building rpms locally.
Merged 4 years ago by nphilipp. Opened 4 years ago by asaleh.
fedora-infra/ asaleh/rpmautospec rpm_macros  into  master

file modified
+16
@@ -112,6 +112,18 @@ 

  

  %config(noreplace) %{_sysconfdir}/koji-hub/plugins/rpmautospec.conf

  

+ # Package the placeholder rpm-macros

+ 

+ %package -n rpmautospec-rpm-macros

+ Summary: Rpmautospec RPM macros for local rpmbuild

+ Requires: rpm

+ 

+ %description -n rpmautospec-rpm-macros

+ RPM macros with placeholders for building rpmautospec enabled packages localy

+ 

+ %files -n rpmautospec-rpm-macros

+ %{rpmmacrodir}/macros.rpmautospec

+ 

  #--------------------------------------------------------

  

  %prep
@@ -157,6 +169,10 @@ 

          %{buildroot}%{_sysconfdir}/$dest/plugins/rpmautospec.conf

  done

  

+ # RPM macros

+ mkdir -p %{buildroot}%{rpmmacrodir}

+ install -m 644  rpm/macros.d/macros.rpmautospec %{buildroot}%{rpmmacrodir}/

+ 

  # EPEL7 does not have python3-koji which is needed to run the tests, so there

  # is no point in running them

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

@@ -0,0 +1,9 @@ 

+ %autorel(e:s:hp) %{?-p:0.}1%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{?dist}%{?-h:.1}

+ %autochangelog %{lua:

+     date = os.date("%a %b %d %Y")

+     packager = rpm.expand("%{?packager}%{!?packager:John Doe <packager@example.com>}")

+     evr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")

+     print("* " .. date .. " " .. packager .. " - " .. evr .. "\\n")

+     print("- local build")

+ }

+ 

no initial comment

Build succeeded.

Tested locally and fepdkg local ran without any problem.

Doing a fedpkg-stage build led to: Building python-arrow-0.14.6-1.fc33 for rawhide[...] which will prevent users from doing the build unless they specify --skip-nvr-check once that build has been recorded in koji.

rebased onto 8e7f4897a4263dc42b69a83117687d795c411bfe

4 years ago

Build succeeded.

Add a blank line to separate the description from the file list please.

Metadata Update from @nphilipp:
- Request assigned

4 years ago

This won't accept the flags of the macro, which would be pasted verbatim into the release field. I know we didn't want to do "fancy" but I couldn't resist :wink:, so let's make it:

%autorel(e:s:hp) %{?-p:0.}1%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{?dist}%{?-h:.1}

This will prepend 0. if for pre-releases, append .1 for hotfixes, and insert the arguments to -e and -s.

Sorry, this is becoming fancy. (Not really sorry.)

  • You don't have to shell out to the date program to produce the current date, lua lets you do that via os.date().
  • Changelog entries also want full names and email addresses and I fear we can't figure out the latter unless the user has set %packager in their ~/.rpmmacros which we can use verbatim if it exists.
  • The release is missing from the entry.
  • Calling date() and whoami() doesn't work, they're strings.
  • The message can be much shorter. :wink:
  • It's indented weirdly (mix of tabs and spaces).

How about:

%autochangelog %{lua:
    date = os.date("%a %b %d %Y")
    packager = rpm.expand("%{?packager}%{!?packager:John Doe <packager@example.com>}")
    evr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
    print("* " .. date .. " " .. packager .. " - " .. evr .. "\\n")
    print("- local build")
}

Doing a fedpkg-stage build led to: Building python-arrow-0.14.6-1.fc33 for rawhide[...] which will prevent users from doing the build unless they specify --skip-nvr-check once that build has been recorded in koji.

Yeah, fedpkg should do the equivalent of rpmautospec --quiet process-distgit --check ... and if it yields that %autorel is used, skip the check by itself.

Ok, for some reason, date() and whoami() were not strings for me, maybe some artefact of how IO works in embedded lua?

But I am all for making this more fancy :-)

rebased onto f8c0e9843bbc1771e5e44f7269606d31ef6dc62c

4 years ago

Build succeeded.

1 new commit added

  • Adding placeholder autospec macros, going with Nils' fancier suggestions.
4 years ago

Build succeeded.

rebased onto f6001f8c02a74212695f8dbe4620a0cf5327421d

4 years ago

rebased onto 651d8900e43b9cd4494a216df94763ed34c2df9d

4 years ago

Build succeeded.

rebased onto 41a89fa580f7559daa8b33e4a1364bf7a12f4095

4 years ago

rebased onto ce7e06b

4 years ago

Pull-Request has been merged by nphilipp

4 years ago

Build succeeded.