From: Denis OSTERLAND <denis.osterland@diehl.com>
To: "ptxdist@pengutronix.de" <ptxdist@pengutronix.de>
Subject: Re: [ptxdist] [PATCH] ptxdist: add xpkg_install to install external ipkgs
Date: Mon, 5 Feb 2018 14:51:30 +0000 [thread overview]
Message-ID: <1517842289.5030.2.camel@diehl.com> (raw)
In-Reply-To: <20180204213126.6457-1-m.grzeschik@pengutronix.de>
Am Sonntag, den 04.02.2018, 22:31 +0100 schrieb Michael Grzeschik:
> This patch enables the feature to call install_xpkg in the targetinstall stage
> of any rule. This way it is possible to install external ipkgs into the targets
> rootfilesystem.
>
> The next example describes an simple usecase with two packages in local_src.
>
> PACKAGES-$(EXAMPLERULE_IPKGS) += examplerule-ipkgs
> EXAMPLERULE_IPKGS_VERSION := 1.0
> EXAMPLERULE_IPKGS := examplerule-ipkgs-$(EXAMPLERULE_IPKGS_VERSION)
> EXAMPLERULE_IPKGS_URL := file://$(PTXDIST_WORKSPACE)/local_src/$(EXAMPLERULE_IPKGS)
>
> EXAMPLERULE_IPKGS_FILES := \
> example1-package_1.1.3_armhf.ipk \
> example2-package_0.3.3_armhf.ipk
>
> define rmsuffix
> $(shell echo $(1) | sed 's-^\([0-9a-zA-Z\-].*\)_\([a-zA-Z.0-9].*\)_.*-\1-g')
> endef
>
> $(STATEDIR)/examplerule.targetinstall:
> @$(call targetinfo)
> @$(foreach ipkg, $(EXAMPLERULE_IPKGS_FILES), \
> $(call install_xpkg, $(call rmsuffix, $(ipkg)), \
> $(EXAMPLERULE_IPKGS_URL)/$(ipkg));)
> @$(call touch)
>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
> rules/post/ptxd_make_xpkg_install.make | 33 ++++++++++
> scripts/lib/ptxd_make_xpkg_install.sh | 111 +++++++++++++++++++++++++++++++++
> 2 files changed, 144 insertions(+)
> create mode 100644 rules/post/ptxd_make_xpkg_install.make
> create mode 100644 scripts/lib/ptxd_make_xpkg_install.sh
>
> diff --git a/rules/post/ptxd_make_xpkg_install.make b/rules/post/ptxd_make_xpkg_install.make
> new file mode 100644
> index 000000000..397961aab
> --- /dev/null
> +++ b/rules/post/ptxd_make_xpkg_install.make
> @@ -0,0 +1,33 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2018 by Michael Grzeschik <mgr@pengutronix.de>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# install_finish
> +#
> +# finishes packet creation
> +#
> +# $1: packet label
Missing $2 documentation
> +#
> +install_xpkg = \
> + $(call xpkg/install, $(1), $(2))
> +
> +#
> +# xpkg/install
> +#
> +# installs packet
> +#
> +# $1: xpkg label
Missing $2 documentation
> +#
> +xpkg/install = \
> + $(call xpkg/env, $(1)) \
> + pkg_xpkg_source='$(strip $(2))' \
> + ptxd_make_xpkg_install
> +
> +# vim: syntax=make
> diff --git a/scripts/lib/ptxd_make_xpkg_install.sh b/scripts/lib/ptxd_make_xpkg_install.sh
> new file mode 100644
> index 000000000..f0367c5e1
> --- /dev/null
> +++ b/scripts/lib/ptxd_make_xpkg_install.sh
> @@ -0,0 +1,111 @@
> +#
> +# ptxd_make_image_extract_ipkg_package - extract ipkg for later image generation
> +#
> +# in:
> +# - $1 ipkg to be extracted
> +# - $2 directory where ipkg are extracted
> +# - $PTXDIST_IPKG_ARCH_STRING ARCH variable for ipkg files
> +#
> +ptxd_make_image_extract_xpkg_package() {
> + # FIXME: consolidate "ptxd_install_setup_src"
> + local src="/etc/opkg/opkg.conf"
> + local xpkg_conf="$(mktemp ${PTXDIST_TEMPDIR}/XXXXXXXXXX_xpkg.conf)"
> + local ipkg="$1"
> + local work_dir="$2"
> + local -a list ptxd_reply
> + echo "option force_reinstall 1" > "${xpkg_conf}"
> + echo "option nodeps 1" >> "${xpkg_conf}"
> + echo "option volatile_cache 1" >> "${xpkg_conf}"
> + echo "option force_postinstall 1" >> "${xpkg_conf}"
> + list=( \
> + "${PTXDIST_WORKSPACE}/projectroot${PTXDIST_PLATFORMSUFFIX}${src}" \
> + "${PTXDIST_WORKSPACE}/projectroot${src}${PTXDIST_PLATFORMSUFFIX}" \
> + "${PTXDIST_WORKSPACE}/projectroot${src}" \
> + "${PTXDIST_TOPDIR}/projectroot${src}" \
> + )
> +
> + if ! ptxd_get_path "${list[@]}"; then
> + local IFS="
> +"
> + ptxd_bailout "
> +unable to find '${src}'
> +
> +These location have been searched:
> +${list[*]}
> +"
> + fi
> +
> +# rm -rf "${work_dir}" &&
> +# install -m 755 -d "${work_dir}" &&
> +
> + ARCH="${PTXDIST_IPKG_ARCH_STRING}" \
> + SRC="" \
> + CHECKSIG="" \
> + CAPATH="" \
> + CAFILE="" \
> + ptxd_replace_magic "${ptxd_reply}" >> "${xpkg_conf}" &&
> +
> + DESTDIR="${work_dir}" \
> + opkg -f "${xpkg_conf}" -o "${work_dir}" \
> + install "${ipkg}" &&
Is it possible to do this with ipkg as well?
> +
> + ptxd_install_fixup_timestamps "${work_dir}"
> +}
> +export -f ptxd_make_image_extract_xpkg_package
> +
> +ptxd_make_xpkg_install_impl() {
> + source="$1"
> + pkg_xpkg_tmp=""
> +
> + ptxd_install_setup &&
> + for dir in "${dirs[@]}"; do
> + if [ -n "${dir}" ]; then
> + echo installing to ${dir}; \
> + ptxd_make_image_extract_xpkg_package \
> + "${source}" "${dir}" || break
> + fi
> + done
> +}
> +export -f ptxd_make_xpkg_install_impl
> +
> +#
> +# function to install a generic package
> +#
> +ptxd_make_xpkg_install() {
> + ptxd_make_xpkg_init || return
> + local source="${pkg_xpkg_source//file:\/\//}"
> +
> + #
> + # track "pkg name" to "xpkg filename" mapping
> + #
> + if [ -e "${pkg_xpkg_map}" ]; then
> + sed -i -e "/^${pkg_xpkg}$/d" "${pkg_xpkg_map}"
> + fi &&
> + echo "${pkg_xpkg}" >> "${pkg_xpkg_map}" || return
> +
> + #
> + # license / currently not per package
> + #
> + echo -n "xpkg_install: collecting license (${pkg_xpkg_license}) ... "
> + echo "${pkg_xpkg_license}" > "${pkg_xpkg_license_file}"
> + echo "done."
> +
> + #
> + # remove old pkgs
> + # note: no version here, so we remove packages with old versions too
> + #
> + rm -f "${ptx_pkg_dir}/${pkg_xpkg}"_*"${PTXDIST_IPKG_ARCH_STRING}.ipk"
> +
> + #
> + # copy to satisfy image creation
> + #
> + cp "${source}" "${ptx_pkg_dir}/"
> +
> + #
> + # only created to satisfy image creation
> + #
> + touch ${pkg_xpkg_perms}
> +
> + fakeroot ptxd_make_xpkg_install_impl ${source}
> +}
> +export -f ptxd_make_xpkg_install
Diehl AKO Stiftung & Co. KG, Pfannerstraße 75-83, 88239 Wangen im Allgäu
Bereichsvorstand: Dr.-Ing. Michael Siedentop (Sprecher), Josef Fellner (Mitglied)
Sitz der Gesellschaft: Wangen i.A. – Registergericht: Amtsgericht Ulm HRA 620609 – Persönlich haftende Gesellschafterin: Diehl Verwaltungs-Stiftung – Sitz: Nürnberg – Registergericht: Amtsgericht Nürnberg HRA 11756 –
Vorstand: Dr.-Ing. E.h. Thomas Diehl (†) (Vorsitzender), Herr Dipl.-Wirtsch.-Ing. Wolfgang Weggen (stellvertretender Vorsitzender), Dipl.-Kfm. Claus Günther, Dipl.-Kfm. Frank Gutzeit, Dr.-Ing. Heinrich Schunk, Dr.-Ing. Michael Siedentop , Dipl.-Kfm. Dr.-Ing. Martin Sommer, Dipl.-Ing. (FH) Rainer von Borstel, Vorsitzender des Aufsichtsrates: Dr. Klaus Maier
___________________________________________________________________________________________________
Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten haben. Bitte loeschen Sie in diesem Fall die Nachricht. Jede unerlaubte Form der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail contains confidential and/or legally protected information. Please inform us if you have received this e-mail by mistake and delete it in such a case. Each unauthorized reproduction, disclosure, alteration, distribution and/or publication of this e-mail is strictly prohibited.
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
prev parent reply other threads:[~2018-02-05 14:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-04 21:31 Michael Grzeschik
2018-02-05 14:51 ` Denis OSTERLAND [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1517842289.5030.2.camel@diehl.com \
--to=denis.osterland@diehl.com \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox