52 Commits

Author SHA1 Message Date
Benjamin Drung
85f2e46f7d conform to snake_case naming style 2024-11-02 18:07:23 +01:00
Benjamin Drung
649c3db767 ubuntu-build: fix used-before-assignment
```
ubuntu-build:244:40: E0601: Using variable 'necessary_privs' before assignment (used-before-assignment)
```
2024-11-02 17:56:47 +01:00
Benjamin Drung
92c80d7bb7 ubuntu-build: remove unused code/imports 2024-11-02 17:54:06 +01:00
Benjamin Drung
d7362d9ed8 Use Python f-strings
```
flynt -ll 99 -tc -tj -a pbuilder-dist pm-helper running-autopkgtests ubuntu-build ubuntutools
```
2024-11-02 17:49:20 +01:00
Benjamin Drung
c7a855ff20 Format code with black and isort
```
isort pbuilder-dist pm-helper running-autopkgtests ubuntu-build ubuntutools
black -C pbuilder-dist pm-helper running-autopkgtests ubuntu-build ubuntutools
```
2024-11-02 17:21:30 +01:00
Steve Langasek
3df40f6392 Handle exceptions on retry
The "can be retried" value from launchpad may have been cached.  Avoid an
exception when we race someone else retrying a build.
2024-05-26 12:57:14 -07:00
Steve Langasek
c869d07f75 ubuntu-build: don't retry builds Launchpad tells us can't be retried 2024-03-12 11:52:32 -07:00
Steve Langasek
c92fa6502f ubuntu-build: Handling of proposed vs release pocket default for ppas 2024-03-10 21:43:06 -07:00
Steve Langasek
07d3158ade Don't do expensive check of group membership on rescore, just handle exceptions
This could do with some further refactoring, but will probably postpone that
until a decision is made about dropping the non-batch mode
2024-03-10 16:51:15 -07:00
Steve Langasek
d5faa9b133 Proper handling of getDevelopmentSeries() 2024-03-10 15:48:16 -07:00
Steve Langasek
9e710a3d66 Always use exact match when looking for source packages by name 2024-03-10 15:46:22 -07:00
Steve Langasek
010af53d7c Add a -A archive option to act on ppas as well.
This results in a major refactor of the code to use launchpadlib directly
instead of the ubuntutools.lp.lpapicache module in ubuntu-dev-tools which is
idiosyncratic and does not expose the full launchpad API.  Easier to rewrite
to use the standard library.
2024-03-10 14:35:47 -07:00
Steve Langasek
0bef4d7352 ubuntu-build: fix licensing.
Canonical licensing policy has never been GPLv3+, only GPLv3.
2024-03-10 13:36:30 -07:00
Steve Langasek
688202a7cf ubuntu-build: update copyright 2024-03-10 13:35:56 -07:00
Steve Langasek
691c1381db ubuntu-build: support retrying builds in other states that failed-to-build 2024-03-10 01:45:20 -08:00
Steve Langasek
f01502bda2 ubuntu-build: make the --arch option top-level
This gets rid of the fugly --arch2 option
2024-03-08 18:53:20 -08:00
Steve Langasek
42f8e5c0d2 ubuntu-build: in batch mode, print a count of packages retried 2024-03-08 18:38:59 -08:00
Steve Langasek
bb8a9f7394 ubuntu-build: support --batch with no package names to retry all 2024-03-08 16:43:30 -08:00
Gianfranco Costamagna
6f0caf1fc0 ubuntu-build: For some reasons, now you need to be authenticated before trying to use the "PersonTeam" class features.
Do it at the begin instead of replicating the same code inside the tool itself.

This fixes e.g. this failure:

./ubuntu-build --batch --retry morsmall
Traceback (most recent call last):
  File "/tmp/ubuntu-dev-tools/ubuntu-build", line 317, in <module>
    main()
  File "/tmp/ubuntu-dev-tools/ubuntu-build", line 289, in main
    can_retry = args.retry and me.canUploadPackage(
AttributeError: 'NoneType' object has no attribute 'canUploadPackage'
2023-07-07 19:23:41 +02:00
Steve Langasek
ff1c95e2c0 Remove references to architectures not supported in any active Ubuntu release. 2023-05-30 21:05:56 -07:00
Benjamin Drung
aa556af89d Use f-strings
pylint complains about C0209: Formatting a regular string which could be
a f-string (consider-using-f-string)

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 19:32:58 +01:00
Benjamin Drung
444b319c12 Implement refactorings found by pylint
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 16:58:24 +01:00
Benjamin Drung
909d945af4 Replace deprecated optparse with argparse
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 13:33:18 +01:00
Benjamin Drung
f6fde2e217 fix: Use lazy % formatting in logging functions
pylint complains about W1201: Use lazy % formatting in logging functions
(logging-not-lazy) and W1203: Use lazy % formatting in logging functions
(logging-fstring-interpolation).

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-31 11:13:07 +01:00
Benjamin Drung
b1bc7e1cdc Address pylint complaints
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 23:10:31 +01:00
Benjamin Drung
4e27045f49 style: Sort Python imports with isort
```
isort -l 99 --profile=black .
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 21:28:47 +01:00
Benjamin Drung
3354b526b5 style: Format Python code with black
```
PYTHON_SCRIPTS=$(grep -l -r '^#! */usr/bin/python3$' .)
black -C -l 99 . $PYTHON_SCRIPTS
```

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 19:45:36 +01:00
Benjamin Drung
932166484b Fix issues found by flake8 on the Python scripts
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2023-01-30 19:29:30 +01:00
Dan Streetman
7d278cde21 ubuntu-build: use correct exception from LP login failure 2022-08-09 12:15:09 -04:00
Dan Streetman
ad402231db ubuntu-build: explicitly login to LP
LP: #1984113
2022-08-09 12:14:56 -04:00
Dan Streetman
0eeb93ee0c logging: update ubuntutools.getLogger() to output to stdout/stderr correctly
Python logging by default sends all output to stderr, but that's not what
normal programs usually do and is not expected for these scripts.

Change the ubuntutools.getLogger() method to return a logger with handlers
correctly set up to send INFO level (or lower) logs to stdout and WARNING
level (or higher; technically INFO+1 level or higher) logs to stderr.

This results in normally logged output going to stdout and warnings/errors
going to stderr, as expected.
2021-02-02 06:25:12 -05:00
Mattia Rizzolo
0aa7280f94
ubuntu-build: add support for riscv64.
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2020-04-29 00:12:24 +02:00
Dan Streetman
90e8fe81e1 replace ubuntutools.logger with standard python logging 2019-11-25 10:10:06 -05:00
Stefano Rivera
6c375255c4 Port ubuntu-build to Python 3 2019-09-04 19:24:44 -03:00
Iain Lane
4471193d9c ubuntu-build: Pass the pocket through to the archive permission check
So that we can retry builds in releases where the release pocket is frozen -
for example so that backporters can retry backports builds.
2017-05-30 10:12:56 +01:00
Benjamin Drung
cc7170eccb Fix all flake8 issues 2017-05-01 00:20:03 +02:00
Colin Watson
f232d121d2 pbuilder-dist, ubuntu-build: Add s390x. 2016-07-16 10:55:28 +01:00
Dimitri John Ledkov
1ecf020703 * Add ppc64el to valid architectures in pbuilder-dist and ubuntu-build.
* Simplify mirror detection in mk-sbuild, all supported releases, all
  architectures but i386/amd64 are on ports.ubuntu.com
2013-12-20 15:03:55 +00:00
Dmitrijs Ledkovs
06874a8bad add arm64 knowledge to mk-sbuild, ubuntu-build, pbuilder-dist. 2013-10-13 21:54:31 +01:00
Stefano Rivera
8faeb46334 ubuntu-build: Default to DEV-proposed in batch mode. Thanks Scott
Kitterman(LP: #1088010)
2012-12-12 17:25:20 +02:00
Stefano Rivera
fc9ddd974e mk-sbuild, pbuilder-dist, ubuntu-build: Add armhf. 2011-11-29 11:42:40 +02:00
Benjamin Drung
2ba510bb89 Fix invalid name pylint report. 2010-12-27 22:33:01 +01:00
Benjamin Drung
53c5d801f8 ubuntu-build: Make pylint happier. 2010-12-27 19:55:48 +01:00
Stefano Rivera
9fa9f3eb96 Whitespace and style cleanups 2010-12-23 00:01:39 +02:00
Stefano Rivera
d0ed0d83cc Broke ubuntu-build in lat commit. Add missing indent 2010-12-22 23:06:03 +02:00
Stefano Rivera
f01beda01c Convert last Python code from mixed tabs and spaces to spaces 2010-12-22 23:04:29 +02:00
Benjamin Drung
1943df29eb Remove all trailing spaces. 2010-12-03 00:06:43 +01:00
Michael Bienia
cc8ec956b0 Factor our the spliting of the release name and the pocket name into its
own function.
2010-03-20 19:45:04 +01:00
Michael Bienia
f77f947359 ubuntu-build: missed updating a function call. 2010-03-08 18:08:06 +01:00
Michael Bienia
f5c6695e13 ubuntutools/lp/lpapicache.py:
* Make PersonTeam.getMe() a class property (PersonTeam.me).
ubuntutools/requestsync/lp.py, ubuntu-build:
* Update for the above mentioned change.
2010-02-20 18:13:15 +01:00