1
0

osc copypac from project:home:michal-m:modsign package:pesign-obs-integration revision:5

OBS-URL: https://build.opensuse.org/package/show/Base:System/pesign-obs-integration?expand=0&rev=9
This commit is contained in:
Ludwig Nussel 2013-03-05 07:41:57 +00:00 committed by Git OBS Bridge
parent 3c6fd95a1e
commit 126b676d62
5 changed files with 116 additions and 12 deletions

View File

@ -50,7 +50,10 @@ if test -z "$RPM_BUILD_ROOT"; then
RPM_BUILD_ROOT=/
fi
mkdir -p "$output"
if ! mkdir -p "$output"; then
echo "$0: warning: $output cannot be created, giving up" >&2
exit 0
fi
cert=$RPM_SOURCE_DIR/_projectcert.crt
if test -e "$cert"; then
echo "Using signing certificate $cert"

View File

@ -63,6 +63,37 @@ sub query_array {
return @res;
}
sub query_multiline_array {
my ($rpm, $tag) = @_;
my @res;
my $delim = "|||"; # XXX - dangerous
my $format = "[$delim\\n\%{$tag}\\n]";
open(my $fh, '-|', "rpm", "-qp", "--qf", $format, $rpm)
or die "rpm: $!\n";
my $line = <$fh>;
return unless $line;
chomp($line);
return if $line eq "(none)";
die "Expected \"$delim\" at beginning of rpm output, got \"$line\""
if $line ne $delim;
my $cur = "";
while ($line = <$fh>) {
chomp($line);
if ($line eq $delim) {
$cur = "" if $cur eq "\n";
push(@res, $cur);
$cur = "";
} else {
$cur .= $line . "\n";
}
}
$cur = "" if $cur eq "\n";
push(@res, $cur);
close($fh);
return @res;
}
sub query_single {
my ($rpm, $tag) = @_;
my $res;
@ -151,14 +182,30 @@ sub load_package {
}
while (my ($script, $tag) = each(%script2tag)) {
my $s = query_single($rpm, $tag);
next unless $s && $s ne "(none)";
my $interp = query_single($rpm, "${tag}prog");
next unless $interp;
my $s = query_single($rpm, $tag);
$res{$script} = {
interp => $interp,
script => $s,
};
}
my @triggers = query_array($rpm, qw(triggertype triggerscriptprog triggerconds));
my @triggerscripts = query_multiline_array($rpm, "triggerscripts");
if (scalar(@triggers) != scalar(@triggerscripts)) {
die "# of %%{triggertype} tags (" . scalar(@triggers) .
") != # of %%{triggerscripts} tags (" . scalar(@triggerscripts)
. ")";
}
for (my $i = 0; $i < scalar(@triggers); $i++) {
$res{triggers} ||= [];
push(@{$res{triggers}}, {
type => $triggers[$i]->[0],
interp => $triggers[$i]->[1],
conds => $triggers[$i]->[2],
script => $triggerscripts[$i],
});
}
open(my $fh, '-|', "rpm", "-qp", "--changelog", $rpm) or die "rpm: $!\n";
{
local $/ = undef;
@ -178,6 +225,17 @@ sub quote {
return $text;
}
sub print_script {
my ($file, $script) = @_;
return unless $script->{script};
open(my $fh, '>', "$output/$file")
or die "$output/$file: $!\n";
print $fh $script->{script};
close($fh);
print SPEC " -f $file";
}
sub print_package {
my ($p, $is_main) = @_;
@ -211,12 +269,16 @@ sub print_package {
for my $script (keys(%script2tag)) {
next unless $p->{$script};
my $file = "$script-$p->{name}";
open(my $fh, '>', "$output/$file") or die "$output/$file: $!\n";
print SPEC "\%$script -p $p->{$script}{interp} -n $p->{name} -f $file\n";
print $fh $p->{$script}{script};
close($fh);
print SPEC "\%$script -p $p->{$script}{interp} -n $p->{name}";
print_script("$script-$p->{name}", $p->{$script});
print SPEC "\n";
}
my $i = 0;
for my $trigger (@{$p->{triggers}}) {
print SPEC "\%trigger$trigger->{type} -p $trigger->{interp} -n $p->{name}";
print_script("trigger$i-$p->{name}", $trigger);
print SPEC " -- $trigger->{conds}\n";
$i++;
}
if ($p->{files}) {
print SPEC "\%files -n $p->{name}\n";

View File

@ -1,3 +1,31 @@
-------------------------------------------------------------------
Mon Mar 4 16:08:34 UTC 2013 - mmarek@suse.cz
- Version 9
- Add support for triggers (bnc#806737)
-------------------------------------------------------------------
Wed Feb 20 09:16:24 UTC 2013 - mmarek@suse.cz
- Do not fail the build if %_topdir/OTHER cannot be created
-------------------------------------------------------------------
Wed Feb 13 14:51:47 UTC 2013 - mmarek@suse.cz
- Version 8
- Hide baselibs from post-build-checks
-------------------------------------------------------------------
Wed Feb 13 09:34:27 UTC 2013 - mmarek@suse.cz
- Do not repackage baselibs
-------------------------------------------------------------------
Wed Feb 13 08:28:31 UTC 2013 - mmarek@suse.cz
- Version 7
- Fix for scriptlets with empty body
-------------------------------------------------------------------
Tue Feb 12 15:42:22 CET 2013 - mls@suse.de

View File

@ -15,15 +15,16 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
# needssslcertforbuild
Name: pesign-obs-integration
Summary: Macros and scripts to sign the kernel and bootloader
License: GPL-2.0
Group: Development/Tools/Other
Version: 6.0
Release: 0
Version: 9.0
Release: 0.<RELEASE15>
Requires: openssl mozilla-nss-tools
%ifarch %ix86 x86_64 ia64
Requires: pesign

View File

@ -52,6 +52,16 @@ for rpm in %_sourcedir/*.rpm; do
cp "$rpm" %_srcrpmdir/
continue
esac
# do not repackage baselibs packages
# FIXME: needs more generic test (if architecture has different
# bitness => skip)
case "$(rpm -qp --qf '%%{name}/%%{arch}' "$rpm")" in
*-32bit/x86_64 | *-32bit/s390x | *-32bit/ppc64 | \
*-64bit/ppc | *-x86/ia64)
mkdir -p "%_topdir/OTHER"
cp "$rpm" "$_"
continue
esac
rpm2cpio "$rpm" | cpio -idm
d=$(rpm -qp --qf '%%{disturl}' "$rpm")
if test -z "$disturl"; then