public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DocBook: only copy stuff to media_api if media xml is generated
@ 2015-11-19  9:45 Mauro Carvalho Chehab
  2015-11-19 10:19 ` Sakari Ailus
  0 siblings, 1 reply; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2015-11-19  9:45 UTC (permalink / raw)
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Mauro Carvalho Chehab

It is possible to use:
	make DOCBOOKS=device-drivers.xml htmldocs

To produce just a few docbooks. In such case, the media docs
won't be built, causing the makefile target to return an error.

While this is ok for human eyes, if the above is used on an script,
it would cause troubles.

Fix it by only creating/filling the media_api directory if the
media_api.xml is found at DOCBOOKS.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
 Documentation/DocBook/media/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile
index 02848146fc3a..2840ff483d5a 100644
--- a/Documentation/DocBook/media/Makefile
+++ b/Documentation/DocBook/media/Makefile
@@ -199,8 +199,10 @@ DVB_DOCUMENTED = \
 #
 
 install_media_images = \
-	$(Q)-mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
-	cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api
+	$(Q)if [ "x$(findstring media_api.xml,$(DOCBOOKS))" != "x" ]; then \
+		mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
+		cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api; \
+	fi
 
 $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64
 	$(Q)base64 -d $< >$@
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] DocBook: only copy stuff to media_api if media xml is generated
  2015-11-19  9:45 [PATCH] DocBook: only copy stuff to media_api if media xml is generated Mauro Carvalho Chehab
@ 2015-11-19 10:19 ` Sakari Ailus
  2015-11-19 11:53   ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Sakari Ailus @ 2015-11-19 10:19 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Hi Mauro,

On Thu, Nov 19, 2015 at 07:45:13AM -0200, Mauro Carvalho Chehab wrote:
> It is possible to use:
> 	make DOCBOOKS=device-drivers.xml htmldocs
> 
> To produce just a few docbooks. In such case, the media docs
> won't be built, causing the makefile target to return an error.
> 
> While this is ok for human eyes, if the above is used on an script,
> it would cause troubles.
> 
> Fix it by only creating/filling the media_api directory if the
> media_api.xml is found at DOCBOOKS.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> ---
>  Documentation/DocBook/media/Makefile | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile
> index 02848146fc3a..2840ff483d5a 100644
> --- a/Documentation/DocBook/media/Makefile
> +++ b/Documentation/DocBook/media/Makefile
> @@ -199,8 +199,10 @@ DVB_DOCUMENTED = \
>  #
>  
>  install_media_images = \
> -	$(Q)-mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
> -	cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api
> +	$(Q)if [ "x$(findstring media_api.xml,$(DOCBOOKS))" != "x" ]; then \
> +		mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
> +		cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api; \
> +	fi
>  
>  $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64
>  	$(Q)base64 -d $< >$@

I'd still copy the files even if the directory was there. It's entirely
possible that new files appeared between the make runs, or that the existing
files changed. cp will just overwrite the targets in that case.

Albeit one still has to issue "make cleandocs" to get the DocBook rebuilt.
Oh well... One thing at a time? :-)

