Skip to contentSkip to conversation

Btrfs-progs Add spec file template and script to create tarball

PATCH In review Gene Czarcinski 2 participants 6 messages Jan 22, 2013 – Jan 23, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Btrfs-progs Add spec file template and script to create tarball

This series of patches adds an rpm spec file template for btrfs-progs and a script to create an archive/tarball which includes an updated spec file.

The "optional" second patch adds make archive which executes do-archve.sh.

The "optional" third patch changes version.sh and btrfs-progs.spec.in to handle future updates when the version changes.

Gene Czarcinski (3):
Btrfs-progs Add rpm spec template and create tarball Btrfs-progs Add make archive
Btrfs-progs Change rpm spec file to be handle version This
"optional" patch changes version.sh and the rpm spec file to handle changes in the version and still work properly. The
"default" version in version.sh is changed to VERSION and
v="$VERSION". The rpm spec file now update \$VERSION which will
not change. Signed-off-by: Gene Czarcinski <[email protected]>

 Makefile            |  6 +++++-
 btrfs-progs.spec.in | 46 +++++++++++++++++++++++++++++++++++++++
 do-archive.sh       | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 version.sh          |  3 ++-
 4 files changed, 115 insertions(+), 2 deletions(-)
 create mode 100644 btrfs-progs.spec.in
 create mode 100644 do-archive.sh
Signature · 1 line
1.8.1
#1 lore raw

PATCH 1/3 Btrfs-progs Add rpm spec template and create tarball

This patch adds a rpm spec file template for btrfs-progs.

The do-archive.sh script creates/updates the rpm spec file and creates an archive of the current branch if the btrfs-progs git repository does not have uncommitted changes. The created archive/tarball is of the form:

      btrfs-progs-git20130122.tar.gz
where the "version" is "git" appended with the date.  The "version"
is also plugged into the rpm spec file.  Additionally, the result of
      git describe --tags

is plugged into the rpm spec file so that version.sh will be updated with the "current" version just like it would be if created in the git repository. See the comments in the do-archive.sh file for additional information.

---
 btrfs-progs.spec.in | 46 +++++++++++++++++++++++++++++++++++++++
 do-archive.sh       | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+)
 create mode 100644 btrfs-progs.spec.in
 create mode 100644 do-archive.sh
btrfs-progs.spec.in new file +46 -0
new file mode 100644
index 0000000..b64e404
@@ -0,0 +1,46 @@
+Name:		btrfs-progs
+Version:	@VERSION@
+Release:	0
+Epoch:		1
+# Use epoch to override distribution packages
+%define	real_version @REALVERSION@
+URL:            http://btrfs.wiki.kernel.org/index.php/Main_Page
+Summary:	Btrfs File System Utilities: %{real_version}
+License:	GPL v2 or later
+Group:          System Environment/Base
+
+Source0:	%{name}-%{version}.tar.gz
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires:  e2fsprogs-devel, libuuid-devel, zlib-devel, libacl-devel, libblkid-devel
+
+%define _root_sbindir /sbin
+
+%description
+The btrfs-progs package provides all the userpsace programs needed to create,
+check, modify and correct any inconsistencies in the btrfs filesystem.
+
+%prep
+%setup -q -c
+sed -i s/v0.20-rc1/%{real_version}/g $RPM_BUILD_DIR/%{name}-%{version}/version.sh
+
+%build
+make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make mandir=%{_mandir} bindir=%{_sbindir} install DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root)
+%doc COPYING INSTALL
+%{_sbindir}/*
+%{_mandir}/man8/*
+
+%changelog
+* Mon Jan 22 2013 Gene Czarcinski <[email protected]>
+- Initial generic rpm spec file.
+- note that much of this is from the Fedora 18 spec file.
do-archive.sh new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.8.1
#2 lore raw

PATCH 2/3 Btrfs-progs Add make archive

In reply to Gene Czarcinski

This adds the archive target to the Makefile which simply executes do-archive.sh. It also adds the remove of btrfs-progs.spec.in to make clean.

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +5 -1
index d524f69..6812258 100644
@@ -111,9 +111,13 @@ manpages:
 install-man:
 	cd man; $(MAKE) install
 
+archive:
+	bash do-archive.sh
+
 clean :
 	rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \
-	      btrfs-zero-log btrfstune dir-test ioctl-test quick-test version.h
+	      btrfs-zero-log btrfstune dir-test ioctl-test quick-test version.h \
+	      btrfs-progs.spec
 	cd man; $(MAKE) clean
 
 install: $(progs) install-man
Signature · 1 line
1.8.1
#5 lore raw

PATCH 3/3 Btrfs-progs Change rpm spec file to be handle version This "optional" patch changes version.sh and the rpm spec file to handle changes in the version and still work properly. The "default" version in version.sh is changed to VERSION and v="$VERSION". The rpm spec file now update \$VERSION which will not change. Signed-off-by: Gene Czarcinski <[email protected]>

In reply to Gene Czarcinski
---
 btrfs-progs.spec.in | 2 +-
 version.sh          | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
btrfs-progs.spec.in +1 -1
index b64e404..882efc7 100644
@@ -22,7 +22,7 @@ check, modify and correct any inconsistencies in the btrfs filesystem.
 
 %prep
 %setup -q -c
-sed -i s/v0.20-rc1/%{real_version}/g $RPM_BUILD_DIR/%{name}-%{version}/version.sh
+sed -i s/\$VERSION/%{real_version}/g $RPM_BUILD_DIR/%{name}-%{version}/version.sh
 
 %build
 make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
version.sh +2 -1
index b81040e..84513a3 100644
@@ -6,7 +6,8 @@
 # Copyright 2008, Oracle
 # Released under the GNU GPLv2
  
-v="v0.20-rc1"
+VERSION="v0.20-rc1"
+v="$VERSION"
 
 which git &> /dev/null
 if [ $? == 0 -a -d .git ]; then
Signature · 1 line
1.8.1
#3 lore raw

Re: [PATCH 2/3] Btrfs-progs Add make archive

In reply to Gene Czarcinski
Quoted 2 lines · Gene Czarcinski

This adds the archive target to the Makefile which simply executes do-archive.sh. It also adds the remove of btrfs-progs.spec.in to

I think you mean btrfs-progs.spec without the .in as that's the generated file.

Quoted 26 lines

make clean.

---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +5 -2
index d524f69..6812258 100644
@@ -111,9 +111,13 @@ manpages:
 install-man:
        cd man; $(MAKE) install
 
+archive:
+       bash do-archive.sh
+
 clean :
        rm -f $(progs) cscope.out *.o .*.d btrfs-convert btrfs-image btrfs-select-super \
-             btrfs-zero-log btrfstune dir-test ioctl-test quick-test version.h
+             btrfs-zero-log btrfstune dir-test ioctl-test quick-test version.h \
+             btrfs-progs.spec
        cd man; $(MAKE) clean
 
 install: $(progs) install-man
--
Quoted 1 line

1.8.1

Mike

#4 lore raw

Re: [PATCH 2/3] Btrfs-progs Add make archive

Quoted 5 lines · Mike Fleetwood
Quoted 2 lines · Gene Czarcinski
Quoted 2 lines

This adds the archive target to the Makefile which simply executes do-archive.sh. It also adds the remove of btrfs-progs.spec.in to

I think you mean btrfs-progs.spec without the .in as that's the generated file.

You are correct.