tuhaihe commented on code in PR #1609:
URL: https://github.com/apache/cloudberry/pull/1609#discussion_r2928962146


##########
devops/build/packaging/deb/ubuntu22.04/rules:
##########
@@ -19,7 +19,22 @@ include /usr/share/dpkg/default.mk
        dh $@ --parallel
 
 gpinstall:
-       make install DESTDIR=${DEBIAN_DESTINATION} prefix=
+       # If the build staging directory is empty, copy from the pre-installed 
location.
+       # In CI, BUILD_DESTINATION already points here so it will be populated.
+       # For local manual packaging, copy from the installed Cloudberry path.
+       @mkdir -p ${DEBIAN_DESTINATION}
+       @if [ -z "$$(ls -A ${DEBIAN_DESTINATION} 2>/dev/null)" ]; then \
+               echo "Copying pre-built binaries from ${CBDB_BIN_PATH} to 
${DEBIAN_DESTINATION}..."; \
+               cp -a ${CBDB_BIN_PATH}/* ${DEBIAN_DESTINATION}/; \
+       else \
+               echo "Build staging directory already populated, skipping 
copy."; \
+       fi
+       # Copy Apache compliance files into the build staging directory
+       cp -a LICENSE NOTICE DISCLAIMER ${DEBIAN_DESTINATION}/
+       cp -a licenses ${DEBIAN_DESTINATION}/
+       # Create debian/copyright for Debian policy compliance
+       mkdir -p $(shell pwd)/debian
+       cat LICENSE NOTICE > $(shell pwd)/debian/copyright

Review Comment:
   Thanks for catching this! The `make install` was replaced with a conditional 
copy mechanism, not simply removed. Here's the updated logic (lines 22–31 in 
the new rules file):
   
   ```makefile
   @mkdir -p ${DEBIAN_DESTINATION}
   @if [ -z "$$(ls -A ${DEBIAN_DESTINATION} 2>/dev/null)" ]; then \
       echo "Copying pre-built binaries from ${CBDB_BIN_PATH} to 
${DEBIAN_DESTINATION}..."; \
       cp -a ${CBDB_BIN_PATH}/* ${DEBIAN_DESTINATION}/; \
   else \
       echo "Build staging directory already populated, skipping copy."; \
   fi
   ```
   
   How it works:
   
   - In CI: The build workflow already sets 
`BUILD_DESTINATION=${SRC_DIR}/debian/build`, so the configure and build scripts 
install all binaries directly into `debian/build/`. When `gpinstall` runs, the 
directory is already populated → skip the copy.
   - For local/manual packaging: If a developer has already compiled and 
installed Cloudberry to `/usr/local/cloudberry-db`, they can run `build-deb.sh`
    directly. The staging directory will be empty → binaries are copied from 
the installed path.
   
   The original `make install DESTDIR=... prefix=` would re-run the install 
step from the source tree, which requires the full build state to still be 
present. The new approach is more flexible and avoids redundant work in both 
scenarios.
   
   All binaries are still fully included in the package — only the mechanism 
for populating the staging directory changed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to