[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 2/3] automation: Add a clean rule for containers


  • To: Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Wed, 30 Nov 2022 15:48:32 +0000
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <michal.orzel@xxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Wed, 30 Nov 2022 15:49:16 +0000
  • Ironport-data: A9a23:mIRASqgH2WPbhb2ugpUoO9LhX161thAKZh0ujC45NGQN5FlHY01je htvUGmAb/zZa2f8eIwibt7i90pTvJPSyt5gTFdlqHtgFSIb9cadCdqndUqhZCn6wu8v7q5Ex 55HNoSfdpBcolv0/ErF3m3J9CEkvU2wbuOgTrWCYmUpH1QMpB4J0XpLg/Q+jpNjne+3CgaMv cKai8DEMRqu1iUc3lg8sspvkzsy+qWs0N8klgZmP6oS5QSGzyN94K83fsldEVOpGuG4IcbiL wrz5OnR1n/U+R4rFuSknt7TGqHdauePVeQmoiM+t5mK2nCulARrukoIHKN0hXNsoyeIh7hMJ OBl7vRcf+uL0prkw4zxWzEAe8130DYvFLXveRBTuuTLp6HKnueFL1yDwyjaMKVBktubD12i+ tQ9EBsdPg2siN6y55TgZcJBjfg+LeTCadZ3VnFIlVk1DN4jSJHHBa7L+cVZzHE7gcUm8fT2P pRDL2A1NVKZPkMJagx/5JEWxY9EglH2dSFYr1SE47I6+WHJwCR60aT3McqTcduPLSlQthbI+ jqboz6mav0cHNyR7iqk+EyCusT0h2DxWr8XSbGj7+E/1TV/wURMUUZLBDNXu8KRgUekV9VSA 0cd4CYpoO4580nDZsLmQxSyrXqAvxgdc9ldCes37EeK0KW8ywOYDWgNSnhGcs4rsOc/QDBs3 ViM9/vjCCZzqrSTRTSY/62NsDKpESEPKCkJYipsZRsI5ZzvrZ8+ijrLT81/C+ilg9vtAzbyz juW6i8kiN0uYdUjjvvhuwqd2nT1+8aPHlVdChjrsnyNyztSdN64SIOU7X/9ttlrAY2lU1isl S1R8ySB19wmAZaInS2LZewCGrC1+vqIWAHhbU5T84oJrGr0pSP6FWxEyHQnfRoybJ5YEdP8S BWL0T698qO/K5dDgUVfR4uqQ/onwqH7fTgOfqCFN4EeCnSdmeLuwc2PWaJy9zq1+KTPuftlU Xt+TSpLJShyNEif5GDqL9rxKJdyrszE+UvdRIrg0zOs2qeEaXieRN8taQXQP79lsv3Z/lmJr b6z0vdmLT0FCIUShQGOoeYuwa0idyBnVfgaVeQIHgJ8HuaWMD54UKKAqV/QU4dkg75Uho/1E oKVAydlJK7ErSSfc22iMykzAI4DqL4j9RrXywRwZwf3s5XiCK7zhJoim2wfJ+Z/qbI7naUoE 5HouayoW5xyd9gOwBxFBbGVkWCoXEnz7e5SF0JJuAQCQqM=
  • Ironport-hdrordr: A9a23:XfQfjK7MH/kOq6Mk/wPXwY2BI+orL9Y04lQ7vn2ZKCYlB/Bw8v rE8sjzuiWVtN9vYgBdpTntAsi9qBDnhO1ICPcqTNWftWDd0QPDEGgI1/qA/9SPIVyaygZXvZ 0QDJSXYLfLYWST5qzBjzVR3LwbreWvweSQoaP78l8odAdtbshbnnVE4sTwKDwJeOGDb6BJZK Z1I6B81kudkA8sH6CGL0hAZfHHu9rI0Lr+eHc9dmcawTjLtyqs9Ln5VzOF3hISOgk/vIsKwC z+ignk4afmlPm+xnbnpgjuxqUTosLl1txAQOqTjcQPQw+c7DqAVcBaQrifuzJwmsGDgWxa6O XkklMbJsFu7HGURG2vvhf3/AHl3F8VmgTf4G7du2Lnvcv6AA03ENBAg4UxSGqi13Yd
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Nov 30, 2022 at 12:15:08PM +0000, Bertrand Marquis wrote:
> --- a/automation/build/Makefile
> +++ b/automation/build/Makefile
> @@ -28,3 +28,13 @@ all: $(CONTAINERS)
>  clean:
>       rm -f yocto/*.dockerfiles
>  
> +define CLEAN_RULE
> +.PHONY: clean-$(1)
> +clean-$(1):
> +ifneq ($$(shell docker image ls -q $(REGISTRY)/$(subst /,:,$(1))),)

Please, don't use "ifneq" in a rule's recipe, especially when running a
shell command. That shell command is evaluated every time make parse the
makefile, so we are going to run `docker image ls` 23 times!

Just write the call to `docker image ls` and evaluate the result in
shell. I guess something like:
    [ "$(docker image ls -q ...)" ] && docker image rm ...


Cheers,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.