Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/pkg-generic.mk: local and override support in legal-info
@ 2023-01-17 11:04 carrier.nicolas0
  2023-01-29 15:31 ` Yann E. MORIN
  2024-07-15 17:48 ` Arnout Vandecappelle via buildroot
  0 siblings, 2 replies; 6+ messages in thread
From: carrier.nicolas0 @ 2023-01-17 11:04 UTC (permalink / raw)
  To: buildroot; +Cc: Nicolas Carrier, Thomas Petazzoni

From: Nicolas Carrier <carrier.nicolas0@gmail.com>

Sources of packages which are using the 'local' _METHOD_SITE or
which declare an _OVERRIDE_SRC_DIR are not archived when generating
the legal-info target.
This is problematic since those packages are the most likely to
require being published, because it's highly probable that their
sources have been modified.

This patch generates a tar.gz archive on the fly, containing the
result of the rsync of the package's source directory, using the
same arguments as during the preparation of a build.
Note that is not possible to archive the builddir, since it may
contain artifacts of previous compilations.

It is not possible to consider rsync as a "normal" download method
either (which would have solved the initial problem), because if we
do that:
 * the DL dir's content would be altered improperly
 * the rsync + tar gz overhead would be paid on compilation and is
   significant, for example, for a linux kernel
 * a hash file would be necessary, which would be a burden to
   maintain, for sources frequently modified

Signed-off-by: Nicolas Carrier <carrier.nicolas0@gmail.com>
---
 package/pkg-generic.mk | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 2f8ba39edf..a8760f40d4 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -660,6 +660,12 @@ $$(error $(1) has local site method, but `$(2)_SITE` is not defined)
 endif
 endif
 
+# for legal-info sources archival
+ifneq ($$($(2)_OVERRIDE_SRCDIR),)
+$(2)_OVERRIDE_RSYNC_DIR = $$($(2)_BUILDDIR)/$$($(2)_BASENAME_RAW)
+$(2)_OVERRIDE_RSYNC_ARCHIVE = $$($(2)_OVERRIDE_RSYNC_DIR).tar.gz
+endif
+
 ifndef $(2)_LICENSE
  ifdef $(3)_LICENSE
   $(2)_LICENSE = $$($(3)_LICENSE)
@@ -1146,13 +1152,16 @@ else
 endif # license files
 
 ifeq ($$($(2)_REDISTRIBUTE),YES)
-ifeq ($$($(2)_SITE_METHOD),local)
-# Packages without a tarball: don't save and warn
-	@$$(call legal-warning-nosource,$$($(2)_RAWNAME),local)
-
-else ifneq ($$($(2)_OVERRIDE_SRCDIR),)
-	@$$(call legal-warning-nosource,$$($(2)_RAWNAME),override)
-
+ifneq ($$($(2)_OVERRIDE_SRCDIR),)
+# Packages without a tarball: create one on the fly
+	@echo "Package is of type local or override, archive sources"
+	$$(Q)rm -rf $$($(2)_OVERRIDE_RSYNC_DIR) $$($(2)_OVERRIDE_RSYNC_ARCHIVE)
+	$$(Q)rsync -au --chmod=u=rwX,go=rX $$(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$$($(2)_OVERRIDE_SRCDIR))/ $$($(2)_OVERRIDE_RSYNC_DIR)/
+	$$(Q)tar -zcf $$($(2)_OVERRIDE_RSYNC_ARCHIVE) -C $$($(2)_OVERRIDE_RSYNC_DIR) $$$$(ls -A $$($(2)_OVERRIDE_RSYNC_DIR)/)
+	$$(Q)rm -rf $$($(2)_OVERRIDE_RSYNC_DIR)
+	$$(Q)support/scripts/hardlink-or-copy \
+			$$($(2)_OVERRIDE_RSYNC_ARCHIVE) \
+			$$($(2)_REDIST_SOURCES_DIR)$$(sep)
 else
 # Other packages
 
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2024-09-09 13:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-17 11:04 [Buildroot] [PATCH 1/1] package/pkg-generic.mk: local and override support in legal-info carrier.nicolas0
2023-01-29 15:31 ` Yann E. MORIN
     [not found]   ` <CANp9F6inGf6BCXrUcdAS7ymyOTJ5ha08yFwuterxT57P_5bFxA@mail.gmail.com>
2023-01-30  8:58     ` [Buildroot] Fwd: " Nicolas CARRIER
2024-07-15 18:00   ` [Buildroot] " Arnout Vandecappelle via buildroot
2024-07-15 17:48 ` Arnout Vandecappelle via buildroot
2024-09-09 13:21   ` yann.morin

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