How to build foreman rpm with edge version of code?

hello
i found foreman-packaging, but can't understand how to build rpm with
latest version of code from develop branch.
short command example or links with very helpful
thanks

> hello
> i found foreman-packaging, but can't understand how to build rpm with
> latest version of code from develop branch.

The first point is that we publish nightly RPMs to
http://yum.theforeman.org/nightly/ which you may find useful.

> short command example or links with very helpful
> thanks

To build it, you first need an SRPM. Check out foreman-packaging's
rpm/develop branch, install tito, rpm-build, then run:

tito release --scratch --arg jenkins_job=test_develop --dry-run
koji-foreman-nightly

This'll generate SRPMs in /tmp/tito/. You can also generate SRPMs the
regular way with rpmbuild -bs and a tarball if you prefer.

Next create mock/site-defaults.cfg in your foreman-packaging checkout,
probably copying one of the two sample files.

Lastly build the SRPM with mock by running:

mock --configdir mock/ -r el7-scl /tmp/tito/foreman-*.el7.rpm

This uses the configs in the mock/ directory of foreman-packaging, which
point to Foreman repos for dependencies.

··· On 04/08/16 12:04, pronix pronix wrote:


Dominic Cleal
dominic@cleal.org

if i correct understand, for foreman project is not way for build without
ci.theforeamn and koji
so the best way is build tar.bz2 and using it with foreman.spec from
foreman-packaging ?
without tito, koji and other redhat community tools ?

··· On Thursday, August 4, 2016 at 1:05:39 PM UTC+2, pronix pronix wrote: > > hello > i found foreman-packaging, but can't understand how to build rpm with > latest version of code from develop branch. > short command example or links with very helpful > thanks >

thanks. it is very helpful and i got my edge rpm :slight_smile:

··· On Thursday, August 4, 2016 at 1:29:00 PM UTC+2, Dominic Cleal wrote: > > On 04/08/16 12:04, pronix pronix wrote: > > hello > > i found foreman-packaging, but can't understand how to build rpm with > > latest version of code from develop branch. > > The first point is that we publish nightly RPMs to > http://yum.theforeman.org/nightly/ which you may find useful. > > > short command example or links with very helpful > > thanks > > To build it, you first need an SRPM. Check out foreman-packaging's > rpm/develop branch, install tito, rpm-build, then run: > > tito release --scratch --arg jenkins_job=test_develop --dry-run > koji-foreman-nightly > > This'll generate SRPMs in /tmp/tito/. You can also generate SRPMs the > regular way with rpmbuild -bs and a tarball if you prefer. > > Next create mock/site-defaults.cfg in your foreman-packaging checkout, > probably copying one of the two sample files. > > Lastly build the SRPM with mock by running: > > mock --configdir mock/ -r el7-scl /tmp/tito/foreman-*.el7.rpm > > This uses the configs in the mock/ directory of foreman-packaging, which > point to Foreman repos for dependencies. > > -- > Dominic Cleal > dom...@cleal.org >

additional question. where is specified source repo and branch for src.rpm ?
i change it in spec file, but no affect

··· On Thursday, August 4, 2016 at 2:31:20 PM UTC+2, pronix pronix wrote: > > thanks. it is very helpful and i got my edge rpm :) > > > On Thursday, August 4, 2016 at 1:29:00 PM UTC+2, Dominic Cleal wrote: >> >> On 04/08/16 12:04, pronix pronix wrote: >> > hello >> > i found foreman-packaging, but can't understand how to build rpm with >> > latest version of code from develop branch. >> >> The first point is that we publish nightly RPMs to >> http://yum.theforeman.org/nightly/ which you may find useful. >> >> > short command example or links with very helpful >> > thanks >> >> To build it, you first need an SRPM. Check out foreman-packaging's >> rpm/develop branch, install tito, rpm-build, then run: >> >> tito release --scratch --arg jenkins_job=test_develop --dry-run >> koji-foreman-nightly >> >> This'll generate SRPMs in /tmp/tito/. You can also generate SRPMs the >> regular way with rpmbuild -bs and a tarball if you prefer. >> >> Next create mock/site-defaults.cfg in your foreman-packaging checkout, >> probably copying one of the two sample files. >> >> Lastly build the SRPM with mock by running: >> >> mock --configdir mock/ -r el7-scl /tmp/tito/foreman-*.el7.rpm >> >> This uses the configs in the mock/ directory of foreman-packaging, which >> point to Foreman repos for dependencies. >> >> -- >> Dominic Cleal >> dom...@cleal.org >> >

If you used that tito release […] koji-foreman-nightly command I
suggested then it uses the latest tarball of the develop branch from our
ci.theforeman.org server.

To use a local checkout of a certain repo/branch then replace the
jenkins_url argument with: --arg source_dir=~/foreman and point it to
your checkout.

Alternatively generate the tarball and use the spec file in the repo
with rpmbuild -bs (e.g. rpmbuild -bs --define "_sourcedir $PWD"
foreman.spec).

··· On 04/08/16 13:57, pronix pronix wrote: > additional question. where is specified source repo and branch for src.rpm ? > i change it in spec file, but no affect


Dominic Cleal
dominic@cleal.org

I'm not sure that I understand the question. The spec and sources from
foreman-packaging should be all that you need. For releases, our
tarballs are on http://downloads.theforeman.org/ as referenced in the
spec file - but for building non-releases then yes, you will need to
create your own tarballs.

tito, koji and our Jenkins server are not required to build Foreman,
they are simply the tooling we use to automate it. The RPM sources are
all in foreman-packaging and SRPMs can be built with regular tools
(rpmbuild, mock), including with the mock configs in the repo.

There are many build dependencies that will be satisfied from external
repos (EPEL, SCL etc) but all of our extra dependencies are in the same
repo.

··· On 05/08/16 14:03, pronix pronix wrote: > if i correct understand, for foreman project is not way for build > without ci.theforeamn and koji > so the best way is build tar.bz2 and using it with foreman.spec from > foreman-packaging ? > without tito, koji and other redhat community tools ?


Dominic Cleal
dominic@cleal.org

thanks.

··· On Thursday, August 4, 2016 at 3:00:14 PM UTC+2, Dominic Cleal wrote: > > On 04/08/16 13:57, pronix pronix wrote: > > additional question. where is specified source repo and branch for > src.rpm ? > > i change it in spec file, but no affect > > If you used that tito release [..] koji-foreman-nightly command I > suggested then it uses the latest tarball of the develop branch from our > ci.theforeman.org server. > > To use a local checkout of a certain repo/branch then replace the > jenkins_url argument with: --arg source_dir=~/foreman and point it to > your checkout. > > Alternatively generate the tarball and use the spec file in the repo > with rpmbuild -bs (e.g. rpmbuild -bs --define "_sourcedir $PWD" > foreman.spec). > > -- > Dominic Cleal > dom...@cleal.org >

appeared new question.
i want repeat full process locally.
which command is used for create tarball on ci.foreman.org ?
because standart git archive not fit , spec file expect some other
structured and prepared archive.

··· On Thursday, August 4, 2016 at 3:00:14 PM UTC+2, Dominic Cleal wrote: > > On 04/08/16 13:57, pronix pronix wrote: > > additional question. where is specified source repo and branch for > src.rpm ? > > i change it in spec file, but no affect > > If you used that tito release [..] koji-foreman-nightly command I > suggested then it uses the latest tarball of the develop branch from our > ci.theforeman.org server. > > To use a local checkout of a certain repo/branch then replace the > jenkins_url argument with: --arg source_dir=~/foreman and point it to > your checkout. > > Alternatively generate the tarball and use the spec file in the repo > with rpmbuild -bs (e.g. rpmbuild -bs --define "_sourcedir $PWD" > foreman.spec). > > -- > Dominic Cleal > dom...@cleal.org >

It's a git archive but with a prefix:

git archive --prefix=foreman-1.13.0/ HEAD | bzip2 -9 >
foreman-1.13.0.tar.bz2

··· On 04/08/16 15:18, pronix pronix wrote: > appeared new question. > i want repeat full process locally. > which command is used for create tarball on ci.foreman.org ? > because standart git archive not fit , spec file expect some other > structured and prepared archive.


Dominic Cleal
dominic@cleal.org

hello
thanks for help. but i still not understand why i can't build rpm.
in foreman git repo i build archive git archive --prefix=foreman-1.13.0/ HEAD | bzip2 -9 > foreman-1.13.0.tar.bz2
in foreman-packaging/foreman , branch rpm/develop , i call tito release --scratch --arg source_dir=~/project/FOREMAN/foreman --dry-run koji-foreman-nightly
but i got error

Will release to the following targets: koji-foreman-nightly
Releasing to target: koji-foreman-nightly
Working in: /tmp/tito/release-foreman4yqcv_ok
Building release in Koji...
WARNING: foreman not specified in whitelist for foreman-nightly-nonscl-rhel7
   Package *NOT* submitted to Koji.
Fetching sources...
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - 
/home/dima/project/FOREMAN/foreman/config/settings.yaml
/home/dima/project/FOREMAN/foreman/config/settings.rb:7:in `<top 
(required)>'
/home/dima/project/FOREMAN/foreman/config/application.rb:8:in `require'
/home/dima/project/FOREMAN/foreman/config/application.rb:8:in `<top 
(required)>'
/home/dima/project/FOREMAN/foreman/Rakefile:1:in `<top (required)>'
/home/dima/.gem/ruby/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
  foreman.spec
Traceback (most recent call last):
  File "/usr/bin/tito", line 23, in <module>
    CLI().main(sys.argv[1:])
  File "/usr/lib/python3.5/site-packages/tito/cli.py", line 202, in main
    return module.main(argv)
  File "/usr/lib/python3.5/site-packages/tito/cli.py", line 595, in main
    scratch=self.options.scratch)
  File "/usr/lib/python3.5/site-packages/tito/release/main.py", line 463, 
in release
    self._koji_release()
  File "/usr/lib/python3.5/site-packages/tito/release/main.py", line 528, 
in _koji_release
    builder.srpm(dist=disttag)
  File "/usr/lib/python3.5/site-packages/tito/builder/main.py", line 197, 
in srpm
    self.tgz()
  File "/usr/lib/python3.5/site-packages/tito/builder/fetch.py", line 67, 
in tgz
    source_strat.fetch()
  File 
"/home/dima/project/FOREMAN/foreman-packaging/rel-eng/custom/custom.py", 
line 88, in fetch
    self.version = self._get_version()
  File 
"/home/dima/project/FOREMAN/foreman-packaging/rel-eng/custom/custom.py", 
line 203, in _get_version
    base_name = os.path.basename(self.sources[0])
IndexError: list index out of range
··· On Thursday, August 4, 2016 at 4:25:09 PM UTC+2, Dominic Cleal wrote: > > On 04/08/16 15:18, pronix pronix wrote: > > appeared new question. > > i want repeat full process locally. > > which command is used for create tarball on ci.foreman.org ? > > because standart git archive not fit , spec file expect some other > > structured and prepared archive. > > It's a git archive but with a prefix: > > git archive --prefix=foreman-1.13.0/ HEAD | bzip2 -9 > > foreman-1.13.0.tar.bz2 > > -- > Dominic Cleal > dom...@cleal.org >

> hello
> thanks for help. but i still not understand why i can't build rpm.
> in foreman git repo i build archive git archive > --prefix=foreman-1.13.0/ HEAD | bzip2 -9 > foreman-1.13.0.tar.bz2
> in foreman-packaging/foreman , branch rpm/develop , i call tito > release --scratch --arg source_dir=~/project/FOREMAN/foreman --dry-run > koji-foreman-nightly

You should pick one method, not both. If you're generating a tarball by
hand (git archive) then you should put it with the other sources (in
foreman-packaging/foreman/) and run rpmbuild -bs to generate the SRPM
(e.g. rpmbuild -bs --define "_sourcedir $PWD" foreman.spec).

> but i got error
> ```
> Will release to the following targets: koji-foreman-nightly
> Releasing to target: koji-foreman-nightly
> Working in: /tmp/tito/release-foreman4yqcv_ok
> Building release in Koji…
> WARNING: foreman not specified in whitelist for foreman-nightly-nonscl-rhel7
> Package NOT submitted to Koji.
> Fetching sources…
> rake aborted!
> Errno::ENOENT: No such file or directory @ rb_sysopen -
> /home/dima/project/FOREMAN/foreman/config/settings.yaml

If you're using the tito … koji-foreman-nightly command against a git
checkout then the checkout has to be set up - create settings.yaml and
install the dependencies via Bundler. It's only really useful if you
have a git checkout of Foreman already, else use a release tarball or
create one yourself.

··· On 04/08/16 16:31, pronix pronix wrote:


Dominic Cleal
dominic@cleal.org