diff --git a/Makefile b/Makefile index a861d609..778c78c0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=011 +VERSION=010 GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8) prefix ?= /usr @@ -10,9 +10,10 @@ mandir ?= ${prefix}/share/man manpages = dracut.8 dracut.kernel.7 dracut.conf.5 dracut-catimages.8 dracut-gencmdline.8 -.PHONY: install clean archive rpm testimage test all check AUTHORS +.PHONY: install clean archive rpm testimage test all check AUTHORS doc -all: syncheck $(manpages) dracut.html +doc: $(manpages) dracut.html +all: syncheck %: %.xml xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< @@ -23,7 +24,7 @@ dracut.html: dracut.xml $(manpages) --stringparam html.stylesheet http://docs.redhat.com/docs/en-US/Common_Content/css/default.css \ http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml -install: +install: doc mkdir -p $(DESTDIR)$(pkglibdir) mkdir -p $(DESTDIR)$(sbindir) mkdir -p $(DESTDIR)$(sysconfdir) @@ -64,22 +65,15 @@ dracut-$(VERSION).tar.bz2: dracut-$(VERSION).tar.gz: git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz -dracut-$(VERSION)-$(GITVERSION).tar.bz2: - git archive --format=tar HEAD --prefix=dracut-$(VERSION)-$(GITVERSION)/ |bzip2 > dracut-$(VERSION)-$(GITVERSION).tar.bz2 - - -rpm: clean dracut-$(VERSION).tar.bz2 - rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" -ba dracut.spec - rm -fr BUILD BUILDROOT - -gitrpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2 - echo "%define gittag $(GITVERSION)" > dracut.spec.git - cat dracut.spec >> dracut.spec.git - mv dracut.spec dracut.spec.bak - mv dracut.spec.git dracut.spec - rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec || : - mv dracut.spec.bak dracut.spec - rm -fr BUILD BUILDROOT +rpm: dracut-$(VERSION).tar.bz2 + mkdir -p rpmbuild + cp dracut-$(VERSION).tar.bz2 rpmbuild + cd rpmbuild; ../git2spec.pl $(VERSION) < ../dracut.spec > dracut.spec; \ + rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \ + --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \ + --define "_rpmdir $$PWD" -ba dracut.spec || :; \ + cd ..; + rm -fr rpmbuild syncheck: @ret=0;for i in dracut-logger modules.d/99base/init modules.d/*/*.sh; do \ diff --git a/dracut.spec b/dracut.spec index 413ec4e9..edf8d264 100644 --- a/dracut.spec +++ b/dracut.spec @@ -6,17 +6,9 @@ %define with_nbd 0 %endif -%if %{defined gittag} -%define rdist .git%{gittag}%{?dist} -%define dashgittag -%{gittag} -%else -%define rdist %{?dist} -%endif - Name: dracut -Version: 011 -%define release_prefix 0%{?rdist} -Release: %{release_prefix} +Version: xxx +Release: xxx Summary: Initramfs generator using udev %if 0%{?fedora} @@ -28,8 +20,8 @@ Group: System/Base License: GPLv2+ URL: https://dracut.wiki.kernel.org/ # Source can be generated by -# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{?dashgittag};sf=tgz -Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}%{?dashgittag}.tar.bz2 +# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz +Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2 BuildArch: noarch BuildRequires: dash bash @@ -162,7 +154,7 @@ Requires: %{name} = %{version}-%{release} This package contains tools to assemble the local initrd and host configuration. %prep -%setup -q -n %{name}-%{version}%{?dashgittag} +%setup -q -n %{name}-%{version} %build make diff --git a/git2spec.pl b/git2spec.pl new file mode 100755 index 00000000..6e0bff87 --- /dev/null +++ b/git2spec.pl @@ -0,0 +1,66 @@ +#!/usr/bin/perl + +sub last_tag { + open( GIT, 'git log --pretty=format:%H |'); + LINE: while( ) { + open( GIT2, "git tag --contains $_ |"); + while( ) { + chomp; + last LINE if /..*/; + } + close GIT2; + } + $tag=$_; + close GIT2; + close GIT; # be done + return $tag; +}; + +sub create_patches { + my $tag=shift; + my $num=0; + open( GIT, 'git format-patch -M -N --no-signature '.$tag.' |'); + @lines=; + close GIT; # be done + return @lines; +}; +use POSIX qw(strftime); +my $datestr = strftime "%Y%m%d", gmtime; + +my $tag=shift; +$tag=&last_tag if not defined $tag; +my @patches=&create_patches($tag); +my $num=$#patches + 2; +$tag=~s/[^0-9]+?([0-9]+)/$1/; +my $release="$num.git$datestr"; +$release="1" if $num == 1; + +while(<>) { + if (/^Version:/) { + print "Version: $tag\n"; + } + elsif (/^Release:/) { + print "Release: $release\n"; + } + elsif ((/^Source0:/) || (/^Source:/)) { + print $_; + $num=1; + for(@patches) { + print "Patch$num: $_"; + $num++; + } + print "\n"; + } + elsif (/^%setup/) { + print $_; + $num=1; + for(@patches) { + print "%patch$num -p1\n"; + $num++; + } + print "\n"; + } + else { + print $_; + } +}