MrMEEE / awx-rpm-v2

AWX-RPM Reignited
GNU Affero General Public License v3.0
39 stars 11 forks source link

How to build #37

Closed IguanaBob closed 3 months ago

IguanaBob commented 4 months ago

I am trying to build AWX-RPM from source. I could not find any official documentation on how to do this, so by reading various scripts in the repo I came up with the following basic steps which admittingly could be very wrong. What am I doing wrong and/or what is the correct method for building from source?

I set up a RockyLinux-9 instance in WSL2, fully updated with epel enabled to do this build.

# Dependencies
dnf install git rpm-build rpmdevtools rpmautospec-rpm-macros expect mock createrepo_c wget vim

# AWX-RPM
# Clone git repos
cd /opt/
git clone https://github.com/MrMEEE/awx-rpm-v2.git  #awx-rpm - Version 24.6.1 in my test
cd awx-rpm-v2
git clone https://github.com/MrMEEE/awx-rpm-versions.git  #awx-rpm-versions
git clone https://github.com/ansible/awx.git   #awx

# Various fixes I determined by trial-and-error
ln -s scripts new-scripts   #Some scripts refer to new-scripts which is renamed
sed -i -e 's/^git push/#git push/g' scripts/changeversion   #Ensure we don't push local changes to the origin repo
ln -s awx-rpm-versions versions   #Several scripts use "versions" path

# Mock changes
sed -i -e 's/mock -r epel-9-x86/mock -r rocky+epel-9-x86/g' scripts/*   # Make mock use rocky instead of rhel
# Add to /etc/mock/templates/rocky-9.tpl to ensure we have a compatible version of NodeJS inside mock.
config_opts['module_install'] = ['nodejs:18']

# Build dependency sources and build SRPMs
./scripts/getsources
./scripts/buildsrc force

# Build RPMS
./scripts/mockbuild  

# Build receptor
# Find newest version on https://github.com/ansible/receptor and use in next command (1.4.8 currently, but won't build for me. 1.4.7 works)
/opt/awx-rpm-v2/scripts/generate-and-build-receptor-source 1.4.7

# Build awx
# This shows line 46 errors from a bad sed, but it builds regardless
# Note the package name for awx-rpm near the end of the output as it will be used in the next step.
/opt/awx-rpm-v2/scripts/generate-awx-source   

# Build awx-rpm
# Use the package name noted from the previous command.
./scripts/single-mockbuild awx-rpm-24.6.1-7.el9.src.rpm

This is as far as I could get. On the last step the logs show errors like this:

> @ansible/ansible-ui@2.4.313 build:awx
> rm -rf build/awx && UI_MODE=AWX webpack --mode production --config ./webpack/webpack.awx.cjs --output-path build/awx

Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
assets by status 17.4 MiB [cached] 206 assets
orphan modules 20.3 MiB (javascript) 270 KiB (css/mini-extract) 656 KiB (asset) 191 KiB (runtime) [orphan] 11289 modules
runtime modules 27.7 KiB 59 modules
cacheable modules 19.5 MiB (javascript) 1.86 MiB (css/mini-extract)
  javascript modules 19.5 MiB
    modules by path ./node_modules/ 17.1 MiB 1644 modules
    modules by path ./frontend/awx/ 2.41 MiB
      ./frontend/awx/main/Awx.tsx 334 bytes [built] [code generated]
      ./frontend/awx/main/AwxMain.tsx + 831 modules 2.41 MiB [built] [code generated]
      ./frontend/awx/administration/topology/worker.ts 770 bytes [built] [code generated]
  css modules 1.86 MiB
    modules by path ./node_modules/ 1.86 MiB 177 modules
    modules by path ./framework/ 5.14 KiB 7 modules
    modules by path ./frontend/ 838 bytes
      css ./node_modules/css-loader/dist/cjs.js!./frontend/awx/views/jobs/JobOutput/JobOutput.css 565 bytes [built] [code generated]
      css ./node_modules/css-loader/dist/cjs.js!./frontend/common/Ansi.css 273 bytes [built] [code generated]

ERROR in ./frontend/awx/main/AwxMasthead.tsx 11:0-53
Module not found: Error: Can't resolve '../../assets/awx-rpm-logo.svg' in '/builddir/build/BUILD/awx/awx/ui_next/src/frontend/awx/main'
resolve '../../assets/awx-rpm-logo.svg' in '/builddir/build/BUILD/awx/awx/ui_next/src/frontend/awx/main'
  using description file: /builddir/build/BUILD/awx/awx/ui_next/src/package.json (relative path: ./frontend/awx/main)
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /builddir/build/BUILD/awx/awx/ui_next/src/package.json (relative path: ./frontend/assets/awx-rpm-logo.svg)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /builddir/build/BUILD/awx/awx/ui_next/src/frontend/assets/awx-rpm-logo.svg doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /builddir/build/BUILD/awx/awx/ui_next/src/frontend/assets/awx-rpm-logo.svg.ts doesn't exist
      .tsx
        Field 'browser' doesn't contain a valid alias configuration
        /builddir/build/BUILD/awx/awx/ui_next/src/frontend/assets/awx-rpm-logo.svg.tsx doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /builddir/build/BUILD/awx/awx/ui_next/src/frontend/assets/awx-rpm-logo.svg.js doesn't exist
      .jsx
        Field 'browser' doesn't contain a valid alias configuration
        /builddir/build/BUILD/awx/awx/ui_next/src/frontend/assets/awx-rpm-logo.svg.jsx doesn't exist
      as directory
        /builddir/build/BUILD/awx/awx/ui_next/src/frontend/assets/awx-rpm-logo.svg doesn't exist
 @ ./frontend/awx/main/AwxApp.tsx 2:0-44 8:32-43
 @ ./frontend/awx/main/AwxMain.tsx 9:0-34 20:38-44
 @ ./frontend/awx/main/Awx.tsx

webpack 5.92.1 compiled with 1 error in 128233 ms
make[1]: Leaving directory '/builddir/build/BUILD/awx'
make[1]: *** [awx/ui_next/Makefile:38: awx/ui_next/src/build/awx] Error 1
make: *** [awx/ui_next/Makefile:25: awx/ui_next/build] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.wkJRZT (%install)
    Bad exit status from /var/tmp/rpm-tmp.wkJRZT (%install)

RPM build errors:
Finish: rpmbuild awx-rpm-24.6.1-7.el9.src.rpm
Finish: build phase for awx-rpm-24.6.1-7.el9.src.rpm
ERROR: Exception(/opt/awx-rpm-v2/rpmbuilds/24.6.1/SRPMS/awx-rpm-24.6.1-7.el9.src.rpm) Config(rocky+epel-9-x86_64) 4 minutes 53 seconds
INFO: Results and/or logs in: /opt/awx-rpm-v2/rpmbuilds/24.6.1/RPMS-TMP/
ERROR: Command failed:
 # bash --login -c '/usr/bin/rpmbuild -bb --noclean --target x86_64 --nodeps /builddir/build/SPECS/awx-rpm.spec --nocheck'

Any ideas?

MrMEEE commented 4 months ago

This is something that I just haven't gotten around to describing.. So I might need some feedback.. Please tell me if you hit any issues:

I have created a bootstrap script.. use it if you will, or implement manually

https://github.com/MrMEEE/awx-rpm-v2/blob/main/docs/bootstrap-build.sh

from there, use the changeversion script to change into the version you want to build:

./changeversion 24.6.1

This uses the spec files that I have created..

From here, run getsources, to fetch the source code for the python packages:

./getsources

Now that you have the sources, build the source RPMS:

./buildsrc

Now you should be ready to build all the dependencies.. run the mockbuilds:

./mockbuild

This will take quite a while..

You can check status with:

./checkbuilds

and get hints to fixing errors with:

./geterrors

when you have all the dependencies built, you have to build receptor

./generate-and-build-receptor-source

I have had issues build 1.4.8.. so go with 1.4.7 (or find the issue)

When receptor is built, it's finally time for generate the AWX-RPM SRPM:

./generate-awx-source

and then build it with single-mockbuild

Hope it makes sense..

MrMEEE commented 3 months ago

I would love some feedback, no matter if you get it to work or not... :)

IguanaBob commented 3 months ago

I would love some feedback, no matter if you get it to work or not... :)

I did do a quick test and it showed the same errors about the logo svg as before, but I didn't follow the steps you provided 100% so I may have missed something important. When I have more time I'll try again following your instructions 100%. If you need to close the issue don't wait around for my slowness.

In any case, thank you very much for the help. Much appreciated.

MrMEEE commented 3 months ago

Please reopen if you have any feedback or comments :)

MrMEEE commented 3 months ago

@IguanaBob Did you ever get the chance to test this?