Difference between revisions of "Building RPMS from Source"

From MythTV Official Wiki
Jump to: navigation, search
m
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Howto]]
+
BUILDING RPMS FROM SOURCE
  
Building RPMS from Source
+
If you usually use the atrpms repositories to obtain mythtv rpm files, but need to make some changes to one or a few files, it is not difficult to amend and re-create an rpm.
  
If you usually use the atrpms or rpmfusion repositories to obtain mythtv rpm files, but need to make some changes to one or a few files, it is not difficult to amend and re-create an rpm.
+
You will need the rpm-build utilities, the source rpm for the package you wish to revise, the specific directory layout used by rpm and Axel Thimm's rpmmacros installed.
 
 
You will need the rpm-build utilities, the source rpm for the package you wish to revise and the specific directory layout used by rpm.
 
  
 
1.      yum install rpm-build
 
1.      yum install rpm-build
 
+
        yum install atrpms-rpm-config-185-2.noarch.rpm
 +
  The latter may not install cleanly, and you may have to search for it under the 'common' files section, save it on your computer and install it from the command line.
  
 
2.  Download the source SRPM to your computer. Use a browser to find it at atrpms or rpmfusion and 'save as' to your computer at, say /tmp
 
2.  Download the source SRPM to your computer. Use a browser to find it at atrpms or rpmfusion and 'save as' to your computer at, say /tmp
Line 22: Line 21:
  
 
4.  Create an rpm-macro to point to this spot, whichever login user you are:
 
4.  Create an rpm-macro to point to this spot, whichever login user you are:
         echo  "%_topdir /home/geoffrey/rpm" > /home/mythtv/.rpmmacros
+
         echo  "%_topdir /home/mythtv/rpm" > /home/mythtv/.rpmmacros
 
     or  
 
     or  
         echo  "%_topdir /home/geoffrey/rpm" > /root/.rpmmacros
+
         echo  "%_topdir /home/mythtv/rpm" > /root/.rpmmacros
  
 
     (The latter will fail if you are not root, of course.)
 
     (The latter will fail if you are not root, of course.)
Line 32: Line 31:
  
 
6.  Install the source rpm.
 
6.  Install the source rpm.
         rpm -i whatever.fc12.i386.src.rpm
+
         rpm -i mythtv-0.22-224.src.rpm
 +
 
 +
6.  Install dependencies.
 +
        yum-builddep mythtv
 +
 
 +
7.  This is where you will make your edits. You will open the tar-ball, edit, and re-tar the files.  See notes below.
 +
        cd to /home/mythtv/rpm/SOURCES
 +
        tar -xjvf mythtv-0.22.tar.bz2
 +
        cd mythtv-0.22
 +
    Make the required edits.
 +
        tar -cjf mythtv-0.22.tar.bz2 mythtv-0.22
  
7.  cd to /home/mythtv/rpm/SOURCES and make whatever changes are required.
 
  
 
8.  cd /home/mythtv/rpm/SPECS
 
8.  cd /home/mythtv/rpm/SPECS
Line 40: Line 48:
 
9.  Build the revised rpm
 
9.  Build the revised rpm
  
         rpmbuild -bb whatever.spec
+
         rpmbuild -bb mythtv.spec
  
 +
    If you get dependency errors at this point, you will have to find and install the missing packages.
 +
    An easy way is to run 'yum-builddep mythtv' which will pull in all of the dependencies, (provided you have installed the atrpms-rpm-config-185-2.noarch.rpm).
 +
    Add '--target=i686', or the architecture you are building.
  
 
10. Change to the correct architecture folder.  
 
10. Change to the correct architecture folder.  
Line 48: Line 59:
 
11.  Install the revised rpm.
 
11.  Install the revised rpm.
 
         rpm -Uvh *rpm
 
         rpm -Uvh *rpm
 +
 +
12.  Random notes for rpmfusion
 +
 +
    # Location of src packages
 +
    http://download1.rpmfusion.org/free/fedora/updates/17/SRPMS/repoview/mythtv.html
 +
    http://download1.rpmfusion.org/free/fedora/updates/17/SRPMS/repoview/mythweb.html
 +
 +
    This files are downloaded from github, here are the base URL https://github.com/MythTV/mythtv/tags click on download tar.gz
 +
    MythTV-mythtv-v0.25.1-0-gc2c276d.tar.gz
 +
    MythTV-mythweb-v0.25.1-0-g89a347c.tar.gz
 +
 +
  After getting the base tarball.  Next apply the fixes ontop of it. 
 +
  Clone a git repository:
 +
  git clone -b fixes/0.26 git://github.com/MythTV/mythtv.git
 +
 +
  then use 'git diff -p --stat v0.25.1 > mythtv-fixes.patch'
 +
 +
  Edit you githashes accordingly.
 +
 +
