[Spice-devel] [PATCH spice-gtk 2/2] Add copr builds integration

Snir Sheriber ssheribe at redhat.com
Wed Aug 28 11:57:04 UTC 2019


Hi,

On 8/28/19 1:36 PM, Frediano Ziglio wrote:
>> Hi,
>>
>> On 8/27/19 10:49 PM, Marc-André Lureau wrote:
>>> Hi
>>>
>>> On Tue, Aug 27, 2019 at 6:27 PM Snir Sheriber <ssheribe at redhat.com> wrote:
>>>> This will let copr to generate srpm using the .copr/Makefile script
>>> Do we really want to maintain that kind of distro things upstream? Do
>>> we need it?
>>>
>>> What does it bring that gitlab CI doesn't have?
>>
>> This srpm is generated with every commit and then a build is triggered
>> in copr so that we'll have a repository of latest upstream packages which
>> can be easily enabled by simple "dnf copr enable X" command.
>> This should eventually replace the nightly builds repo which is currently
>> created by an unmaintained vm that runs cron job that creates the srpms
>> and push to copr (there is also a git repo for the spec file templates used
>> by it).
> IMO replacing the current nightly copr should be more a requirement than a
> "should". Removing an hidden, not open VM into some small hooks configuration
> with open source code that people can change sounds really nice thing.
> Having two semi-official development setups to package/use SPICE seems a
> bit too much.
>
>> Hence the intention was not to use it as ci, just for creating this repo, if
>> i could have easily push the srpm created by gitlab ci to copr i would have
>> done it. (can be done but would require to maintain our own runners)
>>
> Mumble... could we not use artifacts and a webhook? So CI prepare the SRPM,
> save in the artifacts and send a link to the SRPM using a copr webhook
> (or something similar, not sure what can be done in copr)


AFAIK you cannot pass a link to copr.

BUT if it's a known address we may be able to do one of the following:

1. Create the SRPM in gitlab and use a small script to just to download 
it to
     copr's srpm_output dir.

2. Pass only the tarball as artifact and have a small script to download 
it and
     create the SRPM in the srpm_output dir of copr

Then copr will take the srpm from this dir and execute a build

This way we even can drop the Makefile since it's also possible to have the
script directly in copr (without root privileges)

I'll test those options, thanks!


>
>>>> Signed-off-by: Snir Sheriber <ssheribe at redhat.com>
>>>> ---
>>>>    .copr/Makefile | 29 +++++++++++++++++++++++++++++
>>>>    1 file changed, 29 insertions(+)
>>>>    create mode 100644 .copr/Makefile
>>>>
>>>> diff --git a/.copr/Makefile b/.copr/Makefile
>>>> new file mode 100644
>>>> index 0000000..db297fb
>>>> --- /dev/null
>>>> +++ b/.copr/Makefile
>>>> @@ -0,0 +1,29 @@
>>>> +# This Makefile script is invoked by copr to build source rpm
>>>> +# See:
>>>> https://docs.pagure.org/copr.copr/user_documentation.html#make-srpm
>>> When is the build actually triggered? Is copr monitoring the git
>>> repository? Is there a hook somewhere in gitlab to trigger the build?
>>
>> Yes, there is a gitlab hook that should be enabled (just by adding
>> the copr webhook url as gitlab hook)
>>
> Do you mean a gitlab (as gitlab.freedesktop.org) hook that trigger copr
> build?


Yes

Snir.


>>>> +
>>>> +PROTOCOL_GIT_REPO = https://gitlab.freedesktop.org/spice/spice-protocol
>>>> +BUILD = meson gcc xz git rpm-build
>>>> +
>>>> +srpm:
>>>> +       dnf install -y $(BUILD)
>>>> +
>>>> +       # get upstream spice protocol
>>>> +       git clone $(PROTOCOL_GIT_REPO)
>>>> +       cd spice-protocol && meson -Dprefix=/usr/ build && ninja -C build
>>>> install
>>>> +       rm -rf spice-protocol
>>>> +
>>>> +       # get other dependencies for project excluding spice-protocol
>>>> +       dnf install -y `sed '/^BuildRequires:/!d; s/.*://;
>>>> s/\bspice-protocol\b//; s/>.*//' *.spec.in`
>>>> +
>>>> +       # do not use commit id for version
>>>> +       git fetch --tags
>>>> +       git describe --abbrev=0 | sed 's/v//' > .tarball-version
>>>> +       # create source rpm
>>>> +       meson --buildtype=release build
>>>> +       # Meson does not update submodules recursively
>>>> +       git submodule update --init --recursive
>>>> +       # this fix an issue with Meson dist
>>>> +       if ! test -r ../spice-common.git; then DIR=`basename "$$PWD"`; ln
>>>> -s "$$DIR/.git/modules/spice-common" ../spice-common.git; fi
>>>> +       rm -rf meson-dist
>>>> +       ninja -C build dist
>>>> +       rpmbuild -bs ./build/*spec --define "_sourcedir
>>>> $$PWD/build/meson-dist/" --define "_srcrpmdir $(outdir)"
>>> Too much hacks for my taste here.
>>
>> I agree but it's still less hacks than what we have now in order to
>> create the
>> nightly repo, hopefully this will become simpler once some copr & meson
>> issues will be solved (or we'll be able to use rpkg when it will support
>> submodules)
>>
>> Snir.
>>
> Frediano


More information about the Spice-devel mailing list