Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using setuptools for build #501

Merged
merged 10 commits into from
Nov 18, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.intltool-merge-cache
.make.state
**/__pycache__
**/*.so
/packages
/proto
/src/brand/fmri_compare
Expand All @@ -17,8 +18,7 @@
/src/tests/.timing_history.txt
/src/tests/*.pyc
/src/tests/*/*.pyc
/src/cffi_src/_*
/src/cffi_src/64
/src/cffi_src/src
/src/tests/failures
/src/tests/failures.3*
src/pkg.egg-info/
13 changes: 9 additions & 4 deletions README.sync
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
The pkg5 components have been updated to the latest upstream solaris-ips
as of:

commit 7caddba490ac61d0ae1ad9daead93e1fc7265c9c
Author: Jakub Kulik <[email protected]>
Date: Wed Aug 14 06:40:52 2024 -0700
commit 72081aaa8a75ea1d00b7b935a9627744a6fb4ad9
Author: Darren J Moffat <[email protected]>
Date: Wed Oct 23 09:42:15 2024 -0700

29414815 -D firmware-dependency-bypass=1 option throws stacktrace
PSARC/2024/105 pkg(7) user action uid selection must not use reserved range
37049008 pkg should not allocate uid/gid in the system reseved range
35721851 pkg fails to to preserve gid of existing group when manifest
doesn't define a gid
37049046 test_minugid monumentally broken - will always pass
37049103 uid/gid allocation should not be a class default_value

-----------------------------------------------------------------------------

33 changes: 16 additions & 17 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,33 @@ include Makefile.com

JOBS = 8

# These are artificial targets used to run actions against all current python
# versions (in PYVERSIONS). In rules the target python version can be picked
# up via $(@F).
PYTESTS = $(PYVERSIONS:%=runtest/%)
PYMODULES = $(PYVERSIONS:%=modules/%)
EXTMODULES = $(PYVERSIONS:%=extmodules/%)
TESTRESULTS = $(PYVERSIONS:%=testresults/%)

REQUIREMENTS = requirements.txt

TARGET = all
all := TARGET = all
install := TARGET = install
install-cmd := TARGET = install
clean := TARGET = clean
clobber := TARGET = clobber
check := TARGET = check
packages := TARGET = install
test := TARGET = install

SUBDIRS=brand util/mkcert man po svc web
SUBDIRS= cffi_src modules brand util man po svc web
brand: cffi_src modules util $(EXTMODULES)

all: $(SUBDIRS)

build: $(PYVERSIONS)
install: install-cmd $(SUBDIRS) $(EXTMODULES)

install: $(PYVERSIONS) .WAIT $(PYMODULES) .WAIT $(SUBDIRS)

clean: $(SUBDIRS) $(PYVERSIONS)
@cd pkg; pwd; make clean

clobber: $(SUBDIRS) $(PYVERSONS)
@cd pkg; pwd; make clobber
clean clobber: $(SUBDIRS) pkg

packages: install
@cd pkg; pwd; $(MAKE) $(TARGET) check \
Expand All @@ -78,17 +79,17 @@ baseline: _bandit
python$(PYVER) -m bandit -r -q -c tests/banditrc . \
-o tests/bandit-baseline.json -f json || true

$(SUBDIRS) cffi_src: FRC
$(SUBDIRS) pkg: FRC
@cd $@; pwd; $(MAKE) $(TARGET) CC=$(CC)

$(PYVERSIONS): FRC
python$@ setup.py $(TARGET)
install-cmd: FRC
$(MAKE) -f Makefile.cmd $(TARGET)

$(PYMODULES): FRC
$(EXTMODULES):
../tools/installmodules $(CODE_WS) $(ROOT) $(@F) \
$(TARGET) $(ROOTPKGLIB) core $(REQUIREMENTS)

$(PYTESTS): $(PYMODULES)
$(PYTESTS): $(EXTMODULES)
-pfexec python$(@F) tests/run.py -t -j $(JOBS)
-pfexec cp tests/failures.3 tests/failures.$(@F)
-pfexec cp tests/timing_info.txt tests/timing_info.$(@F)
Expand All @@ -100,5 +101,3 @@ $(TESTRESULTS): $(PYTESTS)

FRC:

