[Bug 2176241] Review Request: golang-github-zcalusic-sysinfo - Sysinfo is a Go library providing Linux OS / kernel / hardware system information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



https://bugzilla.redhat.com/show_bug.cgi?id=2176241



--- Comment #19 from Link Dupont <link@xxxxxxxxxxx> ---
I want to avoid manually maintaining the %changelog section and the %release
value. To do so, and to follow the current Fedora packaging guidelines, I use
the %autorelease and %autochangelog macros in my spec files. When I generated
this spec file, I ran `go2rpm github.com/zcalusic/sysinfo`. The resulting spec
file does contain both the %autorelease and %autochangelog macros; they have
been enabled by default[1] since go2rpm 1.7.0.

>From the spec file that was generated by go2rpm, I then ran `fedpkg --release
rawhide srpm` to generate an SRPM. I then uploaded the SRPM to COPR to be
built[2]. The spec file that exists in the SRPM differs from the spec file the
SRPM was built from in two important ways:

1) A locally defined macro called autorelease is inserted into the top of the
spec file.
2) The "%autochangelog" line at the bottom is replaced with a proper changelog

Neither of these operations are performed by me; this is the work of
rpmautospec during the 'fedpkg srpm' operation. This is a necessary side effect
of using %autorelease and %autochangelog to maintain %release and %changelog
automatically. In order for a given SRPM to have a static %release value, a
local definition of %autorelease has to be injected into the spec file so that
the %autorelease macro *always* returns the same fixed number, otherwise each
time the SRPM is built, the release would be incremented. Similary, in order
for a given SRPM to have a static changelog, the changelog must be constructed
from the VCS at the time the SRPM is created and inserted into the SRPM,
otherwise each time the SRPM is built, the changelog would be empty (since
there is not VCS metadata within the SRPM archive to extract changelog entries
from).

I believe you can recreate this and observe these changes for yourself by
running the following:

rpm -q go2rpm
go2rpm github.com/zcalusic/sysinfo
fedpkg --release rawhide srpm
rpm2cpio golang-github-zcalusic-sysinfo-0.9.5-1.fc39.src.rpm | cpio --extract
--verbose --make-directories --directory=EXTRACT
diff -u golang-github-zcalusic-sysinfo.spec
EXTRACT/golang-github-zcalusic-sysinfo.spec

You should see a diff that looks like:

--- golang-github-zcalusic-sysinfo.spec 2023-03-16 11:10:16.231983088 -0400
+++ EXTRACT/golang-github-zcalusic-sysinfo.spec 2023-03-16 11:12:26.901514002
-0400
@@ -1,3 +1,13 @@
+## START: Set by rpmautospec
+## (rpmautospec version 0.3.5)
+## RPMAUTOSPEC: autorelease, autochangelog
+%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
+    release_number = 1;
+    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
+    print(release_number + base_release_number - 1);
+}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
+## END: Set by rpmautospec
+
 # Generated by go2rpm 1.9.0
 %bcond_without check
 %global debug_package %{nil}
@@ -49,4 +59,5 @@
 %gopkgfiles

 %changelog
-%autochangelog
+* Tue Mar 14 2023 Link Dupont <link@xxxxxxxxxxx> - 0.9.5-1
+- Intitial package

1: https://pagure.io/GoSIG/go2rpm/c/9aeb391410bd6dd9baddcaa8bfa305549ea7448a
2: https://copr.fedorainfracloud.org/coprs/linkdupont/reviews/build/5641494/


-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are always notified about changes to this product and component
https://bugzilla.redhat.com/show_bug.cgi?id=2176241
_______________________________________________
package-review mailing list -- package-review@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to package-review-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/package-review@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite Conditions]     [KDE Users]

  Powered by Linux