13. Git commands:
 +
 +
This will retrieve a commit and put it into a patch file.  After you have the file, copy it to the SOURCES directory, next edit the spec file.  The SHA you can obtain from the github while viewing it.
 +
  git format-patch -1 2eb5091b6b2058bf94cb11ef36b5972ef9a18fee
 +
 +
This will cherrypick into the git tree above and if you do the git diff afterwards, it should include your cherrypick.
 +
  git cherry-pick 20f7cd2858e79385ceec07b2c19c7e4f84714e18
 +
 +
Checkout a branch
 +
  git checkout fixes/0.27
 +
 +
[[Category:Developer Tools and Scripts]] [[Category:HOWTO]]

Latest revision as of 21:31, 3 March 2014

BUILDING RPMS FROM SOURCE

If you usually use the atrpms repositories to obtain mythtv rpm files, but need to make some changes to one or a few files, it is not difficult to amend and re-create an rpm.

You will need the rpm-build utilities, the source rpm for the package you wish to revise, the specific directory layout used by rpm and Axel Thimm's rpmmacros installed.

1. yum install rpm-build

       yum install atrpms-rpm-config-185-2.noarch.rpm
  The latter may not install cleanly, and you may have to search for it under the 'common' files section, save it on your computer and install it from the command line.

2. Download the source SRPM to your computer. Use a browser to find it at atrpms or rpmfusion and 'save as' to your computer at, say /tmp


3. Create a build tree in a user home directory:

       cd /home/mythtv
       mkdir rpm
       cd rpm
       mkdir SOURCES SPECS BUILD SRPMS RPMS
       mkdir -p RPMS/i386 RPMS/athlon RPMS/i586 RPMS/i686 RPMS/noarch


4. Create an rpm-macro to point to this spot, whichever login user you are:

       echo  "%_topdir /home/mythtv/rpm" > /home/mythtv/.rpmmacros
    or 
       echo  "%_topdir /home/mythtv/rpm" > /root/.rpmmacros
   (The latter will fail if you are not root, of course.)

5. Cd to whereever the source rpm is:

       cd /tmp

6. Install the source rpm.

       rpm -i mythtv-0.22-224.src.rpm

6. Install dependencies.

       yum-builddep mythtv

7. This is where you will make your edits. You will open the tar-ball, edit, and re-tar the files. See notes below.

       cd to /home/mythtv/rpm/SOURCES
       tar -xjvf mythtv-0.22.tar.bz2
       cd mythtv-0.22
   Make the required edits.
       tar -cjf mythtv-0.22.tar.bz2 mythtv-0.22


8. cd /home/mythtv/rpm/SPECS

9. Build the revised rpm

       rpmbuild -bb mythtv.spec
   If you get dependency errors at this point, you will have to find and install the missing packages.
   An easy way is to run 'yum-builddep mythtv' which will pull in all of the dependencies, (provided you have installed the atrpms-rpm-config-185-2.noarch.rpm).
   Add '--target=i686', or the architecture you are building.

10. Change to the correct architecture folder.

       cd ../RPMS/i386

11. Install the revised rpm.

       rpm -Uvh *rpm

12. Random notes for rpmfusion

   # Location of src packages
   http://download1.rpmfusion.org/free/fedora/updates/17/SRPMS/repoview/mythtv.html
   http://download1.rpmfusion.org/free/fedora/updates/17/SRPMS/repoview/mythweb.html
   This files are downloaded from github, here are the base URL https://github.com/MythTV/mythtv/tags click on download tar.gz
   MythTV-mythtv-v0.25.1-0-gc2c276d.tar.gz
   MythTV-mythweb-v0.25.1-0-g89a347c.tar.gz
  After getting the base tarball.  Next apply the fixes ontop of it.  
  Clone a git repository:
  git clone -b fixes/0.26 git://github.com/MythTV/mythtv.git
  then use 'git diff -p --stat v0.25.1 > mythtv-fixes.patch'
  Edit you githashes accordingly.

13. Git commands:

This will retrieve a commit and put it into a patch file. After you have the file, copy it to the SOURCES directory, next edit the spec file. The SHA you can obtain from the github while viewing it.

  git format-patch -1 2eb5091b6b2058bf94cb11ef36b5972ef9a18fee

This will cherrypick into the git tree above and if you do the git diff afterwards, it should include your cherrypick.

  git cherry-pick 20f7cd2858e79385ceec07b2c19c7e4f84714e18

Checkout a branch

  git checkout fixes/0.27