github.com/x-oss-byte/git-lfs@v2.5.2+incompatible/rpm/INSTALL.md (about)

     1  # Building RPMs #
     2  
     3  All of the code to build the RPM is stored in a SPECS/git-lfs.spec file. The
     4  source code tarball needs to be put in a SOURCES directory. The BUILD and
     5  BUILDROOT directories are used during the build process. The final RPM ends up
     6  in the RPMS directory and a source-rpm in SRPMS.
     7  
     8  In order to expedite installing all dependencies (mainly ruby-ronn and golang)
     9  and download any needed files a build_rpms.bsh script is included. This is the
    10  **RECOMMENDED** way to build the rpms. It will install all yum packages in
    11  order to build the rpm. This can be especially difficult in CentOS 5 and 6,
    12  but it will build and install a suitable golang/ruby so that git-lfs can be
    13  built.
    14  
    15  Simple run:
    16  
    17  ```
    18  ./clean.bsh
    19  ./build_rpms.bsh
    20  ```
    21  
    22  The clean.bsh script removes previous rpms, etc... and removed the source
    23  tar.gz file. Otherwise you might end up creating an rpm with pieces from
    24  different versions.
    25  
    26  Practice is to run rpmbuild as non-root user. This prevents inadvertently
    27  installing files in the operating system. The intent is to run build_rpms.bsh
    28  as a non-root user with sudo privileges. If you have a different command for
    29  sudo, set the SUDO environment variable to the other command.
    30  
    31  When all is down, install (or distribute) RPMS/git-lfs.rpm
    32  
    33  ```
    34  yum install RPMS/x86_64/git-lfs*.rpm
    35  ```
    36  
    37  ### Alternative build method ###
    38  
    39  If you want to use your own ruby/golang without using the version from
    40  build_rpms.bsh, you will have to disable dependencies on the rpms. It's pretty
    41  easy, just make sure ronn and go are in the path, and run
    42  
    43  ```
    44  NODEPS=1 ./build_rpms.bsh
    45  ```
    46  
    47  ### Manual build method ###
    48  
    49  If you want to use your own ruby/golang without using build_rpms.bsh, it's a
    50  little more complicated. You have to make sure ronn and go are in the path,
    51  and create the build structure, and download/create the tar.gz file used. This
    52  is not recommended, but it is possible.
    53  
    54  ```
    55  mkdir -p {BUILD,BUILDROOT,SOURCES,RPMS,SRPMS}
    56  #download file to SOURCES/v{version number}.tar.gz
    57  rpmbuild --define "_topdir `pwd`" -bb SPECS/git-lfs.spec --nodeps
    58  
    59  #(and optionally)
    60  rpmbuild --define "_topdir `pwd`" -bs SPECS/git-lfs.spec --nodeps
    61  ```
    62  
    63  ### Releases ###
    64  
    65  It is no longer necessary to update SPECS/git-lfs.spec every version. As long
    66  as lfs/lfs.go is updated, build_rpms.bsh parses the version number using the
    67  pattern ```s|const Version = "\([0-9.]*\)"|\1|``` and updates
    68  SPECS/git-lfs.spec. The version number is then used to download:
    69  
    70  https://github.com/git-lfs/git-lfs/archive/v%{version}.tar.gz
    71  
    72  This way when a new version is archived, it will get downloaded and built
    73  against. When developing, it is advantageous to use the currently checked out
    74  version to test against. In order do that, after running ```./clean.bsh```,
    75  set the environment variable BUILD_LOCAL to 1
    76  
    77  ```
    78  ./clean.bsh
    79  BUILD_LOCAL=1 ./build_rpms.bsh
    80  ```
    81  
    82  ### Troubleshooting ###
    83  
    84  **Q**) I ran build_rpms.bsh as root and now there are root owned files in the 
    85  rpm dir
    86  
    87  **A**) That happens. Either run build_rpms.bsh as a user with sudo permissions
    88  or ```chown -R username:groupname rpm``` as root after building.