Skip to content

GH-55495: [Packaging][deb] Extract source archive like dpkg-source in apt/build.sh - #55496

Open
kou wants to merge 1 commit into
apache:mainfrom
kou:apt-build-top-dir
Open

kou wants to merge 1 commit into
apache:mainfrom
kou:apt-build-top-dir

Conversation

@kou

@kou kou commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

dev/tasks/linux-packages/apt/build.sh assumes that the top-level directory in the source archive is ${PACKAGE}-${VERSION}/. It needs special cases for ~dev and ~rc versions because their source archives use different top-level directory names.

dpkg-source doesn't assume the top-level directory name. If the archive has only one top-level directory, it uses the directory whatever its name is.

What changes are included in this PR?

Extract the source archive like dpkg-source does:

  1. Extract the archive into a temporary directory.
  2. If the temporary directory has only one entry and it's a directory (not a symbolic link), rename it to ${PACKAGE}-${VERSION}. Otherwise, rename the temporary directory itself to ${PACKAGE}-${VERSION}.

The ~dev/~rc special cases are removed.

apache-arrow-apt-source no longer needs to re-create its source archive to rename the top-level directory for apt/build.sh. It just copies the source archive like apache-arrow does.

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

Copilot AI balanced review requested due to automatic review settings November 11, 2026 07:54
@kou kou added the CI: Extra: Package: Linux Run extra Linux Packages CI label Nov 11, 2026
@github-actions

Copy link
Copy Markdown

⚠️ GitHub issue #55495 has been automatically assigned in GitHub to PR creator.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the source-extraction changes.

No open issues 🎉

What changed in this PR

Updates Debian package source extraction to follow dpkg-source behavior, removing the dependency on archive directory names and addressing GH-55495.

Changes:

  • Extracts source archives into a temporary directory.
  • Uses a sole top-level directory if it is not a symbolic link; otherwise, uses the entire extracted tree.
  • Removes special-case directory renaming for ~dev and ~rc versions.
File Description
dev/​tasks/​linux-packages/​apt/​build.sh Normalizes extracted sources to ${PACKAGE}-${VERSION} regardless of archive layout.

Review effort: Balanced

…rce in apt/build.sh

### Rationale for this change

`dev/tasks/linux-packages/apt/build.sh` assumes that the top-level directory in the source archive is `${PACKAGE}-${VERSION}/`. It needs special cases for `~dev` and `~rc` versions because their source archives use different top-level directory names.

`dpkg-source` doesn't assume the top-level directory name. If the archive has only one top-level directory, it uses the directory whatever its name is.

### What changes are included in this PR?

Extract the source archive like `dpkg-source` does:

1. Extract the archive into a temporary directory.
2. If the temporary directory has only one entry and it's a directory (not a symbolic link), rename it to `${PACKAGE}-${VERSION}`. Otherwise, rename the temporary directory itself to `${PACKAGE}-${VERSION}`.

The `~dev`/`~rc` special cases are removed.

`apache-arrow-apt-source` no longer needs to re-create its source archive to rename the top-level directory for `apt/build.sh`. It just copies the source archive like `apache-arrow` does.

### Are these changes tested?

Yes.

I tested the extraction logic locally with archives that have one top-level directory with an arbitrary name, a hidden top-level directory, multiple entries, a single file, a dot file with a directory and a symbolic link to a directory. I also tested it with the 23.0.1 source archive.

Package builds are tested by CI.

### Are there any user-facing changes?

No.

### Was AI used for this PR?

In accordance to the [AI generation guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code), please disclose below whether and how AI was used in this PR.

**PR code and description written by:**

- [x] Human
- [x] AI

**Reviewed before submission by:**

- [x] Human
- [ ] AI
- [ ] Not reviewed

* GitHub Issue: apache#55495

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kou
kou force-pushed the apt-build-top-dir branch from 38aed0f to 389c57f Compare November 11, 2026 21:44
Copilot AI balanced review requested due to automatic review settings November 11, 2026 21:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the Debian source-archive packaging changes.

No open issues 🎉

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: Extra: Package: Linux Run extra Linux Packages CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants