Re: [rtems commit] psxtests: Remove bogus file

2019-02-12 Thread Joel Sherrill
Is this file present with a .c extension?

This is a math.h method and there should be a test verifying the prototype
is correct.


On Tue, Feb 12, 2019, 3:27 AM Sebastian Huber  Module:rtems
> Branch:master
> Commit:7fdcd02338a5d58122105e3bcd41ed9b8cd184e8
> Changeset:
> http://git.rtems.org/rtems/commit/?id=7fdcd02338a5d58122105e3bcd41ed9b8cd184e8
>
> Author:Sebastian Huber 
> Date:  Tue Feb 12 10:26:34 2019 +0100
>
> psxtests: Remove bogus file
>
> This file is unused and makes trouble on Windows.
>
> Updates #3638.
>
> ---
>
>  testsuites/psxtests/psxhdrs/math/expm1. | 38
> -
>  1 file changed, 38 deletions(-)
>
> diff --git a/testsuites/psxtests/psxhdrs/math/expm1.
> b/testsuites/psxtests/psxhdrs/math/expm1.
> deleted file mode 100644
> index bef42e1..000
> --- a/testsuites/psxtests/psxhdrs/math/expm1.
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -/**
> - *  @file
> - *  @brief exp() API Conformance Test
> - */
> -
> - /*
> -  *  COPYRIGHT (c) 2018.
> -  *  Shashvat Jain
> -  *
> -  *  Permission to use, copy, modify, and/or distribute this software
> -  *  for any purpose with or without fee is hereby granted.
> -  *
> -  *  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
> -  *  WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
> -  *  WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
> AUTHOR
> -  *  BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
> -  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
> PROFITS,
> -  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
> ACTION,
> -  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
> SOFTWARE.
> -  */
> -
> -#ifdef HAVE_CONFIG_H
> -#include "config.h"
> -#endif
> -
> -#include 
> -
> -int test( void );
> -
> -int test( void )
> -{
> -  double x = 0 ;
> -  double result ;
> -
> -  result = expm1(x) ;
> -
> -  return (result);
> -}
>
> ___
> vc mailing list
> v...@rtems.org
> http://lists.rtems.org/mailman/listinfo/vc
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [rtems commit] psxtests: Remove bogus file

2019-02-12 Thread Sebastian Huber

On 12/02/2019 13:33, Joel Sherrill wrote:

Is this file present with a .c extension?


Yes.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH] score: Avoid some deadlocks in _Once()

2019-02-12 Thread Sebastian Huber
Recursive usage of the same pthread_once_t results now in a deadlock.
Previously, an error of EINVAL was returned.  This usage scenario is
invalid according to the POSIX pthread_once() specification.

Close #3334.
---
 cpukit/include/rtems/score/onceimpl.h   |  10 ++-
 cpukit/rtems/src/timerserver.c  |   5 +-
 cpukit/score/src/once.c | 117 ++--
 testsuites/psxtests/psxonce01/init.c|  82 ---
 testsuites/psxtests/psxonce01/psxonce01.scn |  15 ++--
 testsuites/psxtests/psxonce01/system.h  |   2 +-
 testsuites/sptests/spcxx01/init.cc  |  21 -
 testsuites/sptests/spcxx01/spcxx01.doc  |   2 +
 8 files changed, 183 insertions(+), 71 deletions(-)

diff --git a/cpukit/include/rtems/score/onceimpl.h 
b/cpukit/include/rtems/score/onceimpl.h
index 60f1378506..f3afe1cd13 100644
--- a/cpukit/include/rtems/score/onceimpl.h
+++ b/cpukit/include/rtems/score/onceimpl.h
@@ -7,7 +7,7 @@
  */
 
 /*
- * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
+ * Copyright (c) 2014, 2019 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -23,6 +23,8 @@
 #ifndef _RTEMS_ONCE_H
 #define _RTEMS_ONCE_H
 
+#include 
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -37,11 +39,11 @@ extern "C" {
  * @{
  */
 
