mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] ipkg-push: expose checksum type in platformconfig
@ 2020-04-15  8:41 Simon Falsig
  2020-04-15 13:55 ` Simon Falsig
  2020-04-16  6:48 ` Michael Olbrich
  0 siblings, 2 replies; 5+ messages in thread
From: Simon Falsig @ 2020-04-15  8:41 UTC (permalink / raw)
  To: ptxdist

This allows the checksum type used when creating the pacakge index to
be set in the platformconfig. Currently supported types are md5 (the
default), and sha256.
md5 is kept as default, since the target opkg package needs to be
specifically configured to be built with sha256 support.

Also, the ipkg support in ipkg-push has been removed, and it now always
uses the opkg tools instead. The name is kept, since everything else is
still using the 'ipkg' naming scheme though.
---
 platforms/image_ipkg.in    | 18 ++++++++++++++++++
 rules/post/image_ipkg.make | 23 ++++++++++++++++++++---
 scripts/ipkg-push          |  8 ++++----
 3 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/platforms/image_ipkg.in b/platforms/image_ipkg.in
index dae4fe5b7..018231677 100644
--- a/platforms/image_ipkg.in
+++ b/platforms/image_ipkg.in
@@ -70,6 +70,24 @@ config IMAGE_IPKG_INDEX
          server it allows ipkg on your target to access your ipkg and
          install or update them.
 
+choice
+       prompt "checksum type"
+       default IMAGE_IPKG_CHECKSUM_MD5
+       help
+         Sets the checksum type to use when generating the index,
+         both when pushing to a repository and in PKGDIR.
+         Note that opkg on the target may need to be specifically
+          built with support for the selected checksum type.
+
+       config IMAGE_IPKG_CHECKSUM_MD5
+         bool
+         prompt "md5"
+
+       config IMAGE_IPKG_CHECKSUM_SHA256
+         bool
+         prompt "sha256"
+endchoice
+
 config IMAGE_XPKG_EXTRA_ARGS
        string
        prompt "extra arguments passed to ipkg-build/opkg-build"
diff --git a/rules/post/image_ipkg.make b/rules/post/image_ipkg.make
index c2171574c..64cdf150f 100644
--- a/rules/post/image_ipkg.make
+++ b/rules/post/image_ipkg.make
@@ -19,13 +19,24 @@ ifdef PTXCONF_IMAGE_IPKG_FORCED_PUSH
        rm  -rf "$(IMAGE_REPO_DIST_DIR)"
 endif
        @echo "pushing ipkg packages to ipkg-repository..."
-       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/ipkg-push \
+ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_MD5
+       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/opkg-push \
                --ipkgdir  $(call remove_quotes,$(PKGDIR)) \
                --repodir  $(call remove_quotes,$(PTXCONF_SETUP_IPKG_REPOSITORY)) \
                --revision $(call remove_quotes,$(PTXDIST_VERSION_FULL)) \
                --project  $(call remove_quotes,$(PTXCONF_PROJECT)) \
                --dist     $(call remove_quotes,$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION)) \
-               --type     opkg
+               --checksum md5
+endif
+ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_SHA256
+       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/opkg-push \
+               --ipkgdir  $(call remove_quotes,$(PKGDIR)) \
+               --repodir  $(call remove_quotes,$(PTXCONF_SETUP_IPKG_REPOSITORY)) \
+               --revision $(call remove_quotes,$(PTXDIST_VERSION_FULL)) \
+               --project  $(call remove_quotes,$(PTXCONF_PROJECT)) \
+               --dist     $(call remove_quotes,$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION)) \
+               --checksum sha256
+endif
        @echo "ipkg-repository updated"
 ifdef PTXCONF_IMAGE_IPKG_SIGN_OPENSSL
        @echo "signing Packages..."
@@ -50,8 +61,14 @@ PHONY += $(PKGDIR)/Packages
 $(PKGDIR)/Packages: $(STATEDIR)/host-ipkg-utils.install.post $(STATEDIR)/world.targetinstall
        @echo "Creating ipkg index '$@'..."
        @rm -f $(PKGDIR)/Packages*
+ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_MD5
        @$(HOST_ENV) opkg-make-index \
-               -l "$(PKGDIR)/Packages.filelist" -p "$(@)" "$(PKGDIR)"
+               -l "$(PKGDIR)/Packages.filelist" -p "$(@)" --checksum md5 "$(PKGDIR)"
+endif
+ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_SHA256
+       @$(HOST_ENV) opkg-make-index \
+               -l "$(PKGDIR)/Packages.filelist" -p "$(@)" --checksum sha256 "$(PKGDIR)"
+endif
        @echo "done."
 
 # vim: syntax=make
diff --git a/scripts/ipkg-push b/scripts/ipkg-push
index 45978b305..6467f0947 100755
--- a/scripts/ipkg-push
+++ b/scripts/ipkg-push
@@ -31,7 +31,7 @@ usage() {
        echo "  --revision <revision>      dist revision name to be updated"
        echo "  --project  <projectname>   project name"
        echo "  --dist     <distname>      use this to make a dist release (optional)"
-       echo "  --type     <package type>  specify package type (default: ipkg)"
+       echo "  --checksum <checksum>      specify checksum type, {md5,sha256}, default: md5"
        echo
        exit 1
 }
@@ -41,7 +41,7 @@ REPODIR=
 DISTREVISION=
 PROJECT=
 DIST=
-TYPE=ipkg
+CHECKSUM=md5
 
 
 #
@@ -55,7 +55,7 @@ while [ $# -gt 0 ]; do
                --revision) DISTREVISION=`ptxd_abspath $2`; shift 2 ;;
                --project)  PROJECT=$2;                     shift 2 ;;
                --dist)     DIST=$2;                        shift 2 ;;
-               --type)     TYPE=$2;                        shift 2 ;;
+               --checksum) CHECKSUM=$2;                    shift 2 ;;
                *)  usage "unknown option $1" ;;
        esac
 done
@@ -193,7 +193,7 @@ done
 
 echo "creating index.....: "
 
-(cd $REPODIR/$PROJECT/dists/$DIST && ${TYPE}-make-index . > Packages && gzip -c Packages > Packages.gz)
+(cd $REPODIR/$PROJECT/dists/$DIST && opkg-make-index --checksum ${CHECKSUM} . > Packages && gzip -c Packages > Packages.gz)
 
 exit
 
-- 
2.17.1

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] ipkg-push: expose checksum type in platformconfig
  2020-04-15  8:41 [ptxdist] [PATCH] ipkg-push: expose checksum type in platformconfig Simon Falsig
@ 2020-04-15 13:55 ` Simon Falsig
  2020-04-15 16:26   ` Simon Falsig
  2020-04-16  6:48 ` Michael Olbrich
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Falsig @ 2020-04-15 13:55 UTC (permalink / raw)
  To: ptxdist

> --- a/rules/post/image_ipkg.make
> +++ b/rules/post/image_ipkg.make
> @@ -19,13 +19,24 @@ ifdef PTXCONF_IMAGE_IPKG_FORCED_PUSH
>         rm  -rf "$(IMAGE_REPO_DIST_DIR)"
>  endif
>         @echo "pushing ipkg packages to ipkg-repository..."
> -       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/ipkg-push \
> +ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_MD5
> +       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/opkg-push \
>                 --ipkgdir  $(call remove_quotes,$(PKGDIR)) \
>                 --repodir  $(call
> remove_quotes,$(PTXCONF_SETUP_IPKG_REPOSITORY)) \
>                 --revision $(call remove_quotes,$(PTXDIST_VERSION_FULL)) \
>                 --project  $(call remove_quotes,$(PTXCONF_PROJECT)) \
>                 --dist     $(call
> remove_quotes,$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION)) \
> -               --type     opkg
> +               --checksum md5
> +endif
> +ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_SHA256
> +       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/opkg-push \
> +               --ipkgdir  $(call remove_quotes,$(PKGDIR)) \
> +               --repodir  $(call
> remove_quotes,$(PTXCONF_SETUP_IPKG_REPOSITORY)) \
> +               --revision $(call remove_quotes,$(PTXDIST_VERSION_FULL)) \
> +               --project  $(call remove_quotes,$(PTXCONF_PROJECT)) \
> +               --dist     $(call
> remove_quotes,$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION)) \
> +               --checksum sha256
> +endif
>         @echo "ipkg-repository updated"
>  ifdef PTXCONF_IMAGE_IPKG_SIGN_OPENSSL
>         @echo "signing Packages..."

Also, my makefile skills are not amazing, so if anyone knows of a cleaner way to convert IMAGE_IPKG_CHECKSUM_MD5 / IMAGE_IPKG_CHECKSUM_SHA256 to the md5 / sha256 argument needed for --checksum, then please let me know ;)

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] ipkg-push: expose checksum type in platformconfig
  2020-04-15 13:55 ` Simon Falsig
@ 2020-04-15 16:26   ` Simon Falsig
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Falsig @ 2020-04-15 16:26 UTC (permalink / raw)
  To: ptxdist

> > +       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/opkg-push \

> > +       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/opkg-push \

...I'm off to a good start here...:/ Turns out I messed up the initial commit - the above lines should of course call ipkg-push instead. Let me know if there's anything else that can/should be changed, and I'll send a v2 of the patch.

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] ipkg-push: expose checksum type in platformconfig
  2020-04-15  8:41 [ptxdist] [PATCH] ipkg-push: expose checksum type in platformconfig Simon Falsig
  2020-04-15 13:55 ` Simon Falsig
@ 2020-04-16  6:48 ` Michael Olbrich
  2020-04-16  7:58   ` Simon Falsig
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Olbrich @ 2020-04-16  6:48 UTC (permalink / raw)
  To: ptxdist; +Cc: Simon Falsig

On Wed, Apr 15, 2020 at 08:41:18AM +0000, Simon Falsig wrote:
> This allows the checksum type used when creating the pacakge index to
> be set in the platformconfig. Currently supported types are md5 (the
> default), and sha256.
> md5 is kept as default, since the target opkg package needs to be
> specifically configured to be built with sha256 support.
> 
> Also, the ipkg support in ipkg-push has been removed, and it now always
> uses the opkg tools instead. The name is kept, since everything else is
> still using the 'ipkg' naming scheme though.
> ---
>  platforms/image_ipkg.in    | 18 ++++++++++++++++++
>  rules/post/image_ipkg.make | 23 ++++++++++++++++++++---
>  scripts/ipkg-push          |  8 ++++----
>  3 files changed, 42 insertions(+), 7 deletions(-)
> 
> diff --git a/platforms/image_ipkg.in b/platforms/image_ipkg.in
> index dae4fe5b7..018231677 100644
> --- a/platforms/image_ipkg.in
> +++ b/platforms/image_ipkg.in
> @@ -70,6 +70,24 @@ config IMAGE_IPKG_INDEX
>           server it allows ipkg on your target to access your ipkg and
>           install or update them.
>  
> +choice
> +       prompt "checksum type"
> +       default IMAGE_IPKG_CHECKSUM_MD5
> +       help
> +         Sets the checksum type to use when generating the index,
> +         both when pushing to a repository and in PKGDIR.
> +         Note that opkg on the target may need to be specifically
> +          built with support for the selected checksum type.
> +
> +       config IMAGE_IPKG_CHECKSUM_MD5
> +         bool
> +         prompt "md5"
> +
> +       config IMAGE_IPKG_CHECKSUM_SHA256
> +         bool
> +         prompt "sha256"
> +endchoice

Hmmm, we already have the PTXCONF_OPKG_SHA256 option for opkg. Maybe just
use that one?

