Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/build-rpm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Build virt-v2v RPM 2.8.1

on:
push:
workflow_dispatch:

jobs:
build-rpm:
runs-on: ubuntu-latest
container:
image: fedora:42

steps:
- name: Install git first
run: dnf install -y git

- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install build dependencies
run: |
dnf install -y rpm-build rpmdevtools git sqlite perl-hivex \
autoconf automake libtool
dnf builddep -y virt-v2v

- name: Setup rpmbuild tree under /root
run: |
rpmdev-setuptree
mkdir -p /root/rpmbuild/{SPECS,SOURCES,BUILD,BUILDROOT,RPMS,SRPMS}

- name: Build patched tarball (autoreconf + make dist)
working-directory: ${{ github.workspace }}
run: |
autoreconf -fiv
./configure
make dist

- name: Verify tarball name
working-directory: ${{ github.workspace }}
run: |
ls -lh virt-v2v-2.8.1.tar.gz

- name: Download & extract upstream SRPM
run: |
cd /root
dnf download --source virt-v2v \
--enablerepo=fedora-source \
--enablerepo=updates-source \
--skip-unavailable

mkdir -p /tmp/srpm-extract
cd /tmp/srpm-extract
rpm2cpio /root/virt-v2v-*.src.rpm | cpio -idmv

# Move spec and sources to build tree
mv virt-v2v.spec /root/rpmbuild/SPECS/
cp *.keyring /root/rpmbuild/SOURCES/ 2>/dev/null || true
cp *.sig /root/rpmbuild/SOURCES/ 2>/dev/null || true

- name: Copy patched tarball to SOURCES
run: |
cp /__w/virt-v2v/virt-v2v/virt-v2v-2.8.1.tar.gz /root/rpmbuild/SOURCES/

- name: Patch spec file
run: |
SPEC_FILE="/root/rpmbuild/SPECS/virt-v2v.spec"

# 1. Disable GPG checks
sed -i 's/^\([[:space:]]*\)%{gpgverify}/#\1%{gpgverify}/' $SPEC_FILE
sed -i 's/%global verify_tarball_signature 1/%global verify_tarball_signature 0/' $SPEC_FILE || true

# 2. Force Version to 2.8.1
sed -i 's/^Version:.*/Version: 2.8.1/' $SPEC_FILE
sed -i 's/^Release:.*/Release: 1.fc42/' $SPEC_FILE

# 3. Remove files that are missing in our build (oVirt support)
sed -i '/virt-v2v-open/d' $SPEC_FILE
sed -i '/virt-v2v-output-ovirt/d' $SPEC_FILE

- name: Build RPM (With Ignore Unpackaged Files)
run: |
cd /root/rpmbuild/SPECS
# Added _unpackaged_files_terminate_build 0 to ignore the extra RHV man page
rpmbuild -bb \
--define "_topdir /root/rpmbuild" \
--define "_unpackaged_files_terminate_build 0" \
--nocheck \
virt-v2v.spec

- name: Upload built RPMs
uses: actions/upload-artifact@v4
with:
name: virt-v2v-2.8.1-rpm
path: /root/rpmbuild/RPMS/x86_64/*.rpm
8 changes: 6 additions & 2 deletions convert/convert.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type options = {
root_choice : root_choice;
static_ips : static_ip list;
customize_ops : Customize_cmdline.ops;
no_fstrim : bool;
}

(* Mountpoint stats, used for free space estimation. *)
Expand Down Expand Up @@ -111,8 +112,11 @@ let rec convert input_disks options source =
* because unused blocks are marked in the overlay and thus do
* not have to be copied.
*)
message (f_"Mapping filesystem data to avoid copying unused and blank areas");
do_fstrim g inspect;
if not options.no_fstrim then (
message (f_"Mapping filesystem data to avoid copying unused and blank areas");
do_fstrim g inspect
) else
message (f_"Skipping fstrim (--no-fstrim specified)");

(* Check (fsck) the filesystems after conversion. *)
g#umount_all ();
Expand Down
1 change: 1 addition & 0 deletions convert/convert.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type options = {
root_choice : Types.root_choice; (** [--root] option *)
static_ips : Types.static_ip list; (** [--mac :ip:] option *)
customize_ops : Customize_cmdline.ops; (** virt-customize options *)
no_fstrim : bool; (** [--no-fstrim] option *)
}

val convert : NBD_URI.t list -> options -> Types.source ->
Expand Down
5 changes: 5 additions & 0 deletions in-place/in_place.ml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ let rec main () =
let set_root_choice = Types.set_root_choice root_choice in

(* Other options that we handle here. *)
let no_fstrim = ref false in
let print_source = ref false in

let input_modes =
Expand Down Expand Up @@ -180,6 +181,8 @@ let rec main () =
s_"Map network ‘in’ to ‘out’";
[ S 'O' ], Getopt.String ("output.xml", set_output_xml_option),
s_"Set the output filename";
[ L"no-fstrim" ], Getopt.Set no_fstrim,
s_"Don't trim filesystems before conversion";
[ L"print-source" ], Getopt.Set print_source,
s_"Print source and stop";
[ L"root" ], Getopt.String ("ask|... ", set_root_choice),
Expand Down Expand Up @@ -239,6 +242,7 @@ read the man page virt-v2v-in-place(1).
let customize_ops = get_customize_ops () in
let input_conn = !input_conn in
let input_mode = !input_mode in
let no_fstrim = !no_fstrim in
let output_xml = !output_xml in
let print_source = !print_source in
let root_choice = !root_choice in
Expand Down Expand Up @@ -305,6 +309,7 @@ read the man page virt-v2v-in-place(1).
root_choice;
static_ips;
customize_ops;
no_fstrim;
} in

(* Before starting the input module, check there is sufficient
Expand Down
1 change: 1 addition & 0 deletions inspector/inspector.ml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ read the man page virt-v2v-inspector(1).
root_choice;
static_ips;
customize_ops;
no_fstrim = false;
} in

(* Before starting the input module, check there is sufficient
Expand Down
1 change: 1 addition & 0 deletions v2v/v2v.ml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ read the man page virt-v2v(1).
root_choice;
static_ips;
customize_ops;
no_fstrim = false;
} in

(* Before starting the input module, check there is sufficient
Expand Down