hansode / worklogs

0 stars 0 forks source link

最小rpm/rpmspec作成 #28

Closed hansode closed 9 years ago

hansode commented 9 years ago
hansode commented 9 years ago
yum install -y rpmdevtools 
yum install -y rpmlint 
rpmdev-setuptree
cd ~/rpmbuild/SPECS/
rpmdev-newspec makistrano
vi makistrano.spec
rpmlint makistrano.spec
rpmbuild -bb makistrano.spec
hansode commented 9 years ago
cd ~/rpmbuild/SPECS/
rpmdev-newspec makistrano
hansode commented 9 years ago
$ rpmdev-newspec makistrano
Skeleton specfile (minimal) has been created to "makistrano.spec".
hansode commented 9 years ago
$ cat makistrano.spec
Name:           makistrano
Version:
Release:        1%{?dist}
Summary:

Group:
License:
URL:
Source0:

BuildRequires:
Requires:

%description

%prep
%setup -q

%build
%configure
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc

%changelog
hansode commented 9 years ago
$ cat makistrano.spec
%define _git_uri https://github.com/hansode/makistrano.git

Name:           makistrano
Version:        15.03
Release:        1%{?dist}
Summary:        a kind of bash implementation of Capistrano
BuildArch:      noarch

License:        BSD
URL:            https://github.com/hansode/makistrano
Source0:        %{_git_uri}

BuildRequires:  git
Requires:       bash

%description

%prep
[ -d %{name}-%{version} ] && rm -rf %{name}-%{version}
git clone %{_git_uri} %{name}-%{version}
cd %{name}-%{version}
: # don't delete this line.
%setup -T -D

%build

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/bin
cp -p `pwd`/bin/maki $RPM_BUILD_ROOT/usr/bin/maki

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
/usr/bin/maki
%doc

%changelog
hansode commented 9 years ago
$ rpmbuild -bb makistrano.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.A3JQk3
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ '[' -d makistrano-15.03 ']'
+ rm -rf makistrano-15.03
+ git clone https://github.com/hansode/makistrano.git makistrano-15.03
Initialized empty Git repository in /home/vagrant/rpmbuild/BUILD/makistrano-15.03/.git/
remote: Counting objects: 278, done.
remote: Total 278 (delta 0), reused 0 (delta 0), pack-reused 278
Receiving objects: 100% (278/278), 36.30 KiB, done.
Resolving deltas: 100% (106/106), done.
+ cd makistrano-15.03
+:
+ cd /home/vagrant/rpmbuild/BUILD
+ cd makistrano-15.03
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.gcCNjp
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ cd makistrano-15.03
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.41QFmL
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ '[' /home/vagrant/rpmbuild/BUILDROOT/makistrano-15.03-1.el6.x86_64 '!=' / ']'
+ rm -rf /home/vagrant/rpmbuild/BUILDROOT/makistrano-15.03-1.el6.x86_64
++ dirname /home/vagrant/rpmbuild/BUILDROOT/makistrano-15.03-1.el6.x86_64
+ mkdir -p /home/vagrant/rpmbuild/BUILDROOT
+ mkdir /home/vagrant/rpmbuild/BUILDROOT/makistrano-15.03-1.el6.x86_64
+ cd makistrano-15.03
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /home/vagrant/rpmbuild/BUILDROOT/makistrano-15.03-1.el6.x86_64
+ mkdir -p /home/vagrant/rpmbuild/BUILDROOT/makistrano-15.03-1.el6.x86_64/usr/bin
++ pwd
+ cp -p /home/vagrant/rpmbuild/BUILD/makistrano-15.03/bin/maki /home/vagrant/rpmbuild/BUILDROOT/makistrano-15.03-1.el6.x86_64/usr/bin/maki
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /home/vagrant/rpmbuild/BUILD/makistrano-15.03
+ /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: makistrano-15.03-1.el6.noarch
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: /bin/bash
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/vagrant/rpmbuild/BUILDROOT/makistrano-15.03-1.el6.x86_64
warning: Could not canonicalize hostname: vagrant-centos6
Wrote: /home/vagrant/rpmbuild/RPMS/noarch/makistrano-15.03-1.el6.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.8ISawv
+ umask 022
+ cd /home/vagrant/rpmbuild/BUILD
+ cd makistrano-15.03
+ rm -rf /home/vagrant/rpmbuild/BUILDROOT/makistrano-15.03-1.el6.x86_64
+ exit 0
hansode commented 9 years ago
diff --git a/makistrano.spec b/makistrano.spec
index 35da9cb..131fb37 100644
--- a/makistrano.spec
+++ b/makistrano.spec
@@ -1,31 +1,36 @@
+%define _git_uri https://github.com/hansode/makistrano.git
+
 Name:           makistrano
-Version:
+Version:        15.03
 Release:        1%{?dist}
-Summary:
+Summary:        a kind of bash implementation of Capistrano
+BuildArch:      noarch

-Group:
-License:
-URL:
-Source0:
+License:        BSD
+URL:            https://github.com/hansode/makistrano
+Source0:        %{_git_uri}

