Skip to content
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

Failed to supply deb-src in Ubuntu 24.04 #125

Closed
oToToT opened this issue Jan 1, 2025 · 8 comments · Fixed by #127
Closed

Failed to supply deb-src in Ubuntu 24.04 #125

oToToT opened this issue Jan 1, 2025 · 8 comments · Fixed by #127

Comments

@oToToT
Copy link
Contributor

oToToT commented Jan 1, 2025

In my ubuntu 24.04 setup, I don't have any *.list in /etc/apt/sources.list.d.

Instead, I have *.sources file in /etc/apt/sources.list.d, which have a different format than the original list file.

It seems like the current script will try to add deb-src when needed.

if [ "$type" = deb ]; then
echo "deb $url $suite $rest"
echo "deb-src $url $suite $rest"
fi

However, this method does not work on ubuntu 24.04 anymore because *.list no longer exists.

I think we need to find a way to deal with the new *.sources file, but not sure what's the best way to handle it though.

@oToToT
Copy link
Contributor Author

oToToT commented Jan 1, 2025

Maybe I can try submit a PR to include https://askubuntu.com/a/1512043? Nonetheless, I think I still need to parse the file and ensure it's about distro.

@matt335672
Copy link
Member

I think this was fixed in #120

Try the latest version of the git devel branch rather than the release.

@matt335672
Copy link
Member

Scrub that - I've just run into the same issues with that latest version. I'll look further....

@oToToT
Copy link
Contributor Author

oToToT commented Jan 2, 2025

IIUC #120 only copies *.sources files, but it does not add deb-src into it. Thus, it does help with the case if you're using *.sources and deb-src is already presented.

However, in my case, my Ubuntu 24.04 uses *.sources but deb-src is not presented, so I need to add deb-src manually.

@matt335672
Copy link
Member

You're absolutely right.

I'll need a second or two to get up to speed on this. I've not needed to look at this for a while as most people are using pipewire these days.

@matt335672
Copy link
Member

Here's a patch which I'd welcome comments on:-

diff --git a/scripts/install_pulseaudio_sources_apt.sh b/scripts/install_pulseaudio_sources_apt.sh
index af0debd..c4d7357 100755
--- a/scripts/install_pulseaudio_sources_apt.sh
+++ b/scripts/install_pulseaudio_sources_apt.sh
@@ -61,7 +61,8 @@ if [ ! -d "$PULSE_DIR" ]; then
         Ubuntu)
             # Enable the universe repository. Don't use add-apt-repository
             # as this has a huge number of dependencies.
-            if ! grep -q '^ *[^#].* universe *' /etc/apt/sources.list; then
+            if [ -f /etc/apt/sources.list ] && \
+                ! grep -q '^ *[^#].* universe *' /etc/apt/sources.list; then
                 echo "- Adding 'universe' repository" >&2
                 cp /etc/apt/sources.list /tmp/sources.list
                 while read type url suite rest; do
@@ -101,11 +102,20 @@ if [ ! -d "$PULSE_DIR" ]; then
 
     sudo rm $SRCLIST ;# Remove source respositories
 
-    # remove duplicates from the combined source.list in order to prevent
-    # apt warnings/errors; this is useful in cases where the user has
-    # already configured source code repositories.
-    sort -u < /tmp/combined_sources.list | \
-        sudo tee /etc/apt/sources.list > /dev/null
+    if [ -s /tmp/combined_sources.list ]; then
+        # Old-style system using .list files
+
+        # remove duplicates from the combined source.list in order to prevent
+        # apt warnings/errors; this is useful in cases where the user has
+        # already configured source code repositories.
+        sort -u < /tmp/combined_sources.list | \
+            sudo tee /etc/apt/sources.list > /dev/null
+    fi
+
+    # Cater for new-style .sources files
+    for src in $(find /etc/apt/sources.list.d -maxdepth 1 -type f -name '*.sources'); do
+        sudo sed -i 's/^Types: deb/Types: deb deb-src/' "$src"
+    done
 
     sudo apt-get update
 

I'll look at your PR tomorrow (out of time today), but I'm not seeing the same error as you at the moment.

@oToToT
Copy link
Contributor Author

oToToT commented Jan 3, 2025

I'm not an expert of Ubuntu sources file.

However, given the comment in

# Ignore other suites. This is needed when running the wrapper in a
# derivative-distro (like Linux Mint 21.2 'victoria') with --suite
# option (--suite=jammy).

I'm not sure if we also need to do the same check as in

case "$suite" in
$codename | $codename-updates | $codename-security)
if [ "$type" = deb ]; then
echo "deb $url $suite $rest"
echo "deb-src $url $suite $rest"
fi
;;
esac

Otherwise, we may be adding deb-src to non-necessary packages.

@matt335672
Copy link
Member

matt335672 commented Jan 3, 2025

Thanks for that @oToToT. I'll look at it.

PS: I'm aware of the broken CI as well for your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants