#559 command 'sources' should not download sources that are not actually used in the specfile
Closed: Fixed by onosek. Opened by oturpe.

Currently, command sources downloads all sources listed in the sources file
even if they are not actually used in the specfile.
This is waste of resources,
especially because it is a common packager workflow
to first update the specfile,
then do spectool -g *.spec (getting the new sources),
then fedpkg mockbuild.
Mockbuild leads to calling sources,
which in this case never does anything useful:
at best it attempts to do again what spectool already did,
otherwise it downloads unused files from the lookaside cache.
In the worst case lookaside cache and sources file are out of sync,
resulting in an error.

It would be better to only download sources from the lookaside cache
if they are actually used in the specfile.

Implementation proposal:
Before downloading the sources,
read Source entries from the specfile
and filter the sources content by that.
Spectool already has the required regular expressions and stuff,
so it can be used as a model.


Discussion on the Fedora devel mailing list: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/ICMW35NI7I4SDWOW4UHGRSAKN2QZ33IS/

I prefer have one offline option on new-sources (1) , which just update sources without upload the files, note if you update sources file with sha512sum --tag (2) you won't have more downloads of wrong files.

Thank you .

(1)
fedpkg new-sources --offline ${TARBALL_CLEAN} $main_ver $daily_ver
$bytecode_ver

(2)
sha512sum --tag ${TARBALL_CLEAN} $main_ver $daily_ver $bytecode_ver >
sources

After the mailing list discussion I now have an alias now to achieve roughly the same but instead parses the specfile using spectool.

spectool -l *.spec | awk '/https?:/ { print $2 }' | xargs -n 1 basename | xargs sha512sum --tag

I'd still like to see something like some fedpkg command with --offline to take care of this.

@sergiomb @ekohl What you are asking for is actually different from what this issue is about. Anyhow, your request looked like it would be very easy to implement, so I took a look. It was actually even easier than I thought: I was already implemented, just the command line argument was missing! Implemented in #561

Commit 4364afe6 relates to this ticket

Fix for the issue as originally reported: #564

Commit 49c0378b fixes this issue

Metadata Update from @onosek:
- Issue set to the milestone: 1.63

Commit e0bf1381 fixes this issue

Metadata
Related Pull Requests