-
Notifications
You must be signed in to change notification settings - Fork 327
Native Debian packaging #2602
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
base: master
Are you sure you want to change the base?
Native Debian packaging #2602
Conversation
This native packaging is nearly identical to the non-native packaging that will in the future enter Debian. The native packaging can be used to do test builds or distribute .deb packages of TiUP directly by PingCAP.
As the golang-github-shirou-gopsutil-dev package v4.25.2 in Debian is
newer than the v3.21.11 in go.mod of TiUP, the Debian build failed on:
src/github.com/pingcap/tiup/pkg/insight/process.go:165:24: cannot use proc.Status() (value of type []string) as string value in assignment
src/github.com/pingcap/tiup/pkg/insight/process_linux.go:24:38: undefined: process.ClockTicks
Apply these changes on TiUP to make it compatible:
- The `proc.Status()` method now returns a slice of strings (`[]string`)
instead of a single string. Update the assignment to take the first
element of the slice, assuming it contains the primary status
information. Add a check for an empty slice to prevent panics.
- The `process.ClockTicks` constant and the related logic for parsing
`/proc/[pid]/stat` are no longer supported. Replace this with a call
to `proc.CreateTime()`, which provides the process creation time in
milliseconds since the Unix epoch. Convert this value to seconds for
the `StartTime` field.
Additionally, remove unused import statements to avoid failures on:
src/github.com/pingcap/tiup/pkg/insight/process_linux.go:8:2: "os" imported and not used
src/github.com/pingcap/tiup/pkg/insight/process_linux.go:9:2: "strconv" imported and not used
src/github.com/pingcap/tiup/pkg/insight/process_linux.go:10:2: "strings" imported and not used
As the golang-github-xo-usql-dev package v0.19.19 in Debian is
newer than the v0.9.5 in go.mod of TiUP, the Debian build failed on:
src/github.com/pingcap/tiup/components/client/main.go:98:33: not enough arguments in call to rline.New
have (bool, string, string)
want (bool, bool, bool, string, string)
src/github.com/pingcap/tiup/components/client/main.go:102:70: not enough arguments in call to handler.New
have (rline.IO, *user.User, string, bool)
want (rline.IO, *user.User, string, billy.Filesystem, bool)
Apply these changes on TiUP to make it compatible:
- `rline.New` now requires two additional boolean arguments. These are
set to `false` as safe defaults.
- `handler.New` now requires a `billy.Filesystem` argument. This is
provided by importing `osfs` and creating a new `osfs.New` instance
using the instance data directory.
Enable TiUP to operate correctly and robustly when installed via an external package manager (e.g., Debian, RPM, Homebrew). Allow TiUP to run without requiring network access to its online repository for initial setup or updates, which is crucial for production systems and environments with restricted connectivity. Achieve this by introducing the boolean flag `IsPackagedBuild`, which is intended to be hard-coded to `true` in binaries produced by package maintainers. When `IsPackagedBuild` is true: - The initial environment setup skips connecting to the online repository, relying instead on local files. - The automatic update check before running a component is skipped. - A message is printed to stderr indicating that online interaction is skipped, informing the user of the different behavior. - Functions related to *forced* self-updating TiUP return an error, explicitly disabling these operations in packaged builds. Users should still be able to install/update when explicitly running those commands. - Use the system-wide location `/usr/share/tiup/root.json` for initial trust setup and assume this file came with the package. This aligns with typical system package practices.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Have a
debian/subdirectory upstream with native Debian packaging, so.debpackages can be created directly frommasterbranch or the purposes of testing that new changes upstream do not regress Debian packaging, and/or can be used to publish.debpackages directly by PingCAP.The contents of this
debian/is similar, but not identical to the non-native official packaging (if) in Debian.Related to: #2508
What is changed and how it works?
Given the proper build environment with extra PPA enabled, running
dpkg-buildpackage -us -uccan produce.debpackages out of this.Additional changes are needed for a full end-to-end build automation solution. For example the
debian/changelogentry and version are now static.Check List
Tests
Code changes
Branch includes commits from
Side effects #2538 and #2601 which should be reviewed and merged separately, and this PR later rebased and merged as the last thing.