[equivs] 27/36: Add Support for links
Axel Beckert
abe at deuxchevaux.org
Fri Jul 28 23:04:37 UTC 2017
This is an automated email from the git hooks/post-receive script.
abe pushed a commit to branch master
in repository equivs.
commit 068ebe2696ccd4d82400383e727a8941baf2f4c1
Author: Wookey <wookey at debian.org>
Date: Tue Jul 18 02:25:17 2017 +0200
Add Support for links
This patch allows an equivs package to contain links, which can be
useful for 'pointing' to the real files the fake dependency should be
supplying.
---
equivs-build.pod | 11 +++++++++++
examples/libstdc++6-dev.ctl | 16 ++++++++++++++++
usr/bin/equivs-build | 12 +++++++++++-
usr/share/equivs/template.ctl | 1 +
4 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/equivs-build.pod b/equivs-build.pod
index e5e1a66..079d6a5 100644
--- a/equivs-build.pod
+++ b/equivs-build.pod
@@ -77,6 +77,17 @@ first must be indented. Example:
Files: foo-cron /etc/cron.d/
foo-cron-helper /usr/local/bin/
+=item Links:
+
+Links to be created in some directory of the created package. Each
+line contains two paths. The first is the path that the generated
+symlink points at; the second is the name of the symlink file (The
+same order as 'ln -s'). As with other multi-line headers, all lines
+but the first must be indented. Example:
+
+ Links: /usr/aarch64-linux-gnu/lib/libfoo.so /usr/lib/aarch64-linux-gnu/libfoo.so
+ /file/to/symlink/to /symlink/file/name
+
=item File:
Files to be copied into some directory of the created package,
diff --git a/examples/libstdc++6-dev.ctl b/examples/libstdc++6-dev.ctl
new file mode 100644
index 0000000..e849ebe
--- /dev/null
+++ b/examples/libstdc++6-dev.ctl
@@ -0,0 +1,16 @@
+# Package to generate fake dependency (and links) for libraries provided by
+# cross-compilers. Built with equivs-build --arch <HOST arch>.
+# e.g. equivs-build --arch armhf libstdc++6-dev
+Section: misc
+Priority: optional
+Standards-Version: 3.6.2
+
+Package: libstdc++6-dev
+Source: gcc-4.7
+Version: 4.7.2-22
+Maintainer: Wookey <wookey at wookware.org>
+Multi-Arch: same
+Description: Virtual package to satisfy build dependencies for arm64
+ The current toolchain contains the required libraries, but as -cross
+ packages. This suffices until things are fully multiarched.
+Links: /usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/libstdc++.so /usr/lib/arm-linux-gnueabihf/libstc++.so
diff --git a/usr/bin/equivs-build b/usr/bin/equivs-build
index 68a5f46..f85d871 100755
--- a/usr/bin/equivs-build
+++ b/usr/bin/equivs-build
@@ -69,6 +69,12 @@ for (split "\n", $control{'Files'} || "") {
unless m:^\s*(\S+)\s+(\S+)/?\s*$:;
$install_files{"$2/".basename($1)} = $1;
}
+my %create_links = ();
+for (split "\n", $control{'Links'} || "") {
+ die "Cannot parse Links line: '$_'\n"
+ unless m:^\s*(\S+)\s+(\S+)/?\s*$:;
+ $create_links{"$2"} = $1;
+}
my %create_files = ();
for (@{$control{'File'} || []}) {
if (m/^\s*(\S+)(?:\s+(\d+))?\s*\n(.*)$/s) {
@@ -83,7 +89,7 @@ for (@{$control{'File'} || []}) {
mkdir "$builddir/install", 0755;
open INSTALL, '>', "$builddir/debian/install" or
die "Cannot open $builddir/debian/install for writing: $!\n";
-foreach my $target (keys %install_files, keys %create_files) {
+foreach my $target (keys %install_files, keys %create_files, keys %create_links) {
$target =~ s/ +//g;
my $dest;
my $cnt = 0;
@@ -105,6 +111,10 @@ foreach my $target (keys %install_files, keys %create_files) {
or die "Cannot copy $file to $dest: $!\n";
chmod -x $file ? 0755 : 0644, $dest
or die "Cannod chmod $dest: $!\n";
+ } elsif (defined $create_links{$target}) {
+ my $file = $create_links{$target};
+ symlink ($file, $dest)
+ or die "Cannot create symlink $dest pointing to $file: $!\n";
} else {
my ($content, $mode) = @{$create_files{$target}};
open CREATE, '>', $dest
diff --git a/usr/share/equivs/template.ctl b/usr/share/equivs/template.ctl
index a5667f4..3990f67 100644
--- a/usr/share/equivs/template.ctl
+++ b/usr/share/equivs/template.ctl
@@ -21,6 +21,7 @@ Package: <package name; defaults to equivs-dummy>
# Changelog: <changelog file; defaults to a generic changelog>
# Readme: <README.Debian file; defaults to a generic one>
# Extra-Files: <comma-separated list of additional files for the doc directory>
+# Links: <pair of space-separated paths; First is path symlink points at, second is filename of link>
# Files: <pair of space-separated paths; First is file to include, second is destination>
# <more pairs, if there's more than one file to include. Notice the starting space>
Description: <short description; defaults to some wise words>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/equivs.git
More information about the Pkg-perl-cvs-commits
mailing list