Bug 8865 - IDL should be rebuilt by build_idl.sh when pidl is modified
Summary: IDL should be rebuilt by build_idl.sh when pidl is modified
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: Build environment (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Björn Jacke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-15 22:48 UTC by David Disseldorp
Modified: 2012-06-03 09:33 UTC (History)
2 users (show)

See Also:


Attachments
simple script to test pidl conditional rebuilds (1.69 KB, text/plain)
2012-04-16 12:20 UTC, David Disseldorp
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Disseldorp 2012-04-15 22:48:44 UTC
In determining whether to compile a given .idl source file, build_idl.sh currently checks:
a) that all build output files exist
b) build output files are newer than their corresponding .idl source

The .idl is rebuilt if either of the above conditions is false.
This logic does not catch the case where the pidl compiler itself is changed. In such a case, an IDL rebuild should occur.
Comment 1 David Disseldorp 2012-04-15 23:06:42 UTC
Proposed fix:
http://git.samba.org/?p=ddiss/samba.git;a=commit;h=5badbf419cd21ee68583270ab6191d4a89ebf495

The following changes since commit 89e998412fe07a01f9c79330973f62d909dc2da2:

  waf: samba-specific methods should have capitalized names, change process_separate_rule to follow (2012-04-14 08:55:43 +0200)

are available in the git repository at:
  git://git.samba.org/ddiss/samba.git bso8865_rebuild_idl_on_pidl_change

David Disseldorp (1):
      build: rebuild idl if the pidl compiler is changed

 librpc/build_idl.sh |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

--- a/librpc/build_idl.sh
+++ b/librpc/build_idl.sh
@@ -15,16 +15,17 @@ cd ${srcdir}
 
 [ -d $PIDL_OUTPUTDIR ] || mkdir -p $PIDL_OUTPUTDIR || exit 1
 
-PIDL="$PIDL $ARGS"
+PIDL_CMD="$PIDL $ARGS"
 
 if [ $FULL = 1 ]; then
        echo "Rebuilding all idl files"
-       $PIDL $IDL_FILES || exit 1
+       $PIDL_CMD $IDL_FILES || exit 1
        exit 0
 fi
 
 ##
-## Find newer files rather than rebuild all of them
+## Find newer files rather than rebuild all of them. Also handle the case
+## where the pidl compiler itself is newer.
 ##
 
 list=""
@@ -42,6 +43,10 @@ for f in ${IDL_FILES}; do
                list="$list $f"
                break
            }
+           test "`find $PIDL -newer $PIDL_OUTPUTDIR/$o`" != "" && {
+               list="$list $f"
+               break
+           }
        done
 done
 
@@ -50,8 +55,8 @@ done
 ##
 
 if [ "x$list" != x ]; then
-       # echo "${PIDL} ${list}"
-       $PIDL $list || exit 1
+       # echo "${PIDL_CMD} ${list}"
+       $PIDL_CMD $list || exit 1
 fi
 
 cd ${oldpwd}
Comment 2 Stefan Metzmacher 2012-04-16 07:15:51 UTC
You need to check every pidl source file, so everything from

find pidl/ -type f
Comment 3 David Disseldorp 2012-04-16 11:16:35 UTC
(In reply to comment #2)
> You need to check every pidl source file, so everything from
> 
> find pidl/ -type f

Thanks Metze. This change adds the following:

+PIDL_NEWEST=`find $PIDL_DIR -type f -printf "%p\0%T@\n" \
+       | perl -e '$ts_newest = 0;
+                  while (<STDIN>) {
+                          ($f, $ts) = split(/\0/);
+                          next if ($ts <= $ts_newest);
+                          $ts_newest = $ts;
+                          $f_newest = $f;
+                  }
+                  print $f_newest'` || exit 1


http://git.samba.org/?p=ddiss/samba.git;a=commit;h=34da6ffc24234a4f1078a50803d391c70ff31a8e

The following changes since commit b23f5a9418e8acca035930e031c4624478a3d8a9:

  libcli/smb: make use of data_blob_string_const_null() (2012-04-16 12:21:17 +0200)

are available in the git repository at:
  git://git.samba.org/ddiss/samba.git bso8865_rebuild_idl_on_pidl_change_rb1

David Disseldorp (1):
      build: rebuild idl if the pidl compiler is changed

 librpc/build_idl.sh |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)
Comment 4 Stefan Metzmacher 2012-04-16 11:29:21 UTC
if it works, please push it to master
Comment 5 David Disseldorp 2012-04-16 12:20:22 UTC
Created attachment 7456 [details]
simple script to test pidl conditional rebuilds
Comment 6 David Disseldorp 2012-04-16 15:21:57 UTC
Pushed to master with commit 8405fee41d93cb5a44690213c3086f3a4a275cb0. Marking resolved, please reopen if required for 3.6.