diff mbox series

[kteam-tools,v2,6/7] git-build-kernel: special case no-orig-tarball src packages

Message ID 1533249635-9483-7-git-send-email-kamal@canonical.com
State New
Headers show
Series git-build-kernel: source pkg features | expand

Commit Message

Kamal Mostafa Aug. 2, 2018, 10:40 p.m. UTC
The "meta" and "signed" source packages do not use an orig tarball, so
do not try to symlink to one, and do use --no-tgz-check to inhibit checking
for one (the latter is explicitly required just for "signed" since its
non-Debian-native version number implies that there will be a orig tarball).

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 git-build-kernel/git-build-kernel | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

Comments

Andy Whitcroft Aug. 6, 2018, 3:51 p.m. UTC | #1
On Thu, Aug 02, 2018 at 03:40:34PM -0700, Kamal Mostafa wrote:
> The "meta" and "signed" source packages do not use an orig tarball, so
> do not try to symlink to one, and do use --no-tgz-check to inhibit checking
> for one (the latter is explicitly required just for "signed" since its
> non-Debian-native version number implies that there will be a orig tarball).
> 
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> ---
>  git-build-kernel/git-build-kernel | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/git-build-kernel/git-build-kernel b/git-build-kernel/git-build-kernel
> index 3c19587..02994db 100755
> --- a/git-build-kernel/git-build-kernel
> +++ b/git-build-kernel/git-build-kernel
> @@ -142,10 +142,23 @@ touch "$WORKDIR/building"
>  trap "rm -rf $WORKDIR/building $BUILDDIR" 0
>  
>  [ $do_source_pkg = 1 ] && {
> -    orig_tarball="${SRCPKG}_${VERSION%%-*}.orig.tar.gz"
> -    # Careful: $ORIG_TARBALLS_DIR must be accessible from within the chroot.
> -    # (Alternately, use "cp -p" instead of "ln -s" if that's not an option)
> -    ln -s $ORIG_TARBALLS_DIR/$orig_tarball $WORKDIR/
> +    ### Special case for linux-signed and linux-meta packages, which
> +    ### have no .orig tarball
> +    [ ${SRCPKG/-signed} != $SRCPKG ] && no_orig_tarball=1
> +    [ ${SRCPKG/-meta} != $SRCPKG ] && no_orig_tarball=1

This feels like it is going to become a problem.  For example in devel
we don't always have an orig as there isn't one yet as upstream has not
yet released the thing.  I think we need to think of a better way to
make this determination.

> +    if [ "$no_orig_tarball" = 1 ]
> +    then
> +	srcpkg_debopts="--no-tgz-check $srcpkg_debopts"
> +    else
> +	orig_tarball="${SRCPKG}_${VERSION%%-*}.orig.tar.gz"
> +	# Careful: $ORIG_TARBALLS_DIR must be accessible from within the chroot.
> +	# (Alternately, use "cp -p" instead of "ln -s" if that's not an option)
> +	[ -e "$ORIG_TARBALLS_DIR/$orig_tarball" ] || {
> +	    echo "fatal: missing $ORIG_TARBALLS_DIR/$orig_tarball" 1>&2
> +	    exit 1
> +	}
> +	ln -s $ORIG_TARBALLS_DIR/$orig_tarball $WORKDIR/
> +    fi
>  }
>  
>  ###

-apw
Kamal Mostafa Aug. 6, 2018, 4:53 p.m. UTC | #2
On Mon, Aug 06, 2018 at 04:51:48PM +0100, Andy Whitcroft wrote:
> On Thu, Aug 02, 2018 at 03:40:34PM -0700, Kamal Mostafa wrote:
> > The "meta" and "signed" source packages do not use an orig tarball, so
> > do not try to symlink to one, and do use --no-tgz-check to inhibit checking
> > for one (the latter is explicitly required just for "signed" since its
> > non-Debian-native version number implies that there will be a orig tarball).
> > 
> > Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> > ---
> >  git-build-kernel/git-build-kernel | 21 +++++++++++++++++----
> >  1 file changed, 17 insertions(+), 4 deletions(-)
> > 
> > diff --git a/git-build-kernel/git-build-kernel b/git-build-kernel/git-build-kernel
> > index 3c19587..02994db 100755
> > --- a/git-build-kernel/git-build-kernel
> > +++ b/git-build-kernel/git-build-kernel
> > @@ -142,10 +142,23 @@ touch "$WORKDIR/building"
> >  trap "rm -rf $WORKDIR/building $BUILDDIR" 0
> >  
> >  [ $do_source_pkg = 1 ] && {
> > -    orig_tarball="${SRCPKG}_${VERSION%%-*}.orig.tar.gz"
> > -    # Careful: $ORIG_TARBALLS_DIR must be accessible from within the chroot.
> > -    # (Alternately, use "cp -p" instead of "ln -s" if that's not an option)
> > -    ln -s $ORIG_TARBALLS_DIR/$orig_tarball $WORKDIR/
> > +    ### Special case for linux-signed and linux-meta packages, which
> > +    ### have no .orig tarball
> > +    [ ${SRCPKG/-signed} != $SRCPKG ] && no_orig_tarball=1
> > +    [ ${SRCPKG/-meta} != $SRCPKG ] && no_orig_tarball=1
> 
> This feels like it is going to become a problem.  For example in devel
> we don't always have an orig as there isn't one yet as upstream has not
> yet released the thing.  I think we need to think of a better way to
> make this determination.

I'll look into using debian/source/format to determine this instead,
which I will submit as a follow-up patch.

 -Kamal
diff mbox series

Patch

diff --git a/git-build-kernel/git-build-kernel b/git-build-kernel/git-build-kernel
index 3c19587..02994db 100755
--- a/git-build-kernel/git-build-kernel
+++ b/git-build-kernel/git-build-kernel
@@ -142,10 +142,23 @@  touch "$WORKDIR/building"
 trap "rm -rf $WORKDIR/building $BUILDDIR" 0
 
 [ $do_source_pkg = 1 ] && {
-    orig_tarball="${SRCPKG}_${VERSION%%-*}.orig.tar.gz"
-    # Careful: $ORIG_TARBALLS_DIR must be accessible from within the chroot.
-    # (Alternately, use "cp -p" instead of "ln -s" if that's not an option)
-    ln -s $ORIG_TARBALLS_DIR/$orig_tarball $WORKDIR/
+    ### Special case for linux-signed and linux-meta packages, which
+    ### have no .orig tarball
+    [ ${SRCPKG/-signed} != $SRCPKG ] && no_orig_tarball=1
+    [ ${SRCPKG/-meta} != $SRCPKG ] && no_orig_tarball=1
+    if [ "$no_orig_tarball" = 1 ]
+    then
+	srcpkg_debopts="--no-tgz-check $srcpkg_debopts"
+    else
+	orig_tarball="${SRCPKG}_${VERSION%%-*}.orig.tar.gz"
+	# Careful: $ORIG_TARBALLS_DIR must be accessible from within the chroot.
+	# (Alternately, use "cp -p" instead of "ln -s" if that's not an option)
+	[ -e "$ORIG_TARBALLS_DIR/$orig_tarball" ] || {
+	    echo "fatal: missing $ORIG_TARBALLS_DIR/$orig_tarball" 1>&2
+	    exit 1
+	}
+	ln -s $ORIG_TARBALLS_DIR/$orig_tarball $WORKDIR/
+    fi
 }
 
 ###