41 Commits

Author SHA1 Message Date
Dan Streetman
ff66707a4c Add mode param to download_text() to allow using custom modes like 'rb' 2021-05-28 16:14:51 -04:00
Dan Streetman
e5a42b1ba1 misc: add verify_file_checksums() function
Signed-off-by: Dan Streetman <ddstreet@canonical.com>
2021-02-02 06:25:12 -05:00
Dan Streetman
b89ad962f4 misc: add download_text() method
Signed-off-by: Dan Streetman <ddstreet@canonical.com>
2021-02-02 06:25:12 -05:00
Dan Streetman
a26a154bc9 misc: move logic into download() to handle plain file paths, and src == dst
Update download() function to handle src of plain path, by prepending
'file://' to it.  Also handle the case of src and dst pointing to the same
file.

Signed-off-by: Dan Streetman <ddstreet@canonical.com>
2021-02-02 06:25:12 -05:00
Dan Streetman
248cf38d79 misc: update download() function
-require 'dst' parameter
-allow 'dst' parameter to be dir or dest file
-use contextlib.suppress instead of try/except/pass

Signed-off-by: Dan Streetman <ddstreet@canonical.com>
2021-02-02 06:25:12 -05:00
Dan Streetman
8aa2d602c5 pullpkg: add support for pulling from upload queue 2020-03-13 10:02:05 -04:00
Dan Streetman
ea30b9f5bc ubuntutools/misc: add download() function
Move the download functionality from the archive.py into the common
misc.py file.
2020-03-13 10:02:05 -04:00
Dan Streetman
8ebd086aac ubuntutools/misc: add verify_file_checksum function 2020-03-06 13:01:37 +01:00
Dan Streetman
9f428e471b ubuntutools/misc: convert print() to std logging 2020-03-06 13:01:37 +01:00
Dan Streetman
7c097b19ba ubuntutools: add --status param to pull-pkg
Allow specifying what package statuses should be searched for.

By default search only for Pending and Published, unless a specific
version number is being searched for.
2019-11-25 10:10:06 -05:00
Dan Streetman
d0aa64a51b ubuntutools/misc: define POCKETS and DEFAULT_POCKETS
POCKETS is all valid pockets (capitalized), DEFAULT_POCKETS is all in
POCKETS except 'Backports'.
2019-11-25 09:57:54 -05:00
Mattia Rizzolo
21adb8f61f
fix flake8 warning
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
2019-09-26 11:05:48 +02:00
Stefano Rivera
317b68bc08 Use a context manager for opening files 2019-09-11 13:38:42 -03:00
Stefano Rivera
7a6b779e77 ubuntutools.misc: Replace Popen() calls with check_output() 2019-09-11 13:38:42 -03:00
Stefano Rivera
301569e809 Pull out Python 2 support hacks 2019-09-04 19:24:44 -03:00
Stefano Rivera
43ad610a66 Add encoding support to our Popen wrapper 2019-09-04 19:24:44 -03:00
Benjamin Drung
cc7170eccb Fix all flake8 issues 2017-05-01 00:20:03 +02:00
Dimitri John Ledkov
1558b91dde misc.py 2014-12-18 20:34:04 +00:00
Stefano Rivera
9ba1790863 pull-lp-source, requestbackport: Take the latest version from any
non-backports pocket. Implemented by making lpapicache's getSourcePackage
smarter.
2011-11-23 01:45:49 +02:00
Benjamin Drung
e591ab20cf backportpackage: Use Ubuntu and Debian as fall back check in codename_to_distribution to allow backporting to Ubuntu from a Debian system (LP: #823832). 2011-09-08 18:21:57 +02:00
Benjamin Drung
e9efe8d0f0 pull-lp-source: Support source packages with a bad version string
(LP: #844682).
2011-09-08 16:40:29 +02:00
Benjamin Drung
ce2f96bc0d Make pylint happier and code more PEP-8 compliant. 2011-08-20 11:31:02 +02:00
Benjamin Drung
a03fa654f3 Move debian-distro-info, distro-info, and ubuntu-distro-info from
ubuntu-dev-tools into distro-info.
2011-06-25 17:53:44 +02:00
Evan Broder
19c33e5e32 * ubuntutools.subprocess:
- New drop-in replacement wrapper module around subprocess that
    backports the restore_signals kwarg and defaults close_fds=True
  - Switch everything previously using subprocess to use
    ubuntutools.subprocess instead (LP: #785854)
2011-06-24 16:32:07 +02:00
Benjamin Drung
de32133e75 distro_info.py: Add validity check method. 2011-06-15 00:01:49 +02:00
Evan Broder
16300e471f Move vendor_to_distroinfo and codename_to_distribution into ubuntutools.misc 2011-06-11 06:04:09 -07:00
Evan Broder
2398d09ba4 ubuntutools.misc: Add a new "system_distribution_chain", which returns
a list starting with the current distribution and working its way up
each distribution's parent.
2011-06-11 05:05:35 -07:00
Evan Broder
d82e65e0e2 * ubuntutools.subprocess:
- New drop-in replacement wrapper module around subprocess that
    backports the restore_signals kwarg and defaults close_fds=True
  - Switch everything previously using subprocess to use
    ubuntutools.subprocess instead (LP: #785854)
2011-05-24 20:22:37 +02:00
Stefano Rivera
d054dcf796 requestsync, grep-merges: Require a UTF-8 locale. (Closes: #613114,
LP: #553795)
2011-02-13 16:15:24 +02:00
Stefano Rivera
2c27cf68a6 Move common downloading code into new ubuntutools.mirrors. Use in backportpackage, pull-debian-debdiff, pull-lp-source 2010-12-28 00:23:53 +02:00
Benjamin Drung
2ba510bb89 Fix invalid name pylint report. 2010-12-27 22:33:01 +01:00
Stefano Rivera
0d51908f40 Add mirror support to pull-lp-source 2010-12-24 12:00:03 +02:00
Benjamin Drung
c28ddf5698 Wrap all long lines in ubuntutools. 2010-12-23 20:42:21 +01:00
Stefano Rivera
f347770b46 Use dpkg-vendor in ubuntutools.misc.system_distribution(), cache result. 2010-12-02 09:34:09 +02:00
Stefano Rivera
516b264a8f Strip trailing whitespace 2010-12-02 09:33:54 +02:00
Luca Falavigna
4b13534eea * ubuntutools/misc.py:
- Use output of dpkg --print-architecture command to correctly display
    platform architecture
2010-09-20 18:12:39 +02: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
Siegfried-Angel Gevatter Pujals
ea9ee6d0a7 Simplify some code. 2009-10-25 14:32:36 +01:00
Siegfried-Angel Gevatter Pujals
ab78b51a9f * debian/control:
- Improve description of pbuilder-dist and mention cowbuilder-dist.
  * pbuilder-dist:
     - Abort if the host's architecture can't be determined.
     - Error out instead of showing a traceback if pbuilder-dist is called
       without any argument.
  * pbuilder-dist, ubuntutools/misc.py:
     - Move the functions used to determine the hosts architecture and
       distribution to the ubuntutools.misc module.
2009-10-25 13:57:39 +01:00
Jonathan Davies
18a289f7ec * Removed ubuntutools/misc.py's mkdir function - superseded by
os.makedirs().
2009-01-26 09:34:09 +00:00
Jonathan Davies
66e11f7e49 * common.py: Split into multiple files in ubuntutools/.
* buildd: Converted new imports.
2009-01-19 17:55:00 +00:00