-int _Once( unsigned char *once_state, void (*init_routine)(void) );
+int _Once( unsigned char *once_state, void ( *init_routine )( void ) );
 
-void _Once_Lock( void );
+Thread_Life_state _Once_Lock( void );
 
-void _Once_Unlock( void );
+void _Once_Unlock( Thread_Life_state thread_life_state );
 
 /** @} */
 
diff --git a/cpukit/rtems/src/timerserver.c b/cpukit/rtems/src/timerserver.c
index 09e792aa1c..55c3d96b9b 100644
--- a/cpukit/rtems/src/timerserver.c
+++ b/cpukit/rtems/src/timerserver.c
@@ -228,10 +228,11 @@ rtems_status_code rtems_timer_initiate_server(
 )
 {
   rtems_status_code status;
+  Thread_Life_state thread_life_state;
 
-  _Once_Lock();
+  thread_life_state = _Once_Lock();
   status = _Timer_server_Initiate( priority, stack_size, attribute_set );
-  _Once_Unlock();
+  _Once_Unlock( thread_life_state );
 
   return status;
 }
diff --git a/cpukit/score/src/once.c b/cpukit/score/src/once.c
index 5237c11878..5df44c96e7 100644
--- a/cpukit/score/src/once.c
+++ b/cpukit/score/src/once.c
@@ -1,68 +1,99 @@
 /*
- *  COPYRIGHT (c) 1989-1999.
- *  On-Line Applications Research Corporation (OAR).
+ * SPDX-License-Identifier: BSD-2-Clause
  *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
+ * Copyright (C) 2019 embedded brains GmbH
+ * Copyright (C) 2019 Sebastian Huber
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifdef HAVE_CONFIG_H
-  #include "config.h"
+#include "config.h"
 #endif
 
 #include 
-#include 
+#include 
+#include 
+
+#define ONCE_STATE_INIT 0
 
-#include 
+#define ONCE_STATE_RUNNING 1
 
-#define ONCE_STATE_NOT_RUN  0
-#define ONCE_STATE_RUNNING  1
 #define ONCE_STATE_COMPLETE 2
 
+typedef struct {
+  rtems_mutex  Mutex;
+  rtems_condition_variable State;
+} Once_Control;
+
+static Once_Control _Once_Information = {
+  .Mutex = RTEMS_MUTEX_INITIALIZER( "_Once" ),
+  .State = RTEMS_CONDITION_VARIABLE_INITIALIZER( "_Once" )
+};
+
 int _Once( unsigned char *once_state, void ( *init_routine )( void ) )
 {
-  int eno = 0;
-
-  if ( *once_state != ONCE_STATE_COMPLETE ) {
-_Once_Lock();
-
-/*
- * Getting to here means the once_control is locked so we have:
- *  1. The init has not run and the state is ONCE_STATE_NOT_RUN.
- *  2. The init has 

Re: [PATCH v2 04/10] user: Add "Obtain the Sources" section

2019-02-12 Thread Joel Sherrill
On Tue, Feb 12, 2019 at 12:18 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 12/02/2019 03:48, Chris Johns wrote:
> >> We chose
> >> +:file:`$HOME/quick-start/rtems/5` as the installation prefix.
> >> +
> >> +You need at least two source archives or Git repositories to work with
> RTEMS.
> >> +You can download the source archives for a released RTEMS version or
> you can
> >> +clone Git repositories to get all versions of RTEMS including the
> development
> >> +head.
> >> +
> >> +We will clone the Git repositories into :file:`$HOME/quick-start/src`.
> >> +
> >> +.. code-block:: none
> >> +
> >> +mkdir -p $HOME/quick-start/src
> >> +cd $HOME/quick-start/src
> >> +git clonehttps://git.rtems.git/rtems-source-builder  rsb
> >> +git clonehttps://git.rtems.git/rtems
> > I feel we need the https access to git fixed for this to be in the doco.
> I have
> > no idea how to sort this out. We have and are supporting git:// so may
> be this
> > should be documented and the alternative added as helper for those who
> cannot to
> > git via the git protocol?
>
> We should fix our HTTPS clone support or use Github as the default
> source for read-only clones.


Is there a ticket for supporting https clones?


> From my point of view offering the Git
> protocol is user unfriendly. The clone via HTTPS works everywhere, even
> behind firewalls and proxies.
>

Perhaps a word is missing in your response.

Some have to use https and we should support it. I wouldn't recommend it
as a first choice. If someone doesn't have to use it, then they should use
the
native git protocol.

--joel


>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail  : sebastian.hu...@embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v2 04/10] user: Add "Obtain the Sources" section

2019-02-12 Thread Chris Johns
On 13/2/19 7:41 am, Joel Sherrill wrote:
> 
> 
> On Tue, Feb 12, 2019 at 12:18 AM Sebastian Huber
>  >
> wrote:
> 
> On 12/02/2019 03:48, Chris Johns wrote:
> >> We chose
> >> +:file:`$HOME/quick-start/rtems/5` as the installation prefix.
> >> +
> >> +You need at least two source archives or Git repositories to work with
> RTEMS.
> >> +You can download the source archives for a released RTEMS version or 
> you can
> >> +clone Git repositories to get all versions of RTEMS including the
> development
> >> +head.
> >> +
> >> +We will clone the Git repositories into :file:`$HOME/quick-start/src`.
> >> +
> >> +.. code-block:: none
> >> +
> >> +    mkdir -p $HOME/quick-start/src
> >> +    cd $HOME/quick-start/src
> >> +    git clonehttps://git.rtems.git/rtems-source-builder  rsb
> >> +    git clonehttps://git.rtems.git/rtems
> > I feel we need the https access to git fixed for this to be in the 
> doco. I
> have
> > no idea how to sort this out. We have and are supporting git:// so may 
> be this
> > should be documented and the alternative added as helper for those who
> cannot to
> > git via the git protocol?
> 
> We should fix our HTTPS clone support or use Github as the default
> source for read-only clones.
> 
> 
> Is there a ticket for supporting https clones?

Yes it is https://devel.rtems.org/ticket/3683

>  
> 
> From my point of view offering the Git
> protocol is user unfriendly. The clone via HTTPS works everywhere, even
> behind firewalls and proxies.
> 
> 
> Perhaps a word is missing in your response. 
> 
> Some have to use https and we should support it. I wouldn't recommend it
> as a first choice. If someone doesn't have to use it, then they should use the
> native git protocol.

I have considered this over night and realised we currently fully support the
git protocol from our servers. Until we have a fully working https access to our
repos on our servers I feel we need to document what we have which is the git
protocol. A note or sidebar about https is something we should have, it is
important for some users.

We should also see what the issue is supporting https access and resolve it one
way or the other. I will update the ticket adding a link to these posts.

In relation to github, having read-only updated versions of our repos hosted
there is fine but github is a company and we have no insight, access or ability
to sway what they do and what they provide so you will have a hard time
convincing me we should have those repos documented in a our user manuals as the
primary location to get RTEMS from.

This also rolls into the issue of releases and I feel the the user manual should
focus on the tar files for releases and git access as a means of accessing
releases should be moved to an advanced topic. I am happy to leave what is in
the patch about this until we have our house in order and a release candidate
has been created. It is only tar balls that have a proper RTEMS version string,
git builds from the release branch or a tag will not. I will step hard on anyone
deploying and creating a release where the version string matches an existing or
future RTEMS version string.

Finally if our servers are not doing what users want then please ask how you can
help or help by funding work to get things done on them. Yes https access for
git is an issue but I consider having IRC logs or automatically updating doxygen
reports online as more important tasks.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH v3] Coverage : Add coverage support for RISCV

2019-02-12 Thread Joel Sherrill
Doh! If I am ok with it being merged, I should have pushed it.

Sorry. I still am not 100% well and suffering from cold meds.

--joel

On Tue, Feb 12, 2019 at 4:17 PM Joel Sherrill 
wrote:

> Just to be clear. I am OK with this being merged.
>
>
>
> On Tue, Feb 5, 2019 at 10:45 AM Vijay Kumar Banerjee <
> vijaykumar9...@gmail.com> wrote:
>
>> ---
>>  tester/covoar/TargetFactory.cc   |  2 +
>>  tester/covoar/Target_riscv.cc| 83 +
>>  tester/covoar/Target_riscv.h | 95 
>>  tester/covoar/wscript|  3 +-
>>  tester/rtems/testing/bsps/griscv-sis-cov.ini | 40 +
>>  5 files changed, 222 insertions(+), 1 deletion(-)
>>  create mode 100644 tester/covoar/Target_riscv.cc
>>  create mode 100644 tester/covoar/Target_riscv.h
>>  create mode 100644 tester/rtems/testing/bsps/griscv-sis-cov.ini
>>
>> diff --git a/tester/covoar/TargetFactory.cc
>> b/tester/covoar/TargetFactory.cc
>> index fc9c30b..12de94d 100644
>> --- a/tester/covoar/TargetFactory.cc
>> +++ b/tester/covoar/TargetFactory.cc
>> @@ -23,6 +23,7 @@
>>  #include "Target_powerpc.h"
>>  #include "Target_lm32.h"
>>  #include "Target_sparc.h"
>> +#include "Target_riscv.h"
>>
>>  namespace Target {
>>
>> @@ -56,6 +57,7 @@ namespace Target {
>>  { "m68k",Target_m68k_Constructor },
>>  { "powerpc", Target_powerpc_Constructor },
>>  { "sparc",   Target_sparc_Constructor },
>> +{ "riscv",   Target_riscv_Constructor },
>>  { "TBD", NULL },
>>};
>>
>> diff --git a/tester/covoar/Target_riscv.cc b/tester/covoar/Target_riscv.cc
>> new file mode 100644
>> index 000..279dc6a
>> --- /dev/null
>> +++ b/tester/covoar/Target_riscv.cc
>> @@ -0,0 +1,83 @@
>> +/*
>> + * RTEMS Tools Project (http://www.rtems.org/)
>> + * Copyright 2019 Vijay K. Banerjee 
>> + * All rights reserved.
>> + *
>> + * This file is part of the RTEMS Tools package in 'rtems-tools'.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> are met:
>> + *
>> + * 1. Redistributions of source code must retain the above copyright
>> notice,
>> + * this list of conditions and the following disclaimer.
>> + *
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> notice,
>> + * this list of conditions and the following disclaimer in the
>> documentation
>> + * and/or other materials provided with the distribution.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
>> "AS IS"
>> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
>> THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>> PURPOSE
>> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
>> CONTRIBUTORS BE
>> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
>> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
>> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
>> BUSINESS
>> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
>> IN
>> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
>> OTHERWISE)
>> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
>> OF THE
>> + * POSSIBILITY OF SUCH DAMAGE.
>> + */
>> +
>> +/*! @file Target_riscv.cc
>> + *  @brief Target_riscv Implementation
>> + */
>> +
>> +#include "Target_riscv.h"
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +namespace Target {
>> +
>> +  Target_riscv::Target_riscv( std::string targetName ):
>> +TargetBase( targetName )
>> +  {
>> +branchInstructions.push_back("beqz");
>> +branchInstructions.push_back("bnez");
>> +branchInstructions.push_back("blez");
>> +branchInstructions.push_back("bgez");
>> +branchInstructions.push_back("bltz");
>> +branchInstructions.push_back("bgt");
>> +branchInstructions.push_back("bgtz");
>> +branchInstructions.push_back("ble");
>> +branchInstructions.push_back("bgtu");
>> +branchInstructions.push_back("bleu");
>> +
>> +branchInstructions.sort();
>> +   }
>> +
>> +  Target_riscv::~Target_riscv()
>> +  {
>> +  }
>> +
>> +  bool Target_riscv::isNopLine(
>> +const char* const line,
>> +int&  size
>> +)
>> +  {
>> +if (!strcmp( &line[strlen(line)-3], "nop")){
>> +size = 4;
>> +return true;
>> +}
>> +
>> +  return false;
>> +  }
>> +
>> +  TargetBase *Target_riscv_Constructor(
>> +std::stringtargetName
>> +)
>> +{
>> +  return new Target_riscv( targetName );
>> +}
>> +}
>> diff --git a/tester/covoar/Target_riscv.h b/tester/covoar/Target_riscv.h
>> new file mode 100644
>> index 000..c1cf7ab
>> --- /dev/null
>> +++ b/tester/covoar/Target_riscv.h
>> @@ -0,0 +1,95 @@
>> +/*
>> + * RTEMS Tools Project (http://www.rtems.org/)
>> + * Copyright 2019 Vijay K. Banerjee 

git --date=format: Not supported

2019-02-12 Thread Joel Sherrill
Hi

With Chris' commit to rtems-docs, I tried to build the docs again. But
something has changed and now the rtems-docs waf infrastructure depends on
a newer version of git than is available. Tracking down the failed command,
I ended up here:

[joel@localhost rtems-docs]$ git log -1 --format=%h,%cd
--date=format:"%e,%B,%Y"
fatal: unknown date format format:%e,%B,%Y
[joel@localhost rtems-docs]$ git --version
git version 1.8.3.1

This is the short intro to --date= in the man page shows:

   --date=(relative|local|default|iso|rfc|short|raw)
   Only takes effect for dates shown in human-readable format, such
as
   when using "--pretty".  log.date config variable sets a default
   value for log command’s --date option.

To support Centos 7, we will have to restrict what we use.

--joel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: git --date=format: Not supported

2019-02-12 Thread Chris Johns
On 13/2/19 9:41 am, Joel Sherrill wrote:
> Hi
> 
> With Chris' commit to rtems-docs, I tried to build the docs again. But 
> something
> has changed and now the rtems-docs waf infrastructure depends on a newer 
> version
> of git than is available. Tracking down the failed command, I ended up here:
> 
> [joel@localhost rtems-docs]$ git log -1 --format=%h,%cd 
> --date=format:"%e,%B,%Y"
> fatal: unknown date format format:%e,%B,%Y
> [joel@localhost rtems-docs]$ git --version
> git version 1.8.3.1
> 
> This is the short intro to --date= in the man page shows:
> 
>        --date=(relative|local|default|iso|rfc|short|raw)
>            Only takes effect for dates shown in human-readable format, such as
>            when using "--pretty".  log.date config variable sets a default
>            value for log command’s --date option.
> 
> To support Centos 7, we will have to restrict what we use.
> 

I will fix this.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 2/2] waf: Fix version.py to support older versions of git.

2019-02-12 Thread chrisj
From: Chris Johns 

---
 common/version.py | 53 ---
 wscript   |  1 +
 2 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/common/version.py b/common/version.py
index 3ba9454..0f37dad 100644
--- a/common/version.py
+++ b/common/version.py
@@ -65,18 +65,37 @@ from __future__ import print_function
 
 import os.path
 
+import waflib
+
 _version = 'invalid'
 _date = 'unknown date'
 _released = False
 
-def _pretty_day(day):
+def _pretty_day(ctx, date):
+''' Format is -MM-DD'''
+import datetime
+ds = date.split('-')
+if len(ds) != 3:
+ctx.fatal('invalid date format from git: %s' % (date))
+try:
+year = int(ds[0])
+except:
+ctx.fatal('invalid date format from git, converting year: %s' % (date))
+try:
+month = int(ds[1])
+except:
+ctx.fatal('invalid date format from git, converting month: %s' % 
(date))
+try:
+day = int(ds[2])
+except:
+ctx.fatal('invalid date format from git, converting day: %s' % (date))
+try:
+when = datetime.date(year, month, day)
+except:
+ctx.fatal('invalid date format from git: %s' % (date))
 if day == 3:
 s = 'rd'
-elif day == 11:
-s = 'th'
-elif day == 12:
-s = 'th'
-elif day == 13:
+elif day == 11 or day == 12:
 s = 'th'
 elif day % 10 == 1:
 s = 'st'
@@ -84,7 +103,10 @@ def _pretty_day(day):
 s = 'nd'
 else:
 s = 'th'
-return str(day) + s
+s = when.strftime('%%d%s %%B %%Y' % (s))
+if day < 10:
+s = s[1:]
+return s
 
 def get(ctx, rtems_major_version):
 global _version
@@ -122,19 +144,16 @@ def get(ctx, rtems_major_version):
 #
 # Get date and version from Git
 #
-if ctx.exec_command(['git', 'diff-index', '--quiet', 'HEAD']) == 0:
+if ctx.exec_command([ctx.env.GIT[0], 'diff-index', '--quiet', 
'HEAD']) == 0:
 modified = ''
 else:
 modified = '-modified'
-try:
-out = ctx.cmd_and_log(['git', 'log', '-1',
-   '--format=%h,%cd', 
'--date=format:%e,%B,%Y'],
-  quiet = True)
-f = out.strip('\n').split(',')
-version = version + '.' + f[0] + modified
-date = _pretty_day(int(f[1])) + ' ' + f[2] + ' ' + f[3]
-except waflib.Build.Errors.WafError:
-date = 'unknown date'
+out = ctx.cmd_and_log([ctx.env.GIT[0], 'log', '-1',
+   '--format=%h,%cd', '--date=short'],
+  quiet = True)
+f = out.strip('\n').split(',')
+version = version + '.' + f[0] + modified
+date = _pretty_day(ctx, f[1])
 _version = version
 _date = date
 _release = released
diff --git a/wscript b/wscript
index 7cdda9a..06ac034 100644
--- a/wscript
+++ b/wscript
@@ -44,6 +44,7 @@ def options(opt):
 docs_waf.cmd_options(opt)
 
 def configure(conf):
+conf.find_program('git')
 for b in building:
 conf.recurse(b)
 conf.env['BUILD_FROM_TOP'] = 'yes'
-- 
2.19.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/2] waf: Remove as many sys path hacks as we can.

2019-02-12 Thread chrisj
From: Chris Johns 

There are still sys.path hacks in the conf.py files. They cannot
be removed because the instance of python running the sphinx-build
command does not see our top level path hacks. I looked at using
PYTHONPATH but I could not figure out how to set a process environ
var for a waf build instance.
---
 bsp-howto/wscript| 18 +++---
 c-user/wscript   | 18 +++---
 cpu-supplement/wscript   | 18 +++---
 develenv/wscript | 18 +++---
 eclipse/wscript  | 18 +++---
 eng/wscript  | 18 +++---
 filesystem/wscript   | 18 +++---
 images/wscript   | 10 +++---
 networking/wscript   | 18 +++---
 porting/wscript  | 18 +++---
 posix-compliance/wscript | 18 +++---
 posix-users/wscript  | 18 +++---
 rtemsconfig/wscript  | 18 +++---
 shell/wscript| 18 +++---
 user/wscript | 18 +++---
 wscript  | 14 ++
 16 files changed, 111 insertions(+), 165 deletions(-)

diff --git a/bsp-howto/wscript b/bsp-howto/wscript
index 1cb5736..4063cd4 100644
--- a/bsp-howto/wscript
+++ b/bsp-howto/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/c-user/wscript b/c-user/wscript
index 1cb5736..4063cd4 100644
--- a/c-user/wscript
+++ b/c-user/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/cpu-supplement/wscript b/cpu-supplement/wscript
index 1cb5736..4063cd4 100644
--- a/cpu-supplement/wscript
+++ b/cpu-supplement/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/develenv/wscript b/develenv/wscript
index 1cb5736..4063cd4 100644
--- a/develenv/wscript
+++ b/develenv/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/eclipse/wscript b/eclipse/wscript
index 1cb5736..4063cd4 100644
--- a/eclipse/wscript
+++ b/eclipse/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/eng/wscript b/eng/wscript
index 1cb5736..4063cd4 100644
--- a/eng/wscript
+++ b/eng/wscript
@@ -1,11 +1,7 @@
-fro

[PATCH v2 1/3] waf: Remove as many sys path hacks as we can.

2019-02-12 Thread chrisj
From: Chris Johns 

There are still sys.path hacks in the conf.py files. They cannot
be removed because the instance of python running the sphinx-build
command does not see our top level path hacks. I looked at using
PYTHONPATH but I could not figure out how to set a process environ
var for a waf build instance.
---
 bsp-howto/wscript| 18 +++---
 c-user/wscript   | 18 +++---
 cpu-supplement/wscript   | 18 +++---
 develenv/wscript | 18 +++---
 eclipse/wscript  | 18 +++---
 eng/wscript  | 18 +++---
 filesystem/wscript   | 18 +++---
 images/wscript   | 10 +++---
 networking/wscript   | 18 +++---
 porting/wscript  | 18 +++---
 posix-compliance/wscript | 18 +++---
 posix-users/wscript  | 18 +++---
 rtemsconfig/wscript  | 18 +++---
 shell/wscript| 18 +++---
 user/wscript | 18 +++---
 wscript  | 14 ++
 16 files changed, 111 insertions(+), 165 deletions(-)

diff --git a/bsp-howto/wscript b/bsp-howto/wscript
index 1cb5736..4063cd4 100644
--- a/bsp-howto/wscript
+++ b/bsp-howto/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/c-user/wscript b/c-user/wscript
index 1cb5736..4063cd4 100644
--- a/c-user/wscript
+++ b/c-user/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/cpu-supplement/wscript b/cpu-supplement/wscript
index 1cb5736..4063cd4 100644
--- a/cpu-supplement/wscript
+++ b/cpu-supplement/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/develenv/wscript b/develenv/wscript
index 1cb5736..4063cd4 100644
--- a/develenv/wscript
+++ b/develenv/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/eclipse/wscript b/eclipse/wscript
index 1cb5736..4063cd4 100644
--- a/eclipse/wscript
+++ b/eclipse/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/eng/wscript b/eng/wscript
index 1cb5736..4063cd4 100644
--- a/eng/wscript
+++ b/eng/wscript
@@ -1,11 +1,7 @@
-fro

[PATCH v2 2/3] waf: Fix version.py to support older versions of git.

2019-02-12 Thread chrisj
From: Chris Johns 

---
 common/version.py | 51 +++
 wscript   |  1 +
 2 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/common/version.py b/common/version.py
index 3ba9454..9beb3e7 100644
--- a/common/version.py
+++ b/common/version.py
@@ -69,14 +69,31 @@ _version = 'invalid'
 _date = 'unknown date'
 _released = False
 
-def _pretty_day(day):
+def _pretty_day(ctx, date):
+''' Format is -MM-DD'''
+import datetime
+ds = date.split('-')
+if len(ds) != 3:
+ctx.fatal('invalid date format from git: %s' % (date))
+try:
+year = int(ds[0])
+except:
+ctx.fatal('invalid date format from git, converting year: %s' % (date))
+try:
+month = int(ds[1])
+except:
+ctx.fatal('invalid date format from git, converting month: %s' % 
(date))
+try:
+day = int(ds[2])
+except:
+ctx.fatal('invalid date format from git, converting day: %s' % (date))
+try:
+when = datetime.date(year, month, day)
+except:
+ctx.fatal('invalid date format from git: %s' % (date))
 if day == 3:
 s = 'rd'
-elif day == 11:
-s = 'th'
-elif day == 12:
-s = 'th'
-elif day == 13:
+elif day == 11 or day == 12:
 s = 'th'
 elif day % 10 == 1:
 s = 'st'
@@ -84,7 +101,10 @@ def _pretty_day(day):
 s = 'nd'
 else:
 s = 'th'
-return str(day) + s
+s = when.strftime('%%d%s %%B %%Y' % (s))
+if day < 10:
+s = s[1:]
+return s
 
 def get(ctx, rtems_major_version):
 global _version
@@ -122,19 +142,16 @@ def get(ctx, rtems_major_version):
 #
 # Get date and version from Git
 #
-if ctx.exec_command(['git', 'diff-index', '--quiet', 'HEAD']) == 0:
+if ctx.exec_command([ctx.env.GIT[0], 'diff-index', '--quiet', 
'HEAD']) == 0:
 modified = ''
 else:
 modified = '-modified'
-try:
-out = ctx.cmd_and_log(['git', 'log', '-1',
-   '--format=%h,%cd', 
'--date=format:%e,%B,%Y'],
-  quiet = True)
-f = out.strip('\n').split(',')
-version = version + '.' + f[0] + modified
-date = _pretty_day(int(f[1])) + ' ' + f[2] + ' ' + f[3]
-except waflib.Build.Errors.WafError:
-date = 'unknown date'
+out = ctx.cmd_and_log([ctx.env.GIT[0], 'log', '-1',
+   '--format=%h,%cd', '--date=short'],
+  quiet = True)
+f = out.strip('\n').split(',')
+version = version + '.' + f[0] + modified
+date = _pretty_day(ctx, f[1])
 _version = version
 _date = date
 _release = released
diff --git a/wscript b/wscript
index 7cdda9a..06ac034 100644
--- a/wscript
+++ b/wscript
@@ -44,6 +44,7 @@ def options(opt):
 docs_waf.cmd_options(opt)
 
 def configure(conf):
+conf.find_program('git')
 for b in building:
 conf.recurse(b)
 conf.env['BUILD_FROM_TOP'] = 'yes'
-- 
2.19.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 3/3] waf: Use the release date in the coverpage

2019-02-12 Thread chrisj
From: Chris Johns 

---
 common/coverpage/coverpage.html |  4 ++--
 wscript | 16 ++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/common/coverpage/coverpage.html b/common/coverpage/coverpage.html
index 442093b..17ce056 100644
--- a/common/coverpage/coverpage.html
+++ b/common/coverpage/coverpage.html
@@ -3,7 +3,7 @@
  
   RTEMS - Documentation
   
-  
+  
   
   
   
@@ -60,7 +60,7 @@
   
   

-Copyright 2017 RTEMS Project
+© Copyright 1988, @COPYRIGHT_YEAR@ RTEMS Project and contributors.

   
   
diff --git a/wscript b/wscript
index 06ac034..aa5b70b 100644
--- a/wscript
+++ b/wscript
@@ -66,6 +66,15 @@ def coverpage_js(ctx):
 with open(ctx.outputs[0].abspath(), 'w') as o:
 o.write(js.replace('@CATALOGUE', xml))
 
+def index_html(ctx):
+html = ''
+year = ctx.env.DATE.split()[2]
+for f in ctx.inputs:
+if f.abspath().endswith('.html'):
+with open(f.abspath()) as i:
+html += i.read()
+with open(ctx.outputs[0].abspath(), 'w') as o:
+o.write(html.replace('@COPYRIGHT_YEAR@', year))
 
 def build(ctx):
 #
@@ -88,7 +97,7 @@ def build(ctx):
 ctx.recurse(b)
 
 #
-# Build the catalogue, coverpage.js and install.
+# Build the catalogue, coverpage.js, index.html and install.
 #
 ctx(rule = catalogue,
 target = 'catalogue.xml',
@@ -98,10 +107,13 @@ def build(ctx):
 target = 'coverpage.js',
 source = ['wscript', 'catalogue.xml', 'common/coverpage/coverpage.js'])
 ctx.install_as('${PREFIX}/coverpage.js', 'coverpage.js')
+ctx(rule = index_html,
+target = 'coverpage.html',
+source = ['wscript', 'common/coverpage/coverpage.html'])
+ctx.install_as('${PREFIX}/index.html', 'coverpage.html')
 #
 # Install the static content.
 #
-ctx.install_as('${PREFIX}/index.html', 'common/coverpage/coverpage.html')
 static_dir = ctx.path.find_dir('common/coverpage/static')
 ctx.install_files('${PREFIX}/static',
   static_dir.ant_glob('**'),
-- 
2.19.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel