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
Redo pkg-config handling with library collecting #335
Redo pkg-config handling with library collecting #335
Conversation
3b7bf1b
to
3d1aa66
Compare
libustr-1.0.so.1 | ||
libustr-1.0.so.1.0.4 | ||
libyaml-0.so.2 | ||
libyaml-0.so.2.0.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did you generate this list?
A README file next to this one explaining why and how would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good idea, so far I did it manually with find from an OS snap. This will probably need updating from my Qt comments from last night
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, this could use some documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ElOpio and @kyrofa done https://github.com/ubuntu-core/snapcraft/pull/335/files#diff-2cb561c5e46512465f54a0f84d421c80R66
But is also makes me think if it is worth to make this dynamic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you go about making it dynamic? Would you have to download the OS snap every time?
lgtm, but the elf bits are flying over my head. I'll read more about that tomorrow. |
try: | ||
check_call(['/usr/bin/pkg-config', '--exists'] + modules, env=env) | ||
return True | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except subprocess.CalledProcessError.
We don't want to ignore any other exceptions.
@ElOpio wrt |
ldd_out = [l[2] for l in ldd_out if len(l) > 2 and os.path.exists(l[2])] | ||
|
||
# Anything that is part of the project we don't need to check for | ||
libs = list(filter(lambda x: not x.startswith(os.getcwd()), ldd_out)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two (silly) things that bother me about this line: you're calling os.getcwd
in a loop without expecting it to change, and you switched from list comprehensions to filter+lambda.
5c4d3c0
to
10f8e96
Compare
thanks @chipaca |
831e80b
to
8c27da5
Compare
retest this please |
ffea685
to
411faa3
Compare
retest this please |
411faa3
to
6218bcc
Compare
retest this please |
[self.snapcraft_command, 'snap'], cwd=working_dir, | ||
stderr=subprocess.STDOUT).decode('utf-8') | ||
[self.snapcraft_command, '--debug', 'snap'], cwd=working_dir, | ||
stderr=subprocess.STDOUT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ElOpio I'm lost as with what is going on here:
Traceback (most recent call last):
File "/home/jenkins-slave/workspace/github-snapcraft-examples-tests-cloud/examples_tests/tests.py", line 98, in test_example
self.build_snap(self.example_dir)
File "/home/jenkins-slave/workspace/github-snapcraft-examples-tests-cloud/examples_tests/__init__.py", line 129, in build_snap
stderr=subprocess.STDOUT).decode('utf-8')
File "/usr/lib/python3.5/subprocess.py", line 626, in check_output
**kwargs).stdout
File "/usr/lib/python3.5/subprocess.py", line 708, in run
output=stdout, stderr=stderr)
7ccea33
to
6d9d14c
Compare
6d9d14c
to
f31718f
Compare
@@ -399,6 +398,7 @@ def strip(self, force=False): | |||
self.notify_stage('Stripping') | |||
snap_files, snap_dirs = self.migratable_fileset_for('snap') | |||
_migrate_files(snap_files, snap_dirs, self.stagedir, self.snapdir) | |||
_copy_dependencies(self.snapdir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs tracking and library paths used need to be exported to env
hint for @kyrofa
@@ -265,7 +262,7 @@ def pull(self, force=False): | |||
package_files = set() | |||
package_directories = set() | |||
if self.code.stage_packages: | |||
package_files, package_directories = self._setup_stage_packages() | |||
self._setup_stage_packages() | |||
self.code.pull() | |||
|
|||
# Record the files and directories unpacked from the stage packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably don't need this anymore
hint @kyrofa
f31718f
to
5ba5674
Compare
destination_path = os.path.join(destination, relpath) | ||
|
||
if os.path.isdir(source_path) and not os.path.islink(source_path): | ||
os.makedirs(destination_path, exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyrofa do we need to create these potential empty dirs? The else
clause seems will be able to ensure the directories exist and not migrated until build
happens which is too late for the python plugins.
@ElOpio given these pass on |
@ElOpio I'm still seeing _testtools.testresult.real.StringException: output: {{{No module named 'magic'}}} |
env += part.env(part.installdir) | ||
env += _runtime_env(stagedir) | ||
env += _runtime_env(part.installdir) | ||
env += _runtime_env(part.ubuntu_unpackdir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyrofa python plugins fail to work, I'm thinking it might be due to this, did it work for you?
retest this please |
1 similar comment
retest this please |
Thanks @ElOpio |
5ba5674
to
bcc0b45
Compare
pkg-config only handled PKG_CONFIG_SYSROOT_DIR as the stage dir providing many issues when using packages from installdir for a part and also build-packages from the host. For a full implementation, elf dependency tracking from the host to the snap is also implemented here Add dependency tracking and use it to determine LD_LIBRARY_PATH. Also unpacked stage-packages into an intermediate area in pull() and copied them into installdir in build() to make per-step cleaning work better. LP: #1549570 Signed-off-by: Sergio Schvezov <sergio.schvezov@ubuntu.com> Signed-off-by: Kyle Fazzari <kyle@canonical.com>
bcc0b45
to
4a5de24
Compare
@ElOpio final call is on you 😉 |
flashing... |
@ElOpio how is it doing? |
@sergiusens slooooow... Running in the snappy classic in rpi2. All unit tests passed. The integration tests have been running for an hour: (classic)ubuntu@localhost:~/snapcraft$ ./runtests.sh integration |
@ElOpio hmm, maybe we can fix the sudo issue for armhf this cycle :-) |
@sergiusens I can take a look at that. |
…mate-pkg-config Redo pkg-config handling with library collecting
pkg-config only handled PKG_CONFIG_SYSROOT_DIR as the stage dir
providing many issues when using packages from installdir for a part
and also build-packages from the host.
For a full implementation, elf dependency tracking from the host
to the snap is also implemented here
LP: #1549570
Signed-off-by: Sergio Schvezov sergio.schvezov@ubuntu.com