diff options
| author | Paul Buetow <paul@buetow.org> | 2012-04-21 12:30:58 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2012-04-21 12:30:58 +0200 |
| commit | e682c81a46d1f96e9f44a742e8f949d5935e5f79 (patch) | |
| tree | d5cbc6490e0c6a728e281c991f829b16ef25ebcb | |
| parent | 109b41b1368b44377f1d6228659bf920718cadf0 (diff) | |
version number is not hard coded anymore
| -rw-r--r-- | .version | 1 | ||||
| -rw-r--r-- | MUSTTODO | 1 | ||||
| -rw-r--r-- | Makefile | 9 | ||||
| -rw-r--r-- | debian/changelog | 6 | ||||
| -rw-r--r-- | debian/files | 2 | ||||
| -rw-r--r-- | docs/loadbars.1 | 2 | ||||
| -rw-r--r-- | lib/Loadbars/Constants.pm | 1 | ||||
| -rw-r--r-- | lib/Loadbars/Main.pm | 3 | ||||
| -rw-r--r-- | lib/Loadbars/Utils.pm | 18 |
9 files changed, 35 insertions, 8 deletions
diff --git a/.version b/.version new file mode 100644 index 0000000..a2a1a9a --- /dev/null +++ b/.version @@ -0,0 +1 @@ +0.5.2.1+nmu1 diff --git a/MUSTTODO b/MUSTTODO deleted file mode 100644 index 540f451..0000000 --- a/MUSTTODO +++ /dev/null @@ -1 +0,0 @@ -VERSION constant should be equal to version in ./debian/changelog @@ -1,11 +1,13 @@ NAME=loadbars -all: documentation perltidy +all: version documentation perltidy +version: + cut -d' ' -f2 debian/changelog | head -n 1 | sed 's/(//;s/)//' > .version perltidy: find . -name \*.pm | xargs perltidy -b perltidy -b $(NAME) find . -name \*.bak -delete documentation: - pod2man --release="$(NAME) $$(cut -d' ' -f2 debian/changelog | head -n 1 | sed 's/(//;s/)//')" \ + pod2man --release="$(NAME) $$(cat .version)" \ --center="User Commands" ./docs/$(NAME).pod > ./docs/$(NAME).1 pod2text ./docs/$(NAME).pod > ./docs/$(NAME).txt install: @@ -14,8 +16,11 @@ install: cp $(NAME) $(DESTDIR)/usr/bin cp -r ./lib $(DESTDIR)/usr/share/$(NAME)/lib cp -r ./fonts $(DESTDIR)/usr/share/$(NAME)/fonts + cp ./.version $(DESTDIR)/usr/share/$(NAME)/version deinstall: test ! -z "$(DESTDIR)" && test -f $(DESTDIR)/usr/bin/$(NAME) && rm $(DESTDIR)/usr/bin/$(NAME) || exit 0 test ! -z "$(DESTDIR)/usr/share/$(NAME)" && -d $(DESTDIR)/usr/share/$(NAME) && rm -r $(DESTDIR)/usr/share/$(NAME) || exit 0 +clean: + test -f .version && rm .version deb: dpkg-buildpackage diff --git a/debian/changelog b/debian/changelog index 1a168b9..4d025ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +loadbars (0.5.2.1+nmu1) stable; urgency=low + + * Version number is not hard coded anymore + + -- Paul Buetow <paul@buetow.org> Sun, 08 Apr 2012 15:23:53 +0200 + loadbars (0.5.2.1) stable; urgency=low * Hotfix release, contains only a corrected version string. diff --git a/debian/files b/debian/files index 5e56941..0f1fef0 100644 --- a/debian/files +++ b/debian/files @@ -1 +1 @@ -loadbars_0.5.2.1_all.deb utils optional +loadbars_0.5.2.1+nmu1_all.deb utils optional diff --git a/docs/loadbars.1 b/docs/loadbars.1 index 1c982ab..96e7ad8 100644 --- a/docs/loadbars.1 +++ b/docs/loadbars.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "LOADBARS 1" -.TH LOADBARS 1 "2012-04-20" "loadbars 0.5.2.1" "User Commands" +.TH LOADBARS 1 "2012-04-20" "loadbars 0.5.2.1+nmu1" "User Commands" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/lib/Loadbars/Constants.pm b/lib/Loadbars/Constants.pm index adffc47..e21c93a 100644 --- a/lib/Loadbars/Constants.pm +++ b/lib/Loadbars/Constants.pm @@ -6,7 +6,6 @@ use warnings; use SDL::Color; use constant { - VERSION => 'loadbars v0.5.2.1', COPYRIGHT => '2010-2012 (c) Paul Buetow <loadbars@mx.buetow.org>', CONFFILE => $ENV{HOME} . '/.loadbarsrc', CSSH_CONFFILE => '/etc/clusters', diff --git a/lib/Loadbars/Main.pm b/lib/Loadbars/Main.pm index 5b8f161..199a2e4 100644 --- a/lib/Loadbars/Main.pm +++ b/lib/Loadbars/Main.pm @@ -295,8 +295,7 @@ sub loop ($@) { $C{width} = $C{barwidth}; my $app = SDL::App->new( - -title => Loadbars::Constants->VERSION - . ' (press h for help on stdout)', + -title => 'Loadbars ' . get_version . ' (press h for help on stdout)', -icon_title => Loadbars::Constants->VERSION, -width => $C{width}, -height => $C{height}, diff --git a/lib/Loadbars/Utils.pm b/lib/Loadbars/Utils.pm index bfb8027..df5e0f7 100644 --- a/lib/Loadbars/Utils.pm +++ b/lib/Loadbars/Utils.pm @@ -18,6 +18,7 @@ our @EXPORT = qw ( say sum trim + get_version ); sub say (@) { print "$_\n" for @_; return undef } @@ -38,4 +39,21 @@ sub display_info_no_nl ($) { print "==> " . (shift) . ' ' } sub display_info ($) { say "==> " . shift } sub display_warn ($) { say "!!! " . shift } +sub get_version () { + my $versionfile = do { + if ( -f '.version' ) { + '.version'; + } + else { + '/usr/share/loadbars/version'; + } + }; + + open my $fh, $versionfile or error("$!: $versionfile"); + my $version = <$fh>; + close $fh; + + return $version; +} + 1; |
