Re: [PATCH rdma-core 3/3] cbuild: use rpmspec for macro replacement

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

 




Le 09/08/2017 à 17:55, Jason Gunthorpe a écrit :
> On Wed, Aug 09, 2017 at 11:56:47AM +0200, Nicolas Morey-Chaisemartin wrote:
>
>>>>  def run_rpm_build(args,spec_file,env):
>>>>      version = get_version();
>>>> -    with open(spec_file,"r") as F:
>>>> +
>>>> +    # Pre-process file with rpm spec to avoid manually replacing macros
>>>> +    f = open(spec_file + ".processed", "w");
>>>> +    subprocess.check_call(["rpmspec", "-P", spec_file], stdout=f);
>>> This isn't going to work on any host system that does not have
>>> rpmspec, including my Debian systems..
>> Are you building RPM outside of docker on your Debian ?
> No..
>
> The issue is the above subprocess.check_call is run on the host, while
> the call I added below inside go.py is run inside the container.
>
> The host may not have rpmspec, while we guarentee that the container
> does.

Oh OK. I dived into those specific bits of code and assume it was all running in the container.

>
>> I ran the pkg suite for all targets and they all work.
> Your host has rpmspec :)

Yes :)

>
>>>  def run_rpm_build(args,spec_file,env):
>>> -    version = get_version();
>>>      with open(spec_file,"r") as F:
>>>          for ln in F:
>>> -            if ln.startswith("Version:"):
>>> -                ver = ln.strip().partition(' ')[2];
>>> -                assert(ver == get_version());
>>> -
>> You are losing this last check which seems important. It make sure the ti tag is in sync with the RPM
> If you think it is important it can be left in..

Well as we will have 2 spec file, it makes sure no ones forgot a version bump when releasing late at night just before a deadline ;)

>
>>>              if ln.startswith("Source:"):
>>>                  tarfn = ln.strip().partition(' ')[2];
>>> -    tarfn = tarfn.replace("%{version}",version);
>>>  
>>>      image_id = get_image_id(args,env.image_name());
>>>      with private_tmp(args) as tmpdir:
>>> @@ -426,7 +420,8 @@ def run_rpm_build(args,spec_file,env):
>>>          os.mkdir(os.path.join(tmpdir,"tmp"));
>>>  
>>>          subprocess.check_call(["git","archive",
>>> -                               "--prefix","%s/"%(os.path.splitext(tarfn)[0]),
>>> +                               # This must match the prefix generated buildlib/github-release
>>> +                               "--prefix","%s-%s/"%(project,get_version()),
>>>                                 "--output",os.path.join(tmpdir,"SOURCES",tarfn),
>> You have an issue here because tarfn is not set yet.
> No, it was still set above, see the first hunk.

Yes. But the value it has is "wrong"
If I take the current spec file used in OBS:
Source0:        %{name}-%{version}%{git_ver}.tar.xz

Omitting the Source0 that should be changed to Source, this wille set tarfn to rdma-core-15%{git_ver}.tar.xz

>
>> I'm confused on why moving the call to rpmspec further down would solve your Debian issue ?
> Further down the code is run in the container where rpmspec is
> guarenteed to exist. Everything in cbuild is run on the host except
> for the snippet in go.py
>
> Jason

This means that we would need to detar/rename/retar the package in the go.py.
It feels overly complicated :/
What we use this for is mainly for RC and non-release packages. We set the git_ver to -rc1, -<NN>-g<SHA1>  so we know at a glance that this is not an official release.
I can either try to get this working in the go.py, or I'll simply drop this from our spec and bring it back when needed for non release packages.

Nicolas

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux