Skip to content

Commit

Permalink
Merge branch 'master' of github.com:openSUSE/obs-build
Browse files Browse the repository at this point in the history
  • Loading branch information
bugfinder committed Nov 19, 2015
2 parents 84c757f + 70e4d68 commit 7b7cd4e
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 15 deletions.
3 changes: 1 addition & 2 deletions build-recipe-spec
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ recipe_run_rpmlint() {
mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null
chroot $BUILD_ROOT su -s /opt/testing/bin/rpmlint "$BUILD_USER" -- \
--info ${LINT_RPM_FILE_LIST[*]#$BUILD_ROOT} \
${SRPM_FILE_LIST[*]#$BUILD_ROOT} > "$BUILD_ROOT$rpmlint_logfile" || ret=1
cat "$BUILD_ROOT$rpmlint_logfile"
${SRPM_FILE_LIST[*]#$BUILD_ROOT} > >(tee "$BUILD_ROOT$rpmlint_logfile") 2>&1 || ret=1
echo
umount -n $BUILD_ROOT/proc 2>/dev/null || true
if test "$ret" = 1 ; then
Expand Down
17 changes: 11 additions & 6 deletions build-vm
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ vm_shutdown() {
vm_img_create() {
local img="$1"
local size="$2"
local origsize=$(cat "${img}.size" 2> /dev/null)

if test -n "$origsize"; then
test "$origsize" -eq "$size" && return
fi

echo "Creating $img (${size}M)"
mkdir -p "${img%/*}" || cleanup_and_exit 3
Expand All @@ -304,6 +309,8 @@ vm_img_create() {
if test "$r" -gt 0 ; then
dd if=/dev/zero of="$img" bs=1M count=0 seek="$size" || cleanup_and_exit 3
fi

echo "$size" > "${img}.size"
}

vm_img_mkfs() {
Expand Down Expand Up @@ -571,13 +578,11 @@ vm_setup() {
rm -rf "$VM_SWAP"
fi
fi
if test ! -e "$VM_IMAGE" ; then
vm_img_create "$VM_IMAGE" "$VMDISK_ROOTSIZE"
if test -z "$CLEAN_BUILD" ; then
vm_img_mkfs "$VMDISK_FILESYSTEM" "$VM_IMAGE"
fi
vm_img_create "$VM_IMAGE" "$VMDISK_ROOTSIZE"
if test -z "$CLEAN_BUILD" ; then
vm_img_mkfs "$VMDISK_FILESYSTEM" "$VM_IMAGE"
fi
if test -n "$VM_SWAP" -a ! -e "$VM_SWAP" -a ! -b "$VM_SWAP" ; then
if test -n "$VM_SWAP" -a ! -b "$VM_SWAP" ; then
vm_img_create "$VM_SWAP" "$VMDISK_SWAPSIZE"
fi
if test ! -e "$VM_IMAGE" ; then
Expand Down
12 changes: 10 additions & 2 deletions build-vm-lxc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,16 @@ vm_startup_lxc() {
mount --bind "$BUILD_ROOT" "$LXCROOTFS"
EOF
chmod a+x "$LXCHOOK"
lxc-create -n "$LXCID" -t none -f "$LXCCONF" || cleanup_and_exit 1
lxc-start -n "$LXCID" -F "$vm_init_script"
case "$(lxc-create --version)" in
1.0*)
lxc-create -n "$LXCID" -f "$LXCCONF" || cleanup_and_exit 1
lxc-start -n "$LXCID" "$vm_init_script"
;;
*)
lxc-create -n "$LXCID" -f "$LXCCONF" -t none || cleanup_and_exit 1
lxc-start -n "$LXCID" -F "$vm_init_script"
;;
esac
BUILDSTATUS="$?"
test "$BUILDSTATUS" != 255 || BUILDSTATUS=3
cleanup_and_exit "$BUILDSTATUS"
Expand Down
2 changes: 1 addition & 1 deletion configs/debian.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Preinstall: libc6 libncurses5 libacl1 libattr1
Preinstall: libreadline4 tar gawk dpkg
Preinstall: sysv-rc gzip base-files

Runscripts: base-files
Runscripts: base-files initscripts

VMinstall: util-linux binutils libblkid1 libuuid1 libdevmapper1.02 mount

Expand Down
9 changes: 7 additions & 2 deletions expanddeps
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use strict;

use Build;

my ($dist, $rpmdeps, $archs, $configdir, $useusedforbuild, $installonly, $noinstall);
my ($dist, $rpmdeps, $archs, $configdir, $useusedforbuild, $installonly, $noinstall, $isvm);

$configdir = ($::ENV{'BUILD_DIR'} || '/usr/lib/build') . '/configs';

Expand Down Expand Up @@ -76,6 +76,11 @@ while (@ARGV) {
Build::define("_without_$def --without-$def");
next;
}
if ($ARGV[0] eq '--vm') {
shift @ARGV;
$isvm = 1;
next;
}
last;
}

Expand Down Expand Up @@ -386,7 +391,7 @@ if (@sysdeps) {
}

# make sure all preinstalls are in bdeps;
# XXX: also add vmdeps?
@bdeps = Build::unify(@bdeps, Build::get_preinstalls($cf));
@bdeps = Build::unify(@bdeps, Build::get_vminstalls($cf)) if $isvm;

print_rpmlist(@bdeps);
4 changes: 3 additions & 1 deletion init_buildsystem
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,9 @@ else
#
RPMLIST=$BUILD_ROOT/.init_b_cache/rpmlist
test -z "$LIST_STATE" && echo "expanding package dependencies..."
if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $CONFIG_DIR "${PKGS[@]}" > $RPMLIST ; then
VMOPT=
test -z "$PREPARE_VM" || VMOPT=--vm
if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD $VMOPT "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $CONFIG_DIR "${PKGS[@]}" > $RPMLIST ; then
rm -f $BUILD_IS_RUNNING
cleanup_and_exit 1
fi
Expand Down
10 changes: 10 additions & 0 deletions mkbaselibs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,11 @@ for my $rpm (@pkgs) {
warn ("$rpm does not exist, skipping\n");
next;
}
my @rpmfiles = `rpm -qp --queryformat "[%{FILENAMES}\n]" $rpm`;
if (!@rpmfiles) {
warn ("$rpm is empty, skipping\n");
next;
}
next if $rpm =~ /\.(no)?src\.rpm$/; # ignore source rpms
next if $rpm =~ /\.spm$/;
$rpmn =~ s/.*\///; # Remove leading path info
Expand All @@ -1136,6 +1141,11 @@ my @debs;
for my $deb (@pkgs) {
my $debn = $deb;
next unless $debn =~ /\.deb$/;
my @debfiles = `dpkg --contents $deb`;
if (!@debfiles) {
warn ("$deb is empty, skipping\n");
next;
}
$debn =~ s/.*\///; # Remove leading path info
$debn =~ s/_[^_]+_[^_]+\.deb$//; # remove all version info and extension
push @debs, $deb if $debs_to_process{$debn};
Expand Down
8 changes: 7 additions & 1 deletion spec_add_patch
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ my $in_prep = 0;
my $in_global = 1;
my $last_patch_in_prep_index = 0;
my $last_patch_in_global_index = 0;
my $last_source_in_global_index = 0;
my @c = ();
my $index = 0;

Expand Down Expand Up @@ -109,7 +110,7 @@ while(<S>)
}

if ($in_global && $ifdef_level == 0 && /^Source(?:\d+)?:/) {
$last_patch_in_global_index = $index;
$last_source_in_global_index = $index;
}

if ($in_prep && $ifdef_level == 0 && /^\%patch/) {
Expand All @@ -120,6 +121,11 @@ while(<S>)
}
close(S);

# append after last Source if this spec doesn't have any Patches
if ($last_patch_in_global_index == 0) {
$last_patch_in_global_index = $last_source_in_global_index;
}

die if ($ifdef_level > 0);
die if ($in_global || $in_prep);
die if ($last_patch_in_prep_index == 0);
Expand Down

0 comments on commit 7b7cd4e

Please sign in to comment.