-sub get_version {
- # Two build cases: from checkout (svn info works), or dist tarball
- # (FULL_VERSION will exist). First try FULL_VERSION, then
- # try svn info, which takes more time and processing. We assume our url
- # is structured something like this:
- # http://<server>/<project>/<trunk|branches|tags>/[<branch>|<tag>]
- # The re is tested on http urls with full DNS names, but ssh+svn:// or
- # file:/// and short DNS names should work too.
-
- my $VERSION;
- my $version_file = "FULL_VERSION";
- my $version_handle;
- my $versioned_tree = 'packaging/deb';
- if (-e $version_file) {
- # Autogen has been run, search FULL_VERSION file.
- if (-e "$version_file") {
- open($version_handle, "<", "$version_file") or
- die "Could not open FULL_VERSION.";
- chomp($VERSION = <$version_handle>);
- close($version_file);
-
- } else {
- die "Could not find FULL_VERSION file.";
- }
- }
- if ( ! $VERSION ) {
- # Autogen has not been run or VERSION macro was found. Try to
- # use svn info.
- my $SVN_URL = "";
- my $SVN_ROOT = "";
- my $SVN_REV = "";
- foreach my $info_line (`svn info $versioned_tree`) {
- $SVN_URL = $1 if $info_line =~ m{^URL: (.*)};
- $SVN_ROOT = $1 if $info_line =~ m{^Repository Root: (.*)};
- $SVN_REV = $1 if $info_line =~ m{^Revision: (.*)};
- }
- my @paths;
- my $BRANCH;
- my $PROJECT;
- my $svn_version;
- # Only newer versions of svn supply Repository Root.
- if ( $SVN_ROOT ) {
- $SVN_URL =~ m/$SVN_ROOT(.*)/;
- my $SVN_PATH = $1;
+sub get_date {
+ my $date;
+ # Set the date using date -r
+ open(my $DATE_PIPE, "-|", "/bin/date '+%a, %d %b %Y %T %z'");
+ [ $? == 0 ] or die "could not read output of date '+%a, %d %b %Y %T %z'";
+ chomp($date = <$DATE_PIPE>);
+ close($DATE_PIPE);
+ return $date;
+};