jw-pkg distro dup got hung in a chroot environment. strace shows that
write(2) into a pipe is the hanging syscall, with the write buffer
hinting at zypper dup output.
I strongly suspect that run_cmd() tries to write stdout into the pipe
which read_stream() fails to empty. So, make read_stream() more
resilient by using read(4096) instead of readline(), which I suspect
to be prone to hang on overlong lines.
Signed-off-by: Jan Lindemann <jan@janware.com>
--fix-broken is added to apt-get options in non-interactive mode, but
seems to work only with apt-get install, not with apt-get update.
Don't add it at all for now.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add utility method .dpkg() to the backend.debian.Utils class, saving
the need to import it, saving the need to import it.
Signed-off-by: Jan Lindemann <jan@janware.com>
apt_get(), like all other functions and methods spawning processes
should take a list instead of a starred *args array. Implement that.
Signed-off-by: Jan Lindemann <jan@janware.com>
Rename the "packages" argument to "names" to be a little more
consistent with the pkg subcommand argument nomenclature.
Signed-off-by: Jan Lindemann <jan@janware.com>
run_cmd() with cmd_input == mode:interactive and verbose == true
logs output too often. First, __log() is called, then pty.spawn()
writes everything it reads from the PTY master to the terminal.
The fix it to not call __log() from _read() for the PTY reader.
Signed-off-by: Jan Lindemann <jan@janware.com>
Support distro pkg meta <package names ...>, returning meta
information for the specified package names.
Signed-off-by: Jan Lindemann <jan@janware.com>
As with cmds.distro.lib.rpm, the dpkg module is a place for Python
abstractions of the Debian package manager tools dpkg and friends.
Signed-off-by: Jan Lindemann <jan@janware.com>
Replace all_installed_packages() by query_packages(). The function
takes an optional list of packages to be queried. If it's empty, a
list of all installed packages are returned.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add more methods, to make Package more useful:
- __repr__()
- Class-mMethods to help with parsing of strings gathered from the
OS-tools' output:
parse_spec_str()
parse_specs_str()
order_tags()
- Add field maintainer
Signed-off-by: Jan Lindemann <jan@janware.com>
Make all pkg commands take a "names" argument (plural) instead of
"name", and make it a non-option-argument, to be passed to the
subcomand instead.
Signed-off-by: Jan Lindemann <jan@janware.com>
There's no "Homepage" meta tag in the .deb files created by jw-pkg,
add one.
Also, generate an e-mail address <global.jw-maintainer>@janware.com
to go into the Maintainer field. Not ideal, but a low-hanging fruit.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add --download-only to the options of jw-pkg.py distro dup, which
makes the command only download packages from the repositories
without installing them.
Signed-off-by: Jan Lindemann <jan@janware.com>
Passing --only-update should keep "jw-pkg.py distro install" from
installing packages that are not already installed on the the system.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add the command distro.CmdRebootRequired, adding support for "distro
reboot-required". The command exits with status code 1 if a reboot is
required and 0 otherwise.
Signed-off-by: Jan Lindemann <jan@janware.com>
If a Cmd-classes's _run() method returns an integer between 0 and
255, use that as the program's exit status.
Signed-off-by: Jan Lindemann <jan@janware.com>
Most run_xxx() return stdout and stderr. There's no way, really, for
the caller to get hold of the exit code of the spawned executable. It
can pass throw=true, catch, and assume a non-zero exit status. But
that's not semantically clean, since the spawned function can well be
a test function which is expected to return a non-zero status code,
and the caller might be interested in what code that was, exactly.
The clearest way to solve this is to return the exit code as well.
This commit does that.
Signed-off-by: Jan Lindemann <jan@janware.com>
HOST_TUPLE is bastardized to contain more info that just the GNU
Triplet. Add HOST_DISTRO_INFO to do the caching job, and leave
HOST_TUPLE alone.
Signed-off-by: Jan Lindemann <jan@janware.com>
pgit.sh logs "Running $0 $@ GIT_SSH=" which is not the exact command
line. Fix that, and prefix log messages with "pgit.sh".
Signed-off-by: Jan Lindemann <jan@janware.com>
get-os.sh returned "suse" for SuSE-like distros, and that seems more
appropriate since SLES is not OpenSUSE but should share and ID with
other SuSE variants.
Signed-off-by: Jan Lindemann <jan@janware.com>
App.distro_id used to return "opensuse-tumbleweed", analogous to
what's in ID@/etc/os-release, but now returns "opensuse", and the
"tumbleweed" goes into "codename". That matches more what Debian-like
distributions do, but it confuses _backend_path. Adapt it to map the
new distro_id correctly.
Signed-off-by: Jan Lindemann <jan@janware.com>
A compiled release package is currently uploaded to a fixed
directory, determine it dynamically for every distro seperately.
Signed-off-by: Jan Lindemann <jan@janware.com>
PKG_FORMAT is now more straightforward to get with from the revised
jw-pkg.py distro info --format '%{cascade}', so do that, and do it in
the context where all the other variables are set from the output of
that command.
Signed-off-by: Jan Lindemann <jan@janware.com>