>  config IMAGE_XPKG_EXTRA_ARGS
>         string
>         prompt "extra arguments passed to ipkg-build/opkg-build"
> diff --git a/rules/post/image_ipkg.make b/rules/post/image_ipkg.make
> index c2171574c..64cdf150f 100644
> --- a/rules/post/image_ipkg.make
> +++ b/rules/post/image_ipkg.make
> @@ -19,13 +19,24 @@ ifdef PTXCONF_IMAGE_IPKG_FORCED_PUSH
>         rm  -rf "$(IMAGE_REPO_DIST_DIR)"
>  endif
>         @echo "pushing ipkg packages to ipkg-repository..."
> -       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/ipkg-push \
> +ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_MD5
> +       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/opkg-push \
>                 --ipkgdir  $(call remove_quotes,$(PKGDIR)) \
>                 --repodir  $(call remove_quotes,$(PTXCONF_SETUP_IPKG_REPOSITORY)) \
>                 --revision $(call remove_quotes,$(PTXDIST_VERSION_FULL)) \
>                 --project  $(call remove_quotes,$(PTXCONF_PROJECT)) \
>                 --dist     $(call remove_quotes,$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION)) \
> -               --type     opkg
> +               --checksum md5

--checksum $(call ptx/ifdef,PTXCONF_IMAGE_IPKG_CHECKSUM_MD5,md5,sha256)

Or whatever option we end up using.

> +endif
> +ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_SHA256
> +       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/opkg-push \
> +               --ipkgdir  $(call remove_quotes,$(PKGDIR)) \
> +               --repodir  $(call remove_quotes,$(PTXCONF_SETUP_IPKG_REPOSITORY)) \
> +               --revision $(call remove_quotes,$(PTXDIST_VERSION_FULL)) \
> +               --project  $(call remove_quotes,$(PTXCONF_PROJECT)) \
> +               --dist     $(call remove_quotes,$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION)) \
> +               --checksum sha256
> +endif
>         @echo "ipkg-repository updated"
>  ifdef PTXCONF_IMAGE_IPKG_SIGN_OPENSSL
>         @echo "signing Packages..."
> @@ -50,8 +61,14 @@ PHONY += $(PKGDIR)/Packages
>  $(PKGDIR)/Packages: $(STATEDIR)/host-ipkg-utils.install.post $(STATEDIR)/world.targetinstall
>         @echo "Creating ipkg index '$@'..."
>         @rm -f $(PKGDIR)/Packages*
> +ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_MD5
>         @$(HOST_ENV) opkg-make-index \
> -               -l "$(PKGDIR)/Packages.filelist" -p "$(@)" "$(PKGDIR)"
> +               -l "$(PKGDIR)/Packages.filelist" -p "$(@)" --checksum md5 "$(PKGDIR)"
> +endif
> +ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_SHA256
> +       @$(HOST_ENV) opkg-make-index \
> +               -l "$(PKGDIR)/Packages.filelist" -p "$(@)" --checksum sha256 "$(PKGDIR)"
> +endif

Same here.

Michael

>         @echo "done."
>  
>  # vim: syntax=make
> diff --git a/scripts/ipkg-push b/scripts/ipkg-push
> index 45978b305..6467f0947 100755
> --- a/scripts/ipkg-push
> +++ b/scripts/ipkg-push
> @@ -31,7 +31,7 @@ usage() {
>         echo "  --revision <revision>      dist revision name to be updated"
>         echo "  --project  <projectname>   project name"
>         echo "  --dist     <distname>      use this to make a dist release (optional)"
> -       echo "  --type     <package type>  specify package type (default: ipkg)"
> +       echo "  --checksum <checksum>      specify checksum type, {md5,sha256}, default: md5"
>         echo
>         exit 1
>  }
> @@ -41,7 +41,7 @@ REPODIR=
>  DISTREVISION=
>  PROJECT=
>  DIST=
> -TYPE=ipkg
> +CHECKSUM=md5
>  
>  
>  #
> @@ -55,7 +55,7 @@ while [ $# -gt 0 ]; do
>                 --revision) DISTREVISION=`ptxd_abspath $2`; shift 2 ;;
>                 --project)  PROJECT=$2;                     shift 2 ;;
>                 --dist)     DIST=$2;                        shift 2 ;;
> -               --type)     TYPE=$2;                        shift 2 ;;
> +               --checksum) CHECKSUM=$2;                    shift 2 ;;
>                 *)  usage "unknown option $1" ;;
>         esac
>  done
> @@ -193,7 +193,7 @@ done
>  
>  echo "creating index.....: "
>  
> -(cd $REPODIR/$PROJECT/dists/$DIST && ${TYPE}-make-index . > Packages && gzip -c Packages > Packages.gz)
> +(cd $REPODIR/$PROJECT/dists/$DIST && opkg-make-index --checksum ${CHECKSUM} . > Packages && gzip -c Packages > Packages.gz)
>  
>  exit
>  
> -- 
> 2.17.1
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [PATCH] ipkg-push: expose checksum type in platformconfig
  2020-04-16  6:48 ` Michael Olbrich
@ 2020-04-16  7:58   ` Simon Falsig
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Falsig @ 2020-04-16  7:58 UTC (permalink / raw)
  To: Michael Olbrich, ptxdist

