Code Monkey home page Code Monkey logo

git-build-rpm's Introduction

git-build-rpm

Build RPMs from Git repositories.

Description

This project makes it easy to create RPMs from Git projects. Simply create an RPM Spec file with the same name as your Git repository in a directory named dist at the root of your project. This project is a good example: See dist/git-build-rpm.spec for an example. Then just run git-build-rpm to build your RPM:

git build-rpm

git-build-rpm will archive the current branch of your repository, as well as any submodules, and then call rpmbuild to build from the archive based on the spec file. Once the RPM has been built, it will be dropped in the root directory of your project, from where you can copy it to your RPM repository of choice.

Installation

Install dependencies:

sudo yum install git git-archive-all rpm-build \
                 'perl(Module::Build)' \
                 'perl(IPC::System::Simple)' \
                 'perl(Path::Class)'

Build and install from Source:

perl Build.PL
./Build
sudo ./Build install

Build and install an RPM:

./bin/git-build-rpm
rpm -Uvh git-build-rpm*.rpm

Options

  • --spec-file: Path to RPM spec file.
  • --git: Path to git program.
  • --git-branch: Git branch to build from.
  • -p --package-name: Name of the project, used to archive the repo.
  • --dist: Name of distribution, used in RPM release name.
  • -D --define: Define macro=value.
  • --rpm-dir: Path to directory for building the RPM.
  • --quiet: Print as little as possible.
  • -V --version: Print the version number and exit.
  • -H --help: Print a usage statement and exit.
  • -M --man: Print the complete documentation and exit.

How it Works

Here's what git-build-rpm does when you run it:

  • Determines the current branch name via the --git-branch option, $GIT_BRANCH environment variable, or by parsing the output of branch -a --contains HEAD.

  • Determines the package name via the --package-name option or the output of git remote -v, preferring origin, and parsing it from the last part of the remote URL, ending in .git.

  • Determines the directory in which to build the RPM, using either the --rpm-dir option or a temporary directory that will be deleted on exit.

  • Determines the path to the RPM spec file, via the --spec-file option or by looking for a file named ./dist/$package_name.spec.

  • Extracts the version from the spec file.

  • Copies the spec file to the RPM build directory.

  • Archives the specified branch of the repository, as well as any submodules, into the RPM build directory.

  • Determines the RPM dist value via the --dist option, defaulting to the current epoch time and OS version. If the current branch is not "master", the branch name is also included in the dist value (with any invalid characters replaced with underscores). That is, the value is something like 1434755064.el7 when building master, and 1434755064.$branch_name_.el7 when building from any other branch.

  • Builds the RPM, setting dist and any other parameters passed via the --define option.

  • Moves all resulting RPMs to the current directory.

Copyright & License

Copyright 2012-1015 iovation, Inc. Some Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Author

git-build-rpm's People

Contributors

theory avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.