diff mbox series

[Unstable,1/2] UBUNTU: [Packaging] Move the ABI files up by one directory level

Message ID 20210503084707.141209-2-juergh@canonical.com
State New
Headers show
Series Remove 'previous' component from ABI path | expand

Commit Message

Juerg Haefliger May 3, 2021, 8:47 a.m. UTC
The current ABI root directory name is <DEBIAN/abi/previous/. This commit
drops the 'previous' path component and moves the ABI up one level. We
still need a temporary directory for downloading the current ABIs which now
has to reside outside of the ABI tree. For that, use <DEBIAN>/__abi.current/
which should clearly indicate that it's a temporary directory.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 debian/rules.d/0-common-vars.mk  | 4 ++--
 debian/scripts/misc/final-checks | 2 +-
 debian/scripts/misc/getabis      | 8 ++++----
 3 files changed, 7 insertions(+), 7 deletions(-)

Comments

Thadeu Lima de Souza Cascardo May 3, 2021, 11:35 a.m. UTC | #1
On Mon, May 03, 2021 at 10:47:06AM +0200, Juerg Haefliger wrote:
> The current ABI root directory name is <DEBIAN/abi/previous/. This commit
> drops the 'previous' path component and moves the ABI up one level. We
> still need a temporary directory for downloading the current ABIs which now
> has to reside outside of the ABI tree. For that, use <DEBIAN>/__abi.current/
> which should clearly indicate that it's a temporary directory.
> 
> Signed-off-by: Juerg Haefliger <juergh@canonical.com>
> ---
>  debian/rules.d/0-common-vars.mk  | 4 ++--
>  debian/scripts/misc/final-checks | 2 +-
>  debian/scripts/misc/getabis      | 8 ++++----
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
> index c3e417e242e4..d70308bb6737 100644
> --- a/debian/rules.d/0-common-vars.mk
> +++ b/debian/rules.d/0-common-vars.mk
> @@ -125,8 +125,8 @@ ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
>  	CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
>  endif
>  
> -abidir		:= $(CURDIR)/$(DEBIAN)/abi/current/$(arch)
> -prev_abidir	:= $(CURDIR)/$(DEBIAN)/abi/previous/$(arch)
> +abidir		:= $(CURDIR)/$(DEBIAN)/__abi.current/$(arch)
> +prev_abidir	:= $(CURDIR)/$(DEBIAN)/abi/$(arch)
>  commonconfdir	:= $(CURDIR)/$(DEBIAN)/config
>  archconfdir	:= $(CURDIR)/$(DEBIAN)/config/$(arch)
>  sharedconfdir	:= $(CURDIR)/debian.master/config
> diff --git a/debian/scripts/misc/final-checks b/debian/scripts/misc/final-checks
> index a20e0a0f96ff..e7d86a453465 100755
> --- a/debian/scripts/misc/final-checks
> +++ b/debian/scripts/misc/final-checks
> @@ -44,7 +44,7 @@ abi_check()
>  	fi
>  }
>  
> -abi_version="$debian/abi/previous/version"
> +abi_version="$debian/abi/version"
>  if ! [ -f "$abi_version" ]
>  then
>  	failure "$abi_version ABI version file missing"
> diff --git a/debian/scripts/misc/getabis b/debian/scripts/misc/getabis
> index b2a5585fb618..ba0af3353741 100755
> --- a/debian/scripts/misc/getabis
> +++ b/debian/scripts/misc/getabis
> @@ -24,7 +24,7 @@ verfull=$ver-$revision
>  
>  WGET="wget --tries=1 --timeout=10 --quiet -c"
>  
> -abidir="`pwd`/$DEBIAN/abi/$verfull"
> +abidir="`pwd`/$DEBIAN/__abi.current"
>  tmpdir="`pwd`/abi-tmp-$verfull"
>  origdir="`pwd`"
>  fwinfo=$abidir/fwinfo
> @@ -166,6 +166,7 @@ getall_set()
>  # MAIN
>  
>  # Setup abi directory
> +rm -rf "$abidir"
>  mkdir -p $abidir
>  echo $abi > $abidir/abiname
>  echo $verfull > $abidir/version
> @@ -189,12 +190,11 @@ mv fwinfo.tmp $fwinfo
>  rmdir $tmpdir
>  
>  # Replace the previous ABI directory with the new one
> -abiprevdir="$(pwd)/$DEBIAN/abi/previous"
> +abiprevdir="$(pwd)/$DEBIAN/abi"
>  rm -rf "$abiprevdir"
>  mv "$abidir" "$abiprevdir"
>  
> -# If this is running in a git repo, add the current ABI directory and remove any old ones
> +# If this is running in a git repo, add the updated ABI files
>  if [ -d ".git" ]; then
>      git add "$abiprevdir"
> -    find "$DEBIAN"/abi/* -maxdepth 0 -type d | grep -v '/previous$' | while read f; do git rm -rf "$f"; done
>  fi
> -- 
> 2.27.0
> 

Does that work with either transitions when we use getabis? Let's say one had
applied the previous patchset that uses abi/previous/, have ran getabis, and
has thus removed the abi/$verfull/ directory. Now, after running getabis again,
there will be no leftovers as we remove the entire abi directory before
replacing it with the temporary one. So far, so good.

Now, let's say the two patchsets have been applied, and the tree still contains
the abi/$fullver/ directory. We are also removing the entire abi directory and
replacing it. So, this seems to be working even better than before.

But was these two scenarios tested? How did they work out?

Thanks.
Cascardo.

> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Juerg Haefliger May 3, 2021, 12:25 p.m. UTC | #2
On Mon, 3 May 2021 08:35:34 -0300
Thadeu Lima de Souza Cascardo <cascardo@canonical.com> wrote:

> On Mon, May 03, 2021 at 10:47:06AM +0200, Juerg Haefliger wrote:
> > The current ABI root directory name is <DEBIAN/abi/previous/. This commit
> > drops the 'previous' path component and moves the ABI up one level. We
> > still need a temporary directory for downloading the current ABIs which now
> > has to reside outside of the ABI tree. For that, use <DEBIAN>/__abi.current/
> > which should clearly indicate that it's a temporary directory.
> > 
> > Signed-off-by: Juerg Haefliger <juergh@canonical.com>
> > ---
> >  debian/rules.d/0-common-vars.mk  | 4 ++--
> >  debian/scripts/misc/final-checks | 2 +-
> >  debian/scripts/misc/getabis      | 8 ++++----
> >  3 files changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
> > index c3e417e242e4..d70308bb6737 100644
> > --- a/debian/rules.d/0-common-vars.mk
> > +++ b/debian/rules.d/0-common-vars.mk
> > @@ -125,8 +125,8 @@ ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
> >  	CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
> >  endif
> >  
> > -abidir		:= $(CURDIR)/$(DEBIAN)/abi/current/$(arch)
> > -prev_abidir	:= $(CURDIR)/$(DEBIAN)/abi/previous/$(arch)
> > +abidir		:= $(CURDIR)/$(DEBIAN)/__abi.current/$(arch)
> > +prev_abidir	:= $(CURDIR)/$(DEBIAN)/abi/$(arch)
> >  commonconfdir	:= $(CURDIR)/$(DEBIAN)/config
> >  archconfdir	:= $(CURDIR)/$(DEBIAN)/config/$(arch)
> >  sharedconfdir	:= $(CURDIR)/debian.master/config
> > diff --git a/debian/scripts/misc/final-checks b/debian/scripts/misc/final-checks
> > index a20e0a0f96ff..e7d86a453465 100755
> > --- a/debian/scripts/misc/final-checks
> > +++ b/debian/scripts/misc/final-checks
> > @@ -44,7 +44,7 @@ abi_check()
> >  	fi
> >  }
> >  
> > -abi_version="$debian/abi/previous/version"
> > +abi_version="$debian/abi/version"
> >  if ! [ -f "$abi_version" ]
> >  then
> >  	failure "$abi_version ABI version file missing"
> > diff --git a/debian/scripts/misc/getabis b/debian/scripts/misc/getabis
> > index b2a5585fb618..ba0af3353741 100755
> > --- a/debian/scripts/misc/getabis
> > +++ b/debian/scripts/misc/getabis
> > @@ -24,7 +24,7 @@ verfull=$ver-$revision
> >  
> >  WGET="wget --tries=1 --timeout=10 --quiet -c"
> >  
> > -abidir="`pwd`/$DEBIAN/abi/$verfull"
> > +abidir="`pwd`/$DEBIAN/__abi.current"
> >  tmpdir="`pwd`/abi-tmp-$verfull"
> >  origdir="`pwd`"
> >  fwinfo=$abidir/fwinfo
> > @@ -166,6 +166,7 @@ getall_set()
> >  # MAIN
> >  
> >  # Setup abi directory
> > +rm -rf "$abidir"
> >  mkdir -p $abidir
> >  echo $abi > $abidir/abiname
> >  echo $verfull > $abidir/version
> > @@ -189,12 +190,11 @@ mv fwinfo.tmp $fwinfo
> >  rmdir $tmpdir
> >  
> >  # Replace the previous ABI directory with the new one
> > -abiprevdir="$(pwd)/$DEBIAN/abi/previous"
> > +abiprevdir="$(pwd)/$DEBIAN/abi"
> >  rm -rf "$abiprevdir"
> >  mv "$abidir" "$abiprevdir"
> >  
> > -# If this is running in a git repo, add the current ABI directory and remove any old ones
> > +# If this is running in a git repo, add the updated ABI files
> >  if [ -d ".git" ]; then
> >      git add "$abiprevdir"
> > -    find "$DEBIAN"/abi/* -maxdepth 0 -type d | grep -v '/previous$' | while read f; do git rm -rf "$f"; done
> >  fi
> > -- 
> > 2.27.0
> >   
> 
> Does that work with either transitions when we use getabis? Let's say one had
> applied the previous patchset that uses abi/previous/, have ran getabis, and
> has thus removed the abi/$verfull/ directory. Now, after running getabis again,
> there will be no leftovers as we remove the entire abi directory before
> replacing it with the temporary one. So far, so good.
>
> Now, let's say the two patchsets have been applied, and the tree still contains
> the abi/$fullver/ directory. We are also removing the entire abi directory and
> replacing it. So, this seems to be working even better than before.
> 
> But was these two scenarios tested? How did they work out?

Yes. I just tested #1. I've already tested #2 during development. Results are
as expected.

...Juerg

 
> Thanks.
> Cascardo.
> 
> > 
> > -- 
> > kernel-team mailing list
> > kernel-team@lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index c3e417e242e4..d70308bb6737 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -125,8 +125,8 @@  ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
 	CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
 endif
 
-abidir		:= $(CURDIR)/$(DEBIAN)/abi/current/$(arch)
-prev_abidir	:= $(CURDIR)/$(DEBIAN)/abi/previous/$(arch)
+abidir		:= $(CURDIR)/$(DEBIAN)/__abi.current/$(arch)
+prev_abidir	:= $(CURDIR)/$(DEBIAN)/abi/$(arch)
 commonconfdir	:= $(CURDIR)/$(DEBIAN)/config
 archconfdir	:= $(CURDIR)/$(DEBIAN)/config/$(arch)
 sharedconfdir	:= $(CURDIR)/debian.master/config
diff --git a/debian/scripts/misc/final-checks b/debian/scripts/misc/final-checks
index a20e0a0f96ff..e7d86a453465 100755
--- a/debian/scripts/misc/final-checks
+++ b/debian/scripts/misc/final-checks
@@ -44,7 +44,7 @@  abi_check()
 	fi
 }
 
-abi_version="$debian/abi/previous/version"
+abi_version="$debian/abi/version"
 if ! [ -f "$abi_version" ]
 then
 	failure "$abi_version ABI version file missing"
diff --git a/debian/scripts/misc/getabis b/debian/scripts/misc/getabis
index b2a5585fb618..ba0af3353741 100755
--- a/debian/scripts/misc/getabis
+++ b/debian/scripts/misc/getabis
@@ -24,7 +24,7 @@  verfull=$ver-$revision
 
 WGET="wget --tries=1 --timeout=10 --quiet -c"
 
-abidir="`pwd`/$DEBIAN/abi/$verfull"
+abidir="`pwd`/$DEBIAN/__abi.current"
 tmpdir="`pwd`/abi-tmp-$verfull"
 origdir="`pwd`"
 fwinfo=$abidir/fwinfo
@@ -166,6 +166,7 @@  getall_set()
 # MAIN
 
 # Setup abi directory
+rm -rf "$abidir"
 mkdir -p $abidir
 echo $abi > $abidir/abiname
 echo $verfull > $abidir/version
@@ -189,12 +190,11 @@  mv fwinfo.tmp $fwinfo
 rmdir $tmpdir
 
 # Replace the previous ABI directory with the new one
-abiprevdir="$(pwd)/$DEBIAN/abi/previous"
+abiprevdir="$(pwd)/$DEBIAN/abi"
 rm -rf "$abiprevdir"
 mv "$abidir" "$abiprevdir"
 
-# If this is running in a git repo, add the current ABI directory and remove any old ones
+# If this is running in a git repo, add the updated ABI files
 if [ -d ".git" ]; then
     git add "$abiprevdir"
-    find "$DEBIAN"/abi/* -maxdepth 0 -type d | grep -v '/previous$' | while read f; do git rm -rf "$f"; done
 fi