-VERSION=027
-GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
+RELEASEDVERSION = -- will be replaced by "make dist" --
+VERSION = $(shell [ -d .git ] && git describe --abbrev=0 --tags || echo $(RELEASEDVERSION))
+GITVERSION = $(shell [ -d .git ] && { v=$$(git describe --tags); echo -$${v\#*-}; } )
-include Makefile.inc
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
-.PHONY: install clean archive rpm testimage test all check AUTHORS doc
+.PHONY: install clean archive rpm testimage test all check AUTHORS doc dracut-version.sh
all: syncheck dracut-version.sh dracut-install
install -m 0644 dracut-bash-completion.sh $(DESTDIR)${bashcompletiondir}/dracut
dracut-version.sh:
- @echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
+ @echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
clean:
$(RM) *~
$(RM) $(manpages) dracut.html
$(MAKE) -C test clean
-archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
-
dist: dracut-$(VERSION).tar.bz2
dracut-$(VERSION).tar.bz2: doc
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
mkdir -p dracut-$(VERSION)
cp $(manpages) dracut.html dracut-$(VERSION)
- tar -rf dracut-$(VERSION).tar dracut-$(VERSION)/*.[0-9] dracut-$(VERSION)/dracut.html
+ sed 's/^RELEASEDVERSION =.*/RELEASEDVERSION = $(VERSION)/' Makefile > dracut-$(VERSION)/Makefile
+ tar --owner=root --group=root -rf dracut-$(VERSION).tar dracut-$(VERSION)/*.[0-9] dracut-$(VERSION)/dracut.html dracut-$(VERSION)/Makefile
rm -fr dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
bzip2 -9 dracut-$(VERSION).tar
rm -f dracut-$(VERSION).tar
#!/usr/bin/perl
-sub last_tag {
- open( GIT, 'git log --pretty=format:%H |');
- LINE: while( <GIT> ) {
- open( GIT2, "git tag --contains $_ |");
- while( <GIT2> ) {
- chomp;
- last LINE if /..*/;
- }
- close GIT2;
- }
- $tag=$_;
- close GIT2;
- close GIT; # be done
- return $tag;
-};
-
sub create_patches {
my $tag=shift;
my $pdir=shift;
my $tag=shift;
my $pdir=shift;
-$tag=&last_tag if not defined $tag;
+$tag=`git describe --abbrev=0 --tags` if not defined $tag;
+chomp($tag);
my @patches=&create_patches($tag, $pdir);
my $num=$#patches + 2;
$tag=~s/[^0-9]+?([0-9]+)/$1/;