-- 
Cheers,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] DocBook: only copy stuff to media_api if media xml is generated
  2015-11-19 10:19 ` Sakari Ailus
@ 2015-11-19 11:53   ` Mauro Carvalho Chehab
  2015-11-19 13:56     ` Sakari Ailus
  0 siblings, 1 reply; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2015-11-19 11:53 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

Em Thu, 19 Nov 2015 12:19:43 +0200
Sakari Ailus <sakari.ailus@iki.fi> escreveu:

> Hi Mauro,
> 
> On Thu, Nov 19, 2015 at 07:45:13AM -0200, Mauro Carvalho Chehab wrote:
> > It is possible to use:
> > 	make DOCBOOKS=device-drivers.xml htmldocs
> > 
> > To produce just a few docbooks. In such case, the media docs
> > won't be built, causing the makefile target to return an error.
> > 
> > While this is ok for human eyes, if the above is used on an script,
> > it would cause troubles.
> > 
> > Fix it by only creating/filling the media_api directory if the
> > media_api.xml is found at DOCBOOKS.
> > 
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > ---
> >  Documentation/DocBook/media/Makefile | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile
> > index 02848146fc3a..2840ff483d5a 100644
> > --- a/Documentation/DocBook/media/Makefile
> > +++ b/Documentation/DocBook/media/Makefile
> > @@ -199,8 +199,10 @@ DVB_DOCUMENTED = \
> >  #
> >  
> >  install_media_images = \
> > -	$(Q)-mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
> > -	cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api
> > +	$(Q)if [ "x$(findstring media_api.xml,$(DOCBOOKS))" != "x" ]; then \
> > +		mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
> > +		cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api; \
> > +	fi
> >  
> >  $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64
> >  	$(Q)base64 -d $< >$@
> 
> I'd still copy the files even if the directory was there. It's entirely
> possible that new files appeared between the make runs, or that the existing
> files changed. cp will just overwrite the targets in that case.
> 
> Albeit one still has to issue "make cleandocs" to get the DocBook rebuilt.
> Oh well... One thing at a time? :-)

I guess you misread the patch...

It unconditionally copy the files even if the media_api directory exists,
if make is called with:
	make htmldocs

or with:
	make DOCBOOKS=media_api.xml htmldocs

It will only suppress the copy and dir make if someone wants to build
some other html file, with something like:

	make DOCBOOKS=device-drivers.xml htmldocs

Please notice that I use internally a script that detects when a patch
is merged on my tree. In such case, it builds the Kernel and the
documentation, if it is affected, with this logic:

                        cat Documentation/DocBook/device-drivers.tmpl |perl -ne 'print "$1\n" if (m/^\!I(.*media.*)/)' >$TMPFILE
                        if [ "`git show $TAG|diffstat -p1 -l|grep -f $TMPFILE`" ]; then
                                rm $TMPFILE
				make DOCBOOKS=device-drivers.xml htmldocs 2>&1|grep /media/
                                if [ "$?" != "0" ]; then
                                        play ~/sounds/pipe.wav 2>/dev/null >/dev/null
                                fi
                        else
                            	rm $TMPFILE
                        fi

Without this patch, it beeps all the times it runs, because 
	cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api; 

will fail, as no OBJIMGFILES would be produced.

Regards,
Mauro

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] DocBook: only copy stuff to media_api if media xml is generated
  2015-11-19 11:53   ` Mauro Carvalho Chehab
@ 2015-11-19 13:56     ` Sakari Ailus
  0 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2015-11-19 13:56 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab

On Thu, Nov 19, 2015 at 09:53:00AM -0200, Mauro Carvalho Chehab wrote:
> Em Thu, 19 Nov 2015 12:19:43 +0200
> Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> 
> > Hi Mauro,
> > 
> > On Thu, Nov 19, 2015 at 07:45:13AM -0200, Mauro Carvalho Chehab wrote:
> > > It is possible to use:
> > > 	make DOCBOOKS=device-drivers.xml htmldocs
> > > 
> > > To produce just a few docbooks. In such case, the media docs
> > > won't be built, causing the makefile target to return an error.
> > > 
> > > While this is ok for human eyes, if the above is used on an script,
> > > it would cause troubles.
> > > 
> > > Fix it by only creating/filling the media_api directory if the
> > > media_api.xml is found at DOCBOOKS.
> > > 
> > > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > > ---
> > >  Documentation/DocBook/media/Makefile | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile
> > > index 02848146fc3a..2840ff483d5a 100644
> > > --- a/Documentation/DocBook/media/Makefile
> > > +++ b/Documentation/DocBook/media/Makefile
> > > @@ -199,8 +199,10 @@ DVB_DOCUMENTED = \
> > >  #
> > >  
> > >  install_media_images = \
> > > -	$(Q)-mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
> > > -	cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api
> > > +	$(Q)if [ "x$(findstring media_api.xml,$(DOCBOOKS))" != "x" ]; then \
> > > +		mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
> > > +		cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api; \
> > > +	fi
> > >  
> > >  $(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64
> > >  	$(Q)base64 -d $< >$@
> > 
> > I'd still copy the files even if the directory was there. It's entirely
> > possible that new files appeared between the make runs, or that the existing
> > files changed. cp will just overwrite the targets in that case.
> > 
> > Albeit one still has to issue "make cleandocs" to get the DocBook rebuilt.
> > Oh well... One thing at a time? :-)
> 
> I guess you misread the patch...
> 
> It unconditionally copy the files even if the media_api directory exists,

Oops. My bad. Feel free to add:

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-19 13:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-19  9:45 [PATCH] DocBook: only copy stuff to media_api if media xml is generated Mauro Carvalho Chehab
2015-11-19 10:19 ` Sakari Ailus
2015-11-19 11:53   ` Mauro Carvalho Chehab
2015-11-19 13:56     ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox