Re: Spec file using github repo - not tarball

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

 



Hello,
Sorry I forgot to mention that all builds in Fedora require to be built offline so you still need to download the tarball and upload it to Fedora side-storage of source files before build:
# spectool will process the specfile and download the tarball in expected name
spectool -g package.spec
# it is needed to upload the tarball of the snapshot to fedora
fedpkg new-sources package-<version>-git<gitdate>-<shortcommit>.tar.gz

In COPR (https://docs.pagure.org/copr.copr/) you can autodownload the tarball before building the package or even build from git version.
For example you can autobuild of the srpm from another github repository using make_srpm:
https://copr.fedorainfracloud.org/coprs/rebus/infosec/package/yara/


That requires that you store in your git project where you have the spec file also the .copr/Makefile, where you can specify how to prepare the srpm
Example: https://github.com/xambroz/rpms-infosec/blob/master/.copr/Makefile


On COPR you can also use web-hooks from your git with the package source spec file, to trigger automatic COPR rebuild of the package.

Best regards
Michal Ambroz


Hello, 
yes it is possible to refer to the git commit.
For example https://src.fedoraproject.org/rpms/yara/blob/rawhide/f/yara.spec
(I mostly use stable releases, but time to time I have to switch to a git snapshot during major version stabilization or when there is some public vulnerability announced).
I even have it in one spec file with a tarball release and able to switch with the conditional build "--with release" or "--without release".

# Baserelease for the engineering team to auto-update the release version when rebuilding packages
%global baserelease 1


Relevant parts:
# Github metadata
%global         gituser         VirusTotal
%global         gitname         yara
%global         gitdate         20240213
%global         commit          8fa55cde4c0cde8a1ba4ced1c131827eb4005f0d
%global         shortcommit     %(c=%{commit}; echo ${c:0:7})
 
# Release referring to github metadata
Release: %{baserelease}.%{gitdate}git%{shortcommit}%{?dist}

# Source refering to specific commit
Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-git%{gitdate}-%{shortcommit}.tar.gz

# preparation using the commit directory
%prep
%autosetup -n %{gitname}-%{commit} -p 1


Best regards
Michal Ambroz


Is it possible for a .spec file to clone a github.com repo rather than
download a tarball? Can someone link to a working example?

I found a few hints that it's possible. However, the fedoraproject.org
examples use pseudocode or placeholders. I'd like a working example.
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-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/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-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/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux