Your SlideShare is downloading. ×
0
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
RPM: Speed up your deploy
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

RPM: Speed up your deploy

3,617

Published on

RPM technical overview presented at Byte-Code kickoff 2007

RPM technical overview presented at Byte-Code kickoff 2007

Published in: Technology
1 Comment
6 Likes
Statistics
Notes
No Downloads
Views
Total Views
3,617
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
66
Comments
1
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. RPM: Speed up your deploy Francesco Crippa - [email_address]
  • 2. RPM: RedHat Package Manager <ul><li>Make your deploy: </li></ul><ul><ul><li>Fast </li></ul></ul><ul><ul><li>Easy </li></ul></ul><ul><ul><li>Standard </li></ul></ul><ul><ul><li>Secure </li></ul></ul><ul><ul><li>Predictable </li></ul></ul><ul><li>Every time it's the same deploy </li></ul>
  • 3. Install, update and remove <ul><li>An RPM package contains files, directories, permissions and some scripts to easy manage software without interactive process </li></ul>[root@a~]# rpm -ih witick-1.5-4.noarch.rpm [root@a~]# rpm -Uh witick-1.5-4.noarch.rpm [root@a~]# rpm -e witick
  • 4. Important Note... <ul><li>Please, be careful to the difference between “ Package Name ” and “ Package File Name ”: </li></ul><ul><ul><li>witick-1.5-4.noarch.rpm is the filename of “ witick ” package </li></ul></ul><ul><ul><li>rpm -Uh < file_name > </li></ul></ul><ul><ul><li>rpm -e < package_name > </li></ul></ul><ul><ul><li>rpm -ql < package_name > </li></ul></ul><ul><ul><li>yum install < package_name > </li></ul></ul>
  • 5. Yum: dependency semplified <ul><li>One of the most terrible pain with rpm is the dependecy between packages. </li></ul><ul><li>Yum help you to solve this step... </li></ul>[root@a~]# rpm -Uh krb5-server-1.5-17.i386.rpm Error! Failed Dependecies krb5-libs = 1.5-17 is needed by krb5-server-1.5-17
  • 6. RPM: Make it standard <ul><li>Java, C++ and Ruby applications could use very different delployment and building processes: </li></ul><ul><ul><li>Ant </li></ul></ul><ul><ul><li>Maven </li></ul></ul><ul><ul><li>MakeFile </li></ul></ul><ul><ul><li>Rake </li></ul></ul><ul><ul><li>... </li></ul></ul><ul><li>RPM define the process to use right tools to build and deploy right application </li></ul>
  • 7. RPM contents SOURCES SRPM (Source) Binaries RPM RPM Build SPEC
  • 8. RPM Build infrastructure <ul><li>To build an RPM you need a specific infrastructure: </li></ul><ul><li>/~ </li></ul><ul><ul><li>.rpmmacros </li></ul></ul><ul><ul><li>/rpmbuild </li></ul></ul><ul><ul><ul><li>/SOURCES </li></ul></ul></ul><ul><ul><ul><li>/BUILD </li></ul></ul></ul><ul><ul><ul><li>/RPMS </li></ul></ul></ul><ul><ul><ul><ul><li>/i386 </li></ul></ul></ul></ul><ul><ul><ul><ul><li>/i686 </li></ul></ul></ul></ul><ul><ul><ul><ul><li>/x86_64 </li></ul></ul></ul></ul><ul><ul><ul><ul><li>/noarch </li></ul></ul></ul></ul><ul><ul><ul><li>SRPMS </li></ul></ul></ul><ul><ul><ul><li>SPECS </li></ul></ul></ul>
  • 9. .rpmmacros <ul><li>~/.rpmmacros: Contains specific configuration for your user: </li></ul><ul><li>%packager Francesco Crippa <fcrippa@byte-code.com> </li></ul><ul><li>%vendor Byte-Code srl </li></ul><ul><li>%_topdir /home/fcrippa/rpmbuild </li></ul><ul><li>%_signature gpg </li></ul><ul><li>%_gpg_name Francesco Crippa <fcrippa@byte-code.com> </li></ul>
  • 10. All the magic is SPEC file <ul><li>All you nedd is SPEC file. It contains: </li></ul><ul><ul><li>Source files location </li></ul></ul><ul><ul><li>Patches </li></ul></ul><ul><ul><li>Meta-information about package (name, author, version...) </li></ul></ul><ul><ul><li>Changelog </li></ul></ul><ul><ul><li>Build process </li></ul></ul><ul><ul><li>Install process </li></ul></ul><ul><ul><li>Uninstall process </li></ul></ul><ul><ul><li>Requirements for building </li></ul></ul><ul><ul><li>Requirements for deploying </li></ul></ul>
  • 11. SPEC Head <ul><li>Summary: Hello world </li></ul><ul><li>Name: hello-c </li></ul><ul><li>Version: 1.0 </li></ul><ul><li>Release: 1 </li></ul><ul><li>License: GPL </li></ul><ul><li>Group: Amusements/Games </li></ul><ul><li>URL: http://www.byte-code.com </li></ul><ul><li>Source0: %{name}-%{version}.tar.gz </li></ul><ul><li>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root </li></ul><ul><li>BuildArch: i386 </li></ul><ul><li>%description </li></ul><ul><li>Hello world </li></ul><ul><li>... </li></ul>
  • 12. SPEC: build and install <ul><li>%prep </li></ul><ul><li>%setup -q </li></ul><ul><li>%build </li></ul><ul><li>gcc -o hello-c hello.c </li></ul><ul><li>%install </li></ul><ul><li>rm -rf $RPM_BUILD_ROOT </li></ul><ul><li>mkdir -p $RPM_BUILD_ROOT/bin </li></ul><ul><li>cp hello-c $RPM_BUILD_ROOT/bin </li></ul><ul><li>%clean </li></ul><ul><li>rm -rf $RPM_BUILD_ROOT </li></ul>
  • 13. Files and changelog <ul><li>%files </li></ul><ul><li>%defattr(-,root,root,-) </li></ul><ul><li>/bin/* </li></ul><ul><li>%doc README.txt </li></ul><ul><li>%config /etc/hello.conf </li></ul><ul><li>%changelog </li></ul><ul><li>* Sun Sep 16 2007 Francesco Crippa <fcrippa@byte-code.com> - 1.0 </li></ul><ul><li>- Initial build. </li></ul>
  • 14. Building RPM <ul><li>“rpm-build” must be installed on your system </li></ul><ul><li>--rmsource help you to keep free your hard disk </li></ul><ul><li>--sign help you to sign package during building </li></ul>[root@a~]# rpmbuild -ba hello.spec [root@a~]# rpm -ba --sign -rmsource hello.spec
  • 15. Sign your security <ul><li>It's possible to sign (or re-sign) your prefered rpms. </li></ul><ul><li>Sign is made by GnuPG </li></ul><ul><li>You can resign a signed package </li></ul><ul><li>You can sign a package during rpm building </li></ul>
  • 16. Racommendations <ul><li>You MUST not use RPM in %pre and %post </li></ul><ul><li>Never use “cp” and “mv” in %pre and %post </li></ul><ul><li>Increment version or release on every build </li></ul><ul><li>You MUST not ask any question to the user during %pre and %post (process must be non-interactive!) </li></ul>
  • 17. Next Step <ul><li>Continuos Build: </li></ul><ul><ul><li>Koji https://hosted.fedoraproject.org/projects/koji/ </li></ul></ul><ul><li>Version Tree Management: </li></ul><ul><ul><li>Bodhi https://hosted.fedoraproject.org/projects/bodhi/ </li></ul></ul>
  • 18.  

×