-BuildRequires:
-Requires:
+BuildRequires:  git
+Requires:       bash

 %description

 %prep
-%setup -q
+[ -d %{name}-%{version} ] && rm -rf %{name}-%{version}
+git clone %{_git_uri} %{name}-%{version}
+cd %{name}-%{version}
+: # don't delete this line.
+%setup -T -D

 %build
-%configure
-make %{?_smp_mflags}

 %install
 rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/usr/bin
+cp -p `pwd`/bin/maki $RPM_BUILD_ROOT/usr/bin/maki

 %clean
@@ -34,6 +39,7 @@ rm -rf $RPM_BUILD_ROOT

 %files
 %defattr(-,root,root,-)
+/usr/bin/maki
 %doc
hansode commented 9 years ago
$ ls -la /home/vagrant/rpmbuild/RPMS/noarch/makistrano-15.03-1.el6.noarch.rpm
-rw-r--r-- 1 vagrant vagrant 2764 Mar 15 17:36 /home/vagrant/rpmbuild/RPMS/noarch/makistrano-15.03-1.el6.noarch.rpm
hansode commented 9 years ago
[vagrant@vagrant-centos6 SPECS]$ sudo yum install -y /home/vagrant/rpmbuild/RPMS/noarch/makistrano-15.03-1.el6.noarch.rpm
Loaded plugins: fastestmirror
Setting up Install Process
Examining /home/vagrant/rpmbuild/RPMS/noarch/makistrano-15.03-1.el6.noarch.rpm: makistrano-15.03-1.el6.noarch
Marking /home/vagrant/rpmbuild/RPMS/noarch/makistrano-15.03-1.el6.noarch.rpm to be installed
Loading mirror speeds from cached hostfile
 * base: mirror.fairway.ne.jp
 * extras: mirror.fairway.ne.jp
 * updates: mirror.fairway.ne.jp
Resolving Dependencies
--> Running transaction check
---> Package makistrano.noarch 0:15.03-1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================================================================================================
 Package                                           Arch                                          Version                                               Repository                                                             Size
===================================================================================================================================================================================================================================
Installing:
 makistrano                                        noarch                                        15.03-1.el6                                           /makistrano-15.03-1.el6.noarch                                        2.3 k

Transaction Summary
===================================================================================================================================================================================================================================
Install       1 Package(s)

Total size: 2.3 k
Installed size: 2.3 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : makistrano-15.03-1.el6.noarch                                                                                                                                                                                   1/1
  Verifying  : makistrano-15.03-1.el6.noarch                                                                                                                                                                                   1/1

Installed:
  makistrano.noarch 0:15.03-1.el6

Complete!
hansode commented 9 years ago
[vagrant@vagrant-centos6 SPECS]$ type -P maki
/usr/bin/maki
[vagrant@vagrant-centos6 SPECS]$ ls -l /usr/bin/maki
-rwxr-xr-x 1 root root 2391 Mar 15 17:36 /usr/bin/maki
hansode commented 9 years ago
[vagrant@vagrant-centos6 SPECS]$ sudo yum remove makistrano
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package makistrano.noarch 0:15.03-1.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================================================================================================
 Package                                           Arch                                          Version                                              Repository                                                              Size
===================================================================================================================================================================================================================================
Removing:
 makistrano                                        noarch                                        15.03-1.el6                                          @/makistrano-15.03-1.el6.noarch                                        2.3 k

Transaction Summary
===================================================================================================================================================================================================================================
Remove        1 Package(s)

Installed size: 2.3 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : makistrano-15.03-1.el6.noarch                                                                                                                                                                                   1/1
  Verifying  : makistrano-15.03-1.el6.noarch                                                                                                                                                                                   1/1

Removed:
  makistrano.noarch 0:15.03-1.el6

Complete!
hansode commented 9 years ago
[vagrant@vagrant-centos6 SPECS]$ yum info makistrano
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.fairway.ne.jp
 * extras: mirror.fairway.ne.jp
 * updates: mirror.fairway.ne.jp
Installed Packages
Name        : makistrano
Arch        : noarch
Version     : 15.03
Release     : 1.el6
Size        : 2.3 k
Repo        : installed
From repo   : /makistrano-15.03-1.el6.noarch
Summary     : a kind of bash implementation of Capistrano
URL         : https://github.com/hansode/makistrano
License     : BSD
Description :
hansode commented 9 years ago
[vagrant@vagrant-centos6 SPECS]$ rpm -ql makistrano
/usr/bin/maki
hansode commented 9 years ago
[vagrant@vagrant-centos6 SPECS]$ rpm -qi makistrano
Name        : makistrano                   Relocations: (not relocatable)
Version     : 15.03                             Vendor: (none)
Release     : 1.el6                         Build Date: Sun 15 Mar 2015 05:36:52 PM JST
Install Date: Sun 15 Mar 2015 05:46:30 PM JST      Build Host: vagrant-centos6
Group       : Unspecified                   Source RPM: makistrano-15.03-1.el6.src.rpm
Size        : 2391                             License: BSD
Signature   : (none)
URL         : https://github.com/hansode/makistrano
Summary     : a kind of bash implementation of Capistrano
Description :