This allows us to share the mkspec-dtb script among slightly different
branches. Nonexistent dtbs will result in empty RPM packages.
---
rpm/dtb.spec.in.in | 42 +++++++++++++++++++++++++++++++++---------
rpm/mkspec-dtb | 25 +++++--------------------
2 files changed, 38 insertions(+), 29 deletions(-)
diff --git a/rpm/dtb.spec.in.in b/rpm/dtb.spec.in.in
index 0ea9b4639d8b..11e9bae5ec8e 100644
--- a/rpm/dtb.spec.in.in
+++ b/rpm/dtb.spec.in.in
@@ -75,6 +75,9 @@ DTC_FLAGS="$DTC_FLAGS -@"
cd $source/$DTS_folder
for dts in $ALL_SUPPORTED_DTB; do
+ if test ! -e "$dts"; then
+ continue
+ fi
target=${dts%*.dts}
mkdir -p $PPDIR/$(dirname $target)
cpp -x assembler-with-cpp -undef -D__DTS__ -nostdinc -I. -I$SRCDIR/include/ -I$SRCDIR/scripts/dtc/include-prefixes/ -P $target.dts -o $PPDIR/$target.dts
@@ -85,18 +88,39 @@ done
%install
+cat >boilerplate.list <../$pkg.list
+ for dts in $glob; do
+ if test ! -e "$dts"; then
+ continue
+ fi
+ if test ! -s ../$pkg.list; then
+ cp ../boilerplate.list ../$pkg.list
+ fi
+ target=${dts%*.dts}
+ install -m 700 -d %{buildroot}%{dtbdir}/$(dirname $target)
+ install -m 644 $target.dtb %{buildroot}%{dtbdir}/$(dirname $target)
+ echo "%%{dtbdir}/$target.dtb" >>../$pkg.list
+ if test "$(dirname $target)" != "."; then
+ echo "%%dir %%{dtbdir}/$(dirname $target)" >>../$pkg.list
+ fi
%ifarch aarch64
- # HACK: work around U-Boot ignoring vendor dir
- baselink=%{dtbdir}/$(basename $target).dtb
- vendordir=$(basename $(dirname $target))
- ln -s $target.dtb %{buildroot}$baselink
- echo $baselink >> ../dtb-$vendordir.list
+ # HACK: work around U-Boot ignoring vendor dir
+ baselink=%{dtbdir}/$(basename $target).dtb
+ ln -s $target.dtb %{buildroot}$baselink
+ echo $baselink >> ../$pkg.list
%endif
+ done
done
cd -
diff --git a/rpm/mkspec-dtb b/rpm/mkspec-dtb
index 09c7126f3c59..d96ce76892cc 100755
--- a/rpm/mkspec-dtb
+++ b/rpm/mkspec-dtb
@@ -100,6 +100,7 @@ sub generate_spec($$$)
my $subpkg_post = "";
my $subpkg_files = "";
my $all_supported_dtb = "";
+ my $all_supported_pkg_dtb = "";
my $DTS_folder = "arch/arm/boot/dts";
if ($exclusive_arch =~ /aarch64/) {
$DTS_folder = "arch/arm64/boot/dts";
@@ -146,31 +147,14 @@ sub generate_spec($$$)
"# Unless /boot/dtb exists as real directory, create a symlink.\n" .
"[ -d dtb ] || ln -sf dtb-%kernelrelease dtb\n\n";
- my $bin_supported_dtb = $SUPPORTED_DTB;
- $bin_supported_dtb =~ s/\.dts/\.dtb/g;
-
- my $dtb_subdir = "";
- if ($bin_supported_dtb =~ /(.*)\/[^\/]+$/) {
- $dtb_subdir = "%dir %{dtbdir}/$1\n";
- }
-
$subpkg_files .=
- "%ifarch aarch64\n" .
- "%files -n $PKG_NAME -f $PKG_NAME.list\n" .
- "%else\n" .
- "%files -n $PKG_NAME\n" .
- "%endif\n" .
- "%defattr(-,root,root)\n" .
- "%doc COPYING\n" .
- "%ghost /boot/dtb\n" .
- "%dir %{dtbdir}\n" .
- $dtb_subdir .
- "%{dtbdir}/$bin_supported_dtb\n" .
- "\n";
+ "%files -n $PKG_NAME -f $PKG_NAME.list\n\n";
$all_supported_dtb .= "$SUPPORTED_DTB ";
+ $all_supported_pkg_dtb .= "$PKG_NAME:$SUPPORTED_DTB ";
}
chomp($all_supported_dtb);
+ chomp($all_supported_pkg_dtb);
# spec file generation
while(<TEMPLATE>){
@@ -179,6 +163,7 @@ sub generate_spec($$$)
$_ =~ s/\$DTS_folder/$DTS_folder/g;
$_ =~ s/\$SUBPKG_DESC/$subpkg_desc/g;
$_ =~ s/\$ALL_SUPPORTED_DTB/$all_supported_dtb/g;
+ $_ =~ s/\$ALL_SUPPORTED_PKG_DTB/$all_supported_pkg_dtb/g;
$_ =~ s/\$SUBPKG_POST\n?/$subpkg_post/g;
$_ =~ s/\$SUBPKG_FILES\n?/$subpkg_files/g;
print SPEC $_;
--
2.10.2
--
To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org
To contact the owner, e-mail: opensuse-kernel+owner@opensuse.org