Index: work/OS/Fedora/README.md =================================================================== --- work/OS/Fedora/README.md (nonexistent) +++ work/OS/Fedora/README.md (revision 15172) @@ -0,0 +1,93 @@ +# Build `pcb-rnd` RPMs for Linux distributions (March 2018) +This README is applicable to Fedora 27 version. +Applicable also to CentOS ? openSUSE ? others ? + +## Packaging guidelines +They depend on the distribution: + +* Fedora: `https://fedoraproject.org/wiki/Packaging:Guidelines` + +## Preparing your system to create RPM packages +See `https://rpm-packaging-guide.github.io/#prerequisites` and more +Fedora specific documentation +`https://docs.fedoraproject.org/quick-docs/en-US/creating-rpm-packages.html` +to start with. + +> **Never use** the `root` account for any command involved here. A simple user account is sufficient. + +`rpmdev-setuptree` command (run this only once) will create a `~/rpmbuild` +directory, with RPM related sub-dirs locations. +Those directories will contain the resulting files. + +## Get pcb-rnd sources +in `~/rpmbuild/SOURCES` should reside a `.tar` version of sources to be packaged. + +Several possibilities + +1. Get the .tar file from an URL (official way to refer to the release) +2. Build a source version tar file from SVN (see details below) + +Second option consists in copying an svn source tree in `~/rpmbuild/SOURCES`, then +make a `.tar.gz` out of the source tree. +``` +cp -R pcb-rnd/trunk pcb-rnd-{release} +tar --exclude-vcs -czf pcb-rnd-{release}.tar.gz pcb-rnd-{release} +``` + +## Check the `.spec` +The `.spec` file is the main file configuring the RPM tools. It should be located +in `~/rpmbuild/SPECS` dir. Check it with: +``` +rpmlint pcb-rnd.spec +``` +results in: +``` +pcb-rnd.spec:204: W: configure-without-libdir-spec +pcb-rnd.spec: W: no-%install-section +pcb-rnd.spec: W: invalid-url Source0: pcb-rnd-1.2.8.tar.gz +0 packages and 1 specfiles checked; 0 errors, 3 warnings. +``` +### Reference manual for `.spec` file +This is difficult to find... `.spec` file commands are very related to RPM file +format, and old documentation at `http://ftp.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html` +seems still applicable. Some macros are described in +`http://ftp.rpm.org/max-rpm/s1-rpm-inside-macros.html` + +## Build the RPMs +The build is using the `.spec` file, and is started from `~/rpmbuild/SPECS` with: +``` +rpmbuild -ba pcb-rnd.spec > res.log +``` +This command will launch the source extraction, `./configure` and `make` commands, +with messages logged in `res.log`. + +RPM files are located in + +* `~/rpmbuild/SRPMS` for the source RPM file +* `~/rpmbuild/RPMS/noarch` for the documentation +* `~/rpmbuild/RPMS/x86_64` for the binaries (depends on architecture) + +## Check the RPMs +The Fedora `mock` tool [^1] needs a source RPM file. +Go to `~/rpmbuild/SRPMS`, lauch: +``` +mock -r /etc/mock/fedora-27-x86_64.cfg rebuild pcb-rnd-1.2.8-1.fc27.src.rpm +``` +This will extract the source tree, check software dependencies, `./configure`, +`make` and should exit with : +``` +... ++ exit 0 +Finish: rpmbuild pcb-rnd-1.2.8-1.fc27.src.rpm +Finish: build phase for pcb-rnd-1.2.8-1.fc27.src.rpm +INFO: Done(pcb-rnd-1.2.8-1.fc27.src.rpm) Config(fedora-27-x86_64) 5 minutes 4 seconds +INFO: Results and/or logs in: /var/lib/mock/fedora-27-x86_64/result +Finish: run +``` + +## Submit the RPMs +? + +`https://fedoraproject.org/wiki/Packaging:ReviewGuidelines` + +[^1]: `https://github.com/rpm-software-management/mock/wiki` \ No newline at end of file