Two things...
Yes it could be anal glands, and you probably could do that yourself, but it would involve some grossness. google it. the vet can do it, and it's cheap usually. The other thing with pugs is that they are often allergic to things. my pug was farting constantly until we figured out he is allergic to grain. so now he has grain free food and that has solved the problem completely.