Blame src/convert_version.pl
|
Packit |
9f0df5 |
#!/usr/bin/env perl
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
# convert_version.pl: generate a version integer from a version text
|
|
Packit |
9f0df5 |
#
|
|
Packit |
9f0df5 |
# Copyright (C) 2006-2008 Ludovic Rousseau <ludovic.rousseau@free.fr>
|
|
Packit |
9f0df5 |
#
|
|
Packit |
9f0df5 |
# This program is free software; you can redistribute it and/or modify
|
|
Packit |
9f0df5 |
# it under the terms of the GNU General Public License as published by
|
|
Packit |
9f0df5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
Packit |
9f0df5 |
# (at your option) any later version.
|
|
Packit |
9f0df5 |
#
|
|
Packit |
9f0df5 |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
9f0df5 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
9f0df5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
9f0df5 |
# GNU General Public License for more details.
|
|
Packit |
9f0df5 |
#
|
|
Packit |
9f0df5 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
9f0df5 |
# along with this program; if not, write to the Free Software
|
|
Packit |
9f0df5 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit |
9f0df5 |
# 02110-1301 USA.
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
use warnings;
|
|
Packit |
9f0df5 |
use strict;
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
# convert "1.2.3-svn-xyz" in "0x01020003"
|
|
Packit |
9f0df5 |
my ($major, $minor, $patch) = split /\./, $ARGV[0];
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
# remove the -svn-xyz part if any
|
|
Packit |
9f0df5 |
$patch =~ s/-.*//;
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
printf "0x%02X%02X%04X\n", $major, $minor, $patch;
|
|
Packit |
9f0df5 |
|