O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

rpm-building-101.pdf

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio

Confira estes a seguir

1 de 26 Anúncio
Anúncio

Mais Conteúdo rRelacionado

Mais recentes (20)

Anúncio

rpm-building-101.pdf

  1. 1. RPM BUILDING 101: A LAZY ADMIN'S GUIDE FOR BUILDING SOFTWARE TO DEPLOY Created by / Brian Stinson @bstinsonmhk http://kan.st/1G9
  2. 2. AGENDA: Setup What is an RPM? The Spec File The Building Blocks (rpmbuild) Intermediate Tools (mock)
  3. 3. SETUP $ y u m i n s t a l l r p m d e v t o o l s $ e c h o ' % _ t o p d i r / h o m e / b s t i n s o n / r p m b u i l d ' > ~ / . r p m m a c r o s $ r p m d e v ­ s e t u p t r e e
  4. 4. WHAT IS AN RPM? Headers/Metadata CPIO archive name-version-release.arch.rpm python-dateutil-1.5-7.el7.noarch.rpm $ r p m 2 c p i o < y o u r _ p a c k a g e > . r p m | c p i o ­ i v m d
  5. 5. THE SPEC FILE STRUCTURE : METADATA N a m e : p y t h o n ­ d a t e u t i l V e r s i o n : 1 . 5 R e l e a s e : 7 % { ? d i s t } S u m m a r y : P o w e r f u l e x t e n s i o n s t o t h e s t a n d a r d d a t e t i m e m o d u l e G r o u p : D e v e l o p m e n t / L a n g u a g e s L i c e n s e : P y t h o n U R L : h t t p : / / l a b i x . o r g / p y t h o n ­ d a t e u t i l S o u r c e 0 : h t t p : / / l a b i x . o r g / d o w n l o a d / % { n a m e } / % { n a m e } ­ % { v e r s i o n } . t a r . g z P a t c h 0 : p y t h o n ­ d a t e u t i l ­ 1 . 5 ­ s y s t e m ­ z o n e i n f o . p a t c h
  6. 6. THE SPEC FILE STRUCTURE : METADATA B u i l d A r c h : n o a r c h B u i l d R e q u i r e s : p y t h o n ­ d e v e l , p y t h o n ­ s e t u p t o o l s R e q u i r e s : t z d a t a % d e s c r i p t i o n T h e d a t e u t i l m o d u l e p r o v i d e s p o w e r f u l e x t e n s i o n s t o t h e s t a n d a r d d a t e t i m e m o d u l e a v a i l a b l e i n P y t h o n 2 . 3 + .
  7. 7. THE SPEC FILE STRUCTURE : SCRIPTS % p r e p % s e t u p ­ q % p a t c h 0 ­ p 1 i c o n v ­ ­ f r o m = I S O ­ 8 8 5 9 ­ 1 ­ ­ t o = U T F ­ 8 N E W S > N E W S . n e w m v N E W S . n e w N E W S % b u i l d % { _ _ p y t h o n } s e t u p . p y b u i l d % i n s t a l l % { _ _ p y t h o n } s e t u p . p y i n s t a l l ­ ­ s k i p ­ b u i l d ­ ­ r o o t $ R P M _ B U I L D _ R O O T
  8. 8. THE SPEC FILE STRUCTURE : SCRIPTS UNMENTIONED % p r e # J u s t b e f o r e t h e p a c k a g e i s i n s t a l l e d % p o s t # J u s t a f t e r t h e p a c k a g e i s i n s t a l l e d % p r e u n # J u s t b e f o r e t h e p a c k a g e i s r e m o v e d % p o s t u n # J u s t a f t e r t h e p a c k a g e i s r e m o v e d
  9. 9. THE SPEC FILE STRUCTURE : FILE MANIFEST % f i l e s % d o c e x a m p l e . p y L I C E N S E N E W S R E A D M E % { p y t h o n _ s i t e l i b } / d a t e u t i l / % e x c l u d e % { p y t h o n _ s i t e l i b } / d a t e u t i l / z o n e i n f o / z o n e i n f o ­ 2 0 1 0 g . t a r . g z % { p y t h o n _ s i t e l i b } / * . e g g ­ i n f o
  10. 10. THE SPEC FILE STRUCTURE : CHANGELOG % c h a n g e l o g * F r i D e c 2 7 2 0 1 3 D a n i e l M a c h < d m a c h @ r e d h a t . c o m > ­ 1 . 5 ­ 7 ­ M a s s r e b u i l d 2 0 1 3 ­ 1 2 ­ 2 7
  11. 11. MACROS $ r p m ­ ­ e v a l ' % { _ _ p y t h o n } ' / u s r / b i n / p y t h o n
  12. 12. MACROS % p r e p % s e t u p ­ q % p a t c h 0 ­ p 1 i c o n v ­ ­ f r o m = I S O ­ 8 8 5 9 ­ 1 ­ ­ t o = U T F ­ 8 N E W S > N E W S . n e w m v N E W S . n e w N E W S % b u i l d % { _ _ p y t h o n } s e t u p . p y b u i l d % i n s t a l l % { _ _ p y t h o n } s e t u p . p y i n s t a l l ­ ­ s k i p ­ b u i l d ­ ­ r o o t $ R P M _ B U I L D _ R O O T
  13. 13. MACROS : EXPANDED % p r e p % s e t u p ­ q % p a t c h 0 ­ p 1 i c o n v ­ ­ f r o m = I S O ­ 8 8 5 9 ­ 1 ­ ­ t o = U T F ­ 8 N E W S > N E W S . n e w m v N E W S . n e w N E W S % b u i l d / u s r / b i n / p y t h o n s e t u p . p y b u i l d % i n s t a l l / u s r / b i n / p y t h o n s e t u p . p y i n s t a l l ­ ­ s k i p ­ b u i l d ­ ­ r o o t $ R P M _ B U I L D _ R O O T
  14. 14. LET'S BUILD! $ c d ~ / r p m b u i l d / S O U R C E S & & s p e c t o o l ­ g . . / S P E C S / p y t h o n ­ d a t e u t i l . s p e c N a m e : p y t h o n ­ d a t e u t i l V e r s i o n : 1 . 5 . . . S o u r c e 0 : h t t p : / / l a b i x . o r g / d o w n l o a d / % { n a m e } / % { n a m e } ­ % { v e r s i o n } . t a r . g z
  15. 15. WORKING WITH RPMBUILD $ r p m b u i l d ­ b p S P E C S / p y t h o n ­ d a t e u t i l . s p e c % p r e p % s e t u p ­ q % p a t c h 0 ­ p 1 i c o n v ­ ­ f r o m = I S O ­ 8 8 5 9 ­ 1 ­ ­ t o = U T F ­ 8 N E W S > N E W S . n e w m v N E W S . n e w N E W S
  16. 16. WORKING WITH RPMBUILD $ r p m b u i l d [ ­ ­ s h o r t ­ c i r c u i t ] ­ b c S P E C S / p y t h o n ­ d a t e u t i l . s p e c % b u i l d % { _ _ p y t h o n } s e t u p . p y b u i l d
  17. 17. WORKING WITH RPMBUILD $ r p m b u i l d [ ­ ­ s h o r t ­ c i r c u i t ] ­ b i S P E C S / p y t h o n ­ d a t e u t i l . s p e c % i n s t a l l % { _ _ p y t h o n } s e t u p . p y i n s t a l l ­ ­ s k i p ­ b u i l d ­ ­ r o o t $ R P M _ B U I L D _ R O O T
  18. 18. WORKING WITH RPMBUILD Build a Binary RPM $ r p m b u i l d ­ b b Build a Source RPM $ r p m b u i l d ­ b s Build both Binary and Source RPMs $ r p m b u i l d ­ b a
  19. 19. THAT WAS A LOT OF WORK...
  20. 20. PROBLEMS WITH RPMBUILD Lots of BuildRequires packages Only one distro-version at a time $ r p m ­ q a | w c ­ l 8 7 4 5
  21. 21. MOCK TO THE RESCUE! $ y u m i n s t a l l e p e l ­ r e l e a s e $ y u m i n s t a l l m o c k $ u s e r m o d ­ a ­ G m o c k b s t i n s o n & & n e w g r p m o c k Configs for distros/arches are in /etc/mock
  22. 22. BUILDING WITH MOCK Build an SRPM from our Spec File $ c d ~ / r p m b u i l d & & r p m b u i l d ­ b s S P E C S / p y t h o n ­ d a t e u t i l . s p e c
  23. 23. BUILDING WITH MOCK Give Mock our SRPM $ m o c k ­ r c e n t o s ­ 7 ­ x 8 6 _ 6 4 ­ ­ r e b u i l d ~ / r p m b u i l d / S R P M S / p y t h o n ­ d a t e u t i l ­ 1 . 5 ­ 7 . e l 7
  24. 24. BUILD LOGS AND FINAL RPMS / v a r / l i b / m o c k / c e n t o s ­ 7 ­ x 8 6 _ 6 4 / r e s u l t
  25. 25. MORE MOCK $ m o c k ­ r c e n t o s ­ 7 ­ x 8 6 _ 6 4 ­ ­ i n i t $ m o c k ­ r c e n t o s ­ 7 ­ x 8 6 _ 6 4 ­ ­ i n s t a l l . . . $ m o c k ­ r c e n t o s ­ 7 ­ x 8 6 _ 6 4 ­ ­ n o ­ c l e a n ­ ­ r e b u i l d . . . $ m o c k ­ r c e n t o s ­ 7 ­ x 8 6 _ 6 4 ­ ­ s h e l l
  26. 26. FURTHER READING Package Guidelines (Fedora & EPEL): Koji (builds on top of mock): CentOS Community Build System: Your Own Local Yum Repo: https://fedoraproject.org/wiki/Packaging:Guidelines http://www.fedorahosted.org/koji http://wiki.centos.org/HowTos/CommunityBuildSystem http://createrepo.baseurl.org/

×