> > +choice
> > +       prompt "checksum type"
> > +       default IMAGE_IPKG_CHECKSUM_MD5
> > +       help
> > +         Sets the checksum type to use when generating the index,
> > +         both when pushing to a repository and in PKGDIR.
> > +         Note that opkg on the target may need to be specifically
> > +          built with support for the selected checksum type.
> > +
> > +       config IMAGE_IPKG_CHECKSUM_MD5
> > +         bool
> > +         prompt "md5"
> > +
> > +       config IMAGE_IPKG_CHECKSUM_SHA256
> > +         bool
> > +         prompt "sha256"
> > +endchoice
> 
> Hmmm, we already have the PTXCONF_OPKG_SHA256 option for opkg. Maybe
> just use that one?

Done.

> 
> >  config IMAGE_XPKG_EXTRA_ARGS
> >         string
> >         prompt "extra arguments passed to ipkg-build/opkg-build"
> > diff --git a/rules/post/image_ipkg.make b/rules/post/image_ipkg.make
> > index c2171574c..64cdf150f 100644
> > --- a/rules/post/image_ipkg.make
> > +++ b/rules/post/image_ipkg.make
> > @@ -19,13 +19,24 @@ ifdef PTXCONF_IMAGE_IPKG_FORCED_PUSH
> >         rm  -rf "$(IMAGE_REPO_DIST_DIR)"
> >  endif
> >         @echo "pushing ipkg packages to ipkg-repository..."
> > -       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/ipkg-push \
> > +ifdef PTXCONF_IMAGE_IPKG_CHECKSUM_MD5
> > +       @$(HOST_ENV) $(PTXDIST_TOPDIR)/scripts/opkg-push \
> >                 --ipkgdir  $(call remove_quotes,$(PKGDIR)) \
> >                 --repodir  $(call
> remove_quotes,$(PTXCONF_SETUP_IPKG_REPOSITORY)) \
> >                 --revision $(call remove_quotes,$(PTXDIST_VERSION_FULL)) \
> >                 --project  $(call remove_quotes,$(PTXCONF_PROJECT)) \
> >                 --dist     $(call
> remove_quotes,$(PTXCONF_PROJECT)$(PTXCONF_PROJECT_VERSION)) \
> > -               --type     opkg
> > +               --checksum md5
> 
> --checksum $(call
> ptx/ifdef,PTXCONF_IMAGE_IPKG_CHECKSUM_MD5,md5,sha256)
> 

Perfect - much cleaner - thanks!

Since the checksum is no longer exposed in the platformconfig, I'm changing the commit title though - will be up in a bit...

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

end of thread, other threads:[~2020-04-16  7:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-15  8:41 [ptxdist] [PATCH] ipkg-push: expose checksum type in platformconfig Simon Falsig
2020-04-15 13:55 ` Simon Falsig
2020-04-15 16:26   ` Simon Falsig
2020-04-16  6:48 ` Michael Olbrich
2020-04-16  7:58   ` Simon Falsig

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