.NO_PARALLEL: $(PYVERSIONS) $(PYTESTS)

65 changes: 65 additions & 0 deletions src/Makefile.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
#

include Makefile.com

BINS = \
pkg \
pkgdepend \
pkgrepo \
pkgdiff \
pkgfmt \
pkglint \
pkgmerge \
pkgmogrify \
pkgsurf \
pkgsend \
pkgrecv \
pkgsign

LIBS = \
pkg.depotd

TARGETS= $(BINS:%=$(ROOTUSRBIN)/%) $(LIBS:%=$(ROOTUSRLIB)/%)

$(ROOTUSRBIN)/pkg := SRC = client.py
$(ROOTUSRBIN)/pkgdepend := SRC = pkgdep.py
$(ROOTUSRBIN)/pkgrepo := SRC = pkgrepo.py
$(ROOTUSRBIN)/pkgdiff := SRC = util/publish/pkgdiff.py
$(ROOTUSRBIN)/pkgfmt := SRC = util/publish/pkgfmt.py
$(ROOTUSRBIN)/pkglint := SRC = util/publish/pkglint.py
$(ROOTUSRBIN)/pkgmerge := SRC = util/publish/pkgmerge.py
$(ROOTUSRBIN)/pkgmogrify := SRC = util/publish/pkgmogrify.py
$(ROOTUSRBIN)/pkgsurf := SRC = util/publish/pkgsurf.py
$(ROOTUSRBIN)/pkgsend := SRC = publish.py
$(ROOTUSRBIN)/pkgrecv := SRC = pull.py
$(ROOTUSRBIN)/pkgsign := SRC = sign.py
$(ROOTUSRLIB)/pkg.depotd := SRC = depot.py

all clean clobber:

install: $(TARGETS)
python$(PYVER) $(PYCOMPILE_OPTS) $(TARGETS)

$(TARGETS): FRC
$(MKDIR) $(@D)
$(RM) $@
$(SED) '1s/python3 /python$(PYVER) /' < $(SRC) > $@
$(CHMOD) 555 $@

# shebang...

FRC:

8 changes: 7 additions & 1 deletion src/Makefile.com
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ ROOTETC = $(ROOT)/etc
ROOTETCZONES = $(ROOTETC)/zones
ROOTETCBRAND = $(ROOTETC)/brand
ROOTUSRLIB = $(ROOT)/usr/lib
ROOTUSRBIN = $(ROOT)/usr/bin
ROOTUSRSHARE = $(ROOT)/usr/share
ROOTUSRSHARELOCALE = $(ROOTUSRSHARE)/locale
ROOTBRAND = $(ROOTUSRLIB)/brand
ROOTPKGLIB = $(ROOTUSRLIB)/pkg
TRIPLET = x86_64-pc-solaris2

CC = /usr/bin/gcc-13
CC = /usr/bin/gcc-14
CFLAGS = -m64 -Wall -Werror -Wextra -gdwarf-2 -gstrict-dwarf \
-fno-aggressive-loop-optimizations
CPPFLAGS = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
Expand All @@ -43,9 +45,13 @@ STRIP = /usr/bin/strip
RM = /usr/bin/rm -f
MV = /usr/bin/mv
MKDIR = /usr/bin/mkdir -p
RMDIR = /usr/bin/rmdir
SED = /usr/bin/sed
CHMOD = /usr/bin/chmod

CTFCONVERT_BIN = $(CTFCONVERT) -l pkg5
POST_PROCESS = $(CTFCONVERT_BIN) $@; $(STRIP) -x $@
PYCOMPILE_OPTS = -m compileall -j0 -f --invalidation-mode timestamp

PRE_HASH= pre\#
HASH= $(PRE_HASH:pre\%=%)
Expand Down
29 changes: 15 additions & 14 deletions src/cffi_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@
#

#
# Copyright 2023 OmniOS Community Edition (OmniOSce) Association.
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
#

EXTENSIONS= arch sha512_t sysattr syscallat
SOURCES= $(EXTENSIONS:%=_%.c)
OUTDIR= cffi_src
include ../Makefile.com

all: $(SOURCES)
SUBDIRS= $(PYVERSIONS:%=src/%)

$(OUTDIR): FRC
mkdir $@
all := TARGET = all
install := TARGET = install
clean := TARGET = clean
clobber := TARGET = clobber

_%.c: $(OUTDIR) build_%.py
./$<
mv $(OUTDIR)/$@ .
all install clean: $(SUBDIRS)

clean:
rm -f $(SOURCES)
clobber: $(SUBDIRS)
$(RMDIR) $(SUBDIRS) src

clobber: clean
rm -rf $(OUTDIR)
check:

$(SUBDIRS): FRC
$(MKDIR) $@
@cd $@; pwd; $(MAKE) -f ../../Makefile.ext $(TARGET) USEPY=$(@F)

FRC:

53 changes: 53 additions & 0 deletions src/cffi_src/Makefile.crossext
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
#

#
# This file is used instead of Makefile.ext when cross-compiling as the FFI
# module is not available in the python cross environment.
#

include ../../../Makefile.com

SUSEPY.cmd = echo $(USEPY) | tr -d .
SUSEPY = $(SUSEPY.cmd:sh)

ROOTPYPKG= $(ROOT)/usr/lib/python$(USEPY)/vendor-packages/pkg

EXTENSIONS= arch sha512_t sysattr syscallat
SOBJ= $(EXTENSIONS:%=_%.cpython-$(SUSEPY)-$(TRIPLET).so)

_sha512_t.cpython-%.so := LDFLAGS = -lmd
_sysattr.cpython-%.so := LDFLAGS = -lnvpair

all: $(SOBJ)

install: all $(ROOTPYPKG) $(SOBJ:%=$(ROOTPYPKG)/%)

clean:
clobber:
$(RM) $(SOBJ)

$(ROOTPYPKG): FRC
$(MKDIR) $@

$(ROOTPYPKG)/%.so: %.so
$(MKDIR) $(@D)
$(RM) $@; $(INSTALL) -f $(@D) -m 0555 $<

%.cpython-$(SUSEPY)-$(TRIPLET).so: %.c
$(CC) -shared -fPIC $< $(PYCFLAGS) $(PYLDFLAGS) $(LDFLAGS) -o $@

FRC:

50 changes: 50 additions & 0 deletions src/cffi_src/Makefile.ext
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
#

include ../../../Makefile.com

SUSEPY.cmd = echo $(USEPY) | tr -d .
SUSEPY = $(SUSEPY.cmd:sh)

ROOTPYPKG= $(ROOT)/usr/lib/python$(USEPY)/vendor-packages/pkg

EXTENSIONS= arch sha512_t sysattr syscallat
SOURCES= $(EXTENSIONS:%=_%.c)
SOBJ= $(EXTENSIONS:%=_%.cpython-$(SUSEPY)-$(TRIPLET).so)
ROOTSOBJ = $(SOBJ:%=$(ROOTPYPKG)/%)

all: $(SOURCES)

install: $(ROOTPYPKG) $(ROOTSOBJ)

clean:
$(RM) $(SOURCES) $(SOURCES:%.c=%.o)

clobber: clean
$(RM) *.so

$(ROOTSOBJ): $(SOURCES)

$(ROOTPYPKG): FRC
$(MKDIR) $@

$(ROOTPYPKG)/%: %
$(RM) $@; $(INSTALL) -f $(@D) -m 0555 $<

_%.c: ../../build_%.py
python$(USEPY) $<

FRC:

3 changes: 2 additions & 1 deletion src/cffi_src/build_arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <sys/systeminfo.h>
#include <stdlib.h>
""",
extra_compile_args=["-O3"],
)

ffi.cdef(
Expand All @@ -54,7 +55,7 @@
)

if __name__ == "__main__":
ffi.emit_c_code("cffi_src/_arch.c")
ffi.compile(verbose=False)

# Vim hints
# vim:ts=4:sw=4:et:fdm=marker
4 changes: 3 additions & 1 deletion src/cffi_src/build_sha512_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <sys/sha2.h>
#include <string.h>
""",
extra_compile_args=["-O3"],
libraries=["md"],
)

ffi.cdef(
Expand Down Expand Up @@ -70,7 +72,7 @@
)

if __name__ == "__main__":
ffi.emit_c_code("cffi_src/_sha512_t.c")
ffi.compile(verbose=False)

# Vim hints
# vim:ts=4:sw=4:et:fdm=marker
Loading
Loading